Skip to contentSkip to conversation

Load ipxe from a standalone file

PATCH Superseded Wei Liu 3 participants 14 messages May 15, 2018 – Jun 25, 2018

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

cover Load ipxe from a standalone file

Seeing yet another bug report regarding ipxe today, I would rather have this done than having to continuously cherry-pick ipxe commits.

I have written these patches from scratch to my liking.

Only very light testing is done. I will do a bit more testing when I have time.

Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Anoob Soman <[email protected]>
Cc Doug Goldstein <[email protected]>

Wei Liu (5):
Tools.mk.in: drop unused variables
ipxe: produce a single binary from its build
libxc: allow HVM guest to have modules
tools: load IPXE from standalone file
tools: provide --with-system-ipxe

 config/Tools.mk.in                   |  3 +-
 tools/config.h.in                    |  3 ++
 tools/configure                      | 53 ++++++++++++++++++++++++++++++++++++
 tools/configure.ac                   | 18 ++++++++++++
 tools/firmware/Makefile              |  6 ++++
 tools/firmware/etherboot/Makefile    |  6 +++-
 tools/firmware/hvmloader/Makefile    |  9 +-----
 tools/firmware/hvmloader/hvmloader.c |  8 +++++-
 tools/firmware/hvmloader/rombios.c   | 23 +++++++++++-----
 tools/libxc/xc_dom_x86.c             | 32 ++++++++++++----------
 tools/libxl/libxl_dom.c              | 10 +++++++
 tools/libxl/libxl_internal.h         |  1 +
 tools/libxl/libxl_paths.c            |  9 ++++++
 13 files changed, 148 insertions(+), 33 deletions(-)
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author
#1 lore raw

PATCH 1/5 Tools.mk.in: drop unused variables

---
Cc: Ian Jackson <[email protected]>

---
 config/Tools.mk.in | 2 --
 1 file changed, 2 deletions(-)
config/Tools.mk.in +0 -2
index 2d6c440324..4cc9f29090 100644
@@ -20,8 +20,6 @@ BCC                 := @BCC@
 IASL                := @IASL@
 AWK                 := @AWK@
 FETCHER             := @FETCHER@
-SEABIOS_PATH        := @seabios_path@
-OVMF_PATH           := @ovmf_path@
 
 # Extra folder for libs/includes
 PREPEND_INCLUDES    := @PREPEND_INCLUDES@
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author
#2 lore raw

PATCH 2/5 ipxe: produce a single binary from its build

In reply to Wei Liu

And switch hvmloader/Makefile to use that binary. This will help later when we change hvmloader to pick a user provided binary.

No functional change.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>

---
 tools/firmware/etherboot/Makefile | 6 +++++-
 tools/firmware/hvmloader/Makefile | 8 ++++----
 2 files changed, 9 insertions(+), 5 deletions(-)
tools/firmware/etherboot/Makefile +5 -1
index e33458d2fe..37896ed4fc 100644
@@ -18,11 +18,15 @@ D=ipxe
 T=ipxe.tar.gz
 
 ROMS = $(addprefix $D/src/bin/, $(addsuffix .rom, $(ETHERBOOT_NICS)))
+ROM = $D/src/bin/ipxe.bin
 
 .NOTPARALLEL:
 
 .PHONY: all
-all: $(ROMS)
+all: $(ROM)
+
+$(ROM): $(ROMS)
+	cat $^ > $@
 
 %.rom: $D/src/arch/i386/Makefile
 	$(MAKE) -C $D/src bin/$(*F).rom
tools/firmware/hvmloader/Makefile +4 -4
index a5b4c32c1a..16255ebddd 100644
@@ -51,7 +51,7 @@ CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.debug.bin
 else
 CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.bin
 endif
-ETHERBOOT_ROMS := $(addprefix ../etherboot/ipxe/src/bin/, $(addsuffix .rom, $(ETHERBOOT_NICS)))
+ETHERBOOT_ROM := ../etherboot/ipxe/src/bin/ipxe.bin
 endif
 
 ROMS := 
@@ -60,7 +60,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_ROMS)
+ROMS += $(ROMBIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) $(ETHERBOOT_ROM)
 endif
 
 .PHONY: all
@@ -105,9 +105,9 @@ ifneq ($(CIRRUSVGA_ROM),)
 	sh ../../misc/mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> [email protected]
 	echo "#endif" >> [email protected]
 endif
-ifneq ($(ETHERBOOT_ROMS),)
+ifneq ($(ETHERBOOT_ROM),)
 	echo "#ifdef ROM_INCLUDE_ETHERBOOT" >> [email protected]
-	sh ../../misc/mkhex etherboot $(ETHERBOOT_ROMS) >> [email protected]
+	sh ../../misc/mkhex etherboot $(ETHERBOOT_ROM) >> [email protected]
 	echo "#endif" >> [email protected]
 endif
 
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 2/5
#3 lore raw

Re: [PATCH for-next 2/5] ipxe: produce a single binary from its build

Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 15.05.18 at 20:22, <[email protected]> wrote:
tools/firmware/etherboot/Makefile +0 -0
@@ -18,11 +18,15 @@ D=ipxe
 T=ipxe.tar.gz
 
 ROMS = $(addprefix $D/src/bin/, $(addsuffix .rom, $(ETHERBOOT_NICS)))

tools/firmware/etherboot/Makefile D=ipxe · line 29

Quoted 10 lines
tools/firmware/etherboot/Makefile +5 -1
+ROM = $D/src/bin/ipxe.bin
 
 .NOTPARALLEL:
 
 .PHONY: all
-all: $(ROMS)
+all: $(ROM)
+
+$(ROM): $(ROMS)
+	cat $^ > $@

Simple commands like this always make me worry what happens if someone interrupts the build at the "right" point in time: Does the target file get removed in that case, so that a subsequent re-invocation of make will correctly rebuild it? If not, you may need to go through an intermediate file, which you then rename to $@.

hvmloader part

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#4 lore raw

Re: [PATCH for-next 2/5] ipxe: produce a single binary from its build

Quoted 11 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 15.05.18 at 20:22, <[email protected]> wrote:
tools/firmware/etherboot/Makefile +1 -0
@@ -18,11 +18,15 @@ D=ipxe
 T=ipxe.tar.gz
 
 ROMS = $(addprefix $D/src/bin/, $(addsuffix .rom, $(ETHERBOOT_NICS)))
+ROM = $D/src/bin/ipxe.bin
 
 .NOTPARALLEL:
 
Quoted 12 lines

tools/firmware/etherboot/Makefile D=ipxe · line 29

Quoted 6 lines
tools/firmware/etherboot/Makefile +4 -1
 .PHONY: all
-all: $(ROMS)
+all: $(ROM)
+
+$(ROM): $(ROMS)
+	cat $^ > $@

Simple commands like this always make me worry what happens if someone interrupts the build at the "right" point in time: Does the target file get removed in that case, so that a subsequent re-invocation of make will correctly rebuild it? If not, you may need to go through an intermediate file, which you then rename to $@.

Good point. I will use an intermediary file in my next version.

Quoted 4 lines

hvmloader part

Thanks.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#5 lore raw

PATCH 3/5 libxc: allow HVM guest to have modules

In reply to Wei Liu

Lift the loading code out of PVH specific branch. Take the chance to make the debug message more useful.

IPXE will be loaded as a module of Rombios.

---
Cc: Ian Jackson <[email protected]>

---
 tools/libxc/xc_dom_x86.c | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)
tools/libxc/xc_dom_x86.c +18 -14
index e33a28847d..ed4973a997 100644
@@ -1698,20 +1698,6 @@ static int bootlate_hvm(struct xc_dom_image *dom)
                                 ((uintptr_t)cmdline - (uintptr_t)start_info);
         }
 
-        for ( i = 0; i < dom->num_modules; i++ )
-        {
-            struct xc_hvm_firmware_module mod;
-
-            DOMPRINTF("Adding module %u", i);
-            mod.guest_addr_out =
-                dom->modules[i].seg.vstart - dom->parms.virt_base;
-            mod.length =
-                dom->modules[i].seg.vend - dom->modules[i].seg.vstart;
-
-            add_module_to_list(dom, &mod, dom->modules[i].cmdline,
-                               modlist, start_info);
-        }
-
         /* ACPI module 0 is the RSDP */
         start_info->rsdp_paddr = dom->acpi_modules[0].guest_addr_out ? : 0;
     }
@@ -1721,6 +1707,24 @@ static int bootlate_hvm(struct xc_dom_image *dom)
                            modlist, start_info);
     }
 
+    for ( i = 0; i < dom->num_modules; i++ )
+    {
+        struct xc_hvm_firmware_module mod;
+        uint64_t base = dom->parms.virt_base != UNSET_ADDR ?
+            dom->parms.virt_base : 0;
+
+        mod.guest_addr_out =
+            dom->modules[i].seg.vstart - base;
+        mod.length =
+            dom->modules[i].seg.vend - dom->modules[i].seg.vstart;
+
+        DOMPRINTF("Adding module %u guest_addr %"PRIx64" len %u",
+                  i, mod.guest_addr_out, mod.length);
+
+        add_module_to_list(dom, &mod, dom->modules[i].cmdline,
+                           modlist, start_info);
+    }
+
     if ( start_info->nr_modules )
     {
         start_info->modlist_paddr = (dom->start_info_seg.pfn << PAGE_SHIFT) +
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author
#6 lore raw

PATCH 4/5 tools: load IPXE from standalone file

In reply to Wei Liu

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.

---
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>

---
 tools/firmware/Makefile              |  6 ++++++
 tools/firmware/hvmloader/Makefile    |  9 +--------
 tools/firmware/hvmloader/hvmloader.c |  8 +++++++-
 tools/firmware/hvmloader/rombios.c   | 23 ++++++++++++++++-------
 tools/libxl/libxl_dom.c              | 10 ++++++++++
 tools/libxl/libxl_internal.h         |  1 +
 tools/libxl/libxl_paths.c            |  5 +++++
 7 files changed, 46 insertions(+), 16 deletions(-)
tools/firmware/Makefile +6 -0
index 5a7cf7766d..0bef579637 100644
@@ -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
tools/firmware/hvmloader/Makefile +1 -8
index 16255ebddd..496ac72b77 100644
@@ -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) >> [email protected]
 	echo "#endif" >> [email protected]
 endif
-ifneq ($(ETHERBOOT_ROM),)
-	echo "#ifdef ROM_INCLUDE_ETHERBOOT" >> [email protected]
-	sh ../../misc/mkhex etherboot $(ETHERBOOT_ROM) >> [email protected]
-	echo "#endif" >> [email protected]
-endif
-
 	mv [email protected] $@
 
 .PHONY: clean
tools/firmware/hvmloader/hvmloader.c +7 -1
index f603f68ded..f546cfb3ab 100644
@@ -368,7 +368,13 @@ int main(void)
 #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, (void*)paddr, 0 /* unused */);
     }
 #endif
     else
tools/firmware/hvmloader/rombios.c +16 -7
index c736fd9dea..8c44839ce3 100644
@@ -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,7 @@ static void rombios_load_roms(void)
 }
 
 static void rombios_load(const struct bios_config *config,
-                         void *unused_addr, uint32_t unused_size)
+                         void *ipxe_addr, uint32_t unused_size)
 {
     uint32_t bioshigh;
     struct rombios_info *info;
@@ -133,6 +139,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;
 }
 
 /*
tools/libxl/libxl_dom.c +10 -0
index f0fd5fd3a3..1b9e45c492 100644
@@ -1128,6 +1128,16 @@ 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())
+        rc = xc_dom_module_file(dom, libxl__ipxe_path(), "ipxe");
+
+    if (rc) {
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
     if (info->type == LIBXL_DOMAIN_TYPE_HVM &&
         info->u.hvm.smbios_firmware) {
         data = NULL;
tools/libxl/libxl_internal.h +1 -0
index c582894589..518b75592c 100644
@@ -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 -----*/
 
tools/libxl/libxl_paths.c +5 -0
index 0643c1b3a4..8498f82781 100644
@@ -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
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 4/5
#7 lore raw

Re: [PATCH for-next 4/5] tools: load IPXE from standalone file

Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 15.05.18 at 20:22, <[email protected]> wrote:
tools/firmware/hvmloader/rombios.c +0 -6
@@ -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);

tools/firmware/hvmloader/rombios.c static void rombios_load_roms(void) · line 110

Quoted 10 lines
tools/firmware/hvmloader/rombios.c +10 -0
+    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);
+    }

I guess you want to alter existing logic as little as possible, hence you don't want to leverage the fact that you (could) get the size passed ...

tools/firmware/hvmloader/rombios.c static void rombios_load(const struct bios_config *config, · line 145

Quoted 8 lines
tools/firmware/hvmloader/rombios.c +3 -0
@@ -133,6 +139,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;
 }

... here (but you ignore it). If the size was used, scan_option_rom() could be made not even look at non-option-ROMs.

But on the basis that you simply retain existing functionality

for the hvmloader parts.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#8 lore raw

Re: [PATCH for-next 4/5] tools: load IPXE from standalone file

In reply to Wei Liu
Quoted 6 lines · Wei Liu
tools/firmware/hvmloader/hvmloader.c +0 -0
index f603f68ded..f546cfb3ab 100644
@@ -368,7 +368,13 @@ int main(void)
 #ifdef ENABLE_ROMBIOS

tools/firmware/hvmloader/hvmloader.c int main(void) · line 377

Quoted 10 lines
tools/firmware/hvmloader/hvmloader.c +7 -1
     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, (void*)paddr, 0 /* unused */);

I don't think it's a good idea to change the meaning of the arguments of bios_load(). For every other use of bios_load, the second argument is used at the address of the firmware to load. Here "ipxe" is an extra blob to load.

Signature · 6 lines
Anthony PERARD

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author
#9 lore raw

Re: [PATCH for-next 4/5] tools: load IPXE from standalone file

Quoted 14 lines · Anthony PERARD
Quoted 13 lines · Wei Liu
tools/firmware/hvmloader/hvmloader.c +4 -1
index f603f68ded..f546cfb3ab 100644
@@ -368,7 +368,13 @@ int main(void)
 #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");
Quoted 8 lines

tools/firmware/hvmloader/hvmloader.c int main(void) · line 377

Quoted 3 lines
tools/firmware/hvmloader/hvmloader.c +3 -0
+        if ( ipxe )
+            paddr = ipxe->paddr;
+        bios->bios_load(bios, (void*)paddr, 0 /* unused */);

I don't think it's a good idea to change the meaning of the arguments of bios_load(). For every other use of bios_load, the second argument is used at the address of the firmware to load. Here "ipxe" is an extra blob to load.

We either add more arguments to bios_load or repurpose the existing one(s). I'm not too fussed with either option really.

Jan and Andrew, your opinion?

Wei.

Quoted 3 lines
Signature · 2 lines
-- 
Anthony PERARD

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#10 lore raw

Re: [PATCH for-next 4/5] tools: load IPXE from standalone file

Quoted 25 lines
Quoted 1 line
Quoted 1 line · On 25.06.18 at 10:16, <[email protected]> wrote:
Quoted 14 lines · Anthony PERARD
Quoted 13 lines · Wei Liu
tools/firmware/hvmloader/hvmloader.c +4 -1
index f603f68ded..f546cfb3ab 100644
@@ -368,7 +368,13 @@ int main(void)
 #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");
Quoted 8 lines

tools/firmware/hvmloader/hvmloader.c int main(void) · line 377

Quoted 3 lines
tools/firmware/hvmloader/hvmloader.c +3 -0
+        if ( ipxe )
+            paddr = ipxe->paddr;
+        bios->bios_load(bios, (void*)paddr, 0 /* unused */);

I don't think it's a good idea to change the meaning of the arguments of bios_load(). For every other use of bios_load, the second argument is used at the address of the firmware to load. Here "ipxe" is an extra blob to load.

Quoted 4 lines

We either add more arguments to bios_load or repurpose the existing one(s). I'm not too fussed with either option really.

Jan and Andrew, your opinion?

Hmm, it did look fine to me, but if Anthony has strong reservations, maybe adding a new parameter might be better indeed?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#11 lore raw

PATCH 5/5 tools: provide --with-system-ipxe

In reply to Wei Liu

---
Cc: Ian Jackson <[email protected]>

---
 config/Tools.mk.in        |  1 +
 tools/config.h.in         |  3 +++
 tools/configure           | 53 +++++++++++++++++++++++++++++++++++++++++++++++
 tools/configure.ac        | 18 ++++++++++++++++
 tools/libxl/libxl_paths.c |  6 +++++-
 5 files changed, 80 insertions(+), 1 deletion(-)
config/Tools.mk.in +1 -0
index 4cc9f29090..0964f6f9e9 100644
@@ -50,6 +50,7 @@ FLASK_POLICY        := @xsmpolicy@
 CONFIG_OVMF         := @ovmf@
 CONFIG_ROMBIOS      := @rombios@
 CONFIG_SEABIOS      := @seabios@
+CONFIG_IPXE         := @ipxe@
 CONFIG_QEMU_TRAD    := @qemu_traditional@
 CONFIG_QEMU_XEN     := @qemu_xen@
 CONFIG_BLKTAP2      := @blktap2@
tools/config.h.in +3 -0
index c66a78c9b3..5987f087b8 100644
@@ -96,6 +96,9 @@
 /* libutil header file name */
 #undef INCLUDE_LIBUTIL_H
 
+/* IPXE path */
+#undef IPXE_PATH
+
 /* OVMF path */
 #undef OVMF_PATH
 
tools/configure +53 -0

95 lines not on this page · raw message

tools/configure.ac +18 -0
index 0826af8cbc..8e4b173d6f 100644
@@ -84,6 +84,7 @@ AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools])
 AX_ARG_DEFAULT_ENABLE([xsmpolicy], [Disable XSM policy compilation])
 AX_ARG_DEFAULT_DISABLE([ovmf], [Enable OVMF])
 AX_ARG_DEFAULT_ENABLE([seabios], [Disable SeaBIOS])
+AX_ARG_DEFAULT_ENABLE([ipxe], [Disable IPXE])
 
 AC_ARG_WITH([linux-backend-modules],
     AS_HELP_STRING([--with-linux-backend-modules="mod1 mod2"],
@@ -241,6 +242,23 @@ AS_IF([test "x$ovmf" = "xy" -o -n "$ovmf_path" ], [
                        [OVMF path])
 ])
 
+AC_ARG_WITH([system-ipxe],
+    AS_HELP_STRING([--with-system-ipxe@<:@=PATH@:>@],
+       [Use system supplied IPXE PATH instead of building and installing
+        our own version]),[
+    # Disable compilation of IPXE.
+    ipxe=n
+    case $withval in
+        no) ipxe_path= ;;
+        *)  ipxe_path=$withval ;;
+    esac
+],[])
+AS_IF([test "x$ipxe" = "xy" -o -n "$ipxe_path" ], [
+    AC_DEFINE_UNQUOTED([IPXE_PATH],
+                       ["${ipxe_path:-$XENFIRMWAREDIR/ipxe.bin}"],
+                       [IPXE path])
+])
+
 AC_ARG_WITH([extra-qemuu-configure-args],
     AS_HELP_STRING([--with-extra-qemuu-configure-args@<:@="--ARG1 ..."@:>@],
        [List of additional configure options for upstream qemu]),[
tools/libxl/libxl_paths.c +5 -1
index 8498f82781..3f6a33628e 100644
@@ -55,7 +55,11 @@ const char *libxl__ovmf_path(void)
 
 const char *libxl__ipxe_path(void)
 {
-    return XENFIRMWAREDIR "/ipxe.bin";
+#ifdef IPXE_PATH
+    return IPXE_PATH;
+#else
+    return NULL;
+#endif
 }
 
 /*
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#12 lore raw

Re: [PATCH for-next 5/5] tools: provide --with-system-ipxe

Quoted 15 lines · Wei Liu
tools/configure.ac +7 -0
index 0826af8cbc..8e4b173d6f 100644
@@ -241,6 +242,23 @@ AS_IF([test "x$ovmf" = "xy" -o -n "$ovmf_path" ], [
                        [OVMF path])
 ])
 
+AC_ARG_WITH([system-ipxe],
+    AS_HELP_STRING([--with-system-ipxe@<:@=PATH@:>@],
+       [Use system supplied IPXE PATH instead of building and installing
+        our own version]),[
+    # Disable compilation of IPXE.
+    ipxe=n
+    case $withval in

tools/configure.ac AS_IF([test "x$ovmf" = "xy" -o -n "$ovmf_path" ], [ · line 261

Quoted 10 lines
tools/configure.ac +10 -0
+        no) ipxe_path= ;;
+        *)  ipxe_path=$withval ;;
+    esac
+],[])
+AS_IF([test "x$ipxe" = "xy" -o -n "$ipxe_path" ], [
+    AC_DEFINE_UNQUOTED([IPXE_PATH],
+                       ["${ipxe_path:-$XENFIRMWAREDIR/ipxe.bin}"],
+                       [IPXE path])
+])
+

I think there are issues with the way we handle --with-system-X. If a user run configure --with-system-ipxe, without a = or a PATH, then in the hunk abrove, $withval will be "yes" and this will result with IPXE_PATH=yes

I don't know if you want to look at that, since you're introducing a new one.

Signature · 6 lines
Anthony PERARD

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author
#13 lore raw

Re: [PATCH for-next 5/5] tools: provide --with-system-ipxe

Quoted 32 lines · Anthony PERARD
Quoted 15 lines · Wei Liu
tools/configure.ac +7 -0
index 0826af8cbc..8e4b173d6f 100644
@@ -241,6 +242,23 @@ AS_IF([test "x$ovmf" = "xy" -o -n "$ovmf_path" ], [
                        [OVMF path])
 ])
 
+AC_ARG_WITH([system-ipxe],
+    AS_HELP_STRING([--with-system-ipxe@<:@=PATH@:>@],
+       [Use system supplied IPXE PATH instead of building and installing
+        our own version]),[
+    # Disable compilation of IPXE.
+    ipxe=n
+    case $withval in

tools/configure.ac AS_IF([test "x$ovmf" = "xy" -o -n "$ovmf_path" ], [ · line 261

Quoted 10 lines
tools/configure.ac +10 -0
+        no) ipxe_path= ;;
+        *)  ipxe_path=$withval ;;
+    esac
+],[])
+AS_IF([test "x$ipxe" = "xy" -o -n "$ipxe_path" ], [
+    AC_DEFINE_UNQUOTED([IPXE_PATH],
+                       ["${ipxe_path:-$XENFIRMWAREDIR/ipxe.bin}"],
+                       [IPXE path])
+])
+

I think there are issues with the way we handle --with-system-X. If a user run configure --with-system-ipxe, without a = or a PATH, then in the hunk abrove, $withval will be "yes" and this will result with IPXE_PATH=yes

Quoted 3 lines

I don't know if you want to look at that, since you're introducing a new one.

We can add a branch to all of them to print out an error when $withval is yes.

Wei.

Quoted 2 lines
Signature · 1 line
Anthony PERARD

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel