Overview
U-Boot is the bootloader used to boot Linux on the DAT Zynq development platforms. This currently includes the Zedboard, Xilinx ZC702, and the SLAC RCE.
When configured to do so, the Xilinx FSBL will launch the U-Boot elf image located on the first FAT partition on the SD media.
Updates have been made to the default Xilinx U-Boot distribution to support the DAT bootstrap interface (BSI) and the RCE hardware.
Installation
The distribution of U-Boot comes directly from the Xilinx open source repository. The current tag is v14.5, but the head of the repository is current being used.
U-Boot is downloaded from the Xilinx GIT repository. The development implementation resides in /afs/slac/g/cci/package/u-boot-xlnx
git clone git://git.xilinx.com/u-boot-xlnx.git
The the current tag v14.5 does not support the MMC FAT write functionality so the head must be used.
When Xilinx creates a tag that has this required functionality, one would check it out this way:
cd u-boot-xlnx git checkout xilinx-v14.5
To build the default Zedboard configuration:
cd u-boot-xlnx make zynq_zed_config make all
or
cd u-boot-xlnx make ARCH=arm zynq_zed
Modifications
The default U-Boot code and board configuration requires several changes to support the following features:
- Storage of U-Boot environment variables to the MMC FAT partition in a binary file named uboot.env
- Setting of mac address environment variable using the DAT in-memory BSI structure.
- Booting RTEMS images using the elf loader.
The uboot.env file will be created if not already present on the SD media using the saveenv command.
If the BSI structure cannot be found in memory, the mac address found in the U-Boot environment will be used instead.
Source Additions
The following files were update to support reading of the mac address from the BSI structure:
- board/xilinx/zynq/board.c: board_eth_init() to read BSI and setenv ethaddr.
Note that the BSI memory location and structure is hard coded in U-Boot. It is TDB how U-Boot might get this information directly from a DAT header file.
Source Changes
The following changes to U-Boot source code were required:
- sdhci.c: Modification of MMC controller driver timeout values
- env_fat.c: Update to FAT driver file buffer alignment
Configuration Additions
The following additions are required to the default zedboard and zc702 board configuration files:
- CONFIG_ZYNQ_BSI
- CONFIG_ENV_IS_IN_FAT
- CONFIG_SYS_MMC_ENV_DEV 0
- CONFIG_FAT_WRITE
- FAT_ENV_INTERFACE "mmc"
- FAT_ENV_DEVICE 0
- FAT_ENV_PART 1
- FAT_ENV_FILE "uboot.env"
The following additions are required to the default zynq_common board configuration files:
- to update detection of CONFIG_ENV_IS_NOWHERE to allow for CONFIG_ENV_IS_IN_FAT.
- CONFIG_CMD_ELF to support the bootelf command set.
A new configuration will be created for the DAT RCE board.
Limitations
The file uboot.env on the FAT partition, which stores the U-Boot environment variables, can only be located in the root directory.
This is a limitation of the U-Boot FAT file driver which does not support writing to or creation of files that are not located in the root directory.
Consequently, the file must reside along side the FSBL boot.bin and its configuration files.
Running U-Boot
At U-Boot startup, usage of the BSI sourced mac address is output as follows:
DRAM: 512 MiB WARNING: Caches not enabled MMC: zynq_sdhci: 0 reading uboot.env In: serial Out: serial Err: serial Net: bsi mac 08:00:56:00:43:10 Net: Gem.e000b000 Hit any key to stop autoboot: 0 zynq-uboot>
Updates to any environment variables environment can be saved to the SD media using the saveenv command.
If the file uboot.env does not already exist, the saveenv command will create the file in the root directory on the first FAT partition.
zynq-uboot> saveenv Saving Environment to FAT... writing uboot.env done zynq-uboot>
Booting Linux
The Xilinx open source Linux kernel is used along with either a ramdisk image or an ext3 filesystem image.
U-Boot must be configured to locate up to three required files on the SD media. These files include:
- Linux kernel
- Device tree
- Ramdisk
Configuration of the Xilinx Linux kernel, device tree, and file systems will be discussed in the Linux on Zynq Confluence page (TBD)
To boot Linux from an SD card formatted and configured for use with the DAT Xilinx FSBL:
- Copy Linux files to directory 0000000x on the first FAT partition
- Set U-Boot environment to load files from the 0000000x directory by updating variables kernel_image, devicetree_image and ramdisk_image.
devicetree_image=/00000002/devicetree_ramdisk.dtb kernel_image=/00000002/uImage ramdisk_image=/00000002/uramdisk_14.4.image.gz
- Set U-Boot environment to boot from the loaded files by updating or creating sdboot variables.
sdboot_ext3=echo Copying Linux from SD to RAM... && mmcinfo && fatload mmc 0 0x3000000 ${kernel_image} && fatload mmc 0 0x2A00000 ${devicetree_image} && bootm 0x3000000 - 0x2A00000 sdboot_ramdisk=echo Copying Linux from SD to RAM... && mmcinfo && fatload mmc 0 0x3000000 ${kernel_image} && fatload mmc 0 0x2A00000 ${devicetree_image} && fatload mmc 0 0x2000000 ${ramdisk_image} && bootm 0x3000000 0x2000000 0x2A00000sdboot_ext3=echo Copying Linux from SD to RAM... && mmcinfo && fatload mmc 0 0x3000000 ${kernel_image} && fatload mmc 0 0x2A00000 ${devicetree_image} && bootm 0x3000000 - 0x2A00000sdboot_ramdisk=echo Copying Linux from SD to RAM... && mmcinfo && fatload mmc 0 0x3000000 ${kernel_image} && fatload mmc 0 0x2A00000 ${devicetree_image} && fatload mmc 0 0x2000000 ${ramdisk_image} && bootm 0x3000000 0x2000000 0x2A00000
Boot Linux using the appropriate arguments to the run command
run sdboot_ext run sdboot_ramdisk
Setting the default SD boot mode by updating the modeboot environment variable is currently TBD.
Booting RTEMS
An RTEMS elf image can be booted via U-Boot using the bootelf command as follows:
#load elf from nfs to U-Boot memory nfs 0x8000000 /nfsexport/users/smaldona/dat/build/platform/bin/arm-rtems-rceCA9-dbg/dpm.2.2.devel #or load elf file from SD to U-Boot memory fatload mmc 0 0x8000000 /00000001/00000000.elf #boot from memory bootelf -p 0x8000000
There is currently an outstanding issue with the RTEMS network not coming up when booted from U-Boot. This is under investigation.