aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTushar Behera <tushar.behera@linaro.org>2012-09-18 12:07:04 +0530
committerAndrey Konovalov <andrey.konovalov@linaro.org>2014-04-16 23:51:22 +0400
commitcea4cc6187995634796bc5bdb6c3717c602432ec (patch)
tree274517f343195cafec38d38697a800d340c7a575
parentdf7453654e3be7edce66697577a4f59be7b801ab (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--Makefile5
-rw-r--r--include/linux/printk.h1
-rw-r--r--init/main.c1
-rw-r--r--init/version.c3
4 files changed, 8 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index a1b5ee4f280..2c22f15f35c 100644
--- a/Makefile
+++ b/Makefile
@@ -879,7 +879,6 @@ endef
include/config/kernel.release: include/config/auto.conf FORCE
$(call filechk,kernel.release)
-
# 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.
@@ -929,7 +928,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 fa47e2708c0..4d106e9b7ee 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -9,6 +9,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 9c7fd4c9249..0b47584836a 100644
--- a/init/main.c
+++ b/init/main.c
@@ -506,6 +506,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";