Customising U-Boot Configurations

In PetaLinux U-Boot has been updated so that it is automatically configured by the Auto-Config framework with the default functionality enabled. Most users' needs should be met by the default U-Boot configuration.

However, if there are required functionality that needs to be enabled within U-Boot, the following section provides details on customising U-Boot.

The U-Boot bootloader supports a comprehensive range of facilities for embedded systems and it is also very configurable. This allows user to enable or disable functionality to suit their target embedded platform.

Within PetaLinux?, U-Boot can be configured as per the normal U-Boot configuration process. Refer to the DAS U-Boot Manual for more information on configuring U-Boot. However, there are some areas that the user needs to be aware of.

Platform Initialisation Script - ub.config

The procedures that U-Boot is to carry out is defined in a configuration file called ' ub.config '. The ub.config file is essentially a script containing commands that U-Boot will execute sequentially.

Below is an example of the "ub.config" file.

echo PetaLogix MicroBlaze-Auto Board Configuration
echo ---------------------------------------------
echo Network Configuration:
set ethaddr 00:0a:35:00:22:04
set ipaddr 192.168.0.10
set serverip 192.168.0.1
set netkargs macaddr=$(ethaddr)

echo MTD Configuration:
set mtdparts physmap-flash.0:256K(boot),256K(bootenv),256K(config),5M(image),2M(spare)
set mtdkargs mtdparts=$(mtdparts)

echo Clobber DRAM Configuration:
set clobstart 0x10000000

echo Bootloader Configuration:
set bootsize 0x40000
set bootstart 0x28000000

echo Kernel Configuration:
set kernsize 0x400000
set kernstart 0x280c0000
set bootargs $(mtdkargs) $(netkargs)

echo Boot Configuration:
set bootcmd bootm $(kernstart)
set bootdelay 4

echo Saving Configurations...
saveenv

echo Configuration Completed

The ub.config file is separated into sections of tasks. There is no restriction on this. However, it will help make the script more maintainable. All commands are executed in sequencial order.

The current ub.config file contain tasks that are common to most embedded system initialisation. Users can expand this file to include many of their more vendor specific tasks or removed the tasks that are unneccessary for their platform. Refer to the Editing ub.config section for more information.

The following describes the common tasks within the ub.config file.

Network Configuration

This section set up the ethernet MAC address, IP address of the target and Network services server IP address. This is to enable U-Boot to initiates binary image download via the TFTP protocol.

This section also construct the MAC address string for the kernel boot argument. This is to allow the bootloader to pass the MAC address to the Linux kernel.

This section can be removed if ethernet support is not required by the target platform.

These parameters are sourced from the System Configuration Network Address Menu.

MTD Configuration

This section sets the MTDPARTS variable. This is used to pass the FLASH partition configuration information to the Linux MTD driver.

This section can be removed if MTD support is not required by the target platform.

These parameters are sourced from the System Configuration Flash Memory Partition Table Menu.

Clobber DRAM Configuration

This section sets the address of the area in DRAM that can be used to store temporary files used during the board initialisation process.

Bootloader Configuration

This section sets the start address and size of the bootloader image.

The start address and size are mapped to the ' boot ' partition start address and size on the FLASH device.

These values are sourced from the System Configuration Flash Memory Partition Table Menu

Kernel Configuration

This section sets the start address and size of the kernel image.

The start address and size are mapped to the ' image ' partition start address and size on the FLASH device.

These values are sourced from the System Configuration Flash Memory Partition Table Menu

Boot Configuration

The Boot Configuration section sets the command to boot the Linux kernel image and the auto-boot delay. This allow U-Boot to automatically boot the kernel if not interrupted for the delay amount of seconds.

The bootdelay value can be changed as per appropriate. However, the bootcmd variable should not be changed unless the user is aware of the implications.

Save Configuration

This section issue the command to save the configurations into the bootenv partition on the FLASH device.

Editing ub.config

The ub.config script is an auto generated file. Hence, changes to this file will be overwritten the next time the build process is being run. However, editing this file is useful when in development stage for testing new functionality.

The ub.config.template file is the template file that should include the final changes. This file is used to generate the ub.config script. Changes made to this file will stay permernant.

The ub.config.template file includes special substitution tags that are used by the PetaLinux scripts to set the appropriate values during the build process. The substitution tags comtains the following syntax.

    @sub_tag@

    where
        sub_tag - The variable tag to substitute.

These tags should not be removed.

Generating ub.config

There is a 2 part process in generating the ub.config.img binary image. They include:

  • Generating ub.config script from ub.config.template
  • Generating ub.config.img binary image from ub.config script.
$ cd petalinux-dist
$ make u-boot image

The ub.config.img file will be located in the following directory.

    petalinux-dist/images

The ub.config.img file is the final image that is used by U-Boot for the platform initialisation procedures.

Customising U-Boot Functionality