Overview

U-Boot is the bootloader used to boot RTEMS and Linux on the DAT Zynq development platforms.  This currently includes the Zedboard, Xilinx ZC702, and the SLAC RCE.

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 used as the base for the DAT RCE specific modifications comes directly from the Xilinx open source repository.

The development implementation resides in /afs/slac/g/cci/package/u-boot-xlnx and is based on the xilinx-v14.6.01 tag.

To build the default Zedboard configuration:

setenv CROSS_COMPILE arm-xilinx-eabi-
cd u-boot-xlnx
make zynq_zed_config
make all

or

cd u-boot-xlnx
setenv CROSS_COMPILE arm-xilinx-eabi-
make ARCH=arm zynq_zed

The current production U-Boot installation is located at /afs/slac/g/cci/package/u-boot-xlnx

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
  • Loading of the zynq fpga fabric.
  • Configuration of the in memory BSI structure.
  • Configuration of the network switch (DTM only)
  • Booting RTEMS images using the elf loader.

The uboot.env file is distributed with each SD card image.
The mac address stored in the U-Boot environment will be used for booting RTEMS and Linux.

Source Additions

The following files were updates to support reading of the mac address from the BSI structure:

  • board/xilinx/zynq/rce.c/.h: Contains routines for BSI and switch initialization.

Source Changes

The following initial changes to U-Boot source code were required:

  • include/configs/zynq_common.h: Added configuration defines. Updated default configuration.
  • sdhci.c: Modification of MMC controller driver timeout values
  • env_fat.c: Update to FAT driver file buffer alignment
  • board/xilinx/zynq/Makefile: Updated to support usage of DAT shareables.
  • board/xilinx/zynq/board.c: Updated board_late_init() to get environment variables, load the fpga fabric, and execute RCE initialization.

Additional modifications to the SD driver source were made to optimize performance:

  • drivers/mmc/mmc.c
  • drivers/mmc/sdhci.c
  • drivers/mmc/zynq_sdhci.c
  • include/mmc.h

RCE Core Libraries

U-Boot includes several header files and libraries built from a workspace.

  • map/Lookup.h
  • map/MapAxi.h
  • map/MapOcm.h
  • bsi/Bsi_Cfg.h
  • bsi/Bsi.h
  • boot/cm.h
  • build/arm-eabi-rceCA9-opt/lib/libboot.a - DTM bootloader switch manager
  • build/arm-eabi-rceCA9-opt/lib/libport.a - Firmware port library (for BSI FIFO)

U-Boot writes values to the BSI space to report completion of stages in the boot process.

When compiling U-Boot, the DAT_ROOT environment variable must be set to a production workspace.

The two archive libraries listed above must be built prior to compiling U-Boot.

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"
  • FPGA_BIT_FILE "fpga.bit"
  • FPGA_LOAD_ADDR 0x1000000
  • FPGA_LOAD_ADDR_STR "0x1000000"

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 zynq_rce was created specifically for the DAT RCE board.  

Once all modifications have been made, build the DAT RCE U-Boot image:

cd u-boot-xlnx
make zynq_rce_config - for DAT DTM/DPM hardware
make zynq_zed_config - for Zedboard
make zynq_zc70x_config - for Xilinx eval zc702
make all

or

cd u-boot-xlnx
make ARCH=arm zynq_rce - for DAT DTM/DPM hardware
make ARCH=arm zynq_zed - for Zedboard
make ARCH=arm zynq_zc70x - for Xilinx eval zc702

The output elf file produced by U-Boot is called u-boot. For use with the DAT build system, the output file needs to be renamed appropriately, based on the build target:

for zynq_rce
cp u-boot u-boot_rce.elf
for zynq_zed
cp u-boot u-boot_zed.elf
for zynq_zc70x
cp u-boot u-boot_zc70x.elf

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

Each SD card is distributed with boot.bin in the boot partition. This file contains the first stage bootloader (fsbl) and the U-Boot image. The fsbl is executed immediately after a reset or power on, followed by the U-Boot elf image.

At U-Boot startup, the mac address written to the BSI 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.

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:

devicetree_image=devicetree.dtb
kernel_image=uImage
ramdisk_image=uramdisk.image.gz

Boot Linux using the appropriate arguments to the run command

run sdboot_linux
run sdboot_ramdisk

Setting the default SD boot mode by updating the modeboot environment variable is currently TBD.

Booting RTEMS

The default RTEMS elf image urtems.elf is located on partition 5 of the SD media.

All RTEMS elf images must first be wrapped in a U-Boot header.

The DAT build system produces a U-Boot header wrapped RTEMS kernel image during compilation:

udbi.2.3.prod.elf
udbi.2.3.devel.elf
udbi.2.3.rescue.elf

When updating urtems.elf, one of these images should be copied to the SD card as urtems.elf.

Use the following command to manually create the wrapped RTEMS image.

/u1/reg/package/u-boot-xlnx/tools/mkimage -a 0x3000040 -e 0x104200 -C None -A arm -T kernel -O rtems -n dbi.2.3.devel -d ${DAT_ROOT}/build/platform/bin/arm-rtems-rceCA9-opt/dbi.2.3.rescue urtems.elf

The RTEMS elf image can be booted via U-Boot by executing:

run sdboot_rtems

Booting from NFS

It is possible to convince U-boot to load the system image from NFS on a zedBoard or a zc702.  To do so, reset the board (using xmd or something else) and when the U-boot console says to "hit any key to stop autoboot", do so.

Set the following variables at the U-boot prompt:

setenv nfsboot_rtems echo Copying RTEMS from NFS to RAM... && nfs 0x3000000 /nfsexport/<wherever> && bootelf -p 0x3000000
setenv serverip <ip_of_rdsrv101_on_network>
setenv modeboot nfsboot_rtems
setenv ipaddr <your_board's_ip>
saveenv

  • serverip is the address of rdsrv101 on the same network your board is on.  (172.21.7.9 or 172.21.7.73 or 172.21.7.137 or 172.21.12.9)
  • The images booted this way are the "unwrapped" images.  If you wish to boot a "wrapped" image, replace "bootelf -p" with "bootm"
  • No labels