[LEDE-DEV] Identifying kernel version (major) during build (.mk file)

Alexandru Ardelean ardeleanalex at gmail.com
Sat Feb 18 04:57:52 PST 2017

Hey Mauro,

Your case seems a bit specific.
But I guess you can try a few things and inspire yourself from


Not sure if the KERNEL_BASE variable is what you need.
i.e. I can't tell what the output will be in that case.

But from the looks of it, you can also probably use the split_version
[ + maybe also the firstword ] function[s] to extract the major

On Sat, Feb 18, 2017 at 1:49 PM, Mauro Mozzarelli <openwrt at ezplanet.net> wrote:
> I was wondering someone could help me the following problem:
> I want to add some device drivers to the kernel build, but the kernel
> configuration in kernel version 3 is different from the configuration in
> kernel version 4.
> I was looking for a parameter that I could use inside an .mk file to find
> which kernel version I am building for.
> So far with trial and error (unfortunately I could not find specific
> documentation) I found that I can test reliably a variable that includes
> both kernel version and patchlevel as follows:
> LINUX_4_0||LINUX_4_1||LINUX_4_2||LINUX_4_3||LINUX_4_4||LINUX_4_5
> ... and so on.
> However all I would need is something like LINUX_4 or LINUX_3
> otherwise I would have to list every possible patchlevel (present and future
> to allow the build when patchlevel changes).
> Thank you in advance,
> Mauro
> _______________________________________________
> Lede-dev mailing list
> Lede-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev

More information about the Lede-dev mailing list