Build the yocto image with customized image and uboot env files for verdin imx8mp

Hi,

I need to modify my image.json and u-boot-initial-env-sd file generated in the tar zip folder as a customized files as not like the default file’s need to create the custom partitions through the image file and some more commands to be add in the u-boot-initial-env-sd file that adding configs are given below in the text file. and I already have the meta custom layer which presents the some of the recipes which recipes exactly will create the customized noted file’s with the given value.

Device-Info:

Software summary
Bootloader:               U-Boot
Kernel version:           6.6.101-7.5.0-devel #1 SMP PREEMPT Mon Oct 27 12:24:20 UTC 2025
Kernel command line:      root=PARTUUID=0b174f47-4baf-4982-870b-593b25471a5d ro rootwait console=tty1 console=ttymxc2,115200 console=null quiet loglevel=0 vt.global_cursor_default=0 vt.default_redraw=0 consoleblank=0
Distro name:              NAME="TDX Wayland with XWayland"
Distro version:           VERSION_ID=7.5.0-devel-20260122114211-build.0
Distro variant:           -
Hostname:                 verdin-imx8mp-15722244
Hardware info
HW model:                 Toradex Verdin iMX8M Plus WB on Ivy
Toradex version:          0070 V1.1A
Serial number:            15722244
Processor arch:           aarch64

Meta Custom Layer with Recipes:

hari@Administrator:~/oe-core/layers/meta-lokbest$ ls
conf  recipes-bsp  recipes-core  recipes-graphics  recipes-images  recipes-kernel  recipes-lokbest  recipes-test-suite
hari@Administrator:~/oe-core/layers/meta-lokbest$

Below is the attached files for the reference,
image_file.txt (4.2 KB)
u-boot-initial-env-sd.txt (6.1 KB)

Here I have attached the manual customized configuration files from the tar build extracted defualt to my customized files in text format.

I need the suggestion to fix this customization thorugh my yocto build and while the build complete the tar zip winrar file need to contains these customized configuration instead of default. and here which recipes in my meta layer need to be develop for this feature and what are the recipes need to be cleaned to affect this chnages before the image build?

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


To customize the image.json and u-boot-initial-env-sd files in your Yocto build for Verdin iMX8M Plus, you’ll need to create specific recipes in your meta-lokbest layer.

Required Recipes and Structure

Based on the documentation, you’ll need to create the following recipes in your meta-lokbest layer(1):

1. U-Boot Environment Customization

Create a U-Boot recipe to modify the initial environment:

File: recipes-bsp/u-boot/u-boot-toradex_%.bbappend

# Custom U-Boot environment modifications
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

SRC_URI += "file://custom-u-boot-initial-env-sd"

do_install:append() {
    install -d ${D}${sysconfdir}
    install -m 0644 ${WORKDIR}/custom-u-boot-initial-env-sd ${D}${sysconfdir}/u-boot-initial-env-sd
}

(1)

2. Image JSON Customization

For customizing the image.json file, you need to understand how Toradex Easy Installer images are structured. The documentation shows that the image.json file contains partition information(2)(3)(4):

"name": "mmcblk0boot0",
"erase": true,
"content": {
    "filesystem_type": "raw",
    "rawfiles": [
        {
            "filename": "imx-boot",
            "dd_options": "seek=2"
        }
    ]
}

(2)

3. Custom Image Recipe

Create a custom image recipe in recipes-images/:

File: recipes-images/images/lokbest-custom-image.bb

# Custom image recipe
SUMMARY = "Custom Lokbest Image"
LICENSE = "MIT"

require recipes-images/images/tdx-reference-minimal-image.bb

IMAGE_INSTALL:append = " \
    your-custom-packages \
"

# Custom partition handling
IMAGE_FSTYPES += "wic"

(1)

Build Process and Cleaning

To ensure your changes take effect, clean the relevant recipes before building(1):

$ bitbake -c clean u-boot-toradex
$ bitbake -c clean your-image-recipe
$ bitbake your-image-recipe

(1)

Important Considerations

  1. File Locations: Place your custom files in the appropriate files/ directories within your recipe folders(1)

  2. Layer Priority: Ensure your meta-lokbest layer has the correct priority in conf/bblayers.conf(1)

  3. Version Control: Initialize your custom layer as a Git project if building Torizon OS(1):

$ git init
$ git commit -m "Initial Commit" -m "Add meta-lokbest layer"

(1)

Deploy Custom U-Boot Binary

If you need to deploy custom U-Boot binaries, follow the deployment process outlined in the documentation(2)(3)(4):

  1. Start from an existing Toradex prebuilt image
  2. Replace the bootloader binary with your custom one
  3. Adjust the image.json filename field if needed
  4. Deploy using Toradex Easy Installer

The key is to create .bbappend files that modify the existing Toradex recipes rather than replacing them entirely, ensuring compatibility with the Toradex BSP.

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Hi @ToradexAI,

Nothing updated and changes in the build files and tar file the custom uboot initial env sd is not applied,

Custom Layer recipes-bsp bbappend file and custom-u-boot-initial-env-sd:

hari@Administrator:~/oe-core/layers/meta-lokbest/recipes-bsp/u-boot$ cat u-boot-toradex_%.bbappend
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
SRC_URI += "\
    file://custom-u-boot-initial-env-sd \
"
do_install:append() {
    install -d ${D}${sysconfdir}
    install -m 0644 ${WORKDIR}/custom-u-boot-initial-env-sd ${D}${sysconfdir}/u-boot-initial-env-sd
}
hari@Administrator:~/oe-core/layers/meta-lokbest/recipes-bsp/u-boot$ ls
files  u-boot-toradex_%.bbappend
hari@Administrator:~/oe-core/layers/meta-lokbest/recipes-bsp/u-boot$ ls files/.
custom-u-boot-initial-env-sd  verdin-imx8mp
hari@Administrator:~/oe-core/layers/meta-lokbest/recipes-bsp/u-boot$

For the build output is not applied for the custom uboot env configuration instead of the default is applied?

(1)

The issue is that you’re installing the custom U-Boot environment file to the wrong location. The u-boot-initial-env-sd file is generated during the U-Boot build process, not installed to /etc. You need to modify the U-Boot source configuration instead.

Correct Approach for U-Boot Environment Customization

Based on the documentation, you should modify the U-Boot configuration files directly (1). Here’s the corrected approach:

1. Create a Patch for U-Boot Configuration

Create a patch file in your meta layer to modify the U-Boot environment settings:

File: recipes-bsp/u-boot/files/verdin-imx8mp/custom-uboot-env.patch

--- a/include/configs/verdin-imx8mp.h
+++ b/include/configs/verdin-imx8mp.h
@@ -112,7 +112,7 @@
-	"setup=setenv setupargs console=${console},${baudrate} console=tty1 consoleblank=0 earlycon\0" \
+	"setup=setenv setupargs console=${console},${baudrate} consoleblank=0 earlycon vt.global_cursor_default=0\0" \

(2)

2. Update Your bbappend File

File: recipes-bsp/u-boot/u-boot-toradex_%.bbappend

FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

SRC_URI:append:verdin-imx8mp = " file://custom-uboot-env.patch"

(1)

3. Clean and Rebuild

Before building, clean the U-Boot recipe to ensure changes take effect (1):

$ bitbake -c cleansstate u-boot-toradex
$ bitbake -c cleansstate virtual/bootloader
$ bitbake your-image-recipe

(1)

Alternative Approach: Modify U-Boot Header Directly

You can also modify the U-Boot configuration header file using a do_configure_append function (2):

File: recipes-bsp/u-boot/u-boot-toradex_%.bbappend

FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

do_configure:append() {
    sed -i 's/console=tty1 consoleblank=0 earlycon/consoleblank=0 earlycon vt.global_cursor_default=0/' ${S}/include/configs/verdin-imx8mp.h
}

(2)

Key Points

  1. File Location: The u-boot-initial-env-sd file is generated during the U-Boot build process, not installed as a separate file (3)

  2. Environment Variables: U-Boot environment variables are compiled into the bootloader binary from the configuration headers (3)

  3. Cleaning: Always clean the U-Boot recipe before rebuilding to ensure your changes are applied (1)

  4. Version Control: Ensure your custom layer is version controlled with Git if building Torizon OS (1):

git init && git commit -m 'fake GIT project'

(1)

The approach you were using tries to install a file that gets generated during the build process. Instead, you need to modify the source configuration that generates that file.

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Hi @ToradexAI,

Instead of changing the whole file in the u-boot-initial-env-sd file for the yocto , I need to first add the some configurations additionally in the same file as like,

bootfs_a_part=1
bootfs_b_part=2
rootfs_a_part=3
rootfs_b_part=4
rootfs_r_part=7
active_bootfs=A
active_rootfs=A
recovery_rootfs=
ota_update=
select_bootfs=if test "${active_bootfs}" = "B"; then setenv distro_bootpart ${bootfs_b_part}; else setenv distro_bootpart ${bootfs_a_part}; fi
select_rootfs=setenv root_part; if test "${recovery_rootfs}" = "R"; then if part uuid mmc ${devnum}:${rootfs_r_part} uuid; then setenv root_part ${rootfs_r_part}; else setenv recovery_rootfs; fi; fi; if test -z "${root_part}"; then if test "${active_rootfs}" = "B"; then if part uuid mmc ${devnum}:${rootfs_b_part} uuid; then setenv root_part ${rootfs_b_part}; else setenv active_rootfs A; setenv root_part ${rootfs_a_part}; fi; else if part uuid mmc ${devnum}:${rootfs_a_part} uuid; then setenv root_part ${rootfs_a_part}; else setenv active_rootfs B; setenv root_part ${rootfs_b_part}; fi; fi; fi
rootfsargs_ro=part uuid mmc ${devnum}:${root_part} uuid && env set bootargs ${tdxargs} root=PARTUUID=${uuid} ro rootwait console=${console},${baudrate}
rootfsargs_rw=part uuid mmc ${devnum}:${root_part} uuid && env set bootargs ${tdxargs} root=PARTUUID=${uuid} rw rootwait console=${console},${baudrate}
rootfsargs_set=if test "${recovery_rootfs}" = "R"; then run rootfsargs_ro; else run rootfsargs_rw; fi
custom_scan_dev_for_boot_part=run select_bootfs; setenv kernel_loaded 0; run scan_dev_for_boot; if test "${kernel_loaded}" != "1"; then if test "${active_bootfs}" = "A"; then setenv active_bootfs B; setenv distro_bootpart ${bootfs_b_part}; else setenv active_bootfs A; setenv distro_bootpart ${bootfs_a_part}; fi; saveenv; setenv kernel_loaded 0; run scan_dev_for_boot; fi
custom_mmc_boot=if mmc dev 2; then devtype=mmc; setenv devnum 2; run select_rootfs; run custom_scan_dev_for_boot_part; run rootfsargs_set; fi
bootcmd_mmc1=run custom_mmc_boot
bootcmd_mmc2=run custom_mmc_boot

And need to remove the already exisiting configuration in the uboot env like,

bootcmd_mmc1=devnum=1; run mmc_boot
bootcmd_mmc2=devnum=2; run mmc_boot

remove this lines already present in the file instead of use my custom confguration should be affect in the build as additional configuration at bottom.

For this implement give the correct recipes to add this changes and correct bbappend file?

To modify the U-Boot environment by adding your custom configurations and removing existing ones, you need to modify the U-Boot configuration header file directly (1)(2). Here’s the correct approach:

Create a Custom U-Boot Configuration Patch

Create a patch file to modify the U-Boot environment variables for Verdin iMX8M Plus:

File: recipes-bsp/u-boot/files/0001-custom-uboot-env-modifications.patch

--- a/include/configs/verdin-imx8mp.h
+++ b/include/configs/verdin-imx8mp.h
@@ -79,8 +79,25 @@
        "bootcmd_mfg=fastboot 0\0" \
        "boot_file=Image\0" \
        "boot_scripts=" BOOT_SCRIPT "\0" \
        "boot_script_dhcp=" BOOT_SCRIPT "\0" \
        "console=ttymxc2\0" \
        "fdt_board=dev\0" \
        "initrd_addr=0x43800000\0" \
        "initrd_high=0xffffffffffffffff\0" \
+       "bootfs_a_part=1\0" \
+       "bootfs_b_part=2\0" \
+       "rootfs_a_part=3\0" \
+       "rootfs_b_part=4\0" \
+       "rootfs_r_part=7\0" \
+       "active_bootfs=A\0" \
+       "active_rootfs=A\0" \
+       "recovery_rootfs=\0" \
+       "ota_update=\0" \
+       "select_bootfs=if test \"${active_bootfs}\" = \"B\"; then setenv distro_bootpart ${bootfs_b_part}; else setenv distro_bootpart ${bootfs_a_part}; fi\0" \
+       "select_rootfs=setenv root_part; if test \"${recovery_rootfs}\" = \"R\"; then if part uuid mmc ${devnum}:${rootfs_r_part} uuid; then setenv root_part ${rootfs_r_part}; else setenv recovery_rootfs; fi; fi; if test -z \"${root_part}\"; then if test \"${active_rootfs}\" = \"B\"; then if part uuid mmc ${devnum}:${rootfs_b_part} uuid; then setenv root_part ${rootfs_b_part}; else setenv active_rootfs A; setenv root_part ${rootfs_a_part}; fi; else if part uuid mmc ${devnum}:${rootfs_a_part} uuid; then setenv root_part ${rootfs_a_part}; else setenv active_rootfs B; setenv root_part ${rootfs_b_part}; fi; fi; fi\0" \
+       "rootfsargs_ro=part uuid mmc ${devnum}:${root_part} uuid && env set bootargs ${tdxargs} root=PARTUUID=${uuid} ro rootwait console=${console},${baudrate}\0" \
+       "rootfsargs_rw=part uuid mmc ${devnum}:${root_part} uuid && env set bootargs ${tdxargs} root=PARTUUID=${uuid} rw rootwait console=${console},${baudrate}\0" \
+       "rootfsargs_set=if test \"${recovery_rootfs}\" = \"R\"; then run rootfsargs_ro; else run rootfsargs_rw; fi\0" \
+       "custom_scan_dev_for_boot_part=run select_bootfs; setenv kernel_loaded 0; run scan_dev_for_boot; if test \"${kernel_loaded}\" != \"1\"; then if test \"${active_bootfs}\" = \"A\"; then setenv active_bootfs B; setenv distro_bootpart ${bootfs_b_part}; else setenv active_bootfs A; setenv distro_bootpart ${bootfs_a_part}; fi; saveenv; setenv kernel_loaded 0; run scan_dev_for_boot; fi\0" \
+       "custom_mmc_boot=if mmc dev 2; then devtype=mmc; setenv devnum 2; run select_rootfs; run custom_scan_dev_for_boot_part; run rootfsargs_set; fi\0" \
        "setup=setenv setupargs console=tty1 console=${console},${baudrate} " \
                "consoleblank=0 earlycon\0" \
        "update_uboot=askenv confirm Did you load flash.bin (y/N)?; " \
@@ -88,6 +105,8 @@
                "setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt " \
                "${blkcnt} / 0x200; mmc dev 2 1; mmc write ${loadaddr} 0x0 " \
                "${blkcnt}; fi\0"
+       "bootcmd_mmc1=run custom_mmc_boot\0" \
+       "bootcmd_mmc2=run custom_mmc_boot\0"

(2)

Update Your bbappend File

File: recipes-bsp/u-boot/u-boot-toradex_%.bbappend

FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

SRC_URI:append:verdin-imx8mp = " file://0001-custom-uboot-env-modifications.patch"

(2)

Alternative Approach Using sed Commands

If you prefer to use sed commands instead of patches, you can modify the configuration directly in the do_configure:append() function (2):

File: recipes-bsp/u-boot/u-boot-toradex_%.bbappend

do_configure:append() {
    # Remove existing bootcmd_mmc1 and bootcmd_mmc2 definitions
    sed -i '/bootcmd_mmc1=devnum=1; run mmc_boot/d' ${S}/include/configs/verdin-imx8mp.h
    sed -i '/bootcmd_mmc2=devnum=2; run mmc_boot/d' ${S}/include/configs/verdin-imx8mp.h
    
    # Add custom environment variables before the closing quote
    sed -i '/update_uboot=.*fi\\0"/a\\
        "bootfs_a_part=1\\0" \\\
        "bootfs_b_part=2\\0" \\\
        "rootfs_a_part=3\\0" \\\
        "rootfs_b_part=4\\0" \\\
        "rootfs_r_part=7\\0" \\\
        "active_bootfs=A\\0" \\\
        "active_rootfs=A\\0" \\\
        "recovery_rootfs=\\0" \\\
        "ota_update=\\0" \\\
        "select_bootfs=if test \\"${active_bootfs}\\" = \\"B\\"; then setenv distro_bootpart ${bootfs_b_part}; else setenv distro_bootpart ${bootfs_a_part}; fi\\0" \\\
        "select_rootfs=setenv root_part; if test \\"${recovery_rootfs}\\" = \\"R\\"; then if part uuid mmc ${devnum}:${rootfs_r_part} uuid; then setenv root_part ${rootfs_r_part}; else setenv recovery_rootfs; fi; fi; if test -z \\"${root_part}\\"; then if test \\"${active_rootfs}\\" = \\"B\\"; then if part uuid mmc ${devnum}:${rootfs_b_part} uuid; then setenv root_part ${rootfs_b_part}; else setenv active_rootfs A; setenv root_part ${rootfs_a_part}; fi; else if part uuid mmc ${devnum}:${rootfs_a_part} uuid; then setenv root_part ${rootfs_a_part}; else setenv active_rootfs B; setenv root_part ${rootfs_b_part}; fi; fi; fi\\0" \\\
        "rootfsargs_ro=part uuid mmc ${devnum}:${root_part} uuid && env set bootargs ${tdxargs} root=PARTUUID=${uuid} ro rootwait console=${console},${baudrate}\\0" \\\
        "rootfsargs_rw=part uuid mmc ${devnum}:${root_part} uuid && env set bootargs ${tdxargs} root=PARTUUID=${uuid} rw rootwait console=${console},${baudrate}\\0" \\\
        "rootfsargs_set=if test \\"${recovery_rootfs}\\" = \\"R\\"; then run rootfsargs_ro; else run rootfsargs_rw; fi\\0" \\\
        "custom_scan_dev_for_boot_part=run select_bootfs; setenv kernel_loaded 0; run scan_dev_for_boot; if test \\"${kernel_loaded}\\" != \\"1\\"; then if test \\"${active_bootfs}\\" = \\"A\\"; then setenv active_bootfs B; setenv distro_bootpart ${bootfs_b_part}; else setenv active_bootfs A; setenv distro_bootpart ${bootfs_a_part}; fi; saveenv; setenv kernel_loaded 0; run scan_dev_for_boot; fi\\0" \\\
        "custom_mmc_boot=if mmc dev 2; then devtype=mmc; setenv devnum 2; run select_rootfs; run custom_scan_dev_for_boot_part; run rootfsargs_set; fi\\0" \\\
        "bootcmd_mmc1=run custom_mmc_boot\\0" \\\
        "bootcmd_mmc2=run custom_mmc_boot\\0"' ${S}/include/configs/verdin-imx8mp.h
}

(2)

Clean and Rebuild

Before building, clean the U-Boot recipe to ensure your changes take effect (3)(2):

$ bitbake -c cleansstate u-boot-toradex
$ bitbake -c cleansstate virtual/bootloader
$ bitbake your-image-recipe

(2)

Important Notes

  1. Environment Variables: U-Boot environment variables are stored as key-value pairs and are compiled into the bootloader binary from the configuration headers (1)(3)

  2. Persistence: Changes made with setenv only affect the RAM representation. To make changes persistent, you must call saveenv (3)

  3. Version Control: Ensure your custom layer is version controlled with Git if building Torizon OS (2):

git init && git commit -m 'Initial commit'

(2)

The approach modifies the U-Boot configuration header file directly, which will generate the u-boot-initial-env-sd file with your custom environment variables during the build process.

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Hi @ToradexAI,

After modifying the updates in uboot bbappend file I have got an error issue like this,

Updated Recipes-BSP Uboot bbappend File:

hari@Administrator:~/oe-core/layers/meta-lokbest/recipes-bsp/u-boot$ cat u-boot-toradex_%.bbappend
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

SRC_URI += "\
    file://disable-console-logs.patch \
"

do_configure:append() {
    # Set boot delay to 0 for fast boot
    if grep -q "#define CONFIG_BOOTDELAY" ${S}/include/configs/verdin-imx8mp.h; then
        sed -i 's/#define CONFIG_BOOTDELAY.*[0-9]/#define CONFIG_BOOTDELAY 0/' ${S}/include/configs/verdin-imx8mp.h
    else
        echo "#define CONFIG_BOOTDELAY 0" >> ${S}/include/configs/verdin-imx8mp.h
    fi

    # Modify setupargs to remove console=tty1
    if grep -q "console=tty1" ${S}/include/configs/verdin-imx8mp.h; then
        sed -i 's/console=tty1 console=/console=/' ${S}/include/configs/verdin-imx8mp.h
    fi

    # Override setupargs to remove console=tty1
    if ! grep -q '"setupargs=console=${console}\\0"' ${S}/include/configs/verdin-imx8mp.h; then
        sed -i '/tdxargs=/a\\t"setupargs=console=${console}\\0" \\' ${S}/include/configs/verdin-imx8mp.h
    fi

    # Override the setup command to exclude console=tty1
    if ! grep -q "setup=setenv setupargs console=" ${S}/include/configs/verdin-imx8mp.h; then
        sed -i '/tdxargs=/a\\t"setup=setenv setupargs console=${console}\\0" \\' ${S}/include/configs/verdin-imx8mp.h
    fi

    # Add tdxargs for console configuration if not already present
    if ! grep -q "tdxargs=" ${S}/include/configs/verdin-imx8mp.h; then
        sed -i '/initrd_high=0xffffffffffffffff\\0/a\\t"tdxargs=quiet loglevel=0 vt.global_cursor_default=0 vt.default_redraw=0 consoleblank=0\\0" \\' ${S}/include/configs/verdin-imx8mp.h
    fi

    # Remove existing fdtfile, if there is one
    sed -i '/"fdtfile=.*\\0" \\/d' ${S}/include/configs/verdin-imx8mp.h
    # Add new fdtfile for Ivy carrier board
    sed -i 's/\("fdt_board=.*\\0" \\\)/\0\n      "fdtfile=imx8mp-verdin-wifi-ivy.dtb\\0" \\/' ${S}/include/configs/verdin-imx8mp.h

    # Remove existing bootcmd_mmc1 and bootcmd_mmc2 definitions
    sed -i '/bootcmd_mmc1=devnum=1; run mmc_boot/d' ${S}/include/configs/verdin-imx8mp.h
    sed -i '/bootcmd_mmc2=devnum=2; run mmc_boot/d' ${S}/include/configs/verdin-imx8mp.h

    # Add custom environment variables before the closing quote
    sed -i '/update_uboot=.*fi\\0"/a\\
        "bootfs_a_part=1\\0" \\\
        "bootfs_b_part=2\\0" \\\
        "rootfs_a_part=3\\0" \\\
        "rootfs_b_part=4\\0" \\\
        "rootfs_r_part=7\\0" \\\
        "active_bootfs=A\\0" \\\
        "active_rootfs=A\\0" \\\
        "recovery_rootfs=\\0" \\\
        "ota_update=\\0" \\\
        "select_bootfs=if test \\"${active_bootfs}\\" = \\"B\\"; then setenv distro_bootpart ${bootfs_b_part}; else setenv distro_bootpart ${bootfs_a_part}; fi\\0" \\\
        "select_rootfs=setenv root_part; if test \\"${recovery_rootfs}\\" = \\"R\\"; then if part uuid mmc ${devnum}:${rootfs_r_part} uuid; then setenv root_part ${rootfs_r_part}; else setenv recovery_rootfs; fi; fi; if test -z \\"${root_part}\\"; then if test \\"${active_rootfs}\\" = \\"B\\"; then if part uuid mmc ${devnum}:${rootfs_b_part} uuid; then setenv root_part ${rootfs_b_part}; else setenv active_rootfs A; setenv root_part ${rootfs_a_part}; fi; else if part uuid mmc ${devnum}:${rootfs_a_part} uuid; then setenv root_part ${rootfs_a_part}; else setenv active_rootfs B; setenv root_part ${rootfs_b_part}; fi; fi; fi\\0" \\\
        "rootfsargs_ro=part uuid mmc ${devnum}:${root_part} uuid && env set bootargs ${tdxargs} root=PARTUUID=${uuid} ro rootwait console=${console},${baudrate}\\0" \\\
        "rootfsargs_rw=part uuid mmc ${devnum}:${root_part} uuid && env set bootargs ${tdxargs} root=PARTUUID=${uuid} rw rootwait console=${console},${baudrate}\\0" \\\
        "rootfsargs_set=if test \\"${recovery_rootfs}\\" = \\"R\\"; then run rootfsargs_ro; else run rootfsargs_rw; fi\\0" \\\
        "custom_scan_dev_for_boot_part=run select_bootfs; setenv kernel_loaded 0; run scan_dev_for_boot; if test \\"${kernel_loaded}\\" != \\"1\\"; then if test \\"${active_bootfs}\\" = \\"A\\"; then setenv active_bootfs B; setenv distro_bootpart ${bootfs_b_part}; else setenv active_bootfs A; setenv distro_bootpart ${bootfs_a_part}; fi; saveenv; setenv kernel_loaded 0; run scan_dev_for_boot; fi\\0" \\\
        "custom_mmc_boot=if mmc dev 2; then devtype=mmc; setenv devnum 2; run select_rootfs; run custom_scan_dev_for_boot_part; run rootfsargs_set; fi\\0" \\\
        "bootcmd_mmc1=run custom_mmc_boot\\0" \\\
        "bootcmd_mmc2=run custom_mmc_boot\\0"' ${S}/include/configs/verdin-imx8mp.h
}

Error Log:

Sstate summary: Wanted 507 Local 476 Mirrors 0 Missed 31 Current 5677 (93% match, 99% complete)#####         | ETA:  0:00:00
Initialising tasks: 100% |###################################################################################| Time: 0:00:10
NOTE: Executing Tasks
ERROR: u-boot-toradex-1_2024.07-r0 do_configure: ExecutionError('/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/temp/run.do_configure.284635', 1, None, None)
ERROR: Logfile of failure stored in: /home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/temp/log.do_configure.284635
Log data follows:
| DEBUG: Executing python function extend_recipe_sysroot
| NOTE: Direct dependencies are ['/home/hari/oe-core/build/../layers/openembedded-core/meta/recipes-core/glibc/glibc_2.39.bb:do_populate_sysroot', '/home/hari/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/gcc/gcc-cross_13.4.bb:do_populate_sysroot', '/home/hari/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/gcc/gcc-runtime_13.4.bb:do_populate_sysroot', '/home/hari/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/quilt/quilt-native_0.67.bb:do_populate_sysroot', '/home/hari/oe-core/build/../layers/openembedded-core/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb:do_populate_sysroot', 'virtual:native:/home/hari/oe-core/build/../layers/openembedded-core/meta/recipes-connectivity/openssl/openssl_3.2.6.bb:do_populate_sysroot', 'virtual:native:/home/hari/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/bison/bison_3.8.2.bb:do_populate_sysroot', 'virtual:native:/home/hari/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/flex/flex_2.6.4.bb:do_populate_sysroot', 'virtual:native:/home/hari/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/patch/patch_2.7.6.bb:do_populate_sysroot', 'virtual:native:/home/hari/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb:do_populate_sysroot', 'virtual:native:/home/hari/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/pseudo/pseudo_git.bb:do_populate_sysroot', 'virtual:native:/home/hari/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/python/python3-jsonschema_4.21.1.bb:do_populate_sysroot', 'virtual:native:/home/hari/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/python/python3-pyelftools_0.30.bb:do_populate_sysroot', 'virtual:native:/home/hari/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/python/python3-pyyaml_6.0.1.bb:do_populate_sysroot', 'virtual:native:/home/hari/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/python/python3-setuptools_69.1.1.bb:do_populate_sysroot', 'virtual:native:/home/hari/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/python/python3-yamllint_1.35.1.bb:do_populate_sysroot', 'virtual:native:/home/hari/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/python/python3_3.12.12.bb:do_populate_sysroot', 'virtual:native:/home/hari/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/swig/swig_4.2.1.bb:do_populate_sysroot', 'virtual:native:/home/hari/oe-core/build/../layers/openembedded-core/meta/recipes-extended/bc/bc_1.07.1.bb:do_populate_sysroot', 'virtual:native:/home/hari/oe-core/build/../layers/openembedded-core/meta/recipes-kernel/dtc/dtc_1.7.0.bb:do_populate_sysroot', 'virtual:native:/home/hari/oe-core/build/../layers/openembedded-core/meta/recipes-support/gnutls/gnutls_3.8.4.bb:do_populate_sysroot']
| NOTE: Installed into sysroot: []
| NOTE: Skipping as already exists in sysroot: ['gettext-minimal-native', 'glibc', 'binutils-cross-aarch64', 'cmake-native', 'gcc-cross-aarch64', 'gcc-runtime', 'libgcc', 'libtool-native', 'm4-native', 'quilt-native', 'texinfo-dummy-native', 'kern-tools-native', 'linux-libc-headers', 'openssl-native', 'expat-native', 'ncurses-native', 'readline-native', 'util-linux-libuuid-native', 'zlib-native', 'bison-native', 'flex-native', 'git-native', 'gnu-config-native', 'libedit-native', 'make-native', 'patch-native', 'perl-native', 'pkgconfig-native', 'pseudo-native', 'python3-attrs-native', 'python3-build-native', 'python3-calver-native', 'python3-cython-native', 'python3-editables-native', 'python3-flit-core-native', 'python3-hatch-fancy-pypi-readme-native', 'python3-hatch-vcs-native', 'python3-hatchling-native', 'python3-idna-native', 'python3-importlib-metadata-native', 'python3-installer-native', 'python3-jsonpointer-native', 'python3-jsonschema-specifications-native', 'python3-jsonschema-native', 'python3-maturin-native', 'python3-more-itertools-native', 'python3-packaging-native', 'python3-pathlib2-native', 'python3-pathspec-native', 'python3-pip-native', 'python3-pluggy-native', 'python3-pyelftools-native', 'python3-pyparsing-native', 'python3-pyproject-hooks-native', 'python3-pyrsistent-native', 'python3-pyyaml-native', 'python3-referencing-native', 'python3-rfc3339-validator-native', 'python3-rfc3987-native', 'python3-rpds-py-native', 'python3-semantic-version-native', 'python3-setuptools-rust-native', 'python3-setuptools-scm-native', 'python3-setuptools-native', 'python3-six-native', 'python3-toml-native', 'python3-tomli-native', 'python3-trove-classifiers-native', 'python3-typing-extensions-native', 'python3-webcolors-native', 'python3-wheel-native', 'python3-yamllint-native', 'python3-zipp-native', 'python3-native', 'cargo-native', 'rust-llvm-native', 'rust-native', 'swig-native', 'bc-native', 'bzip2-native', 'libidn2-native', 'libnsl2-native', 'libtirpc-native', 'unzip-native', 'xz-native', 'zstd-native', 'dtc-native', 'attr-native', 'ca-certificates-native', 'curl-native', 'gdbm-native', 'gmp-native', 'gnutls-native', 'libtasn1-native', 'libffi-native', 'libmpc-native', 'libpcre2-native', 'libssh2-native', 'libunistring-native', 'libyaml-native', 'mpfr-native', 'nettle-native', 'sqlite3-native']
| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Searching for 0001-board-toradex-verdin-imx8mm-add-4-GB-lpddr4-memory-s.patch in paths:
|     /home/hari/oe-core/layers/meta-lokbest/recipes-bsp/u-boot/files/tdx-distro
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex-2024.07/tdx-distro
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex/tdx-distro
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/files/tdx-distro
|     /home/hari/oe-core/layers/meta-lokbest/recipes-bsp/u-boot/files/tdx-xwayland
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex-2024.07/tdx-xwayland
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex/tdx-xwayland
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/files/tdx-xwayland
|     /home/hari/oe-core/layers/meta-lokbest/recipes-bsp/u-boot/files/verdin-imx8mp
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex-2024.07/verdin-imx8mp
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex/verdin-imx8mp
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/files/verdin-imx8mp
|     /home/hari/oe-core/layers/meta-lokbest/recipes-bsp/u-boot/files/mx8mp-nxp-bsp
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex-2024.07/mx8mp-nxp-bsp
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex/mx8mp-nxp-bsp
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/files/mx8mp-nxp-bsp
|     /home/hari/oe-core/layers/meta-lokbest/recipes-bsp/u-boot/files/mx8mp-generic-bsp
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex-2024.07/mx8mp-generic-bsp
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex/mx8mp-generic-bsp
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/files/mx8mp-generic-bsp
|     /home/hari/oe-core/layers/meta-lokbest/recipes-bsp/u-boot/files/mx8m-nxp-bsp
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex-2024.07/mx8m-nxp-bsp
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex/mx8m-nxp-bsp
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/files/mx8m-nxp-bsp
|     /home/hari/oe-core/layers/meta-lokbest/recipes-bsp/u-boot/files/mx8m-generic-bsp
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex-2024.07/mx8m-generic-bsp
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex/mx8m-generic-bsp
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/files/mx8m-generic-bsp
|     /home/hari/oe-core/layers/meta-lokbest/recipes-bsp/u-boot/files/mx8-nxp-bsp
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex-2024.07/mx8-nxp-bsp
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex/mx8-nxp-bsp
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/files/mx8-nxp-bsp
|     /home/hari/oe-core/layers/meta-lokbest/recipes-bsp/u-boot/files/mx8-generic-bsp
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex-2024.07/mx8-generic-bsp
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex/mx8-generic-bsp
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/files/mx8-generic-bsp
|     /home/hari/oe-core/layers/meta-lokbest/recipes-bsp/u-boot/files/imxvulkan
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex-2024.07/imxvulkan
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex/imxvulkan
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/files/imxvulkan
|     /home/hari/oe-core/layers/meta-lokbest/recipes-bsp/u-boot/files/imxgpu3d
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex-2024.07/imxgpu3d
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex/imxgpu3d
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/files/imxgpu3d
|     /home/hari/oe-core/layers/meta-lokbest/recipes-bsp/u-boot/files/imxgpu2d
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex-2024.07/imxgpu2d
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex/imxgpu2d
|     /home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/files/imxgpu2d
|     /home/hari/oe-core/layers/meta-lokbest/recipes-bsp/u-boot/files/imxviv
| DEBUG: Using /home/hari/oe-core/layers/meta-lokbest/recipes-bsp/u-boot/files/verdin-imx8mp/disable-console-logs.patch for disable-console-logs.patch
| DEBUG: Executing shell function do_configure
| NOTE: make CROSS_COMPILE=aarch64-tdx-linux- CC=aarch64-tdx-linux-gcc  --sysroot=/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot -fcanon-prefix-map  -fmacro-prefix-map=/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git=/usr/src/debug/u-boot-toradex/2024.07  -fdebug-prefix-map=/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git=/usr/src/debug/u-boot-toradex/2024.07  -fmacro-prefix-map=/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/build=/usr/src/debug/u-boot-toradex/2024.07  -fdebug-prefix-map=/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/build=/usr/src/debug/u-boot-toradex/2024.07  -fdebug-prefix-map=/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot=  -fmacro-prefix-map=/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot=  -fdebug-prefix-map=/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native=  V=1 HOSTCC=gcc  -isystem/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/include -O2 -pipe -L/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/lib                         -L/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/lib                         -Wl,--enable-new-dtags                         -Wl,-rpath-link,/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/lib                         -Wl,-rpath-link,/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/lib                         -Wl,-rpath,/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/lib                         -Wl,-rpath,/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/lib                         -Wl,-O1 STAGING_INCDIR=/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/include STAGING_LIBDIR=/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/lib -C /home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git O=/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/build/verdin-imx8mp_defconfig verdin-imx8mp_defconfig
| make: Entering directory '/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git'
| make -C /home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/build/verdin-imx8mp_defconfig KBUILD_SRC=/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git \
| -f /home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git/Makefile verdin-imx8mp_defconfig
| make[1]: Entering directory '/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/build/verdin-imx8mp_defconfig'
| make -f /home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git/scripts/Makefile.build obj=scripts/basic
|   gcc  -isystem/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/include -O2 -pipe -L/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/lib                         -L/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/lib                         -Wl,--enable-new-dtags                         -Wl,-rpath-link,/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/lib                         -Wl,-rpath-link,/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/lib                         -Wl,-rpath,/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/lib                         -Wl,-rpath,/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/lib                         -Wl,-O1 -Wp,-MD,scripts/basic/.fixdep.d -Iscripts/basic -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu11   -o scripts/basic/fixdep /home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git/scripts/basic/fixdep.c
| rm -f .tmp_quiet_recordmcount
| ln -fsn /home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git source
| /bin/bash /home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git/scripts/mkmakefile /home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git
|   GEN     Makefile
| make -f /home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git/scripts/Makefile.build obj=scripts/kconfig verdin-imx8mp_defconfig
|   gcc  -isystem/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/include -O2 -pipe -L/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/lib                         -L/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/lib                         -Wl,--enable-new-dtags                         -Wl,-rpath-link,/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/lib                         -Wl,-rpath-link,/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/lib                         -Wl,-rpath,/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/lib                         -Wl,-rpath,/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/lib                         -Wl,-O1 -Wp,-MD,scripts/kconfig/.conf.o.d -Iscripts/kconfig -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu11 -c -o scripts/kconfig/conf.o /home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git/scripts/kconfig/conf.c
|   bison -oscripts/kconfig/zconf.tab.c -t -l /home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git/scripts/kconfig/zconf.y
|   flex -oscripts/kconfig/zconf.lex.c -L /home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git/scripts/kconfig/zconf.l
|   gcc  -isystem/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/include -O2 -pipe -L/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/lib                         -L/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/lib                         -Wl,--enable-new-dtags                         -Wl,-rpath-link,/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/lib                         -Wl,-rpath-link,/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/lib                         -Wl,-rpath,/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/lib                         -Wl,-rpath,/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/lib                         -Wl,-O1 -Wp,-MD,scripts/kconfig/.zconf.tab.o.d -Iscripts/kconfig -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu11  -I/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git/scripts/kconfig -c -o scripts/kconfig/zconf.tab.o scripts/kconfig/zconf.tab.c
|   gcc  -isystem/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/include -O2 -pipe -L/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/lib                         -L/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/lib                         -Wl,--enable-new-dtags                         -Wl,-rpath-link,/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/lib                         -Wl,-rpath-link,/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/lib                         -Wl,-rpath,/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/usr/lib                         -Wl,-rpath,/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/lib                         -Wl,-O1   -o scripts/kconfig/conf scripts/kconfig/conf.o scripts/kconfig/zconf.tab.o
| aarch64-tdx-linux-gcc  --sysroot=/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot -fcanon-prefix-map  -fmacro-prefix-map=/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git=/usr/src/debug/u-boot-toradex/2024.07  -fdebug-prefix-map=/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git=/usr/src/debug/u-boot-toradex/2024.07  -fmacro-prefix-map=/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/build=/usr/src/debug/u-boot-toradex/2024.07  -fdebug-prefix-map=/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/build=/usr/src/debug/u-boot-toradex/2024.07  -fdebug-prefix-map=/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot=  -fmacro-prefix-map=/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot=  -fdebug-prefix-map=/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native=  -E -nostdinc -P -I /home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git -undef -x assembler-with-cpp /home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git/arch/../configs/verdin-imx8mp_defconfig -o generated_defconfig
| scripts/kconfig/conf  --defconfig=generated_defconfig Kconfig
| #
| # configuration written to .config
| #
| make[1]: Leaving directory '/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/build/verdin-imx8mp_defconfig'
| make: Leaving directory '/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git'
| sed: -e expression #1, char 36: unknown command: `"'
| WARNING: exit code 1 from a shell command.
ERROR: Task (/home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex_2024.07.bb:do_configure) failed with exit code '1'
Setscene tasks: 6184 of 6184

Give the correct solution for this error to resolve and success build with update uboot initial env file?

The error is caused by invalid sed syntax in your do_configure:append() function. The sed command is failing because of improper escaping and quoting (1). Here’s the corrected approach:

Fix the sed Command Syntax

File: recipes-bsp/u-boot/u-boot-toradex_%.bbappend

FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

SRC_URI += "\
    file://disable-console-logs.patch \
"

do_configure:append() {
    # Set boot delay to 0 for fast boot
    if grep -q "#define CONFIG_BOOTDELAY" ${S}/include/configs/verdin-imx8mp.h; then
        sed -i 's/#define CONFIG_BOOTDELAY.*[0-9]/#define CONFIG_BOOTDELAY 0/' ${S}/include/configs/verdin-imx8mp.h
    else
        echo "#define CONFIG_BOOTDELAY 0" >> ${S}/include/configs/verdin-imx8mp.h
    fi

    # Modify setupargs to remove console=tty1 and add custom parameters
    sed -i 's/console=tty1 console=/console=/' ${S}/include/configs/verdin-imx8mp.h
    
    # Add tdxargs for console configuration
    if ! grep -q "tdxargs=" ${S}/include/configs/verdin-imx8mp.h; then
        sed -i '/initrd_high=0xffffffffffffffff\\0/a\\t"tdxargs=quiet loglevel=0 vt.global_cursor_default=0 vt.default_redraw=0 consoleblank=0\\0" \\' ${S}/include/configs/verdin-imx8mp.h
    fi

    # Set fdtfile for Ivy carrier board
    sed -i 's/"fdt_board=dev\\0" \\/"fdt_board=dev\\0" \\\n\t"fdtfile=imx8mp-verdin-wifi-ivy.dtb\\0" \\/' ${S}/include/configs/verdin-imx8mp.h

    # Add custom environment variables at the end of CONFIG_EXTRA_ENV_SETTINGS
    sed -i '/update_uboot=.*fi\\0"$/i\\t"bootfs_a_part=1\\0" \\\n\t"bootfs_b_part=2\\0" \\\n\t"rootfs_a_part=3\\0" \\\n\t"rootfs_b_part=4\\0" \\\n\t"rootfs_r_part=7\\0" \\\n\t"active_bootfs=A\\0" \\\n\t"active_rootfs=A\\0" \\\n\t"recovery_rootfs=\\0" \\\n\t"ota_update=\\0" \\\n\t"select_bootfs=if test \\"${active_bootfs}\\" = \\"B\\"; then setenv distro_bootpart ${bootfs_b_part}; else setenv distro_bootpart ${bootfs_a_part}; fi\\0" \\\n\t"select_rootfs=setenv root_part; if test \\"${recovery_rootfs}\\" = \\"R\\"; then if part uuid mmc ${devnum}:${rootfs_r_part} uuid; then setenv root_part ${rootfs_r_part}; else setenv recovery_rootfs; fi; fi; if test -z \\"${root_part}\\"; then if test \\"${active_rootfs}\\" = \\"B\\"; then if part uuid mmc ${devnum}:${rootfs_b_part} uuid; then setenv root_part ${rootfs_b_part}; else setenv active_rootfs A; setenv root_part ${rootfs_a_part}; fi; else if part uuid mmc ${devnum}:${rootfs_a_part} uuid; then setenv root_part ${rootfs_a_part}; else setenv active_rootfs B; setenv root_part ${rootfs_b_part}; fi; fi; fi\\0" \\\n\t"rootfsargs_ro=part uuid mmc ${devnum}:${root_part} uuid && env set bootargs ${tdxargs} root=PARTUUID=${uuid} ro rootwait console=${console},${baudrate}\\0" \\\n\t"rootfsargs_rw=part uuid mmc ${devnum}:${root_part} uuid && env set bootargs ${tdxargs} root=PARTUUID=${uuid} rw rootwait console=${console},${baudrate}\\0" \\\n\t"rootfsargs_set=if test \\"${recovery_rootfs}\\" = \\"R\\"; then run rootfsargs_ro; else run rootfsargs_rw; fi\\0" \\\n\t"custom_scan_dev_for_boot_part=run select_bootfs; setenv kernel_loaded 0; run scan_dev_for_boot; if test \\"${kernel_loaded}\\" != \\"1\\"; then if test \\"${active_bootfs}\\" = \\"A\\"; then setenv active_bootfs B; setenv distro_bootpart ${bootfs_b_part}; else setenv active_bootfs A; setenv distro_bootpart ${bootfs_a_part}; fi; saveenv; setenv kernel_loaded 0; run scan_dev_for_boot; fi\\0" \\\n\t"custom_mmc_boot=if mmc dev 2; then devtype=mmc; setenv devnum 2; run select_rootfs; run custom_scan_dev_for_boot_part; run rootfsargs_set; fi\\0" \\\n\t"bootcmd_mmc1=run custom_mmc_boot\\0" \\\n\t"bootcmd_mmc2=run custom_mmc_boot\\0" \\' ${S}/include/configs/verdin-imx8mp.h
}

(2)

Alternative Patch-Based Approach (Recommended)

Instead of complex sed commands, create a patch file which is more reliable (2):

File: recipes-bsp/u-boot/files/0001-custom-verdin-imx8mp-env.patch

--- a/include/configs/verdin-imx8mp.h
+++ b/include/configs/verdin-imx8mp.h
@@ -79,6 +79,7 @@
        "bootcmd_mfg=fastboot 0\0" \
        "boot_file=Image\0" \
        "boot_scripts=" BOOT_SCRIPT "\0" \
        "boot_script_dhcp=" BOOT_SCRIPT "\0" \
        "console=ttymxc2\0" \
        "fdt_board=dev\0" \
+       "fdtfile=imx8mp-verdin-wifi-ivy.dtb\0" \
        "initrd_addr=0x43800000\0" \
        "initrd_high=0xffffffffffffffff\0" \
+       "tdxargs=quiet loglevel=0 vt.global_cursor_default=0 vt.default_redraw=0 consoleblank=0\0" \
+       "bootfs_a_part=1\0" \
+       "bootfs_b_part=2\0" \
+       "rootfs_a_part=3\0" \
+       "rootfs_b_part=4\0" \
+       "rootfs_r_part=7\0" \
+       "active_bootfs=A\0" \
+       "active_rootfs=A\0" \
+       "recovery_rootfs=\0" \
+       "ota_update=\0" \
+       "select_bootfs=if test \"${active_bootfs}\" = \"B\"; then setenv distro_bootpart ${bootfs_b_part}; else setenv distro_bootpart ${bootfs_a_part}; fi\0" \
+       "select_rootfs=setenv root_part; if test \"${recovery_rootfs}\" = \"R\"; then if part uuid mmc ${devnum}:${rootfs_r_part} uuid; then setenv root_part ${rootfs_r_part}; else setenv recovery_rootfs; fi; fi; if test -z \"${root_part}\"; then if test \"${active_rootfs}\" = \"B\"; then if part uuid mmc ${devnum}:${rootfs_b_part} uuid; then setenv root_part ${rootfs_b_part}; else setenv active_rootfs A; setenv root_part ${rootfs_a_part}; fi; else if part uuid mmc ${devnum}:${rootfs_a_part} uuid; then setenv root_part ${rootfs_a_part}; else setenv active_rootfs B; setenv root_part ${rootfs_b_part}; fi; fi; fi\0" \
+       "rootfsargs_ro=part uuid mmc ${devnum}:${root_part} uuid && env set bootargs ${tdxargs} root=PARTUUID=${uuid} ro rootwait console=${console},${baudrate}\0" \
+       "rootfsargs_rw=part uuid mmc ${devnum}:${root_part} uuid && env set bootargs ${tdxargs} root=PARTUUID=${uuid} rw rootwait console=${console},${baudrate}\0" \
+       "rootfsargs_set=if test \"${recovery_rootfs}\" = \"R\"; then run rootfsargs_ro; else run rootfsargs_rw; fi\0" \
+       "custom_scan_dev_for_boot_part=run select_bootfs; setenv kernel_loaded 0; run scan_dev_for_boot; if test \"${kernel_loaded}\" != \"1\"; then if test \"${active_bootfs}\" = \"A\"; then setenv active_bootfs B; setenv distro_bootpart ${bootfs_b_part}; else setenv active_bootfs A; setenv distro_bootpart ${bootfs_a_part}; fi; saveenv; setenv kernel_loaded 0; run scan_dev_for_boot; fi\0" \
+       "custom_mmc_boot=if mmc dev 2; then devtype=mmc; setenv devnum 2; run select_rootfs; run custom_scan_dev_for_boot_part; run rootfsargs_set; fi\0" \
        "setup=setenv setupargs console=${console},${baudrate} " \
                "consoleblank=0 earlycon\0" \
        "update_uboot=askenv confirm Did you load flash.bin (y/N)?; " \
@@ -86,6 +105,8 @@
                "setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt " \
                "${blkcnt} / 0x200; mmc dev 2 1; mmc write ${loadaddr} 0x0 " \
                "${blkcnt}; fi\0"
+       "bootcmd_mmc1=run custom_mmc_boot\0" \
+       "bootcmd_mmc2=run custom_mmc_boot\0"

Updated bbappend file:

FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

SRC_URI += "\
    file://disable-console-logs.patch \
    file://0001-custom-verdin-imx8mp-env.patch \
"

(2)

Clean and Rebuild

Clean the U-Boot recipe before rebuilding (1):

$ bitbake -c cleansstate u-boot-toradex
$ bitbake -c cleansstate virtual/bootloader  
$ bitbake your-image-recipe

(1)

Key Points

  1. Escaping Issues: The original sed command had improper quote escaping which caused the syntax error (1)
  2. Patch Approach: Using patches is more reliable than complex sed commands (2)
  3. Environment Variables: U-Boot environment variables are compiled into the bootloader binary from configuration headers (3)
  4. Persistence: Changes made with setenv only affect RAM; use saveenv to make them persistent (1)

The patch-based approach is recommended as it’s more maintainable and less error-prone than complex sed operations.

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Hi @Hariprabhu_13,

My suggestion for this would be to use the patch option on the Linux-toradex recipe using a bbappend file for the environment changes. This is pretty much how I do it.

For the image json file, I also have some patches for the script that generates this to enable me to have a dual root, dual boot and dual environment plus an encrypted data partition. For this to work we also have to switch to using the gpt partition table as there are too many partitions for the mbr configuration.

If that would be useful I can provide the patches I use to do this (note I have to manually apply these before running a build as they modify the toradex layers directly). I do have an old post here where these changes were rejected by toradex as they were made for kirkstone which is not supported anymore. However, I have updated them to work for scarthgap now. I can post my patches here tomorrow when back in the office if that would be useful? Also I can find the link to the old post if you find them useful to add your vote to that and maybe help convince toradex dev team that it would be a useful addition to the bsp layer.

Regards,

Izzy

Thanks @izzycoding,

There is an error has appeared while Im use the patch file in the bsp recipes uboot files as in the verdin imx8mp for update the uboot variables via the yocto build,

Error Log for u-boot-toradex:

Sstate summary: Wanted 507 Local 476 Mirrors 0 Missed 31 Current 5677 (93% match, 99% complete)#####         | ETA:  0:00:01
Removing 3 stale sstate objects for arch verdin_imx8mp: 100% |###############################################| Time: 0:00:00
NOTE: Executing Tasks
ERROR: u-boot-toradex-1_2024.07-r0 do_patch: Applying patch '0001-custom-verdin-imx8mp-env.patch' on target directory '/home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/git'
CmdError('quilt --quiltrc /home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/recipe-sysroot-native/etc/quiltrc push', 0, 'stdout: Applying patch 0001-custom-verdin-imx8mp-env.patch
patching file include/configs/verdin-imx8mp.h
Hunk #1 FAILED at 79.
1 out of 1 hunk FAILED -- rejects in file include/configs/verdin-imx8mp.h
Patch 0001-custom-verdin-imx8mp-env.patch does not apply (enforce with -f)

stderr: ')
ERROR: Logfile of failure stored in: /home/hari/oe-core/build/tmp/work/verdin_imx8mp-tdx-linux/u-boot-toradex/2024.07/temp/log.do_patch.36870
ERROR: Task (/home/hari/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex_2024.07.bb:do_patch) failed with exit code '1'

There is an error appeared while using the updated above gien u-boot patch file @ToradexAI.

recipes-bsp u-boot bbappend file:

hari@Administrator:~/oe-core/layers/meta-lokbest/recipes-bsp/u-boot$ ls
files  u-boot-toradex_%.bbappend
hari@Administrator:~/oe-core/layers/meta-lokbest/recipes-bsp/u-boot$ cat u-boot-toradex_%.bbappend
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
SRC_URI += "\
    file://disable-console-logs.patch \
    file://0001-custom-verdin-imx8mp-env.patch \
"
do_configure:append() {
    # Set boot delay to 0 for fast boot
    if grep -q "#define CONFIG_BOOTDELAY" ${S}/include/configs/verdin-imx8mp.h; then
        sed -i 's/#define CONFIG_BOOTDELAY.*[0-9]/#define CONFIG_BOOTDELAY 0/' ${S}/include/configs/verdin-imx8mp.h
    else
        echo "#define CONFIG_BOOTDELAY 0" >> ${S}/include/configs/verdin-imx8mp.h
    fi
    # Modify setupargs to remove console=tty1
    if grep -q "console=tty1" ${S}/include/configs/verdin-imx8mp.h; then
        sed -i 's/console=tty1 console=/console=/' ${S}/include/configs/verdin-imx8mp.h
    fi
    # Override setupargs to remove console=tty1
    if ! grep -q '"setupargs=console=${console}\\0"' ${S}/include/configs/verdin-imx8mp.h; then
        sed -i '/tdxargs=/a\\t"setupargs=console=${console}\\0" \\' ${S}/include/configs/verdin-imx8mp.h
    fi
    # Override the setup command to exclude console=tty1
    if ! grep -q "setup=setenv setupargs console=" ${S}/include/configs/verdin-imx8mp.h; then
        sed -i '/tdxargs=/a\\t"setup=setenv setupargs console=${console}\\0" \\' ${S}/include/configs/verdin-imx8mp.h
    fi
    # Add tdxargs for console configuration if not already present
    if ! grep -q "tdxargs=" ${S}/include/configs/verdin-imx8mp.h; then
        sed -i '/initrd_high=0xffffffffffffffff\\0/a\\t"tdxargs=quiet loglevel=0 vt.global_cursor_default=0 vt.default_redraw=0 consoleblank=0\\0" \\' ${S}/include/configs/verdin-imx8mp.h
    fi
    # Remove existing fdtfile, if there is one
    sed -i '/"fdtfile=.*\\0" \\/d' ${S}/include/configs/verdin-imx8mp.h
    # Add new fdtfile for Ivy carrier board
    sed -i 's/\("fdt_board=.*\\0" \\\)/\0\n      "fdtfile=imx8mp-verdin-wifi-ivy.dtb\\0" \\/' ${S}/include/configs/verdin-imx8mp.h
}

Patch File for 0001-custom-verdin-imx8mp-env.patch:

hari@Administrator:~/oe-core/layers/meta-lokbest/recipes-bsp/u-boot/files/verdin-imx8mp$ ls
0001-custom-verdin-imx8mp-env.patch  disable-console-logs.patch  fast-boot-config.patch
hari@Administrator:~/oe-core/layers/meta-lokbest/recipes-bsp/u-boot/files/verdin-imx8mp$ cat 0001-custom-verdin-imx8mp-env.patch
--- a/include/configs/verdin-imx8mp.h
+++ b/include/configs/verdin-imx8mp.h
@@ -79,6 +79,7 @@
        "bootcmd_mfg=fastboot 0\0" \
        "boot_file=Image\0" \
        "boot_scripts=" BOOT_SCRIPT "\0" \
        "boot_script_dhcp=" BOOT_SCRIPT "\0" \
        "console=ttymxc2\0" \
        "fdt_board=dev\0" \
+       "fdtfile=imx8mp-verdin-wifi-ivy.dtb\0" \
        "initrd_addr=0x43800000\0" \
        "initrd_high=0xffffffffffffffff\0" \
+       "tdxargs=quiet loglevel=0 vt.global_cursor_default=0 vt.default_redraw=0 consoleblank=0\0" \
+       "bootfs_a_part=1\0" \
+       "bootfs_b_part=2\0" \
+       "rootfs_a_part=3\0" \
+       "rootfs_b_part=4\0" \
+       "rootfs_r_part=7\0" \
+       "active_bootfs=A\0" \
+       "active_rootfs=A\0" \
+       "recovery_rootfs=\0" \
+       "ota_update=\0" \
+       "select_bootfs=if test \"${active_bootfs}\" = \"B\"; then setenv distro_bootpart ${bootfs_b_part}; else setenv distro_bootpart ${bootfs_a_part}; fi\0" \
+       "select_rootfs=setenv root_part; if test \"${recovery_rootfs}\" = \"R\"; then if part uuid mmc ${devnum}:${rootfs_r_part} uuid; then setenv root_part ${rootfs_r_part}; else setenv recovery_rootfs; fi; fi; if test -z \"${root_part}\"; then if test \"${active_rootfs}\" = \"B\"; then if part uuid mmc ${devnum}:${rootfs_b_part} uuid; then setenv root_part ${rootfs_b_part}; else setenv active_rootfs A; setenv root_part ${rootfs_a_part}; fi; else if part uuid mmc ${devnum}:${rootfs_a_part} uuid; then setenv root_part ${rootfs_a_part}; else setenv active_rootfs B; setenv root_part ${rootfs_b_part}; fi; fi; fi\0" \
+       "rootfsargs_ro=part uuid mmc ${devnum}:${root_part} uuid && env set bootargs ${tdxargs} root=PARTUUID=${uuid} ro rootwait console=${console},${baudrate}\0" \
+       "rootfsargs_rw=part uuid mmc ${devnum}:${root_part} uuid && env set bootargs ${tdxargs} root=PARTUUID=${uuid} rw rootwait console=${console},${baudrate}\0" \
+       "rootfsargs_set=if test \"${recovery_rootfs}\" = \"R\"; then run rootfsargs_ro; else run rootfsargs_rw; fi\0" \
+       "custom_scan_dev_for_boot_part=run select_bootfs; setenv kernel_loaded 0; run scan_dev_for_boot; if test \"${kernel_loaded}\" != \"1\"; then if test \"${active_bootfs}\" = \"A\"; then setenv active_bootfs B; setenv distro_bootpart ${bootfs_b_part}; else setenv active_bootfs A; setenv distro_bootpart ${bootfs_a_part}; fi; saveenv; setenv kernel_loaded 0; run scan_dev_for_boot; fi\0" \
+       "custom_mmc_boot=if mmc dev 2; then devtype=mmc; setenv devnum 2; run select_rootfs; run custom_scan_dev_for_boot_part; run rootfsargs_set; fi\0" \
        "setup=setenv setupargs console=${console},${baudrate} " \
                "consoleblank=0 earlycon\0" \
        "update_uboot=askenv confirm Did you load flash.bin (y/N)?; " \
@@ -86,6 +105,8 @@
                "setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt " \
                "${blkcnt} / 0x200; mmc dev 2 1; mmc write ${loadaddr} 0x0 " \
                "${blkcnt}; fi\0"
+       "bootcmd_mmc1=run custom_mmc_boot\0" \
+       "bootcmd_mmc2=run custom_mmc_boot\0"

The patch is failing because the line numbers and context don’t match the actual U-Boot source file. You need to create a proper patch based on the actual file structure (1). Here’s how to fix this:

Create a Proper Patch File

First, examine the actual file structure to create a correct patch. Based on the documentation, the U-Boot configuration contains environment variables defined in the header file (2).

Step 1: Remove the conflicting patch and sed commands

Update your bbappend file to remove the failing patch and conflicting sed operations:

File: recipes-bsp/u-boot/u-boot-toradex_%.bbappend

FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

SRC_URI += "\
    file://disable-console-logs.patch \
"

do_configure:append() {
    # Set boot delay to 0 for fast boot
    if grep -q "#define CONFIG_BOOTDELAY" ${S}/include/configs/verdin-imx8mp.h; then
        sed -i 's/#define CONFIG_BOOTDELAY.*[0-9]/#define CONFIG_BOOTDELAY 0/' ${S}/include/configs/verdin-imx8mp.h
    else
        echo "#define CONFIG_BOOTDELAY 0" >> ${S}/include/configs/verdin-imx8mp.h
    fi
    
    # Modify setupargs to remove console=tty1
    sed -i 's/console=tty1 console=/console=/' ${S}/include/configs/verdin-imx8mp.h
    
    # Add custom environment variables to the existing CONFIG_EXTRA_ENV_SETTINGS
    # Find the line with update_uboot and add our custom variables before it
    if ! grep -q "bootfs_a_part=" ${S}/include/configs/verdin-imx8mp.h; then
        sed -i '/initrd_high=0xffffffffffffffff\\0"/a\\t"tdxargs=quiet loglevel=0 vt.global_cursor_default=0 vt.default_redraw=0 consoleblank=0\\0" \\' ${S}/include/configs/verdin-imx8mp.h
        sed -i '/tdxargs=.*\\0"/a\\t"fdtfile=imx8mp-verdin-wifi-ivy.dtb\\0" \\' ${S}/include/configs/verdin-imx8mp.h
        sed -i '/fdtfile=.*\\0"/a\\t"bootfs_a_part=1\\0" \\' ${S}/include/configs/verdin-imx8mp.h
        sed -i '/bootfs_a_part=.*\\0"/a\\t"bootfs_b_part=2\\0" \\' ${S}/include/configs/verdin-imx8mp.h
        sed -i '/bootfs_b_part=.*\\0"/a\\t"rootfs_a_part=3\\0" \\' ${S}/include/configs/verdin-imx8mp.h
        sed -i '/rootfs_a_part=.*\\0"/a\\t"rootfs_b_part=4\\0" \\' ${S}/include/configs/verdin-imx8mp.h
        sed -i '/rootfs_b_part=.*\\0"/a\\t"rootfs_r_part=7\\0" \\' ${S}/include/configs/verdin-imx8mp.h
        sed -i '/rootfs_r_part=.*\\0"/a\\t"active_bootfs=A\\0" \\' ${S}/include/configs/verdin-imx8mp.h
        sed -i '/active_bootfs=.*\\0"/a\\t"active_rootfs=A\\0" \\' ${S}/include/configs/verdin-imx8mp.h
        sed -i '/active_rootfs=.*\\0"/a\\t"recovery_rootfs=\\0" \\' ${S}/include/configs/verdin-imx8mp.h
        sed -i '/recovery_rootfs=.*\\0"/a\\t"ota_update=\\0" \\' ${S}/include/configs/verdin-imx8mp.h
    fi
    
    # Add the complex environment variables
    if ! grep -q "select_bootfs=" ${S}/include/configs/verdin-imx8mp.h; then
        sed -i '/ota_update=.*\\0"/a\\t"select_bootfs=if test \\"${active_bootfs}\\" = \\"B\\"; then setenv distro_bootpart ${bootfs_b_part}; else setenv distro_bootpart ${bootfs_a_part}; fi\\0" \\' ${S}/include/configs/verdin-imx8mp.h
        sed -i '/select_bootfs=.*\\0"/a\\t"select_rootfs=setenv root_part; if test \\"${recovery_rootfs}\\" = \\"R\\"; then if part uuid mmc ${devnum}:${rootfs_r_part} uuid; then setenv root_part ${rootfs_r_part}; else setenv recovery_rootfs; fi; fi; if test -z \\"${root_part}\\"; then if test \\"${active_rootfs}\\" = \\"B\\"; then if part uuid mmc ${devnum}:${rootfs_b_part} uuid; then setenv root_part ${rootfs_b_part}; else setenv active_rootfs A; setenv root_part ${rootfs_a_part}; fi; else if part uuid mmc ${devnum}:${rootfs_a_part} uuid; then setenv root_part ${rootfs_a_part}; else setenv active_rootfs B; setenv root_part ${rootfs_b_part}; fi; fi; fi\\0" \\' ${S}/include/configs/verdin-imx8mp.h
        sed -i '/select_rootfs=.*\\0"/a\\t"rootfsargs_ro=part uuid mmc ${devnum}:${root_part} uuid \\&\\& env set bootargs ${tdxargs} root=PARTUUID=${uuid} ro rootwait console=${console},${baudrate}\\0" \\' ${S}/include/configs/verdin-imx8mp.h
        sed -i '/rootfsargs_ro=.*\\0"/a\\t"rootfsargs_rw=part uuid mmc ${devnum}:${root_part} uuid \\&\\& env set bootargs ${tdxargs} root=PARTUUID=${uuid} rw rootwait console=${console},${baudrate}\\0" \\' ${S}/include/configs/verdin-imx8mp.h
        sed -i '/rootfsargs_rw=.*\\0"/a\\t"rootfsargs_set=if test \\"${recovery_rootfs}\\" = \\"R\\"; then run rootfsargs_ro; else run rootfsargs_rw; fi\\0" \\' ${S}/include/configs/verdin-imx8mp.h
        sed -i '/rootfsargs_set=.*\\0"/a\\t"custom_scan_dev_for_boot_part=run select_bootfs; setenv kernel_loaded 0; run scan_dev_for_boot; if test \\"${kernel_loaded}\\" != \\"1\\"; then if test \\"${active_bootfs}\\" = \\"A\\"; then setenv active_bootfs B; setenv distro_bootpart ${bootfs_b_part}; else setenv active_bootfs A; setenv distro_bootpart ${bootfs_a_part}; fi; saveenv; setenv kernel_loaded 0; run scan_dev_for_boot; fi\\0" \\' ${S}/include/configs/verdin-imx8mp.h
        sed -i '/custom_scan_dev_for_boot_part=.*\\0"/a\\t"custom_mmc_boot=if mmc dev 2; then devtype=mmc; setenv devnum 2; run select_rootfs; run custom_scan_dev_for_boot_part; run rootfsargs_set; fi\\0" \\' ${S}/include/configs/verdin-imx8mp.h
        sed -i '/custom_mmc_boot=.*\\0"/a\\t"bootcmd_mmc1=run custom_mmc_boot\\0" \\' ${S}/include/configs/verdin-imx8mp.h
        sed -i '/bootcmd_mmc1=.*\\0"/a\\t"bootcmd_mmc2=run custom_mmc_boot\\0" \\' ${S}/include/configs/verdin-imx8mp.h
    fi
}

(1)

Clean and Rebuild

Remove the failed patch file and clean the build:

$ rm recipes-bsp/u-boot/files/verdin-imx8mp/0001-custom-verdin-imx8mp-env.patch
$ bitbake -c cleansstate u-boot-toradex
$ bitbake -c cleansstate virtual/bootloader
$ bitbake your-image-recipe

(1)

Key Points

  1. Patch Context: The patch failed because the line numbers and context didn’t match the actual file structure (1)

  2. Environment Variables: U-Boot environment variables are defined in the configuration header files and compiled into the bootloader binary (2)

  3. Incremental Approach: Using sed commands to add variables one by one is more reliable than a large patch (3)

  4. Variable Persistence: Changes made with setenv only affect RAM; use saveenv to make them persistent (1)

The sed-based approach will be more flexible and less prone to context mismatches than patches when dealing with U-Boot environment variable modifications.

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Hello @izzycoding,

once you found the solution post or findout the files for the custom image, and u-boot-initial-env-sd file patch and bbappend file to update the custom configuration in that recipes-bsp in my layer please provide the available patch file for updating it.

Hi @Hariprabhu_13,

If you’re modifying the header file, then I would do it all with patches and not using the do_configure function.

Also, the CONFIG_BOOT.. define can be done by adding a “my_custom_kernal_configure function.cfg” file (you can use any name and just make sure it is in your SRC variable list. That will override any of the kernel definitions. Example can be seen here: Toradex Security Layer - u-boot-hab.cfg

I am guessing that there may also be a priority issue with how the patches are being applied. How did you create the patches? It may be that something else has a patch that is run before yours and means your patch is invalid. After the error occurs, can you cd to the git directory that the error message shows? That is the working directory the build is running in and it should be left in the broken state. From that git directory you should be able to do a ‘git status’ to see what has been modified up to the point of applying your patch. You can then use vi or nano to look at the header file to compare the differences to what you started with.

Hopefully, that can give you a starting point to debug your layer’s patches.

When I get into the office tomorrow I will try to pull out something to show what I have done (it will be stripped down though as our full image customisations are commercial IP).

Regards,

Izzy

Hi @Hariprabhu_13,

Sorry, I got caught up at work yesterday.

Will be going in early on Monday and will get what I can to post here for our custom patches to help.

Regards,

Izzy

Hi @Hariprabhu_13,

u-boot-env-secure.cfg (331 Bytes)
This is the initial u-boot config file I include in the u-boot-toradex bbappend file to ensure I have the BOOTDELAY set correctly (plus a few other config values that are related).

0012-uboot-altbootcmd-config.patch (1.3 KB)
This is the patch I use to modify the env for my custom boot and root partitions and configure the relevant variables to enable my software updates process (added to u-boot-toradex bbappend).

I also do the following in the u-boot-distro-boot bbappend to change the default root partition (reference image used partition 2, but as I have dual boot and dual root partitions my initial root partition is 3).

do_compile:append() {
    sed \
        -e 's#env set root_part 2#env set root_part 3#g' \
        -i boot.cmd
}

The following is added to my u-boot-toradex bbappend to set the relevant fdtfile (note the ${MY_DEV_TREE_NAME} is the variable I set in the local.conf file for the device tree I want to use as I have a cutom one for my carrier board).

do_configure:append() {
    sed -i '/"fdtfile=.*\\0" \\/d' ${S}/include/configs/verdin-imx8mp.h
    sed -i 's/\("fdt_board=.*\\0" \\\)/\0\n      "fdtfile=${MY_DEV_TREE_NAME}.dtb\\0" \\/' ${S}/include/configs/verdin-imx8mp.h
}

0013-Silent-uboot-args.patch (844 Bytes)

u-boot-silent-console.cfg (158 Bytes)
These are the patch and u-boot config I use to enable the silent console (included in u-boot-toradex bbappend). NOTE: you should not need to remove the tty console from the env arguments as once the fuses are set and you blow the secureboot fuse, the meta-toradex-security layer hardening will do that for you.

One other thing to note is I have my security layer that contains these define the layer.conf PRIORITY to be 31 (so it trumps the base layers and my patches are executed at the correct time during the build), but this may be different for your build, so is something you may need to be aware of.

Hopefully these will help with your implementation.

Regards,
Izzy

Hi @izzy_building and @izzycoding,

Thank you very much for sharing the detailed explanation along with the configuration files and patches.

The breakdown of:

  • ‘u-boot-env-secure.cfg’ for BOOTDELAY and related configs
  • ‘0012-uboot-altbootcmd-config.patch’ for custom boot/root partition handling
  • The 'do_compile:append(() modification for changing the default root partition
  • The ‘do_configure:append()’ changes for setting the correct ‘fdtfile’
  • The silent console patch and config
  • The note about layer priority (PRIORITY = “31”)

is extremely helpful and gives me a clear direction for structuring my own implementation.

I will carefully review these changes and align them with my current Yocto setup, especially the bbappend structure and layer priority handling. I’ll also verify how this integrates with my custom device tree and dual root partition setup.

Thanks again for taking the time to share your working approach - this is really valuable.