Incomplete Module.symvers file in some SDKs

Sebastian Kemper sebastian_ml at
Mon Apr 12 15:18:59 BST 2021

On Mon, Apr 12, 2021 at 01:37:59PM +0200, Sebastian Kemper wrote:
> What set this off was commit 5ed1e5140a80558ab47fd70410ae3242bed5becf
> ("build: build kernel image before building modules/packages"). Before
> this commit the make target would always include "modules", resulting in
> a MODPOST and a complete Module.symvers file. Since this commit a
> MODPOST of the kernel modules is not guaranteed, which may result in a
> broken SDK.
> I think that the first line that the commit changed was probably enough.
> Adding "modules" back to the other two lines will probably fix this
> problem without causing any headache. Probably a comment should be added
> to make people aware that "modules" is there for a reason.

I tried this:

diff --git a/include/ b/include/
index 4b0b136a03..1b3b4497a2 100644
--- a/include/
+++ b/include/
@@ -147,12 +147,17 @@ define Kernel/CopyImage

+# Always add "modules" so a proper Module.symvers file is written that
+# also contains symbols from the kernel modules. Without these symbols
+# external packages that depend on exported symbols from kernel modules
+# will fail to build.
 define Kernel/CompileImage/Default
        rm -f $(TARGET_DIR)/init
        $(call Kernel/CopyImage)

+# Here as well, always add "modules", see comment above.
 define Kernel/CompileImage/Initramfs
        $(call Kernel/Configure/Initramfs)
@@ -173,7 +178,7 @@ endif
        $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),$(STAGING_DIR_HOST)/bin/zstd -T0 -f -o $(KERNEL_BUILD_DIR)/initrd.cpio.zstd $(KERNEL_BUILD_DIR)/initrd.cpio)
        $(call Kernel/CopyImage,-initramfs)

With this change a "make -j2 V=s" resulted in a proper Module.symvers file.

Kind regards,

> I checked openwrt-21.02, but the commit in question was not applied
> there, so 21.02 is fine.
> Any thoughts?
> Kind regards,
> Sebastian

More information about the openwrt-devel mailing list