diff --git a/boards.sh b/boards.sh index bfa4690ac..7f5c8f730 100644 --- a/boards.sh +++ b/boards.sh @@ -19,141 +19,141 @@ install_board_specific (){ #--------------------------------------------------------------------------------------------------------------------------------- # Allwinner's - if [[ $LINUXFAMILY == sun* ]] ; then - + if [[ $LINUXFAMILY == sun* ]] ; then + # default lirc configuration sed -i '1i sed -i \x27s/DEVICE="\\/dev\\/input.*/DEVICE="\\/dev\\/input\\/\x27$str\x27"/g\x27 /etc/lirc/hardware.conf' \ - $DEST/cache/sdcard/etc/lirc/hardware.conf + $CACHEDIR/sdcard/etc/lirc/hardware.conf sed -i '1i str=$(cat /proc/bus/input/devices | grep "H: Handlers=sysrq rfkill kbd event" | awk \x27{print $(NF)}\x27)' \ - $DEST/cache/sdcard/etc/lirc/hardware.conf - sed -i '1i # Cubietruck automatic lirc device detection by Igor Pecovnik' $DEST/cache/sdcard/etc/lirc/hardware.conf - sed -e 's/DEVICE=""/DEVICE="\/dev\/input\/event1"/g' -i $DEST/cache/sdcard/etc/lirc/hardware.conf - sed -e 's/DRIVER="UNCONFIGURED"/DRIVER="devinput"/g' -i $DEST/cache/sdcard/etc/lirc/hardware.conf - cp $SRC/lib/config/lirc.conf.cubietruck $DEST/cache/sdcard/etc/lirc/lircd.conf + $CACHEDIR/sdcard/etc/lirc/hardware.conf + sed -i '1i # Cubietruck automatic lirc device detection by Igor Pecovnik' $CACHEDIR/sdcard/etc/lirc/hardware.conf + sed -e 's/DEVICE=""/DEVICE="\/dev\/input\/event1"/g' -i $CACHEDIR/sdcard/etc/lirc/hardware.conf + sed -e 's/DRIVER="UNCONFIGURED"/DRIVER="devinput"/g' -i $CACHEDIR/sdcard/etc/lirc/hardware.conf + cp $SRC/lib/config/lirc.conf.cubietruck $CACHEDIR/sdcard/etc/lirc/lircd.conf - fi + fi # Lemaker Guitar - if [[ $BOARD == "guitar" ]] ; then + if [[ $BOARD == "guitar" ]] ; then - echo "blacklist wlan_8723bs_vq0" > $DEST/cache/sdcard/etc/modprobe.d/blacklist-guitar.conf - echo "blacklist ctp_gslX680" >> $DEST/cache/sdcard/etc/modprobe.d/blacklist-guitar.conf - echo "blacklist ctp_gsl3680" >> $DEST/cache/sdcard/etc/modprobe.d/blacklist-guitar.conf - echo "blacklist gsensor_mir3da" >> $DEST/cache/sdcard/etc/modprobe.d/blacklist-guitar.conf - echo "blacklist gsensor_stk8313" >> $DEST/cache/sdcard/etc/modprobe.d/blacklist-guitar.conf - echo "blacklist gsensor_bma222" >> $DEST/cache/sdcard/etc/modprobe.d/blacklist-guitar.conf - echo "blacklist lightsensor_ltr301" >> $DEST/cache/sdcard/etc/modprobe.d/blacklist-guitar.conf + echo "blacklist wlan_8723bs_vq0" > $CACHEDIR/sdcard/etc/modprobe.d/blacklist-guitar.conf + echo "blacklist ctp_gslX680" >> $CACHEDIR/sdcard/etc/modprobe.d/blacklist-guitar.conf + echo "blacklist ctp_gsl3680" >> $CACHEDIR/sdcard/etc/modprobe.d/blacklist-guitar.conf + echo "blacklist gsensor_mir3da" >> $CACHEDIR/sdcard/etc/modprobe.d/blacklist-guitar.conf + echo "blacklist gsensor_stk8313" >> $CACHEDIR/sdcard/etc/modprobe.d/blacklist-guitar.conf + echo "blacklist gsensor_bma222" >> $CACHEDIR/sdcard/etc/modprobe.d/blacklist-guitar.conf + echo "blacklist lightsensor_ltr301" >> $CACHEDIR/sdcard/etc/modprobe.d/blacklist-guitar.conf fi # Odroid if [[ $BOARD == "odroidxu4" ]] ; then - - echo "blacklist ina231_sensor" > $DEST/cache/sdcard/etc/modprobe.d/blacklist-odroid.conf - chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y -qq remove lirc >/dev/null 2>&1" - - fi + + echo "blacklist ina231_sensor" > $CACHEDIR/sdcard/etc/modprobe.d/blacklist-odroid.conf + chroot $CACHEDIR/sdcard /bin/bash -c "apt-get -y -qq remove lirc >/dev/null 2>&1" + + fi # Armada if [[ $BOARD == "armada" ]] ; then - - chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y -qq remove lirc linux-sound-base alsa-base alsa-utils bluez>/dev/null 2>&1" - - fi - + + chroot $CACHEDIR/sdcard /bin/bash -c "apt-get -y -qq remove lirc linux-sound-base alsa-base alsa-utils bluez>/dev/null 2>&1" + + fi + # Udoo - if [[ $BOARD == "udoo" ]] ; then - - chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y -qq remove lirc >/dev/null 2>&1" - sed 's/wlan0/wlan2/' -i $DEST/cache/sdcard/etc/network/interfaces.default - sed 's/wlan0/wlan2/' -i $DEST/cache/sdcard/etc/network/interfaces.bonding - sed 's/wlan0/wlan2/' -i $DEST/cache/sdcard/etc/network/interfaces.hostapd + if [[ $BOARD == "udoo" ]] ; then + + chroot $CACHEDIR/sdcard /bin/bash -c "apt-get -y -qq remove lirc >/dev/null 2>&1" + sed 's/wlan0/wlan2/' -i $CACHEDIR/sdcard/etc/network/interfaces.default + sed 's/wlan0/wlan2/' -i $CACHEDIR/sdcard/etc/network/interfaces.bonding + sed 's/wlan0/wlan2/' -i $CACHEDIR/sdcard/etc/network/interfaces.hostapd fi # Udoo neo - if [[ $BOARD == "udoo-neo" ]] ; then + if [[ $BOARD == "udoo-neo" ]] ; then - chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y -qq remove lirc" - sed 's/wlan0/wlan2/' -i $DEST/cache/sdcard/etc/network/interfaces.default - sed 's/wlan0/wlan2/' -i $DEST/cache/sdcard/etc/network/interfaces.bonding - sed 's/wlan0/wlan2/' -i $DEST/cache/sdcard/etc/network/interfaces.hostapd + chroot $CACHEDIR/sdcard /bin/bash -c "apt-get -y -qq remove lirc" + sed 's/wlan0/wlan2/' -i $CACHEDIR/sdcard/etc/network/interfaces.default + sed 's/wlan0/wlan2/' -i $CACHEDIR/sdcard/etc/network/interfaces.bonding + sed 's/wlan0/wlan2/' -i $CACHEDIR/sdcard/etc/network/interfaces.hostapd # SD card is elsewhere - sed 's/mmcblk0p1/mmcblk1p1/' -i $DEST/cache/sdcard/etc/fstab + sed 's/mmcblk0p1/mmcblk1p1/' -i $CACHEDIR/sdcard/etc/fstab # firmware for M4 - mkdir -p $DEST/cache/sdcard/boot/bin/ - cp $SRC/lib/bin/m4startup.fw* $DEST/cache/sdcard/boot/bin/ + mkdir -p $CACHEDIR/sdcard/boot/bin/ + cp $SRC/lib/bin/m4startup.fw* $CACHEDIR/sdcard/boot/bin/ # fix for BT cp $SRC/lib/bin/udoo-neo-debs/udooneo-bluetooth_1.2-1_armhf.deb /tmp - chroot $DEST/cache/sdcard /bin/bash -c "dpkg -i /tmp/udooneo-bluetooth_1.2-1_armhf.deb >/dev/null 2>&1" + chroot $CACHEDIR/sdcard /bin/bash -c "dpkg -i /tmp/udooneo-bluetooth_1.2-1_armhf.deb >/dev/null 2>&1" fi # cubox / hummingboard if [[ $BOARD == cubox-i* ]] ; then - - # default lirc configuration - sed -e 's/DEVICE=""/DEVICE="\/dev\/lirc0"/g' -i $DEST/cache/sdcard/etc/lirc/hardware.conf - sed -e 's/DRIVER="UNCONFIGURED"/DRIVER="default"/g' -i $DEST/cache/sdcard/etc/lirc/hardware.conf - cp $SRC/lib/config/lirc.conf.cubox-i $DEST/cache/sdcard/etc/lirc/lircd.conf - cp $SRC/lib/bin/brcm_patchram_plus_cubox $DEST/cache/sdcard/usr/local/bin/brcm_patchram_plus - chroot $DEST/cache/sdcard /bin/bash -c "chmod +x /usr/local/bin/brcm_patchram_plus" - cp $SRC/lib/scripts/brcm4330 $DEST/cache/sdcard/etc/default - cp $SRC/lib/scripts/brcm4330-patch $DEST/cache/sdcard/etc/init.d - chroot $DEST/cache/sdcard /bin/bash -c "chmod +x /etc/init.d/brcm4330-patch" - chroot $DEST/cache/sdcard /bin/bash -c "update-rc.d brcm4330-patch defaults>> /dev/null" - + + # default lirc configuration + sed -e 's/DEVICE=""/DEVICE="\/dev\/lirc0"/g' -i $CACHEDIR/sdcard/etc/lirc/hardware.conf + sed -e 's/DRIVER="UNCONFIGURED"/DRIVER="default"/g' -i $CACHEDIR/sdcard/etc/lirc/hardware.conf + cp $SRC/lib/config/lirc.conf.cubox-i $CACHEDIR/sdcard/etc/lirc/lircd.conf + cp $SRC/lib/bin/brcm_patchram_plus_cubox $CACHEDIR/sdcard/usr/local/bin/brcm_patchram_plus + chroot $CACHEDIR/sdcard /bin/bash -c "chmod +x /usr/local/bin/brcm_patchram_plus" + cp $SRC/lib/scripts/brcm4330 $CACHEDIR/sdcard/etc/default + cp $SRC/lib/scripts/brcm4330-patch $CACHEDIR/sdcard/etc/init.d + chroot $CACHEDIR/sdcard /bin/bash -c "chmod +x /etc/init.d/brcm4330-patch" + chroot $CACHEDIR/sdcard /bin/bash -c "update-rc.d brcm4330-patch defaults>> /dev/null" + fi - # install custom root package - chroot $DEST/cache/sdcard /bin/bash -c "dpkg -i /tmp/$RELEASE/${CHOSEN_ROOTFS}_${REVISION}_armhf.deb > /dev/null" + # install custom root package + chroot $CACHEDIR/sdcard /bin/bash -c "dpkg -i /tmp/$RELEASE/${CHOSEN_ROOTFS}_${REVISION}_armhf.deb > /dev/null" # remove not needed packages - chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y -qq autoremove >/dev/null 2>&1" - + chroot $CACHEDIR/sdcard /bin/bash -c "apt-get -y -qq autoremove >/dev/null 2>&1" + # enable first run script - chroot $DEST/cache/sdcard /bin/bash -c "update-rc.d firstrun defaults >/dev/null 2>&1" + chroot $CACHEDIR/sdcard /bin/bash -c "update-rc.d firstrun defaults >/dev/null 2>&1" display_alert "Creating boot scripts" "$BOARD" "info" - rm -rf $DEST/cache/sdcard/boot/dtb.old # remove .old on new image + rm -rf $CACHEDIR/sdcard/boot/dtb.old # remove .old on new image if [[ $BOARD == udoo* ]] ; then - cp $SRC/lib/config/boot-$BOARD.cmd $DEST/cache/sdcard/boot/boot.cmd + cp $SRC/lib/config/boot-$BOARD.cmd $CACHEDIR/sdcard/boot/boot.cmd elif [[ $BOARD == cubox-i* ]]; then - cp $SRC/lib/config/boot-cubox.cmd $DEST/cache/sdcard/boot/boot.cmd + cp $SRC/lib/config/boot-cubox.cmd $CACHEDIR/sdcard/boot/boot.cmd elif [[ $BOARD == guitar* ]]; then - cp $SRC/lib/config/boot-guitar.cmd $DEST/cache/sdcard/boot/boot.cmd + cp $SRC/lib/config/boot-guitar.cmd $CACHEDIR/sdcard/boot/boot.cmd elif [[ $BOARD == armada* ]]; then - cp $SRC/lib/config/boot-marvell.cmd $DEST/cache/sdcard/boot/boot.cmd + cp $SRC/lib/config/boot-marvell.cmd $CACHEDIR/sdcard/boot/boot.cmd elif [[ $BOARD == odroid* ]]; then - cp $SRC/lib/config/boot-odroid.ini $DEST/cache/sdcard/boot/boot.ini + cp $SRC/lib/config/boot-odroid.ini $CACHEDIR/sdcard/boot/boot.ini else - cp $SRC/lib/config/boot.cmd $DEST/cache/sdcard/boot/boot.cmd + cp $SRC/lib/config/boot.cmd $CACHEDIR/sdcard/boot/boot.cmd # orangepi h3 temp exceptions [[ $LINUXFAMILY == "sun8i" ]] && sed -i -e '1s/^/gpio set PL10\ngpio set PG11\nsetenv machid 1029\nsetenv bootm_boot_mode sec\n/' \ - -e 's/\ disp.screen0_output_mode=1920x1080p60//' -e 's/\ hdmi.audio=EDID:0//' $DEST/cache/sdcard/boot/boot.cmd + -e 's/\ disp.screen0_output_mode=1920x1080p60//' -e 's/\ hdmi.audio=EDID:0//' $CACHEDIR/sdcard/boot/boot.cmd # let's prepare for old kernel too - chroot $DEST/cache/sdcard /bin/bash -c \ + chroot $CACHEDIR/sdcard /bin/bash -c \ "ln -s /boot/bin/$BOARD.bin /boot/script.bin >/dev/null 2>&1 || cp /boot/bin/$BOARD.bin /boot/script.bin" fi # if we have a special fat boot partition, alter rootfs= if [[ "$BOOTSIZE" -gt "0" ]]; then display_alert "Adjusting boot scripts" "$BOARD" "info" - [[ -f "$DEST/cache/sdcard/boot/boot.cmd" ]] && sed -e 's/p1 /p2 /g' -i $DEST/cache/sdcard/boot/boot.cmd - echo "/dev/mmcblk0p1 /boot vfat defaults 0 0" >> $DEST/cache/sdcard/etc/fstab + [[ -f "$CACHEDIR/sdcard/boot/boot.cmd" ]] && sed -e 's/p1 /p2 /g' -i $CACHEDIR/sdcard/boot/boot.cmd + echo "/dev/mmcblk0p1 /boot vfat defaults 0 0" >> $CACHEDIR/sdcard/etc/fstab fi # convert to uboot compatible script - [[ -f "$DEST/cache/sdcard/boot/boot.cmd" ]] && \ - mkimage -C none -A arm -T script -d $DEST/cache/sdcard/boot/boot.cmd $DEST/cache/sdcard/boot/boot.scr >> /dev/null + [[ -f "$CACHEDIR/sdcard/boot/boot.cmd" ]] && \ + mkimage -C none -A arm -T script -d $CACHEDIR/sdcard/boot/boot.cmd $CACHEDIR/sdcard/boot/boot.scr >> /dev/null # initial date for fake-hwclock - date -u '+%Y-%m-%d %H:%M:%S' > $DEST/cache/sdcard/etc/fake-hwclock.data + date -u '+%Y-%m-%d %H:%M:%S' > $CACHEDIR/sdcard/etc/fake-hwclock.data } @@ -165,44 +165,44 @@ install_kernel (){ display_alert "Install kernel" "$CHOSEN_KERNEL" "info" # configure MIN / MAX speed for cpufrequtils - echo "ENABLE=true" > $DEST/cache/sdcard/etc/default/cpufrequtils - echo "MIN_SPEED=$CPUMIN" >> $DEST/cache/sdcard/etc/default/cpufrequtils - echo "MAX_SPEED=$CPUMAX" >> $DEST/cache/sdcard/etc/default/cpufrequtils - echo "GOVERNOR=$GOVERNOR" >> $DEST/cache/sdcard/etc/default/cpufrequtils - - # set hostname - echo $HOST > $DEST/cache/sdcard/etc/hostname + echo "ENABLE=true" > $CACHEDIR/sdcard/etc/default/cpufrequtils + echo "MIN_SPEED=$CPUMIN" >> $CACHEDIR/sdcard/etc/default/cpufrequtils + echo "MAX_SPEED=$CPUMAX" >> $CACHEDIR/sdcard/etc/default/cpufrequtils + echo "GOVERNOR=$GOVERNOR" >> $CACHEDIR/sdcard/etc/default/cpufrequtils + + # set hostname + echo $HOST > $CACHEDIR/sdcard/etc/hostname # this is needed for ubuntu - rm $DEST/cache/sdcard/etc/resolv.conf - echo "nameserver 8.8.8.8" >> $DEST/cache/sdcard/etc/resolv.conf + rm $CACHEDIR/sdcard/etc/resolv.conf + echo "nameserver 8.8.8.8" >> $CACHEDIR/sdcard/etc/resolv.conf # set hostname in hosts file - echo "127.0.0.1 localhost $HOST" > $DEST/cache/sdcard/etc/hosts - echo "::1 localhost $HOST ip6-localhost ip6-loopback" >> $DEST/cache/sdcard/etc/hosts - echo "fe00::0 ip6-localnet" >> $DEST/cache/sdcard/etc/hosts - echo "ff00::0 ip6-mcastprefix" >> $DEST/cache/sdcard/etc/hosts - echo "ff02::1 ip6-allnodes" >> $DEST/cache/sdcard/etc/hosts - echo "ff02::2 ip6-allrouters" >> $DEST/cache/sdcard/etc/hosts + echo "127.0.0.1 localhost $HOST" > $CACHEDIR/sdcard/etc/hosts + echo "::1 localhost $HOST ip6-localhost ip6-loopback" >> $CACHEDIR/sdcard/etc/hosts + echo "fe00::0 ip6-localnet" >> $CACHEDIR/sdcard/etc/hosts + echo "ff00::0 ip6-mcastprefix" >> $CACHEDIR/sdcard/etc/hosts + echo "ff02::1 ip6-allnodes" >> $CACHEDIR/sdcard/etc/hosts + echo "ff02::2 ip6-allrouters" >> $CACHEDIR/sdcard/etc/hosts # create modules file IFS=" " if [[ $BRANCH == *next* || $BRANCH == *dev* ]];then - for word in $MODULES_NEXT; do - echo $word >> $DEST/cache/sdcard/etc/modules; + for word in $MODULES_NEXT; do + echo $word >> $CACHEDIR/sdcard/etc/modules; done else - for word in $MODULES; do - echo $word >> $DEST/cache/sdcard/etc/modules; + for word in $MODULES; do + echo $word >> $CACHEDIR/sdcard/etc/modules; done fi # copy and create symlink to default interfaces configuration - cp $SRC/lib/config/interfaces.* $DEST/cache/sdcard/etc/network/ - ln -sf interfaces.default $DEST/cache/sdcard/etc/network/interfaces + cp $SRC/lib/config/interfaces.* $CACHEDIR/sdcard/etc/network/ + ln -sf interfaces.default $CACHEDIR/sdcard/etc/network/interfaces # mount deb storage to tmp - mount --bind $DEST/debs/ $DEST/cache/sdcard/tmp + mount --bind $DEST/debs/ $CACHEDIR/sdcard/tmp # extract kernel version VER=$(dpkg --info $DEST/debs/${CHOSEN_KERNEL}_${REVISION}_armhf.deb | grep Descr | awk '{print $(NF)}') @@ -214,29 +214,29 @@ install_kernel (){ HEADERS_TMP="${CHOSEN_KERNEL/image/headers}" # install kernel - chroot $DEST/cache/sdcard /bin/bash -c "dpkg -i /tmp/${CHOSEN_KERNEL}_${REVISION}_armhf.deb > dev/null" + chroot $CACHEDIR/sdcard /bin/bash -c "dpkg -i /tmp/${CHOSEN_KERNEL}_${REVISION}_armhf.deb > dev/null" # install uboot display_alert "Install u-boot" "$CHOSEN_UBOOT" "info" - chroot $DEST/cache/sdcard /bin/bash -c "dpkg -i /tmp/${CHOSEN_UBOOT}_${REVISION}_armhf.deb > /dev/null" - + chroot $CACHEDIR/sdcard /bin/bash -c "dpkg -i /tmp/${CHOSEN_UBOOT}_${REVISION}_armhf.deb > /dev/null" + # install headers display_alert "Install headers" "$HEADERS_TMP" "info" - chroot $DEST/cache/sdcard /bin/bash -c "dpkg -i /tmp/${HEADERS_TMP}_${REVISION}_armhf.deb > /dev/null" - + chroot $CACHEDIR/sdcard /bin/bash -c "dpkg -i /tmp/${HEADERS_TMP}_${REVISION}_armhf.deb > /dev/null" + # install firmware display_alert "Install firmware" "$FW_TMP" "info" - chroot $DEST/cache/sdcard /bin/bash -c "dpkg -i /tmp/${FW_TMP}_${REVISION}_armhf.deb > /dev/null" + chroot $CACHEDIR/sdcard /bin/bash -c "dpkg -i /tmp/${FW_TMP}_${REVISION}_armhf.deb > /dev/null" # install DTB - if [[ -f $DEST/cache/sdcard/tmp/${DTB_TMP}_${REVISION}_armhf.deb ]]; then + if [[ -f $CACHEDIR/sdcard/tmp/${DTB_TMP}_${REVISION}_armhf.deb ]]; then display_alert "Install DTB" "$DTB_TMP" "info" - chroot $DEST/cache/sdcard /bin/bash -c "dpkg -i /tmp/${DTB_TMP}_${REVISION}_armhf.deb > /dev/null" + chroot $CACHEDIR/sdcard /bin/bash -c "dpkg -i /tmp/${DTB_TMP}_${REVISION}_armhf.deb > /dev/null" fi - + # copy boot splash image - cp $SRC/lib/bin/armbian.bmp $DEST/cache/sdcard/boot/boot.bmp - + cp $SRC/lib/bin/armbian.bmp $CACHEDIR/sdcard/boot/boot.bmp + # add our linux firmwares to cache image - unzip -q $SRC/lib/bin/linux-firmware.zip -d $DEST/cache/sdcard/lib/firmware + unzip -q $SRC/lib/bin/linux-firmware.zip -d $CACHEDIR/sdcard/lib/firmware } diff --git a/common.sh b/common.sh index 44cb2a3a3..3299c9421 100644 --- a/common.sh +++ b/common.sh @@ -23,32 +23,32 @@ compile_uboot (){ if [[ ! -d "$SOURCES/$BOOTSOURCEDIR" ]]; then exit_with_error "Error building u-boot: source directory does not exist" "$BOOTSOURCEDIR" fi - + display_alert "Compiling uboot. Please wait." "$VER" "info" - echo `date +"%d.%m.%Y %H:%M:%S"` $SOURCES/$BOOTSOURCEDIR/$BOOTCONFIG >> $DEST/debug/install.log + echo `date +"%d.%m.%Y %H:%M:%S"` $SOURCES/$BOOTSOURCEDIR/$BOOTCONFIG >> $DEST/debug/install.log cd $SOURCES/$BOOTSOURCEDIR make -s ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean >/dev/null 2>&1 - + # there are two methods of compilation if [[ $BOOTCONFIG == *config* ]]; then - + make $CTHREADS $BOOTCONFIG CROSS_COMPILE=arm-linux-gnueabihf- >/dev/null 2>&1 [ -f .config ] && sed -i 's/CONFIG_LOCALVERSION=""/CONFIG_LOCALVERSION="-armbian"/g' .config - [ -f .config ] && sed -i 's/CONFIG_LOCALVERSION_AUTO=.*/# CONFIG_LOCALVERSION_AUTO is not set/g' .config + [ -f .config ] && sed -i 's/CONFIG_LOCALVERSION_AUTO=.*/# CONFIG_LOCALVERSION_AUTO is not set/g' .config [ -f $SOURCES/$BOOTSOURCEDIR/tools/logos/udoo.bmp ] && cp $SRC/lib/bin/armbian-u-boot.bmp $SOURCES/$BOOTSOURCEDIR/tools/logos/udoo.bmp touch .scmversion - + # special compilation for armada [[ $LINUXFAMILY == "marvell" ]] && local MAKEPARA="u-boot.mmc" - + # patch mainline uboot configuration to boot with old kernels if [[ $BRANCH == "default" && $LINUXFAMILY == sun*i ]] ; then if [ "$(cat $SOURCES/$BOOTSOURCEDIR/.config | grep CONFIG_ARMV7_BOOT_SEC_DEFAULT=y)" == "" ]; then echo "CONFIG_ARMV7_BOOT_SEC_DEFAULT=y" >> $SOURCES/$BOOTSOURCEDIR/.config echo "CONFIG_OLD_SUNXI_KERNEL_COMPAT=y" >> $SOURCES/$BOOTSOURCEDIR/.config fi - fi - + fi + eval 'make $MAKEPARA $CTHREADS CROSS_COMPILE="$CCACHE arm-linux-gnueabihf-" 2>&1' \ ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/compilation.log'} \ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Compiling u-boot..." $TTY_Y $TTY_X'} \ @@ -66,32 +66,32 @@ compile_uboot (){ local uboot_name=${CHOSEN_UBOOT}_${REVISION}_armhf mkdir -p $DEST/debs/$uboot_name/usr/lib/$uboot_name $DEST/debs/$uboot_name/DEBIAN - + # set up post install script cat < $DEST/debs/$uboot_name/DEBIAN/postinst #!/bin/bash set -e if [[ \$DEVICE == "" ]]; then DEVICE="/dev/mmcblk0"; fi -if [[ \$DPKG_MAINTSCRIPT_PACKAGE == *cubox* ]] ; then +if [[ \$DPKG_MAINTSCRIPT_PACKAGE == *cubox* ]] ; then ( dd if=/usr/lib/$uboot_name/SPL of=\$DEVICE bs=512 seek=2 status=noxfer ) > /dev/null 2>&1 - ( dd if=/usr/lib/$uboot_name/u-boot.img of=\$DEVICE bs=1K seek=42 status=noxfer ) > /dev/null 2>&1 -elif [[ \$DPKG_MAINTSCRIPT_PACKAGE == *guitar* ]] ; then + ( dd if=/usr/lib/$uboot_name/u-boot.img of=\$DEVICE bs=1K seek=42 status=noxfer ) > /dev/null 2>&1 +elif [[ \$DPKG_MAINTSCRIPT_PACKAGE == *guitar* ]] ; then ( dd if=/usr/lib/$uboot_name/bootloader.bin of=\$DEVICE bs=512 seek=4097 conv=fsync ) > /dev/null 2>&1 ( dd if=/usr/lib/$uboot_name/u-boot-dtb.bin of=\$DEVICE bs=512 seek=6144 conv=fsync ) > /dev/null 2>&1 -elif [[ \$DPKG_MAINTSCRIPT_PACKAGE == *odroid* ]] ; then +elif [[ \$DPKG_MAINTSCRIPT_PACKAGE == *odroid* ]] ; then ( dd if=/usr/lib/$uboot_name/bl1.bin.hardkernel of=\$DEVICE seek=1 conv=fsync ) > /dev/null 2>&1 ( dd if=/usr/lib/$uboot_name/bl2.bin.hardkernel of=\$DEVICE seek=31 conv=fsync ) > /dev/null 2>&1 ( dd if=/usr/lib/$uboot_name/u-boot.bin of=\$DEVICE bs=512 seek=63 conv=fsync ) > /dev/null 2>&1 ( dd if=/usr/lib/$uboot_name/tzsw.bin.hardkernel of=\$DEVICE seek=719 conv=fsync ) > /dev/null 2>&1 ( dd if=/dev/zero of=\$DEVICE seek=1231 count=32 bs=512 conv=fsync ) > /dev/null 2>&1 -elif [[ \$DPKG_MAINTSCRIPT_PACKAGE == *udoo* ]] ; then +elif [[ \$DPKG_MAINTSCRIPT_PACKAGE == *udoo* ]] ; then ( dd if=/usr/lib/$uboot_name/SPL of=\$DEVICE bs=1k seek=1 status=noxfer ) > /dev/null 2>&1 - ( dd if=/usr/lib/$uboot_name/u-boot.img of=\$DEVICE bs=1K seek=69 status=noxfer ) > /dev/null 2>&1 -elif [[ \$DPKG_MAINTSCRIPT_PACKAGE == *armada* ]] ; then - ( dd if=/usr/lib/$uboot_name/u-boot.mmc of=\$DEVICE bs=512 seek=1 status=noxfer ) > /dev/null 2>&1 -else - ( dd if=/usr/lib/$uboot_name/u-boot-sunxi-with-spl.bin of=\$DEVICE bs=1024 seek=8 status=noxfer ) > /dev/null 2>&1 + ( dd if=/usr/lib/$uboot_name/u-boot.img of=\$DEVICE bs=1K seek=69 status=noxfer ) > /dev/null 2>&1 +elif [[ \$DPKG_MAINTSCRIPT_PACKAGE == *armada* ]] ; then + ( dd if=/usr/lib/$uboot_name/u-boot.mmc of=\$DEVICE bs=512 seek=1 status=noxfer ) > /dev/null 2>&1 +else + ( dd if=/usr/lib/$uboot_name/u-boot-sunxi-with-spl.bin of=\$DEVICE bs=1024 seek=8 status=noxfer ) > /dev/null 2>&1 fi exit 0 END @@ -113,12 +113,12 @@ END # copy proper uboot files to place if [[ $BOARD == cubox-i* ]] ; then - [ ! -f "SPL" ] || cp SPL u-boot.img $DEST/debs/$uboot_name/usr/lib/$uboot_name + [ ! -f "SPL" ] || cp SPL u-boot.img $DEST/debs/$uboot_name/usr/lib/$uboot_name elif [[ $BOARD == guitar* ]] ; then - [ ! -f "u-boot-dtb.bin" ] || cp u-boot-dtb.bin $DEST/debs/$uboot_name/usr/lib/$uboot_name + [ ! -f "u-boot-dtb.bin" ] || cp u-boot-dtb.bin $DEST/debs/$uboot_name/usr/lib/$uboot_name [ ! -f "$SRC/lib/bin/s500-bootloader.bin" ] || cp $SRC/lib/bin/s500-bootloader.bin $DEST/debs/$uboot_name/usr/lib/$uboot_name/bootloader.bin - elif [[ $BOARD == odroid* ]] ; then - [ ! -f "sd_fuse/hardkernel/bl1.bin.hardkernel" ] || cp sd_fuse/hardkernel/bl1.bin.hardkernel $DEST/debs/$uboot_name/usr/lib/$uboot_name + elif [[ $BOARD == odroid* ]] ; then + [ ! -f "sd_fuse/hardkernel/bl1.bin.hardkernel" ] || cp sd_fuse/hardkernel/bl1.bin.hardkernel $DEST/debs/$uboot_name/usr/lib/$uboot_name [ ! -f "sd_fuse/hardkernel/bl2.bin.hardkernel" ] || cp sd_fuse/hardkernel/bl2.bin.hardkernel $DEST/debs/$uboot_name/usr/lib/$uboot_name [ ! -f "sd_fuse/hardkernel/tzsw.bin.hardkernel" ] || cp sd_fuse/hardkernel/tzsw.bin.hardkernel $DEST/debs/$uboot_name/usr/lib/$uboot_name [ ! -f "u-boot.bin" ] || cp u-boot.bin $DEST/debs/$uboot_name/usr/lib/$uboot_name/ @@ -127,7 +127,7 @@ END elif [[ $BOARD == armada* ]] ; then [ ! -f "u-boot.mmc" ] || cp u-boot.mmc $DEST/debs/$uboot_name/usr/lib/$uboot_name else - [ ! -f "u-boot-sunxi-with-spl.bin" ] || cp u-boot-sunxi-with-spl.bin $DEST/debs/$uboot_name/usr/lib/$uboot_name + [ ! -f "u-boot-sunxi-with-spl.bin" ] || cp u-boot-sunxi-with-spl.bin $DEST/debs/$uboot_name/usr/lib/$uboot_name fi cd $DEST/debs @@ -172,9 +172,9 @@ compile_kernel (){ if [[ ! -d "$SOURCES/$LINUXSOURCEDIR" ]]; then exit_with_error "Error building kernel: source directory does not exist" "$LINUXSOURCEDIR" fi - + # read kernel version to variable $VER - grab_version "$SOURCES/$LINUXSOURCEDIR" + grab_version "$SOURCES/$LINUXSOURCEDIR" display_alert "Compiling $BRANCH kernel" "@host" "info" cd $SOURCES/$LINUXSOURCEDIR/ @@ -203,12 +203,12 @@ compile_kernel (){ export LOCALVERSION="-"$LINUXFAMILY - # We can use multi threading here but not later since it's not working. This way of compilation is much faster. + # We can use multi threading here but not later since it's not working. This way of compilation is much faster. if [ "$KERNEL_CONFIGURE" != "yes" ]; then if [ "$BRANCH" = "default" ]; then make $CTHREADS ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- silentoldconfig else - make $CTHREADS ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- olddefconfig + make $CTHREADS ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- olddefconfig fi else make $CTHREADS ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- oldconfig @@ -240,7 +240,7 @@ compile_kernel (){ KERNEL_PACKING="bindeb-pkg" fi - # make $CTHREADS ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- + # make $CTHREADS ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- # produce deb packages: image, headers, firmware, libc eval 'make -j1 $KERNEL_PACKING KDEB_PKGVERSION=$REVISION LOCALVERSION="-"$LINUXFAMILY KBUILD_DEBARCH=armhf ARCH=arm DEBFULLNAME="$MAINTAINER" \ DEBEMAIL="$MAINTAINERMAIL" CROSS_COMPILE="$CCACHE arm-linux-gnueabihf-" 2>&1 ' \ @@ -274,11 +274,11 @@ sed -e 's/%STUBNAME_TAG%/tusbd/g' $SOURCES/usb-redirector-linux-arm-eabi/files/r sed -e 's/%DAEMONNAME_TAG%/usbsrvd/g' $SOURCES/usb-redirector-linux-arm-eabi/files/rc.usbsrvd1 > $SOURCES/usb-redirector-linux-arm-eabi/files/rc.usbsrvd chmod +x $SOURCES/usb-redirector-linux-arm-eabi/files/rc.usbsrvd # copy to root -cp $SOURCES/usb-redirector-linux-arm-eabi/files/usb* $DEST/cache/sdcard/usr/local/bin/ -cp $SOURCES/usb-redirector-linux-arm-eabi/files/modules/src/tusbd/tusbd.ko $DEST/cache/sdcard/usr/local/bin/ -cp $SOURCES/usb-redirector-linux-arm-eabi/files/rc.usbsrvd $DEST/cache/sdcard/etc/init.d/ +cp $SOURCES/usb-redirector-linux-arm-eabi/files/usb* $CACHEDIR/sdcard/usr/local/bin/ +cp $SOURCES/usb-redirector-linux-arm-eabi/files/modules/src/tusbd/tusbd.ko $CACHEDIR/sdcard/usr/local/bin/ +cp $SOURCES/usb-redirector-linux-arm-eabi/files/rc.usbsrvd $CACHEDIR/sdcard/etc/init.d/ # not started by default ----- update.rc rc.usbsrvd defaults -# chroot $DEST/cache/sdcard /bin/bash -c "update-rc.d rc.usbsrvd defaults" +# chroot $CACHEDIR/sdcard /bin/bash -c "update-rc.d rc.usbsrvd defaults" # some aditional stuff. Some driver as example if [[ -n "$MISC3_DIR" ]]; then @@ -288,9 +288,9 @@ if [[ -n "$MISC3_DIR" ]]; then #git checkout 0ea77e747df7d7e47e02638a2ee82ad3d1563199 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean >/dev/null 2>&1 (make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- KSRC=$SOURCES/$LINUXSOURCEDIR/ >/dev/null 2>&1) - cp *.ko $DEST/cache/sdcard/lib/modules/$VER-$LINUXFAMILY/kernel/net/wireless/ - depmod -b $DEST/cache/sdcard/ $VER-$LINUXFAMILY - #cp blacklist*.conf $DEST/cache/sdcard/etc/modprobe.d/ + cp *.ko $CACHEDIR/sdcard/lib/modules/$VER-$LINUXFAMILY/kernel/net/wireless/ + depmod -b $CACHEDIR/sdcard/ $VER-$LINUXFAMILY + #cp blacklist*.conf $CACHEDIR/sdcard/etc/modprobe.d/ fi # MISC4 = NOTRO DRIVERS / special handling @@ -301,7 +301,7 @@ if [[ -n "$MISC5_DIR" && $BRANCH != "next" && $LINUXSOURCEDIR == *sunxi* ]]; the cp "$SOURCES/$LINUXSOURCEDIR/include/video/sunxi_disp_ioctl.h" . make clean >/dev/null 2>&1 (make ARCH=arm CC=arm-linux-gnueabihf-gcc KSRC="$SOURCES/$LINUXSOURCEDIR/" >/dev/null 2>&1) - install -m 755 a10disp "$DEST/cache/sdcard/usr/local/bin" + install -m 755 a10disp "$CACHEDIR/sdcard/usr/local/bin" fi # MISC5 = sunxi display control / compile it for sun8i just in case sun7i stuff gets ported to sun8i and we're able to use it if [[ -n "$MISC5_DIR" && $BRANCH != "next" && $LINUXSOURCEDIR == *sun8i* ]]; then @@ -309,7 +309,7 @@ if [[ -n "$MISC5_DIR" && $BRANCH != "next" && $LINUXSOURCEDIR == *sun8i* ]]; the wget -q "https://raw.githubusercontent.com/linux-sunxi/linux-sunxi/sunxi-3.4/include/video/sunxi_disp_ioctl.h" make clean >/dev/null 2>&1 (make ARCH=arm CC=arm-linux-gnueabihf-gcc KSRC="$SOURCES/$LINUXSOURCEDIR/" >/dev/null 2>&1) - install -m 755 a10disp "$DEST/cache/sdcard/usr/local/bin" + install -m 755 a10disp "$CACHEDIR/sdcard/usr/local/bin" fi # MT7601U @@ -363,21 +363,21 @@ _EOF_ cd src make -s ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean >/dev/null 2>&1 (make -s -j4 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LINUX_SRC=$SOURCES/$LINUXSOURCEDIR/ >/dev/null 2>&1) - cp os/linux/*.ko $DEST/cache/sdcard/lib/modules/$VER-$LINUXFAMILY/kernel/net/wireless/ - mkdir -p $DEST/cache/sdcard/etc/Wireless/RT2870STA - cp RT2870STA.dat $DEST/cache/sdcard/etc/Wireless/RT2870STA/ - depmod -b $DEST/cache/sdcard/ $VER-$LINUXFAMILY + cp os/linux/*.ko $CACHEDIR/sdcard/lib/modules/$VER-$LINUXFAMILY/kernel/net/wireless/ + mkdir -p $CACHEDIR/sdcard/etc/Wireless/RT2870STA + cp RT2870STA.dat $CACHEDIR/sdcard/etc/Wireless/RT2870STA/ + depmod -b $CACHEDIR/sdcard/ $VER-$LINUXFAMILY make -s clean 1>&2 2>/dev/null cd .. - mkdir -p $DEST/cache/sdcard/usr/src/ - cp -R src $DEST/cache/sdcard/usr/src/mt7601-3.0.0.4 + mkdir -p $CACHEDIR/sdcard/usr/src/ + cp -R src $CACHEDIR/sdcard/usr/src/mt7601-3.0.0.4 # TODO: Set the module to build automatically via dkms in the future here fi # h3disp for sun8i/3.4.x if [ "$BOARD" = "orangepiplus" -o "$BOARD" = "orangepih3" ]; then - install -m 755 "$SRC/lib/scripts/h3disp" "$DEST/cache/sdcard/usr/local/bin" + install -m 755 "$SRC/lib/scripts/h3disp" "$CACHEDIR/sdcard/usr/local/bin" fi } @@ -396,7 +396,7 @@ write_uboot() ( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_armhf/SPL of=$LOOP bs=512 seek=2 status=noxfer >/dev/null 2>&1) ( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_armhf/u-boot.img of=$LOOP bs=1K seek=42 status=noxfer >/dev/null 2>&1) elif [[ $BOARD == *armada* ]] ; then - ( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_armhf/u-boot.mmc of=$LOOP bs=512 seek=1 status=noxfer >/dev/null 2>&1) + ( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_armhf/u-boot.mmc of=$LOOP bs=512 seek=1 status=noxfer >/dev/null 2>&1) elif [[ $BOARD == *udoo* ]] ; then ( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_armhf/SPL of=$LOOP bs=1k seek=1 status=noxfer >/dev/null 2>&1) ( dd if=/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_armhf/u-boot.img of=$LOOP bs=1k seek=69 conv=fsync >/dev/null 2>&1) diff --git a/compile.sh b/compile.sh index cfda71cce..d30ab6b90 100755 --- a/compile.sh +++ b/compile.sh @@ -20,7 +20,7 @@ KERNEL_CONFIGURE="no" # want to change my default configuration CLEAN_LEVEL="make,debs" # comma-separated list of clean targets: "make" = make clean for selected kernel and u-boot, # "images" = delete "./output/images", "debs" = delete "./output/debs", # "cache" = delete "./output/cache", "sources" = delete "./sources" -# user +# user DEST_LANG="en_US.UTF-8" # sl_SI.UTF-8, en_US.UTF-8 CONSOLE_CHAR="UTF-8" @@ -49,8 +49,8 @@ SOURCES=$(pwd)/sources # To preserve proper librarires updating #-------------------------------------------------------------------------------------------------------------------------------- if [[ -f main.sh && -d bin ]]; then - echo -e "[\e[0;31m error \x1B[0m] Copy this file one level up, alter and run again." - exit + echo -e "[\e[0;31m error \x1B[0m] Copy this file one level up, alter and run again." + exit fi diff --git a/config/linux-sun8i-default.config b/config/linux-sun8i-default.config index 775fad3ad..df9003397 100644 --- a/config/linux-sun8i-default.config +++ b/config/linux-sun8i-default.config @@ -1,6 +1,5 @@ # -# Automatically generated file; DO NOT EDIT. -# Linux/arm 3.4.110 Kernel Configuration +# Armbian 5.06 sun8i 3.4.110 Kernel Configuration # CONFIG_ARM=y CONFIG_ARM_HAS_SG_CHAIN=y @@ -57,7 +56,10 @@ CONFIG_POSIX_MQUEUE_SYSCTL=y CONFIG_BSD_PROCESS_ACCT=y CONFIG_BSD_PROCESS_ACCT_V3=y CONFIG_FHANDLE=y -# CONFIG_TASKSTATS is not set +CONFIG_TASKSTATS=y +CONFIG_TASK_DELAY_ACCT=y +CONFIG_TASK_XACCT=y +CONFIG_TASK_IO_ACCOUNTING=y CONFIG_AUDIT=y CONFIG_AUDITSYSCALL=y CONFIG_AUDIT_WATCH=y @@ -113,7 +115,7 @@ CONFIG_IPC_NS=y CONFIG_USER_NS=y CONFIG_PID_NS=y CONFIG_NET_NS=y -# CONFIG_SCHED_AUTOGROUP is not set +CONFIG_SCHED_AUTOGROUP=y CONFIG_MM_OWNER=y # CONFIG_SYSFS_DEPRECATED is not set CONFIG_RELAY=y diff --git a/config/orangepi2.fex b/config/orangepi2.fex index 3a8b93579..f4dfd5ed9 100644 --- a/config/orangepi2.fex +++ b/config/orangepi2.fex @@ -351,8 +351,8 @@ gpio_pin_19 = port:PG07<1><0> [leds_para] leds_used = 1 -green_led = port:PL10<1><0> -green_led_active_low = 1 +green_led = port:PL10<1><1> +green_led_active_low = 0 red_led = port:PA15<1><0> red_led_active_low = 0 @@ -787,7 +787,7 @@ smc_sda = port:PA08<2> [usbc0] usb_used = 1 usb_port_type = 2 -usb_detect_type = 1 +usb_detect_type = 0 usb_id_gpio = usb_det_vbus_gpio = usb_drv_vbus_gpio = port:PL02<1><0><0> diff --git a/config/orangepilite.fex b/config/orangepilite.fex index 23999558a..56ca5336a 100644 --- a/config/orangepilite.fex +++ b/config/orangepilite.fex @@ -247,8 +247,8 @@ gpio_pin_19 = port:PG07<1><0> [leds_para] leds_used = 1 -green_led = port:PL10<1><0> -green_led_active_low = 1 +green_led = port:PL10<1><1> +green_led_active_low = 0 red_led = port:PA15<1><0> red_led_active_low = 0 diff --git a/config/orangepione.fex b/config/orangepione.fex index 24684db33..83f42f117 100644 --- a/config/orangepione.fex +++ b/config/orangepione.fex @@ -247,8 +247,8 @@ gpio_pin_19 = port:PG07<1><0> [leds_para] leds_used = 1 -green_led = port:PL10<1><0> -green_led_active_low = 1 +green_led = port:PL10<1><1> +green_led_active_low = 0 red_led = port:PA15<1><0> red_led_active_low = 0 diff --git a/config/orangepipc.fex b/config/orangepipc.fex index 9352cc653..1ae9f6f75 100644 --- a/config/orangepipc.fex +++ b/config/orangepipc.fex @@ -247,8 +247,8 @@ gpio_pin_19 = port:PG07<1><0> [leds_para] leds_used = 1 -green_led = port:PL10<1><0> -green_led_active_low = 1 +green_led = port:PL10<1><1> +green_led_active_low = 0 red_led = port:PA15<1><0> red_led_active_low = 0 diff --git a/config/orangepiplus.fex b/config/orangepiplus.fex index 31279e1b8..44f964ea0 100644 --- a/config/orangepiplus.fex +++ b/config/orangepiplus.fex @@ -354,8 +354,8 @@ gpio_pin_19 = port:PG07<1><0> [leds_para] leds_used = 1 -green_led = port:PL10<1><0> -green_led_active_low = 1 +green_led = port:PL10<1><1> +green_led_active_low = 0 red_led = port:PA15<1><0> red_led_active_low = 0 @@ -801,9 +801,7 @@ smc_sda = port:PA08<2> ;-------------------------------- [usbc0] usb_used = 1 -;usb_port_type = 2 usb_port_type = 1 -;usb_detect_type = 1 usb_detect_type = 0 usb_id_gpio = usb_det_vbus_gpio = diff --git a/configuration.sh b/configuration.sh index 359d0e98e..62618e0d1 100644 --- a/configuration.sh +++ b/configuration.sh @@ -34,12 +34,11 @@ MAINTAINERMAIL="igor.pecovnik@****l.com" # deb signature SDSIZE="4000" # SD image size in MB TZDATA=`cat /etc/timezone` # Timezone for target is taken from host or defined here. USEALLCORES="yes" # Use all CPU cores for compiling -SYSTEMD="no" # Enable or disable systemd on Jessie in debootstrap process OFFSET="1" # Bootloader space in MB (1 x 2048 = default) BOOTSIZE="0" # Mb size of boot partition EXIT_PATCHING_ERROR="" # exit patching if failed SERIALCON="ttyS0" -MISC1="https://github.com/linux-sunxi/sunxi-tools.git" # Allwinner fex compiler / decompiler +MISC1="https://github.com/linux-sunxi/sunxi-tools.git" # Allwinner fex compiler / decompiler MISC1_DIR="sunxi-tools" # local directory MISC2="" # Reserved MISC2_DIR="" # local directory @@ -53,13 +52,14 @@ MISC6="https://github.com/porjo/mt7601/" # Display changer for Allwinner MISC6_DIR="mt7601" # local directory TTY_X=$(($(stty size| awk '{print $2}')-6)) # determine terminal width TTY_Y=$(($(stty size| awk '{print $1}')-6)) # determine terminal height +CACHEDIR=$DEST/cache # board configurations case $BOARD in cubieboard4)#disabled - LINUXFAMILY="sun9i" + LINUXFAMILY="sun9i" BOOTCONFIG="Cubieboard4_defconfig" CPUMIN="1200000" CPUMAX="1800000" @@ -70,7 +70,7 @@ case $BOARD in #description A20 dual core SoM #build 0 LINUXFAMILY="sun7i" - BOOTCONFIG="Awsom_defconfig" + BOOTCONFIG="Awsom_defconfig" MODULES="hci_uart gpio_sunxi rfcomm hidp bonding spi_sun7i" MODULES_NEXT="bonding" ;; @@ -78,8 +78,8 @@ case $BOARD in olinux-som-a13)#enabled #description A13 single core 512Mb SoM #build 0 - LINUXFAMILY="sun5i" - BOOTCONFIG="A13-OLinuXino_defconfig" + LINUXFAMILY="sun5i" + BOOTCONFIG="A13-OLinuXino_defconfig" MODULES="gpio_sunxi spi_sunxi" MODULES_NEXT="bonding" ;; @@ -98,7 +98,7 @@ case $BOARD in #description A20 dual core 1Gb SoC #build 6 LINUXFAMILY="sun7i" - BOOTCONFIG="Cubieboard2_config" + BOOTCONFIG="Cubieboard2_config" MODULES="hci_uart gpio_sunxi rfcomm hidp sunxi-ir bonding spi_sun7i" MODULES_NEXT="bonding" DESKTOP_TARGET="trusty,default" @@ -108,7 +108,7 @@ case $BOARD in #description A20 dual core 2Gb SoC Wifi #build 6 LINUXFAMILY="sun7i" - BOOTCONFIG="Cubietruck_config" + BOOTCONFIG="Cubietruck_config" MODULES="hci_uart gpio_sunxi rfcomm hidp sunxi-ir bonding spi_sun7i ap6210" MODULES_NEXT="brcmfmac rfcomm hidp bonding" DESKTOP_TARGET="trusty,%" @@ -138,7 +138,7 @@ case $BOARD in #description A20 dual core 1Gb SoC #build 6 LINUXFAMILY="sun7i" - BOOTCONFIG="A20-OLinuXino-Lime2_defconfig" + BOOTCONFIG="A20-OLinuXino-Lime2_defconfig" MODULES="hci_uart gpio_sunxi rfcomm hidp bonding spi_sun7i 8021q a20_tp" MODULES_NEXT="bonding" DESKTOP_TARGET="trusty,default" @@ -190,7 +190,7 @@ case $BOARD in LINUXFAMILY="sun7i" BOOTCONFIG="Lamobo_R1_defconfig" MODULES="hci_uart gpio_sunxi rfcomm hidp sunxi-ir bonding spi_sun7i 8021q" - MODULES_NEXT="brcmfmac bonding" + MODULES_NEXT="brcmfmac bonding" ;; orangepi)#enabled @@ -311,7 +311,7 @@ case $BOARD in MODULES_NEXT="" SERIALCON="ttymxc0" ;; - + armada)#enabled #description Marvell Armada 38x #build 3 @@ -321,7 +321,7 @@ case $BOARD in MODULES_NEXT="" SERIALCON="ttyS0" ;; - + *) exit_with_error "Board configuration not found" "$BOARD" ;; esac @@ -337,7 +337,7 @@ case $LINUXFAMILY in # Kernel KERNEL_DEFAULT='https://github.com/linux-sunxi/linux-sunxi' KERNEL_DEFAULT_BRANCH="sunxi-3.4" - KERNEL_DEFAULT_SOURCE="linux-sunxi" + KERNEL_DEFAULT_SOURCE="linux-sunxi" # sun8i legacy if [[ $LINUXFAMILY == sun8i ]]; then # KERNEL_DEFAULT="https://github.com/ssvb/linux-sunxi" @@ -345,7 +345,7 @@ case $LINUXFAMILY in KERNEL_DEFAULT="https://github.com/O-Computers/linux-sunxi" KERNEL_DEFAULT_BRANCH="h3-wip" KERNEL_DEFAULT_SOURCE="linux-sun8i" - fi + fi KERNEL_NEXT='git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git' [ "$USE_MAINLINE_GOOGLE_MIRROR" = "yes" ] && KERNEL_NEXT='https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable' KERNEL_NEXT_BRANCH="v"`wget -qO- https://www.kernel.org/finger_banner | grep "The latest st" | awk '{print $NF}' | head -1` @@ -370,14 +370,14 @@ case $LINUXFAMILY in UBOOT_NEXT_BRANCH="v2016.01" fi ;; - + odroidxu4) KERNEL_DEFAULT='https://github.com/hardkernel/linux' KERNEL_DEFAULT_BRANCH="odroidxu3-3.10.y" KERNEL_DEFAULT_SOURCE="linux-odroidxu" KERNEL_NEXT='https://github.com/tobetter/linux' KERNEL_NEXT_BRANCH="odroidxu4-v4.2" - KERNEL_NEXT_SOURCE="linux-odroidxu-next" + KERNEL_NEXT_SOURCE="linux-odroidxu-next" UBOOT_DEFAULT="https://github.com/hardkernel/u-boot.git" UBOOT_DEFAULT_BRANCH="odroidxu3-v2012.07" UBOOT_DEFAULT_SOURCE="u-boot-odroidxu" @@ -388,14 +388,14 @@ case $LINUXFAMILY in UBOOT_DEV_BRANCH=$UBOOT_DEFAULT_BRANCH UBOOT_DEV_SOURCE=$UBOOT_DEFAULT_SOURCE ;; - + udoo) KERNEL_DEFAULT="https://github.com/UDOOboard/linux_kernel" KERNEL_DEFAULT_BRANCH="3.14-1.0.x-udoo" KERNEL_DEFAULT_SOURCE="linux-udoo" KERNEL_NEXT="https://github.com/patrykk/linux-udoo" KERNEL_NEXT_BRANCH="v4.4.0-6-vivante-5.0.11.p7.3" - KERNEL_NEXT_SOURCE="linux-udoo-next" + KERNEL_NEXT_SOURCE="linux-udoo-next" UBOOT_DEFAULT="https://github.com/UDOOboard/uboot-imx" UBOOT_DEFAULT_BRANCH="2015.10.fslc-qdl" UBOOT_DEFAULT_SOURCE="u-boot-udoo" @@ -406,12 +406,12 @@ case $LINUXFAMILY in UBOOT_DEV_BRANCH=$UBOOT_DEFAULT_BRANCH UBOOT_DEV_SOURCE=$UBOOT_DEFAULT_SOURCE ;; - + neo) KERNEL_DEFAULT='https://github.com/UDOOboard/linux_kernel' #KERNEL_DEFAULT_BRANCH="imx_3.14.28_1.0.0_ga_neo" KERNEL_DEFAULT_BRANCH="3.14-1.0.x-udoo" - #KERNEL_DEFAULT_SOURCE="linux-udoo-neo" + #KERNEL_DEFAULT_SOURCE="linux-udoo-neo" KERNEL_DEFAULT_SOURCE="linux-udoo" UBOOT_DEFAULT="https://github.com/UDOOboard/uboot-imx" UBOOT_DEFAULT_BRANCH="2015.04.imx-neo" @@ -423,15 +423,15 @@ case $LINUXFAMILY in UBOOT_DEV_BRANCH=$UBOOT_DEFAULT_BRANCH UBOOT_DEV_SOURCE=$UBOOT_DEFAULT_SOURCE ;; - + cubox) - KERNEL_DEFAULT='https://github.com/linux4kix/linux-linaro-stable-mx6' - KERNEL_DEFAULT_BRANCH="linux-linaro-lsk-v3.14-mx6" + KERNEL_DEFAULT='https://github.com/linux4kix/linux-linaro-stable-mx6' + KERNEL_DEFAULT_BRANCH="linux-linaro-lsk-v3.14-mx6" KERNEL_DEFAULT_SOURCE="linux-cubox" KERNEL_NEXT='git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git' [ "$USE_MAINLINE_GOOGLE_MIRROR" = "yes" ] && KERNEL_NEXT='https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable' KERNEL_NEXT_BRANCH="v"`wget -qO- https://www.kernel.org/finger_banner | grep "The latest st" | awk '{print $NF}' | head -1` - KERNEL_NEXT_SOURCE="linux-vanilla" + KERNEL_NEXT_SOURCE="linux-vanilla" KERNEL_DEV='https://github.com/SolidRun/linux-fslc' KERNEL_DEV_BRANCH="3.14-1.0.x-mx6-sr" KERNEL_DEV_SOURCE="linux-cubox" @@ -445,7 +445,7 @@ case $LINUXFAMILY in UBOOT_DEV_BRANCH=$UBOOT_DEFAULT_BRANCH UBOOT_DEV_SOURCE=$UBOOT_DEFAULT_SOURCE ;; - + s500) KERNEL_DEFAULT='https://github.com/LeMaker/linux-actions' KERNEL_DEFAULT_BRANCH="s500-master" @@ -462,8 +462,8 @@ case $LINUXFAMILY in UBOOT_DEV=$UBOOT_DEFAULT UBOOT_DEV_BRANCH=$UBOOT_DEFAULT_BRANCH UBOOT_DEV_SOURCE=$UBOOT_DEFAULT_SOURCE - ;; - + ;; + toradex) KERNEL_DEFAULT="git://git.toradex.com/linux-toradex.git" KERNEL_DEFAULT_BRANCH="toradex_imx_3.14.28_1.0.0_ga" @@ -477,8 +477,8 @@ case $LINUXFAMILY in UBOOT_DEV=$UBOOT_DEFAULT UBOOT_DEV_BRANCH=$UBOOT_DEFAULT_BRANCH UBOOT_DEV_SOURCE=$UBOOT_DEFAULT_SOURCE - ;; - + ;; + marvell) KERNEL_DEFAULT="https://github.com/SolidRun/linux-armada38x" KERNEL_DEFAULT_BRANCH="linux-3.10.70-15t1-clearfog" @@ -490,7 +490,7 @@ case $LINUXFAMILY in KERNEL_DEV='git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git' [ "$USE_MAINLINE_GOOGLE_MIRROR" = "yes" ] && KERNEL_DEV='https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable' KERNEL_DEV_BRANCH="" - KERNEL_DEV_SOURCE="linux-vanilla" + KERNEL_DEV_SOURCE="linux-vanilla" UBOOT_DEFAULT="https://github.com/SolidRun/u-boot-armada38x" UBOOT_DEFAULT_BRANCH="u-boot-2013.01-15t1-clearfog" UBOOT_DEFAULT_SOURCE="u-boot-armada" @@ -500,8 +500,8 @@ case $LINUXFAMILY in UBOOT_DEV=$UBOOT_DEFAULT UBOOT_DEV_BRANCH=$UBOOT_DEFAULT_BRANCH UBOOT_DEV_SOURCE=$UBOOT_DEFAULT_SOURCE - ;; - + ;; + *) exit_with_error "Defaults not found" "$LINUXFAMILY" ;; esac @@ -509,7 +509,7 @@ esac # Let's set defalt data if not defined in board configuration above [[ -z $LINUXCONFIG ]] && LINUXCONFIG="linux-$LINUXFAMILY-$BRANCH" -[[ -z $LINUXKERNEL ]] && eval LINUXKERNEL=\$KERNEL_${BRANCH^^} +[[ -z $LINUXKERNEL ]] && eval LINUXKERNEL=\$KERNEL_${BRANCH^^} [[ -z $LINUXSOURCE ]] && eval LINUXSOURCE=\$KERNEL_${BRANCH^^}"_SOURCE" [[ -z $KERNELBRANCH ]] && eval KERNELBRANCH=\$KERNEL_${BRANCH^^}"_BRANCH" [[ -z $BOOTLOADER ]] && eval BOOTLOADER=\$UBOOT_${BRANCH^^} @@ -586,17 +586,17 @@ else PACKAGE_LIST_DESKTOP="" fi -# For user override -if [[ -f "$SRC/userpatches/lib.config" ]]; then +# For user override +if [[ -f "$SRC/userpatches/lib.config" ]]; then display_alert "Using user configuration override" "userpatches/lib.config" "info" source $SRC/userpatches/lib.config fi # Build final package list after possible override PACKAGE_LIST="$PACKAGE_LIST $PACKAGE_LIST_RELEASE $PACKAGE_LIST_ADDITIONAL $PACKAGE_LIST_DESKTOP" - + # debug -echo -e "Config: $LINUXCONFIG\nKernel source: $LINUXKERNEL\nBranch: $KERNELBRANCH" >> $DEST/debug/install.log -echo -e "linuxsource: $LINUXSOURCE\nOffset: $OFFSET\nbootsize: $BOOTSIZE" >> $DEST/debug/install.log -echo -e "bootloader: $BOOTLOADER\nbootsource: $BOOTSOURCE\nbootbranch: $BOOTBRANCH" >> $DEST/debug/install.log -echo -e "CPU $CPUMIN / $CPUMAX with $GOVERNOR" >> $DEST/debug/install.log +echo -e "Config: $LINUXCONFIG\nKernel source: $LINUXKERNEL\nBranch: $KERNELBRANCH" >> $DEST/debug/install.log +echo -e "linuxsource: $LINUXSOURCE\nOffset: $OFFSET\nbootsize: $BOOTSIZE" >> $DEST/debug/install.log +echo -e "bootloader: $BOOTLOADER\nbootsource: $BOOTSOURCE\nbootbranch: $BOOTBRANCH" >> $DEST/debug/install.log +echo -e "CPU $CPUMIN / $CPUMAX with $GOVERNOR" >> $DEST/debug/install.log diff --git a/debootstrap-ng.sh b/debootstrap-ng.sh index f8e2c0376..f2b57f9d7 100644 --- a/debootstrap-ng.sh +++ b/debootstrap-ng.sh @@ -43,8 +43,8 @@ debootstrap_ng() trap unmount_on_exit INT TERM EXIT # stage: clean and create directories - rm -rf $DEST/cache/sdcard $DEST/cache/mount - mkdir -p $DEST/cache/sdcard $DEST/cache/mount $DEST/images + rm -rf $CACHEDIR/sdcard $CACHEDIR/mount + mkdir -p $CACHEDIR/sdcard $CACHEDIR/mount $DEST/images # stage: verify tmpfs configuration and mount # default maximum size for tmpfs mount is 1/2 of available RAM @@ -59,7 +59,7 @@ debootstrap_ng() fi if [[ $use_tmpfs == yes ]]; then - mount -t tmpfs -o size=${tmpfs_max_size}M tmpfs $DEST/cache/sdcard + mount -t tmpfs -o size=${tmpfs_max_size}M tmpfs $CACHEDIR/sdcard fi # stage: prepare basic rootfs: unpack cache or create from scratch @@ -72,7 +72,7 @@ debootstrap_ng() install_board_specific # cleanup for install_kernel and install_board_specific - umount $DEST/cache/sdcard/tmp + umount $CACHEDIR/sdcard/tmp # install desktop files if [[ $BUILD_DESKTOP == yes ]]; then @@ -86,19 +86,19 @@ debootstrap_ng() # stage: user customization script # NOTE: installing too many packages may fill tmpfs mount - cp $SRC/userpatches/customize-image.sh $DEST/cache/sdcard/tmp/customize-image.sh - chmod +x $DEST/cache/sdcard/tmp/customize-image.sh + cp $SRC/userpatches/customize-image.sh $CACHEDIR/sdcard/tmp/customize-image.sh + chmod +x $CACHEDIR/sdcard/tmp/customize-image.sh display_alert "Calling image customization script" "customize-image.sh" "info" - chroot $DEST/cache/sdcard /bin/bash -c "/tmp/customize-image.sh $RELEASE $FAMILY $BOARD $BUILD_DESKTOP" + chroot $CACHEDIR/sdcard /bin/bash -c "/tmp/customize-image.sh $RELEASE $FAMILY $BOARD $BUILD_DESKTOP" # stage: cleanup - rm -f $DEST/cache/sdcard/usr/sbin/policy-rc.d - rm -f $DEST/cache/sdcard/usr/bin/qemu-arm-static - if [[ -x $DEST/cache/sdcard/sbin/initctl.REAL ]]; then - mv -f $DEST/cache/sdcard/sbin/initctl.REAL $DEST/cache/sdcard/sbin/initctl + rm -f $CACHEDIR/sdcard/usr/sbin/policy-rc.d + rm -f $CACHEDIR/sdcard/usr/bin/qemu-arm-static + if [[ -x $CACHEDIR/sdcard/sbin/initctl.REAL ]]; then + mv -f $CACHEDIR/sdcard/sbin/initctl.REAL $CACHEDIR/sdcard/sbin/initctl fi - if [[ -x $DEST/cache/sdcard/sbin/start-stop-daemon.REAL ]]; then - mv -f $DEST/cache/sdcard/sbin/start-stop-daemon.REAL $DEST/cache/sdcard/sbin/start-stop-daemon + if [[ -x $CACHEDIR/sdcard/sbin/start-stop-daemon.REAL ]]; then + mv -f $CACHEDIR/sdcard/sbin/start-stop-daemon.REAL $CACHEDIR/sdcard/sbin/start-stop-daemon fi umount_chroot @@ -106,8 +106,8 @@ debootstrap_ng() if [[ $ROOTFS_TYPE == fel || $ROOTFS_TYPE == nfs ]]; then # kill /etc/network/interfaces on target to prevent conflicts between kernel # and userspace network config (mainly on Xenial) - rm -f $DEST/cache/sdcard/etc/network/interfaces - printf "auto lo\niface lo inet loopback\n\niface eth0 inet manual" > $DEST/cache/sdcard/etc/network/interfaces + rm -f $CACHEDIR/sdcard/etc/network/interfaces + printf "auto lo\niface lo inet loopback\n\niface eth0 inet manual" > $CACHEDIR/sdcard/etc/network/interfaces fi if [[ $ROOTFS_TYPE != ext4 ]]; then @@ -117,7 +117,7 @@ debootstrap_ng() fi if [[ $ROOTFS_TYPE == fel ]]; then - FEL_ROOTFS=$DEST/cache/sdcard/ + FEL_ROOTFS=$CACHEDIR/sdcard/ display_alert "Starting FEL boot" "$BOARD" "info" source $SRC/lib/fel-load.sh else @@ -127,10 +127,10 @@ debootstrap_ng() # stage: unmount tmpfs if [[ $use_tmpfs = yes ]]; then - umount $DEST/cache/sdcard + umount $CACHEDIR/sdcard fi - rm -rf $DEST/cache/sdcard + rm -rf $CACHEDIR/sdcard # remove exit trap trap - INT TERM EXIT @@ -144,14 +144,14 @@ create_rootfs_cache() { [[ $BUILD_DESKTOP == yes ]] && local variant_desktop=yes local packages_hash=$(get_package_list_hash $PACKAGE_LIST) - local cache_fname="$DEST/cache/rootfs/$RELEASE${variant_desktop:+_desktop}-ng.$packages_hash.tgz" + local cache_fname="$CACHEDIR/rootfs/$RELEASE${variant_desktop:+_desktop}-ng.$packages_hash.tgz" local display_name=$RELEASE${variant_desktop:+_desktop}-ng.${packages_hash:0:3}...${packages_hash:29}.tgz if [[ -f $cache_fname ]]; then local filemtime=$(stat -c %Y $cache_fname) local currtime=$(date +%s) local diff=$(( (currtime - filemtime) / 86400 )) display_alert "Extracting $display_name" "$diff days old" "info" - pv -p -b -r -c -N "$display_name" "$cache_fname" | pigz -dc | tar xp -C $DEST/cache/sdcard/ + pv -p -b -r -c -N "$display_name" "$cache_fname" | pigz -dc | tar xp -C $CACHEDIR/sdcard/ else display_alert "Creating new rootfs for" "$RELEASE" "info" @@ -169,20 +169,20 @@ create_rootfs_cache() [[ -z $OUTPUT_DIALOG && $RELEASE != wheezy ]] && local apt_extra_progress="--show-progress -o DPKG::Progress-Fancy=1" display_alert "Installing base system" "Stage 1/2" "info" - eval 'debootstrap --include=debconf-utils,locales --arch=armhf --foreign $RELEASE $DEST/cache/sdcard/ $apt_mirror' \ + eval 'debootstrap --include=debconf-utils,locales --arch=armhf --foreign $RELEASE $CACHEDIR/sdcard/ $apt_mirror' \ ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} \ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Debootstrap (stage 1/2)..." $TTY_Y $TTY_X'} \ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} [[ ${PIPESTATUS[0]} -ne 0 ]] && exit_with_error "Debootstrap base system first stage failed" - cp /usr/bin/qemu-arm-static $DEST/cache/sdcard/usr/bin/ + cp /usr/bin/qemu-arm-static $CACHEDIR/sdcard/usr/bin/ # NOTE: not needed? - mkdir -p $DEST/cache/sdcard/usr/share/keyrings/ - cp /usr/share/keyrings/debian-archive-keyring.gpg $DEST/cache/sdcard/usr/share/keyrings/ + mkdir -p $CACHEDIR/sdcard/usr/share/keyrings/ + cp /usr/share/keyrings/debian-archive-keyring.gpg $CACHEDIR/sdcard/usr/share/keyrings/ display_alert "Installing base system" "Stage 2/2" "info" - eval 'chroot $DEST/cache/sdcard /bin/bash -c "/debootstrap/debootstrap --second-stage"' \ + eval 'chroot $CACHEDIR/sdcard /bin/bash -c "/debootstrap/debootstrap --second-stage"' \ ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} \ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Debootstrap (stage 2/2)..." $TTY_Y $TTY_X'} \ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} @@ -194,60 +194,60 @@ create_rootfs_cache() # policy-rc.d script prevents starting or reloading services # from dpkg pre- and post-install scripts during image creation -cat < $DEST/cache/sdcard/usr/sbin/policy-rc.d +cat < $CACHEDIR/sdcard/usr/sbin/policy-rc.d #!/bin/sh exit 101 EOF - chmod 755 $DEST/cache/sdcard/usr/sbin/policy-rc.d + chmod 755 $CACHEDIR/sdcard/usr/sbin/policy-rc.d # ported from debootstrap and multistrap for upstart support - if [[ -x $DEST/cache/sdcard/sbin/initctl ]]; then - mv $DEST/cache/sdcard/sbin/start-stop-daemon $DEST/cache/sdcard/sbin/start-stop-daemon.REAL -cat < $DEST/cache/sdcard/sbin/start-stop-daemon + if [[ -x $CACHEDIR/sdcard/sbin/initctl ]]; then + mv $CACHEDIR/sdcard/sbin/start-stop-daemon $CACHEDIR/sdcard/sbin/start-stop-daemon.REAL +cat < $CACHEDIR/sdcard/sbin/start-stop-daemon #!/bin/sh echo "Warning: Fake start-stop-daemon called, doing nothing" EOF - chmod 755 $DEST/cache/sdcard/sbin/start-stop-daemon + chmod 755 $CACHEDIR/sdcard/sbin/start-stop-daemon fi - if [[ -x $DEST/cache/sdcard/sbin/initctl ]]; then - mv $DEST/cache/sdcard/sbin/initctl $DEST/cache/sdcard/sbin/initctl.REAL -cat < $DEST/cache/sdcard/sbin/initctl + if [[ -x $CACHEDIR/sdcard/sbin/initctl ]]; then + mv $CACHEDIR/sdcard/sbin/initctl $CACHEDIR/sdcard/sbin/initctl.REAL +cat < $CACHEDIR/sdcard/sbin/initctl #!/bin/sh echo "Warning: Fake initctl called, doing nothing" EOF - chmod 755 $DEST/cache/sdcard/sbin/initctl + chmod 755 $CACHEDIR/sdcard/sbin/initctl fi # stage: configure language and locales display_alert "Configuring locales" "$DEST_LANG" "info" - if [ -f $DEST/cache/sdcard/etc/locale.gen ]; then sed -i "s/^# $DEST_LANG/$DEST_LANG/" $DEST/cache/sdcard/etc/locale.gen; fi - eval 'LC_ALL=C LANG=C chroot $DEST/cache/sdcard /bin/bash -c "locale-gen $DEST_LANG"' ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} - eval 'LC_ALL=C LANG=C chroot $DEST/cache/sdcard /bin/bash -c "update-locale LANG=$DEST_LANG LANGUAGE=$DEST_LANG LC_MESSAGES=POSIX"' \ + if [ -f $CACHEDIR/sdcard/etc/locale.gen ]; then sed -i "s/^# $DEST_LANG/$DEST_LANG/" $CACHEDIR/sdcard/etc/locale.gen; fi + eval 'LC_ALL=C LANG=C chroot $CACHEDIR/sdcard /bin/bash -c "locale-gen $DEST_LANG"' ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} + eval 'LC_ALL=C LANG=C chroot $CACHEDIR/sdcard /bin/bash -c "update-locale LANG=$DEST_LANG LANGUAGE=$DEST_LANG LC_MESSAGES=POSIX"' \ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} - LC_ALL=C LANG=C chroot $DEST/cache/sdcard /bin/bash -c "export CHARMAP=$CONSOLE_CHAR FONTFACE=8x16" + LC_ALL=C LANG=C chroot $CACHEDIR/sdcard /bin/bash -c "export CHARMAP=$CONSOLE_CHAR FONTFACE=8x16" # stage: copy proper apt sources list - cp $SRC/lib/config/sources.list.$RELEASE $DEST/cache/sdcard/etc/apt/sources.list + cp $SRC/lib/config/sources.list.$RELEASE $CACHEDIR/sdcard/etc/apt/sources.list # stage: add armbian repository and install key - echo "deb http://apt.armbian.com $RELEASE main" > $DEST/cache/sdcard/etc/apt/sources.list.d/armbian.list - cp $SRC/lib/bin/armbian.key $DEST/cache/sdcard - eval 'chroot $DEST/cache/sdcard /bin/bash -c "cat armbian.key | apt-key add -"' \ + echo "deb http://apt.armbian.com $RELEASE main" > $CACHEDIR/sdcard/etc/apt/sources.list.d/armbian.list + cp $SRC/lib/bin/armbian.key $CACHEDIR/sdcard + eval 'chroot $CACHEDIR/sdcard /bin/bash -c "cat armbian.key | apt-key add -"' \ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} - rm $DEST/cache/sdcard/armbian.key + rm $CACHEDIR/sdcard/armbian.key # stage: update packages list display_alert "Updating package list" "$RELEASE" "info" - eval 'LC_ALL=C LANG=C chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y $apt_extra update"' \ + eval 'LC_ALL=C LANG=C chroot $CACHEDIR/sdcard /bin/bash -c "apt-get -y $apt_extra update"' \ ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} \ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Updating package lists..." $TTY_Y $TTY_X'} \ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} # stage: install additional packages display_alert "Installing packages for" "Armbian" "info" - eval 'LC_ALL=C LANG=C chroot $DEST/cache/sdcard /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y -q \ + eval 'LC_ALL=C LANG=C chroot $CACHEDIR/sdcard /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y -q \ $apt_extra $apt_extra_progress --no-install-recommends install $PACKAGE_LIST"' \ ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} \ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Installing Armbian system..." $TTY_Y $TTY_X'} \ @@ -258,10 +258,10 @@ EOF # DEBUG: print free space echo echo "Free space:" - df -h | grep "$DEST/cache/" | tee -a $DEST/debug/debootstrap.log + df -h | grep "$CACHEDIR/" | tee -a $DEST/debug/debootstrap.log # stage: remove downloaded packages - chroot $DEST/cache/sdcard /bin/bash -c "apt-get clean" + chroot $CACHEDIR/sdcard /bin/bash -c "apt-get clean" # stage: make rootfs cache archive display_alert "Ending debootstrap process and preparing cache" "$RELEASE" "info" @@ -270,9 +270,9 @@ EOF # based on rootfs size calculation umount_chroot - tar cp --directory=$DEST/cache/sdcard/ --exclude='./dev/*' --exclude='./proc/*' --exclude='./run/*' --exclude='./tmp/*' \ + tar cp --directory=$CACHEDIR/sdcard/ --exclude='./dev/*' --exclude='./proc/*' --exclude='./run/*' --exclude='./tmp/*' \ --exclude='./sys/*' . | \ - pv -p -b -r -s $(du -sb $DEST/cache/sdcard/ | cut -f1) -N "$display_name" | pigz > $cache_fname + pv -p -b -r -s $(du -sb $CACHEDIR/sdcard/ | cut -f1) -N "$display_name" | pigz > $cache_fname fi mount_chroot } ############################################################################# @@ -327,7 +327,7 @@ prepare_partitions() # mountopts[nfs] is empty # stage: calculate rootfs size - local rootfs_size=$(du -sm $DEST/cache/sdcard/ | cut -f1) # MiB + local rootfs_size=$(du -sm $CACHEDIR/sdcard/ | cut -f1) # MiB display_alert "Current rootfs size" "$rootfs_size MiB" "info" if [[ -n $FIXED_IMAGE_SIZE && $FIXED_IMAGE_SIZE =~ ^[0-9]+$ ]]; then display_alert "Using user-defined image size" "$FIXED_IMAGE_SIZE MiB" "info" @@ -345,7 +345,7 @@ prepare_partitions() # stage: create blank image display_alert "Creating blank image for rootfs" "$sdsize MiB" "info" - dd if=/dev/zero bs=1M status=none count=$sdsize | pv -p -b -r -s $(( $sdsize * 1024 * 1024 )) | dd status=none of=$DEST/cache/tmprootfs.raw + dd if=/dev/zero bs=1M status=none count=$sdsize | pv -p -b -r -s $(( $sdsize * 1024 * 1024 )) | dd status=none of=$CACHEDIR/tmprootfs.raw # stage: determine partition configuration # boot @@ -364,14 +364,14 @@ prepare_partitions() # stage: create partition table display_alert "Creating partitions" "${bootfs:+/boot: $bootfs }root: $ROOTFS_TYPE" "info" - parted -s $DEST/cache/tmprootfs.raw -- mklabel msdos + parted -s $CACHEDIR/tmprootfs.raw -- mklabel msdos if [[ $ROOTFS_TYPE == nfs ]]; then - parted -s $DEST/cache/tmprootfs.raw -- mkpart primary ${parttype[$bootfs]} ${BOOTSTART}s -1s + parted -s $CACHEDIR/tmprootfs.raw -- mkpart primary ${parttype[$bootfs]} ${BOOTSTART}s -1s elif [[ $BOOTSIZE == 0 ]]; then - parted -s $DEST/cache/tmprootfs.raw -- mkpart primary ${parttype[$ROOTFS_TYPE]} ${ROOTSTART}s -1s + parted -s $CACHEDIR/tmprootfs.raw -- mkpart primary ${parttype[$ROOTFS_TYPE]} ${ROOTSTART}s -1s else - parted -s $DEST/cache/tmprootfs.raw -- mkpart primary ${parttype[$bootfs]} ${BOOTSTART}s ${BOOTEND}s - parted -s $DEST/cache/tmprootfs.raw -- mkpart primary ${parttype[$ROOTFS_TYPE]} ${ROOTSTART}s -1s + parted -s $CACHEDIR/tmprootfs.raw -- mkpart primary ${parttype[$bootfs]} ${BOOTSTART}s ${BOOTEND}s + parted -s $CACHEDIR/tmprootfs.raw -- mkpart primary ${parttype[$ROOTFS_TYPE]} ${ROOTSTART}s -1s fi # stage: mount image @@ -382,7 +382,7 @@ prepare_partitions() fi # NOTE: losetup -P option is not available in Trusty - losetup $LOOP $DEST/cache/tmprootfs.raw + losetup $LOOP $CACHEDIR/tmprootfs.raw partprobe $LOOP # stage: create fs @@ -396,36 +396,36 @@ prepare_partitions() fi # stage: mount partitions and create proper fstab - rm -f $DEST/cache/sdcard/etc/fstab + rm -f $CACHEDIR/sdcard/etc/fstab if [[ $BOOTSIZE == 0 ]]; then - mount ${LOOP}p1 $DEST/cache/mount/ - echo "/dev/mmcblk0p1 / ${parttype[$ROOTFS_TYPE]} defaults,noatime,nodiratime${mountopts[$ROOTFS_TYPE]} 0 1" >> $DEST/cache/sdcard/etc/fstab + mount ${LOOP}p1 $CACHEDIR/mount/ + echo "/dev/mmcblk0p1 / ${parttype[$ROOTFS_TYPE]} defaults,noatime,nodiratime${mountopts[$ROOTFS_TYPE]} 0 1" >> $CACHEDIR/sdcard/etc/fstab else if [[ $ROOTFS_TYPE != nfs ]]; then - mount ${LOOP}p2 $DEST/cache/mount/ - echo "/dev/mmcblk0p2 / ${parttype[$ROOTFS_TYPE]} defaults,noatime,nodiratime${mountopts[$ROOTFS_TYPE]} 0 1" >> $DEST/cache/sdcard/etc/fstab + mount ${LOOP}p2 $CACHEDIR/mount/ + echo "/dev/mmcblk0p2 / ${parttype[$ROOTFS_TYPE]} defaults,noatime,nodiratime${mountopts[$ROOTFS_TYPE]} 0 1" >> $CACHEDIR/sdcard/etc/fstab fi # create /boot on rootfs after it is mounted - mkdir -p $DEST/cache/mount/boot/ - mount ${LOOP}p1 $DEST/cache/mount/boot/ - echo "/dev/mmcblk0p1 /boot ${parttype[$bootfs]} defaults${mountopts[$bootfs]} 0 2" >> $DEST/cache/sdcard/etc/fstab + mkdir -p $CACHEDIR/mount/boot/ + mount ${LOOP}p1 $CACHEDIR/mount/boot/ + echo "/dev/mmcblk0p1 /boot ${parttype[$bootfs]} defaults${mountopts[$bootfs]} 0 2" >> $CACHEDIR/sdcard/etc/fstab fi - echo "tmpfs /tmp tmpfs defaults,rw,nosuid 0 0" >> $DEST/cache/sdcard/etc/fstab + echo "tmpfs /tmp tmpfs defaults,rw,nosuid 0 0" >> $CACHEDIR/sdcard/etc/fstab # stage: create boot script if [[ $ROOTFS_TYPE == nfs ]]; then # copy script provided by user if exists if [[ -f $SRC/userpatches/nfs-boot.cmd ]]; then display_alert "Using custom NFS boot script" "userpatches/nfs-boot.cmd" "info" - cp $SRC/userpatches/nfs-boot.cmd $DEST/cache/sdcard/boot/boot.cmd + cp $SRC/userpatches/nfs-boot.cmd $CACHEDIR/sdcard/boot/boot.cmd else - cp $SRC/lib/scripts/nfs-boot.cmd.template $DEST/cache/sdcard/boot/boot.cmd + cp $SRC/lib/scripts/nfs-boot.cmd.template $CACHEDIR/sdcard/boot/boot.cmd fi elif [[ $BOOTSIZE != 0 ]]; then - sed -i 's/mmcblk0p1/mmcblk0p2/' $DEST/cache/sdcard/boot/boot.cmd - sed -i "s/rootfstype=ext4/rootfstype=$ROOTFS_TYPE/" $DEST/cache/sdcard/boot/boot.cmd + sed -i 's/mmcblk0p1/mmcblk0p2/' $CACHEDIR/sdcard/boot/boot.cmd + sed -i "s/rootfstype=ext4/rootfstype=$ROOTFS_TYPE/" $CACHEDIR/sdcard/boot/boot.cmd fi - mkimage -C none -A arm -T script -d $DEST/cache/sdcard/boot/boot.cmd $DEST/cache/sdcard/boot/boot.scr > /dev/null 2>&1 + mkimage -C none -A arm -T script -d $CACHEDIR/sdcard/boot/boot.cmd $CACHEDIR/sdcard/boot/boot.scr > /dev/null 2>&1 } ############################################################################# @@ -447,47 +447,47 @@ create_image() if [[ $ROOTFS_TYPE != nfs ]]; then display_alert "Copying files to image" "tmprootfs.raw" "info" eval 'rsync -aHWh --exclude="/boot/*" --exclude="/dev/*" --exclude="/proc/*" --exclude="/run/*" --exclude="/tmp/*" \ - --exclude="/sys/*" --info=progress2,stats1 $DEST/cache/sdcard/ $DEST/cache/mount/' + --exclude="/sys/*" --info=progress2,stats1 $CACHEDIR/sdcard/ $CACHEDIR/mount/' else display_alert "Creating rootfs archive" "rootfs.tgz" "info" - tar cp --directory=$DEST/cache/sdcard/ --exclude='./boot/*' --exclude='./dev/*' --exclude='./proc/*' --exclude='./run/*' --exclude='./tmp/*' \ + tar cp --directory=$CACHEDIR/sdcard/ --exclude='./boot/*' --exclude='./dev/*' --exclude='./proc/*' --exclude='./run/*' --exclude='./tmp/*' \ --exclude='./sys/*' . | \ - pv -p -b -r -s $(du -sb $DEST/cache/sdcard/ | cut -f1) -N "rootfs.tgz" | pigz > $DEST/images/$VERSION-rootfs.tgz + pv -p -b -r -s $(du -sb $CACHEDIR/sdcard/ | cut -f1) -N "rootfs.tgz" | pigz > $DEST/images/$VERSION-rootfs.tgz fi # stage: rsync /boot display_alert "Copying files to /boot partition" "tmprootfs.raw" "info" - if [[ $(findmnt --target $DEST/cache/mount/boot -o FSTYPE -n) == vfat ]]; then + if [[ $(findmnt --target $CACHEDIR/mount/boot -o FSTYPE -n) == vfat ]]; then # fat32 - rsync -rLtWh --info=progress2,stats1 $DEST/cache/sdcard/boot $DEST/cache/mount + rsync -rLtWh --info=progress2,stats1 $CACHEDIR/sdcard/boot $CACHEDIR/mount else # ext4 - rsync -aHWh --info=progress2,stats1 $DEST/cache/sdcard/boot $DEST/cache/mount + rsync -aHWh --info=progress2,stats1 $CACHEDIR/sdcard/boot $CACHEDIR/mount fi # DEBUG: print free space echo echo "Free space:" - df -h | grep "$DEST/cache/" | tee -a $DEST/debug/debootstrap.log + df -h | grep "$CACHEDIR/" | tee -a $DEST/debug/debootstrap.log # stage: write u-boot write_uboot $LOOP # stage: copy armbian.txt TODO: Copy only if creating zip file? - cp $DEST/cache/sdcard/etc/armbian.txt $DEST/cache/ + cp $CACHEDIR/sdcard/etc/armbian.txt $CACHEDIR/ # unmount /boot first, rootfs second, image file last - if [[ $BOOTSIZE != 0 ]]; then umount -l $DEST/cache/mount/boot; fi - if [[ $ROOTFS_TYPE != nfs ]]; then umount -l $DEST/cache/mount; fi + if [[ $BOOTSIZE != 0 ]]; then umount -l $CACHEDIR/mount/boot; fi + if [[ $ROOTFS_TYPE != nfs ]]; then umount -l $CACHEDIR/mount; fi losetup -d $LOOP - mv $DEST/cache/tmprootfs.raw $DEST/cache/$VERSION.raw - cd $DEST/cache/ + mv $CACHEDIR/tmprootfs.raw $CACHEDIR/$VERSION.raw + cd $CACHEDIR/ # stage: compressing or copying image file if [[ -n $FIXED_IMAGE_SIZE || $COMPRESS_OUTPUTIMAGE == no ]]; then display_alert "Copying image file" "$VERSION.raw" "info" - mv -f $DEST/cache/$VERSION.raw $DEST/images/$VERSION.raw + mv -f $CACHEDIR/$VERSION.raw $DEST/images/$VERSION.raw display_alert "Done building" "$DEST/images/$VERSION.raw" "info" else display_alert "Signing and compressing" "$VERSION.zip" "info" @@ -508,10 +508,10 @@ create_image() # mount_chroot() { - mount -t proc chproc $DEST/cache/sdcard/proc - mount -t sysfs chsys $DEST/cache/sdcard/sys - mount -t devtmpfs chdev $DEST/cache/sdcard/dev || mount --bind /dev $DEST/cache/sdcard/dev - mount -t devpts chpts $DEST/cache/sdcard/dev/pts + mount -t proc chproc $CACHEDIR/sdcard/proc + mount -t sysfs chsys $CACHEDIR/sdcard/sys + mount -t devtmpfs chdev $CACHEDIR/sdcard/dev || mount --bind /dev $CACHEDIR/sdcard/dev + mount -t devpts chpts $CACHEDIR/sdcard/dev/pts } ############################################################################# # umount_chroot @@ -520,10 +520,10 @@ mount_chroot() # umount_chroot() { - umount -l $DEST/cache/sdcard/dev/pts >/dev/null 2>&1 - umount -l $DEST/cache/sdcard/dev >/dev/null 2>&1 - umount -l $DEST/cache/sdcard/proc >/dev/null 2>&1 - umount -l $DEST/cache/sdcard/sys >/dev/null 2>&1 + umount -l $CACHEDIR/sdcard/dev/pts >/dev/null 2>&1 + umount -l $CACHEDIR/sdcard/dev >/dev/null 2>&1 + umount -l $CACHEDIR/sdcard/proc >/dev/null 2>&1 + umount -l $CACHEDIR/sdcard/sys >/dev/null 2>&1 } ############################################################################# # unmount_on_exit @@ -531,10 +531,10 @@ umount_chroot() unmount_on_exit() { umount_chroot - umount -l $DEST/cache/sdcard >/dev/null 2>&1 - umount -l $DEST/cache/mount/boot >/dev/null 2>&1 - umount -l $DEST/cache/mount >/dev/null 2>&1 + umount -l $CACHEDIR/sdcard >/dev/null 2>&1 + umount -l $CACHEDIR/mount/boot >/dev/null 2>&1 + umount -l $CACHEDIR/mount >/dev/null 2>&1 losetup -d $LOOP >/dev/null 2>&1 - rm -rf $DEST/cache/sdcard + rm -rf $CACHEDIR/sdcard exit_with_error "debootstrap-ng was interrupted" } ############################################################################# diff --git a/debootstrap.sh b/debootstrap.sh index 83b74952e..1890e2f13 100644 --- a/debootstrap.sh +++ b/debootstrap.sh @@ -27,12 +27,12 @@ custom_debootstrap (){ #fi # create needed directories and mount image to next free loop device -rm -rf $DEST/cache/sdcard/ -mkdir -p $DEST/cache/rootfs $DEST/cache/sdcard +rm -rf $CACHEDIR/sdcard/ +mkdir -p $CACHEDIR/rootfs $CACHEDIR/sdcard -cd $DEST/cache +cd $CACHEDIR -# We need to re-calculate from human to machine +# We need to re-calculate from human to machine BOOTSTART=$(($OFFSET*2048)) ROOTSTART=$(($BOOTSTART+($BOOTSIZE*2048))) BOOTEND=$(($ROOTSTART-1)) @@ -40,10 +40,10 @@ BOOTEND=$(($ROOTSTART-1)) # Create image file if [ "$OUTPUT_DIALOG" = "yes" ]; then - (dd if=/dev/zero bs=1M status=none count=$SDSIZE | pv -n -s $(( $SDSIZE * 1024 * 1024 )) | dd status=none of=$DEST/cache/tmprootfs.raw) 2>&1 \ + (dd if=/dev/zero bs=1M status=none count=$SDSIZE | pv -n -s $(( $SDSIZE * 1024 * 1024 )) | dd status=none of=$CACHEDIR/tmprootfs.raw) 2>&1 \ | dialog --backtitle "$backtitle" --title "Creating blank image ($SDSIZE), please wait ..." --gauge "" 5 70 else - dd if=/dev/zero bs=1M status=none count=$SDSIZE | pv -p -b -r -s $(( $SDSIZE * 1024 * 1024 )) | dd status=none of=$DEST/cache/tmprootfs.raw + dd if=/dev/zero bs=1M status=none count=$SDSIZE | pv -p -b -r -s $(( $SDSIZE * 1024 * 1024 )) | dd status=none of=$CACHEDIR/tmprootfs.raw fi # Find first available free device @@ -55,31 +55,31 @@ exit fi # Mount image as block device -losetup $LOOP $DEST/cache/tmprootfs.raw +losetup $LOOP $CACHEDIR/tmprootfs.raw sync # Create partitions and file-system parted -s $LOOP -- mklabel msdos -if [ "$BOOTSIZE" -eq "0" ]; then +if [ "$BOOTSIZE" -eq "0" ]; then parted -s $LOOP -- mkpart primary ext4 $ROOTSTART"s" -1s partprobe $LOOP mkfs.ext4 -q $LOOP"p1" - mount $LOOP"p1" $DEST/cache/sdcard/ + mount $LOOP"p1" $CACHEDIR/sdcard/ else parted -s $LOOP -- mkpart primary fat16 $BOOTSTART"s" $BOOTEND"s" parted -s $LOOP -- mkpart primary ext4 $ROOTSTART"s" -1s partprobe $LOOP mkfs.vfat -n "$IMAGEVOLUME" $LOOP"p1" >/dev/null 2>&1 mkfs.ext4 -q $LOOP"p2" - mount $LOOP"p2" $DEST/cache/sdcard/ - mkdir -p $DEST/cache/sdcard/boot - mount $LOOP"p1" $DEST/cache/sdcard/boot + mount $LOOP"p2" $CACHEDIR/sdcard/ + mkdir -p $CACHEDIR/sdcard/boot + mount $LOOP"p1" $CACHEDIR/sdcard/boot fi # rootfs cache file name [[ $BUILD_DESKTOP == yes ]] && local variant_desktop=yes local packages_hash=$(get_package_list_hash $PACKAGE_LIST) -local cache_fname="$DEST/cache/rootfs/$RELEASE${variant_desktop:+_desktop}.$packages_hash.tgz" +local cache_fname="$CACHEDIR/rootfs/$RELEASE${variant_desktop:+_desktop}.$packages_hash.tgz" # Uncompress from cache if [ -f "$cache_fname" ]; then @@ -87,11 +87,11 @@ if [ -f "$cache_fname" ]; then currtime=`date +%s` diff=$(( (currtime - filemtime) / 86400 )) display_alert "Extracting $RELEASE from cache" "$diff days old" "info" - pv -p -b -r -c -N "$(basename $cache_fname)" "$cache_fname" | pigz -dc | tar xp -C $DEST/cache/sdcard/ - rm $DEST/cache/sdcard/etc/resolv.conf - echo "nameserver 8.8.8.8" > $DEST/cache/sdcard/etc/resolv.conf + pv -p -b -r -c -N "$(basename $cache_fname)" "$cache_fname" | pigz -dc | tar xp -C $CACHEDIR/sdcard/ + rm $CACHEDIR/sdcard/etc/resolv.conf + echo "nameserver 8.8.8.8" > $CACHEDIR/sdcard/etc/resolv.conf if [ "$diff" -gt "3" ]; then - chroot $DEST/cache/sdcard /bin/bash -c "apt-get update" | dialog --backtitle "$backtitle" --title "Force package update ..." --progressbox $TTY_Y $TTY_X + chroot $CACHEDIR/sdcard /bin/bash -c "apt-get update" | dialog --backtitle "$backtitle" --title "Force package update ..." --progressbox $TTY_Y $TTY_X fi fi @@ -100,77 +100,77 @@ if [ ! -f "$cache_fname" ]; then # debootstrap base system [[ $DISTRIBUTION == "Debian" ]] && local redir="http://httpredir.debian.org/debian/" -debootstrap --include=openssh-server,debconf-utils --arch=armhf --foreign $RELEASE $DEST/cache/sdcard/ $redir | dialog --backtitle "$backtitle" --title "Debootstrap $DISTRIBUTION $RELEASE base system to image template ..." --progressbox $TTY_Y $TTY_X +debootstrap --include=openssh-server,debconf-utils --arch=armhf --foreign $RELEASE $CACHEDIR/sdcard/ $redir | dialog --backtitle "$backtitle" --title "Debootstrap $DISTRIBUTION $RELEASE base system to image template ..." --progressbox $TTY_Y $TTY_X # we need emulator for second stage -cp /usr/bin/qemu-arm-static $DEST/cache/sdcard/usr/bin/ +cp /usr/bin/qemu-arm-static $CACHEDIR/sdcard/usr/bin/ # and keys -d=$DEST/cache/sdcard/usr/share/keyrings/ -test -d "$d" || mkdir -p "$d" && cp /usr/share/keyrings/debian-archive-keyring.gpg "$d" +d=$CACHEDIR/sdcard/usr/share/keyrings/ +test -d "$d" || mkdir -p "$d" && cp /usr/share/keyrings/debian-archive-keyring.gpg "$d" # enable arm binary format so that the cross-architecture chroot environment will work test -e /proc/sys/fs/binfmt_misc/qemu-arm || update-binfmts --enable qemu-arm # debootstrap second stage -chroot $DEST/cache/sdcard /bin/bash -c "/debootstrap/debootstrap --second-stage" | dialog --backtitle "$backtitle" --title "Installing $DISTRIBUTION $RELEASE base system to image template ..." --progressbox $TTY_Y $TTY_X +chroot $CACHEDIR/sdcard /bin/bash -c "/debootstrap/debootstrap --second-stage" | dialog --backtitle "$backtitle" --title "Installing $DISTRIBUTION $RELEASE base system to image template ..." --progressbox $TTY_Y $TTY_X # mount proc, sys and dev -mount -t proc chproc $DEST/cache/sdcard/proc -mount -t sysfs chsys $DEST/cache/sdcard/sys -mount -t devtmpfs chdev $DEST/cache/sdcard/dev || mount --bind /dev $DEST/cache/sdcard/dev -mount -t devpts chpts $DEST/cache/sdcard/dev/pts +mount -t proc chproc $CACHEDIR/sdcard/proc +mount -t sysfs chsys $CACHEDIR/sdcard/sys +mount -t devtmpfs chdev $CACHEDIR/sdcard/dev || mount --bind /dev $CACHEDIR/sdcard/dev +mount -t devpts chpts $CACHEDIR/sdcard/dev/pts # choose proper apt list -cp $SRC/lib/config/sources.list.$RELEASE $DEST/cache/sdcard/etc/apt/sources.list +cp $SRC/lib/config/sources.list.$RELEASE $CACHEDIR/sdcard/etc/apt/sources.list # add armbian key -echo "deb http://apt.armbian.com $RELEASE main" > $DEST/cache/sdcard/etc/apt/sources.list.d/armbian.list -cp $SRC/lib/bin/armbian.key $DEST/cache/sdcard -chroot $DEST/cache/sdcard /bin/bash -c "cat armbian.key | apt-key add -" -rm $DEST/cache/sdcard/armbian.key +echo "deb http://apt.armbian.com $RELEASE main" > $CACHEDIR/sdcard/etc/apt/sources.list.d/armbian.list +cp $SRC/lib/bin/armbian.key $CACHEDIR/sdcard +chroot $CACHEDIR/sdcard /bin/bash -c "cat armbian.key | apt-key add -" +rm $CACHEDIR/sdcard/armbian.key # update and upgrade -LC_ALL=C LANGUAGE=C LANG=C chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y update" | dialog --progressbox "Updating package databases ..." $TTY_Y $TTY_X +LC_ALL=C LANGUAGE=C LANG=C chroot $CACHEDIR/sdcard /bin/bash -c "apt-get -y update" | dialog --progressbox "Updating package databases ..." $TTY_Y $TTY_X # generate locales and install packets display_alert "Install locales" "$DEST_LANG" "info" -LC_ALL=C LANGUAGE=C LANG=C chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y -qq install locales" -if [ -f $DEST/cache/sdcard/etc/locale.gen ]; then sed -i "s/^# $DEST_LANG/$DEST_LANG/" $DEST/cache/sdcard/etc/locale.gen; fi -LC_ALL=C LANGUAGE=C LANG=C chroot $DEST/cache/sdcard /bin/bash -c "locale-gen $DEST_LANG" -LC_ALL=C LANGUAGE=C LANG=C chroot $DEST/cache/sdcard /bin/bash -c "export CHARMAP=$CONSOLE_CHAR FONTFACE=8x16 LANG=$DEST_LANG LANGUAGE=$DEST_LANG DEBIAN_FRONTEND=noninteractive" -LC_ALL=C LANGUAGE=C LANG=C chroot $DEST/cache/sdcard /bin/bash -c "update-locale LANG=$DEST_LANG LANGUAGE=$DEST_LANG LC_MESSAGES=POSIX" +LC_ALL=C LANGUAGE=C LANG=C chroot $CACHEDIR/sdcard /bin/bash -c "apt-get -y -qq install locales" +if [ -f $CACHEDIR/sdcard/etc/locale.gen ]; then sed -i "s/^# $DEST_LANG/$DEST_LANG/" $CACHEDIR/sdcard/etc/locale.gen; fi +LC_ALL=C LANGUAGE=C LANG=C chroot $CACHEDIR/sdcard /bin/bash -c "locale-gen $DEST_LANG" +LC_ALL=C LANGUAGE=C LANG=C chroot $CACHEDIR/sdcard /bin/bash -c "export CHARMAP=$CONSOLE_CHAR FONTFACE=8x16 LANG=$DEST_LANG LANGUAGE=$DEST_LANG DEBIAN_FRONTEND=noninteractive" +LC_ALL=C LANGUAGE=C LANG=C chroot $CACHEDIR/sdcard /bin/bash -c "update-locale LANG=$DEST_LANG LANGUAGE=$DEST_LANG LC_MESSAGES=POSIX" install_packet "$PACKAGE_LIST" "Installing Armbian on the top of $DISTRIBUTION $RELEASE base system ..." -chroot $DEST/cache/sdcard /bin/bash -c "apt-get clean" -chroot $DEST/cache/sdcard /bin/bash -c "sync" -chroot $DEST/cache/sdcard /bin/bash -c "unset DEBIAN_FRONTEND" +chroot $CACHEDIR/sdcard /bin/bash -c "apt-get clean" +chroot $CACHEDIR/sdcard /bin/bash -c "sync" +chroot $CACHEDIR/sdcard /bin/bash -c "unset DEBIAN_FRONTEND" sync sleep 3 # unmount proc, sys and dev from chroot -umount -l $DEST/cache/sdcard/dev/pts -umount -l $DEST/cache/sdcard/dev -umount -l $DEST/cache/sdcard/proc -umount -l $DEST/cache/sdcard/sys +umount -l $CACHEDIR/sdcard/dev/pts +umount -l $CACHEDIR/sdcard/dev +umount -l $CACHEDIR/sdcard/proc +umount -l $CACHEDIR/sdcard/sys # kill process inside -KILLPROC=$(ps -uax | pgrep ntpd | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi -KILLPROC=$(ps -uax | pgrep dbus-daemon | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi -KILLPROC=$(ps -uax | pgrep bluetoothd | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi -KILLPROC=$(ps -uax | pgrep acpid | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi -KILLPROC=$(ps -uax | pgrep python | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi +KILLPROC=$(ps -uax | pgrep ntpd | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi +KILLPROC=$(ps -uax | pgrep dbus-daemon | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi +KILLPROC=$(ps -uax | pgrep bluetoothd | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi +KILLPROC=$(ps -uax | pgrep acpid | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi +KILLPROC=$(ps -uax | pgrep python | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi display_alert "Closing debootstrap process and preparing cache." "" "info" -tar cp --directory=$DEST/cache/sdcard/ --exclude='./dev/*' --exclude='./proc/*' --exclude='./run/*' --exclude='./tmp/*' \ ---exclude='./mnt/*' --exclude='./sys/*' . | pv -p -b -r -s $(du -sb $DEST/cache/sdcard/ | cut -f1) -N "$(basename $cache_fname)" | pigz > $cache_fname +tar cp --directory=$CACHEDIR/sdcard/ --exclude='./dev/*' --exclude='./proc/*' --exclude='./run/*' --exclude='./tmp/*' \ +--exclude='./mnt/*' --exclude='./sys/*' . | pv -p -b -r -s $(du -sb $CACHEDIR/sdcard/ | cut -f1) -N "$(basename $cache_fname)" | pigz > $cache_fname fi # # mount proc, sys and dev -mount -t proc chproc $DEST/cache/sdcard/proc -mount -t sysfs chsys $DEST/cache/sdcard/sys -mount -t devtmpfs chdev $DEST/cache/sdcard/dev || mount --bind /dev $DEST/cache/sdcard/dev -mount -t devpts chpts $DEST/cache/sdcard/dev/pts +mount -t proc chproc $CACHEDIR/sdcard/proc +mount -t sysfs chsys $CACHEDIR/sdcard/sys +mount -t devtmpfs chdev $CACHEDIR/sdcard/dev || mount --bind /dev $CACHEDIR/sdcard/dev +mount -t devpts chpts $CACHEDIR/sdcard/dev/pts } shrinking_raw_image (){ # Parameter: RAW image with full path @@ -186,7 +186,7 @@ losetup $LOOP $RAWIMAGE PARTSTART=$(parted $LOOP unit s print -sm | tail -1 | cut -d: -f2 | sed 's/s//') PARTEND=$(parted $LOOP unit s print -sm | head -3 | tail -1 | cut -d: -f3 | sed 's/s//') # end of first partition PARTSTARTBLOCKS=$(($PARTSTART*512)) -echo "PARTSTART $PARTSTART PARTEND $PARTEND PARTSTARTBLOCKS $PARTSTARTBLOCKS" >> $DEST/debug/install.log +echo "PARTSTART $PARTSTART PARTEND $PARTEND PARTSTARTBLOCKS $PARTSTARTBLOCKS" >> $DEST/debug/install.log sleep 1; losetup -d $LOOP # convert from EXT4 to EXT2 @@ -198,7 +198,7 @@ resize2fs $LOOP -M >/dev/null 2>&1 BLOCKSIZE=$(LANGUAGE=english tune2fs -l $LOOP | grep "Block count" | awk '{ print $(NF)}') RESERVEDBLOCKSIZE=$(LANGUAGE=english tune2fs -l $LOOP | grep "Reserved block count" | awk '{ print $(NF)}') BLOCKSIZE=$(($PARTSTART+$BLOCKSIZE+50000)) # fixed reserve to be enough for swap file creation -echo "BLOCKSIZE $BLOCKSIZE RESERVEDBLOCKSIZE $RESERVEDBLOCKSIZE" >> $DEST/debug/install.log +echo "BLOCKSIZE $BLOCKSIZE RESERVEDBLOCKSIZE $RESERVEDBLOCKSIZE" >> $DEST/debug/install.log resize2fs $LOOP $BLOCKSIZE >/dev/null 2>&1 tune2fs -O has_journal $LOOP >/dev/null 2>&1 tune2fs -o journal_data_writeback $LOOP >/dev/null 2>&1 @@ -222,27 +222,27 @@ TRUNCATE=$(parted -m $LOOP 'unit s print' | tail -1 | awk -F':' '{ print $3 }' | TRUNCATE=$((($TRUNCATE+1)*512)) truncate -s $TRUNCATE $RAWIMAGE >/dev/null 2>&1 losetup -d $LOOP -echo "NEWSIZE $NEWSIZE STARTFROM $STARTFROM TRUNCATE $TRUNCATE" >> $DEST/debug/install.log +echo "NEWSIZE $NEWSIZE STARTFROM $STARTFROM TRUNCATE $TRUNCATE" >> $DEST/debug/install.log } closing_image (){ #-------------------------------------------------------------------------------------------------------------------------------- -# Closing image and clean-up +# Closing image and clean-up #-------------------------------------------------------------------------------------------------------------------------------- display_alert "Possible after install." "customize-image.sh" "info" -cp $SRC/userpatches/customize-image.sh $DEST/cache/sdcard/tmp/customize-image.sh -chmod +x $DEST/cache/sdcard/tmp/customize-image.sh -chroot $DEST/cache/sdcard /bin/bash -c "/tmp/customize-image.sh $RELEASE $FAMILY $BOARD $BUILD_DESKTOP" -chroot $DEST/cache/sdcard /bin/bash -c "sync" +cp $SRC/userpatches/customize-image.sh $CACHEDIR/sdcard/tmp/customize-image.sh +chmod +x $CACHEDIR/sdcard/tmp/customize-image.sh +chroot $CACHEDIR/sdcard /bin/bash -c "/tmp/customize-image.sh $RELEASE $FAMILY $BOARD $BUILD_DESKTOP" +chroot $CACHEDIR/sdcard /bin/bash -c "sync" sync sleep 3 # unmount proc, sys and dev from chroot -umount -l $DEST/cache/sdcard/dev/pts -umount -l $DEST/cache/sdcard/dev -umount -l $DEST/cache/sdcard/proc -umount -l $DEST/cache/sdcard/sys -umount -l $DEST/cache/sdcard/tmp >/dev/null 2>&1 +umount -l $CACHEDIR/sdcard/dev/pts +umount -l $CACHEDIR/sdcard/dev +umount -l $CACHEDIR/sdcard/proc +umount -l $CACHEDIR/sdcard/sys +umount -l $CACHEDIR/sdcard/tmp >/dev/null 2>&1 # let's create nice file name VER="${VER/-$LINUXFAMILY/}" @@ -254,44 +254,44 @@ VERSION="${VERSION//__/_}" if [ "$BUILD_DESKTOP" = "yes" ]; then VERSION=$VERSION"_desktop" fi - + # kill process inside -KILLPROC=$(ps -uax | pgrep ntpd | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi -KILLPROC=$(ps -uax | pgrep dbus-daemon | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi -KILLPROC=$(ps -uax | pgrep bluetoothd | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi -KILLPROC=$(ps -uax | pgrep acpid | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi +KILLPROC=$(ps -uax | pgrep ntpd | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi +KILLPROC=$(ps -uax | pgrep dbus-daemon | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi +KILLPROC=$(ps -uax | pgrep bluetoothd | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi +KILLPROC=$(ps -uax | pgrep acpid | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi # same info outside the image -cp $DEST/cache/sdcard/etc/armbian.txt $DEST/cache/ +cp $CACHEDIR/sdcard/etc/armbian.txt $CACHEDIR/ sleep 2 -rm $DEST/cache/sdcard/usr/bin/qemu-arm-static +rm $CACHEDIR/sdcard/usr/bin/qemu-arm-static sleep 2 -umount -l $DEST/cache/sdcard/boot > /dev/null 2>&1 || /bin/true -umount -l $DEST/cache/sdcard/ +umount -l $CACHEDIR/sdcard/boot > /dev/null 2>&1 || /bin/true +umount -l $CACHEDIR/sdcard/ sleep 2 losetup -d $LOOP -rm -rf $DEST/cache/sdcard/ +rm -rf $CACHEDIR/sdcard/ # write bootloader LOOP=$(losetup -f) -losetup $LOOP $DEST/cache/tmprootfs.raw +losetup $LOOP $CACHEDIR/tmprootfs.raw write_uboot $LOOP sleep 3 losetup -d $LOOP sync sleep 2 -mv $DEST/cache/tmprootfs.raw $DEST/cache/$VERSION.raw +mv $CACHEDIR/tmprootfs.raw $CACHEDIR/$VERSION.raw sync sleep 2 # let's shrint it -shrinking_raw_image "$DEST/cache/$VERSION.raw" "15" +shrinking_raw_image "$CACHEDIR/$VERSION.raw" "15" sleep 2 -cd $DEST/cache/ +cd $CACHEDIR/ cp $SRC/lib/bin/imagewriter.exe . # sign with PGP if [[ $GPG_PASS != "" ]] ; then - echo $GPG_PASS | gpg --passphrase-fd 0 --armor --detach-sign --batch --yes $VERSION.raw + echo $GPG_PASS | gpg --passphrase-fd 0 --armor --detach-sign --batch --yes $VERSION.raw echo $GPG_PASS | gpg --passphrase-fd 0 --armor --detach-sign --batch --yes imagewriter.exe echo $GPG_PASS | gpg --passphrase-fd 0 --armor --detach-sign --batch --yes armbian.txt fi @@ -301,8 +301,8 @@ if [[ $COMPRESS_OUTPUTIMAGE == no ]]; then rm -f *.asc imagewriter.* armbian.txt mv *.raw $DEST/images/ else - zip -FSq $DEST/images/$VERSION.zip $VERSION.raw* armbian.txt imagewriter.* - rm -f $VERSION.raw *.asc imagewriter.* armbian.txt + zip -FSq $DEST/images/$VERSION.zip $VERSION.raw* armbian.txt imagewriter.* + rm -f $VERSION.raw *.asc imagewriter.* armbian.txt fi } @@ -322,11 +322,11 @@ procent=${procent%.*} if [[ $3 == "host" ]]; then DEBIAN_FRONTEND=noninteractive apt-get -qq -y install $x >> $DEST/debug/install.log 2>&1 else - chroot $DEST/cache/sdcard /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -qq -y install $x --no-install-recommends" >> $DEST/debug/install.log 2>&1 + chroot $CACHEDIR/sdcard /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -qq -y install $x --no-install-recommends" >> $DEST/debug/install.log 2>&1 fi - + if [ $? -ne 0 ]; then display_alert "Installation of package failed" "$INSTALL" "err"; exit 1; fi - + if [[ $4 != "quiet" ]]; then printf '%.0f\n' $procent | dialog --backtitle "$backtitle" --title "$2" --gauge "\n\n$x" 9 70 fi diff --git a/desktop.sh b/desktop.sh index e08aeacde..c5fa8a902 100644 --- a/desktop.sh +++ b/desktop.sh @@ -16,101 +16,101 @@ install_desktop (){ #--------------------------------------------------------------------------------------------------------------------------------- display_alert "Installing desktop" "XFCE" "info" -umount $DEST/cache/sdcard/tmp >/dev/null 2>&1 -mount --bind $SRC/lib/bin/ $DEST/cache/sdcard/tmp +umount $CACHEDIR/sdcard/tmp >/dev/null 2>&1 +mount --bind $SRC/lib/bin/ $CACHEDIR/sdcard/tmp # Debian Wheezy if [[ $RELEASE == "wheezy" ]]; then # copy wallpapers and default desktop settings - d=$DEST/cache/sdcard/usr/share/xfce4/backdrops/ - test -d "$d" || mkdir -p "$d" && cp $SRC/lib/bin/armbian*.jpg "$d" - chroot $DEST/cache/sdcard /bin/bash -c "tar xfz /tmp/wheezy-desktop.tgz -C /etc/skel/" - chroot $DEST/cache/sdcard /bin/bash -c "tar xfz /tmp/wheezy-desktop.tgz -C /root/" + d=$CACHEDIR/sdcard/usr/share/xfce4/backdrops/ + test -d "$d" || mkdir -p "$d" && cp $SRC/lib/bin/armbian*.jpg "$d" + chroot $CACHEDIR/sdcard /bin/bash -c "tar xfz /tmp/wheezy-desktop.tgz -C /etc/skel/" + chroot $CACHEDIR/sdcard /bin/bash -c "tar xfz /tmp/wheezy-desktop.tgz -C /root/" fi # Debian Jessie if [[ $RELEASE == "jessie" ]]; then # copy wallpapers and default desktop settings - d=$DEST/cache/sdcard/usr/share/backgrounds/xfce/ - test -d "$d" || mkdir -p "$d" && cp $SRC/lib/bin/armbian*.jpg "$d" - chroot $DEST/cache/sdcard /bin/bash -c "tar xfz /tmp/jessie-desktop.tgz -C /etc/skel/" - chroot $DEST/cache/sdcard /bin/bash -c "tar xfz /tmp/jessie-desktop.tgz -C /root/" - mkdir -p $DEST/cache/sdcard/etc/polkit-1/localauthority/50-local.d - cp $SRC/lib/config/polkit-jessie/*.pkla $DEST/cache/sdcard/etc/polkit-1/localauthority/50-local.d/ + d=$CACHEDIR/sdcard/usr/share/backgrounds/xfce/ + test -d "$d" || mkdir -p "$d" && cp $SRC/lib/bin/armbian*.jpg "$d" + chroot $CACHEDIR/sdcard /bin/bash -c "tar xfz /tmp/jessie-desktop.tgz -C /etc/skel/" + chroot $CACHEDIR/sdcard /bin/bash -c "tar xfz /tmp/jessie-desktop.tgz -C /root/" + 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/ fi # Ubuntu trusty if [[ $RELEASE == "trusty" ]]; then # copy wallpapers and default desktop settings - d=$DEST/cache/sdcard/usr/share/backgrounds/xfce/ - test -d "$d" || mkdir -p "$d" && cp $SRC/lib/bin/armbian*.jpg "$d" - chroot $DEST/cache/sdcard /bin/bash -c "tar xfz /tmp/trusty-desktop.tgz -C /etc/skel/" - chroot $DEST/cache/sdcard /bin/bash -c "tar xfz /tmp/trusty-desktop.tgz -C /root/" + d=$CACHEDIR/sdcard/usr/share/backgrounds/xfce/ + test -d "$d" || mkdir -p "$d" && cp $SRC/lib/bin/armbian*.jpg "$d" + chroot $CACHEDIR/sdcard /bin/bash -c "tar xfz /tmp/trusty-desktop.tgz -C /etc/skel/" + chroot $CACHEDIR/sdcard /bin/bash -c "tar xfz /tmp/trusty-desktop.tgz -C /root/" fi # Ubuntu Xenial if [[ $RELEASE == xenial ]]; then # copy wallpapers and default desktop settings - d=$DEST/cache/sdcard/usr/share/backgrounds/xfce/ + d=$CACHEDIR/sdcard/usr/share/backgrounds/xfce/ test -d "$d" || mkdir -p "$d" && cp $SRC/lib/bin/armbian*.jpg "$d" - chroot $DEST/cache/sdcard /bin/bash -c "tar xfz /tmp/xenial-desktop.tgz -C /etc/skel/" - chroot $DEST/cache/sdcard /bin/bash -c "tar xfz /tmp/xenial-desktop.tgz -C /root/" - mkdir -p $DEST/cache/sdcard/etc/polkit-1/localauthority/50-local.d - cp $SRC/lib/config/polkit-jessie/*.pkla $DEST/cache/sdcard/etc/polkit-1/localauthority/50-local.d/ + chroot $CACHEDIR/sdcard /bin/bash -c "tar xfz /tmp/xenial-desktop.tgz -C /etc/skel/" + chroot $CACHEDIR/sdcard /bin/bash -c "tar xfz /tmp/xenial-desktop.tgz -C /root/" + 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/ fi # Install custom icons and theme -chroot $DEST/cache/sdcard /bin/bash -c "dpkg -i /tmp/vibrancy-colors_2.4-trusty-Noobslab.com_all.deb >/dev/null 2>&1" -chroot $DEST/cache/sdcard /bin/bash -c "unzip -qq /tmp/NumixHolo.zip -d /usr/share/themes" +chroot $CACHEDIR/sdcard /bin/bash -c "dpkg -i /tmp/vibrancy-colors_2.4-trusty-Noobslab.com_all.deb >/dev/null 2>&1" +chroot $CACHEDIR/sdcard /bin/bash -c "unzip -qq /tmp/NumixHolo.zip -d /usr/share/themes" # unmount bind mount -umount $DEST/cache/sdcard/tmp >/dev/null 2>&1 +umount $CACHEDIR/sdcard/tmp >/dev/null 2>&1 # fix for udoo if [[ $BOARD != "udoo" ]]; then - echo "[Settings]" > $DEST/cache/sdcard/etc/wicd/manager-settings.conf - echo "wireless_interface = wlan0" >> $DEST/cache/sdcard/etc/wicd/manager-settings.conf + echo "[Settings]" > $CACHEDIR/sdcard/etc/wicd/manager-settings.conf + echo "wireless_interface = wlan0" >> $CACHEDIR/sdcard/etc/wicd/manager-settings.conf fi # Disable desktop mode autostart for now to enforce creation of normal user account -sed "s/NODM_ENABLED=\(.*\)/NODM_ENABLED=false/g" -i $DEST/cache/sdcard/etc/default/nodm - +sed "s/NODM_ENABLED=\(.*\)/NODM_ENABLED=false/g" -i $CACHEDIR/sdcard/etc/default/nodm + # Compile Turbo Frame buffer for sunxi if [[ $LINUXFAMILY == *sun* && $BRANCH == "default" ]]; then - mkdir -p $DEST/cache/sdcard/etc/udev/rules.d - cp $SRC/lib/config/sunxi-udev/* $DEST/cache/sdcard/etc/udev/rules.d/ - cp $SRC/lib/config/xorg.conf.sunxi $DEST/cache/sdcard/etc/X11/xorg.conf + mkdir -p $CACHEDIR/sdcard/etc/udev/rules.d + cp $SRC/lib/config/sunxi-udev/* $CACHEDIR/sdcard/etc/udev/rules.d/ + cp $SRC/lib/config/xorg.conf.sunxi $CACHEDIR/sdcard/etc/X11/xorg.conf if [[ $RELEASE == "jessie" ]]; then - cp -R $SRC/lib/bin/sunxi-debs $DEST/cache/sdcard/tmp/debs + cp -R $SRC/lib/bin/sunxi-debs $CACHEDIR/sdcard/tmp/debs error_num=0 display_alert "Installing desktop-extras for sunxi" "sunxi" "info" - chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y install libdri2-1 2>&1 >/dev/null" + chroot $CACHEDIR/sdcard /bin/bash -c "apt-get -y install libdri2-1 2>&1 >/dev/null" if [ $? -gt 0 ]; then - chroot $DEST/cache/sdcard /bin/bash -c "cd /tmp/debs && dpkg -i libdri2*.deb 2>&1 >/dev/null" + chroot $CACHEDIR/sdcard /bin/bash -c "cd /tmp/debs && dpkg -i libdri2*.deb 2>&1 >/dev/null" error_num=$(($error_num+$?)) fi - chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y install mesa-utils-extra 2>&1 >/dev/null" + chroot $CACHEDIR/sdcard /bin/bash -c "apt-get -y install mesa-utils-extra 2>&1 >/dev/null" error_num=$(($error_num+$?)) - chroot $DEST/cache/sdcard /bin/bash -c "cd /tmp/debs && dpkg -i libump*.deb 2>&1 >/dev/null" + chroot $CACHEDIR/sdcard /bin/bash -c "cd /tmp/debs && dpkg -i libump*.deb 2>&1 >/dev/null" error_num=$(($error_num+$?)) - chroot $DEST/cache/sdcard /bin/bash -c "cd /tmp/debs && dpkg -i libcedrus*.deb 2>&1 >/dev/null" + chroot $CACHEDIR/sdcard /bin/bash -c "cd /tmp/debs && dpkg -i libcedrus*.deb 2>&1 >/dev/null" error_num=$(($error_num+$?)) - chroot $DEST/cache/sdcard /bin/bash -c "cd /tmp/debs && dpkg -i libvdpau*.deb 2>&1 >/dev/null" + chroot $CACHEDIR/sdcard /bin/bash -c "cd /tmp/debs && dpkg -i libvdpau*.deb 2>&1 >/dev/null" error_num=$(($error_num+$?)) - chroot $DEST/cache/sdcard /bin/bash -c "cd /tmp/debs && dpkg -i sunxi-mali*.deb 2>&1 >/dev/null" + chroot $CACHEDIR/sdcard /bin/bash -c "cd /tmp/debs && dpkg -i sunxi-mali*.deb 2>&1 >/dev/null" error_num=$(($error_num+$?)) - chroot $DEST/cache/sdcard /bin/bash -c "cd /tmp/debs && dpkg -i fbturbo*.deb 2>&1 >/dev/null" + chroot $CACHEDIR/sdcard /bin/bash -c "cd /tmp/debs && dpkg -i fbturbo*.deb 2>&1 >/dev/null" error_num=$(($error_num+$?)) - chroot $DEST/cache/sdcard /bin/bash -c "cd /tmp/debs && dpkg -i mpv_*.deb 2>&1 >/dev/null" - chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y -f install 2>&1 >/dev/null" + chroot $CACHEDIR/sdcard /bin/bash -c "cd /tmp/debs && dpkg -i mpv_*.deb 2>&1 >/dev/null" + chroot $CACHEDIR/sdcard /bin/bash -c "apt-get -y -f install 2>&1 >/dev/null" error_num=$(($error_num+$?)) if [ $error_num -gt 0 ]; then display_alert "Installation failed" "desktop-extras for sunxi" "err"; exit 1;fi # Disable compositing by default - sed 's/name="use_compositing" type="bool" value="true"/name="use_compositing" type="bool" value="false"/' -i $DEST/cache/sdcard/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml - sed 's/name="use_compositing" type="bool" value="true"/name="use_compositing" type="bool" value="false"/' -i $DEST/cache/sdcard/root/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml - cp $SRC/lib/config/mpv.conf.sunxi $DEST/cache/sdcard/etc/mpv/mpv.conf - chroot $DEST/cache/sdcard /bin/bash -c "ldconfig" + sed 's/name="use_compositing" type="bool" value="true"/name="use_compositing" type="bool" value="false"/' -i $CACHEDIR/sdcard/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml + sed 's/name="use_compositing" type="bool" value="true"/name="use_compositing" type="bool" value="false"/' -i $CACHEDIR/sdcard/root/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml + cp $SRC/lib/config/mpv.conf.sunxi $CACHEDIR/sdcard/etc/mpv/mpv.conf + chroot $CACHEDIR/sdcard /bin/bash -c "ldconfig" else @@ -120,22 +120,22 @@ if [[ $LINUXFAMILY == *sun* && $BRANCH == "default" ]]; then if [[ $? -eq 1 && $error_num -eq 1 ]]; then error_num=0 display_alert "Adding support for Mali - acceleration" "sunxi" "info" - git clone -q https://github.com/WereCatf/armbian-debs.git $DEST/cache/sdcard/tmp/armbian-debs - chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y install mesa-utils-extra 2>&1 >/dev/null" - chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y install libdri2-1 libdri2-dev 2>&1 >/dev/null" + git clone -q https://github.com/WereCatf/armbian-debs.git $CACHEDIR/sdcard/tmp/armbian-debs + chroot $CACHEDIR/sdcard /bin/bash -c "apt-get -y install mesa-utils-extra 2>&1 >/dev/null" + chroot $CACHEDIR/sdcard /bin/bash -c "apt-get -y install libdri2-1 libdri2-dev 2>&1 >/dev/null" if [ $? -gt 0 ]; then - chroot $DEST/cache/sdcard /bin/bash -c "cd /tmp/armbian-debs && dpkg -i libdri2-1_1.0-1_armhf.deb 2>&1 >/dev/null" + chroot $CACHEDIR/sdcard /bin/bash -c "cd /tmp/armbian-debs && dpkg -i libdri2-1_1.0-1_armhf.deb 2>&1 >/dev/null" error_num=$(($error_num+$?)) fi if [ $error_num -gt 0 ]; then display_alert "Installation failed" "Mali - libdri2-1" "err"; exit 1 else - chroot $DEST/cache/sdcard /bin/bash -c "cd /tmp/armbian-debs && dpkg -i libump_3.0-0sunxi1_armhf.deb libump-dev_3.0-0sunxi1_armhf.deb 2>&1 >/dev/null" + chroot $CACHEDIR/sdcard /bin/bash -c "cd /tmp/armbian-debs && dpkg -i libump_3.0-0sunxi1_armhf.deb libump-dev_3.0-0sunxi1_armhf.deb 2>&1 >/dev/null" error_num=$(($error_num+$?)) if [ $error_num -gt 0 ]; then display_alert "Installation failed" "Mali - libump" "err"; exit 1 else - chroot $DEST/cache/sdcard /bin/bash -c "cd /tmp/armbian-debs && dpkg -i sunxi-mali-r3p0_4.0.0.0_armhf.deb 2>&1 >/dev/null" + chroot $CACHEDIR/sdcard /bin/bash -c "cd /tmp/armbian-debs && dpkg -i sunxi-mali-r3p0_4.0.0.0_armhf.deb 2>&1 >/dev/null" error_num=$(($error_num+$?)) - chroot $DEST/cache/sdcard /bin/bash -c "ldconfig" + chroot $CACHEDIR/sdcard /bin/bash -c "ldconfig" if [ $error_num -gt 0 ]; then display_alert "Installation failed" "Mali r3p0" "err"; exit 1;fi fi fi @@ -144,28 +144,28 @@ if [[ $LINUXFAMILY == *sun* && $BRANCH == "default" ]]; then display_alert "Compiling FB Turbo" "sunxi" "info" error_num=0 # quemu bug walkaround - git clone -q https://github.com/ssvb/xf86-video-fbturbo.git $DEST/cache/sdcard/tmp/xf86-video-fbturbo - chroot $DEST/cache/sdcard /bin/bash -c "cd /tmp/xf86-video-fbturbo && autoreconf -vi >/dev/null 2>&1" + git clone -q https://github.com/ssvb/xf86-video-fbturbo.git $CACHEDIR/sdcard/tmp/xf86-video-fbturbo + chroot $CACHEDIR/sdcard /bin/bash -c "cd /tmp/xf86-video-fbturbo && autoreconf -vi >/dev/null 2>&1" error_num=$(($error_num+$?)) - chroot $DEST/cache/sdcard /bin/bash -c "cd /tmp/xf86-video-fbturbo && ./configure --prefix=/usr >/dev/null 2>&1" + chroot $CACHEDIR/sdcard /bin/bash -c "cd /tmp/xf86-video-fbturbo && ./configure --prefix=/usr >/dev/null 2>&1" error_num=$(($error_num+$?)) - chroot $DEST/cache/sdcard /bin/bash -c "cd /tmp/xf86-video-fbturbo && make $CTHREADS && make install >/dev/null 2>&1" + chroot $CACHEDIR/sdcard /bin/bash -c "cd /tmp/xf86-video-fbturbo && make $CTHREADS && make install >/dev/null 2>&1" error_num=$(($error_num+$?)) # compile video acceleration - git clone -q https://github.com/linux-sunxi/libvdpau-sunxi.git $DEST/cache/sdcard/tmp/libvdpau-sunxi + git clone -q https://github.com/linux-sunxi/libvdpau-sunxi.git $CACHEDIR/sdcard/tmp/libvdpau-sunxi # with temporaly fix - chroot $DEST/cache/sdcard /bin/bash -c "cd /tmp/libvdpau-sunxi; git checkout 906c36ed45ceb53fecd5fc72e821c11849eeb1a3; make $CTHREADS" >/dev/null 2>&1 + chroot $CACHEDIR/sdcard /bin/bash -c "cd /tmp/libvdpau-sunxi; git checkout 906c36ed45ceb53fecd5fc72e821c11849eeb1a3; make $CTHREADS" >/dev/null 2>&1 error_num=$(($error_num+$?)) - d=$DEST/cache/sdcard/usr/lib/arm-linux-gnueabihf/vdpau - test -d "$d" || mkdir -p "$d" && cp $DEST/cache/sdcard/tmp/libvdpau-sunxi/libvdpau_sunxi.so.1 "$d" + d=$CACHEDIR/sdcard/usr/lib/arm-linux-gnueabihf/vdpau + test -d "$d" || mkdir -p "$d" && cp $CACHEDIR/sdcard/tmp/libvdpau-sunxi/libvdpau_sunxi.so.1 "$d" ln -s $d/libvdpau_sunxi.so.1 $d/libvdpau_sunxi.so # error check if [ $error_num -gt 0 ]; then display_alert "Compiling failed" "FB Turbo" "err"; exit 1; fi fi # Set default audio-output to HDMI for desktop-images - cat >> $DEST/cache/sdcard/etc/asound.conf << _EOF_ + cat >> $CACHEDIR/sdcard/etc/asound.conf << _EOF_ pcm.!default { type hw card 1 @@ -178,14 +178,14 @@ ctl.!default { _EOF_ # That we can just play - echo "export VDPAU_DRIVER=sunxi" >> $DEST/cache/sdcard/etc/profile - + echo "export VDPAU_DRIVER=sunxi" >> $CACHEDIR/sdcard/etc/profile + # enable memory reservations - sed "s/sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_no_mali_mem_reserve sunxi_fb_mem_reserve=16 //g" -i $DEST/cache/sdcard/boot/boot.cmd - mkimage -C none -A arm -T script -d $DEST/cache/sdcard/boot/boot.cmd $DEST/cache/sdcard/boot/boot.scr >> /dev/null - + sed "s/sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_no_mali_mem_reserve sunxi_fb_mem_reserve=16 //g" -i $CACHEDIR/sdcard/boot/boot.cmd + mkimage -C none -A arm -T script -d $CACHEDIR/sdcard/boot/boot.cmd $CACHEDIR/sdcard/boot/boot.scr >> /dev/null + # clean deb cache - chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y clean >/dev/null 2>&1" - + chroot $CACHEDIR/sdcard /bin/bash -c "apt-get -y clean >/dev/null 2>&1" + fi } diff --git a/distributions.sh b/distributions.sh index f904abc1d..6fc144cf9 100644 --- a/distributions.sh +++ b/distributions.sh @@ -20,167 +20,164 @@ display_alert "Fixing release custom applications." "$RELEASE" "info" # Common # set up apt -cat < $DEST/cache/sdcard/etc/apt/apt.conf.d/71-no-recommends +cat < $CACHEDIR/sdcard/etc/apt/apt.conf.d/71-no-recommends APT::Install-Recommends "0"; APT::Install-Suggests "0"; END # configure the system for unattended upgrades -cp $SRC/lib/scripts/50unattended-upgrades $DEST/cache/sdcard/etc/apt/apt.conf.d/50unattended-upgrades -cp $SRC/lib/scripts/02periodic $DEST/cache/sdcard/etc/apt/apt.conf.d/02periodic +cp $SRC/lib/scripts/50unattended-upgrades $CACHEDIR/sdcard/etc/apt/apt.conf.d/50unattended-upgrades +cp $SRC/lib/scripts/02periodic $CACHEDIR/sdcard/etc/apt/apt.conf.d/02periodic # setting window title for remote sessions -mkdir -p $DEST/cache/sdcard/etc/profile.d -install -m 755 $SRC/lib/scripts/ssh-title.sh $DEST/cache/sdcard/etc/profile.d/ssh-title.sh +mkdir -p $CACHEDIR/sdcard/etc/profile.d +install -m 755 $SRC/lib/scripts/ssh-title.sh $CACHEDIR/sdcard/etc/profile.d/ssh-title.sh case $RELEASE in # Debian Wheezy wheezy) - # add serial console - echo T0:2345:respawn:/sbin/getty -L $SERIALCON 115200 vt100 >> $DEST/cache/sdcard/etc/inittab - + echo T0:2345:respawn:/sbin/getty -L $SERIALCON 115200 vt100 >> $CACHEDIR/sdcard/etc/inittab + # don't clear screen on boot console - sed -e 's/getty 38400 tty1/getty --noclear 38400 tty1/g' -i $DEST/cache/sdcard/etc/inittab - + sed -e 's/getty 38400 tty1/getty --noclear 38400 tty1/g' -i $CACHEDIR/sdcard/etc/inittab + # disable some getties - sed -e 's/5:23:respawn/#5:23:respawn/g' -i $DEST/cache/sdcard/etc/inittab - sed -e 's/6:23:respawn/#6:23:respawn/g' -i $DEST/cache/sdcard/etc/inittab - + sed -e 's/5:23:respawn/#5:23:respawn/g' -i $CACHEDIR/sdcard/etc/inittab + sed -e 's/6:23:respawn/#6:23:respawn/g' -i $CACHEDIR/sdcard/etc/inittab + # auto upgrading - sed -e "s/ORIGIN/Debian/g" -i $DEST/cache/sdcard/etc/apt/apt.conf.d/50unattended-upgrades - sed -e "s/n=CODENAME/a=old-stable/g" -i $DEST/cache/sdcard/etc/apt/apt.conf.d/50unattended-upgrades - + sed -e "s/ORIGIN/Debian/g" -i $CACHEDIR/sdcard/etc/apt/apt.conf.d/50unattended-upgrades + sed -e "s/n=CODENAME/a=old-stable/g" -i $CACHEDIR/sdcard/etc/apt/apt.conf.d/50unattended-upgrades + # install ramlog - cp $SRC/lib/bin/ramlog_2.0.0_all.deb $DEST/cache/sdcard/tmp - chroot $DEST/cache/sdcard /bin/bash -c "dpkg -i /tmp/ramlog_2.0.0_all.deb >/dev/null 2>&1" + cp $SRC/lib/bin/ramlog_2.0.0_all.deb $CACHEDIR/sdcard/tmp + chroot $CACHEDIR/sdcard /bin/bash -c "dpkg -i /tmp/ramlog_2.0.0_all.deb >/dev/null 2>&1" # enabled back at first run. To remove errors - chroot $DEST/cache/sdcard /bin/bash -c "service ramlog disable >/dev/null 2>&1" - rm $DEST/cache/sdcard/tmp/ramlog_2.0.0_all.deb - sed -e 's/TMPFS_RAMFS_SIZE=/TMPFS_RAMFS_SIZE=512m/g' -i $DEST/cache/sdcard/etc/default/ramlog - sed -e 's/$remote_fs $time/$remote_fs $time ramlog/g' -i $DEST/cache/sdcard/etc/init.d/rsyslog - sed -e 's/umountnfs $time/umountnfs $time ramlog/g' -i $DEST/cache/sdcard/etc/init.d/rsyslog + chroot $CACHEDIR/sdcard /bin/bash -c "service ramlog disable >/dev/null 2>&1" + rm $CACHEDIR/sdcard/tmp/ramlog_2.0.0_all.deb + sed -e 's/TMPFS_RAMFS_SIZE=/TMPFS_RAMFS_SIZE=512m/g' -i $CACHEDIR/sdcard/etc/default/ramlog + sed -e 's/$remote_fs $time/$remote_fs $time ramlog/g' -i $CACHEDIR/sdcard/etc/init.d/rsyslog + sed -e 's/umountnfs $time/umountnfs $time ramlog/g' -i $CACHEDIR/sdcard/etc/init.d/rsyslog ;; # Debian Jessie jessie) - # enable root login for latest ssh on jessie - sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' $DEST/cache/sdcard/etc/ssh/sshd_config - + sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' $CACHEDIR/sdcard/etc/ssh/sshd_config + # auto upgrading - sed -e "s/ORIGIN/Debian/g" -i $DEST/cache/sdcard/etc/apt/apt.conf.d/50unattended-upgrades - sed -e "s/CODENAME/$RELEASE/g" -i $DEST/cache/sdcard/etc/apt/apt.conf.d/50unattended-upgrades - + sed -e "s/ORIGIN/Debian/g" -i $CACHEDIR/sdcard/etc/apt/apt.conf.d/50unattended-upgrades + sed -e "s/CODENAME/$RELEASE/g" -i $CACHEDIR/sdcard/etc/apt/apt.conf.d/50unattended-upgrades + # mount 256Mb tmpfs to /tmp - echo "tmpfs /tmp tmpfs nodev,nosuid,size=256M 0 0" >> $DEST/cache/sdcard/etc/fstab - - # fix selinux error - mkdir $DEST/cache/sdcard/selinux - + echo "tmpfs /tmp tmpfs nodev,nosuid,size=256M 0 0" >> $CACHEDIR/sdcard/etc/fstab + + # fix selinux error + mkdir $CACHEDIR/sdcard/selinux + # add serial console - cp $SRC/lib/config/ttyS0.conf $DEST/cache/sdcard/etc/init/$SERIALCON.conf - sed -e "s/ttyS0/$SERIALCON/g" -i $DEST/cache/sdcard/etc/init/$SERIALCON.conf - chroot $DEST/cache/sdcard /bin/bash -c "systemctl --no-reload enable serial-getty@$SERIALCON.service >/dev/null 2>&1" - mkdir -p "$DEST/cache/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d" - echo "[Service]" > "$DEST/cache/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d/10-rate.conf" - echo "ExecStart=" >> "$DEST/cache/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d/10-rate.conf" - echo "ExecStart=-/sbin/agetty -L 115200 %I $TERM" >> "$DEST/cache/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d/10-rate.conf" + cp $SRC/lib/config/ttyS0.conf $CACHEDIR/sdcard/etc/init/$SERIALCON.conf + sed -e "s/ttyS0/$SERIALCON/g" -i $CACHEDIR/sdcard/etc/init/$SERIALCON.conf + chroot $CACHEDIR/sdcard /bin/bash -c "systemctl --no-reload enable serial-getty@$SERIALCON.service >/dev/null 2>&1" + mkdir -p "$CACHEDIR/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d" + echo "[Service]" > "$CACHEDIR/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d/10-rate.conf" + echo "ExecStart=" >> "$CACHEDIR/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d/10-rate.conf" + echo "ExecStart=-/sbin/agetty -L 115200 %I $TERM" >> "$CACHEDIR/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d/10-rate.conf" # don't clear screen tty1 - mkdir -p "$DEST/cache/sdcard/etc/systemd/system/getty@tty1.service.d/" - echo "[Service]" > "$DEST/cache/sdcard/etc/systemd/system/getty@tty1.service.d/10-noclear.conf" - echo "TTYVTDisallocate=no" >> "$DEST/cache/sdcard/etc/systemd/system/getty@tty1.service.d/10-noclear.conf" - + mkdir -p "$CACHEDIR/sdcard/etc/systemd/system/getty@tty1.service.d/" + echo "[Service]" > "$CACHEDIR/sdcard/etc/systemd/system/getty@tty1.service.d/10-noclear.conf" + echo "TTYVTDisallocate=no" >> "$CACHEDIR/sdcard/etc/systemd/system/getty@tty1.service.d/10-noclear.conf" + # seting timeout - mkdir -p $DEST/cache/sdcard/etc/systemd/system/systemd-modules-load.service.d/ - echo "[Service]" > $DEST/cache/sdcard/etc/systemd/system/systemd-modules-load.service.d/10-timeout.conf - echo "TimeoutStopSec=10" >> $DEST/cache/sdcard/etc/systemd/system/systemd-modules-load.service.d/10-timeout.conf + mkdir -p $CACHEDIR/sdcard/etc/systemd/system/systemd-modules-load.service.d/ + echo "[Service]" > $CACHEDIR/sdcard/etc/systemd/system/systemd-modules-load.service.d/10-timeout.conf + echo "TimeoutStopSec=10" >> $CACHEDIR/sdcard/etc/systemd/system/systemd-modules-load.service.d/10-timeout.conf # handle PMU power button - mkdir -p $DEST/cache/sdcard/etc/udev/rules.d/ - cp $SRC/lib/config/71-axp-power-button.rules $DEST/cache/sdcard/etc/udev/rules.d/ + mkdir -p $CACHEDIR/sdcard/etc/udev/rules.d/ + cp $SRC/lib/config/71-axp-power-button.rules $CACHEDIR/sdcard/etc/udev/rules.d/ ;; # Ubuntu Trusty trusty) - # add serial console - cp $SRC/lib/config/ttyS0.conf $DEST/cache/sdcard/etc/init/$SERIALCON.conf - sed -e "s/ttyS0/$SERIALCON/g" -i $DEST/cache/sdcard/etc/init/$SERIALCON.conf + cp $SRC/lib/config/ttyS0.conf $CACHEDIR/sdcard/etc/init/$SERIALCON.conf + sed -e "s/ttyS0/$SERIALCON/g" -i $CACHEDIR/sdcard/etc/init/$SERIALCON.conf # don't clear screen tty1 - sed -e s,"exec /sbin/getty","exec /sbin/getty --noclear",g -i $DEST/cache/sdcard/etc/init/tty1.conf - + sed -e s,"exec /sbin/getty","exec /sbin/getty --noclear",g -i $CACHEDIR/sdcard/etc/init/tty1.conf + # disable some getties - rm -f $DEST/cache/sdcard/etc/init/tty5.conf - rm -f $DEST/cache/sdcard/etc/init/tty6.conf - + rm -f $CACHEDIR/sdcard/etc/init/tty5.conf + rm -f $CACHEDIR/sdcard/etc/init/tty6.conf + # enable root login for latest ssh on trusty - sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' $DEST/cache/sdcard/etc/ssh/sshd_config - - # fix selinux error - mkdir $DEST/cache/sdcard/selinux + sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' $CACHEDIR/sdcard/etc/ssh/sshd_config + + # fix selinux error + mkdir $CACHEDIR/sdcard/selinux # that my custom motd works well - if [ -d "$DEST/cache/sdcard/etc/update-motd.d" ]; then - mv $DEST/cache/sdcard/etc/update-motd.d $DEST/cache/sdcard/etc/update-motd.d-backup + if [ -d "$CACHEDIR/sdcard/etc/update-motd.d" ]; then + mv $CACHEDIR/sdcard/etc/update-motd.d $CACHEDIR/sdcard/etc/update-motd.d-backup fi # auto upgrading - sed -e "s/ORIGIN/Ubuntu/g" -i $DEST/cache/sdcard/etc/apt/apt.conf.d/50unattended-upgrades - sed -e "s/CODENAME/$RELEASE/g" -i $DEST/cache/sdcard/etc/apt/apt.conf.d/50unattended-upgrades + sed -e "s/ORIGIN/Ubuntu/g" -i $CACHEDIR/sdcard/etc/apt/apt.conf.d/50unattended-upgrades + sed -e "s/CODENAME/$RELEASE/g" -i $CACHEDIR/sdcard/etc/apt/apt.conf.d/50unattended-upgrades - # remove what's anyway not working - rm $DEST/cache/sdcard/etc/init/ureadahead* - rm $DEST/cache/sdcard/etc/init/plymouth* + # remove what's anyway not working + rm $CACHEDIR/sdcard/etc/init/ureadahead* + rm $CACHEDIR/sdcard/etc/init/plymouth* ;; xenial) # enable root login for latest ssh on jessie - sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' $DEST/cache/sdcard/etc/ssh/sshd_config + sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' $CACHEDIR/sdcard/etc/ssh/sshd_config # auto upgrading (disabled while testing) - #sed -e "s/ORIGIN/Debian/g" -i $DEST/cache/sdcard/etc/apt/apt.conf.d/50unattended-upgrades - #sed -e "s/CODENAME/$RELEASE/g" -i $DEST/cache/sdcard/etc/apt/apt.conf.d/50unattended-upgrades + #sed -e "s/ORIGIN/Debian/g" -i $CACHEDIR/sdcard/etc/apt/apt.conf.d/50unattended-upgrades + #sed -e "s/CODENAME/$RELEASE/g" -i $CACHEDIR/sdcard/etc/apt/apt.conf.d/50unattended-upgrades # mount 256Mb tmpfs to /tmp (disabled while supported by debootstrap-ng only) - #echo "tmpfs /tmp tmpfs nodev,nosuid,size=256M 0 0" >> $DEST/cache/sdcard/etc/fstab + #echo "tmpfs /tmp tmpfs nodev,nosuid,size=256M 0 0" >> $CACHEDIR/sdcard/etc/fstab # fix selinux error - mkdir $DEST/cache/sdcard/selinux + mkdir $CACHEDIR/sdcard/selinux # add serial console (needs testing whether it's still needed) - #cp $SRC/lib/config/ttyS0.conf $DEST/cache/sdcard/etc/init/$SERIALCON.conf - #sed -e "s/ttyS0/$SERIALCON/g" -i $DEST/cache/sdcard/etc/init/$SERIALCON.conf - chroot $DEST/cache/sdcard /bin/bash -c "systemctl --no-reload enable serial-getty@$SERIALCON.service >/dev/null 2>&1" - #mkdir -p "$DEST/cache/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d" - #echo "[Service]" > "$DEST/cache/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d/10-rate.conf" - #echo "ExecStart=" >> "$DEST/cache/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d/10-rate.conf" - #echo "ExecStart=-/sbin/agetty -L 115200 %I $TERM" >> "$DEST/cache/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d/10-rate.conf" + #cp $SRC/lib/config/ttyS0.conf $CACHEDIR/sdcard/etc/init/$SERIALCON.conf + #sed -e "s/ttyS0/$SERIALCON/g" -i $CACHEDIR/sdcard/etc/init/$SERIALCON.conf + chroot $CACHEDIR/sdcard /bin/bash -c "systemctl --no-reload enable serial-getty@$SERIALCON.service >/dev/null 2>&1" + #mkdir -p "$CACHEDIR/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d" + #echo "[Service]" > "$CACHEDIR/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d/10-rate.conf" + #echo "ExecStart=" >> "$CACHEDIR/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d/10-rate.conf" + #echo "ExecStart=-/sbin/agetty -L 115200 %I $TERM" >> "$CACHEDIR/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d/10-rate.conf" # don't clear screen tty1 - mkdir -p "$DEST/cache/sdcard/etc/systemd/system/getty@tty1.service.d/" - echo "[Service]" > "$DEST/cache/sdcard/etc/systemd/system/getty@tty1.service.d/10-noclear.conf" - echo "TTYVTDisallocate=no" >> "$DEST/cache/sdcard/etc/systemd/system/getty@tty1.service.d/10-noclear.conf" + mkdir -p "$CACHEDIR/sdcard/etc/systemd/system/getty@tty1.service.d/" + echo "[Service]" > "$CACHEDIR/sdcard/etc/systemd/system/getty@tty1.service.d/10-noclear.conf" + echo "TTYVTDisallocate=no" >> "$CACHEDIR/sdcard/etc/systemd/system/getty@tty1.service.d/10-noclear.conf" # seting timeout - mkdir -p $DEST/cache/sdcard/etc/systemd/system/systemd-modules-load.service.d/ - echo "[Service]" > $DEST/cache/sdcard/etc/systemd/system/systemd-modules-load.service.d/10-timeout.conf - echo "TimeoutStopSec=10" >> $DEST/cache/sdcard/etc/systemd/system/systemd-modules-load.service.d/10-timeout.conf + mkdir -p $CACHEDIR/sdcard/etc/systemd/system/systemd-modules-load.service.d/ + echo "[Service]" > $CACHEDIR/sdcard/etc/systemd/system/systemd-modules-load.service.d/10-timeout.conf + echo "TimeoutStopSec=10" >> $CACHEDIR/sdcard/etc/systemd/system/systemd-modules-load.service.d/10-timeout.conf # handle PMU power button - mkdir -p $DEST/cache/sdcard/etc/udev/rules.d/ - cp $SRC/lib/config/71-axp-power-button.rules $DEST/cache/sdcard/etc/udev/rules.d/ + mkdir -p $CACHEDIR/sdcard/etc/udev/rules.d/ + cp $SRC/lib/config/71-axp-power-button.rules $CACHEDIR/sdcard/etc/udev/rules.d/ # disable ureadahead # needs kernel tracing options that AFAIK are present only in mainline TODO: fix later - chroot $DEST/cache/sdcard /bin/bash -c "systemctl --no-reload mask ureadahead.service >/dev/null 2>&1" - chroot $DEST/cache/sdcard /bin/bash -c "systemctl --no-reload mask setserial.service etc-setserial.service >/dev/null 2>&1" + chroot $CACHEDIR/sdcard /bin/bash -c "systemctl --no-reload mask ureadahead.service >/dev/null 2>&1" + chroot $CACHEDIR/sdcard /bin/bash -c "systemctl --no-reload mask setserial.service etc-setserial.service >/dev/null 2>&1" # disable initramfs - sed -i 's/update_initramfs=yes/update_initramfs=no/' $DEST/cache/sdcard//etc/initramfs-tools/update-initramfs.conf + sed -i 's/update_initramfs=yes/update_initramfs=no/' $CACHEDIR/sdcard//etc/initramfs-tools/update-initramfs.conf ;; *) @@ -189,58 +186,58 @@ xenial) esac # copy hostapd configurations -install -m 755 $SRC/lib/config/hostapd.conf $DEST/cache/sdcard/etc/hostapd.conf -install -m 755 $SRC/lib/config/hostapd.realtek.conf $DEST/cache/sdcard/etc/hostapd.conf-rt +install -m 755 $SRC/lib/config/hostapd.conf $CACHEDIR/sdcard/etc/hostapd.conf +install -m 755 $SRC/lib/config/hostapd.realtek.conf $CACHEDIR/sdcard/etc/hostapd.conf-rt -# console fix due to Debian bug -sed -e 's/CHARMAP=".*"/CHARMAP="'$CONSOLE_CHAR'"/g' -i $DEST/cache/sdcard/etc/default/console-setup +# console fix due to Debian bug +sed -e 's/CHARMAP=".*"/CHARMAP="'$CONSOLE_CHAR'"/g' -i $CACHEDIR/sdcard/etc/default/console-setup # root-fs modifications -rm -f $DEST/cache/sdcard/etc/motd -touch $DEST/cache/sdcard/etc/motd +rm -f $CACHEDIR/sdcard/etc/motd +touch $CACHEDIR/sdcard/etc/motd # change time zone data -echo $TZDATA > $DEST/cache/sdcard/etc/timezone -chroot $DEST/cache/sdcard /bin/bash -c "dpkg-reconfigure -f noninteractive tzdata >/dev/null 2>&1" +echo $TZDATA > $CACHEDIR/sdcard/etc/timezone +chroot $CACHEDIR/sdcard /bin/bash -c "dpkg-reconfigure -f noninteractive tzdata >/dev/null 2>&1" -# set root password -chroot $DEST/cache/sdcard /bin/bash -c "(echo $ROOTPWD;echo $ROOTPWD;) | passwd root >/dev/null 2>&1" +# set root password +chroot $CACHEDIR/sdcard /bin/bash -c "(echo $ROOTPWD;echo $ROOTPWD;) | passwd root >/dev/null 2>&1" # create proper fstab -if [ "$BOOTSIZE" -eq "0" ]; then +if [ "$BOOTSIZE" -eq "0" ]; then local device="/dev/mmcblk0p1 / ext4 defaults,noatime,nodiratime,data=writeback,commit=600,errors=remount-ro" else - local device="/dev/mmcblk0p2 / ext4 defaults,noatime,nodiratime,data=writeback,commit=600,errors=remount-ro" + local device="/dev/mmcblk0p2 / ext4 defaults,noatime,nodiratime,data=writeback,commit=600,errors=remount-ro" fi -echo "$device 0 0" >> $DEST/cache/sdcard/etc/fstab +echo "$device 0 0" >> $CACHEDIR/sdcard/etc/fstab # flash media tunning -if [ -f "$DEST/cache/sdcard/etc/default/tmpfs" ]; then - sed -e 's/#RAMTMP=no/RAMTMP=yes/g' -i $DEST/cache/sdcard/etc/default/tmpfs - sed -e 's/#RUN_SIZE=10%/RUN_SIZE=128M/g' -i $DEST/cache/sdcard/etc/default/tmpfs - sed -e 's/#LOCK_SIZE=/LOCK_SIZE=/g' -i $DEST/cache/sdcard/etc/default/tmpfs - sed -e 's/#SHM_SIZE=/SHM_SIZE=128M/g' -i $DEST/cache/sdcard/etc/default/tmpfs - sed -e 's/#TMP_SIZE=/TMP_SIZE=1G/g' -i $DEST/cache/sdcard/etc/default/tmpfs +if [ -f "$CACHEDIR/sdcard/etc/default/tmpfs" ]; then + sed -e 's/#RAMTMP=no/RAMTMP=yes/g' -i $CACHEDIR/sdcard/etc/default/tmpfs + sed -e 's/#RUN_SIZE=10%/RUN_SIZE=128M/g' -i $CACHEDIR/sdcard/etc/default/tmpfs + sed -e 's/#LOCK_SIZE=/LOCK_SIZE=/g' -i $CACHEDIR/sdcard/etc/default/tmpfs + sed -e 's/#SHM_SIZE=/SHM_SIZE=128M/g' -i $CACHEDIR/sdcard/etc/default/tmpfs + sed -e 's/#TMP_SIZE=/TMP_SIZE=1G/g' -i $CACHEDIR/sdcard/etc/default/tmpfs fi # add custom bashrc loading -cat <> $DEST/cache/sdcard/etc/bash.bashrc +cat <> $CACHEDIR/sdcard/etc/bash.bashrc if [ -f /etc/bash.bashrc.custom ]; then . /etc/bash.bashrc.custom fi END # display welcome message at first root login -touch $DEST/cache/sdcard/root/.not_logged_in_yet +touch $CACHEDIR/sdcard/root/.not_logged_in_yet # force change root password at first login -chroot $DEST/cache/sdcard /bin/bash -c "chage -d 0 root" +chroot $CACHEDIR/sdcard /bin/bash -c "chage -d 0 root" # remove hostapd because it's replaced with ours -chroot $DEST/cache/sdcard /bin/bash -c "apt-get -y -qq remove hostapd >/dev/null 2>&1" +chroot $CACHEDIR/sdcard /bin/bash -c "apt-get -y -qq remove hostapd >/dev/null 2>&1" # install sunxi-tools -cp $SRC/lib/bin/sunxi-tools_1.3-1_armhf.deb $DEST/cache/sdcard/tmp/ +cp $SRC/lib/bin/sunxi-tools_1.3-1_armhf.deb $CACHEDIR/sdcard/tmp/ # libusb dependency should already be satisfied by usbutils -chroot $DEST/cache/sdcard /bin/bash -c "dpkg -i /tmp/sunxi-tools_1.3-1_armhf.deb >/dev/null 2>&1" +chroot $CACHEDIR/sdcard /bin/bash -c "dpkg -i /tmp/sunxi-tools_1.3-1_armhf.deb >/dev/null 2>&1" } diff --git a/documentation/fel-boot.md b/documentation/fel-boot.md index fdf253c8b..fb5e1f2ad 100644 --- a/documentation/fel-boot.md +++ b/documentation/fel-boot.md @@ -58,3 +58,14 @@ Set `FEL_NET_IFNAME` to name of your network interface if you have more than one Set `FEL_LOCAL_IP` to IP address that can be used to reach NFS server on your build host if it can't be obtained from ifconfig (i.e. port forwarding to VM guest) Set `FEL_AUTO=yes` to skip prompt before trying FEL load + +### Customisation + +You can even create `userpatches/fel-hooks.sh` and define there 2 functions: `fel_post_prepare` and `fel_pre_load`. All normal build variables like $BOARD, $BRANCH and so on can be used in these functions to define specific actions. + +`fel_post_prepare` is executed once after setting up u-boot script and NFS share, you can use it to add extra stuff to boot.scr (like `gpio set` or `setenv machid`) based on device name. + +`fel_pre_load` is executed before calling sunxi-fel, you can use it to implement logic to select one of multiple connected boards; to pass additional arguments to `sunxi-fel` you can use `FEL_EXTRA_ARGS` variable. + +An example is provided as `scripts/fel-hooks.sh.example`. + diff --git a/documentation/user-faq.md b/documentation/user-faq.md index 201694e04..9198647d6 100644 --- a/documentation/user-faq.md +++ b/documentation/user-faq.md @@ -42,9 +42,11 @@ Unzipped .raw images can be written with supplied imagewriter.exe on Windows XP/ # OS X example: /dev/[r]diskx is your sd card device: diskutil unmountDisk diskx && dd bs=1m if=filename.raw of=/dev/rdiskx && diskutil eject diskx -Image writting takes around 3 minutes on a slow, class 6 SD card. +Image writing takes around 3 minutes on a slow, class 6 SD card. -Make sure you use a **good & reliable** SD card. If you encounter boot troubles or simply as a measure of precaution, check them with [F3](http://oss.digirati.com.br/f3/) or [H2testw](http://www.heise.de/download/h2testw.html). +Important: Make sure you use a **good & reliable** SD card. If you encounter boot troubles or simply as a measure of precaution, check them with [F3](http://oss.digirati.com.br/f3/) or [H2testw](http://www.heise.de/download/h2testw.html). + +Also important: SD cards are optimised for sequential reads/writes as it's commong in digital cameras. This is what the *speed class* is about. And while you should not buy any card rated less than *class 10* you should also take care to choose one that is known to show high random I/O performance (see this [benchmarked comparison](http://www.jeffgeerling.com/blogs/jeff-geerling/raspberry-pi-microsd-card)) since this is way more performance relevant when used with any SBC. # How to boot? @@ -375,3 +377,4 @@ And finally start your service when done with learning: Test your remote: irw /dev/lircd + diff --git a/fel-load.sh b/fel-load.sh index bd29be35e..ce6c52ea7 100644 --- a/fel-load.sh +++ b/fel-load.sh @@ -84,13 +84,13 @@ if [[ -n $FEL_ROOTFS ]]; then fel_prepare_target [[ $(type -t fel_post_prepare) == function ]] && fel_post_prepare RES=b - while [[ $RES == b ]]; do + while [[ $RES != q ]]; do if [[ $FEL_AUTO != yes ]]; then display_alert "Connect device in FEL mode and press" "" "info" read fi fel_load - display_alert "Press to boot again, to finish" "FEL" "info" + display_alert "Press any key to boot again, to finish" "FEL" "info" read -n 1 RES echo done diff --git a/general.sh b/general.sh index 09f328746..f4401cb0b 100644 --- a/general.sh +++ b/general.sh @@ -52,7 +52,7 @@ cleaning() ;; "cache") # delete output/cache - [ -d "$DEST/cache" ] && display_alert "Cleaning" "$DEST/cache" "info" && find $DEST/cache/ -type f -delete + [ -d "$CACHEDIR" ] && display_alert "Cleaning" "$CACHEDIR" "info" && find $CACHEDIR/ -type f -delete ;; "images") # delete output/images @@ -112,29 +112,29 @@ fetch_from_github (){ GITHUBSUBDIR=$3 [[ -z "$3" ]] && GITHUBSUBDIR="branchless" [[ -z "$4" ]] && GITHUBSUBDIR="" # only kernel and u-boot have subdirs for tags -if [ -d "$SOURCES/$2/$GITHUBSUBDIR" ]; then +if [ -d "$SOURCES/$2/$GITHUBSUBDIR" ]; then cd $SOURCES/$2/$GITHUBSUBDIR git checkout -q $FORCE $3 display_alert "... updating" "$2" "info" PULL=$(git pull) -else - if [[ -n $3 && -n "$(git ls-remote $1 | grep "$tag")" ]]; then - display_alert "... creating a shallow clone" "$2 $3" "info" +else + if [[ -n $3 && -n "$(git ls-remote $1 | grep "$tag")" ]]; then + display_alert "... creating a shallow clone" "$2 $3" "info" # Toradex git's doesn't support shallow clone. Need different solution than this. - git clone -n $1 $SOURCES/$2/$GITHUBSUBDIR -b $3 --depth 1 || git clone -n $1 $SOURCES/$2/$GITHUBSUBDIR -b $3 - cd $SOURCES/$2/$GITHUBSUBDIR + git clone -n $1 $SOURCES/$2/$GITHUBSUBDIR -b $3 --depth 1 || git clone -n $1 $SOURCES/$2/$GITHUBSUBDIR -b $3 + cd $SOURCES/$2/$GITHUBSUBDIR git checkout -q $3 else - display_alert "... creating a shallow clone" "$2" "info" + display_alert "... creating a shallow clone" "$2" "info" git clone -n $1 $SOURCES/$2/$GITHUBSUBDIR --depth 1 cd $SOURCES/$2/$GITHUBSUBDIR git checkout -q fi - + fi cd $SRC if [ $? -ne 0 ]; then - exit_with_error "Github download failed" "$1" + exit_with_error "Github download failed" "$1" fi } @@ -177,7 +177,7 @@ grab_version () fingerprint_image (){ #-------------------------------------------------------------------------------------------------------------------------------- -# Saving build summary to the image +# Saving build summary to the image #-------------------------------------------------------------------------------------------------------------------------------- display_alert "Fingerprinting." "$VERSION Linux $VER" "info" #echo -e "[\e[0;32m ok \x1B[0m] Fingerprinting" @@ -200,21 +200,21 @@ echo "-------------------------------------------------------------------------- echo "" >> $1 cat $SRC/lib/LICENSE >> $1 echo "" >> $1 -echo "--------------------------------------------------------------------------------" >> $1 +echo "--------------------------------------------------------------------------------" >> $1 } umount_image (){ -umount -l $DEST/cache/sdcard/dev/pts >/dev/null 2>&1 -umount -l $DEST/cache/sdcard/dev >/dev/null 2>&1 -umount -l $DEST/cache/sdcard/proc >/dev/null 2>&1 -umount -l $DEST/cache/sdcard/sys >/dev/null 2>&1 -umount -l $DEST/cache/sdcard/tmp >/dev/null 2>&1 -umount -l $DEST/cache/sdcard >/dev/null 2>&1 +umount -l $CACHEDIR/sdcard/dev/pts >/dev/null 2>&1 +umount -l $CACHEDIR/sdcard/dev >/dev/null 2>&1 +umount -l $CACHEDIR/sdcard/proc >/dev/null 2>&1 +umount -l $CACHEDIR/sdcard/sys >/dev/null 2>&1 +umount -l $CACHEDIR/sdcard/tmp >/dev/null 2>&1 +umount -l $CACHEDIR/sdcard >/dev/null 2>&1 IFS=" " x=$(losetup -a |awk '{ print $1 }' | rev | cut -c 2- | rev | tac); for x in $x; do - losetup -d $x + losetup -d $x done } @@ -231,38 +231,38 @@ while [[ $j -lt ${#DISTROS[@]} ]] do # add each packet to distribution DIS=${DISTROS[$j]} - + # let's drop from publish if exits - if [ "$(aptly publish list -config=config/aptly.conf -raw | awk '{print $(NF)}' | grep $DIS)" != "" ]; then + if [ "$(aptly publish list -config=config/aptly.conf -raw | awk '{print $(NF)}' | grep $DIS)" != "" ]; then aptly publish drop -config=config/aptly.conf $DIS > /dev/null 2>&1 fi #aptly db cleanup -config=config/aptly.conf - if [ "$1" == "remove" ]; then + if [ "$1" == "remove" ]; then # remove repository aptly repo drop -config=config/aptly.conf $DIS > /dev/null 2>&1 aptly db cleanup -config=config/aptly.conf > /dev/null 2>&1 fi - + # create repository if not exist OUT=$(aptly repo list -config=config/aptly.conf -raw | awk '{print $(NF)}' | grep $DIS) if [[ "$OUT" != "$DIS" ]]; then display_alert "Creating section" "$DIS" "info" aptly repo create -config=config/aptly.conf -distribution=$DIS -component=main -comment="Armbian stable" $DIS > /dev/null 2>&1 fi - + # add all packages aptly repo add -force-replace=true -config=config/aptly.conf $DIS $POT/*.deb - + # add all distribution packages if [ -d "$POT/$DIS" ]; then aptly repo add -force-replace=true -config=config/aptly.conf $DIS $POT/$DIS/*.deb fi - + aptly publish -passphrase=$GPG_PASS -force-overwrite=true -config=config/aptly.conf -component="main" --distribution=$DIS repo $DIS > /dev/null 2>&1 - + #aptly repo show -config=config/aptly.conf $DIS - + j=$[$j+1] done } @@ -362,7 +362,7 @@ prepare_host() { test -e /proc/sys/fs/binfmt_misc/qemu-arm || update-binfmts --enable qemu-arm # create directory structure - mkdir -p $SOURCES $DEST/debug $DEST/cache $DEST/cache/rootfs $SRC/userpatches/ + mkdir -p $SOURCES $DEST/debug $CACHEDIR $CACHEDIR/rootfs $SRC/userpatches/ find $SRC/lib/patch -type d ! -name . | sed "s%lib/patch%userpatches%" | xargs mkdir -p [[ ! -f $SRC/userpatches/customize-image.sh ]] && cp $SRC/lib/scripts/customize-image.sh.template $SRC/userpatches/customize-image.sh diff --git a/makeboarddeb.sh b/makeboarddeb.sh index add4a953a..8cff51586 100644 --- a/makeboarddeb.sh +++ b/makeboarddeb.sh @@ -21,11 +21,11 @@ create_board_package (){ display_alert "Creating board support package." "$BOARD" "info" - if [[ $BRANCH == "next" ]]; then - ROOT_BRACH="-next"; - else - ROOT_BRACH=""; - fi + if [[ $BRANCH == "next" ]]; then + ROOT_BRACH="-next"; + else + ROOT_BRACH=""; + fi local destination=$DEST/debs/$RELEASE/${CHOSEN_ROOTFS}_${REVISION}_armhf local controlfile=$destination/DEBIAN/control @@ -54,7 +54,7 @@ create_board_package (){ install -m 755 $SRC/lib/scripts/firstrun $destination/etc/init.d # install hardware info script - install -m 755 $SRC/lib/scripts/armhwinfo $destination/etc/init.d + install -m 755 $SRC/lib/scripts/armhwinfo $destination/etc/init.d echo "set -e" >> $destination/DEBIAN/postinst echo "update-rc.d armhwinfo defaults >/dev/null 2>&1" >> $destination/DEBIAN/postinst echo "update-rc.d -f motd remove >/dev/null 2>&1" >> $destination/DEBIAN/postinst diff --git a/patch/u-boot/u-boot-default/u-boot-99-opi-change-build-settings.patch b/patch/u-boot/u-boot-default/u-boot-99-opi-change-build-settings.patch index fc621a0c0..3b38c4f3c 100644 --- a/patch/u-boot/u-boot-default/u-boot-99-opi-change-build-settings.patch +++ b/patch/u-boot/u-boot-default/u-boot-99-opi-change-build-settings.patch @@ -1,7 +1,7 @@ diff -Nur a/configs/orangepi_h3_defconfig b/configs/orangepi_h3_defconfig --- a/configs/orangepi_h3_defconfig 1970-01-01 01:00:00.000000000 +0100 +++ b/configs/orangepi_h3_defconfig 2016-02-19 00:58:31.007705977 +0100 -@@ -0,0 +1,16 @@ +@@ -0,0 +1,18 @@ +CONFIG_ARM=y +CONFIG_ARCH_SUNXI=y +CONFIG_MACH_SUN8I_H3=y @@ -31,7 +31,7 @@ index aaf0f68..b389a0e 100644 +CONFIG_DM=y +CONFIG_DM_GPIO=y diff --git a/configs/orangepi_plus_defconfig b/configs/orangepi_plus_defconfig -index e52dcfc..03a2687 100644 +index e52dcfc..c2280e0 100644 --- a/configs/orangepi_plus_defconfig +++ b/configs/orangepi_plus_defconfig @@ -14,3 +14,5 @@ CONFIG_SPL=y @@ -39,4 +39,4 @@ index e52dcfc..03a2687 100644 CONFIG_SY8106A_POWER=y CONFIG_USB_EHCI_HCD=y +CONFIG_DM=y -+CONFIG_MMC_SUNXI_SLOT_EXTRA=2 ++CONFIG_DM_GPIO=y diff --git a/scripts/armhwinfo b/scripts/armhwinfo index ac2bf5f1c..515b29a9c 100644 --- a/scripts/armhwinfo +++ b/scripts/armhwinfo @@ -11,7 +11,7 @@ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin collect_informations() { - ifconfig | grep -q eth0 || (ifconfig eth0 up ; sleep 1) + ifconfig | grep -q eth0 || (ifconfig eth0 up ; sleep 2) TMPFILE=$(mktemp /tmp/${0##*/}.XXXXXX) trap "rm \"${TMPFILE}\" ; exit 0" 0 1 2 3 15 dmesg >"${TMPFILE}" @@ -128,7 +128,7 @@ detect_board() { echo 200 >/sys/class/leds/green_led/delay_off echo 200 >/sys/class/leds/green_led/delay_on [ -f "/root/.not_logged_in_yet" ] && BlinkTime=120 || BlinkTime=10 - (sleep ${BlinkTime} && echo none >/sys/class/leds/green_led/trigger) & + (sleep ${BlinkTime} && echo default-on >/sys/class/leds/green_led/trigger) & fi # redistribute USB irqs to dedicated cores @@ -171,15 +171,6 @@ detect_board() { else ID="Orange Pi One" fi - # prepare board/settings mismatch detection. If we cleanup board/config names then this - # might work for all boards later and can be moved from sun8i section further down to support - # all $HARDWARE variants. Only check board after 1st login already happened to be not in - # conflict with our board auto detection mechanisms - ScriptBinName="$(echo "${ID}" | tr '[:upper:]' '[:lower:]' | sed -e 's/+/plus/' -e 's/\ //g' -e 's/2mini$/2/g' -e 's/plus2$/plus/g').bin" - ScriptBinUsed="$(readlink -f "/boot/script.bin")" - if [ "X${ScriptBinName}" != "X${ScriptBinUsed##*/}" -a ! -f "/root/.not_logged_in_yet" ]; then - show_motd_warning "It seems the image is running on ${ID} but you're using wrong settings: ${ScriptBinUsed##*/}" - fi fi elif [ "$ARCH" = "aarch64" ]; then if [ $HARDWARE = "sun50iw1p1" ]; then @@ -282,5 +273,10 @@ case $1 in if [ -f /boot/.verbose -a ! -f /boot/.force-verbose ]; then rm /boot/.verbose fi + collect_informations + if [ $HARDWARE = "sun8i" ]; then + # redefine green led to blink until shutdown + echo heartbeat >/sys/class/leds/green_led/trigger + fi ;; esac diff --git a/scripts/fel-hooks.sh.example b/scripts/fel-hooks.sh.example new file mode 100644 index 000000000..abc75a313 --- /dev/null +++ b/scripts/fel-hooks.sh.example @@ -0,0 +1,31 @@ +#!/bin/bash +# +# fel-hooks.sh.example -- this file is an example how +# userpatches/fel-hooks.sh could be implemented. Basics first: +# https://github.com/igorpecovnik/lib/blob/master/documentation/fel-boot.md +# +# The following example assumes you use a Gembird power switch connected +# through USB to be able to power cycle the board you want to fel boot. You +# need the sispmctl package and use 'sispmctl -s' to get the ID of your +# power switch. And the fel_post_prepare function tries to adjust the +# boot environment for H3 boards on the fly. + +fel_pre_load() { + # power cycle socket 1 of Gembird power switch + sispmctl -D01:01:51:23:cb -q -f1 + # 5 seconds delay since PSUs don't like be being power cycled too fast + sleep 5 + sispmctl -D01:01:51:23:cb -q -o1 + # 3 seconds delay since the SoC has to initialise + sleep 3 +} # fel_pre_load + +fel_post_prepare() { + # This adds/adjusts necessary boot environment for H3 boards + if [ "$LINUXFAMILY" == "sun8i" ]; then + sed -i -e 's/\ disp.screen0_output_mode=1920x1080p60//' -e 's/\ hdmi.audio=EDID:0//' \ + -e '1s/^/gpio set PL10\ngpio set PG11\nsetenv machid 1029\nsetenv bootm_boot_mode sec\n/' \ + $FEL_ROOTFS/boot/boot.cmd + mkimage -C none -A arm -T script -d $FEL_ROOTFS/boot/boot.cmd $FEL_ROOTFS/boot/boot.scr > /dev/null + fi +} # fel_post_prepare diff --git a/scripts/firstrun b/scripts/firstrun index 5c7b7c997..0c7997943 100644 --- a/scripts/firstrun +++ b/scripts/firstrun @@ -7,7 +7,7 @@ # Should-Start: armhwinfo # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 -# Short-Description: Script to run when first starting +# Short-Description: PLEASE BE PATIENT AND DO NOT INTERRUPT THE FIRST REBOOT # Description: Something needs to be done when is # starting at first time. # regenerate ssh host key