diff --git a/debootstrap-ng.sh b/debootstrap-ng.sh index d9cf8daa4..a5cdc67d3 100644 --- a/debootstrap-ng.sh +++ b/debootstrap-ng.sh @@ -98,12 +98,6 @@ debootstrap_ng() umount_chroot - if [[ ( $ROOTFS_TYPE == fel || $ROOTFS_TYPE == nfs ) && $RELEASE == xenial ]]; then - # kill /etc/network/interfaces on target to prevent hang on shutdown on Xenial target - rm -f $CACHEDIR/sdcard/etc/network/interfaces - printf "auto lo\niface lo inet loopback\n" > $CACHEDIR/sdcard/etc/network/interfaces - fi - if [[ $ROOTFS_TYPE != ext4 ]]; then # to prevent creating swap file on NFS (needs specific kernel options) # and f2fs/btrfs (not recommended or needs specific kernel options) @@ -136,10 +130,9 @@ debootstrap_ng() # create_rootfs_cache() { - [[ $BUILD_DESKTOP == yes ]] && local variant_desktop=yes local packages_hash=$(get_package_list_hash $PACKAGE_LIST) - local cache_fname="$CACHEDIR/rootfs/$RELEASE${variant_desktop:+_desktop}-ng-$ARCH.$packages_hash.tgz" - local display_name=$RELEASE${variant_desktop:+_desktop}-ng-$ARCH.${packages_hash:0:3}...${packages_hash:29}.tgz + local cache_fname=$CACHEDIR/rootfs/${RELEASE}-ng-$ARCH.$packages_hash.tgz + local display_name=${RELEASE}-ng-$ARCH.${packages_hash:0:3}...${packages_hash:29}.tgz if [[ -f $cache_fname ]]; then local date_diff=$(( ($(date +%s) - $(stat -c %Y $cache_fname)) / 86400 )) display_alert "Extracting $display_name" "$date_diff days old" "info" @@ -227,7 +220,7 @@ create_rootfs_cache() ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} # stage: upgrade base packages from xxx-updates and xxx-backports repository branches - display_alert "Updating base packages" "Armbian" "info" + display_alert "Upgrading base packages" "Armbian" "info" eval 'LC_ALL=C LANG=C chroot $CACHEDIR/sdcard /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y -q \ $apt_extra $apt_extra_progress upgrade"' \ ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} \ @@ -401,7 +394,7 @@ prepare_partitions() mount ${LOOP}p1 $CACHEDIR/mount/boot/ echo "/dev/mmcblk0p1 /boot ${mkfs[$bootfs]} defaults${mountopts[$bootfs]} 0 2" >> $CACHEDIR/sdcard/etc/fstab fi - echo "tmpfs /tmp tmpfs defaults,rw,nosuid 0 0" >> $CACHEDIR/sdcard/etc/fstab + echo "tmpfs /tmp tmpfs defaults,nosuid 0 0" >> $CACHEDIR/sdcard/etc/fstab # stage: create boot script if [[ $ROOTFS_TYPE == nfs ]]; then diff --git a/distributions.sh b/distributions.sh index c41a70785..0e8dde7b6 100644 --- a/distributions.sh +++ b/distributions.sh @@ -82,19 +82,15 @@ jessie) 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" + printf "[Service]\nExecStart=\nExecStart=-/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 "$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" + printf "[Service]\nTTYVTDisallocate=no" > "$CACHEDIR/sdcard/etc/systemd/system/getty@tty1.service.d/10-noclear.conf" # seting timeout 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 + printf "[Service]\nTimeoutStopSec=10" > $CACHEDIR/sdcard/etc/systemd/system/systemd-modules-load.service.d/10-timeout.conf # handle PMU power button mkdir -p $CACHEDIR/sdcard/etc/udev/rules.d/ @@ -143,9 +139,6 @@ xenial) #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" >> $CACHEDIR/sdcard/etc/fstab - # fix selinux error mkdir $CACHEDIR/sdcard/selinux @@ -160,13 +153,11 @@ xenial) # don't clear screen tty1 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" + printf "[Service]\nTTYVTDisallocate=no" > "$CACHEDIR/sdcard/etc/systemd/system/getty@tty1.service.d/10-noclear.conf" # seting timeout 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 + printf "[Service]\nTimeoutStopSec=10" > $CACHEDIR/sdcard/etc/systemd/system/systemd-modules-load.service.d/10-timeout.conf # handle PMU power button mkdir -p $CACHEDIR/sdcard/etc/udev/rules.d/ @@ -177,8 +168,10 @@ xenial) 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/' $CACHEDIR/sdcard/etc/initramfs-tools/update-initramfs.conf + # disable stopping network interfaces + # fixes shutdown with root on NFS + mkdir -p $CACHEDIR/sdcard/etc/systemd/system/networking.service.d/ + printf "[Service]\nExecStop=\n" > $CACHEDIR/sdcard/etc/systemd/system/networking.service.d/10-nostop.conf ;; *) diff --git a/documentation/fel-boot.md b/documentation/fel-boot.md index 4f47a34fc..3f9c6b386 100644 --- a/documentation/fel-boot.md +++ b/documentation/fel-boot.md @@ -2,7 +2,7 @@ ### What is FEL/NFS boot? -FEL/NFS boot mode is a possibility to test freshly created Armbian distribution without using SD card. It is implemented by loading u-boot, kernel, boot script and .bin/.dtb file via [USB FEL mode](https://linux-sunxi.org/FEL/USBBoot) and providing root filesystem via NFS share. +FEL/NFS boot mode is a possibility to test freshly created Armbian distribution without using SD card. It is implemented by loading u-boot, kernel, initrd, boot script and .bin/.dtb file via [USB FEL mode](https://linux-sunxi.org/FEL/USBBoot) and providing root filesystem via NFS share. NOTE: this mode is designed only for testing. To use root on NFS permanently, use `ROOTFS_TYPE=nfs` option. NOTE: "hot" switching between kernel branches (default <-> dev/next) is not supported @@ -14,6 +14,7 @@ NOTE: "hot" switching between kernel branches (default <-> dev/next) is not supp - Network connection between build host and board. For target board **wired** Ethernet connection is required (either via onboard Ethernet or via USB ethernet adapter that has required kernel modules built-in) - NFS ports on build host should be reachable from board perspective (you may need to open ports in firewall or change network configuration of your VM) - Selected kernel should have built-in support for DHCP and NFS root filesystem +- `CLEAN_LEVEL="make,debs"` to always update u-boot configuration #### Additional requirements (recommended) diff --git a/fel-load.sh b/fel-load.sh index 1d84df872..dd790d3a9 100644 --- a/fel-load.sh +++ b/fel-load.sh @@ -41,7 +41,7 @@ fel_prepare_target() # kill /etc/fstab on target echo > $FEL_ROOTFS/etc/fstab echo "/dev/nfs / nfs defaults 0 0" >> $FEL_ROOTFS/etc/fstab - echo "tmpfs /tmp tmpfs defaults,rw,nosuid 0 0" >> $FEL_ROOTFS/etc/fstab + echo "tmpfs /tmp tmpfs defaults,nosuid 0 0" >> $FEL_ROOTFS/etc/fstab # if for some reason uInitrd doesn't exist [[ ! -f $FEL_ROOTFS/boot/uInitrd ]] && touch $FEL_ROOTFS/boot/uInitrd