mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
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@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
2cae31dd47
commit
e4506f404c
10 files changed
+57
-20
No files matched your search
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -1128,6 +1128,19 @@ static int libxl__domain_firmware(libxl__gc *gc,
|
||||
if (rc) goto out;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@@ -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 -----*/
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||