Package: qemu-kvm
Version: 0.12.3+dfsg-4
Severity: important
Tags: squeeze sid


After upgrading kvm and using the version in lenny-backports, KVM fails
to start and giving a "Cannot boot from non-existent NIC" error.

I found this problem reported here[1] and after applying upstream
commits 4e9e9d6e0a68f1691bcdcc80601a9a1bc2954736 ...
4e9e9d6e0a68f1691bcdcc80601a9a1bc2954736 the problem went away.

[1] http://lists.gnu.org/archive/html/qemu-devel/2010-04/msg00378.html

I'm attaching a working patch. Feel free to do whatever with it. As
mentioned in qemu-devel, it's only the patch #2 which fixes the problem.

-- System Information:
Debian Release: squeeze/sid
  APT prefers stable
  APT policy: (990, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.30-2-amd64 (SMP w/1 CPU core)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff --git a/debian/changelog b/debian/changelog
index ee44c7a..ddb6ebe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
+qemu-kvm (0.12.3+dfsg-4~bpo50+2.1) unstable; urgency=low
+
+  * added patch from upstream, 4e9e9d6e0a68f1691bcdcc80601a9a1bc2954736,
+    07_remove_nicinfo_bootable_field.patch
+  * added patch from upstream, da1fcfda59a6bcbdf58d49243fbced455f2bf78a,
+    08_remove_broken_set_boot_mask.patch, fixes an issue with PXE booting
+    and more where kvm would say "Cannot boot from non-existent NIC"
+  * added patch from upstream, c2564608a149555d748390e446990324802586e7,
+    09_remove_unused_boot_devices_bitmap_variable.patch
+
+ -- Örjan Persson <or...@spotify.com>  Tue, 11 May 2010 15:45:19 +0200
+
 qemu-kvm (0.12.3+dfsg-4~bpo50+2) lenny-backports; urgency=low
 
   * Re-add 99_lenny_bpo_ksm.patch: define MADV_MERGEABLE to enable KSM
diff --git a/debian/patches/07_remove_nicinfo_bootable_field.patch b/debian/patches/07_remove_nicinfo_bootable_field.patch
new file mode 100644
index 0000000..0233abb
--- /dev/null
+++ b/debian/patches/07_remove_nicinfo_bootable_field.patch
@@ -0,0 +1,24 @@
+Index: qemu-kvm-0.12.3+dfsg/net.c
+===================================================================
+--- qemu-kvm-0.12.3+dfsg.orig/net.c	2010-05-11 15:32:51.000000000 +0200
++++ qemu-kvm-0.12.3+dfsg/net.c	2010-05-11 15:33:06.000000000 +0200
+@@ -1196,7 +1196,6 @@
+ 
+     for (i = 0; i < nb_nics; i++) {
+         if (net_boot_mask & (1 << i)) {
+-            nd_table[i].bootable = 1;
+             net_boot_mask &= ~(1 << i);
+         }
+     }
+Index: qemu-kvm-0.12.3+dfsg/net.h
+===================================================================
+--- qemu-kvm-0.12.3+dfsg.orig/net.h	2010-05-11 15:32:58.000000000 +0200
++++ qemu-kvm-0.12.3+dfsg/net.h	2010-05-11 15:33:06.000000000 +0200
+@@ -132,7 +132,6 @@
+     VLANState *vlan;
+     VLANClientState *netdev;
+     int used;
+-    int bootable;
+     int nvectors;
+ };
+ 
diff --git a/debian/patches/08_remove_broken_set_boot_mask.patch b/debian/patches/08_remove_broken_set_boot_mask.patch
new file mode 100644
index 0000000..b7231bf
--- /dev/null
+++ b/debian/patches/08_remove_broken_set_boot_mask.patch
@@ -0,0 +1,65 @@
+Index: qemu-kvm-0.12.3+dfsg/net.c
+===================================================================
+--- qemu-kvm-0.12.3+dfsg.orig/net.c	2010-05-11 15:33:55.000000000 +0200
++++ qemu-kvm-0.12.3+dfsg/net.c	2010-05-11 15:34:15.000000000 +0200
+@@ -1187,25 +1187,6 @@
+     qemu_del_vlan_client(vc);
+ }
+ 
+-void net_set_boot_mask(int net_boot_mask)
+-{
+-    int i;
+-
+-    /* Only the first four NICs may be bootable */
+-    net_boot_mask = net_boot_mask & 0xF;
+-
+-    for (i = 0; i < nb_nics; i++) {
+-        if (net_boot_mask & (1 << i)) {
+-            net_boot_mask &= ~(1 << i);
+-        }
+-    }
+-
+-    if (net_boot_mask) {
+-        fprintf(stderr, "Cannot boot from non-existent NIC\n");
+-        exit(1);
+-    }
+-}
+-
+ void do_info_network(Monitor *mon)
+ {
+     VLANState *vlan;
+Index: qemu-kvm-0.12.3+dfsg/net.h
+===================================================================
+--- qemu-kvm-0.12.3+dfsg.orig/net.h	2010-05-11 15:34:00.000000000 +0200
++++ qemu-kvm-0.12.3+dfsg/net.h	2010-05-11 15:34:15.000000000 +0200
+@@ -162,7 +162,6 @@
+ int net_init_clients(void);
+ void net_check_clients(void);
+ void net_cleanup(void);
+-void net_set_boot_mask(int boot_mask);
+ void net_host_device_add(Monitor *mon, const QDict *qdict);
+ void net_host_device_remove(Monitor *mon, const QDict *qdict);
+ 
+Index: qemu-kvm-0.12.3+dfsg/vl.c
+===================================================================
+--- qemu-kvm-0.12.3+dfsg.orig/vl.c	2010-05-11 15:34:06.000000000 +0200
++++ qemu-kvm-0.12.3+dfsg/vl.c	2010-05-11 15:35:20.000000000 +0200
+@@ -4919,7 +4919,7 @@
+     const char *gdbstub_dev = NULL;
+     uint32_t boot_devices_bitmap = 0;
+     int i;
+-    int snapshot, linux_boot, net_boot;
++    int snapshot, linux_boot;
+     const char *initrd_filename;
+     const char *kernel_filename, *kernel_cmdline;
+     char boot_devices[33] = "cad"; /* default to HD->floppy->CD-ROM */
+@@ -5958,9 +5958,6 @@
+         exit(1);
+     }
+ 
+-    net_boot = (boot_devices_bitmap >> ('n' - 'a')) & 0xF;
+-    net_set_boot_mask(net_boot);
+-
+     /* init the bluetooth world */
+     if (foreach_device_config(DEV_BT, bt_parse))
+         exit(1);
diff --git a/debian/patches/09_remove_unused_boot_devices_bitmap_variable.patch b/debian/patches/09_remove_unused_boot_devices_bitmap_variable.patch
new file mode 100644
index 0000000..f279c52
--- /dev/null
+++ b/debian/patches/09_remove_unused_boot_devices_bitmap_variable.patch
@@ -0,0 +1,45 @@
+Index: qemu-kvm-0.12.3+dfsg/vl.c
+===================================================================
+--- qemu-kvm-0.12.3+dfsg.orig/vl.c	2010-05-11 15:36:15.000000000 +0200
++++ qemu-kvm-0.12.3+dfsg/vl.c	2010-05-11 15:36:51.000000000 +0200
+@@ -2514,7 +2514,7 @@
+     return boot_set_handler(boot_set_opaque, boot_devices);
+ }
+ 
+-static int parse_bootdevices(char *devices)
++static void validate_bootdevices(char *devices)
+ {
+     /* We just do some generic consistency checks */
+     const char *p;
+@@ -2540,7 +2540,6 @@
+         }
+         bitmap |= 1 << (*p - 'a');
+     }
+-    return bitmap;
+ }
+ 
+ static void restore_boot_devices(void *opaque)
+@@ -4917,7 +4916,6 @@
+ int main(int argc, char **argv, char **envp)
+ {
+     const char *gdbstub_dev = NULL;
+-    uint32_t boot_devices_bitmap = 0;
+     int i;
+     int snapshot, linux_boot;
+     const char *initrd_filename;
+@@ -5212,13 +5210,13 @@
+ 
+                     if (legacy ||
+                         get_param_value(buf, sizeof(buf), "order", optarg)) {
+-                        boot_devices_bitmap = parse_bootdevices(buf);
++                        validate_bootdevices(buf);
+                         pstrcpy(boot_devices, sizeof(boot_devices), buf);
+                     }
+                     if (!legacy) {
+                         if (get_param_value(buf, sizeof(buf),
+                                             "once", optarg)) {
+-                            boot_devices_bitmap |= parse_bootdevices(buf);
++                            validate_bootdevices(buf);
+                             standard_boot_devices = qemu_strdup(boot_devices);
+                             pstrcpy(boot_devices, sizeof(boot_devices), buf);
+                             qemu_register_reset(restore_boot_devices,
diff --git a/debian/patches/series b/debian/patches/series
index 02e33b2..7d1927e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,6 +2,9 @@
 02_use_usr_share_kvm_fixed.patch
 04_use_etc_kvm_kvm-ifup.patch
 06_no_system_linux_kvm_h.patch
+07_remove_nicinfo_bootable_field.patch
+08_remove_broken_set_boot_mask.patch
+09_remove_unused_boot_devices_bitmap_variable.patch
 security/leftover.patch
 avoid_creating_too_large_iovecs_in_multiwrite_merge.patch
 revert-sdlaudio:-make-it-suck-less.diff

Reply via email to