7

I am building images for i.MX board using Yocto. My requirement is to build specific kernel for the board.

After downloading from Freescale Yocto repository site, I could see recipes for multiple kernels.

Can you guide me to understand how yocto will decide which kernel to build. I mean where Yocto configured to build specific kernel out of the available kernel recipes?

abunickabhi
  • 558
  • 2
  • 9
  • 31
Ravi A
  • 421
  • 2
  • 9
  • 21
  • Does this answer your question? [How to specify which kernel to build with bitbake/yocto](https://stackoverflow.com/questions/26761635/how-to-specify-which-kernel-to-build-with-bitbake-yocto) – Dharma B Jul 26 '22 at 09:13

4 Answers4

10

Select which kernel to build in your machine configuration, see BSP manual and for example stackoverflow question

Basically, for selecting kernel you can add

PREFERRED_PROVIDER_virtual/kernel = "my-kernel-recipe"

To your mymachine.conf.

Saeed Masoomi
  • 1,703
  • 1
  • 19
  • 33
Anders
  • 8,541
  • 1
  • 27
  • 34
4

You should have or create kernel bb layer for having kernel source.

Once you have kernel source, add following in your local.conf file.

PREFERRED_PROVIDER_virtual/kernel ?= "<bb_layer_name>"
PREFERRED_VERSION_<bb_layer_name> ?= "<version>"

E.g.

mkdir -p meta-imx/recipes-kernel/linux/linux-imx_4.11.bb

add whatever you want in bb file.

vi build/local.conf

# kernel preference    
PREFERRED_PROVIDER_virtual/kernel ?= "linux-imx"
PREFERRED_VERSION_linux-imx ?= "4.11%"

Once you are good with it you can merge build/local.conf to your target such as local.conf.sample or what ever name you have given.

Abhishek Dwivedi
  • 6,557
  • 3
  • 15
  • 20
2

Add preferred kernel version in build/conf/local.conf file

PREFERRED_VERSION_linux-imx = "3.14%"
1

Go to your meta-layer/conf/machine then open your selected-machine.conf file in and there you will find the macro variable

PREFERRED_PROVIDER_virtual/kernel

PREFERRED_VERSION_<bb_layer_name> ?= "<version>"

the meta-layer developers written the default kernel & version here. If.

yoctotutor.com
  • 5,145
  • 4
  • 26
  • 36