diff mbox series

[v2,11/12] Makefile: install the edk2 firmware images and their descriptors

Message ID 20190313210057.32584-12-lersek@redhat.com (mailing list archive)
State New, archived
Headers show
Series bundle edk2 platform firmware with QEMU | expand

Commit Message

Laszlo Ersek March 13, 2019, 9 p.m. UTC
Decompress and install the edk2 firmware blobs as part of "make install",
unless blob installation was disabled with configure's "--disable-blobs"
option.

Additionally, decompress the blobs as a pre-requisite for building softmmu
binaries -- this is helpful for both "make check" and other ad-hoc tests
one might want to run in the build directory.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---

Notes:
    v2:
    
    - adapt to tracking the edk2 flash device files in compressed form [Dan,
      Michael, Phil]
    
    - do not pick up Michal's and Michael's R-b's due to the above change

 configure  |  1 +
 Makefile   | 29 +++++++++++++++++++-
 .gitignore |  1 +
 3 files changed, 30 insertions(+), 1 deletion(-)

Comments

Michal Prívozník March 14, 2019, 2:06 p.m. UTC | #1
On 3/13/19 10:00 PM, Laszlo Ersek wrote:
> Decompress and install the edk2 firmware blobs as part of "make install",
> unless blob installation was disabled with configure's "--disable-blobs"
> option.
> 
> Additionally, decompress the blobs as a pre-requisite for building softmmu
> binaries -- this is helpful for both "make check" and other ad-hoc tests
> one might want to run in the build directory.
> 
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
> 
> Notes:
>      v2:
>      
>      - adapt to tracking the edk2 flash device files in compressed form [Dan,
>        Michael, Phil]
>      
>      - do not pick up Michal's and Michael's R-b's due to the above change
> 
>   configure  |  1 +
>   Makefile   | 29 +++++++++++++++++++-
>   .gitignore |  1 +
>   3 files changed, 30 insertions(+), 1 deletion(-)

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal
Philippe Mathieu-Daudé March 14, 2019, 6:57 p.m. UTC | #2
On 3/13/19 10:00 PM, Laszlo Ersek wrote:
> Decompress and install the edk2 firmware blobs as part of "make install",
> unless blob installation was disabled with configure's "--disable-blobs"
> option.
> 
> Additionally, decompress the blobs as a pre-requisite for building softmmu
> binaries -- this is helpful for both "make check" and other ad-hoc tests
> one might want to run in the build directory.
> 
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
> 
> Notes:
>     v2:
>     
>     - adapt to tracking the edk2 flash device files in compressed form [Dan,
>       Michael, Phil]
>     
>     - do not pick up Michal's and Michael's R-b's due to the above change

Appreciated!

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> 
>  configure  |  1 +
>  Makefile   | 29 +++++++++++++++++++-
>  .gitignore |  1 +
>  3 files changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index cab830a4c920..a8e5c14899d6 100755
> --- a/configure
> +++ b/configure
> @@ -7770,6 +7770,7 @@ for bios_file in \
>      $source_path/pc-bios/*.img \
>      $source_path/pc-bios/openbios-* \
>      $source_path/pc-bios/u-boot.* \
> +    $source_path/pc-bios/edk2-*.fd.xz \
>      $source_path/pc-bios/palcode-*
>  do
>      LINKS="$LINKS pc-bios/$(basename $bios_file)"
> diff --git a/Makefile b/Makefile
> index 6ccb8639b08a..4b325052005e 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -296,6 +296,10 @@ ui/input-keymap-%.c: $(KEYCODEMAP_GEN) $(KEYCODEMAP_CSV) $(SRC_PATH)/ui/Makefile
>  $(KEYCODEMAP_GEN): .git-submodule-status
>  $(KEYCODEMAP_CSV): .git-submodule-status
>  
> +edk2-decompressed = $(basename $(wildcard pc-bios/edk2-*.fd.xz))
> +pc-bios/edk2-%.fd: pc-bios/edk2-%.fd.xz
> +	$(call quiet-command,xz -d -c $< > $@,"UNXZ",$<)
> +
>  # Don't try to regenerate Makefile or configure
>  # We don't generate any of them
>  Makefile: ;
> @@ -444,6 +448,7 @@ $(SOFTMMU_SUBDIR_RULES): $(block-obj-y)
>  $(SOFTMMU_SUBDIR_RULES): $(crypto-obj-y)
>  $(SOFTMMU_SUBDIR_RULES): $(io-obj-y)
>  $(SOFTMMU_SUBDIR_RULES): config-all-devices.mak
> +$(SOFTMMU_SUBDIR_RULES): $(edk2-decompressed)
>  
>  subdir-%:
>  	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
> @@ -632,6 +637,7 @@ clean:
>  		! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \
>  		! -path ./roms/edk2/BaseTools/Source/Python/UPT/Dll/sqlite3.dll \
>  		-exec rm {} +
> +	rm -f $(edk2-decompressed)
>  	rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
>  	rm -f fsdev/*.pod scsi/*.pod
>  	rm -f qemu-img-cmds.h
> @@ -722,9 +728,14 @@ spapr-rtas.bin slof.bin skiboot.lid \
>  palcode-clipper \
>  u-boot.e500 u-boot-sam460-20100605.bin \
>  qemu_vga.ndrv \
> +edk2-licenses.txt \
>  hppa-firmware.img
> +
> +DESCS=50-edk2-i386-secure.json 50-edk2-x86_64-secure.json \
> +60-edk2-aarch64.json 60-edk2-arm.json 60-edk2-i386.json 60-edk2-x86_64.json
>  else
>  BLOBS=
> +DESCS=
>  endif
>  
>  # Note that we manually filter-out the non-Sphinx documentation which
> @@ -785,7 +796,8 @@ endif
>  
>  ICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 512x512
>  
> -install: all $(if $(BUILD_DOCS),install-doc) install-datadir install-localstatedir
> +install: all $(if $(BUILD_DOCS),install-doc) install-datadir install-localstatedir \
> +	$(if $(INSTALL_BLOBS),$(edk2-decompressed))
>  ifneq ($(TOOLS),)
>  	$(call install-prog,$(subst qemu-ga,qemu-ga$(EXESUF),$(TOOLS)),$(DESTDIR)$(bindir))
>  endif
> @@ -807,6 +819,21 @@ ifneq ($(BLOBS),)
>  	set -e; for x in $(BLOBS); do \
>  		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
>  	done
> +endif
> +ifdef INSTALL_BLOBS
> +	set -e; for x in $(edk2-decompressed); do \
> +		$(INSTALL_DATA) $$x "$(DESTDIR)$(qemu_datadir)"; \
> +	done
> +endif
> +ifneq ($(DESCS),)
> +	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/firmware"
> +	set -e; tmpf=$$(mktemp); trap 'rm -f -- "$$tmpf"' EXIT; \
> +	for x in $(DESCS); do \
> +		sed -e 's,@DATADIR@,$(DESTDIR)$(qemu_datadir),' \
> +			"$(SRC_PATH)/pc-bios/descriptors/$$x" > "$$tmpf"; \
> +		$(INSTALL_DATA) "$$tmpf" \
> +			"$(DESTDIR)$(qemu_datadir)/firmware/$$x"; \
> +	done
>  endif
>  	for s in $(ICON_SIZES); do \
>  		mkdir -p "$(DESTDIR)/$(qemu_icondir)/hicolor/$${s}/apps"; \
> diff --git a/.gitignore b/.gitignore
> index 77522561b8ea..889896c023fd 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -96,6 +96,7 @@
>  *.gcno
>  *.gcov
>  /pc-bios/bios-pq/status
> +/pc-bios/edk2-*.fd
>  /pc-bios/vgabios-pq/status
>  /pc-bios/optionrom/linuxboot.asm
>  /pc-bios/optionrom/linuxboot.bin
>
diff mbox series

Patch

diff --git a/configure b/configure
index cab830a4c920..a8e5c14899d6 100755
--- a/configure
+++ b/configure
@@ -7770,6 +7770,7 @@  for bios_file in \
     $source_path/pc-bios/*.img \
     $source_path/pc-bios/openbios-* \
     $source_path/pc-bios/u-boot.* \
+    $source_path/pc-bios/edk2-*.fd.xz \
     $source_path/pc-bios/palcode-*
 do
     LINKS="$LINKS pc-bios/$(basename $bios_file)"
diff --git a/Makefile b/Makefile
index 6ccb8639b08a..4b325052005e 100644
--- a/Makefile
+++ b/Makefile
@@ -296,6 +296,10 @@  ui/input-keymap-%.c: $(KEYCODEMAP_GEN) $(KEYCODEMAP_CSV) $(SRC_PATH)/ui/Makefile
 $(KEYCODEMAP_GEN): .git-submodule-status
 $(KEYCODEMAP_CSV): .git-submodule-status
 
+edk2-decompressed = $(basename $(wildcard pc-bios/edk2-*.fd.xz))
+pc-bios/edk2-%.fd: pc-bios/edk2-%.fd.xz
+	$(call quiet-command,xz -d -c $< > $@,"UNXZ",$<)
+
 # Don't try to regenerate Makefile or configure
 # We don't generate any of them
 Makefile: ;
@@ -444,6 +448,7 @@  $(SOFTMMU_SUBDIR_RULES): $(block-obj-y)
 $(SOFTMMU_SUBDIR_RULES): $(crypto-obj-y)
 $(SOFTMMU_SUBDIR_RULES): $(io-obj-y)
 $(SOFTMMU_SUBDIR_RULES): config-all-devices.mak
+$(SOFTMMU_SUBDIR_RULES): $(edk2-decompressed)
 
 subdir-%:
 	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
@@ -632,6 +637,7 @@  clean:
 		! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \
 		! -path ./roms/edk2/BaseTools/Source/Python/UPT/Dll/sqlite3.dll \
 		-exec rm {} +
+	rm -f $(edk2-decompressed)
 	rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
 	rm -f fsdev/*.pod scsi/*.pod
 	rm -f qemu-img-cmds.h
@@ -722,9 +728,14 @@  spapr-rtas.bin slof.bin skiboot.lid \
 palcode-clipper \
 u-boot.e500 u-boot-sam460-20100605.bin \
 qemu_vga.ndrv \
+edk2-licenses.txt \
 hppa-firmware.img
+
+DESCS=50-edk2-i386-secure.json 50-edk2-x86_64-secure.json \
+60-edk2-aarch64.json 60-edk2-arm.json 60-edk2-i386.json 60-edk2-x86_64.json
 else
 BLOBS=
+DESCS=
 endif
 
 # Note that we manually filter-out the non-Sphinx documentation which
@@ -785,7 +796,8 @@  endif
 
 ICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 512x512
 
-install: all $(if $(BUILD_DOCS),install-doc) install-datadir install-localstatedir
+install: all $(if $(BUILD_DOCS),install-doc) install-datadir install-localstatedir \
+	$(if $(INSTALL_BLOBS),$(edk2-decompressed))
 ifneq ($(TOOLS),)
 	$(call install-prog,$(subst qemu-ga,qemu-ga$(EXESUF),$(TOOLS)),$(DESTDIR)$(bindir))
 endif
@@ -807,6 +819,21 @@  ifneq ($(BLOBS),)
 	set -e; for x in $(BLOBS); do \
 		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
 	done
+endif
+ifdef INSTALL_BLOBS
+	set -e; for x in $(edk2-decompressed); do \
+		$(INSTALL_DATA) $$x "$(DESTDIR)$(qemu_datadir)"; \
+	done
+endif
+ifneq ($(DESCS),)
+	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/firmware"
+	set -e; tmpf=$$(mktemp); trap 'rm -f -- "$$tmpf"' EXIT; \
+	for x in $(DESCS); do \
+		sed -e 's,@DATADIR@,$(DESTDIR)$(qemu_datadir),' \
+			"$(SRC_PATH)/pc-bios/descriptors/$$x" > "$$tmpf"; \
+		$(INSTALL_DATA) "$$tmpf" \
+			"$(DESTDIR)$(qemu_datadir)/firmware/$$x"; \
+	done
 endif
 	for s in $(ICON_SIZES); do \
 		mkdir -p "$(DESTDIR)/$(qemu_icondir)/hicolor/$${s}/apps"; \
diff --git a/.gitignore b/.gitignore
index 77522561b8ea..889896c023fd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -96,6 +96,7 @@ 
 *.gcno
 *.gcov
 /pc-bios/bios-pq/status
+/pc-bios/edk2-*.fd
 /pc-bios/vgabios-pq/status
 /pc-bios/optionrom/linuxboot.asm
 /pc-bios/optionrom/linuxboot.bin