From 42f0b3ff9b9e71da74ddca1b41f3f04787d571c4 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Tue, 28 Mar 2017 09:30:51 -0400 Subject: Implement boot parameter "netkeys" This allows the keys to be loaded from the boot medium even when the root filesystem is loaded over the network. I.e., specifying nbdroot= no longer implies that the keys will be loaded over the network. The ISO images generated by xorriso-usb.sh will not specify 'netkeys' so the keys on the USB stick will be used. The idea is that after install, the network should not be needed at all; but that requires using a new mechanism instead of the nbdroot= parameter, to determine dynamically whether to use a network root fs device. Currently, the network is still needed to boot a device that has its root fs on the local disk and the keys on the boot medium, even though no data is fetched from the NBD server. You can force the machine to boot by going to the initramfs shell and running: for n in $(seq 1 20); do killall ipconfig; done Otherwise it blocks waiting for the network. --- src/qemu.sh | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'src/qemu.sh') diff --git a/src/qemu.sh b/src/qemu.sh index f9982c4..b095eb8 100755 --- a/src/qemu.sh +++ b/src/qemu.sh @@ -21,17 +21,32 @@ NET='tap,vlan=0,ifname=tap0,script=no,downscript=no' initrd=${samizdat_isolinux_dir}/linux/initrd.img kernel=${samizdat_isolinux_dir}/linux/vmlinuz -kcmdline_NET='boot=samizdat components quiet splash nbdroot=192.168.10.1,samizdat.btrfs nbddev=/dev/nbd0 ip=dhcp' + kcmdline_NET='boot=samizdat components quiet splash nbdroot=192.168.10.1,samizdat.btrfs nbddev=/dev/nbd0 ip=dhcp netkeys' +kcmdline_CDROM_NET='boot=samizdat components quiet splash nbdroot=192.168.10.1,samizdat.btrfs nbddev=/dev/nbd0 ip=dhcp' kcmdline_CDROM='boot=samizdat components quiet splash' +set -- if [ "$USE_ISO" ]; then - [ "$QEMU_LOADS_LINUX" ] && set -- -initrd "$initrd" -kernel "$kernel" -append "$kcmdline_CDROM" - set -- -cdrom "$iso" + set -- "$@" -cdrom "$iso" + if [ "$QEMU_LOADS_LINUX" ]; then + set -- "$@" -initrd "$initrd" -kernel "$kernel" + if [ "$NO_NET" ]; then + set -- "$@" -append "$kcmdline_CDROM" + else + set -- "$@" -append "$kcmdline_CDROM_NET" + fi + else + set -- "$@" -boot d + fi else - [ "$QEMU_LOADS_LINUX" ] && set -- -initrd "$initrd" -kernel "$kernel" -append "$kcmdline_NET" - set -- -boot n + if [ "$QEMU_LOADS_LINUX" ]; then + set -- "$@" -initrd "$initrd" -kernel "$kernel" -append "$kcmdline_NET" + else + set -- "$@" -boot n + fi fi +set -x sudo qemu-system-x86_64 -enable-kvm -smp 2 -m 640 -k en-us \ -vga qxl \ -net nic,vlan=0,model=virtio \ -- cgit v1.2.3