[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH RFC] hvmloader: Make ROM dependencies optional



When booting HVMs with SeaBIOS, the BIOS itself takes care of extracting
option ROMs from the PCI devices. These ROMs are usually provided with by
the device model (qemu).
Thus, hvmloader should not require any longer the rombios, stdvga,
cirrusvga or etherboot ROMs to be present.

Also, the 32bitbios_support.c file is specific to rombios and should not
be built when building hvmloader with seabios.

Signed-off-by: Julian Pidancet <julian.pidancet@xxxxxxxxx>
---
 tools/firmware/hvmloader/Makefile    |   37 ++++++++++++++++++++++++---------
 tools/firmware/hvmloader/hvmloader.c |   13 ++++++++++-
 2 files changed, 38 insertions(+), 12 deletions(-)

diff --git a/tools/firmware/hvmloader/Makefile 
b/tools/firmware/hvmloader/Makefile
index 41a4369..a8e0f97 100644
--- a/tools/firmware/hvmloader/Makefile
+++ b/tools/firmware/hvmloader/Makefile
@@ -29,7 +29,7 @@ LOADADDR = 0x100000
 CFLAGS += $(CFLAGS_xeninclude)
 
 OBJS  = hvmloader.o mp_tables.o util.o smbios.o 
-OBJS += 32bitbios_support.o smp.o cacheattr.o xenbus.o
+OBJS += smp.o cacheattr.o xenbus.o
 OBJS += e820.o pci.o pir.o ctype.o
 ifeq ($(debug),y)
 OBJS += tests.o
@@ -37,25 +37,41 @@ endif
 
 CIRRUSVGA_DEBUG ?= n
 
-ROMBIOS_DIR := ../rombios
+ROMBIOS_DIR ?= ../rombios
 ifneq ($(ROMBIOS_DIR),)
-OBJS += rombios.o
+OBJS += rombios.o 32bitbios_support.o 
 CFLAGS += -DENABLE_ROMBIOS
 ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest
 endif
 
-SEABIOS_DIR := ../seabios-dir
+SEABIOS_DIR ?= ../seabios-dir
 ifneq ($(SEABIOS_DIR),)
 OBJS += seabios.o
 CFLAGS += -DENABLE_SEABIOS
 SEABIOS_ROM := $(SEABIOS_DIR)/out/bios.bin
 endif
 
-STDVGA_ROM    := ../vgabios/VGABIOS-lgpl-latest.bin
+STDVGA_DIR ?= ../vgabios/
+ifneq ($(STDVGA_DIR),)
+STDVGA_ROM    := $(STDVGA_DIR)/VGABIOS-lgpl-latest.bin
+CFLAGS += -DENABLE_STDVGA
+endif
+
+CIRRUSVGA_DIR ?= ../vgabios/
+ifneq ($(CIRRUSVGA_DIR),)
 ifeq ($(CIRRUSVGA_DEBUG),y)
-CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.debug.bin
+CIRRUSVGA_ROM := $(CIRRUSVGA_DIR)/VGABIOS-lgpl-latest.cirrus.debug.bin
 else
-CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.bin
+CIRRUSVGA_ROM := $(CIRRUSVGA_DIR)/VGABIOS-lgpl-latest.cirrus.bin
+endif
+CFLAGS += -DENABLE_CIRRUSVGA
+endif
+
+ETHERBOOT_DIR ?= ../etherboot/ipxe
+ETHERBOOT_NIC := rtl8139
+ifneq ($(ETHERBOOT_DIR),)
+CFLAGS += -DENABLE_ETHERBOOT
+ETHERBOOT_ROM := $(ETHERBOOT_DIR)/src/bin/$(ETHERBOOT_NIC).rom
 endif
 
 .PHONY: all
@@ -70,7 +86,7 @@ hvmloader: $(OBJS) acpi/acpi.a
        $(OBJCOPY) hvmloader.tmp hvmloader
        rm -f hvmloader.tmp
 
-roms.inc: $(ROMBIOS_ROM) $(SEABIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) 
../etherboot/eb-roms.h
+roms.inc: $(ROMBIOS_ROM) $(SEABIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) 
$(ETHERBOOT_ROM)
        echo "/* Autogenerated file. DO NOT EDIT */" > $@.new
 
 ifneq ($(ROMBIOS_ROM),)
@@ -95,10 +111,11 @@ ifneq ($(CIRRUSVGA_ROM),)
        sh ./mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> $@.new
        echo "#endif" >> $@.new
 endif
-
+ifneq ($(ETHERBOOT_ROM),)
        echo "#ifdef ROM_INCLUDE_ETHERBOOT" >> $@.new
-       cat ../etherboot/eb-roms.h >> $@.new
+       sh ./mkhex etherboot $(ETHERBOOT_ROM) >> $@.new
        echo "#endif" >> $@.new
+endif
 
        mv $@.new $@
 
diff --git a/tools/firmware/hvmloader/hvmloader.c 
b/tools/firmware/hvmloader/hvmloader.c
index f120ffe..659a382 100644
--- a/tools/firmware/hvmloader/hvmloader.c
+++ b/tools/firmware/hvmloader/hvmloader.c
@@ -236,6 +236,7 @@ static int scan_option_rom(
     return round_option_rom(rom->rom_size * 512 + 1);
 }
 
+#ifdef ENABLE_ETHERBOOT
 /*
  * Scan the PCI bus for the first NIC supported by etherboot, and copy
  * the corresponding rom data to *copy_rom_dest. Returns the length of the
@@ -264,6 +265,7 @@ static int scan_etherboot_nic(unsigned int option_rom_end,
 
     return rom_size;
 }
+#endif
 
 /*
  * Scan the PCI bus for the devices that have an option ROM, and copy
@@ -475,16 +477,20 @@ int main(void)
         switch ( virtual_vga )
         {
         case VGA_cirrus:
+#ifdef ENABLE_CIRRUSVGA
             printf("Loading Cirrus VGABIOS ...\n");
             memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
                    vgabios_cirrusvga, sizeof(vgabios_cirrusvga));
             vgabios_sz = round_option_rom(sizeof(vgabios_cirrusvga));
+#endif
             break;
         case VGA_std:
+#ifdef ENABLE_STDVGA
             printf("Loading Standard VGABIOS ...\n");
             memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
                    vgabios_stdvga, sizeof(vgabios_stdvga));
             vgabios_sz = round_option_rom(sizeof(vgabios_stdvga));
+#endif
             break;
         case VGA_pt:
             printf("Loading VGABIOS of passthroughed gfx ...\n");
@@ -496,13 +502,16 @@ int main(void)
             break;
         }
 
-        etherboot_phys_addr = VGABIOS_PHYSICAL_ADDRESS + vgabios_sz;
+        option_rom_phys_addr = VGABIOS_PHYSICAL_ADDRESS + vgabios_sz;
+#ifdef ENABLE_ETHERBOOT
+        etherboot_phys_addr = option_rom_phys_addr;
         if ( etherboot_phys_addr < bios->optionrom_start )
             etherboot_phys_addr = bios->optionrom_start;
         etherboot_sz = scan_etherboot_nic(bios->optionrom_end,
                                           etherboot_phys_addr);
 
-        option_rom_phys_addr = etherboot_phys_addr + etherboot_sz;
+        option_rom_phys_addr += etherboot_sz;
+#endif
         option_rom_sz = pci_load_option_roms(bios->optionrom_end,
                                              option_rom_phys_addr);
     }
-- 
Julian Pidancet


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.