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
configuration file located at <plnx-proj-root>/project-spec/configs/u-boot-xlnx/ .
Note:
config.cfg is generated only when 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 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_MEMTESTTip: 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
mtestcommand 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: 20369Important: IfCONFIG_CMD_MEMTESTis 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.