I build my openwrt firmware images from source (clone the git repo and build them with make
) (not image-builder).
Ive tried tweaking the kernel config a few times and, well, the way the openwrt build system is set up makes it really hard to get it right. From a good bit of trial and error, Ive figured out 2 ways that at least have a chance of building a kernel that isnt broken, but both sort of suck:
Option 1: start by running make [-j$(nproc) V=sc] prepare_kernel_conf kernel_menuconfig
This doesnt actually show you the kernel's configuration in the kernel menuconfig . menu. I think what is happening here is that you are being shown some generic "base" config, and the specific selections you choose are then recorded and just those selections get layered on top of the "real" kernel config when you build the kernel.
Trying to configure the kernel without knowing the kernel base configuration is error prone and time consuming.
Option 2: build a kernel, steal its .config
, and then reconfigure and rebuild the kernel.
If you run a make [-j$(nproc) V=sc] prepare, the
.configfor the just-built kernel is available at
builddir/target_<GCC_ARCH>/linux-<OPENWRT_ARCH>/linux-<KERNEL_VERSION>/.configIf youi take that and use it to overwrite the file at
targets/<OPENWRT_TARGET>/config-X.Yand then run
make target/____/clean kernel_menuconfig` it will show you the actual kernel configuration.
The problem here is that you fuul it the full kernel .config as input, and so it treats it as if you manually selected every single config option, which breaks ass the automatic co-dependencies between options.
example: if you select option A and option B is automatically pulled in as a dependent option. If you then remove option A, option B get removed as well.
The same happens if you select A (with B automatically pulled in), export to .config, load .config, and then remove A - option B is stil there, because when you loaded the .config you in effect manually selected it (and all the other options)
But, if you select option B manually and then select option A, removing option A doesnt remove option B. Since dependencies are 1 way, you often get "A depends on B, B doesnt explicitly depend on A but will be useless or even actively harmful is A is not also present".
As such, reconfiguring a kernel where it thinks you manually selected every opotion and the automatic dependency system doesnt change the rest of the config as required, it is hard to build a working kernel.
Hence, my question. The diffconfig script basically reduces the .config down to just the options that were explicitly selected (manually or via a config file). loading this reduced "diffconfig" instead of the full .config will only select/deselect options we manually tweaked, which would make it much easier to get a working custom kernel (using "method 2" above).