Changing the Kernel configuration for i.MX6 SABRE

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Changing the Kernel configuration for i.MX6 SABRE

跳至解决方案
44,135 次查看
chrishossack
Contributor III

Hi

I’m trying to change the default Kernel to include PCIe, but I’ve been having real problems trying to change the configuration used to build the kernel.

I can build a default kernel using the following steps (I’m using branch imx-3.10.53-1.1.0_ga)

$ mkdir fsl-release-bsp

$ cd fsl-release-bsp

$ repo init -u git://git.freescale.com/imx/fsl-arm-yocto-bsp.git -b imx-3.10.53-1.1.0_ga

$ repo sync

$ MACHINE=imx6qsabresd source fsl-setup-release.sh -b build-x11 -e x11

$ bitbake core-image-base

This image works fine. I can power up my Sabre platform.

But I now want to change the Kernel configuration to include PCIe, but it seems that the documented way (see “Task #5 - Kernel - The complete step by step to change the kernel configuration”) doesn’t work for me. Here are the steps from the document.

$ 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

But I don’t have the correct paths for the “cp” command. My .config file is actually located in

./tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.10.53-r0/git/.config

So I would expect to find a matching folder in ../sources, but I don’t have a “../sources/meta-fsl-arm/recipes-kernel/linux/linux-imx-3.0.35” directory ;-(

The only directories I have at this level are

linux-fslc          linux-imx-2.6.35.3     linux-imx.inc                 linux-imx-rt_3.10.17.bb

linux-fslc_3.14.bb  linux-imx_2.6.35.3.bb  linux-imx-mfgtool-3.10.17     linux-mfgtool.inc

linux-fslc.inc      linux-imx-3.10.17      linux-imx-mfgtool_3.10.17.bb  linux-timesys-3.0.15

linux-imx           linux-imx_3.10.17.bb   linux-imx-rt-3.10.17          linux-timesys_3.0.15.bb

And I think (by looking at each sub-directory) that…

  • Linux-imx-2.6.35.3 is used for mx5, imx23evk, imx28evk
  • Linux-imx-3.10.17 is used for imx6

So I’ve tried copying .config to linux-imx-3.10.17/imx/defconfig and created new directories for linux-imx-3.10.53/imx/defconfig. Then I run

$ bitbake -c cleansstate linux-imx

$ bitbake linux-imx

Then I program my SD card and try to power up and test my PCIe changes. But while it does boot up, none of my Kernel changes are present. I test this by using lspci and also the following command

$ cat /proc/config.gz | gunzip | grep –i pci

I’ve looked at other pages and it seems that I’m not the only one having problems, eg

https://community.freescale.com/thread/360368

https://community.freescale.com/thread/372003

https://community.freescale.com/message/563729#563729

https://community.freescale.com/docs/DOC-95045

https://community.freescale.com/docs/DOC-100847

The only way I found to change my Kernel that works is to run the following commands in this particular order.

$ bitbake linux-imx -c cleansstate
$ bitbake linux-imx -c menuconfig

(change anything)

$ bitbake linux-imx

  • The cleansstate removes …/3.10.53-r0/git/.config (and a lot of others files).
  • Then menuconfig populates …/3.10.53-r0/git before running the terminal to allow changes.
  • The build process picks up the changed …/3.10.53-r0/git/.config and builds the Kernel.

While this system works I realize that I’m changing a file in the ./tmp directory, so it will be lost when I clean my build. I guess the advantage of copying it to the ../source directory is that I could then have my own git branch and keep track of my changes.

So I would like to know what exactly my “copy” command should be, eg

$ cp tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.10.53-r0/git/.config

<what should this be???>

Any help on changing the Kernel configurations correctly would be greatly appreciated.

Cheers

Chris

标签 (3)
1 解答
17,442 次查看
chrishossack
Contributor III

Hi,

So after bashing my head against a brick wall for weeks I’ve finally found a way to apply my .cfg file in my own layer. I’m not sure it’s the correct way, but it seems to work. Please let me know if there is a better way of doing it.

So repeating my initial steps I create an image based branch imx-3.10.53-1.1.0_ga.

$ mkdir fsl-release-bsp-3-10-53

$ cd fsl-release-bsp-3-10-53

$ repo init -u git://git.freescale.com/imx/fsl-arm-yocto-bsp.git -b imx-3.10.53-1.1.0_ga

$ repo sync

$ MACHINE=imx6qsabresd source fsl-setup-release.sh -b build-x11 -e x11

$ bitbake core-image-base

This image works fine. I can power up my Sabre platform. I now create my new layer called meta-fsl-pci

$ cd ../sources

$ yocto-layer create fsl-pci

Please enter the layer priority you'd like to use for the layer: [default: 6]

Would you like to have an example recipe created? (y/n) [default: n]

Would you like to have an example bbappend file created? (y/n) [default: n]

New layer created in meta-fsl-pci.

Don't forget to add it to your BBLAYERS (for details see meta-fsl-pci\README).

$ cd ../build-x11

I then update ./conf/bblayers.conf with my new layer.

BBLAYERS += " ${BSPDIR}/sources/meta-fsl-bsp-release/imx/meta-fsl-demos "

BBLAYERS += " ${BSPDIR}/sources/meta-fsl-pci "

BBLAYERS += " ${BSPDIR}/sources/meta-browser "

I verify this bit has worked by using the following command

$ bitbake-layers show-layers

layer                 path                                      priority

==========================================================================

meta                  /mnt/data/imx6/fsl-release-bsp-3-10-53/sources/poky/meta  5

meta-yocto            /mnt/data/imx6/fsl-release-bsp-3-10-53/sources/poky/meta-yocto  5

meta-oe               /mnt/data/imx6/fsl-release-bsp-3-10-53/sources/meta-openembedded/meta-oe  6

meta-fsl-arm          /mnt/data/imx6/fsl-release-bsp-3-10-53/sources/meta-fsl-arm  5

meta-fsl-arm-extra    /mnt/data/imx6/fsl-release-bsp-3-10-53/sources/meta-fsl-arm-extra  4

meta-fsl-demos        /mnt/data/imx6/fsl-release-bsp-3-10-53/sources/meta-fsl-demos  4

meta-fsl-arm          /mnt/data/imx6/fsl-release-bsp-3-10-53/sources/meta-fsl-bsp-release/imx/meta-fsl-arm  0

meta-fsl-demos        /mnt/data/imx6/fsl-release-bsp-3-10-53/sources/meta-fsl-bsp-release/imx/meta-fsl-demos  0

meta-fsl-pci          /mnt/data/imx6/fsl-release-bsp-3-10-53/sources/meta-fsl-pci  6 <-- Here's my layer

meta-browser          /mnt/data/imx6/fsl-release-bsp-3-10-53/sources/meta-browser  7

meta-gnome            /mnt/data/imx6/fsl-release-bsp-3-10-53/sources/meta-openembedded/meta-gnome  7

meta-networking       /mnt/data/imx6/fsl-release-bsp-3-10-53/sources/meta-openembedded/meta-networking  5

meta-ruby             /mnt/data/imx6/fsl-release-bsp-3-10-53/sources/meta-openembedded/meta-ruby  7

meta-qt5              /mnt/data/imx6/fsl-release-bsp-3-10-53/sources/meta-qt5  7

meta-fsl-qt5          /mnt/data/imx6/fsl-release-bsp-3-10-53/sources/meta-fsl-bsp-release/imx/meta-fsl-qt5  0

meta-fsl-bluez        /mnt/data/imx6/fsl-release-bsp-3-10-53/sources/meta-fsl-bsp-release/imx/meta-fsl-bluez  8

I now create a layer directory structure to support my PCI modifications to the kernel:

$ mkdir -p ../sources/meta-fsl-pci/recipes-kernel/linux/linux-imx

I now create my pci.cfg file.

$ bitbake linux-imx -c cleansstate

$ bitbake linux-imx -c menuconfig

<enable pci configurations>

$ bitbake linux-imx -c diffconfig

Config fragment has been dumped into:

/mnt/data/imx6/fsl-release-bsp-3-10-53/build-x11/tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.10.53-r0/fragment.cfg

NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be rerun and all succeeded.

Then copy to pci.cfg

cp /mnt/data/imx6/fsl-release-bsp-3-10-53/build-x11/tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.10.53-r0/fragment.cfg ../sources/meta-fsl-pci/recipes-kernel/linux/linux-imx/pci.cfg

I need to create a bbappend file that matches the following .bb file, eg

ls ../sources/meta-fsl-bsp-release/imx/meta-fsl-arm/recipes-kernel/linux/linux-imx_3.10.53.bb

I now create my bbappend file

vi ../sources/meta-fsl-pci/recipes-kernel/linux/linux-imx_3.10.53.bbappend

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

SRC_URI += "file://pci.cfg"

do_configure_append() {

        #this is run from

        #./tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.10.53-r0/git

        cat ../*.cfg >> ${B}/.config

}

I then clean and rebuild

bitbake linux-imx -c cleansstate

bitbake core-image-base -c cleansstate

bitbake core-image-base

And my PCI configurations is now in my kernel ;-)

The trick to this solution is the do_configure_append() function which is called after the .config and .defconfig is copied across from imx_v7_defconfig in the following file

../sources/meta-fsl-bsp-release/imx/meta-fsl-arm/recipes-kernel/linux/linux-imx_3.10.53.bb

do_configure_prepend() {

   # copy latest defconfig for imx_v7_defoonfig to use

   cp ${S}/arch/arm/configs/imx_v7_defconfig ${S}/.config

   cp ${S}/arch/arm/configs/imx_v7_defconfig ${S}/../defconfig

}

I think Yocto does use my pci.cfg to generate .config, but the above lines then splats over this file. So I then concatenate any *.cfg files to the end of the splatted .config, and it seems to work. But I’m not proud of this hack ;-(

Note: The order of the configuration options in the .config file are important. The later ones in the file overrides any previous values.

Cheers

Chris

PS unless anybody can give me a better answer than this I'll mark this as the correct answer next week.

在原帖中查看解决方案

30 回复数
1,825 次查看
chrishossack
Contributor III

hi Saurabh,

thank you for your answer. I thought I had to create a .cfg file which then updates the deconfig (which seems to be copied from imx_v7_defconfig as describe in linux-imx_3.10.53.bb), which is then used to generate .config with my changes.

Originally I created a linux-imx_3.10.17.bbappend (see previous comment) but nothing happened. I have found that if I rename this to linux-imx_3.10.53 my pci.cfg is copied to the work directory (next to the defconfig ((copied from imx_v7_defconfig)) but still the .config are missing my changes ;-(

So should I be using a mydefconfig or a .cfg? and what is the difference?

thank you

Chris

0 项奖励
回复
1,825 次查看
chrishossack
Contributor III

hi,

so by changing the name of

../sources/meta-fsl-pci/recipes-kernel/linux/linux-imx_3.10.17.bbappend

to

../sources/meta-fsl-pci/recipes-kernel/linux/linux-imx_3.10.53.bbappend

which reflects the actual kernel I'm building, I now see my pci.cfg file here next to a defconfig

./tmp/work/imx6sabresd-poky-linux-gnueabi/linux-imx/3.10.53-ro/pci.cfg

But my changes are still missing from (after running cleansstate and menuconfig)

./tmp/work/imx6sabresd-poky-linux-gnueabi/linux-imx/3.10.53-ro/git/.config

So after some more searching I found the following link which suggests the .cfg is broken for freescale imx.Kernel config fragments are not applied

Bruce Ashfield suggests a work around and a fix for Yocto 1.7. I've tried the suggestion, eg

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

inherit kernel

COMPATIBLE_MACHINE = "(mx6)"

SRC_URI += "file://pci.cfg"

SRCREV_machine = "${SRCREV}"

but that didn't work either, and I'm already using Fido 1.8

The links are a bit old so I'm hoping I'm still doing something silly. Does anybody have an answer?

cheers

Chris

0 项奖励
回复
1,827 次查看
gusarambula
NXP TechSupport
NXP TechSupport

Hello Chris Hossack,

You are not alone on this, as you pointed out, in part because Yocto is more a means of distribution of customized images (like BSPs) than a development tool. Yocto does not have a way to track changes on the source code so I would recommend downloading the kernel source code and working there building with the toolchain manually and once the necessary changes are ready writing a recipe that will apply these changes.

That being said I have also been unable to find the source for 3.10.53 inside the recipes-kernel folder. I’ll look for more information on what could be the reason for that.

0 项奖励
回复
1,827 次查看
chrishossack
Contributor III

hi,

thank you for your reply. At the moment I'm just looking at evaluating the imx6 platform and I just need to prove I can build my PCI drivers on the target ( Building a Kernel driver on imx6 sabre target.​ ) and run some hardware correctly. But I guess I will have to read how to create my own recipes. I just wanted to know what I was missing when I followed the above method from the documentation.

cheers

Chris

0 项奖励
回复
1,827 次查看
saurabh206
Senior Contributor III

Hi Chris

You can use Yocto BSP setup for Rootfs, kernel and u-boot generation.

You can build kernel and u-boot separately using meta-toolchail

linux-2.6-imx.git - Freescale i.MX Linux Tree

You can download the kernel from above like, build the kernel manually and update the zImage or uImage.

Once the all modification is completed you can generate patches and use these patched with yocto recipe.

Thanks

Saurabh

0 项奖励
回复
1,825 次查看
maxmustermann
Contributor I

If you want some *robust* tool, which is also good for development, go for ptxdist.

Anyways, why are you using such an ancient kernel ?

0 项奖励
回复
1,825 次查看
chrishossack
Contributor III

Hi,

we're using the fsl layers that contain the device trees, drivers, tweaks, for the sabre platform. I'm not an expect on Kernels, so I'm just using the code freescale have tested with their boards. It's a bit of a cop out, but I don't think changing the kernel will solve my bitbake issues ;-(

cheers

Chris

0 项奖励
回复
1,827 次查看
chrishossack
Contributor III

hi Sarurabh,

that sounds easy.. once you have done it a couple of times ;-)

But for a first time newbie are there any step by step instructions on how to do all of that?

I can find snippets for different bits of this process, but rather than bashing my head against a wall for the next couple of days it would be really nice for somebody who knows what they are doing to generate a newbie guide.

cheers

Chris

0 项奖励
回复
1,827 次查看
saurabh206
Senior Contributor III
0 项奖励
回复
1,827 次查看
chrishossack
Contributor III

hi Saurabh,

thank you. This looks very interesting. I will read this and give it a go. I'll get back to you next week.

cheers

Chris

0 项奖励
回复