]> gitweb.fluxo.info Git - kvm-manager.git/commitdiff
enable booting the guest from a local kernel directly
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Sun, 8 Sep 2013 02:32:27 +0000 (22:32 -0400)
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Sun, 8 Sep 2013 02:32:27 +0000 (22:32 -0400)
the user in control of a kvm-manager guest can now choose a kernel to
boot directly by placing two files (symlinks are fine) at:

  ~/vms/$VMNAME/kernel
  ~/vms/$VMNAME/initrd

This is by analogy with ~/vms/$VMNAME/cd.iso.

If those two files are present, then the kvm guest will boot directly
to the provided kernel rather than doing BIOS emulation that hands off
control to the MBR of the first emulated disks.

In this case, the first line of the contents of
/etc/sv/kvm/env/CMDLINE will be passed as the kernel parameters, and
no bootloader will be run.

kvm-manager

index 7838c047a1ab9a1c235c56dc67162f2cc8adff94..574737b5e86a90eb78b424f9dea1adacc0d9ca06 100755 (executable)
@@ -35,11 +35,19 @@ up() {
 
     CDISO="$OWNERHOME/vms/$VMNAME/cd.iso"
     NETBOOT="$OWNERHOME/vms/$VMNAME/netboot"
+    KERNEL="$OWNERHOME/vms/$VMNAME/kernel"
+    INITRD="$OWNERHOME/vms/$VMNAME/initrd"
     KVMARGS=
+    unset KERNEL_CMDLINE
     
     BOOTCHOICE=c
 
-    if [ -e "$NETBOOT" ] ; then
+    if [ -e "$KERNEL" -a -e "$INITRD" ] ; then
+       KVMARGS="-kernel $KERNEL -initrd $INITRD"
+        if [ "$CMDLINE" ]; then
+            KERNEL_CMDLINE="$CMDLINE"
+        fi
+    elif [ -e "$NETBOOT" ] ; then
        BOOTCHOICE=n
     elif [ -e "$CDISO" ] && [ -e $(readlink -f "$CDISO") ] ; then
        KVMARGS="-cdrom $CDISO"
@@ -88,6 +96,7 @@ EOF
     chpst -u "$OWNER:$OWNERGROUP:kvm" \
         /usr/bin/kvm $KVMARGS \
         -M "${MACHINE:-pc}" \
+       ${KERNEL_CMDLINE:+-append "$KERNEL_CMDLINE"} \
         -enable-kvm \
         -nodefaults \
         -nographic \