aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Mendez <mmendez534@gmail.com>2021-01-28 16:45:04 -0500
committerMichael Brown <mcb30@ipxe.org>2021-01-30 18:21:59 +0000
commitd8dc06fbf9c8801c57d8a5423a76963679830207 (patch)
treef1f98b3f5d3aeac2bb8fcbd0296a165b83bc0e29
parentbc4979e2cf375f7d9bf81ccf00bc2679f3dbabc2 (diff)
downloadipxe-d8dc06fbf9c8801c57d8a5423a76963679830207.zip
ipxe-d8dc06fbf9c8801c57d8a5423a76963679830207.tar.gz
ipxe-d8dc06fbf9c8801c57d8a5423a76963679830207.tar.bz2
[build] Replace random build ID with a deterministic one
Calculate the build ID as a checksum over the input files. Since the input files include $(BIN)/version.%.o which itself includes the build target name (from which TGT_LD_FLAGS is calculated), this should be sufficient to meet the requirement that the build ID be unique for each $(BIN)/%.tmp even within the same build run. Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/Makefile.housekeeping8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping
index 81bd3c4..9b52e12 100644
--- a/src/Makefile.housekeeping
+++ b/src/Makefile.housekeeping
@@ -1163,7 +1163,13 @@ blib : $(BLIB)
# Command to generate build ID. Must be unique for each $(BIN)/%.tmp,
# even within the same build run.
#
-BUILD_ID_CMD := perl -e 'printf "0x%08x", int ( rand ( 0xffffffff ) );'
+# The build ID is supposed to be collision-free across all ROMs that
+# might ever end up installed in the same system. It doesn't just
+# disambiguate targets within a single build; it also disambiguates
+# different builds (such as builds for multiple ROMs all built from
+# the same blib.a).
+#
+BUILD_ID_CMD = sha1sum $^ | sort | cksum | awk '{printf "0x%08x", $$1}'
# Build timestamp
#