mirror of
https://github.com/Fishwaldo/opensbi.git
synced 2025-03-16 03:41:24 +00:00
Include git describe
in OpenSBI
OpenSBI includes a version, but that is only updated when tagged. For users that are using the git releases we instead end up with an ambiguous version number, which makes it hard to figure out what everyone is using. This patch checks for a git directory and prints out the result of `git describe`, which is a mix of pretty and unambiguous. Signed-off-by: Palmer Dabbelt <palmer@sifive.com> Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
parent
75229705a0
commit
a2a7763ac7
2 changed files with 9 additions and 0 deletions
4
Makefile
4
Makefile
|
@ -65,6 +65,7 @@ export firmware_dir=$(CURDIR)/firmware
|
|||
# Find library version
|
||||
OPENSBI_VERSION_MAJOR=`grep "define OPENSBI_VERSION_MAJOR" $(include_dir)/sbi/sbi_version.h | sed 's/.*MAJOR.*\([0-9][0-9]*\)/\1/'`
|
||||
OPENSBI_VERSION_MINOR=`grep "define OPENSBI_VERSION_MINOR" $(include_dir)/sbi/sbi_version.h | sed 's/.*MINOR.*\([0-9][0-9]*\)/\1/'`
|
||||
OPENSBI_VERSION_GIT=$(shell if [ -d $(src_dir)/.git ]; then git describe; fi)
|
||||
|
||||
# Setup compilation commands
|
||||
ifdef CROSS_COMPILE
|
||||
|
@ -151,6 +152,9 @@ endif
|
|||
# Setup compilation commands flags
|
||||
GENFLAGS = -I$(platform_src_dir)/include
|
||||
GENFLAGS += -I$(include_dir)
|
||||
ifneq ($(OPENSBI_VERSION_GIT),)
|
||||
GENFLAGS += -DOPENSBI_VERSION_GIT="\"$(OPENSBI_VERSION_GIT)\""
|
||||
endif
|
||||
GENFLAGS += $(libsbiutils-genflags-y)
|
||||
GENFLAGS += $(platform-genflags-y)
|
||||
GENFLAGS += $(firmware-genflags-y)
|
||||
|
|
|
@ -34,8 +34,13 @@ static void sbi_boot_prints(struct sbi_scratch *scratch, u32 hartid)
|
|||
const struct sbi_platform *plat = sbi_platform_ptr(scratch);
|
||||
|
||||
misa_string(str, sizeof(str));
|
||||
#ifdef OPENSBI_VERSION_GIT
|
||||
sbi_printf("\nOpenSBI %s (%s %s)\n", OPENSBI_VERSION_GIT,
|
||||
__DATE__, __TIME__);
|
||||
#else
|
||||
sbi_printf("\nOpenSBI v%d.%d (%s %s)\n", OPENSBI_VERSION_MAJOR,
|
||||
OPENSBI_VERSION_MINOR, __DATE__, __TIME__);
|
||||
#endif
|
||||
|
||||
sbi_printf(BANNER);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue