From 3bbb92772813c7a955d210f0e82ebdedd3183cec Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 30 Oct 2015 15:20:12 +0000 Subject: build: Allow kernel modules to set build ID debug symbol MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change adds support for specifying a build ID for kernel modules. This is done by setting PKG_BUILD_ID to a hexadecimal string, which will then be passed to the kernel linker. In addition, when this flag is set, the build ID debug symbol (.note.gnu.build-id) will not be stripped from the kernel module. This symbol is exported in sysfs by the kernel (if the kernel is compiled with CONFIG_KALLSYMS) and so can be used to uniquely identify a version of a kernel module in a running kernel. This is useful for keeping track of different versions of a module when doing experiments and development. Modules that specify the build ID will be ~100 bytes larger (depending on the length of the build ID specified). There is no size difference for kernel modules that do not set this variable. Signed-off-by: Toke Høiland-Jørgensen SVN-Revision: 47290 --- include/kernel-defaults.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk index 24d26308b1..d37787a44b 100644 --- a/include/kernel-defaults.mk +++ b/include/kernel-defaults.mk @@ -11,7 +11,8 @@ KERNEL_MAKEOPTS := -C $(LINUX_DIR) \ ARCH="$(LINUX_KARCH)" \ KBUILD_HAVE_NLS=no \ CONFIG_SHELL="$(BASH)" \ - $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') + $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \ + $(if $(PKG_BUILD_ID),LDFLAGS_MODULE=--build-id=0x$(PKG_BUILD_ID)) ifdef CONFIG_STRIP_KERNEL_EXPORTS KERNEL_MAKEOPTS += \ -- cgit v1.2.3