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.