Skip to contentSkip to conversation

edk2: get version + date from git submodule

PATCH In review Gerd Hoffmann 2 participants 6 messages Mar 27, 2024 – Apr 9, 2024

lore
Share & tools
lore
#0 lore raw

v2 cover edk2: get version + date from git submodule

v2 changes:
- store version information in git

Gerd Hoffmann (3):
edk2: get version + date from git submodule
edk2: commit version info
edk2/seabios: use common extra version

 roms/Makefile     | 25 ++++++++++++++++++-------
 roms/edk2-version |  2 ++
 2 files changed, 20 insertions(+), 7 deletions(-)
 create mode 100644 roms/edk2-version
Signature · 1 line
2.44.0
#1 lore raw

PATCH v2 1/3 edk2: get version + date from git submodule

Turned out hard-coding version and date in the Makefile wasn't a bright idea. Updating it on edk2 updates is easily forgotten. Fetch the info from git instead. Store in edk2-version, so this can be committed to the repo and is present in tarballs too.

---
 roms/Makefile | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
roms/Makefile +14 -3
index edc234a0e886..783a5cab4f4c 100644
@@ -52,6 +52,8 @@ SEABIOS_EXTRAVERSION="-prebuilt.qemu.org"
 #
 EDK2_EFIROM = edk2/BaseTools/Source/C/bin/EfiRom
 
+-include edk2-version
+
 default help:
 	@echo "nothing is build by default"
 	@echo "available build targets:"
@@ -147,10 +149,19 @@ skiboot:
 	$(MAKE) -C skiboot CROSS=$(powerpc64_cross_prefix)
 	cp skiboot/skiboot.lid ../pc-bios/skiboot.lid
 
-efi:
+edk2-version: edk2
+	if test -e edk2/.git; then \
+		echo "EDK2_STABLE = $$(cd edk2; git describe --tags --match 'edk2-stable*')" > $@; \
+		echo "EDK2_DATE = $$(cd edk2; git log -1 --pretty='format:%cd' --date='format:%m/%d/%Y')" >> $@; \
+	else \
+		touch $@; \
+	fi
+
+efi: edk2-version
 	$(PYTHON) edk2-build.py --config edk2-build.config \
-		--version-override "edk2-stable202302-for-qemu" \
-		--release-date "03/01/2023"
+		--version-override "$(EDK2_STABLE)-for-qemu" \
+		--release-date "$(EDK2_DATE)" \
+		--silent --no-logs
 	rm -f ../pc-bios/edk2-*.fd.bz2
 	bzip2 --verbose ../pc-bios/edk2-*.fd
 
Signature · 1 line
2.44.0
#2 lore raw
Quoted 28 lines · Gerd Hoffmann

Turned out hard-coding version and date in the Makefile wasn't a bright idea. Updating it on edk2 updates is easily forgotten. Fetch the info from git instead. Store in edk2-version, so this can be committed to the repo and is present in tarballs too.

---
 roms/Makefile | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
roms/Makefile +2 -0
index edc234a0e886..783a5cab4f4c 100644
@@ -52,6 +52,8 @@ SEABIOS_EXTRAVERSION="-prebuilt.qemu.org"
 #
 EDK2_EFIROM = edk2/BaseTools/Source/C/bin/EfiRom
 
+-include edk2-version
+
 default help:
        @echo "nothing is build by default"
        @echo "available build targets:"
@@ -147,10 +149,19 @@ skiboot:
        $(MAKE) -C skiboot CROSS=$(powerpc64_cross_prefix)
        cp skiboot/skiboot.lid ../pc-bios/skiboot.lid
 

roms/Makefile skiboot: · line 160

Quoted 10 lines
roms/Makefile +9 -1
-efi:
+edk2-version: edk2
+       if test -e edk2/.git; then \
+               echo "EDK2_STABLE = $$(cd edk2; git describe --tags --match 'edk2-stable*')" > $@; \
+               echo "EDK2_DATE = $$(cd edk2; git log -1 --pretty='format:%cd' --date='format:%m/%d/%Y')" >> $@; \
+       else \
+               touch $@; \
+       fi
+
+efi: edk2-version

Do we actually need this dependency, by the way? I think Make will rebuild edk2-version regardless because it's included (and it would be too late to rebuild it as merely a dependency of 'efi' here).

Quoted 11 lines
roms/Makefile +3 -3
        $(PYTHON) edk2-build.py --config edk2-build.config \
-               --version-override "edk2-stable202302-for-qemu" \
-               --release-date "03/01/2023"
+               --version-override "$(EDK2_STABLE)-for-qemu" \
+               --release-date "$(EDK2_DATE)" \
+               --silent --no-logs
        rm -f ../pc-bios/edk2-*.fd.bz2
        bzip2 --verbose ../pc-bios/edk2-*.fd
 
--

2.44.0

-- PMM

#3 lore raw

PATCH v2 2/3 edk2: commit version info

In reply to Gerd Hoffmann
---
 roms/edk2-version | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 roms/edk2-version
roms/edk2-version new file +2 -0
new file mode 100644
index 000000000000..1594ed8c4de9
@@ -0,0 +1,2 @@
+EDK2_STABLE = edk2-stable202402
+EDK2_DATE = 02/14/2024
Signature · 1 line
2.44.0
#4 lore raw

PATCH v2 3/3 edk2/seabios: use common extra version

In reply to Gerd Hoffmann

Bring a bit more consistency into the naming.

---
 roms/Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
roms/Makefile +5 -5
index 783a5cab4f4c..dfed2b216a1e 100644
@@ -41,8 +41,8 @@ x86_64_cross_prefix := $(call find-cross-prefix,x86_64)
 riscv32_cross_prefix := $(call find-cross-prefix,riscv32)
 riscv64_cross_prefix := $(call find-cross-prefix,riscv64)
 
-# tag our seabios builds
-SEABIOS_EXTRAVERSION="-prebuilt.qemu.org"
+# tag our firmware builds
+FIRMWARE_EXTRAVERSION = -prebuilt.qemu.org
 
 #
 # EfiRom utility is shipped with edk2 / tianocore, in BaseTools/
@@ -93,12 +93,12 @@ build-seabios-config-%: config.%
 	mkdir -p seabios/builds/$*
 	cp $< seabios/builds/$*/.config
 	$(MAKE) -C seabios \
-		EXTRAVERSION=$(SEABIOS_EXTRAVERSION) \
+		EXTRAVERSION=$(FIRMWARE_EXTRAVERSION) \
 		CROSS_PREFIX=$(x86_64_cross_prefix) \
 		KCONFIG_CONFIG=$(CURDIR)/seabios/builds/$*/.config \
 		OUT=$(CURDIR)/seabios/builds/$*/ oldnoconfig
 	$(MAKE) -C seabios \
-		EXTRAVERSION=$(SEABIOS_EXTRAVERSION) \
+		EXTRAVERSION=$(FIRMWARE_EXTRAVERSION) \
 		CROSS_PREFIX=$(x86_64_cross_prefix) \
 		KCONFIG_CONFIG=$(CURDIR)/seabios/builds/$*/.config \
 		OUT=$(CURDIR)/seabios/builds/$*/ all
@@ -159,7 +159,7 @@ edk2-version: edk2
 
 efi: edk2-version
 	$(PYTHON) edk2-build.py --config edk2-build.config \
-		--version-override "$(EDK2_STABLE)-for-qemu" \
+		--version-override "$(EDK2_STABLE)$(FIRMWARE_EXTRAVERSION)" \
 		--release-date "$(EDK2_DATE)" \
 		--silent --no-logs
 	rm -f ../pc-bios/edk2-*.fd.bz2
Signature · 1 line
2.44.0
Reviewed-by on the v2 series
#5 lore raw
In reply to Gerd Hoffmann
Quoted 9 lines · Gerd Hoffmann

v2 changes:
- store version information in git

Gerd Hoffmann (3):
edk2: get version + date from git submodule
edk2: commit version info
edk2/seabios: use common extra version

Quoted 4 lines
 roms/Makefile     | 25 ++++++++++++++++++-------
 roms/edk2-version |  2 ++
 2 files changed, 20 insertions(+), 7 deletions(-)
 create mode 100644 roms/edk2-version

Series

thanks
-- PMM