[OpenWrt-Devel] [PATCH 04/13] include/kernel: add custom USER/DOMAIN config options

Alexander Couzens lynxis at fe80.eu
Mon Jan 25 15:49:26 EST 2016


From: bryan newbold <bnewbold at robocracy.org>

These allow the generated kernel's build metadata to be defined explicitly.
This metadata is reported, eg, at boot time and in `uname -a` on running
systems. If the variables aren't configured, the current build system username
and hostname are used as normal.

The motivation for this option is to achive reproducible (bit-for-bit
identical) kernel builds of official openwrt releases.

Signed-off-by: bryan newbold <bnewbold at robocracy.org>
---
 config/Config-kernel.in    | 16 ++++++++++++++++
 include/kernel-defaults.mk |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/config/Config-kernel.in b/config/Config-kernel.in
index 6e79bae..c93bbde 100644
--- a/config/Config-kernel.in
+++ b/config/Config-kernel.in
@@ -4,6 +4,22 @@
 # See /LICENSE for more information.
 #
 
+config KERNEL_BUILD_USER
+	string "Custom Kernel Build User Name"
+	default ""
+	help
+	  Sets the Kernel build user string, which for example will be returned
+	  by 'uname -a' on running systems.
+	  If not set, uses system user at build time.
+
+config KERNEL_BUILD_DOMAIN
+	string "Custom Kernel Build Domain Name"
+	default ""
+	help
+	  Sets the Kernel build domain string, which for example will be
+	  returned by 'uname -a' on running systems.
+	  If not set, uses system hostname at build time.
+
 config KERNEL_PRINTK
 	bool "Enable support for printk"
 	default y
diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index 052b2b3..63f996a 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -10,6 +10,8 @@ KERNEL_MAKEOPTS := -C $(LINUX_DIR) \
 	CROSS_COMPILE="$(KERNEL_CROSS)" \
 	ARCH="$(LINUX_KARCH)" \
 	KBUILD_HAVE_NLS=no \
+	KBUILD_BUILD_USER="$(CONFIG_KERNEL_BUILD_USER)" \
+	KBUILD_BUILD_HOST="$(CONFIG_KERNEL_BUILD_DOMAIN)" \
 	CONFIG_SHELL="$(BASH)" \
 	$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
 	$(if $(PKG_BUILD_ID),LDFLAGS_MODULE=--build-id=0x$(PKG_BUILD_ID))
-- 
2.7.0
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list