summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-02-07 11:55:41 -0800
committerH. Peter Anvin <hpa@zytor.com>2010-02-07 11:55:41 -0800
commit33bf122c1bc1ee98a98a5459847bf3f6acc1e33d (patch)
tree0294136eb3de339967fe291b1b593c1962555c41
parent7def7a90e13cfb9a25fdb89029c977653a47e04f (diff)
downloadsyslinux-33bf122c1bc1ee98a98a5459847bf3f6acc1e33d.tar.gz
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@zytor.com>
-rw-r--r--com32/sysdump/Makefile9
-rw-r--r--com32/sysdump/main.c7
2 files changed, 15 insertions, 1 deletions
diff --git a/com32/sysdump/Makefile b/com32/sysdump/Makefile
index a64414ad..4ac235a8 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 c231c29e..4c58f5f4 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);