Build all kernel module - ALL_KMODS

I have created firmware for wrtnode1 from the sources. I have installed on my device, configured some packages.

I have now recognised I need other kernel modules as well.
If I make a new firmware with the same SDK and check the newm kernel module in menuconfig, after I succesfull build I can't install it, because the kernel version 3.1.xx-abc, abc is different.

In the future I would like to avoid this thing, and I would like to build all kernel modules. I dont't want to flash it in firmware, I just would like to create ipk s. If I need some module later I can just install the ipk and do not need to recompile the whole firmware.

"ALL_KMODS" can be usefull for this. But how can I use it??

A full build of all kernel modules can be pretty time consuming, not to mention some might not build, or be in conflict with each other. With a clean build (after toolchain is built) taking me 20 minutes or less on a moderate Debian box, I tend to just rebuild. You can also make some guesses about what you might need and select those as modules (<M>)

There is a "build all kernel modules" which I'm about to try for amusement on my 12-core Ryzen 5 box, which normally can build an image with time make -j12 clean download world with my "standard load" plus LuCI in about 4 minutes (ccache enabled).


This, however, does not appear re-select kernel modules that were not previously selected

The sledgehammer of

sed -i -E -e 's/^# (CONFIG_PACKAGE_kmod-[^ ]+) is not set.*$/\1=M/' .config`

(be aware that this will overwrite a symlink to, for example, env/.config, if you are managing config within its own directory)

then running make defconfig to "clean things up" a bit (as the first attempt to build failed) warns me that some can't be modules for some reason

jeff@deb-devel:~/devel/openwrt-tl-wdr4300$ make defconfig
.config:2762:warning: symbol value 'M' invalid for PACKAGE_kmod-cryptodev
.config:2767:warning: symbol value 'M' invalid for PACKAGE_kmod-fs-afs
.config:3187:warning: symbol value 'M' invalid for PACKAGE_kmod-rtc-ds1307
.config:3188:warning: symbol value 'M' invalid for PACKAGE_kmod-rtc-ds1374
.config:3189:warning: symbol value 'M' invalid for PACKAGE_kmod-rtc-ds1672
.config:3190:warning: symbol value 'M' invalid for PACKAGE_kmod-rtc-isl1208
.config:3191:warning: symbol value 'M' invalid for PACKAGE_kmod-rtc-pcf2123
.config:3192:warning: symbol value 'M' invalid for PACKAGE_kmod-rtc-pcf8563
.config:3193:warning: symbol value 'M' invalid for PACKAGE_kmod-rtc-pt7c4338
.config:3194:warning: symbol value 'M' invalid for PACKAGE_kmod-rtc-rs5c372a
# configuration written to .config

:sleeping: -- back in a bit if/when this finishes

It actually wasn't too bad (6 min vs. 4 min) with ccache enabled for the second run -- that's the "magic" of ccache at work. The first run (or likely any kernel-code changes) was another story.

I'd still pick and choose, rather than the sledgehammer approach.

Note that this has some "interesting" side effects, such as apparently compiling kernels that have nothing to do with the target, perhaps because the drivers for certain devices are "hard tied" to those devices -- make[3] -C package/kernel/mt76 compile

As @jeff noted, the CONFIG_ALL_KMODS symbol merely alters the default selection so it only has an effect on a fresh, not yet saved .config since it will not forcibly select previous unselected kmods.

To retroactively enable it, you can use something like this:

sed -i -e '/^# CONFIG_PACKAGE_kmod-/d' .config
echo CONFIG_ALL_KMODS=y >> .config
make defconfig

Don't forget that some kmods are hosted by external feeds, so make sure that all feeds are updated and installed before activating ALL_KMODS.

1 Like