Configuring U-Boot - 2020.2 English

PetaLinux Tools Documentation Reference Guide (UG1144)

Document ID
UG1144
Release Date
2020-11-24
Version
2020.2 English
Universal boot loader (U-Boot) configuration is usually done using C pre-processor. It defines:
Configuration _OPTIONS_
You can select the configuration options. They have names beginning with CONFIG_.
Configuration _SETTINGS_
These depend on the hardware and other factors. They have names beginning with CONFIG_SYS_.
Tip: Detailed explanation on CONFIG_ options/settings documentation and README on U-Boot can be found at Denx U-Boot Guide.

PetaLinux U-Boot configuration is associated with config.cfg and platform-auto.h configuration files which are located at <plnx-proj-root>/project-spec/configs/u-boot-xlnx/ and platform-top.h located at <plnx-proj-root>/project-spec/meta-user/recipes-bsp/u-boot/files/.

For setting U-Boot environment variables, edit CONFIG_EXTRA_ENV_SETTINGS variable in platform-auto.h. Note that platform-auto.h is regenerated each time petalinux-config is run.

CAUTION:
config.cfg and platform-auto.h files are automatically generated; edit them with caution.
Note: config.cfg and platform-auto.h are generated only when petalinux-config > Auto Config Settings > u-boot autoconfig is enabled.

PetaLinux does not automate U-Boot configuration with respect to CONFIG_ options/settings. You can add these CONFIG_ options/settings into platform-top.h file.

Important: If petalinux-config > Auto Config Settings > u-boot autoconfig is disabled, the platform-top.h changes are not reflected directly. To resolve this, see Steps for Managing Image Size.

Steps to add CONFIG_ option (For example, CONFIG_CMD_MEMTEST) to platform-top.h:

  • Change into the root directory of your PetaLinux project.
    $ cd <plnx-proj-root>
  • Open the file platform-top.h
    $ vi project-spec/meta-user/recipes-bsp/u-boot/files/platform-top.h
  • If you want to add CONFIG_CMD_MEMTEST option, add the following line to the file. Save the changes.
    #define CONFIG_CMD_MEMTEST
    Tip: Defining CONFIG_CMD_MEMTEST enables the Monitor Command "mtest", which is used for simple RAM test.
  • Build the U-Boot image.
    $ petalinux-build -c u-boot
  • Generate BOOT.BIN using the following command.
    $ petalinux-package --boot --fsbl <FSBL image> --fpga <FPGA bitstream> --u-boot
    
  • Boot the image either on hardware or QEMU and stop at U-Boot stage.
  • Enter the mtest command in the U-Boot console as follows:
    ZynqMP mtest
  • Output on the U-Boot console should be similar to the following:
    Testing 00000000 ... 00001000:
    						Pattern 00000000 Writing... Reading...Iteration: 20369
    
    Important: If CONFIG_CMD_MEMTEST is not defined, output on U-Boot console is as follows:
    U-Boot-PetaLinux> mtest Unknown command ’mtest’ - try ’help’

    For more information on U-Boot, see https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842223/U-boot.