[syslinux:master] sysdump: record the sysdump version used to generate a bundle

syslinux-bot for H. Peter Anvin hpa at zytor.com
Sun Feb 7 12:00:24 PST 2010


Commit-ID:  33bf122c1bc1ee98a98a5459847bf3f6acc1e33d
Gitweb:     http://syslinux.zytor.com/commit/33bf122c1bc1ee98a98a5459847bf3f6acc1e33d
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Sun, 7 Feb 2010 11:55:41 -0800
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Sun, 7 Feb 2010 11:55:41 -0800

sysdump: record the sysdump version used to generate a bundle

Record the sysdump version used to actually generate a data set.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 com32/sysdump/Makefile |    9 +++++++++
 com32/sysdump/main.c   |    7 ++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/com32/sysdump/Makefile b/com32/sysdump/Makefile
index a64414a..4ac235a 100644
--- a/com32/sysdump/Makefile
+++ b/com32/sysdump/Makefile
@@ -26,6 +26,15 @@ TESTFILES =
 
 OBJS = $(patsubst %.c,%.o,$(wildcard *.c))
 
+# The DATE is set on the make command line when building binaries for
+# official release.  Otherwise, substitute a hex string that is pretty much
+# guaranteed to be unique to be unique from build to build.
+ifndef DATE
+DATE    := $(shell sh ../gen-id.sh $(VERSION) $(HEXDATE))
+endif
+
+CFLAGS    += -DDATE='"$(DATE)"'
+
 all: $(MODULES) $(TESTFILES)
 
 sysdump.elf : $(OBJS) $(LIBS) $(C_LIBS)
diff --git a/com32/sysdump/main.c b/com32/sysdump/main.c
index c231c29..4c58f5f 100644
--- a/com32/sysdump/main.c
+++ b/com32/sysdump/main.c
@@ -19,10 +19,11 @@
 #include <dprintf.h>
 #include <console.h>
 #include <sys/cpu.h>
+#include "../../version.h"
 #include "backend.h"
 #include "sysdump.h"
 
-const char *program = "sysdump";
+const char program[] = "sysdump";
 
 __noreturn die(const char *msg)
 {
@@ -32,8 +33,12 @@ __noreturn die(const char *msg)
 
 static void dump_all(struct backend *be, const char *argv[], size_t len)
 {
+    static const char version[] = "SYSDUMP " VERSION_STR " " DATE "\n";
+
     cpio_init(be, argv, len);
 
+    cpio_writefile(be, "sysdump", version, sizeof version);
+
     dump_memory_map(be);
     dump_memory(be);
     dump_dmi(be);



More information about the Syslinux-commits mailing list