Modifying U-Boot Kconfig with configuration fragments and Yocto on the MCIMX6UL-EVKB evaluation board

MCIMX6UL-EVKB is a i.MX 6UltraLite Evaluation Kit.

It uses the NXP i.MX 6ULL (900 MHz Arm Cortex®-A7 core, MCIMX6Y2DVM09AB).

Instructions based on the porting guide – https://www.nxp.com/docs/en/user-guide/IMX_PORTING_GUIDE.pdf

Your eval board boots, but it hangs during the “starting linux kernel” message. You can’t debug the Linux kernel because it hasn’t loaded yet. So the next option is to debug the preceding U-Boot bootloader. This article explains how to configure a Yocto layer to modify the Uboot Kconfig settings (without hacking about in the tmp/work directory!)

As a simple example we will increase the auto boot delay – CONFIG_BOOTDELAY – from 3 seconds to 7 seconds.

Install Yocto

See section 4, “Yocto Project Setup”, here –
https://www.nxp.com/docs/en/user-guide/IMX_YOCTO_PROJECT_USERS_GUIDE.pdf

Build image-core-minimal for MACHINE= imx6ull14x14evk and DISTRO= fsl-imx-fb.

 DISTRO=<distro name> MACHINE=<machine name> source imx-setup-release.sh -b <build dir>

 bitbake core-image-minimal

Create custom layer called meta-custom-uboot.

bitbake-layers create-layer ../sources/meta-custom-uboot
bitbake-layers add-layer ../sources/meta-custom-uboot

Copy existing machine file from meta-freescale layer

from

build/sources/meta-freescale/conf/machine/imx6ullevk.conf

to

build/sources/meta-custom-uboot/conf/machine/custom_imx6ullevk.conf

Find U-Boot recipe file in meta-freescale layer

 build/sources/meta-freescale/recipes-bsp/u-boot/u-boot-imx_2020.04.bb

Create bbappend file to override the recipe (for all versions)

 build/sources/meta-custom-uboot/recipes-bsp/u-boot/u-boot-imx_%.bbappend

Add configuration fragment path to bbappend override file

FILESEXTRAPATHS_prepend := "{THISDIR}/{PN}:"
SRC_URI += "file://myboot.cfg"

Create config fragment file

 build/sources/meta-custom-uboot/recipes-bsp/u-boot/u-boot-imx/myboot.cfg

Add Kconfig options to config fragment file

 CONFIG_BOOTDELAY=7

Open local configuration file for the build

 build/conf/local.conf

Add new machine “custom_imx6ullevk” as preferred virtual bootloader provider for “u-boot-imx” recipe:

 PREFERRED_PROVIDER_virtual/bootloader_custom_imx6ullevk = "u-boot-imx"

The finished layer directory structure

build/sources/meta-custom-uboot/
├── conf
│   ├── layer.conf
│   └── machine
│       └── custom_imx6ullevk.conf
├── COPYING.MIT
├── README
└── recipes-bsp
    └── u-boot
        ├── u-boot-imx
        │   └── myboot.cfg
        └── u-boot-imx_%.bbappend

Rebuild the image for the new machine:

 MACHINE=custom_imx6ullevk  bitbake core-image-minimal

Verify KConfig option is included in “u-boot-imx” build:

 cat tmp/work/custom_imx6ullevk-poky-linux-gnueabi/u-boot-imx/1_2021.04-r0/deploy-u-boot-imx/u-boot-imx-initial-env-custom_imx6ullevk-sd-2021.04-r0

Deploy image to build via sd card:

bzcat tmp/deploy/images/custom_imx6ullevk/core-image-minimal-custom_imx6ullevk.wic.bz2 | sudo dd of=/dev/mmcblk0 bs=1M status=progress conv=fsync

Leave a Reply

Your email address will not be published. Required fields are marked *