Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kernel selection using yocto

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?

like image 582
Ravi A Avatar asked May 02 '17 06:05

Ravi A


People also ask

Where is kernel source in Yocto?

Each release of the Yocto Project provides a few Linux kernel recipes from which you can choose. These are located in the Source Directory in meta/recipes-kernel/linux . Modifying an existing recipe can consist of the following: Creating the append file.

What is Yocto kernel?

The Yocto Project also provides a powerful set of kernel tools for managing Linux kernel sources and configuration data. You can use these tools to make a single configuration change, apply multiple patches, or work with your own kernel sources.


4 Answers

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.

like image 134
Anders Avatar answered Oct 12 '22 00:10

Anders


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.

like image 41
Abhishek Dwivedi Avatar answered Oct 12 '22 02:10

Abhishek Dwivedi


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.

like image 42
yoctotutor.com Avatar answered Oct 12 '22 01:10

yoctotutor.com


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

PREFERRED_VERSION_linux-imx = "3.14%"
like image 2
Praveen Muthusamy Avatar answered Oct 12 '22 01:10

Praveen Muthusamy