[build] Generate random build identifier
Randomly generate a 32-bit build identifier that can be used to identify identical iPXE ROMs when multiple such ROMs are present in a system (e.g. when a multi-function NIC exposes the same iPXE ROM image via each function's expansion ROM BAR). Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
parent
483c3c06ab
commit
58f6e55362
@ -686,13 +686,18 @@ $(BLIB) : $(BLIB_OBJS) $(BLIB_LIST) $(MAKEDEPS)
|
|||||||
$(Q)$(RANLIB) $@
|
$(Q)$(RANLIB) $@
|
||||||
blib : $(BLIB)
|
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 ) );'
|
||||||
|
|
||||||
# Build an intermediate object file from the objects required for the
|
# Build an intermediate object file from the objects required for the
|
||||||
# specified target.
|
# specified target.
|
||||||
#
|
#
|
||||||
$(BIN)/%.tmp : $(BLIB) $(MAKEDEPS) $(LDSCRIPT)
|
$(BIN)/%.tmp : $(BLIB) $(MAKEDEPS) $(LDSCRIPT)
|
||||||
$(QM)$(ECHO) " [LD] $@"
|
$(QM)$(ECHO) " [LD] $@"
|
||||||
$(Q)$(LD) $(LDFLAGS) -T $(LDSCRIPT) $(TGT_LD_FLAGS) $(BLIB) -o $@ \
|
$(Q)$(LD) $(LDFLAGS) -T $(LDSCRIPT) $(TGT_LD_FLAGS) $(BLIB) -o $@ \
|
||||||
-Map $(BIN)/$*.tmp.map
|
--defsym _build_id=`$(BUILD_ID_CMD)` -Map $(BIN)/$*.tmp.map
|
||||||
$(Q)$(OBJDUMP) -ht $@ | $(SORTOBJDUMP) >> $(BIN)/$*.tmp.map
|
$(Q)$(OBJDUMP) -ht $@ | $(SORTOBJDUMP) >> $(BIN)/$*.tmp.map
|
||||||
|
|
||||||
# Keep intermediate object file (useful for debugging)
|
# Keep intermediate object file (useful for debugging)
|
||||||
|
@ -52,6 +52,9 @@ checksum:
|
|||||||
.long 0
|
.long 0
|
||||||
.previous
|
.previous
|
||||||
|
|
||||||
|
build_id:
|
||||||
|
.long _build_id /* Randomly-generated build ID */
|
||||||
|
|
||||||
pciheader:
|
pciheader:
|
||||||
.ascii "PCIR" /* Signature */
|
.ascii "PCIR" /* Signature */
|
||||||
.word pci_vendor_id /* Vendor identification */
|
.word pci_vendor_id /* Vendor identification */
|
||||||
|
Reference in New Issue
Block a user