Skip to content

Instantly share code, notes, and snippets.

@masami256
Created February 11, 2017 14:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masami256/06ec4bc2008c7bb0daf1b57de8a48d8c to your computer and use it in GitHub Desktop.
Save masami256/06ec4bc2008c7bb0daf1b57de8a48d8c to your computer and use it in GitHub Desktop.
codename patch
diff --git a/Makefile b/Makefile
index 8e223e0..9f4bd0c 100644
--- a/Makefile
+++ b/Makefile
@@ -1024,6 +1024,7 @@ endif
prepare2: prepare3 prepare-compiler-check outputmakefile asm-generic
prepare1: prepare2 $(version_h) include/generated/utsrelease.h \
+ include/generated/utscodename.h \
include/config/auto.conf
$(cmd_crmodverdir)
@@ -1097,6 +1098,10 @@ define filechk_version.h
echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';)
endef
+define filechk_utscodename.h
+ (echo \#define UTS_CODENAME \"$(NAME)\";)
+endef
+
$(version_h): $(srctree)/Makefile FORCE
$(call filechk,version.h)
$(Q)rm -f $(old_version_h)
@@ -1104,6 +1109,9 @@ $(version_h): $(srctree)/Makefile FORCE
include/generated/utsrelease.h: include/config/kernel.release FORCE
$(call filechk,utsrelease.h)
+include/generated/utscodename.h: $(srctree)/Makefile FORCE
+ $(call filechk,utscodename.h)
+
PHONY += headerdep
headerdep:
$(Q)find $(srctree)/include/ -name '*.h' | xargs --max-args 1 \
diff --git a/init/version.c b/init/version.c
index fe41a63..82fde8f 100644
--- a/init/version.c
+++ b/init/version.c
@@ -11,6 +11,7 @@
#include <linux/uts.h>
#include <linux/utsname.h>
#include <generated/utsrelease.h>
+#include <generated/utscodename.h>
#include <linux/version.h>
#include <linux/proc_ns.h>
@@ -45,7 +46,7 @@ EXPORT_SYMBOL_GPL(init_uts_ns);
/* FIXED STRINGS! Don't touch! */
const char linux_banner[] =
"Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
- LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
+ LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION UTS_CODENAME "\n";
const char linux_proc_banner[] =
"%s version %s"
diff --git a/kernel/utsname_sysctl.c b/kernel/utsname_sysctl.c
index c8eac43..8f3c12a 100644
--- a/kernel/utsname_sysctl.c
+++ b/kernel/utsname_sysctl.c
@@ -14,6 +14,7 @@
#include <linux/utsname.h>
#include <linux/sysctl.h>
#include <linux/wait.h>
+#include <generated/utscodename.h>
#ifdef CONFIG_PROC_SYSCTL
@@ -104,6 +105,13 @@ static struct ctl_table uts_kern_table[] = {
.proc_handler = proc_do_uts_string,
.poll = &domainname_poll,
},
+ {
+ .procname = "codename",
+ .data = UTS_CODENAME,
+ .maxlen = sizeof(UTS_CODENAME),
+ .mode = 0444,
+ .proc_handler = proc_do_uts_string,
+ },
{}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment