Commit fb3225df authored by Adam Wujek's avatar Adam Wujek 💬

revision: add build_by

Use git config --get-all user.name as an build author, if not available use
user@hostname.
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 8f88197c
......@@ -110,6 +110,12 @@ OUTPUT-$(CONFIG_WR_SWITCH) = rt_cpu
OUTPUT := $(OUTPUT-y)
GIT_VER = $(shell git describe --always --dirty | sed 's;^wr-switch-sw-;;')
GIT_USR = $(shell git config --get-all user.name)
# if user.name is not available from git use user@hostname
ifeq ($(GIT_USR),)
GIT_USR = $(shell whoami)@$(shell hostname)
endif
all: tools $(OUTPUT).elf $(arch-files-y)
......@@ -140,7 +146,7 @@ sdb-lib/libsdbfs.a:
$(MAKE) -C sdb-lib
$(OUTPUT).elf: $(LDS-y) $(AUTOCONF) gitmodules $(OUTPUT).o config.o
$(CC) $(CFLAGS) -D__GIT_VER__="\"$(GIT_VER)\"" -c revision.c
$(CC) $(CFLAGS) -D__GIT_VER__="\"$(GIT_VER)\"" -D__GIT_USR__="\"$(GIT_USR)\"" -c revision.c
${CC} -o $@ revision.o config.o $(OUTPUT).o $(LDFLAGS)
${OBJDUMP} -d $(OUTPUT).elf > $(OUTPUT)_disasm.S
$(SIZE) $@
......
......@@ -4,5 +4,6 @@
extern const char *build_revision;
extern const char *build_date;
extern const char *build_time;
extern const char *build_by;
#endif /* __REVISION_H__ */
......@@ -13,6 +13,7 @@ const char *build_revision = stats.commit_id;
const char *build_date = stats.build_date;
const char *build_time = stats.build_time;
const char *build_by = stats.build_by;
/*
* We export softpll internal status to the ARM cpu, for SNMP. Thus,
* we place this structure at a known address in the linker script
......@@ -22,9 +23,12 @@ struct spll_stats stats __attribute__((section(".stats"))) = {
.ver = SPLL_STATS_VER,
#ifdef CONFIG_DETERMINISTIC_BINARY
.build_date = "",
.build_time = "",
.build_by = "",
#else
.build_date = __DATE__,
.build_time = __TIME__,
.build_by = __GIT_USR__,
#endif
.commit_id = __GIT_VER__,
};
......@@ -18,12 +18,23 @@
#define SUPPORT ""
#endif
#ifdef CONFIG_DETERMINISTIC_BINARY
#define DETERMINISTIC_BINARY 1
#else
#define DETERMINISTIC_BINARY 0
#endif
static int cmd_ver(const char *args[])
{
int hwram = sysc_get_memsize();
pp_printf("WR Core build: %s%s\n", build_revision, SUPPORT);
pp_printf("Built: %s %s\n", build_date, build_time); /* may be empty */
/* may be empty if build with CONFIG_DETERMINISTIC_BINARY */
if (DETERMINISTIC_BINARY)
pp_printf("Deterministic binary build\n");
else
pp_printf("Built: %s %s by %s\n", build_date, build_time,
build_by);
pp_printf("Built for %d kB RAM, stack is %d bytes\n",
CONFIG_RAMSIZE / 1024, CONFIG_STACKSIZE);
/* hardware reports memory size, with a 16kB granularity */
......
......@@ -57,7 +57,7 @@
#define ALIGN_STATE_WAIT_CLKIN 9
#define ALIGN_STATE_WAIT_PLOCK 10
#define SPLL_STATS_VER 2
#define SPLL_STATS_VER 3
/* info reported through .stat section */
/* due to endiannes problem strings has to be 4 bytes alligned */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment