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

Magnus Kroken mkroken at gmail.com
Sat Feb 18 12:51:08 PST 2017


Hi Mauro

On 18.02.2017 12.49, Mauro Mozzarelli wrote:
> 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
>
> However all I would need is something like LINUX_4 or LINUX_3

At this point, the only supported 3.x kernel is 3.18 (LINUX_3_18), 
everything else is 4.x. With a recent tree, you should be able to depend 
on LINUX_3_18 to select your 3.x configuration, and depend on 
!LINUX_3_18 (not 3.18) to select your 4.x configuration. Unless you need 
this to work with old trees when several 3.x kernels were in the tree, 
this should be sufficient.

If you have to support multiple 3.x kernels, you could list all the 3.x 
patchlevels that have been in tree at some point, as that is a finite 
and known list. Unless you need to support *very* old trees with 2.6 
kernels, that should have you covered.

The OpenWrt wiki refers to symbols named LINUX_3_X, which presumably is 
what you're after, 3.x. I can't find this in the LEDE wiki, and I can't 
figure out where LINUX_* symbols are defined, so I don't know if those 
will still work, but you could try and see what happens.

> Thank you in advance,
>
> Mauro

Regards
/Magnus



More information about the Lede-dev mailing list