Incomplete Module.symvers file in some SDKs

Sebastian Kemper sebastian_ml at gmx.net
Mon Apr 12 12:37:59 BST 2021


Hi all,

Some SDKs have a Module.symvers file in
build_dir/target-*/linux-*/linux-5.4.*/ that is missing exported symbols
from kernel modules:

openwrt-sdk-mpc85xx-p1010_gcc-8.4.0_musl.Linux-x86_64
openwrt-sdk-apm821xx-nand_gcc-8.4.0_musl.Linux-x86_64
openwrt-sdk-kirkwood_gcc-8.4.0_musl_eabi.Linux-x86_64
openwrt-sdk-oxnas-ox820_gcc-8.4.0_musl_eabi.Linux-x86_64
openwrt-sdk-mvebu-cortexa9_gcc-8.4.0_musl_eabi.Linux-x86_64
openwrt-sdk-mediatek-mt7629_gcc-8.4.0_musl_eabi.Linux-x86_64
openwrt-sdk-armvirt-32_gcc-8.4.0_musl_eabi.Linux-x86_64
openwrt-sdk-armvirt-64_gcc-8.4.0_musl.Linux-x86_64

Any external kernel module package that depends on any exported symbol
from a linux kernel module will fail to build in these SDKs. For
instance the dahdi-linux package depends on symbols from the kernel's
"echo" module fails:

<snip>
ERROR: "oslec_create" [/builder/shared-workdir/build/sdk/build_dir/target-arm_mpcore_musl_eabi/linux-oxnas_ox820/dahdi-linux-3.1.0/drivers/dahdi/dahdi_echocan_oslec.ko] undefined!
ERROR: "oslec_free" [/builder/shared-workdir/build/sdk/build_dir/target-arm_mpcore_musl_eabi/linux-oxnas_ox820/dahdi-linux-3.1.0/drivers/dahdi/dahdi_echocan_oslec.ko] undefined!
<snip>

This problem is visible on the build bots (some packages are failing to
build) as well as in the CIs used for the external feeds (Github Actions).

The reason for the incomplete Module.symvers file is that when either
Kernel/CompileImage/Default or Kernel/CompileImage/Initramfs (see
include/kernel-defaults.mk) is called and KERNELNAME is given, the make
target may be of the sort which does not prompt the Linux kernel to
MODPOST the modules. For instance when building the
openwrt-sdk-ath79-generic_gcc-8.4.0_musl.Linux-x86_64 sdk KERNELNAME is
not set and the resulting call is this one:

make -C /home/sk/tmp/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/linux-5.4.109 <snip> all

This is visible in the output:
MODPOST 59 modules

The Module.symvers file is complete.

Using the openwrt-sdk-apm821xx-nand_gcc-8.4.0_musl.Linux-x86_64 sdk on
the other hand results in this call (KERNELNAME is uImage).

make -C /home/sk/tmp/openwrt/build_dir/target-powerpc_464fp_musl/linux-apm821xx_nand/linux-5.4.98 <snip> uImage

No MODPOST occurs for the Linux kernel modules. The resulting
Module.symvers file is incomplete.

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 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