Topics

How to select Linux kernel version?


JH
 

Hi,

I replaced Linux kernel version from 4.19 by 5.10 bb file, but it
still built 4.19 zImage, I add PREFERRED_VERSION_linux-yocto = "5.10%"
in local.conf, it still built 4.19 zImage. Where the linux kernel
version is defined in configure files?

Thank you.

Kind regards,

- j


Anuj Mittal
 

On Wed, 2021-01-06 at 17:02 +1100, JH wrote:
Hi,

I replaced Linux kernel version from 4.19 by 5.10 bb file, but it
still built 4.19 zImage, I add PREFERRED_VERSION_linux-yocto =
"5.10%"
in local.conf, it still built 4.19 zImage. Where the linux kernel
version is defined in configure files?
Is the PREFERRED_PROVIDER_virtual/kernel set to linux-yocto? You need
to set the PREFERRED_VERSION for kernel that you are using ...

bitbake -e virtual/kernel output should help see how it's being set and
where.

Thanks,

Anuj


JH
 

Thanks for the response.

Is the PREFERRED_PROVIDER_virtual/kernel set to linux-yocto? You need
to set the PREFERRED_VERSION for kernel that you are using ...
Yes, I tried to set both in local.conif or distro, none of works.

bitbake -e virtual/kernel output should help see how it's being set and
where.
There was no PREFERRED_PROVIDER_virtual/kernel, nor
PREFERRED_VERSION_linux-yocto setup.

Thank you.

Kind regards,

- j


kapllaj.elvis@...
 

It also may be overridden by some conf file. For example, if you are using a i.MX cpus, you may have some conf file on meta-freescale that override this variable with something like: PREFERRED_PROVIDER_virtual/kernel_imx = "some kernel"

I had a situation like this on a imx6 xpu, and had to specify the "_imx" override in order to make it work.

"bitbake - e virtual/kernel | grep PREFERRED_PROVIDER_virtual/kernel" is your friend. 
It will show you the current variable selected, and also the different overrides available.


JH
 

Thanks kapllaj,

It also may be overridden by some conf file. For example, if you are using a
i.MX cpus, you may have some conf file on meta-freescale that override this
variable with something like: PREFERRED_PROVIDER_virtual/kernel_imx = "some
kernel"
It has linux-imx and ${IMX_DEFAULT_KERNEL}, but I could not find what
is defined for ${IMX_DEFAULT_KERNEL}

I defined IMX_DEFAULT_KERNEL = "5.10.%" in local.conf, still download 4.19,

I had a situation like this on a imx6 xpu, and had to specify the "_imx"
override in order to make it work.

"bitbake - e virtual/kernel | grep PREFERRED_PROVIDER_virtual/kernel" is
your friend.
It will show you the current variable selected, and also the different
overrides available.
Yes, I've done many times, there is no decisive definition for it, a
little bit weird.

Did not know it is that hard to just define a kernel version in Yocto ??


Thank you.

Kind regards,

- j


kapllaj.elvis@...
 

Hi, it actually shouldn't be that hard to set the kernel.

IMX_DEFAULT_KERNEL is a variable that sets the kernel name (the recipe) and not the version. I don't know on which yocto version you are working, and also on which CPU.

On meta-freescale, you find this on meta-freescale-distro/conf/distro/include/fsl-base.inc:

# Handle default kernel
IMX_DEFAULT_KERNEL = "linux-imx"
IMX_DEFAULT_KERNEL_mxs = "linux-fslc"
IMX_DEFAULT_KERNEL_mx5 = "linux-fslc"
IMX_DEFAULT_KERNEL_mx6 = "linux-fslc-imx"
IMX_DEFAULT_KERNEL_mx7 = "linux-fslc-imx"
IMX_DEFAULT_KERNEL_mx8 = "linux-imx"
IMX_DEFAULT_KERNEL_mx7ulp = "linux-imx"
IMX_DEFAULT_KERNEL_mx6sll = "linux-imx"
IMX_DEFAULT_KERNEL_mx6ul = "linux-fslc-imx"
IMX_DEFAULT_KERNEL_mx6ull = "linux-fslc-imx"
IMX_DEFAULT_KERNEL_use-mainline-bsp = "linux-fslc"
 
PREFERRED_PROVIDER_virtual/kernel ??= "${IMX_DEFAULT_KERNEL}"

That variable is only used if "PREFERRED_PROVIDER_virtual/kernel" variable was never set (note the ??= assignment). And what this does is: if there was not specified a kernel for this machine, set it to linux-imx (and note that it is also overridden for different cpus!). For example, it selects linux-fslc-imx for imx6 cpu.

Now, go to meta-freescale/recipes-kernel/linux folder, and take a look to see what kernels are available for your machine. Note that the linux-imx kernel provides currently on master branch the 5.4 version!
For you to select the 5.10 (assuming you are on master branch) you should set:

PREFERRED_PROVIDER_virtual/kernel = "linux-fslc"

Yocto will automatically select the highest available version, but if you would also like to fix the version, provide also that information:
PREFERRED_VERSION_linux-fslc = "5.%"


JH
 

Thanks kapllaj.

On meta-freescale, you find this on
meta-freescale-distro/conf/distro/include/fsl-base.inc:
Yes I use imx6ull, I've looked those config files, nothing set to run 4.19.

Now, go to meta-freescale/recipes-kernel/linux folder, and take a look to
see what kernels are available for your machine. Note that the linux-imx
kernel provides currently on master branch the 5.4 version!
For you to select the 5.10 (assuming you are on master branch) you should
set:

PREFERRED_PROVIDER_virtual/kernel = "linux-fslc"
I setup PREFERRED_PROVIDER_virtual/kernel = "linux-yocto", I have to
say, it has been running for a year for 4.19 kernel.

Yocto will automatically select the highest available version, but if you
would also like to fix the version, provide also that information:
PREFERRED_VERSION_linux-fslc = "5.%"
I know iit should automatically select the highest available version 5.10.

I set up following in local.conf:

PREFERRED_PROVIDER_virtual/kernel="linux-yocto"
PREFERRED_VERSION_linux-yocto="5.10.%"

But it was still running 4.19, the question is why didn't the Yocto
ignore the setting?

Thank you.

- j


Quentin Schulz
 

Hi,

On Thu, Jan 07, 2021 at 09:07:58PM +1100, JH wrote:
Thanks kapllaj.

On meta-freescale, you find this on
meta-freescale-distro/conf/distro/include/fsl-base.inc:
Yes I use imx6ull, I've looked those config files, nothing set to run 4.19.

Now, go to meta-freescale/recipes-kernel/linux folder, and take a look to
see what kernels are available for your machine. Note that the linux-imx
kernel provides currently on master branch the 5.4 version!
For you to select the 5.10 (assuming you are on master branch) you should
set:

PREFERRED_PROVIDER_virtual/kernel = "linux-fslc"
I setup PREFERRED_PROVIDER_virtual/kernel = "linux-yocto", I have to
say, it has been running for a year for 4.19 kernel.

Yocto will automatically select the highest available version, but if you
would also like to fix the version, provide also that information:
PREFERRED_VERSION_linux-fslc = "5.%"
I know iit should automatically select the highest available version 5.10.

I set up following in local.conf:

PREFERRED_PROVIDER_virtual/kernel="linux-yocto"
PREFERRED_VERSION_linux-yocto="5.10.%"
So we can stop half guessing and help you can you give us the output of:
bitbake -e virtual/kernel | grep -e "^PREFERRED_PROVIDER_"
bitbake -e virtual/kernel | grep -e "^PREFERRED_VERSION_"
bitbake -e virtual/kernel | grep -e "^OVERRIDES="
bitbake-layers show-recipes linux-yocto linux-fslc

Thanks,
Quentin


JH
 

Thanks Quentin, here are results:

So we can stop half guessing and help you can you give us the output of:
bitbake -e virtual/kernel | grep -e "^PREFERRED_PROVIDER_"
$ bitbake -e virtual/kernel | grep -e "^PREFERRED_PROVIDER_"
PREFERRED_PROVIDER_console-tools="kbd"
PREFERRED_PROVIDER_dbus-glib="dbus-glib"
PREFERRED_PROVIDER_dbus-glib-native="dbus-glib-native"
PREFERRED_PROVIDER_gdb="gdb"
PREFERRED_PROVIDER_gdk-pixbuf="gdk-pixbuf"
PREFERRED_PROVIDER_getopt="util-linux-getopt"
PREFERRED_PROVIDER_gzip-native="pigz-native"
PREFERRED_PROVIDER_libgcc="libgcc"
PREFERRED_PROVIDER_linux-libc-headers="linux-libc-headers"
PREFERRED_PROVIDER_ltp="ltp"
PREFERRED_PROVIDER_matchbox-panel="matchbox-panel-2"
PREFERRED_PROVIDER_nativesdk-libgcc="nativesdk-libgcc"
PREFERRED_PROVIDER_nativesdk-linux-libc-headers="nativesdk-linux-libc-headers"
PREFERRED_PROVIDER_nativesdk-mesa="nativesdk-mesa"
PREFERRED_PROVIDER_nativesdk-openssl="nativesdk-openssl"
PREFERRED_PROVIDER_nativesdk-opkg="nativesdk-opkg"
PREFERRED_PROVIDER_nativesdk-pkgconfig="nativesdk-pkgconfig"
PREFERRED_PROVIDER_openssl="openssl"
PREFERRED_PROVIDER_openssl-native="openssl-native"
PREFERRED_PROVIDER_opkg="opkg"
PREFERRED_PROVIDER_opkg-native="opkg-native"
PREFERRED_PROVIDER_pkgconfig="pkgconfig"
PREFERRED_PROVIDER_pkgconfig-native="pkgconfig-native"
PREFERRED_PROVIDER_udev="systemd"
PREFERRED_PROVIDER_virtual/base-utils="busybox"
PREFERRED_PROVIDER_virtual/egl="mesa"
PREFERRED_PROVIDER_virtual/fakeroot-native="pseudo-native"
PREFERRED_PROVIDER_virtual/gettext="gettext"
PREFERRED_PROVIDER_virtual/i686-oe-linux-binutils="binutils-cross-i686"
PREFERRED_PROVIDER_virtual/i686-oe-linux-compilerlibs="gcc-runtime"
PREFERRED_PROVIDER_virtual/i686-oe-linux-g++="gcc-cross-i686"
PREFERRED_PROVIDER_virtual/i686-oe-linux-gcc="gcc-cross-i686"
PREFERRED_PROVIDER_virtual/kernel="linux-yocto"
PREFERRED_PROVIDER_virtual/libc="glibc"
PREFERRED_PROVIDER_virtual/libc-locale="glibc-locale"
PREFERRED_PROVIDER_virtual/libgl="mesa"
PREFERRED_PROVIDER_virtual/libgl-native="mesa-native"
PREFERRED_PROVIDER_virtual/libgles1="mesa"
PREFERRED_PROVIDER_virtual/libgles2="mesa"
PREFERRED_PROVIDER_virtual/libiconv="glibc"
PREFERRED_PROVIDER_virtual/libintl="glibc"
PREFERRED_PROVIDER_virtual/libx11="libx11"
PREFERRED_PROVIDER_virtual/make="make"
PREFERRED_PROVIDER_virtual/make-native="make-native"
PREFERRED_PROVIDER_virtual/mesa="mesa"
PREFERRED_PROVIDER_virtual/nativesdk-libc="nativesdk-glibc"
PREFERRED_PROVIDER_virtual/nativesdk-libgl="nativesdk-mesa"
PREFERRED_PROVIDER_virtual/nativesdk-libiconv="nativesdk-glibc"
PREFERRED_PROVIDER_virtual/nativesdk-libintl="nativesdk-glibc"
PREFERRED_PROVIDER_virtual/update-alternatives="opkg-utils"
PREFERRED_PROVIDER_virtual/update-alternatives-native="opkg-utils-native"
PREFERRED_PROVIDER_virtual/x86_64-oesdk-linux-binutils-crosssdk="binutils-crosssdk-x86_64-oesdk-linux"
PREFERRED_PROVIDER_virtual/x86_64-oesdk-linux-compilerlibs="nativesdk-gcc-runtime"
PREFERRED_PROVIDER_virtual/x86_64-oesdk-linux-g++="gcc-crosssdk-x86_64-oesdk-linux"
PREFERRED_PROVIDER_virtual/x86_64-oesdk-linux-gcc="gcc-crosssdk-x86_64-oesdk-linux"
PREFERRED_PROVIDER_virtual/xserver="xserver-xorg"
PREFERRED_PROVIDER_virtual/xserver-xf86="xserver-xorg"
PREFERRED_PROVIDER_xf86-video-intel="xf86-video-intel"

bitbake -e virtual/kernel | grep -e "^PREFERRED_VERSION_"
$ bitbake -e virtual/kernel | grep -e "^PREFERRED_VERSION_"
PREFERRED_VERSION_binutils="2.32%"
PREFERRED_VERSION_binutils-cross-canadian-i686="2.32%"
PREFERRED_VERSION_binutils-cross-i686="2.32%"
PREFERRED_VERSION_binutils-crosssdk-x86_64-oesdk-linux="2.32%"
PREFERRED_VERSION_binutils-native="2.32%"
PREFERRED_VERSION_cross-localedef-native="2.30%"
PREFERRED_VERSION_gcc="9.%"
PREFERRED_VERSION_gcc-cross-canadian-i686="9.%"
PREFERRED_VERSION_gcc-cross-i686="9.%"
PREFERRED_VERSION_gcc-cross-initial-i686="9.%"
PREFERRED_VERSION_gcc-crosssdk-initial-x86_64-oesdk-linux="9.%"
PREFERRED_VERSION_gcc-crosssdk-x86_64-oesdk-linux="9.%"
PREFERRED_VERSION_gcc-runtime="9.%"
PREFERRED_VERSION_gcc-sanitizers="9.%"
PREFERRED_VERSION_gdb="8.3%"
PREFERRED_VERSION_gdb-cross-canadian-i686="8.3%"
PREFERRED_VERSION_gdb-cross-i686="8.3%"
PREFERRED_VERSION_glibc="2.30%"
PREFERRED_VERSION_glibc-locale="2.30%"
PREFERRED_VERSION_glibc-mtrace="2.30%"
PREFERRED_VERSION_glibc-scripts="2.30%"
PREFERRED_VERSION_go="1.12%"
PREFERRED_VERSION_go-cross-canadian-i686="1.12%"
PREFERRED_VERSION_go-cross-core2-32="1.12%"
PREFERRED_VERSION_go-crosssdk-x86_64="1.12%"
PREFERRED_VERSION_go-native="1.12%"
PREFERRED_VERSION_go-runtime="1.12%"
PREFERRED_VERSION_libgcc="9.%"
PREFERRED_VERSION_libgcc-initial="9.%"
PREFERRED_VERSION_libgfortran="9.%"
PREFERRED_VERSION_linux-libc-headers="5.2%"
PREFERRED_VERSION_linux-yocto="5.10.%"
PREFERRED_VERSION_llvm="8.0.1"
PREFERRED_VERSION_llvm-native="8.0.1"
PREFERRED_VERSION_nativesdk-gcc="9.%"
PREFERRED_VERSION_nativesdk-gcc-runtime="9.%"
PREFERRED_VERSION_nativesdk-gcc-sanitizers="9.%"
PREFERRED_VERSION_nativesdk-glibc="2.30%"
PREFERRED_VERSION_nativesdk-go="1.12%"
PREFERRED_VERSION_nativesdk-go-runtime="1.12%"
PREFERRED_VERSION_nativesdk-libgcc="9.%"
PREFERRED_VERSION_nativesdk-libgcc-initial="9.%"
PREFERRED_VERSION_nativesdk-linux-libc-headers="5.2%"
PREFERRED_VERSION_nativesdk-llvm="8.0.1"
PREFERRED_VERSION_nativesdk-qemu="4.1%"
PREFERRED_VERSION_qemu="4.1%"
PREFERRED_VERSION_qemu-native="4.1%"
PREFERRED_VERSION_virtual/i686-oe-linux-go="1.12%"
PREFERRED_VERSION_wpa_supplicant="2.6"


bitbake -e virtual/kernel | grep -e "^OVERRIDES="
$ bitbake -e virtual/kernel | grep -e "^OVERRIDES="
OVERRIDES="linux:i686:pn-linux-yocto:x86:qemuall:qemux86:solar-distro:class-target:libc-glibc:forcevariable"

bitbake-layers show-recipes linux-yocto linux-fslc
$ bitbake-layers show-recipes linux-yocto linux-fslc
NOTE: Starting bitbake server...
Loading cache: 100% |############################################| Time: 0:00:00
Loaded 1473 entries from dependency cache.
Parsing recipes: 100% |##########################################| Time: 0:00:02
Parsing of 922 .bb files complete (920 cached, 2 parsed). 1475
targets, 295 skipped, 0 masked, 0 errors.
=== Matching recipes: ===
linux-fslc:
meta-freescale 5.1 (skipped)
linux-yocto:
meta 5.2.28+gitAUTOINC+dd6019025c_992280855e
meta 4.19.87+gitAUTOINC+4f5d761316_b44ad1b1e7

$ cat local.conf
............
PREFERRED_PROVIDER_virtual/kernel="linux-yocto"
PREFERRED_VERSION_linux-yocto = "5.10.%"
.............

Thank you very much.

Kind regards,

- jupiter


Quentin Schulz
 

Hi Jupiter,

On Fri, Jan 08, 2021 at 02:03:47PM +1100, Jupiter wrote:
Thanks Quentin, here are results:

So we can stop half guessing and help you can you give us the output of:
bitbake -e virtual/kernel | grep -e "^PREFERRED_PROVIDER_"
$ bitbake -e virtual/kernel | grep -e "^PREFERRED_PROVIDER_"
[...]
PREFERRED_PROVIDER_virtual/kernel="linux-yocto"
[...]

bitbake -e virtual/kernel | grep -e "^PREFERRED_VERSION_"
$ bitbake -e virtual/kernel | grep -e "^PREFERRED_VERSION_"
PREFERRED_VERSION_linux-libc-headers="5.2%"
PREFERRED_VERSION_linux-yocto="5.10.%"
Not sure this will fly nicely (the kernel headers being older than your
kernel).

Otherwise ok.


bitbake -e virtual/kernel | grep -e "^OVERRIDES="
$ bitbake -e virtual/kernel | grep -e "^OVERRIDES="
OVERRIDES="linux:i686:pn-linux-yocto:x86:qemuall:qemux86:solar-distro:class-target:libc-glibc:forcevariable"

bitbake-layers show-recipes linux-yocto linux-fslc
$ bitbake-layers show-recipes linux-yocto linux-fslc
NOTE: Starting bitbake server...
Loading cache: 100% |############################################| Time: 0:00:00
Loaded 1473 entries from dependency cache.
Parsing recipes: 100% |##########################################| Time: 0:00:02
Parsing of 922 .bb files complete (920 cached, 2 parsed). 1475
targets, 295 skipped, 0 masked, 0 errors.
=== Matching recipes: ===
linux-fslc:
meta-freescale 5.1 (skipped)
linux-yocto:
meta 5.2.28+gitAUTOINC+dd6019025c_992280855e
meta 4.19.87+gitAUTOINC+4f5d761316_b44ad1b1e7
And here we have the winner :)

You don't have a 5.10 linux-yocto recipe so obviously bitbake can't
compile it.

Now, I don't know why 4.19 is taken and not 5.2. I quickly looked into
both recipes and didn't find a DEFAULT_PREFERENCE
(c.f. https://docs.yoctoproject.org/ref-manual/variables.html?highlight=preference#term-DEFAULT_PREFERENCE).

So, can you tell us how you created your 5.10 recipe and where you put
it (the filename, the path in the layer, is it in a new layer? if yes,
did you add it to bblayers.conf? etc...).

Quentin


JH
 

Hi Quentin,

Thanks for your helps, I finally figured out an old Yocto version thud
is able to pick up the latest the kernel version to run 5.10 where the
Zeus could not, there are a couple of bugs in Zeus which I could not
run Zeus in Ubuntu 20.4, it is time for me to upgrade to the latest
Yocto version which hopefully fixes the kernel version issue.

Thank you.

Kind regards,

jupiter


Quentin Schulz
 

Hi Jupiter,

On Sat, Jan 09, 2021 at 09:56:13AM +1100, Jupiter wrote:
Hi Quentin,

Thanks for your helps, I finally figured out an old Yocto version thud
is able to pick up the latest the kernel version to run 5.10 where the
Zeus could not, there are a couple of bugs in Zeus which I could not
run Zeus in Ubuntu 20.4, it is time for me to upgrade to the latest
Yocto version which hopefully fixes the kernel version issue.
This should have nothing to do with a Yocto version, if your recipe is
not found, it's just not found and it is usually a tell that you either
put your recipe in the wrong tree layout or that you forgot to add the
layers to your bblayers.conf.

If both were done correctly and you still have the issue, it is an
important bug to report and investigate, so please share with us the
output of bblayers.conf and the path to your linux-yocto_5.10 recipe.

You could also add:
python __anonymous() {
bb.warning("The recipe is being parsed as expected")
}

If when you run bitbake virtual/kernel you don't see a warning, your
recipe is for sure not parsed and obviously cannot be used by Yocto.

Cheers,
Quentin