changing u-boot-initial-env or boot.scr with YOCTO variables

Hi,
i am trying to change videomode setting in u-boot-initial-env or to get it into the bootcmd.
(But also have a few other things for u-boot enviroment.)

Its a YOCTO build based on tdx-reference-minimal-image with tdx-signed class so TDX_SECBOOT_REQUIRED_BOOTARGS is also used.

I expect making a recipe like u-boot-toradex_2024.04.bbappend or some of the suggestions with patches in topics in here, but i was expecting there was an easy way and that some of these variables could be set in local.conf

CONFIG_EXTRA_ENV_SETTINGS = "videomode=video=mxsfb:x:1024,y:60
CONFIG_BOOTARGS +=
CONFIG_BOOTCOMMAND +=

but there is apparently no effect - changing dont even trigger build of a new …Tezi.tar

is that correct or am i setting them wrong ?

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

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


Hello! Thank you for your question.

You are correct in your assessment—U-Boot environment variables, including things like videomode, are not settable via local.conf, and changes to variables like CONFIG_EXTRA_ENV_SETTINGS, CONFIG_BOOTARGS, or CONFIG_BOOTCOMMAND in local.conf will not trigger a new build of U-Boot or update its environment. This is due to how U-Boot handles its environment and board configuration.

How to Modify U-Boot Environment Variables Properly

  1. U-Boot Environment Storage
    The default U-Boot environment is built at compile time—variables are hardcoded into the U-Boot binary and not dynamically set via Yocto configuration files like local.conf.
    More info: Best Practices with U-Boot Environment Variables

  2. How to Change the Default Environment (e.g., videomode)
    If you want to modify variables like videomode or make other environment changes, the recommended approach for Yocto builds is to:

    • Create a .bbappend Recipe for U-Boot
      Name it u-boot-toradex_%.bbappend (for all versions) or u-boot-toradex_<version>.bbappend (for a specific version).

    • Apply a Patch to the Board-Specific U-Boot Configuration
      In your append, add a patch that modifies the relevant board configuration file found in u-boot/include/configs/<board-name>.h.
      Typical environment settings are in a macro such as CONFIG_EXTRA_ENV_SETTINGS.
      See example here:

      #define CONFIG_EXTRA_ENV_SETTINGS \
          BOOTENV \
          MEM_LAYOUT_ENV_SETTINGS \
          "videomode=video=mxsfb:x:1024,y:60\0"
      

      Add or adjust your variables as needed.

    • Rebuild U-Boot
      Your changes will only take effect after building U-Boot and including the new binary in your image.

    • Save the Environment (if changed at runtime)
      If you make changes from the U-Boot prompt, use saveenv to store them:

      setenv videomode 'video=mxsfb:x:1024,y:60'
      saveenv
      

      Environment persistence instructions

Why local.conf Does Not Work

  • local.conf is used by the Yocto build system for generic build configuration and does not have a direct hook into U-Boot environment construction. Any CONFIG_XXX options there will not trigger U-Boot to rebuild or update U-Boot environment defaults.

Next Steps

  1. Create a .bbappend for U-Boot with a patch modifying your board’s config file for environment variables.
  2. Build your image.
  3. Deploy and validate the presence of your environment variables.

References:

Let me know if you need a concrete example or step-by-step instructions for a specific board or variable!

Best regards,
Toradex AI Assistant.