Patchwork Add Makefile rules to build pxe rom binaries (with/without EFI support)

login
register
mail settings
Submitter Gerd Hoffmann
Date Feb. 11, 2013, 10:36 a.m.
Message ID <1360579000-29309-1-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/219561/
State New
Headers show

Comments

Gerd Hoffmann - Feb. 11, 2013, 10:36 a.m.
This patch adds two new targets to roms/Makefile.

"make -C roms ipxerom" will build the ipxe roms and update
the binaries in pc-bios/, i.e. it basically documents how
the build process of our current pxe roms works.

"make -C rpms epxerom" will build rom binaries with EFI support.
They are composed from three images: legacy bios, efi ia32
and efi x86.  So netbooting via SeaBIOS will continue to work
like it does today, and additionally we get network support
for EFI.  This target needs the EfiRom utility (shipped with
edk2) somewhere in the $PATH.

Note that adding EFI support makes the pxe rom bar size jump
from 64k to 256k, so before actually committing binaries with
EFI support to the master branch we have to figure how to handle
rom size changes on live migration.  But we must do that anyway
as seabios bios size is pretty close to 128k and we likely will
have to jump to 256k in near future.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 roms/Makefile |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
Andreas Färber - Feb. 11, 2013, 2:15 p.m.
Am 11.02.2013 11:36, schrieb Gerd Hoffmann:
> This patch adds two new targets to roms/Makefile.
> 
> "make -C roms ipxerom" will build the ipxe roms and update
> the binaries in pc-bios/, i.e. it basically documents how
> the build process of our current pxe roms works.
> 
> "make -C rpms epxerom" will build rom binaries with EFI support.

roms

> They are composed from three images: legacy bios, efi ia32
> and efi x86.  So netbooting via SeaBIOS will continue to work

Makefile comment says x64.

Cheers,
Andreas

> like it does today, and additionally we get network support
> for EFI.  This target needs the EfiRom utility (shipped with
> edk2) somewhere in the $PATH.
> 
> Note that adding EFI support makes the pxe rom bar size jump
> from 64k to 256k, so before actually committing binaries with
> EFI support to the master branch we have to figure how to handle
> rom size changes on live migration.  But we must do that anyway
> as seabios bios size is pretty close to 128k and we likely will
> have to jump to 256k in near future.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  roms/Makefile |   46 ++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 46 insertions(+)
> 
> diff --git a/roms/Makefile b/roms/Makefile
> index 5e645bc..18c7ae2 100644
> --- a/roms/Makefile
> +++ b/roms/Makefile
> @@ -1,5 +1,30 @@
>  
>  vgabios_variants := stdvga cirrus vmware qxl
> +pxerom_variants  := e1000 eepro100 ne2k_pci pcnet rtl8139 virtio
> +
> +ipxerom-e1000    epxerom-e1000    : VID := 8086
> +ipxerom-e1000    epxerom-e1000    : DID := 100e
> +ipxerom-eepro100 epxerom-eepro100 : VID := 8086
> +ipxerom-eepro100 epxerom-eepro100 : DID := 1209
> +ipxerom-ne2k_pci epxerom-ne2k_pci : VID := 1050
> +ipxerom-ne2k_pci epxerom-ne2k_pci : DID := 0940
> +ipxerom-pcnet    epxerom-pcnet    : VID := 1022
> +ipxerom-pcnet    epxerom-pcnet    : DID := 2000
> +ipxerom-rtl8139  epxerom-rtl8139  : VID := 10ec
> +ipxerom-rtl8139  epxerom-rtl8139  : DID := 8139
> +ipxerom-virtio   epxerom-virtio   : VID := 1af4
> +ipxerom-virtio   epxerom-virtio   : DID := 1000
> +
> +#
> +# EfiRom utility is shipped with edk2 / tianocore, in BaseTools/
> +#
> +# We need that to combine multiple images (legacy bios,
> +# efi ia32, efi x64) into a single rom binary.
> +#
> +# We try to find it in the path.  You can also pass the location on
> +# the command line, i.e. "make EFIROM=/path/to/EfiRom epxerom"
> +#
> +EFIROM ?= $(shell which EfiRom 2>/dev/null)
>  
>  default:
>  	@echo "nothing is build by default"
> @@ -7,6 +32,9 @@ default:
>  	@echo "  bios           -- update bios.bin (seabios)"
>  	@echo "  seavgabios     -- update vgabios binaries (seabios)"
>  	@echo "  lgplvgabios    -- update vgabios binaries (lgpl)"
> +	@echo "  ipxerom        -- update pxe roms (bios only)"
> +	@echo "  epxerom        -- update pxe roms (bios+efi, this needs"
> +	@echo "                    the EfiRom utility from edk2 / tianocore)"
>  
>  bios: config.seabios
>  	sh configure-seabios.sh $<
> @@ -26,3 +54,21 @@ lgplvgabios: $(patsubst %,lgplvgabios-%,$(vgabios_variants))
>  lgplvgabios-%:
>  	make -C vgabios vgabios-$*.bin
>  	cp vgabios/VGABIOS-lgpl-latest.$*.bin ../pc-bios/vgabios-$*.bin
> +
> +ipxerom: $(patsubst %,ipxerom-%,$(pxerom_variants))
> +
> +ipxerom-%:
> +	make -C ipxe/src bin/$(VID)$(DID).rom
> +	cp ipxe/src/bin/$(VID)$(DID).rom ../pc-bios/pxe-$*.rom
> +
> +epxerom: $(patsubst %,epxerom-%,$(pxerom_variants))
> +
> +epxerom-%:
> +	make -C ipxe/src bin/$(VID)$(DID).rom
> +	make -C ipxe/src bin-i386-efi/$(VID)$(DID).efidrv
> +	make -C ipxe/src bin-x86_64-efi/$(VID)$(DID).efidrv
> +	$(EFIROM) -f "0x$(VID)" -i "0x$(DID)" -l 0x02 \
> +		-b ipxe/src/bin/$(VID)$(DID).rom \
> +		-ec ipxe/src/bin-i386-efi/$(VID)$(DID).efidrv \
> +		-ec ipxe/src/bin-x86_64-efi/$(VID)$(DID).efidrv \
> +		-o ../pc-bios/pxe-$*.rom

Patch

diff --git a/roms/Makefile b/roms/Makefile
index 5e645bc..18c7ae2 100644
--- a/roms/Makefile
+++ b/roms/Makefile
@@ -1,5 +1,30 @@ 
 
 vgabios_variants := stdvga cirrus vmware qxl
+pxerom_variants  := e1000 eepro100 ne2k_pci pcnet rtl8139 virtio
+
+ipxerom-e1000    epxerom-e1000    : VID := 8086
+ipxerom-e1000    epxerom-e1000    : DID := 100e
+ipxerom-eepro100 epxerom-eepro100 : VID := 8086
+ipxerom-eepro100 epxerom-eepro100 : DID := 1209
+ipxerom-ne2k_pci epxerom-ne2k_pci : VID := 1050
+ipxerom-ne2k_pci epxerom-ne2k_pci : DID := 0940
+ipxerom-pcnet    epxerom-pcnet    : VID := 1022
+ipxerom-pcnet    epxerom-pcnet    : DID := 2000
+ipxerom-rtl8139  epxerom-rtl8139  : VID := 10ec
+ipxerom-rtl8139  epxerom-rtl8139  : DID := 8139
+ipxerom-virtio   epxerom-virtio   : VID := 1af4
+ipxerom-virtio   epxerom-virtio   : DID := 1000
+
+#
+# EfiRom utility is shipped with edk2 / tianocore, in BaseTools/
+#
+# We need that to combine multiple images (legacy bios,
+# efi ia32, efi x64) into a single rom binary.
+#
+# We try to find it in the path.  You can also pass the location on
+# the command line, i.e. "make EFIROM=/path/to/EfiRom epxerom"
+#
+EFIROM ?= $(shell which EfiRom 2>/dev/null)
 
 default:
 	@echo "nothing is build by default"
@@ -7,6 +32,9 @@  default:
 	@echo "  bios           -- update bios.bin (seabios)"
 	@echo "  seavgabios     -- update vgabios binaries (seabios)"
 	@echo "  lgplvgabios    -- update vgabios binaries (lgpl)"
+	@echo "  ipxerom        -- update pxe roms (bios only)"
+	@echo "  epxerom        -- update pxe roms (bios+efi, this needs"
+	@echo "                    the EfiRom utility from edk2 / tianocore)"
 
 bios: config.seabios
 	sh configure-seabios.sh $<
@@ -26,3 +54,21 @@  lgplvgabios: $(patsubst %,lgplvgabios-%,$(vgabios_variants))
 lgplvgabios-%:
 	make -C vgabios vgabios-$*.bin
 	cp vgabios/VGABIOS-lgpl-latest.$*.bin ../pc-bios/vgabios-$*.bin
+
+ipxerom: $(patsubst %,ipxerom-%,$(pxerom_variants))
+
+ipxerom-%:
+	make -C ipxe/src bin/$(VID)$(DID).rom
+	cp ipxe/src/bin/$(VID)$(DID).rom ../pc-bios/pxe-$*.rom
+
+epxerom: $(patsubst %,epxerom-%,$(pxerom_variants))
+
+epxerom-%:
+	make -C ipxe/src bin/$(VID)$(DID).rom
+	make -C ipxe/src bin-i386-efi/$(VID)$(DID).efidrv
+	make -C ipxe/src bin-x86_64-efi/$(VID)$(DID).efidrv
+	$(EFIROM) -f "0x$(VID)" -i "0x$(DID)" -l 0x02 \
+		-b ipxe/src/bin/$(VID)$(DID).rom \
+		-ec ipxe/src/bin-i386-efi/$(VID)$(DID).efidrv \
+		-ec ipxe/src/bin-x86_64-efi/$(VID)$(DID).efidrv \
+		-o ../pc-bios/pxe-$*.rom