mirror of
https://github.com/Fishwaldo/build.git
synced 2025-06-20 05:09:08 +00:00
Merge pull request #232 from ThomasKaiser/master
Few H3 fixes, small fel-boot documentation improvement
This commit is contained in:
commit
1eb650d48f
23 changed files with 677 additions and 639 deletions
160
boards.sh
160
boards.sh
|
@ -23,13 +23,13 @@ install_board_specific (){
|
|||
|
||||
# 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
|
||||
|
||||
|
@ -37,38 +37,38 @@ install_board_specific (){
|
|||
# Lemaker Guitar
|
||||
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"
|
||||
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"
|
||||
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
|
||||
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
|
||||
|
||||
|
@ -76,18 +76,18 @@ install_board_specific (){
|
|||
# Udoo neo
|
||||
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
|
||||
|
||||
|
@ -96,64 +96,64 @@ install_board_specific (){
|
|||
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"
|
||||
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"
|
||||
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
|
||||
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 > $DEST/cache/sdcard/etc/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;
|
||||
echo $word >> $CACHEDIR/sdcard/etc/modules;
|
||||
done
|
||||
else
|
||||
for word in $MODULES; do
|
||||
echo $word >> $DEST/cache/sdcard/etc/modules;
|
||||
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
|
||||
}
|
||||
|
|
32
common.sh
32
common.sh
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -351,8 +351,8 @@ gpio_pin_19 = port:PG07<1><default><default><0>
|
|||
|
||||
[leds_para]
|
||||
leds_used = 1
|
||||
green_led = port:PL10<1><default><default><0>
|
||||
green_led_active_low = 1
|
||||
green_led = port:PL10<1><default><default><1>
|
||||
green_led_active_low = 0
|
||||
red_led = port:PA15<1><default><default><0>
|
||||
red_led_active_low = 0
|
||||
|
||||
|
@ -787,7 +787,7 @@ smc_sda = port:PA08<2><default><default><default>
|
|||
[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><default><0>
|
||||
|
|
|
@ -247,8 +247,8 @@ gpio_pin_19 = port:PG07<1><default><default><0>
|
|||
|
||||
[leds_para]
|
||||
leds_used = 1
|
||||
green_led = port:PL10<1><default><default><0>
|
||||
green_led_active_low = 1
|
||||
green_led = port:PL10<1><default><default><1>
|
||||
green_led_active_low = 0
|
||||
red_led = port:PA15<1><default><default><0>
|
||||
red_led_active_low = 0
|
||||
|
||||
|
|
|
@ -247,8 +247,8 @@ gpio_pin_19 = port:PG07<1><default><default><0>
|
|||
|
||||
[leds_para]
|
||||
leds_used = 1
|
||||
green_led = port:PL10<1><default><default><0>
|
||||
green_led_active_low = 1
|
||||
green_led = port:PL10<1><default><default><1>
|
||||
green_led_active_low = 0
|
||||
red_led = port:PA15<1><default><default><0>
|
||||
red_led_active_low = 0
|
||||
|
||||
|
|
|
@ -247,8 +247,8 @@ gpio_pin_19 = port:PG07<1><default><default><0>
|
|||
|
||||
[leds_para]
|
||||
leds_used = 1
|
||||
green_led = port:PL10<1><default><default><0>
|
||||
green_led_active_low = 1
|
||||
green_led = port:PL10<1><default><default><1>
|
||||
green_led_active_low = 0
|
||||
red_led = port:PA15<1><default><default><0>
|
||||
red_led_active_low = 0
|
||||
|
||||
|
|
|
@ -354,8 +354,8 @@ gpio_pin_19 = port:PG07<1><default><default><0>
|
|||
|
||||
[leds_para]
|
||||
leds_used = 1
|
||||
green_led = port:PL10<1><default><default><0>
|
||||
green_led_active_low = 1
|
||||
green_led = port:PL10<1><default><default><1>
|
||||
green_led_active_low = 0
|
||||
red_led = port:PA15<1><default><default><0>
|
||||
red_led_active_low = 0
|
||||
|
||||
|
@ -801,9 +801,7 @@ smc_sda = port:PA08<2><default><default><default>
|
|||
;--------------------------------
|
||||
[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 =
|
||||
|
|
|
@ -34,7 +34,6 @@ 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
|
||||
|
@ -53,6 +52,7 @@ 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
|
||||
|
||||
|
|
|
@ -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 <<EOF > $DEST/cache/sdcard/usr/sbin/policy-rc.d
|
||||
cat <<EOF > $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 <<EOF > $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 <<EOF > $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 <<EOF > $DEST/cache/sdcard/sbin/initctl
|
||||
if [[ -x $CACHEDIR/sdcard/sbin/initctl ]]; then
|
||||
mv $CACHEDIR/sdcard/sbin/initctl $CACHEDIR/sdcard/sbin/initctl.REAL
|
||||
cat <<EOF > $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"
|
||||
} #############################################################################
|
||||
|
|
132
debootstrap.sh
132
debootstrap.sh
|
@ -27,10 +27,10 @@ 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
|
||||
BOOTSTART=$(($OFFSET*2048))
|
||||
|
@ -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,7 +55,7 @@ exit
|
|||
fi
|
||||
|
||||
# Mount image as block device
|
||||
losetup $LOOP $DEST/cache/tmprootfs.raw
|
||||
losetup $LOOP $CACHEDIR/tmprootfs.raw
|
||||
sync
|
||||
|
||||
# Create partitions and file-system
|
||||
|
@ -64,22 +64,22 @@ 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,59 +100,59 @@ 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/
|
||||
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
|
||||
|
@ -162,15 +162,15 @@ KILLPROC=$(ps -uax | pgrep acpid | tail -1); if [ -n "$KILLPROC" ]; then kill -9
|
|||
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
|
||||
|
@ -231,18 +231,18 @@ closing_image (){
|
|||
# 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/}"
|
||||
|
@ -263,31 +263,31 @@ KILLPROC=$(ps -uax | pgrep bluetoothd | tail -1); if [ -n "$KILLPROC" ]; then ki
|
|||
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
|
||||
|
@ -322,7 +322,7 @@ 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
|
||||
|
|
124
desktop.sh
124
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/
|
||||
d=$CACHEDIR/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/"
|
||||
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/
|
||||
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/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/
|
||||
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/
|
||||
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/trusty-desktop.tgz -C /etc/skel/"
|
||||
chroot $DEST/cache/sdcard /bin/bash -c "tar xfz /tmp/trusty-desktop.tgz -C /root/"
|
||||
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
|
||||
}
|
||||
|
|
193
distributions.sh
193
distributions.sh
|
@ -20,167 +20,164 @@ display_alert "Fixing release custom applications." "$RELEASE" "info"
|
|||
# Common
|
||||
|
||||
# set up apt
|
||||
cat <<END > $DEST/cache/sdcard/etc/apt/apt.conf.d/71-no-recommends
|
||||
cat <<END > $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
|
||||
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
|
||||
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
|
||||
sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' $CACHEDIR/sdcard/etc/ssh/sshd_config
|
||||
|
||||
# fix selinux error
|
||||
mkdir $DEST/cache/sdcard/selinux
|
||||
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*
|
||||
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,22 +186,22 @@ 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
|
||||
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"
|
||||
chroot $CACHEDIR/sdcard /bin/bash -c "(echo $ROOTPWD;echo $ROOTPWD;) | passwd root >/dev/null 2>&1"
|
||||
|
||||
# create proper fstab
|
||||
if [ "$BOOTSIZE" -eq "0" ]; then
|
||||
|
@ -212,35 +209,35 @@ if [ "$BOOTSIZE" -eq "0" ]; then
|
|||
else
|
||||
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 <<END >> $DEST/cache/sdcard/etc/bash.bashrc
|
||||
cat <<END >> $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"
|
||||
}
|
||||
|
|
|
@ -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`.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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" "<Enter>" "info"
|
||||
read
|
||||
fi
|
||||
fel_load
|
||||
display_alert "Press <b> to boot again, <q> to finish" "FEL" "info"
|
||||
display_alert "Press any key to boot again, <q> to finish" "FEL" "info"
|
||||
read -n 1 RES
|
||||
echo
|
||||
done
|
||||
|
|
16
general.sh
16
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
|
||||
|
@ -205,12 +205,12 @@ echo "--------------------------------------------------------------------------
|
|||
|
||||
|
||||
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
|
||||
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
31
scripts/fel-hooks.sh.example
Normal file
31
scripts/fel-hooks.sh.example
Normal file
|
@ -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
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue