make modules_prepare failing

Tim Harvey tharvey at gateworks.com
Wed Jun 16 12:35:16 PDT 2021


Greetings,

I'm trying to understand how to use the 'modules_prepare' target to
prepare kernel headers on a dev host appropriate for building
out-of-tree modules on a target board. I'm interested in the minimum
headers necessary and have noticed the Ubuntu 'linux-headers-*'
packages are only about 24MiB.

I've looked over
https://www.kernel.org/doc/Documentation/kbuild/modules.txt and it
does not provide an example showing how to build the headers in a
different directory.

$ make O=foo modules_prepare
make[1]: Entering directory '/usr/src/venice/bsp/linux/foo'
***
*** The source tree is not clean, please run 'make mrproper'
*** in /usr/src/venice/bsp/linux
***
/usr/src/venice/bsp/linux/Makefile:512: recipe for target
'outputmakefile' failed
make[1]: *** [outputmakefile] Error 1
make[1]: Leaving directory '/usr/src/venice/bsp/linux/foo'
Makefile:179: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

A 'make mrproper' as suggested just complains that a .config is not
found, but then if there is a .config found it will complain I need to
make mrproper again.

The 'modules_prepare' does work if I don't try to output to a
different directory but then it isn't clear what to package compared
to the entire >1GiB kernel source tree.

I wish https://www.kernel.org/doc/Documentation/kbuild/modules.txt had
an example expalining how a distro packager would create
linux-headers-<foo>. I'm not familiar enough with Ubuntu packaging to
understand how to disect how their packages are created.

Any suggestions?

Best regards,

Tim



More information about the linux-arm-kernel mailing list