Commit 60642d037b for qemu.org
commit 60642d037b2ae838eac138cc6716cc7459238bee
Author: Brian Cain <brian.cain@oss.qualcomm.com>
Date: Wed Nov 18 09:14:09 2026 -0800
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.
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
diff --git a/MAINTAINERS b/MAINTAINERS
index 3a9b4d34a0..40bf63651c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -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
------------------
diff --git a/roms/Makefile b/roms/Makefile
index bae8f3b766..bcde683585 100644
--- a/roms/Makefile
+++ b/roms/Makefile
@@ -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) \
diff --git a/roms/hexagon-hypervisor-version b/roms/hexagon-hypervisor-version
new file mode 100644
index 0000000000..4aeabdc7d0
--- /dev/null
+++ b/roms/hexagon-hypervisor-version
@@ -0,0 +1 @@
+H2K_COMMIT = 23d5bde4313c1e63ba64dd5d7f542b1055188ef8