Skip to contentSkip to conversation

Add extboot to kvm-userspace

PATCH In review Anthony Liguori 2 participants 4 messages Jan 2, 2008 – Jan 3, 2008 3 messages not in the archive KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Add extboot to kvm-userspace

extboot is an x86 Option ROM that passes through int13 functions to a VMM which allows a VMM to expose an arbitrary block device as the primary BIOS disk. It can be used to boot SCSI or paravirtual devices.

extboot/Makefile new file +21 -0
new file mode 100644
index 0000000..1ea71a7
@@ -0,0 +1,21 @@
+OBJCOPY=objcopy
+
+CFLAGS=-Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin \
+       -fno-stack-protector
+
+all: extboot.bin
+
+%.o: %.S
+	$(CC) $(CFLAGS) -o $@ -c $<
+
+extboot.img: extboot.o
+	$(LD) --oformat binary -Ttext 0 -o $@ $<
+
+extboot.bin: extboot.img signrom
+	./signrom extboot.img extboot.bin
+
+signrom: signrom.c
+	$(CC) -o $@ -g -Wall $^
+
+clean:
+	$(RM) *.o *.img *.bin signrom *~
extboot/STATUS new file +6 -0
new file mode 100644
index 0000000..687c6d6
@@ -0,0 +1,6 @@
+Working
+-------
+
+Ubuntu Server 7.04 (i386)
+Windows 2000 Professional (i386)
+Windows XP SP2 (i386)
extboot/extboot.S new file +742 -0

742 lines not on this page · raw message

extboot/signrom.c new file +79 -0

79 lines not on this page · raw message

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#2 lore raw

PATCH 2/2 Add QEMU support for extboot

In reply to a message not in the archive

This patch adds support to QEMU for extboot. It requires that an extboot.bin binary be copied into the pc-bios directory or else make install will not function properly.

To use extboot to boot from an arbitrary block device, simply append a ",boot=on" to the block device to boot from. For instance, to boot from a SCSI disk, one would use:

-drive file=/path/to/image.img,if=scsi,boot=on

qemu/Makefile +2 -1
index ce76352..a3c6870 100644
@@ -179,7 +179,7 @@ endif
 	mkdir -p "$(DESTDIR)$(datadir)"
 	for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
 		video.x openbios-sparc32 pxe-ne2k_pci.bin \
-		pxe-rtl8139.bin pxe-pcnet.bin; do \
+		pxe-rtl8139.bin pxe-pcnet.bin extboot.bin; do \
 		$(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
 	done
 ifndef CONFIG_WIN32
@@ -281,6 +281,7 @@ tarbin:
         $(datadir)/pxe-ne2k_pci.bin \
 	$(datadir)/pxe-rtl8139.bin \
         $(datadir)/pxe-pcnet.bin \
+	$(datadir)/extboot.bin \
 	$(docdir)/qemu-doc.html \
 	$(docdir)/qemu-tech.html \
 	$(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
qemu/Makefile.target +1 -1
index 0c5ca47..289cd18 100644
@@ -471,7 +471,7 @@ ifeq ($(TARGET_BASE_ARCH), i386)
 VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o
 VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
 VL_OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
-VL_OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o
+VL_OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o extboot.o
 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
 endif
 ifeq ($(TARGET_BASE_ARCH), ia64)
qemu/hw/pc.c +51 -34

116 lines not on this page · raw message

qemu/hw/pc.h +4 -0
index 5d4c747..7d1832f 100644
@@ -151,4 +151,8 @@ void virtio_net_poll(void);
 void *virtio_blk_init(PCIBus *bus, uint16_t vendor, uint16_t device,
 		      BlockDriverState *bs);
 
+/* extboot.c */
+
+void extboot_init(BlockDriverState *bs, int cmd);
+
 #endif
qemu/sysemu.h +1 -0
index b9f4b43..a72a4d6 100644
@@ -148,6 +148,7 @@ typedef struct DriveInfo {
 
 int nb_drives;
 DriveInfo drives_table[MAX_DRIVES+1];
+int extboot_drive;
 
 extern int drive_get_index(BlockInterfaceType type, int bus, int unit);
 extern int drive_get_max_bus(BlockInterfaceType type);
qemu/vl.c +17 -3
index c47b294..39b2e24 100644
@@ -177,6 +177,7 @@ IOPortWriteFunc *ioport_write_table[3][MAX_IOPORTS];
    to store the VM snapshots */
 DriveInfo drives_table[MAX_DRIVES+1];
 int nb_drives;
+int extboot_drive = -1;
 /* point to the block driver where the snapshots are managed */
 BlockDriverState *bs_snapshots;
 int vga_ram_size;
@@ -4930,7 +4931,7 @@ static int drive_init(const char *str, int snapshot, QEMUMachine *machine)
     int bdrv_flags;
     char *params[] = { "bus", "unit", "if", "index", "cyls", "heads",
                        "secs", "trans", "media", "snapshot", "file",
-                       "cache", NULL };
+                       "cache", "boot", NULL };
 
     if (check_params(buf, sizeof(buf), params, str) < 0) {
          fprintf(stderr, "qemu: unknowm parameter '%s' in '%s'\n",
@@ -5101,6 +5102,19 @@ static int drive_init(const char *str, int snapshot, QEMUMachine *machine)
         }
     }
 
+    if (get_param_value(buf, sizeof(buf), "boot", str)) {
+	if (!strcmp(buf, "on")) {
+	    if (extboot_drive != -1) {
+		fprintf(stderr, "qemu: two bootable drives specified\n");
+		return -1;
+	    }
+	    extboot_drive = nb_drives;
+	} else if (strcmp(buf, "off")) {
+	    fprintf(stderr, "qemu: '%s' invalid boot option\n", str);
+	    return -1;
+	}
+    }
+
     get_param_value(file, sizeof(file), "file", str);
 
     /* compute bus and unit according index */
@@ -7895,8 +7909,8 @@ static void help(int exitcode)
            "-hdc/-hdd file  use 'file' as IDE hard disk 2/3 image\n"
            "-cdrom file     use 'file' as IDE cdrom image (cdrom is ide1 master)\n"
 	   "-drive [file=file][,if=type][,bus=n][,unit=m][,media=d][index=i]\n"
-           "       [,cyls=c,heads=h,secs=s[,trans=t]][snapshot=on|off]"
-           "       [,cache=on|off]\n"
+           "       [,cyls=c,heads=h,secs=s[,trans=t]][snapshot=on|off]\n"
+           "       [,cache=on|off][,boot=on|off]\n"
 	   "                use 'file' as a drive image\n"
            "-mtdblock file  use 'file' as on-board Flash memory image\n"
            "-sd file        use 'file' as SecureDigital card image\n"

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#4 lore raw

Re: [PATCH 2/2] Add QEMU support for extboot

In reply to a message not in the archive
Quoted 11 lines · Anthony Liguori

This patch adds support to QEMU for extboot. It requires that an extboot.bin binary be copied into the pc-bios directory or else make install will not function properly.

To use extboot to boot from an arbitrary block device, simply append a ",boot=on" to the block device to boot from. For instance, to boot from a SCSI disk, one would use:

-drive file=/path/to/image.img,if=scsi,boot=on

extboot.c is missing...

Signature · 7 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
#6 lore raw

Re: [PATCH 2/2] Add QEMU support for extboot

In reply to a message not in the archive
Quoted 12 lines · Avi Kivity
Quoted 11 lines · Anthony Liguori

This patch adds support to QEMU for extboot. It requires that an extboot.bin
binary be copied into the pc-bios directory or else make install will not
function properly.

To use extboot to boot from an arbitrary block device, simply append a ",boot=on" to the block device to boot from. For instance, to boot from a SCSI
disk, one would use:

Quoted 5 lines
Quoted 3 lines

-drive file=/path/to/image.img,if=scsi,boot=on

extboot.c is missing...

Sorry, just sent out a new series fixing that.

Regards,

Anthony Liguori

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/