diff options
author | Tushar Behera <tushar.behera@linaro.org> | 2012-09-18 12:07:04 +0530 |
---|---|---|
committer | Tushar Behera <tushar.behera@linaro.org> | 2013-06-19 16:52:47 +0530 |
commit | 21709c30232e1fc679339ae8eec32e0ee39f5854 (patch) | |
tree | 5aef793738655303fb3ce4c5490e21f2c982edb5 | |
parent | 7972c1c463c0f9e6249746dc68ac94c20bffa54b (diff) |
kbuild: Add support to extract information about current git commit HEAD
Many cases it is difficult to get to the exact commit at which the
current kernel is compiled.
Adding an additional print statement to explicitly tell the current
HEAD.
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | include/linux/printk.h | 1 | ||||
-rw-r--r-- | init/main.c | 1 | ||||
-rw-r--r-- | init/version.c | 3 |
4 files changed, 8 insertions, 2 deletions
@@ -799,7 +799,6 @@ include/config/kernel.release: include/config/auto.conf FORCE $(Q)rm -f $@ $(Q)echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" > $@ - # Things we need to do before we recursively start building the kernel # or the modules are listed in "prepare". # A multi level approach is used. prepareN is processed before prepareN-1. @@ -849,7 +848,9 @@ define filechk_utsrelease.h echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \ exit 1; \ fi; \ - (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\";) + (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"; \ + echo \#define KERNEL_GIT_ID \"$(shell \ + git rev-parse --verify --short HEAD 2>/dev/null)\";) endef define filechk_version.h diff --git a/include/linux/printk.h b/include/linux/printk.h index 22c7052e937..b62c7670353 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -8,6 +8,7 @@ extern const char linux_banner[]; extern const char linux_proc_banner[]; +extern const char linux_scm_version_banner[]; static inline int printk_get_level(const char *buffer) { diff --git a/init/main.c b/init/main.c index 9484f4ba88d..7499e43e9b7 100644 --- a/init/main.c +++ b/init/main.c @@ -498,6 +498,7 @@ asmlinkage void __init start_kernel(void) boot_cpu_init(); page_address_init(); pr_notice("%s", linux_banner); + pr_notice("%s", linux_scm_version_banner); setup_arch(&command_line); mm_init_owner(&init_mm, &init_task); mm_init_cpumask(&init_mm); diff --git a/init/version.c b/init/version.c index 1a4718e500f..3978f0298c9 100644 --- a/init/version.c +++ b/init/version.c @@ -48,3 +48,6 @@ const char linux_proc_banner[] = "%s version %s" " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")" " (" LINUX_COMPILER ") %s\n"; + +const char linux_scm_version_banner [] = + "Kernel was built at commit id '" KERNEL_GIT_ID "'\n"; |