xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] hvmloader: Make ROM dependencies optional
@ 2012-02-05 16:18 Julian Pidancet
  2012-02-08 13:28 ` Ian Campbell
  0 siblings, 1 reply; 5+ messages in thread
From: Julian Pidancet @ 2012-02-05 16:18 UTC (permalink / raw)
  To: xen-devel; +Cc: Julian Pidancet

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@gmail.com>
---
 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-02-08 17:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-05 16:18 [PATCH RFC] hvmloader: Make ROM dependencies optional Julian Pidancet
2012-02-08 13:28 ` Ian Campbell
2012-02-08 14:53   ` Julian Pidancet
2012-02-08 17:26     ` Ian Campbell
2012-02-08 17:53       ` Julian Pidancet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).