Task #5 - Kernel

Document created by Daiane Angolini Employee on Jun 24, 2013Last modified by Daiane Angolini Employee on Jun 5, 2014
Version 4Show Document
  • View in full screen mode

You already know. Your source code is one week old now, so please, update it (or should I say 'sync' it?)! Get used to update your BSP layers.



Is the name of file that determinates how a package should act. For example, the version, where it is the mainstream repo, how to build, install, link. etc.



For meta-fsl-arm the kernel recipes are under meta-fsl-arm/recipes-kernel/linux (take a look here meta-fsl-arm - Layer containing Freescale ARM hardware support metadata)



For meta-fsl-arm, there are 3 kernel recipes:


linux-fslc_3.8.bb  --> kernel mainline (from kernel.org)

linux-imx_2.6.35.3.bb  --> kernel from FSL, for imx5x and imx28

linux-imx_3.0.35.bb --> kernel from FSL for imx6


Take the linux-imx for imx6 as an example meta-fsl-arm - Layer containing Freescale ARM hardware support metadata

The recipe determinates:


  • what´s the compatible machine for this linux version (mx6)
  • what´s the commit ID for the head of this code (SRCREV) (MX6DL and MX6SL have different source code)
  • what´s the patches for the mx6 boards (SRC_URI).



In order to see where the source code is cloned from, you need to go to .inc file meta-fsl-arm - Layer containing Freescale ARM hardware support metadata


SRC_URI = "git://git.freescale.com/imx/linux-2.6-imx.git \

           file://defconfig \


it´s from git.freescale.com. In addition, there is a defconfig file added on SRC_URI.


There is a defconfig file for every board, on every Linux revision. Some defconfigs are shared for more than one board (for example, every mx6 board), and some Linux version are not compatible for some boards (for example, imx53 is only compatible with 2.6.35).


During a bitbake linux-imx, a temp folder will be created under build/tmp/armv7-imx6....../linux-imx, with code from git, patches and defconfig. Then bitbake takes that defconfig and configure the kernel, built it, and deploy it.


So, in order to change the kernel configuration (make menuconfig) you must replace your defconfig file from meta-fsl-arm/recipes-kernel/linux/linux-imx-3.0.35/mx6


How to change kernel configuration



Create the new defconfig

Copy it to meta-fsl-arm/recipes-kernel/linux/linux-imx-3.0.35/mx6 (or the right folder for your board/kernel)

$ bitbake -c cleansstate linux-imx

$ bitbake linux-imx (if you want only the kernel image)

$ bitbake fsl-image-gui (if you want to generate a complete image using the new kernel)



How to make menuconfig with yocto


$ bitbake -c menuconfig linux-imx


will generate a config file on tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.0.35-r33.10/git/.config



The complete step by step to change the kernel configuration



$ bitbake -c menuconfig linux-imx

(change anything)

$ cp tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.0.35-r33.10/git/.config ../sources/meta-fsl-arm/recipes-kernel/linux/linux-imx-3.0.35/mx6/defconfig

$ bitbake -c cleansstate linux-imx

$ bitbake fsl-image-gui


The uImage will be under tmp/deploy/image


In order to replace only uImage binary into one ready sdcard:


$sudo cp tmp/deploy/image/uImage-imx6-XXX.bin /media/user/Boot imx6/uImage


Kernel Mainline - kernel.org


In order to use kernel mainline instead of linux-imx. Please add the following code to your conf/local.conf


PREFERRED_PROVIDER_virtual/kernel = "linux-fslc"


Make sure the desired board is supported by kernel.org.



In order to take and build kernel mainline manually, please see https://community.freescale.com/docs/DOC-95017


Final points


It´s not a simple task, I know. Yocto is not the best tool for use to develop and customize kernel during development stage. It is easier to use an external toolchain (bitbake meta-toolchain). Once the kernel development, or customization, is done, the changes can be integrated in the Yocto so it is managed for production use.


I like to have a copy of kernel source code cloned on my machine directly from git.freescale.com, then I can re-configure it, rebuild it, apply some patches, make changes, and build it manually - any way I want it. So, I only change kernel using yocto when I know the bug and I know how to fix it, and I have the patch. (and this is the way I like to work)


Although this is how to configure (and even patch) kernel (if you want to patch kernel, follow the example in the recipes)


If you face any error, please, let me know. I tested the steps and it worked, but I´m using an Ubuntu machine, not a virtual machine (and I´m not sure how -c menuconfig will act in a virtual machine).




Go to Yocto Training - HOME

Go to Task #4 - Deploy and test