summaryrefslogtreecommitdiff
path: root/src/qemu.sh
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2017-03-28 09:30:51 -0400
committerAndrew Cady <d@jerkface.net>2017-03-28 09:30:51 -0400
commit42f0b3ff9b9e71da74ddca1b41f3f04787d571c4 (patch)
tree7fa5a368b3a82fac61c7c68edd2e29366c9a1e4b /src/qemu.sh
parent2b948633f002af0dd1e428bfeca0453cb6ac72c3 (diff)
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.
Diffstat (limited to 'src/qemu.sh')
-rwxr-xr-xsrc/qemu.sh25
1 files changed, 20 insertions, 5 deletions
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'
21 21
22initrd=${samizdat_isolinux_dir}/linux/initrd.img 22initrd=${samizdat_isolinux_dir}/linux/initrd.img
23kernel=${samizdat_isolinux_dir}/linux/vmlinuz 23kernel=${samizdat_isolinux_dir}/linux/vmlinuz
24kcmdline_NET='boot=samizdat components quiet splash nbdroot=192.168.10.1,samizdat.btrfs nbddev=/dev/nbd0 ip=dhcp' 24 kcmdline_NET='boot=samizdat components quiet splash nbdroot=192.168.10.1,samizdat.btrfs nbddev=/dev/nbd0 ip=dhcp netkeys'
25kcmdline_CDROM_NET='boot=samizdat components quiet splash nbdroot=192.168.10.1,samizdat.btrfs nbddev=/dev/nbd0 ip=dhcp'
25kcmdline_CDROM='boot=samizdat components quiet splash' 26kcmdline_CDROM='boot=samizdat components quiet splash'
26 27
28set --
27if [ "$USE_ISO" ]; then 29if [ "$USE_ISO" ]; then
28 [ "$QEMU_LOADS_LINUX" ] && set -- -initrd "$initrd" -kernel "$kernel" -append "$kcmdline_CDROM" 30 set -- "$@" -cdrom "$iso"
29 set -- -cdrom "$iso" 31 if [ "$QEMU_LOADS_LINUX" ]; then
32 set -- "$@" -initrd "$initrd" -kernel "$kernel"
33 if [ "$NO_NET" ]; then
34 set -- "$@" -append "$kcmdline_CDROM"
35 else
36 set -- "$@" -append "$kcmdline_CDROM_NET"
37 fi
38 else
39 set -- "$@" -boot d
40 fi
30else 41else
31 [ "$QEMU_LOADS_LINUX" ] && set -- -initrd "$initrd" -kernel "$kernel" -append "$kcmdline_NET" 42 if [ "$QEMU_LOADS_LINUX" ]; then
32 set -- -boot n 43 set -- "$@" -initrd "$initrd" -kernel "$kernel" -append "$kcmdline_NET"
44 else
45 set -- "$@" -boot n
46 fi
33fi 47fi
34 48
49set -x
35sudo qemu-system-x86_64 -enable-kvm -smp 2 -m 640 -k en-us \ 50sudo qemu-system-x86_64 -enable-kvm -smp 2 -m 640 -k en-us \
36 -vga qxl \ 51 -vga qxl \
37 -net nic,vlan=0,model=virtio \ 52 -net nic,vlan=0,model=virtio \