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 we'll keep the commit in a tracked file, regenerate it when it's
a submodule.

Signed-off-by: Brian Cain <[email protected]>
---
 MAINTAINERS                     |  1 +
 roms/Makefile                   | 13 +++++++++++--
 roms/hexagon-hypervisor-version |  1 +
 3 files changed, 13 insertions(+), 2 deletions(-)
 create mode 100644 roms/hexagon-hypervisor-version

diff --git a/MAINTAINERS b/MAINTAINERS
index fa0c6d0c9bc..df264c30753 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1399,6 +1399,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 bae8f3b766b..2cbab2d1993 100644
--- a/roms/Makefile
+++ b/roms/Makefile
@@ -226,11 +226,20 @@ 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
+
+hexagon-hypervisor-version: hexagon-hypervisor
+       if test -e hexagon-hypervisor/.git; then \
+               echo "H2K_COMMIT = $$(git -C hexagon-hypervisor rev-parse 
HEAD)" > $@; \
+       else \
+               touch $@; \
+       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 \
diff --git a/roms/hexagon-hypervisor-version b/roms/hexagon-hypervisor-version
new file mode 100644
index 00000000000..4aeabdc7d0e
--- /dev/null
+++ b/roms/hexagon-hypervisor-version
@@ -0,0 +1 @@
+H2K_COMMIT = 23d5bde4313c1e63ba64dd5d7f542b1055188ef8
-- 
2.34.1

Reply via email to