Skip to contentSkip to conversation

roms: omit the git reference to h2

PATCH In review Brian Cain 3 participants 8 messages Nov 18 – Nov 19

lore
Share & tools
lore

Brian Cain

author
#0 lore raw

v2 cover roms: omit the git reference to h2

Using git rev-parse doesn't make any sense for a source tarball distribution.

Switch to the process used by edk2: capture the version in a makefile instead.

v1: https://lore.kernel.org/qemu-devel/[email protected]/

Brian Cain (2):
roms: record the H2 commit in a file
pc-bios: rebuild H2 firmware

 MAINTAINERS                             |   1 +
 pc-bios/README                          |   7 +++----
 pc-bios/hexagon_booter_qcs6490_cdsp     | Bin 285292 -> 285292 bytes
 pc-bios/hexagon_booter_sa8775p_cdsp     | Bin 281224 -> 281224 bytes
 pc-bios/hexagon_booter_sa8797p_nsp0     | Bin 288904 -> 288904 bytes
 pc-bios/hexagon_booter_sc8480xp_nsp0    | Bin 288908 -> 288908 bytes
 pc-bios/hexagon_booter_sm8975_nsp       | Bin 288900 -> 288900 bytes
 pc-bios/hexagon_loadlinux_qcs6490_cdsp  | Bin 200428 -> 200428 bytes
 pc-bios/hexagon_loadlinux_sa8775p_cdsp  | Bin 200456 -> 200456 bytes
 pc-bios/hexagon_loadlinux_sa8797p_nsp0  | Bin 208136 -> 208136 bytes
 pc-bios/hexagon_loadlinux_sc8480xp_nsp0 | Bin 208140 -> 208140 bytes
 pc-bios/hexagon_loadlinux_sm8975_nsp    | Bin 208132 -> 208132 bytes
 roms/Makefile                           |  22 ++++++++++++++++++----
 roms/hexagon-hypervisor-version         |   1 +
 14 files changed, 23 insertions(+), 8 deletions(-)
 create mode 100644 roms/hexagon-hypervisor-version
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v2 1/2 roms: record the H2 commit in a file

The H2 build ID was derived by running git rev-parse, which fails when building from a source tarball. Leaving H2K_GIT_COMMIT as "0x" does not compile.

Instead, keep the commit in a tracked file and always build from it. When the submodule is checked out, fail the H2 build if its HEAD does not match the recorded commit, so a submodule update without a matching update of the file is caught.

---
 MAINTAINERS                     |  1 +
 roms/Makefile                   | 22 ++++++++++++++++++----
 roms/hexagon-hypervisor-version |  1 +
 3 files changed, 20 insertions(+), 4 deletions(-)
 create mode 100644 roms/hexagon-hypervisor-version
MAINTAINERS +1 -0
index 15942aaba3a..c6ed3469779 100644
@@ -1400,6 +1400,7 @@ F: tests/qtest/qcom-dsp-test.c
 F: docs/devel/hexagon-sys.rst
 F: pc-bios/hexagon*
 F: roms/hexagon-hypervisor
+F: roms/hexagon-hypervisor-version
 
 LoongArch Machines
 ------------------
roms/Makefile +18 -4
index bae8f3b766b..bcde6835851 100644
@@ -226,11 +226,25 @@ hexagon_h2_booters := hexagon-booter-qcs6490-cdsp \
 hexagon_h2_loadlinux := hexagon-loadlinux-qcs6490-cdsp \
 	hexagon-loadlinux-sm8975-nsp hexagon-loadlinux-sa8775p-cdsp \
 	hexagon-loadlinux-sc8480xp-nsp0 hexagon-loadlinux-sa8797p-nsp0
+include hexagon-hypervisor-version
+
+.PHONY: hexagon-hypervisor-check
+hexagon-hypervisor-check:
+	@if test -e hexagon-hypervisor/.git; then \
+		h2_head=$$(git -C hexagon-hypervisor rev-parse HEAD); \
+		if test "$$h2_head" != "$(H2K_COMMIT)"; then \
+			echo "hexagon-hypervisor is at $$h2_head, but" \
+				"roms/hexagon-hypervisor-version has" \
+				"$(H2K_COMMIT)" >&2; \
+			exit 1; \
+		fi; \
+	fi
+
 hexagon_h2_common_flags = USE_PKW=0 TARGET=opt NULL_ANGEL_TRAP=1 \
 	HMX_HLX_SUPPORT=1 \
 	H2K_LOAD_ADDR=0x9b800000 H2K_GUEST_START=0xa2000000 \
-	H2K_GIT_COMMIT=0x$(shell git -C hexagon-hypervisor rev-parse --short=8 HEAD) \
-	H2K_GIT_COMMIT_LONG=0x$(shell git -C hexagon-hypervisor rev-parse HEAD) \
+	H2K_GIT_COMMIT=0x$(shell echo $(H2K_COMMIT) | cut -c1-8) \
+	H2K_GIT_COMMIT_LONG=0x$(H2K_COMMIT) \
 	JFLAG=-j$(shell nproc)
 
 .PHONY: hexagon-qcs6490-cdsp hexagon-sm8975-nsp \
@@ -264,7 +278,7 @@ hexagon-loadlinux-sm8975-nsp hexagon-loadlinux-sa8775p-cdsp \
 	hexagon-loadlinux-sc8480xp-nsp0 hexagon-loadlinux-sa8797p-nsp0: \
 	hexagon_h2_linux_flags = LINUX_LINK_ADDR=0xa0000000
 
-$(hexagon_h2_booters): hexagon-booter-%:
+$(hexagon_h2_booters): hexagon-booter-%: hexagon-hypervisor-check
 	rm -rf $(hexagon_h2_out)/booter-$*
 	$(MAKE) -C hexagon-hypervisor $(hexagon_h2_common_flags) \
 		$(hexagon_h2_machine_flags) \
@@ -273,7 +287,7 @@ $(hexagon_h2_booters): hexagon-booter-%:
 		$(hexagon_h2_build)/booter-$*/install/bin/booter
 	chmod -x ../pc-bios/hexagon_booter_$(subst -,_,$*)
 
-$(hexagon_h2_loadlinux): hexagon-loadlinux-%:
+$(hexagon_h2_loadlinux): hexagon-loadlinux-%: hexagon-hypervisor-check
 	rm -rf $(hexagon_h2_out)/loadlinux-$*
 	$(MAKE) -C hexagon-hypervisor $(hexagon_h2_common_flags) \
 		$(hexagon_h2_machine_flags) \
roms/hexagon-hypervisor-version new file +1 -0
new file mode 100644
index 00000000000..4aeabdc7d0e
@@ -0,0 +1 @@
+H2K_COMMIT = 23d5bde4313c1e63ba64dd5d7f542b1055188ef8
Signature · 1 line
2.34.1
Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] roms: record the H2 commit in a file

Quoted 9 lines · Brian Cain

The H2 build ID was derived by running git rev-parse, which fails when building from a source tarball. Leaving H2K_GIT_COMMIT as "0x" does not compile.

Instead, keep the commit in a tracked file and always build from it. When the submodule is checked out, fail the H2 build if its HEAD does not match the recorded commit, so a submodule update without a matching update of the file is caught.

Quoted 8 lines
---
 MAINTAINERS                     |  1 +
 roms/Makefile                   | 22 ++++++++++++++++++----
 roms/hexagon-hypervisor-version |  1 +
 3 files changed, 20 insertions(+), 4 deletions(-)
 create mode 100644 roms/hexagon-hypervisor-version
Reviewed-by on v2 1/2
#3 lore raw

Re: [PATCH v2 1/2] roms: record the H2 commit in a file

In reply to Brian Cain
Quoted 10 lines · Brian Cain

The H2 build ID was derived by running git rev-parse, which fails when building from a source tarball. Leaving H2K_GIT_COMMIT as "0x" does not compile.

Instead, keep the commit in a tracked file and always build from it. When the submodule is checked out, fail the H2 build if its HEAD does not match the recorded commit, so a submodule update without a matching update of the file is caught.

Thank you for the work and the update!

/mjt

Quoted 75 lines
  MAINTAINERS                     |  1 +
  roms/Makefile                   | 22 ++++++++++++++++++----
  roms/hexagon-hypervisor-version |  1 +
  3 files changed, 20 insertions(+), 4 deletions(-)

create mode 100644 roms/hexagon-hypervisor-version

MAINTAINERS +1 -0
index 15942aaba3a..c6ed3469779 100644
@@ -1400,6 +1400,7 @@ F: tests/qtest/qcom-dsp-test.c
  F: docs/devel/hexagon-sys.rst
  F: pc-bios/hexagon*
  F: roms/hexagon-hypervisor
+F: roms/hexagon-hypervisor-version
 
  LoongArch Machines
  ------------------
roms/Makefile +18 -4
index bae8f3b766b..bcde6835851 100644
@@ -226,11 +226,25 @@ hexagon_h2_booters := hexagon-booter-qcs6490-cdsp \
  hexagon_h2_loadlinux := hexagon-loadlinux-qcs6490-cdsp \
  	hexagon-loadlinux-sm8975-nsp hexagon-loadlinux-sa8775p-cdsp \
  	hexagon-loadlinux-sc8480xp-nsp0 hexagon-loadlinux-sa8797p-nsp0
+include hexagon-hypervisor-version
+
+.PHONY: hexagon-hypervisor-check
+hexagon-hypervisor-check:
+	@if test -e hexagon-hypervisor/.git; then \
+		h2_head=$$(git -C hexagon-hypervisor rev-parse HEAD); \
+		if test "$$h2_head" != "$(H2K_COMMIT)"; then \
+			echo "hexagon-hypervisor is at $$h2_head, but" \
+				"roms/hexagon-hypervisor-version has" \
+				"$(H2K_COMMIT)" >&2; \
+			exit 1; \
+		fi; \
+	fi
+
  hexagon_h2_common_flags = USE_PKW=0 TARGET=opt NULL_ANGEL_TRAP=1 \
  	HMX_HLX_SUPPORT=1 \
  	H2K_LOAD_ADDR=0x9b800000 H2K_GUEST_START=0xa2000000 \
-	H2K_GIT_COMMIT=0x$(shell git -C hexagon-hypervisor rev-parse --short=8 HEAD) \
-	H2K_GIT_COMMIT_LONG=0x$(shell git -C hexagon-hypervisor rev-parse HEAD) \
+	H2K_GIT_COMMIT=0x$(shell echo $(H2K_COMMIT) | cut -c1-8) \
+	H2K_GIT_COMMIT_LONG=0x$(H2K_COMMIT) \
  	JFLAG=-j$(shell nproc)
 
  .PHONY: hexagon-qcs6490-cdsp hexagon-sm8975-nsp \
@@ -264,7 +278,7 @@ hexagon-loadlinux-sm8975-nsp hexagon-loadlinux-sa8775p-cdsp \
  	hexagon-loadlinux-sc8480xp-nsp0 hexagon-loadlinux-sa8797p-nsp0: \
  	hexagon_h2_linux_flags = LINUX_LINK_ADDR=0xa0000000
 
-$(hexagon_h2_booters): hexagon-booter-%:
+$(hexagon_h2_booters): hexagon-booter-%: hexagon-hypervisor-check
  	rm -rf $(hexagon_h2_out)/booter-$*
  	$(MAKE) -C hexagon-hypervisor $(hexagon_h2_common_flags) \
  		$(hexagon_h2_machine_flags) \
@@ -273,7 +287,7 @@ $(hexagon_h2_booters): hexagon-booter-%:
  		$(hexagon_h2_build)/booter-$*/install/bin/booter
  	chmod -x ../pc-bios/hexagon_booter_$(subst -,_,$*)
 
-$(hexagon_h2_loadlinux): hexagon-loadlinux-%:
+$(hexagon_h2_loadlinux): hexagon-loadlinux-%: hexagon-hypervisor-check
  	rm -rf $(hexagon_h2_out)/loadlinux-$*
  	$(MAKE) -C hexagon-hypervisor $(hexagon_h2_common_flags) \
  		$(hexagon_h2_machine_flags) \
roms/hexagon-hypervisor-version new file +1 -0
new file mode 100644
index 00000000000..4aeabdc7d0e
@@ -0,0 +1 @@
+H2K_COMMIT = 23d5bde4313c1e63ba64dd5d7f542b1055188ef8
author
#4 lore raw

PATCH v2 2/2 pc-bios: rebuild H2 firmware

In reply to Brian Cain

Rebuild the H2 images with the updated roms/Makefile. The H2 sources and build ID are unchanged.

---
 pc-bios/README                          |   7 +++----
 pc-bios/hexagon_booter_qcs6490_cdsp     | Bin 285292 -> 285292 bytes
 pc-bios/hexagon_booter_sa8775p_cdsp     | Bin 281224 -> 281224 bytes
 pc-bios/hexagon_booter_sa8797p_nsp0     | Bin 288904 -> 288904 bytes
 pc-bios/hexagon_booter_sc8480xp_nsp0    | Bin 288908 -> 288908 bytes
 pc-bios/hexagon_booter_sm8975_nsp       | Bin 288900 -> 288900 bytes
 pc-bios/hexagon_loadlinux_qcs6490_cdsp  | Bin 200428 -> 200428 bytes
 pc-bios/hexagon_loadlinux_sa8775p_cdsp  | Bin 200456 -> 200456 bytes
 pc-bios/hexagon_loadlinux_sa8797p_nsp0  | Bin 208136 -> 208136 bytes
 pc-bios/hexagon_loadlinux_sc8480xp_nsp0 | Bin 208140 -> 208140 bytes
 pc-bios/hexagon_loadlinux_sm8975_nsp    | Bin 208132 -> 208132 bytes
 11 files changed, 3 insertions(+), 4 deletions(-)
pc-bios/README +3 -4
index 661feddf3ac..eea6e28c28c 100644
@@ -3,10 +3,9 @@
 
 - hexagon_booter_<machine> and hexagon_loadlinux_<machine> are the H2
   hypervisor firmware for the Hexagon machines. The sources are at
-  https://gitlab.com/qemu-project/hexagon-hypervisor, built from commit
-  23d5bde4313c1e63ba64dd5d7f542b1055188ef8 with Hexagon SDK 6.7.0.0
-  via "make -C roms hexagon-<machine>".  H2 is distributed under the terms
-  given in "hexagon-hypervisor-license.txt".
+  https://gitlab.com/qemu-project/hexagon-hypervisor
+  built with Hexagon SDK 6.7.0.0 via "make -C roms hexagon-<machine>".
+  H2 is distributed under the terms given in "hexagon-hypervisor-license.txt".
 
 - The VGA BIOS and the Cirrus VGA BIOS come from the LGPL VGA bios
   project (http://www.nongnu.org/vgabios/).
pc-bios/hexagon_booter_qcs6490_cdsp binary +0 -0
index 33d681c31203fa27060c30111882fad89647f4d7..93b13f1ad2b4aa7ddc26bc5c56fc473e41f04d5e 100644
GIT binary patch
pc-bios/hexagon_booter_sa8775p_cdsp binary +0 -0
index 596cdfd51eebf10a05c0537de2ca061075dc206f..d3d4ad3d0b7c85363e5f2127b5105327631552ef 100644
GIT binary patch
pc-bios/hexagon_booter_sa8797p_nsp0 binary +0 -0
index ac248383d482231faff39ec1359c4b51cd071953..90d43551e0e1726ccfbcc4e129170b2a2611dedf 100644
GIT binary patch
pc-bios/hexagon_booter_sc8480xp_nsp0 binary +0 -0
index 7637d3388d972993b7dfddb4082611413f744d74..9e73dcba835781c00cd82d9f7fcf7af0826feeea 100644
GIT binary patch
pc-bios/hexagon_booter_sm8975_nsp binary +0 -0
index ab172f775c76e17526002515f37205a209e42934..e9f42a5c8f60d24925ecc5d304e09b5068942ac6 100644
GIT binary patch
pc-bios/hexagon_loadlinux_qcs6490_cdsp binary +0 -0
index 4f7ab6487f4e040f6708755fb32b35f9ee4fda94..81986e00a3792f1007a283a940cd44e5ad88921d 100644
GIT binary patch
pc-bios/hexagon_loadlinux_sa8775p_cdsp binary +0 -0
index b1e9c5ce7c5ad32665038294bccb0fe2a8b50b7e..3b1939b72f9e53b6b7ec3c6689cc0e9c5124a1dc 100644
GIT binary patch
pc-bios/hexagon_loadlinux_sa8797p_nsp0 binary +0 -0
index c0f8304fb728d8e75877ac95fafce2eb2c667202..0c8ebb44e179b1ac408f80b00889547a67a1b08d 100644
GIT binary patch
pc-bios/hexagon_loadlinux_sc8480xp_nsp0 binary +0 -0
index cf8e9b9abc426fcb33e9479547206c019a8b2e43..ad9080c0e3bf575f6e6c5cc131297371fd8113c2 100644
GIT binary patch
pc-bios/hexagon_loadlinux_sm8975_nsp binary +0 -0
index b0bb2273996507512d4cc42e9f6b953d7ab32fb4..ce16d9f2ee6a833f4e18fe1ccd4bf56fdba6b0e0 100644
GIT binary patch
Signature · 1 line
2.34.1
Reviewed-by on v2 2/2
#5 lore raw

Re: [PATCH v2 2/2] pc-bios: rebuild H2 firmware

Quoted 4 lines · Brian Cain

Rebuild the H2 images with the updated roms/Makefile. The H2 sources and build ID are unchanged.

Quoted 14 lines
---
 pc-bios/README                          |   7 +++----
 pc-bios/hexagon_booter_qcs6490_cdsp     | Bin 285292 -> 285292 bytes
 pc-bios/hexagon_booter_sa8775p_cdsp     | Bin 281224 -> 281224 bytes
 pc-bios/hexagon_booter_sa8797p_nsp0     | Bin 288904 -> 288904 bytes
 pc-bios/hexagon_booter_sc8480xp_nsp0    | Bin 288908 -> 288908 bytes
 pc-bios/hexagon_booter_sm8975_nsp       | Bin 288900 -> 288900 bytes
 pc-bios/hexagon_loadlinux_qcs6490_cdsp  | Bin 200428 -> 200428 bytes
 pc-bios/hexagon_loadlinux_sa8775p_cdsp  | Bin 200456 -> 200456 bytes
 pc-bios/hexagon_loadlinux_sa8797p_nsp0  | Bin 208136 -> 208136 bytes
 pc-bios/hexagon_loadlinux_sc8480xp_nsp0 | Bin 208140 -> 208140 bytes
 pc-bios/hexagon_loadlinux_sm8975_nsp    | Bin 208132 -> 208132 bytes
 11 files changed, 3 insertions(+), 4 deletions(-)
#6 lore raw

Re: [PATCH v2 2/2] pc-bios: rebuild H2 firmware

In reply to Brian Cain
Quoted 2 lines · Brian Cain

Rebuild the H2 images with the updated roms/Makefile. The H2 sources and build ID are unchanged.

Do we really need this second commit when nothing really changed besides the way where we're getting the commit ID?

Not that I'm opposing or something, it just feels unnecessary (the binaries changes that is, not the change to README).

BTW, it looks like the firmware files aren't reproducible too, just like many other firmware files (since a rebuild makes them differ). But it's an entirely different, separate, much larger question than the scope of this change.

Thanks,

/mjt

author
#7 lore raw

Re: [PATCH v2 2/2] pc-bios: rebuild H2 firmware

Quoted 10 lines · Michael Tokarev
Quoted 2 lines · Brian Cain

Rebuild the H2 images with the updated roms/Makefile. The H2 sources and build ID are unchanged.

Do we really need this second commit when nothing really changed besides the way where we're getting the commit ID?

Not that I'm opposing or something, it just feels unnecessary (the binaries changes that is, not the change to README).

It felt appropriate to re-build h2 because the makefile changed - so that there'd be no confusion about the inputs to h2 when it was built.

But if you prefer, we can drop this commit.

Quoted 8 lines

BTW, it looks like the firmware files aren't reproducible too, just like many other firmware files (since a rebuild makes them differ).  But it's an entirely different, separate, much larger question than the scope of this change.

Thanks,

/mjt