Task #5 - Kernel

cancel
Showing results for 
Search instead for 
Did you mean: 

Task #5 - Kernel

Task #5 - Kernel

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.

Recipe

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.

Kernel

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

Labels (1)
Comments

This is very useful information

I had not appreciated the existence of linux-fslc

I will now be making use of PREFERRED_PROVIDER_virtual/kernel = "linux-fslc"

Thank you for this Yocto training

Not strictly part of the kernel but part of the OS is the init mechanism

To select systemd instead of sysvinit add the following to conf/local.conf

DISTRO_FEATURES_append = “ systemd”

VIRTUAL-RUNTIME_init_manager = “systemd”

Please keep in mind that when you add/modify a kernel module, you also have to cp the modules over to your board in addition to the uImage kernel image. Copy the modules over and run 'depmod' to register them

Guys, you are awesome!

Thanks a lot for your comments

I finally got around to trying PREFERRED_PROVIDER_virtual/kernel = "linux-fslc" on a sabresd board but the resulting sdcard failed to complete its boot and instead stopped at:

Waiting for root device /dev/mmcblk1p2...
mmc1: new high speed SDHC card at address b368
mmcblk0: mmc1:b368 SDC   3.72 GiB
 mmcblk0: p1 p2

The SDHC card seems to be detected at mmcblk0 instead of the required mmcblk1. There is probably something extra that I should have done when I changed to linux-fslc but I do not really understand it. Can you please explain

Have you plugged your SD on SD3 slot? That is the right slot.

Yes I am using SD3 near the HDMI

I have tried a number of things to try to get it working. The only combination that seems to work is to:

  • Additionally specify PREFERRED_PROVIDER_virtual/bootloader = "u-boot-fslc" AND
  • interrupt the boot and type setenv mmcroot=/dev/mmcblk0p2 rootwait rw

I haven´t tested sabrelite for a while now

But it does look like a bug.

Could you, please, submit a bug here:

https://bugzilla.yoctoproject.org/enter_bug.cgi?product=BSPs

It would be perfect if you could test with the newest u-boot-fslc (2013.10) before you report the bug. And please, don´t forget to select meta-fsl-arm

I was trying PREFERRED_PROVIDER_virtual/kernel = "linux-fslc" with meta-fsl-arm dylan core-image-minimal on a sabre-sd board

Do you still think it is a bug or does it work for you so is more likely something I have messed up?

Is mixing linux-fslc with u-boot-imx an unsupported combination?

It seems to work ok on Master so I will raise the bug on Dylan

Sorry for delay.

Do you have the bug number?

Hmm I may have misunderstood my colleague re Master being ok so some of the bug content may not be correct but its number is 5178

Please, make sure the bug is OK, and if it was the case, close it.

We are on final release cycle.

How i can rename the kernel version name?

Example:

rename 3.0.5-imx6-g324g56 to 3.0.5-imx6-my_name

I tried to build the kernel 3.5.7 on Yocto Dora.(using imx6qsabreauto)

I added this code in my conf/local.conf

     PREFERRED_VERSION_linux-imx_mx6 = "3.5.7"

I tried build with fsl-image-gui. There are no build errors.

But... I was met below problem.

.....

mmc0 is current device

reading boot.scr

** Unable to read file boot.scr **

reading uImage

4737768 bytes read in 217 ms (20.8 MiB/s)

Booting from mmc ...

reading imx6q-sabreauto.dtb

43609 bytes read in 19 ms (2.2 MiB/s)

## Booting kernel from Legacy Image at 12000000 ...

   Image Name:   Linux-3.5.7-1.0.0+3285970

   Image Type:   ARM Linux Kernel Image (uncompressed)

   Data Size:    4737704 Bytes = 4.5 MiB

   Load Address: 10008000

   Entry Point:  10008000

   Verifying Checksum ... OK

## Flattened Device Tree blob at 18000000

   Booting using the fdt blob at 0x18000000

   Loading Kernel Image ... OK

OK

   Using Device Tree in place at 18000000, end 1800da58

Starting kernel ...

(hang....)

I think machine id is not match between u-boot and kernel.

So, I used CONFIG_EARLY_PRINTK=y but there are no messages printed by kernel.

(UART number : 3)

I am having the same issue.  I created a separate discussion (3.5.7 Kernel not booting).

Dear all,

I have addedd the fresscale-release-bsp so I can compile the 3.10.17 beta

So I tried to onfig it before to compile it: (taking from above istructions:)

"""""""""""""""""""""""""""""""""

$ 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

""""""""""""""""""""""""""""""""

of course the directory for the 3.10.17 are different so my cp was:

cp tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.10.17-r0/git/.config ../sources/meta-fsl-bsp-release/imx/meta-fsl-arm/recipes-kernel/linux/defconfig

I have some doubt on the destination dir, is it correct?I' not sure because in the recipes-kernel of the meta-fsl.bsp-release i don't have he subir "linux-imx-3.10.17/mx6" or similar,there is just the "recipes-kernel/linux" with the 3.10.17.bb file.... So where have I to put the defconfig file?

Omar

.

oh, I see.

So, please, create the folder and place the defconfig there.

create a folder here http://git.freescale.com/git/cgit.cgi/imx/meta-fsl-bsp-release.git/tree/imx/meta-fsl-arm/recipes-ker...

called linux-imx-3.10.17

I create the folder and i would like to committ the change to meta-fsl-bsp-release.git. Which is the correct email to sent it to?

meta-fsl-bsp-release does not receive patches

at least currently

:smileysad:

ok, i will keep the modification in my local barnch..

Another issue:

I compiled the kernel 3.10.17, my goal was to use it on sabrelite also ,but uboot says

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

file not found /boot/imx6q-sabrelite.dtb

...

... booting kernel from legacy Image at 10800000 ..

    Image name: Linux-3.10.17 ....

    Image type: ..

   ....

Staritng kernel ....

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

then nothing more...

the /boot directory is the one of the rootfs? (so i have to update also the rootfs?)

why he is stucking ? in the menuconfig i activated the legacy AFLAGS.... shoudn't but anyway even if without dtb and dts?

Omar

Omar, are you subscribed to meta-freescale?

https://lists.yoctoproject.org/listinfo/meta-freescale

subscribe yourself and listen to the mailing list for a while.

I'm sure you're going to learn something there and when you fell comfortable you can start contribute to project :smileywink:

Version history
Revision #:
1 of 1
Last update:
‎06-24-2013 09:10 AM
Updated by: