From 33bf122c1bc1ee98a98a5459847bf3f6acc1e33d Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 7 Feb 2010 11:55:41 -0800 Subject: [PATCH] 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 --- com32/sysdump/Makefile | 9 +++++++++ com32/sysdump/main.c | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) 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 #include #include +#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); -- 2.7.4