Configuring kernel for LX2160 using Yocto SDK

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Configuring kernel for LX2160 using Yocto SDK

1,870 Views
brian_vajda
Contributor I

Hi-

I'm developing a distro for the LX2160ardb board using the Yocto SDK from NXP (per the thread Are there instructions to build images from Yocto for LX2160A RDB? ).

I need to customize the kernel for this distro. I have attempted to modify the kernel configuration using the the methods in the Yocto documentation. Specifically, I have created a bbappend to supply a defconfig file, as well as creating a cfg (from the bitbake diffconfig command). Neither approach works when starting a kernel build from a clean (bitbake virtual/kernel -c cleanall followed by bitbake virtual/kernel).

The kernel configuration works if I build an image (bitbake fsl-image-networking -> bitbake virtual/kernel -c menuconfig -> bitbake fsl-image-networking). However, I need to have the Yocto build fully automated from first principles, aka. checking out all layers from scratch and doing an image build.

Upon further investigation, the recipe linux-qoriq_4.14.bb or linux-qoriq_4.19.bb in the meta-freescale/recipes-kernel/linux layer seems to intercept the kernel config process. Within these two recipes, there is a function do_merge_delta_config that assembles a defconfig. This task is then inserted into the Yocto task stack via addtask merge_delta_config before do_preconfigure after do_patch.

I still have the need to modify the kernel, however since the freescale layer deviates from the Yocto norm, I don't know the best way to patch my kernel customizations into the build process. Commenting out the addtask line in the recipe works, but again I need to build a distro from a fresh clone of all layers.

What is the recommended approach to modify the kernel configuration when using the freescale layers for the QorIQ?

Thank you-

Brian

0 Kudos
4 Replies

1,708 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Brian Vajda,

Please go to sources/meta-freescale/recipes-kernel/linux,

please create folder linux-qoriq-4.19, then rename your Linux Kernel configuration file as defconfig_cus and put it in this folder.

Please define linux-qoriq_4.19.bbappend file the content is as the following.

SRC_URI += "file://defconfig_cus \
"

do_configure_append() {

cp ${WORKDIR}/defconfig_cus  ${WORKDIR}/build/.config
}

Then rebuild Linux Kernel

$bitbake virtual/kernel -c cleansstate

$bitbake virtual/kernel

Thanks,

Yiping

0 Kudos

1,708 Views
brian_vajda
Contributor I

Thank you Yiping.

Is there any way to configure the kernel from my custom layer? We are building several Yocto distros for different QorIQ boards, and each project share the common layers (meta-openembedded, meta-freescale, etc.), so putting project specific files in a shared layer is problematic.

Thanks-

Brian

0 Kudos

1,708 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Brian,

Please refer to the following.

In sources folder create meta-custom folder, 

Define file meta-custom/conf/layer.conf as the following.

BBPATH .= ":${LAYERDIR}"
BBFILE_COLLECTIONS += "custom-layer"
LAYERSERIES_COMPAT_custom-layer = "warrior zeus"
BBFILE_PATTERN_custom-layer := "^${LAYERDIR}/"

BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"

Define meta-custom/recipes-kernel/linux/linux-qoriq_4.19.bbappend as the following.

SRC_URI += "file://defconfig_cus \
"

do_configure_append() {

cp ${WORKDIR}/defconfig_cus ${WORKDIR}/build/.config
}

Please put defconfig_cus in <yocto_install>/downloads/ folder.

In file build_<platform>/conf/bblayers.conf, please add layer meta-custom.

BBLAYERS ?= " \
/home/yiping/yocto-sdk/sources/poky/meta \
/home/yiping/yocto-sdk/sources/poky/meta-poky \
/home/yiping/yocto-sdk/sources/poky/meta-yocto-bsp \
/home/yiping/yocto-sdk/sources/meta-openembedded/meta-oe \
/home/yiping/yocto-sdk/sources/meta-openembedded/meta-multimedia \
/home/yiping/yocto-sdk/sources/meta-openembedded/meta-python \
/home/yiping/yocto-sdk/sources/meta-openembedded/meta-networking \
/home/yiping/yocto-sdk/sources/meta-openembedded/meta-gnome \
/home/yiping/yocto-sdk/sources/meta-openembedded/meta-filesystems \
/home/yiping/yocto-sdk/sources/meta-openembedded/meta-webserver \
/home/yiping/yocto-sdk/sources/meta-openembedded/meta-perl \
/home/yiping/yocto-sdk/sources/meta-virtualization \
/home/yiping/yocto-sdk/sources/meta-cloud-services \
/home/yiping/yocto-sdk/sources/meta-security \
/home/yiping/yocto-sdk/sources/meta-selinux \
/home/yiping/yocto-sdk/sources/meta-freescale \
/home/yiping/yocto-sdk/sources/meta-freescale-distro \
/home/yiping/yocto-sdk/sources/meta-qoriq-demos \
/home/yiping/yocto-sdk/sources/meta-custom \
"

Then run command

$ source build_t2080rdb/SOURCE_THIS

$ bitbake virtual/kernel -c cleansstate

bitbake virtual/kernel

Thanks,

Yiping

0 Kudos

1,708 Views
brian_vajda
Contributor I

Thanks Yiping, that worked.

For future reference, I modified the recipe slightly to use a defconfig in the same directory as the recipe by using:

FILESEXTRAPATHS_prepend := "${THISDIR}:"

0 Kudos