[PATCH] Add ELF note with Linux version

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>, <akpm@...>
Cc: Dan Aloni <da-x@...>
Date: Tuesday, September 4, 2007 - 11:00 am

This patch adds version information to the ELF kernel file. Together
with the bzImage version information, this allows distributions to
identify the kernel version based on the file name.


Signed-off-by: Dan Aloni <da-x@monatomic.org>
Signed-off-by: Bernhard Walle <bwalle@suse.de>

---
 include/linux/elfnote.h |    9 +++++++++
 init/version.c          |    3 +++
 2 files changed, 12 insertions(+)

--- a/include/linux/elfnote.h
+++ b/include/linux/elfnote.h
@@ -93,6 +93,15 @@
 
 #define ELFNOTE32(name, type, desc) ELFNOTE(32, name, type, desc)
 #define ELFNOTE64(name, type, desc) ELFNOTE(64, name, type, desc)
+
+#ifdef CONFIG_64BIT
+#define ELFNOTE_C(params...) ELFNOTE64(params)
+#else
+#define ELFNOTE_C(params...) ELFNOTE32(params)
+#endif
+
 #endif	/* __ASSEMBLER__ */
 
+#define LINUX_ELFNOTE_UTS_RELEASE    0
+
 #endif /* _LINUX_ELFNOTE_H */
--- a/init/version.c
+++ b/init/version.c
@@ -11,6 +11,7 @@
 #include <linux/uts.h>
 #include <linux/utsname.h>
 #include <linux/utsrelease.h>
+#include <linux/elfnote.h>
 #include <linux/version.h>
 
 #define version(a) Version_ ## a
@@ -42,3 +43,5 @@ const char linux_proc_banner[] =
 	"%s version %s"
 	" (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"
 	" (" LINUX_COMPILER ") %s\n";
+
+ELFNOTE_C("LINUX", LINUX_ELFNOTE_UTS_RELEASE, UTS_RELEASE);
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Add ELF note with Linux version, Bernhard Walle, (Tue Sep 4, 11:00 am)
Re: [PATCH] Add ELF note with Linux version, Jeremy Fitzhardinge, (Thu Sep 6, 6:36 am)
Re: [PATCH] Add ELF note with Linux version, Andrew Morton, (Thu Sep 13, 5:42 pm)
Re: [PATCH] Add ELF note with Linux version, Sam Ravnborg, (Thu Sep 13, 6:13 pm)
Re: [PATCH] Add ELF note with Linux version, Jeremy Fitzhardinge, (Thu Sep 13, 6:44 pm)
Re: [PATCH] Add ELF note with Linux version, Sam Ravnborg, (Fri Sep 14, 2:08 am)
Re: [PATCH] Add ELF note with Linux version, Jeremy Fitzhardinge, (Fri Sep 14, 3:47 pm)
Re: [PATCH] Add ELF note with Linux version, Sam Ravnborg, (Fri Sep 14, 5:07 pm)
Re: [PATCH] Add ELF note with Linux version, Jeremy Fitzhardinge, (Fri Sep 14, 5:31 pm)
Re: [PATCH] Add ELF note with Linux version, Roland McGrath, (Fri Sep 14, 9:30 pm)
Re: [PATCH] Add ELF note with Linux version, Roland McGrath, (Fri Sep 14, 5:15 pm)
Re: [PATCH] Add ELF note with Linux version, Jeremy Fitzhardinge, (Thu Sep 13, 5:56 pm)
Re: [PATCH] Add ELF note with Linux version, Bernhard Walle, (Fri Sep 14, 3:52 am)
Re: [PATCH] Add ELF note with Linux version, Jeremy Fitzhardinge, (Fri Sep 14, 4:00 pm)