From fbf5b8ce302dc8dcd12861f9ec820a7a4ca99a5b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Tue, 23 Jul 2019 18:13:34 +0200 Subject: [PATCH] enable pxe/nbd boot --- Makefile | 22 ++++++++++++---------- modules/live.mk | 18 +++++++++++------- 2 files changed, 23 insertions(+), 17 deletions(-) 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 -- 2.39.2