Move files used by makeboarddeb to packages/bsp subdirectory

Remove obsolete sunxi-musb script - should be handled with DT overlays
Remove unused build-kernel/post-install script
This commit is contained in:
zador-blood-stained 2017-07-17 19:29:56 +03:00
parent 171e04abe9
commit 4e04879249
70 changed files with 113 additions and 221 deletions

View file

@ -35,8 +35,6 @@ install_desktop ()
# install wallpapers
d=$CACHEDIR/$SDCARD/usr/share/backgrounds/xfce/
test -d "$d" || mkdir -p "$d" && cp $SRC/lib/bin/wallpapers/armbian*.jpg "$d"
mkdir -p $CACHEDIR/$SDCARD/etc/polkit-1/localauthority/50-local.d
cp $SRC/lib/config/polkit-jessie/*.pkla $CACHEDIR/$SDCARD/etc/polkit-1/localauthority/50-local.d/
# Install custom icons and theme
chroot $CACHEDIR/$SDCARD /bin/bash -c "dpkg -i /tmp/bin/vibrancy-colors_2.4-trusty-Noobslab.com_all.deb >/dev/null 2>&1"

View file

@ -170,10 +170,6 @@ install_common()
mkdir -p $CACHEDIR/$SDCARD/etc/systemd/system/systemd-modules-load.service.d/
printf "[Service]\nTimeoutStopSec=10" > $CACHEDIR/$SDCARD/etc/systemd/system/systemd-modules-load.service.d/10-timeout.conf
# handle PMU power button
mkdir -p $CACHEDIR/$SDCARD/etc/udev/rules.d/
cp $SRC/lib/config/71-axp-power-button.rules $CACHEDIR/$SDCARD/etc/udev/rules.d/
[[ $LINUXFAMILY == sun*i ]] && mkdir -p $CACHEDIR/$SDCARD/boot/overlay-user
# Fix for PuTTY/KiTTY & ncurses-based dialogs (i.e. alsamixer) over serial

View file

@ -260,6 +260,7 @@ if [[ $IGNORE_UPDATES != yes ]]; then
BOOTSOURCEDIR=$BOOTDIR/${BOOTBRANCH##*:}
fetch_from_repo "$KERNELSOURCE" "$KERNELDIR" "$KERNELBRANCH" "yes"
LINUXSOURCEDIR=$KERNELDIR/${KERNELBRANCH##*:}
fetch_from_repo "https://github.com/armbian/config" "armbian-config" "branch:dev"
fi
compile_sunxi_tools

View file

@ -109,14 +109,15 @@ create_board_package()
# create directory structure
mkdir -p $destination/etc/{init.d,default,update-motd.d,profile.d,network,cron.d,cron.daily}
mkdir -p $destination/usr/{bin,sbin} $destination/usr/lib/armbian/ $destination/usr/share/armbian/ $destination/usr/share/log2ram/
mkdir -p $destination/usr/{bin,sbin} $destination/usr/lib/armbian/ $destination/usr/lib/nand-sata-install/ $destination/usr/share/armbian/ $destination/usr/share/log2ram/
mkdir -p $destination/etc/initramfs/post-update.d/
mkdir -p $destination/etc/kernel/preinst.d/
mkdir -p $destination/etc/apt/apt.conf.d/ $destination/etc/apt/preferences.d/
mkdir -p $destination/etc/apt/apt.conf.d/
mkdir -p $destination/etc/X11/xorg.conf.d/
mkdir -p $destination/lib/systemd/system/
mkdir -p $destination/lib/systemd/system/ $destination/lib/udev/rules.d/
mkdir -p $destination/var/lib/polkit-1/localauthority/
install -m 755 $SRC/lib/scripts/armhwinfo $destination/etc/init.d/
install -m 755 $SRC/lib/packages/bsp/armhwinfo $destination/etc/init.d/
# configure MIN / MAX speed for cpufrequtils
cat <<-EOF > $destination/etc/default/cpufrequtils
@ -137,131 +138,54 @@ create_board_package()
ARCH=$ARCHITECTURE
IMAGE_TYPE=$IMAGE_TYPE
BOARD_TYPE=$BOARD_TYPE
INITRD_ARCH=$INITRD_ARCH
EOF
# add USB OTG port mode switcher (obsolete - will be handled with DT overlays)
# install -m 755 $SRC/lib/scripts/sunxi-musb $destination/usr/bin
# armbianmonitor (currently only to toggle boot verbosity and log upload)
install -m 755 $SRC/lib/scripts/armbianmonitor/armbianmonitor $destination/usr/bin
install -m 755 $SRC/lib/packages/bsp/armbianmonitor/armbianmonitor $destination/usr/bin
# updating uInitrd image in update-initramfs trigger
cat <<-EOF > $destination/etc/initramfs/post-update.d/99-uboot
#!/bin/sh
echo "update-initramfs: Converting to u-boot format" >&2
tempname="/boot/uInitrd-\$1"
mkimage -A $INITRD_ARCH -O linux -T ramdisk -C gzip -n uInitrd -d \$2 \$tempname > /dev/null
ln -sf \$(basename \$tempname) /boot/uInitrd > /dev/null 2>&1 || mv \$tempname /boot/uInitrd
exit 0
EOF
chmod +x $destination/etc/initramfs/post-update.d/99-uboot
install -m 755 $SRC/lib/packages/bsp/99-uboot $destination/etc/initramfs/post-update.d/99-uboot
# removing old initrd.img on upgrade
cat <<-EOF > $destination/etc/kernel/preinst.d/initramfs-cleanup
#!/bin/sh
version="\$1"
[ -x /usr/sbin/update-initramfs ] || exit 0
# passing the kernel version is required
if [ -z "\${version}" ]; then
echo >&2 "W: initramfs-tools: \${DPKG_MAINTSCRIPT_PACKAGE:-kernel package} did not pass a version number"
exit 0
fi
# avoid running multiple times
if [ -n "\$DEB_MAINT_PARAMS" ]; then
eval set -- "\$DEB_MAINT_PARAMS"
if [ -z "\$1" ] || [ "\$1" != "upgrade" ]; then
exit 0
fi
fi
STATEDIR=/var/lib/initramfs-tools
version_list="\$(ls -1 "\${STATEDIR}" | linux-version sort --reverse)"
for v in \$version_list; do
if ! linux-version compare \$v eq \$version; then
# try to delete delete old initrd images via update-initramfs
INITRAMFS_TOOLS_KERNEL_HOOK=y update-initramfs -d -k \$v 2>/dev/null
# delete unused state files
find \$STATEDIR -type f ! -name "\$version" -printf "Removing obsolete file %f\n" -delete
# delete unused initrd images
find /boot -name "initrd.img*" -o -name "uInitrd-*" ! -name "*\$version" -printf "Removing obsolete file %f\n" -delete
fi
done
EOF
chmod +x $destination/etc/kernel/preinst.d/initramfs-cleanup
# this will be obsolete after kernel packages rework
install -m 755 $SRC/lib/packages/bsp/initramfs-cleanup $destination/etc/kernel/preinst.d/initramfs-cleanup
# network interfaces configuration
cp $SRC/lib/config/network/interfaces.* $destination/etc/network/
[[ $RELEASE = xenial ]] && sed -i 's/#no-auto-down/no-auto-down/g' $destination/etc/network/interfaces.default
cp $SRC/lib/packages/bsp/network/interfaces.* $destination/etc/network/
# this is required for NFS boot to prevent deconfiguring the network on shutdown
[[ $RELEASE == xenial || $RELEASE == stretch ]] && sed -i 's/#no-auto-down/no-auto-down/g' $destination/etc/network/interfaces.default
# apt configuration
cat <<-EOF > $destination/etc/apt/apt.conf.d/71-no-recommends
APT::Install-Recommends "0";
APT::Install-Suggests "0";
EOF
# xorg configuration
cat <<-EOF > $destination/etc/X11/xorg.conf.d/01-armbian-defaults.conf
Section "Monitor"
Identifier "Monitor0"
Option "DPMS" "false"
EndSection
Section "ServerFlags"
Option "BlankTime" "0"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"
EndSection
EOF
cp $SRC/lib/packages/bsp/apt/71-no-recommends $destination/etc/apt/apt.conf.d/71-no-recommends
# configure the system for unattended upgrades
cp $SRC/lib/scripts/02periodic $destination/etc/apt/apt.conf.d/02periodic
cp $SRC/lib/packages/bsp/apt/02periodic $destination/etc/apt/apt.conf.d/02periodic
# pin priority for armbian repo
# reference: man apt_preferences
# this allows providing own versions of hostapd, libdri2 and sunxi-tools
cat <<-EOF > $destination/etc/apt/preferences.d/50-armbian.pref
Package: *
Pin: origin "apt.armbian.com"
Pin-Priority: 500
EOF
# xorg configuration
cp $SRC/lib/packages/bsp/xorg/01-armbian-defaults.conf $destination/etc/X11/xorg.conf.d/01-armbian-defaults.conf
# script to install to SATA
cp -R $SRC/lib/scripts/nand-sata-install/usr $destination/
chmod +x $destination/usr/lib/nand-sata-install/nand-sata-install.sh
ln -s ../lib/nand-sata-install/nand-sata-install.sh $destination/usr/sbin/nand-sata-install
cp -R $SRC/lib/packages/bsp/nand-sata-install/lib/* $destination/usr/lib/nand-sata-install/
install -m 755 $SRC/lib/packages/bsp/nand-sata-install/nand-sata-install $destination/usr/sbin/nand-sata-install
# configuration script
# TODO: better git update logic
if [[ -d $SRC/sources/Debian-micro-home-server ]]; then
git --work-tree=$SRC/sources/Debian-micro-home-server --git-dir=$SRC/sources/Debian-micro-home-server/.git pull
else
git clone https://github.com/igorpecovnik/Debian-micro-home-server $SRC/sources/Debian-micro-home-server
fi
install -m 755 $SRC/sources/Debian-micro-home-server/scripts/tv_grab_file $destination/usr/bin/tv_grab_file
install -m 755 $SRC/sources/Debian-micro-home-server/debian-config $destination/usr/bin/armbian-config
install -m 755 $SRC/sources/Debian-micro-home-server/softy $destination/usr/bin/softy
install -m 755 $SRC/sources/armbian-config/scripts/tv_grab_file $destination/usr/bin/tv_grab_file
install -m 755 $SRC/sources/armbian-config/debian-config $destination/usr/bin/armbian-config
install -m 755 $SRC/sources/armbian-config/softy $destination/usr/bin/softy
# install custom motd with reboot and upgrade checking
install -m 755 $SRC/lib/scripts/update-motd.d/* $destination/etc/update-motd.d/
cp $SRC/lib/scripts/check_first_login_reboot.sh $destination/etc/profile.d
cp $SRC/lib/scripts/check_first_login.sh $destination/etc/profile.d
install -m 755 $SRC/lib/packages/bsp/motd/* $destination/etc/update-motd.d/
install -m 755 $SRC/lib/scripts/apt-updates $destination/usr/lib/armbian/apt-updates
install -m 755 $SRC/lib/packages/bsp/apt/apt-updates $destination/usr/lib/armbian/apt-updates
cp $SRC/lib/packages/bsp/apt/armbian-updates $destination/etc/cron.d/armbian-updates
cat <<-EOF > $destination/usr/lib/armbian/armbian-motd.default
# add space-separated list of MOTD script names (without number) to exclude them from MOTD
# Example:
# MOTD_DISABLE="header tips updates"
MOTD_DISABLE=""
EOF
# install bash profile scripts
cp $SRC/lib/packages/bsp/profile/* $destination/etc/profile.d/
cat <<-EOF > $destination/etc/cron.d/armbian-updates
@reboot root /usr/lib/armbian/apt-updates
@daily root /usr/lib/armbian/apt-updates
EOF
# install various udev rules
cp $SRC/lib/packages/bsp/udev/*.rules $destination/lib/udev/rules.d/
# setting window title for remote sessions
install -m 755 $SRC/lib/scripts/ssh-title.sh $destination/etc/profile.d/ssh-title.sh
cp $SRC/lib/packages/bsp/armbian-motd.default $destination/usr/lib/armbian/armbian-motd.default
# install copy of boot script & environment file
local bootscript_src=${BOOTSCRIPT%%:*}
@ -270,10 +194,13 @@ create_board_package()
[[ -n $BOOTENV_FILE && -f $SRC/lib/config/bootenv/$BOOTENV_FILE ]] && \
cp $SRC/lib/config/bootenv/$BOOTENV_FILE $destination/usr/share/armbian/armbianEnv.txt
# install policykit files used on desktop images to alllow unprivileged users to shutdown/reboot,
# change brightness, configure network, etc.
cp $SRC/lib/packages/bsp/policykit/*.pkla $destination/var/lib/polkit-1/localauthority/
# h3disp for sun8i/3.4.x
if [[ $LINUXFAMILY == sun8i && $BRANCH == default ]]; then
install -m 755 $SRC/lib/scripts/h3disp $destination/usr/bin
install -m 755 $SRC/lib/scripts/h3consumption $destination/usr/bin
install -m 755 $SRC/lib/packages/bsp/{h3disp,h3consumption} $destination/usr/bin
fi
# add configuration for setting uboot environment from userspace with: fw_setenv fw_printenv
@ -284,16 +211,16 @@ create_board_package()
fi
# log2ram - systemd compatible ramlog alternative
cp $SRC/lib/scripts/log2ram/LICENSE.log2ram $destination/usr/share/log2ram/LICENSE
cp $SRC/lib/scripts/log2ram/log2ram.service $destination/lib/systemd/system/log2ram.service
install -m 755 $SRC/lib/scripts/log2ram/log2ram $destination/usr/sbin/log2ram
install -m 755 $SRC/lib/scripts/log2ram/log2ram.hourly $destination/etc/cron.daily/log2ram
cp $SRC/lib/scripts/log2ram/log2ram.default $destination/etc/default/log2ram.dpkg-dist
cp $SRC/lib/packages/bsp/log2ram/LICENSE.log2ram $destination/usr/share/log2ram/LICENSE
cp $SRC/lib/packages/bsp/log2ram/log2ram.service $destination/lib/systemd/system/log2ram.service
install -m 755 $SRC/lib/packages/bsp/log2ram/log2ram $destination/usr/sbin/log2ram
install -m 755 $SRC/lib/packages/bsp/log2ram/log2ram.hourly $destination/etc/cron.daily/log2ram
cp $SRC/lib/packages/bsp/log2ram/log2ram.default $destination/etc/default/log2ram.dpkg-dist
if [[ $LINUXFAMILY == sun*i* ]]; then
install -m 755 $SRC/lib/scripts/armbian-add-overlay $destination/usr/sbin
install -m 755 $SRC/lib/packages/bsp/armbian-add-overlay $destination/usr/sbin
if [[ $BRANCH == default ]]; then
arm-linux-gnueabihf-gcc $SRC/lib/scripts/sunxi-temp/sunxi_tp_temp.c -o $destination/usr/bin/sunxi_tp_temp
arm-linux-gnueabihf-gcc $SRC/lib/packages/bsp/sunxi-temp/sunxi_tp_temp.c -o $destination/usr/bin/sunxi_tp_temp
# convert and add fex files
mkdir -p $destination/boot/bin
for i in $(ls -w1 $SRC/lib/config/fex/*.fex | xargs -n1 basename); do
@ -305,22 +232,19 @@ create_board_package()
if [[ ( $LINUXFAMILY == sun*i || $LINUXFAMILY == pine64 ) && $BRANCH == default ]]; then
# add mpv config for vdpau_sunxi
mkdir -p $destination/etc/mpv/
cp $SRC/lib/config/mpv_sunxi.conf $destination/etc/mpv/mpv.conf
cp $SRC/lib/packages/bsp/mpv/mpv_sunxi.conf $destination/etc/mpv/mpv.conf
echo "export VDPAU_OSD=1" > $destination/etc/profile.d/90-vdpau.sh
chmod 755 $destination/etc/profile.d/90-vdpau.sh
fi
if [[ ( $LINUXFAMILY == sun50i* || $LINUXFAMILY == sun8i ) && $BRANCH == dev ]]; then
# add mpv config for x11 output - slow, but it works compared to no config at all
mkdir -p $destination/etc/mpv/
cat <<-EOF > $destination/etc/mpv/mpv.conf
# HW acceleration is not supported on this platform yet
vo=x11
EOF
cp $SRC/lib/packages/bsp/mpv/mpv_mainline.conf $destination/etc/mpv/mpv.conf
fi
#TODO: move to sources.conf
#TODO: move to sources.conf and to a subdirectory in packages/bsp
if [[ $BOARD == pinebook-a64 ]]; then
cp $SRC/lib/scripts/pinebook-enable-sound.service $destination/lib/systemd/system/
cp $SRC/lib/packages/bsp/pinebook-enable-sound.service $destination/lib/systemd/system/
fi
# add some summary to the image

9
packages/bsp/99-uboot Normal file
View file

@ -0,0 +1,9 @@
#!/bin/sh
. /etc/armbian-release
echo "update-initramfs: Converting to u-boot format" >&2
tempname="/boot/uInitrd-$1"
mkimage -A $INITRD_ARCH -O linux -T ramdisk -C gzip -n uInitrd -d $2 \$tempname > /dev/null
ln -sf $(basename $tempname) /boot/uInitrd > /dev/null 2>&1 || mv $tempname /boot/uInitrd
exit 0

View file

@ -0,0 +1,2 @@
APT::Install-Recommends "0";
APT::Install-Suggests "0";

View file

@ -0,0 +1,2 @@
@reboot root /usr/lib/armbian/apt-updates
@daily root /usr/lib/armbian/apt-updates

View file

@ -0,0 +1,5 @@
# add space-separated list of MOTD script names (without number) to exclude them from MOTD
# Example:
# MOTD_DISABLE="header tips updates"
MOTD_DISABLE=""

0
scripts/h3consumption → packages/bsp/h3consumption Executable file → Normal file
View file

0
scripts/h3disp → packages/bsp/h3disp Executable file → Normal file
View file

View file

@ -0,0 +1,36 @@
#!/bin/sh
version="$1"
[ -x /usr/sbin/update-initramfs ] || exit 0
# passing the kernel version is required
if [ -z "$version" ]; then
echo >&2 "W: initramfs-tools: ${DPKG_MAINTSCRIPT_PACKAGE:-kernel package} did not pass a version number"
exit 0
fi
# avoid running multiple times
if [ -n "$DEB_MAINT_PARAMS" ]; then
eval set -- "$DEB_MAINT_PARAMS"
if [ -z "$1" ] || [ "$1" != "upgrade" ]; then
exit 0
fi
fi
STATEDIR=/var/lib/initramfs-tools
version_list="$(ls -1 "$STATEDIR" | linux-version sort --reverse)"
for v in $version_list; do
if ! linux-version compare $v eq $version; then
# try to delete delete old initrd images via update-initramfs
INITRAMFS_TOOLS_KERNEL_HOOK=y update-initramfs -d -k $v 2>/dev/null
# delete unused state files
find $STATEDIR -type f ! -name "$version" -printf "Removing obsolete file %f\n" -delete
# delete unused initrd images
find /boot -name "initrd.img*" -o -name "uInitrd-*" ! -name "*$version" -printf "Removing obsolete file %f\n" -delete
fi
done
exit 0

View file

@ -0,0 +1,2 @@
# HW acceleration is not supported on this platform yet
vo=x11

View file

@ -0,0 +1,10 @@
Section "Monitor"
Identifier "Monitor0"
Option "DPMS" "false"
EndSection
Section "ServerFlags"
Option "BlankTime" "0"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"
EndSection

View file

@ -1,14 +0,0 @@
#!/usr/bin/env bash
echo "Running post-install"
# This gets run multiple times during the build process, so must be careful
# when the operations are actually performed!
# Remove these links as they produce warnings when the package is unpacked
if [ "$IMAGE_TOP" != "" ]; then
if [ "$version" != "" ]; then
rm -f $IMAGE_TOP/lib/modules/$version/build
rm -f $IMAGE_TOP/lib/modules/$version/source
mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n "Linux kernel" -d $IMAGE_TOP/boot/vmlinuz* $IMAGE_TOP/boot/uImage
fi
fi

View file

@ -1,40 +0,0 @@
setenv rootdev "/dev/mmcblk0p1"
if ext4load mmc 0 0x00000000 /boot/.verbose
then
setenv verbosity 7
else
setenv verbosity 1
fi
# nonstandard monitor settings for A10, A20 and A31 based boards
# screen is initialized before this script -> saving to u-boot environment is mandatory
#setenv video-mode sunxi:1024x768-24@60,monitor=dvi,hpd=0,edid=0,overscan_x=1,overscan_y=2
#saveenv
# nonstandard monitor settings
setenv bootargs "console=ttyS0,115200 console=tty1 root=${rootdev} rootwait rootfstype=ext4 cgroup_enable=memory swapaccount=1 sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_fb_mem_reserve=16 hdmi.audio=EDID:0 disp.screen0_output_mode=1920x1080p60 panic=10 consoleblank=0 enforcing=0 loglevel=${verbosity} storage_type=${storage_type} ${extraargs}"
#--------------------------------------------------------------------------------------------------------------------------------
# Boot loader script to boot with different boot methods for old and new kernel
#--------------------------------------------------------------------------------------------------------------------------------
if ext4load mmc 0 0x00000000 /boot/.next || fatload mmc 0 0x00000000 .next || ext4load mmc 0 0x00000000 .next
then
# sunxi mainline kernel
#--------------------------------------------------------------------------------------------------------------------------------
ext4load mmc 0 ${fdt_addr_r} /boot/dtb/${fdtfile} || fatload mmc 0 ${fdt_addr_r} /dtb/${fdtfile} || ext4load mmc 0 ${fdt_addr_r} /dtb/${fdtfile}
ext4load mmc 0 ${ramdisk_addr_r} /boot/uInitrd || fatload mmc 0 ${ramdisk_addr_r} uInitrd || ext4load mmc 0 ${ramdisk_addr_r} uInitrd || setenv ramdisk_addr_r "-"
ext4load mmc 0 ${kernel_addr_r} /boot/zImage || fatload mmc 0 ${kernel_addr_r} zImage || ext4load mmc 0 ${kernel_addr_r} zImage
bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
#--------------------------------------------------------------------------------------------------------------------------------
else
# sunxi android kernel
#--------------------------------------------------------------------------------------------------------------------------------
ext4load mmc 0 ${fdt_addr_r} /boot/script.bin || fatload mmc 0 ${fdt_addr_r} script.bin || ext4load mmc 0 ${fdt_addr_r} script.bin
ext4load mmc 0 ${ramdisk_addr_r} /boot/uInitrd || fatload mmc 0 ${ramdisk_addr_r} uInitrd || ext4load mmc 0 ${ramdisk_addr_r} uInitrd || setenv ramdisk_addr_r "-"
ext4load mmc 0 ${kernel_addr_r} /boot/zImage || fatload mmc 0 ${kernel_addr_r} zImage || ext4load mmc 0 ${kernel_addr_r} zImage
bootz ${kernel_addr_r} ${ramdisk_addr_r}
#--------------------------------------------------------------------------------------------------------------------------------
fi
# Recompile with:
# mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr

View file

@ -1,39 +0,0 @@
#!/bin/bash
#
#
# sunxi_musb
#
# Patches Device Tree Blob to modify dr_mode - function of the OTG port
#
# Usage: filename.dtb otg | host
#
# It searches for dtb files in /boot/dtb
#
# It's a part of Armbian project.
if [[ -z $1 ]]; then
echo -e "OTG / HOST changer for DTB v1.0"
echo -e "\n`basename "$0"` filename.dtb otg | host"
echo -e ""
echo -e "\e[0;32mUsage example:\x1B[0m `basename "$0"` sun4i-a10-mini-xplus.dtb otg"
echo -e
exit
fi
[[ ! -f "/boot/dtb/$1" ]] && echo -e "[\e[0;31m Device tree blob /boot/dtb/$1 not found \x1B[0m]"
if [[ $2 != "otg" && $2 != "host" ]]; then
echo -e "[\e[0;31m error \x1B[0m] Unkown parameter $2"
exit 2
fi
( dtc -I dtb -O dts /boot/dtb/$1 | grep dr_mode ) > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "[\e[0;31m error \x1B[0m] dr_mode undefined in /boot/dtb/$1"
exit 1
fi
dtc -I dtb -O dts /boot/dtb/$1 | sed -e "s/dr_mode =.*/dr_mode = \"$2\";/" | dtc -I dts -O dtb -o /boot/dtb/$1
echo -e "[\e[0;32m o.k. \x1B[0m] $2 mode enabled in /boot/dtb/$1"