[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] tools: load IPXE from standalone file
commit e4506f404cb7983d6b424054ba999c6dd26ab4fa Author: Wei Liu <wei.liu2@xxxxxxxxxx> AuthorDate: Mon Jul 16 15:02:53 2018 +0100 Commit: Wei Liu <wei.liu2@xxxxxxxxxx> CommitDate: Mon Jul 16 16:09:01 2018 +0100 tools: load IPXE from standalone file Do not embed IPXE into Rombios anymore. Instead, it is loaded by the toolstack from a file as a separate module. Ability to let user specify an IPXE blob will come later. No user visible change. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> Acked-by: Jan Beulich <jbeulich@xxxxxxxx> --- tools/firmware/Makefile | 6 ++++++ tools/firmware/hvmloader/Makefile | 9 +-------- tools/firmware/hvmloader/config.h | 3 ++- tools/firmware/hvmloader/hvmloader.c | 10 ++++++++-- tools/firmware/hvmloader/ovmf.c | 3 ++- tools/firmware/hvmloader/rombios.c | 24 +++++++++++++++++------- tools/firmware/hvmloader/seabios.c | 3 ++- tools/libxl/libxl_dom.c | 13 +++++++++++++ tools/libxl/libxl_internal.h | 1 + tools/libxl/libxl_paths.c | 5 +++++ 10 files changed, 57 insertions(+), 20 deletions(-) diff --git a/tools/firmware/Makefile b/tools/firmware/Makefile index 842b48c3d3..bc84300b69 100644 --- a/tools/firmware/Makefile +++ b/tools/firmware/Makefile @@ -55,6 +55,9 @@ endif ifeq ($(CONFIG_OVMF),y) $(INSTALL_DATA) ovmf-dir/ovmf.bin $(INST_DIR)/ovmf.bin endif +ifeq ($(CONFIG_IPXE),y) + $(INSTALL_DATA) etherboot/ipxe/src/bin/ipxe.bin $(INST_DIR)/ipxe.bin +endif ifeq ($(CONFIG_PV_SHIM),y) $(INSTALL_DATA) xen-dir/xen-shim $(INST_DIR)/xen-shim $(INSTALL_DATA) xen-dir/xen-shim-syms $(DEBG_DIR)/xen-shim-syms @@ -69,6 +72,9 @@ endif ifeq ($(CONFIG_OVMF),y) rm -f $(INST_DIR)/ovmf.bin endif +ifeq ($(CONFIG_IPXE),y) + rm -r $(INST_DIR)/ipxe.bin +endif ifeq ($(CONFIG_PV_SHIM),y) rm -f $(INST_DIR)/xen-shim rm -f $(DEBG_DIR)/xen-shim-syms diff --git a/tools/firmware/hvmloader/Makefile b/tools/firmware/hvmloader/Makefile index 16255ebddd..496ac72b77 100644 --- a/tools/firmware/hvmloader/Makefile +++ b/tools/firmware/hvmloader/Makefile @@ -51,7 +51,6 @@ CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.debug.bin else CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.bin endif -ETHERBOOT_ROM := ../etherboot/ipxe/src/bin/ipxe.bin endif ROMS := @@ -60,7 +59,7 @@ ifeq ($(CONFIG_ROMBIOS),y) OBJS += optionroms.o 32bitbios_support.o rombios.o CFLAGS += -DENABLE_ROMBIOS ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest -ROMS += $(ROMBIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) $(ETHERBOOT_ROM) +ROMS += $(ROMBIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) endif .PHONY: all @@ -105,12 +104,6 @@ ifneq ($(CIRRUSVGA_ROM),) sh ../../misc/mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> $@.new echo "#endif" >> $@.new endif -ifneq ($(ETHERBOOT_ROM),) - echo "#ifdef ROM_INCLUDE_ETHERBOOT" >> $@.new - sh ../../misc/mkhex etherboot $(ETHERBOOT_ROM) >> $@.new - echo "#endif" >> $@.new -endif - mv $@.new $@ .PHONY: clean diff --git a/tools/firmware/hvmloader/config.h b/tools/firmware/hvmloader/config.h index 6e00413f2e..d9b4713d63 100644 --- a/tools/firmware/hvmloader/config.h +++ b/tools/firmware/hvmloader/config.h @@ -22,7 +22,8 @@ struct bios_config { /* ROMS */ void (*load_roms)(void); - void (*bios_load)(const struct bios_config *config, void *addr, uint32_t size); + void (*bios_load)(const struct bios_config *config, void *addr, + uint32_t size, void *extra_addr); void (*bios_info_setup)(void); void (*bios_info_finish)(void); diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c index f603f68ded..598a226278 100644 --- a/tools/firmware/hvmloader/hvmloader.c +++ b/tools/firmware/hvmloader/hvmloader.c @@ -363,12 +363,18 @@ int main(void) { uint32_t paddr = bios_module->paddr; - bios->bios_load(bios, (void*)paddr, bios_module->size); + bios->bios_load(bios, (void *)paddr, bios_module->size, NULL); } #ifdef ENABLE_ROMBIOS else if ( bios == &rombios_config ) { - bios->bios_load(bios, NULL, 0); + const struct hvm_modlist_entry *ipxe; + uint32_t paddr = 0; + + ipxe = get_module_entry(hvm_start_info, "ipxe"); + if ( ipxe ) + paddr = ipxe->paddr; + bios->bios_load(bios, NULL, 0, (void *)paddr); } #endif else diff --git a/tools/firmware/hvmloader/ovmf.c b/tools/firmware/hvmloader/ovmf.c index a17a11c2f9..23610a0717 100644 --- a/tools/firmware/hvmloader/ovmf.c +++ b/tools/firmware/hvmloader/ovmf.c @@ -85,7 +85,8 @@ static void ovmf_finish_bios_info(void) } static void ovmf_load(const struct bios_config *config, - void *bios_addr, uint32_t bios_length) + void *bios_addr, uint32_t bios_length, + void *unused_addr) { xen_pfn_t mfn; uint64_t addr = OVMF_END diff --git a/tools/firmware/hvmloader/rombios.c b/tools/firmware/hvmloader/rombios.c index c736fd9dea..46f331e465 100644 --- a/tools/firmware/hvmloader/rombios.c +++ b/tools/firmware/hvmloader/rombios.c @@ -63,6 +63,8 @@ static void rombios_setup_bios_info(void) memset(info, 0, sizeof(*info)); } +static void *ipxe_module_addr; + static void rombios_load_roms(void) { int option_rom_sz = 0, vgabios_sz = 0, etherboot_sz = 0; @@ -95,13 +97,17 @@ static void rombios_load_roms(void) etherboot_phys_addr = VGABIOS_PHYSICAL_ADDRESS + vgabios_sz; if ( etherboot_phys_addr < OPTIONROM_PHYSICAL_ADDRESS ) etherboot_phys_addr = OPTIONROM_PHYSICAL_ADDRESS; - etherboot_sz = scan_etherboot_nic(OPTIONROM_PHYSICAL_END, - etherboot_phys_addr, - etherboot); - option_rom_phys_addr = etherboot_phys_addr + etherboot_sz; - option_rom_sz = pci_load_option_roms(OPTIONROM_PHYSICAL_END, - option_rom_phys_addr); + if ( ipxe_module_addr ) + { + etherboot_sz = scan_etherboot_nic(OPTIONROM_PHYSICAL_END, + etherboot_phys_addr, + ipxe_module_addr); + + option_rom_phys_addr = etherboot_phys_addr + etherboot_sz; + option_rom_sz = pci_load_option_roms(OPTIONROM_PHYSICAL_END, + option_rom_phys_addr); + } printf("Option ROMs:\n"); if ( vgabios_sz ) @@ -119,7 +125,8 @@ static void rombios_load_roms(void) } static void rombios_load(const struct bios_config *config, - void *unused_addr, uint32_t unused_size) + void *unused_addr, uint32_t unused_size, + void *ipxe_addr) { uint32_t bioshigh; struct rombios_info *info; @@ -133,6 +140,9 @@ static void rombios_load(const struct bios_config *config, info = (struct rombios_info *)BIOS_INFO_PHYSICAL_ADDRESS; info->bios32_entry = bioshigh; + + /* Stash ipxe address */ + ipxe_module_addr = ipxe_addr; } /* diff --git a/tools/firmware/hvmloader/seabios.c b/tools/firmware/hvmloader/seabios.c index 801516daf7..444d118ddb 100644 --- a/tools/firmware/hvmloader/seabios.c +++ b/tools/firmware/hvmloader/seabios.c @@ -131,7 +131,8 @@ static void seabios_setup_e820(void) } static void seabios_load(const struct bios_config *bios, - void *bios_addr, uint32_t bios_length) + void *bios_addr, uint32_t bios_length, + void *unused_addr) { unsigned int bios_dest = 0x100000 - bios_length; diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index f0fd5fd3a3..3cfe0d4808 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -1129,6 +1129,19 @@ static int libxl__domain_firmware(libxl__gc *gc, } if (info->type == LIBXL_DOMAIN_TYPE_HVM && + info->u.hvm.bios == LIBXL_BIOS_TYPE_ROMBIOS && + libxl__ipxe_path()) { + const char *fp = libxl__ipxe_path(); + rc = xc_dom_module_file(dom, fp, "ipxe"); + + if (rc) { + LOGE(ERROR, "failed to load IPXE %s (%d)", fp, rc); + rc = ERROR_FAIL; + goto out; + } + } + + if (info->type == LIBXL_DOMAIN_TYPE_HVM && info->u.hvm.smbios_firmware) { data = NULL; e = libxl_read_file_contents(ctx, info->u.hvm.smbios_firmware, diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 52e1e8e036..843c625142 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -2362,6 +2362,7 @@ _hidden const char *libxl__lock_dir_path(void); _hidden const char *libxl__run_dir_path(void); _hidden const char *libxl__seabios_path(void); _hidden const char *libxl__ovmf_path(void); +_hidden const char *libxl__ipxe_path(void); /*----- subprocess execution with timeout -----*/ diff --git a/tools/libxl/libxl_paths.c b/tools/libxl/libxl_paths.c index 0643c1b3a4..8498f82781 100644 --- a/tools/libxl/libxl_paths.c +++ b/tools/libxl/libxl_paths.c @@ -53,6 +53,11 @@ const char *libxl__ovmf_path(void) #endif } +const char *libxl__ipxe_path(void) +{ + return XENFIRMWAREDIR "/ipxe.bin"; +} + /* * Local variables: * mode: C -- generated by git-patchbot for /home/xen/git/xen.git#staging _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |