U-Boot is an open source Universal Boot Loader that is frequently used in the Linux community. Xilinx provides a Git tree located at https://github.com/Xilinx/u-boot-xlnx which includes U-Boot to run on Xilinx boards. The Xilinx U-Boot project is based on the source code from http://git.denx.de.

U-Boot Commands

The list of U-Boot commands can be accessed while in the U-Boot prompt. Type "help" or "?" for a complete listing of available commands. Below an example is given:
?       - alias for 'help'
base    - print or set address offset
bdinfo  - print Board Info structure
boot    - boot default, i.e., run 'bootcmd'
bootd   - boot default, i.e., run 'bootcmd'
bootm   - boot application image from memory
bootp   - boot image via network using BOOTP/TFTP protocol
cmp     - memory compare
coninfo - print console devices and information
cp      - memory copy
crc32   - checksum calculation
date    - get/set/reset date & time
echo    - echo args to console
editenv - edit environment variable
erase   - erase FLASH memory
ext2load- load binary file from a Ext2 filesystem
ext2ls  - list files in a directory (default /)
fatinfo - print information about filesystem
fatload - load binary file from a dos filesystem
fatls   - list files in a directory (default /)
fdt     - flattened device tree utility commands
flinfo  - print FLASH memory information
go      - start application at address 'addr'
help    - print command description/usage
iminfo  - print header information for application image
imls    - list all images found in flash
imxtract- extract a part of a multi-image
itest   - return true/false on integer compare
loadb   - load binary file over serial line (kermit mode)
loads   - load S-Record file over serial line
loady   - load binary file over serial line (ymodem mode)
loop    - infinite loop on address range
md      - memory display
mm      - memory modify (auto-incrementing address)
mmc     - MMC sub system
mmcinfo - display MMC info
mtest   - simple RAM read/write test
mw      - memory write (fill)
nfs     - boot image via network using NFS protocol
nm      - memory modify (constant address)
ping    - send ICMP ECHO_REQUEST to network host
printenv- print environment variables
protect - enable or disable FLASH write protection
rarpboot- boot image via network using RARP/TFTP protocol
reset   - Perform RESET of the CPU
run     - run commands in an environment variable
setenv  - set environment variables
sf      - SPI flash sub-system
sleep   - delay execution for some time
source  - run script from memory
sspi    - SPI utility commands
tftpboot- boot image via network using TFTP protocol
version - print monitor version
 
 

Programming QSPI Flash

U-Boot provides the SF command to program serial flash devices. On the ZC702 board you can use the SF command to program a QSPI device. Here is an example of loading an image file to QSPI device.
uboot> sf
Usage:
sf probe [[bus:]cs] [hz] [mode] - init flash device on given SPI bus and chip select
sf read addr offset len         - read 'len' bytes starting at 'offset' to memory at 'addr'
sf write addr offset len        - write 'len' bytes from memory at 'addr' to flash at 'offset'
sf erase offset [+]len          - erase 'len' bytes from 'offset'; '+len' round up 'len' to block size
sf update addr offset len       - erase and write 'len'bytes from memory at 'addr' to flash at 'offset
 
uboot> sf probe 0 0 0
SF: Detected N25Q128 with page size 256, total 16 MiB
16384 KiB N25Q128 at 0:0 is now current device
 
// Detect QSPI Flash parameters
// To make QSPI clock run faster, higher speed can be set to second parameter,
// e.g. setting QSPI clock to 20MHz
// sf probe 0 20000000 0
 
uboot> sf erase 0 0x200000
 
// Erase 2MB from QSPI offset 0x0
// Note: If erase size is less than QSPI Flash page size, u-boot reports erase error
 
uboot> sf read 0x08000000 0 100
 
// Read QSPI Flash from 0x0 to DDR 0x08000000 with 100 bytes
// you can use any location in DDR as destination. make sure it doesnt overwrite u-boot
// code/data area. u-boot is at 0x04000000.
 
uboot> md 08000000
08000000: ffffffff ffffffff ffffffff ffffffff    ................
 
// Display content in memory 0x08000000.
// U-boot by default uses hex
 
 
// load the boot image to DDR
// load method can be KERMIT through UART, XMD dow -data through JTAG, TFTP through Ethernet
// or read from SD Card directly
 
zynq-boot> loadb 0x08000000
 
// load the boot image through KERMIT protocol after this step
// it is assumed that you should have a boot image generated using the bootgen utility
 
## Ready for binary (kermit) download to 0x08000000 at 115200 bps...
## Total Size      = 0x0003e444 = 255044 Bytes
## Start Addr      = 0x08000000
uboot> md 08000000 100
 
uboot> sf write 0x08000000 0 0x3E444
 
// Write from DDR address 0x08000000 to QSPI offset 0 with 0x3E444 bytes of data
 
// U-Boot read command can be used to see what is programmed in to QSPI memory.
// Following is the syntax of the "sf read" command.
 
zynq-boot> sf read  <destination address in RAM> <source address in QSPI> <length of data to read>
 
NOTE: The "destination address" should not be ZERO.
 
Example:
 
uboot> sf read 0x800 0x0 0x2000

Programming NAND Flash

U-Boot provides the nand command to program nand devices. Here is an example of loading an image file to nand device. The command sequence for nand is same as QSPI except the commands.Below nand command sequence for writing an image to nand device. The read command at the end just to ensure the data was written properly and you can use cmp command for comparing written data with original data which was lready present in DDR..
nand info
nand erase <start addr> <size>
 
// Download the image to a location DDR(DDR addr) using tftp and then perform write to nand from that DDR address as shown below.
 
nand write <DDR addr> <start addr> <size>
 
// The nand programming was done wuith the above command but to ensure that it has written successfully just read the written data using the below read command.
// Provide DDR addr different from the above and differ from the above DDR addr at least by the <size> so that we can compare both using cmp command and ensure it was written successfully.
 
nand read <DDR addr> <start addr>

Programming NOR Flash

U-Boot uses the regular memory command to program NOR devices. Here is command sequence of loading an image file to NOR device.
flinfo
erase all
cp.b <DDR addr> <nor addr> <size>.

Authentication and Decryption in zynq u-boot

Zynq U-boot can authenticate and decrypt the partitions before loading them for execution. u-boot initially loads the image to a location to DDR. Then this DDR location was passed as an argument to command “zynqrsa <DDRD addr>” . The whole functionality was implemented under this command so that user can load image to DDR from tftp or anything and then user can provide that address for authenticating that image and then loading that.

The zynqrsa command authenticates or decrypts or both authenticate and decrypt the images and loads to DDR. The image has to be generated using bootgen with proper authentication and encryption keys. The zynq rsa command authenticates or decrypts only the images in which partition owner is mentioned as u-boot while preparing images using bootgen. This will enabled only if we enable the config “CONFIG_CMD_ZYNQ_RSA”. This config also enables the decryption functionality. The Decryption process can also invoked using the command “zynqaes ”. For more details check zynqaes help.

Authentication and Decryption in ZynqMP u-boot

The authentication and decryption functionality present in ZynqMP u-boot can found at page.

U-Boot 14.3 (and newer releases) Specific Details

U-Boot is now by default expecting a uImage Linux kernel image and a ramdisk that is also wrapped with the mkimage utility. It is using the bootm command by default now which also passes the address of the device tree to the Linux kernel. The Linux build process will build a uImage when the uImage target is specified on the make command line.

Mkimage Utility

The mkimage utility is part of U-Boot and is placed in the u-boot/tools directory during the build process. It is used to prepend a header onto the specified image such that U-Boot can verify an image was loaded into memory correctly.

Bootm Command Details
The bootm command has the following format:
bootm <Linux uImage address> <mkimage wrapped ramdisk address> <device tree (dtb) address>
The following U-Boot commands illustrate loading the Linux kernel uImage, a mkimage wrapped ramdisk, and a device tree into memory from the SD card and then booting the Linux kernel.
u-boot> fatload mmc 0 0x3000000 uImage
u-boot> fatload mmc 0 0x2A00000 devicetree.dtb
u-boot> fatload mmc 0 0x2000000 uramdisk.image.gz
u-boot> bootm 0x3000000 0x2000000 0x2A00000
With the bootm command, U-Boot is relocating the images before it boots Linux such that the addresses above may not be what the kernel sees. U-Boot also alters the device tree to tell the kernel where the ramdisk image is located in memory (initrd-start and initrd-end). The bootm command sets the r2 register to the address of the device tree in memory which is not done by the go command.


NOTE: Please note that version that was printed at u-boot manner is the u-boot mainline version that it is based on and not a xilinx specific version.

Supported Drivers list for Zynq and Zynq Ultrascale


Zynq
Zynq Ultrascale
Nand PS driver
Nand PS driver
QSPI driver
QSPI driver
SD/MMC/eMMC driver
SD/MMC/eMMC driver
SPI
SPI
UART
UART
PS GEM
PS GEM
USB2.0 host
USB2.0 host
USB2.0 device
USB2.0 device
GPIO
GPIO
FPGA
FPGA
I2C
I2C
NOR flash
SATA

Release Notes

Platform specific documentation


Related Links

The zynqrsa command authenticates or decrypts or both authenticate and decrypt the images and loads to DDR. The image has to be generated using bootgen with proper authentication and encryption keys. The zynq rsa command authenticates or decrypts only the images in which partition owner is mentioned as u-boot while preparing images using bootgen. This will enabled only if we enable the config “CONFIG_CMD_ZYNQ_RSA”. This config also enables the decryption functionality. The Decryption process can also invoked using the command “zynqaes ”. For more details check zynqaes help