From: Paul Hänsch Date: Tue, 23 Jul 2019 16:13:34 +0000 (+0200) Subject: enable pxe/nbd boot X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=fbf5b8ce302dc8dcd12861f9ec820a7a4ca99a5b;p=blast enable pxe/nbd boot --- diff --git a/Makefile b/Makefile index 62ebebe..ef1af75 100644 --- a/Makefile +++ b/Makefile @@ -73,14 +73,16 @@ else ifdef squash SQUASH := ${squash} SYSROOT := sys_root/ CFGROOT := cfg_root/ + + PACKAGES += squashfs-tools nbd-client _target: _squash _install _config _bootstrap: _install: _bootstrap _copy: _install - _config: _copy - _squash: _config _squash_modules + _config: _copy _squash_modules + _squash: _config else ifdef raspi VOLUME := ${raspi} @@ -98,7 +100,7 @@ else ifdef raspi deb http://archive.raspberrypi.org/debian stretch main endef -PACKAGES := ${PACKAGES} firmware-brcm80211 libraspberrypi-bin libraspberrypi0 pi-bluetooth raspberrypi-bootloader raspberrypi-kernel + PACKAGES += firmware-brcm80211 libraspberrypi-bin libraspberrypi0 pi-bluetooth raspberrypi-bootloader raspberrypi-kernel _target: _umount _partcopy _config _install @@ -135,15 +137,16 @@ endif export SOURCES SYSROOT CFGROOT VOLUME PBOOT PROOT SQUASH ARCH KEYRING BOOTSTRAP sys_root/: - btrfs subvol create "$@" || mkdir -p "$@" + btrfs subvol create "$@" || mkdir "$@" chmod 755 "$@" cfg_root/: sys_root/ _install - btrfs sub snap "$<" "$@" || mkdir -p "$@" + -btrfs sub del "$@" || rm -r "$@" + btrfs sub snap "$<" "$@" || mkdir "$@" chmod 755 "$@" rpi_root/: - btrfs subvol create "$@" || mkdir -p "$@" + btrfs subvol create "$@" || mkdir "$@" chmod 755 "$@" img_mount/: @@ -193,15 +196,14 @@ _install: ${SYSROOT} _aptkeys _norecommends _copy: ${SYSROOT} ${CFGROOT} cp -au "$${SYSROOT}/." "$${CFGROOT}/" -.PHONY: _common_config -_config: _common_config -_common_config: ${CFGROOT} +_config: ${CFGROOT} ln -sf /dev/null "$${CFGROOT}/etc/systemd/network/99-default.link" printf '\nsession optional pam_mkhomedir.so umask=0027\n' >>"$${CFGROOT}/etc/pam.d/common-session" printf 'LABEL=FSROOT / ext4 auto,nofail,rw 0 0\nLABEL=BOOT /boot vfat auto,nofail,ro 0 0\n' \ >"$${CFGROOT}/etc/fstab" + chroot "$${CFGROOT}" update-initramfs -u -${SQUASH}: ${CFGROOT} +${SQUASH}: ${CFGROOT} .FORCE -rm "$${SQUASH}" mksquashfs "$${CFGROOT}" "$${SQUASH}" -comp xz diff --git a/modules/live.mk b/modules/live.mk index d58a645..fcf2a9e 100644 --- a/modules/live.mk +++ b/modules/live.mk @@ -1,17 +1,21 @@ -PACKAGES += bilibop-lockfs +PACKAGES += bilibop-lockfs live-boot live-boot-initramfs-tools -.PHONY: _live _live_sudo _live_sudo_users +.PHONY: _live_lockfs _live_sudo _live_sudo_users _live_modules ifdef users _config: _live_sudo_users endif -_umount: _live -_live: ${CFGROOT} _bootloader - grep -x aufs "$${CFGROOT}/etc/initramfs-tools" || printf 'aufs\n' >>"$${CFGROOT}/etc/initramfs-tools/modules" - sed -i 's; root=; lockfs=1G root=;' "$${CFGROOT}/boot/bootmenu.cfg" "$${CFGROOT}/boot/grub.cfg" +_live_modules: ${CFGROOT} + printf 'aufs\n' >>"$${CFGROOT}/etc/initramfs-tools/modules" + sed -i 's;^MODULES=.*$$;MODULES=netboot;' "$${CFGROOT}/etc/initramfs-tools/initramfs.conf" -_config: _live_sudo +_umount: _live_lockfs +_live_lockfs: ${CFGROOT} _bootloader + sed -i 's; root=; lockfs=1G root=;' "$${CFGROOT}/boot/bootmenu.cfg" "$${CFGROOT}/boot/grub.cfg" \ + || sed -i 's; root=; lockfs=1G root=;' "$${CFGROOT}/boot/cmdline.txt" + +_config: _live_sudo _live_modules _live_sudo: ${CFGROOT}/etc/sudoers.d/nopassword _live_sudo: ${CFGROOT}/var/lib/polkit-1/localauthority/50-local.d/disable-passwords.pkla