There is a new developer option to switch on CONFIG_MODVERSIONS for the
kernel. In that case, we need to build vmlinux as well, when compiling
modules.

vmlinux is removed only once per make run now, that should suffice to
prevent modules from picking up files from an earlier run.

The ubox kernel module handling facilities can not cope with CONFIG_MODVERSIONS,
but the busybox module handling can, so this is option really is only for
developer who know what they are doing


Signed-off-by: Nils Rennebarth <nils.renneba...@bintec-elmeg.com>
---
 config/Config-devel.in     | 8 ++++++++
 include/kernel-build.mk    | 3 ++-
 include/kernel-defaults.mk | 5 +++--
 3 files changed, 13 insertions(+), 3 deletions(-)



--
Nils Rennebarth
Software developer

bintec elmeg security GmbH

Mönchhaldenstraße 28
D-70191 Stuttgart
Germany

Tel: +49-711-900600-64
Email: nils.renneba...@bintec-elmeg.com
www: www.bintec-elmeg.com

Location: Nuremberg, Local Court Nuremberg, HRB 25481<br>
Managing Director: Bernd Büttner

--------------------------------
The information contained in this e-mail has been carefully researched,
but the possibility of it being inapplicable in individual cases cannot
be ruled out. We therefore regret that we cannot accept responsibility
or liability of any kind whatsoever for the correctness of the
information given. Please notify us if you discover that information is
inapplicable.
diff --git a/config/Config-devel.in b/config/Config-devel.in
index 5e5c857..5aaa810 100644
--- a/config/Config-devel.in
+++ b/config/Config-devel.in
@@ -53,6 +53,14 @@ menuconfig DEVEL
 		string "Use external kernel tree" if DEVEL
 		default ""
 
+	config KERNEL_MODVERSIONS
+		bool "Use versioned symbols in the kernel" if DEVEL
+		default n
+		help
+		  Build the kernel with version information for each exported
+		  symbol. See LINUX_DIR/init/Kconfig, section MODVERSIONS for
+		  more information.
+
 	config KERNEL_GIT_CLONE_URI
 		string "Enter git repository to clone" if DEVEL
 		default ""
diff --git a/include/kernel-build.mk b/include/kernel-build.mk
index 27c7aee..16d1fe1 100644
--- a/include/kernel-build.mk
+++ b/include/kernel-build.mk
@@ -103,6 +103,7 @@ define BuildKernel
 	touch $$@
 
   $(LINUX_DIR)/.modules: $(STAMP_CONFIGURED) $(LINUX_DIR)/.config FORCE
+	rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map
 	$(Kernel/CompileModules)
 	touch $$@
 
@@ -110,7 +111,7 @@ define BuildKernel
 	$(Kernel/CompileImage)
 	$(Kernel/CollectDebug)
 	touch $$@
-	
+
   mostlyclean: FORCE
 	$(Kernel/Clean)
 
diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index 114c017..224e3de 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -106,11 +106,13 @@ define Kernel/Configure/Default
 	rm -rf $(KERNEL_BUILD_DIR)/modules
 	[ -d $(LINUX_DIR)/user_headers ] || $(MAKE) $(KERNEL_MAKEOPTS) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install
 	$(SH_FUNC) grep '=[ym]' $(LINUX_DIR)/.config | LC_ALL=C sort | md5s > $(LINUX_DIR)/.vermagic
+ifndef CONFIG_KERNEL_MODVERSIONS
 	if grep -q "^CONFIG_MODVERSIONS=y" $(LINUX_DIR)/.config; then \
 		printf "\nERROR: Module versioning not supported for openwrt kernels\n" ; \
 		printf "Please change your kernel config so that CONFIG_MODVERSIONS is not set\n\n" ; \
 		exit 1; \
 	fi
+endif
 endef
 
 define Kernel/Configure/Initramfs
@@ -118,8 +120,7 @@ define Kernel/Configure/Initramfs
 endef
 
 define Kernel/CompileModules/Default
-	rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map
-	+$(MAKE) $(KERNEL_MAKEOPTS) modules
+	+$(MAKE) $(KERNEL_MAKEOPTS) $(if $(CONFIG_KERNEL_MODVERSIONS),vmlinux,) modules
 endef
 
 OBJCOPY_STRIP = -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to