Build image with official kernel-vermagic without building all kmods

If I would like my custom build to have the same kernel vermagic as the official builld, It seems I have to tick all the kernel modules at least with [M] in order to get the vermagic right. Building all these takes a lot of time and electricity. Is is possible to build the kernel as if all these kernel modules were selected, but without actually building all of them?
If not, could I at least deselect some kernel modules without changing the vermagic?
And if that is the case, is there a faster way to find out the resulting vermagic than make target/linux/compile ? If so, maybe I could write a shell script that finds out which ones can be deselected.

It’s not an iterative process…
see here for guidance:

I know how to build an image with the right vermagic.

I just want to know if one can do this without building all the kernel modules.

I seem to remember that the .vermagic is created at the start of compilation . You can halt compilation and inspect the value…

1 Like

You will only get the right vermagic if the kernel configuration is 101% identical to OpenWrt's, that does involve building all kernel modules (on the vermagic- and the actual ABI level).

1 Like