[PATCH v3 02/15] uefi-test-tools: Add support for python based build script

Sunil V L posted 15 patches 6 months, 1 week ago
There is a newer version of this series
[PATCH v3 02/15] uefi-test-tools: Add support for python based build script
Posted by Sunil V L 6 months, 1 week ago
edk2-funcs.sh which is used in this Makefile, was removed in the commit
c28a2891f3 ("edk2: update build script"). It is replaced with a python
based script. So, update the Makefile and add the configuration file as
required to support the python based build script.

Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
---
 tests/uefi-test-tools/Makefile               | 19 +++----
 tests/uefi-test-tools/uefi-test-build.config | 52 ++++++++++++++++++++
 2 files changed, 59 insertions(+), 12 deletions(-)
 create mode 100644 tests/uefi-test-tools/uefi-test-build.config

diff --git a/tests/uefi-test-tools/Makefile b/tests/uefi-test-tools/Makefile
index 0c003f2877..f4eaebd8ff 100644
--- a/tests/uefi-test-tools/Makefile
+++ b/tests/uefi-test-tools/Makefile
@@ -12,7 +12,7 @@
 
 edk2_dir              := ../../roms/edk2
 images_dir            := ../data/uefi-boot-images
-emulation_targets     := arm aarch64 i386 x86_64
+emulation_targets     := arm aarch64 i386 x86_64 riscv64
 uefi_binaries         := bios-tables-test
 intermediate_suffixes := .efi .fat .iso.raw
 
@@ -56,7 +56,8 @@ Build/%.iso.raw: Build/%.fat
 # stripped from, the argument.
 map_arm_to_uefi     = $(subst arm,ARM,$(1))
 map_aarch64_to_uefi = $(subst aarch64,AA64,$(call map_arm_to_uefi,$(1)))
-map_i386_to_uefi    = $(subst i386,IA32,$(call map_aarch64_to_uefi,$(1)))
+map_riscv64_to_uefi = $(subst riscv64,RISCV64,$(call map_aarch64_to_uefi,$(1)))
+map_i386_to_uefi    = $(subst i386,IA32,$(call map_riscv64_to_uefi,$(1)))
 map_x86_64_to_uefi  = $(subst x86_64,X64,$(call map_i386_to_uefi,$(1)))
 map_to_uefi         = $(subst .,,$(call map_x86_64_to_uefi,$(1)))
 
@@ -70,7 +71,7 @@ Build/%.fat: Build/%.efi
 	uefi_bin_b=$$(stat --format=%s -- $<) && \
 		uefi_fat_kb=$$(( (uefi_bin_b * 11 / 10 + 1023) / 1024 )) && \
 		uefi_fat_kb=$$(( uefi_fat_kb >= 64 ? uefi_fat_kb : 64 )) && \
-		mkdosfs -C $@ -n $(basename $(@F)) -- $$uefi_fat_kb
+		mkdosfs -C $@ -n "bios-test" -- $$uefi_fat_kb
 	MTOOLS_SKIP_CHECK=1 mmd -i $@ ::EFI
 	MTOOLS_SKIP_CHECK=1 mmd -i $@ ::EFI/BOOT
 	MTOOLS_SKIP_CHECK=1 mcopy -i $@ -- $< \
@@ -95,15 +96,9 @@ Build/%.fat: Build/%.efi
 # we must mark the recipe manually as recursive, by using the "+" indicator.
 # This way, when the inner "make" starts a parallel build of the target edk2
 # module, it can communicate with the outer "make"'s job server.
-Build/bios-tables-test.%.efi: build-edk2-tools
-	+./build.sh $(edk2_dir) BiosTablesTest $* $@
-
-build-edk2-tools:
-	cd $(edk2_dir)/BaseTools && git submodule update --init --force
-	$(MAKE) -C $(edk2_dir)/BaseTools \
-		PYTHON_COMMAND=$${EDK2_PYTHON_COMMAND:-python3} \
-		EXTRA_OPTFLAGS='$(EDK2_BASETOOLS_OPTFLAGS)' \
-		EXTRA_LDFLAGS='$(EDK2_BASETOOLS_LDFLAGS)'
+Build/bios-tables-test.%.efi:
+	$(PYTHON) ../../roms/edk2-build.py --config uefi-test-build.config \
+		--match $*
 
 clean:
 	rm -rf Build Conf log
diff --git a/tests/uefi-test-tools/uefi-test-build.config b/tests/uefi-test-tools/uefi-test-build.config
new file mode 100644
index 0000000000..1f389ae541
--- /dev/null
+++ b/tests/uefi-test-tools/uefi-test-build.config
@@ -0,0 +1,52 @@
+[global]
+core = ../../roms/edk2
+
+####################################################################################
+# arm
+
+[build.arm]
+conf = UefiTestToolsPkg/UefiTestToolsPkg.dsc
+plat = UefiTestTools
+dest = ./Build
+arch = ARM
+cpy1 = ARM/BiosTablesTest.efi  bios-tables-test.arm.efi
+
+####################################################################################
+# aarch64
+
+[build.aarch64]
+conf = UefiTestToolsPkg/UefiTestToolsPkg.dsc
+plat = UefiTestTools
+dest = ./Build
+arch = AARCH64
+cpy1 = AARCH64/BiosTablesTest.efi  bios-tables-test.aarch64.efi
+
+####################################################################################
+# riscv64
+
+[build.riscv]
+conf = UefiTestToolsPkg/UefiTestToolsPkg.dsc
+plat = UefiTestTools
+dest = ./Build
+arch = RISCV64
+cpy1 = RISCV64/BiosTablesTest.efi  bios-tables-test.riscv64.efi
+
+####################################################################################
+# ia32
+
+[build.ia32]
+conf = UefiTestToolsPkg/UefiTestToolsPkg.dsc
+plat = UefiTestTools
+dest = ./Build
+arch = IA32
+cpy1 = IA32/BiosTablesTest.efi  bios-tables-test.i386.efi
+
+####################################################################################
+# x64
+
+[build.x64]
+conf = UefiTestToolsPkg/UefiTestToolsPkg.dsc
+plat = UefiTestTools
+dest = ./Build
+arch = X64
+cpy1 = X64/BiosTablesTest.efi  bios-tables-test.x86_64.efi
-- 
2.40.1
Re: [PATCH v3 02/15] uefi-test-tools: Add support for python based build script
Posted by Igor Mammedov 6 months ago
On Fri, 21 Jun 2024 17:28:53 +0530
Sunil V L <sunilvl@ventanamicro.com> wrote:

> edk2-funcs.sh which is used in this Makefile, was removed in the commit
> c28a2891f3 ("edk2: update build script"). It is replaced with a python
> based script. So, update the Makefile and add the configuration file as
> required to support the python based build script.
> 
> Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>

Acked-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  tests/uefi-test-tools/Makefile               | 19 +++----
>  tests/uefi-test-tools/uefi-test-build.config | 52 ++++++++++++++++++++
>  2 files changed, 59 insertions(+), 12 deletions(-)
>  create mode 100644 tests/uefi-test-tools/uefi-test-build.config
> 
> diff --git a/tests/uefi-test-tools/Makefile b/tests/uefi-test-tools/Makefile
> index 0c003f2877..f4eaebd8ff 100644
> --- a/tests/uefi-test-tools/Makefile
> +++ b/tests/uefi-test-tools/Makefile
> @@ -12,7 +12,7 @@
>  
>  edk2_dir              := ../../roms/edk2
>  images_dir            := ../data/uefi-boot-images
> -emulation_targets     := arm aarch64 i386 x86_64
> +emulation_targets     := arm aarch64 i386 x86_64 riscv64
>  uefi_binaries         := bios-tables-test
>  intermediate_suffixes := .efi .fat .iso.raw
>  
> @@ -56,7 +56,8 @@ Build/%.iso.raw: Build/%.fat
>  # stripped from, the argument.
>  map_arm_to_uefi     = $(subst arm,ARM,$(1))
>  map_aarch64_to_uefi = $(subst aarch64,AA64,$(call map_arm_to_uefi,$(1)))
> -map_i386_to_uefi    = $(subst i386,IA32,$(call map_aarch64_to_uefi,$(1)))
> +map_riscv64_to_uefi = $(subst riscv64,RISCV64,$(call map_aarch64_to_uefi,$(1)))
> +map_i386_to_uefi    = $(subst i386,IA32,$(call map_riscv64_to_uefi,$(1)))
>  map_x86_64_to_uefi  = $(subst x86_64,X64,$(call map_i386_to_uefi,$(1)))
>  map_to_uefi         = $(subst .,,$(call map_x86_64_to_uefi,$(1)))
>  
> @@ -70,7 +71,7 @@ Build/%.fat: Build/%.efi
>  	uefi_bin_b=$$(stat --format=%s -- $<) && \
>  		uefi_fat_kb=$$(( (uefi_bin_b * 11 / 10 + 1023) / 1024 )) && \
>  		uefi_fat_kb=$$(( uefi_fat_kb >= 64 ? uefi_fat_kb : 64 )) && \
> -		mkdosfs -C $@ -n $(basename $(@F)) -- $$uefi_fat_kb
> +		mkdosfs -C $@ -n "bios-test" -- $$uefi_fat_kb
>  	MTOOLS_SKIP_CHECK=1 mmd -i $@ ::EFI
>  	MTOOLS_SKIP_CHECK=1 mmd -i $@ ::EFI/BOOT
>  	MTOOLS_SKIP_CHECK=1 mcopy -i $@ -- $< \
> @@ -95,15 +96,9 @@ Build/%.fat: Build/%.efi
>  # we must mark the recipe manually as recursive, by using the "+" indicator.
>  # This way, when the inner "make" starts a parallel build of the target edk2
>  # module, it can communicate with the outer "make"'s job server.
> -Build/bios-tables-test.%.efi: build-edk2-tools
> -	+./build.sh $(edk2_dir) BiosTablesTest $* $@
> -
> -build-edk2-tools:
> -	cd $(edk2_dir)/BaseTools && git submodule update --init --force
> -	$(MAKE) -C $(edk2_dir)/BaseTools \
> -		PYTHON_COMMAND=$${EDK2_PYTHON_COMMAND:-python3} \
> -		EXTRA_OPTFLAGS='$(EDK2_BASETOOLS_OPTFLAGS)' \
> -		EXTRA_LDFLAGS='$(EDK2_BASETOOLS_LDFLAGS)'
> +Build/bios-tables-test.%.efi:
> +	$(PYTHON) ../../roms/edk2-build.py --config uefi-test-build.config \
> +		--match $*
>  
>  clean:
>  	rm -rf Build Conf log
> diff --git a/tests/uefi-test-tools/uefi-test-build.config b/tests/uefi-test-tools/uefi-test-build.config
> new file mode 100644
> index 0000000000..1f389ae541
> --- /dev/null
> +++ b/tests/uefi-test-tools/uefi-test-build.config
> @@ -0,0 +1,52 @@
> +[global]
> +core = ../../roms/edk2
> +
> +####################################################################################
> +# arm
> +
> +[build.arm]
> +conf = UefiTestToolsPkg/UefiTestToolsPkg.dsc
> +plat = UefiTestTools
> +dest = ./Build
> +arch = ARM
> +cpy1 = ARM/BiosTablesTest.efi  bios-tables-test.arm.efi
> +
> +####################################################################################
> +# aarch64
> +
> +[build.aarch64]
> +conf = UefiTestToolsPkg/UefiTestToolsPkg.dsc
> +plat = UefiTestTools
> +dest = ./Build
> +arch = AARCH64
> +cpy1 = AARCH64/BiosTablesTest.efi  bios-tables-test.aarch64.efi
> +
> +####################################################################################
> +# riscv64
> +
> +[build.riscv]
> +conf = UefiTestToolsPkg/UefiTestToolsPkg.dsc
> +plat = UefiTestTools
> +dest = ./Build
> +arch = RISCV64
> +cpy1 = RISCV64/BiosTablesTest.efi  bios-tables-test.riscv64.efi
> +
> +####################################################################################
> +# ia32
> +
> +[build.ia32]
> +conf = UefiTestToolsPkg/UefiTestToolsPkg.dsc
> +plat = UefiTestTools
> +dest = ./Build
> +arch = IA32
> +cpy1 = IA32/BiosTablesTest.efi  bios-tables-test.i386.efi
> +
> +####################################################################################
> +# x64
> +
> +[build.x64]
> +conf = UefiTestToolsPkg/UefiTestToolsPkg.dsc
> +plat = UefiTestTools
> +dest = ./Build
> +arch = X64
> +cpy1 = X64/BiosTablesTest.efi  bios-tables-test.x86_64.efi
Re: [PATCH v3 02/15] uefi-test-tools: Add support for python based build script
Posted by Gerd Hoffmann 6 months, 1 week ago
On Fri, Jun 21, 2024 at 05:28:53PM GMT, Sunil V L wrote:
> edk2-funcs.sh which is used in this Makefile, was removed in the commit
> c28a2891f3 ("edk2: update build script"). It is replaced with a python
> based script. So, update the Makefile and add the configuration file as
> required to support the python based build script.
> 
> Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>

Acked-by: Gerd Hoffmann <kraxel@redhat.com>