How uClibc gets kernel sources?

I'm preparing a modified build of OpenWRT using quite old (circa 2016) base, with even older kernel.
Though this shouldn't matter for my question:

I have Linux kernel API headers patched. But when it comes to compiling uClibc, the copy of the kernel included in the uClibc build (ie. linux-dev/include/linux/un.h) does not contain my patches.

I can see that during "Prepare" stage of uClibc build, copy of the kernel is not there yet - so I cannot just patch the copy via toolchain/uClibc/patches-${VERSION} folder.

While looking at toolchain/uClibc/common.mk and other files there, I can't figure out where the kernel sources are being extracted. But after the build fails, I can see the unpatched kernel header in two locations:

./build_dir/toolchain-mips_gcc-4.6-linaro_uClibc-${UCLIBC_VERSION}/linux-${KERNEL_VERSION}/include/linux/un.h
./build_dir/toolchain-mips_gcc-4.6-linaro_uClibc-${UCLIBC_VERSION}/linux-dev/include/linux/un.h

Could you please give me a hint of where to search for kernel sources being re-extracted for uClibc?

Ok, never mind.

Looks like I just had to ask the question directly to easily find an answer.
The Linux kernel headers are prepared within 'toolchain/kernel-headers' package.

Look also at how kernel patches are applied by the build system. At least with current builds, architecture-specific patches reside in target/kernel/<arch>/patches-4.nn/ and, along with the "general" patches, get applied by the build system.

1 Like