diff options
author | Tushar Behera <tushar.behera@linaro.org> | 2012-09-18 12:07:04 +0530 |
---|---|---|
committer | Tushar Behera <tushar.behera@linaro.org> | 2013-05-24 08:36:11 +0530 |
commit | a31b0c50c99cad8517012aee7e847b69f826e3f8 (patch) | |
tree | 993d80a8895c3315d7998bc638db10de0c226023 | |
parent | 8e1ca879776ec0f58aa0ea8b992549eb96eba646 (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
@@ -795,7 +795,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. @@ -845,7 +844,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 812d102b9e2..8d013a9e107 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -6,6 +6,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 2d80a118204..be368a96489 100644 --- a/init/main.c +++ b/init/main.c @@ -497,6 +497,7 @@ asmlinkage void __init start_kernel(void) boot_cpu_init(); page_address_init(); printk(KERN_NOTICE "%s", linux_banner); + printk(KERN_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 58170f18912..9d9f3f9dfb8 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"; |