Microblaze U-Boot


The purpose of this page is to document the U-Boot Xilinx project for MicroBlaze.

Xilinx provides a Git tree located at git://git.xilinx.com which includes U-Boot to run on Xilinx boards. The Xilinx U-Boot project is based on the source code from git://git.denx.de .

Project goals

Xilinx's goal for U-Boot is to provide a minimal boot loader with which a Linux kernel can be loaded into and booted from memory. This means that a limited number of devices have been tested with U-Boot.

The devices that have been tested include UART lite, UART 16550, Linear flash, EMAC lite, LL TEMAC with PLB DMA, and AXI EMAC with AXI DMA. The timer counter and interrupt controller were also tested.
Tests were done on Spartan 605 (PLB and AXI) and Kintex 705 (AXI) evaluation platforms using XPS 14.2 and 14.3 .

The hardware project


U-Boot requires some minimal hardware configuration. Make sure the following peripherals are included in the system:

Microblaze processor configured for '(Low-end) Linux with MMU'
external memory controller
serial output configured to use interrupts
timer configured to use interrupts
interrupt controller


U-Boot includes capabilities of writing to/reading from flash and also transferring files over a network if the available hardware is present:

ethernet lite configured to use interrupts
ethernet configured to use interrupts and DMA

Additional peripherals and features are considered outside the scope of this page.

Building U-Boot

Creating the BSP required by U-Boot

To build U-Boot correctly, some information about the system will need to be provided to the U-Boot build tree. This information is generated by the U-Boot BSP.

The U-Boot BSP source can be downloaded from this link. Once it has been installed and the project has been exported to SDK, the U-Boot BSP can be created for the system.

In order for the U-Boot BSP to generate the necessary settings for U-Boot, it needs to know which specific peripherals should be used for some corresponding tasks. These selections are made in the fields/drop-down menus located in the 'Settings' of the newly created U-Boot BSP. For example:

Name Value
stdout rs232_uart_1
stdin rs232_uart_1
main_memory ddr2_sdram
flash_memory flash
ethernet hard_ethernet_mac
timer xps_timer_0

Once the U-Boot BSP has been compiled in SDK, the generated files, config.mk and xparameters.h, can be found at <sdk_workspace>/uboot_bsp_0/microblaze_0/libsrc/uboot_v*/ .

Downloading the source tree

The U-Boot source tree can be downloaded from the Xilinx Git server. The repository is u-boot-xlnx and the branch is master:

linux-host> git clone git://git.xilinx.com/u-boot-xlnx.git
linux-host> cd u-boot-xlnx

Compiling U-Boot

The U-Boot compilation will use the definitions and flags defined in config.mk and xparameters.h . Import these two files generated by the U-Boot BSP in SDK into the U-Boot directory for Microblaze located at <u-boot-xlnx>/board/xilinx/microblaze-generic/ .

Xilinx's Microblaze GNU toolchain will be used to cross-compile U-Boot for Microblaze. Instructions on obtaining and setting up the newest cross-compilation toolchain for Microblaze may be found at http://wiki.xilinx.com/mb-gnu-tools .

Now that U-Boot and the toolchain are configured correctly, we can cross-compile U-Boot:

linux-host> cd <u-boot-xlnx>
linux-host> export BUILD_DIR=$PWD/build
linux-host> make microblaze-generic_config
linux-host> make

Loading and running U-Boot

Downloading U-Boot to Microblaze

Once the bitstream containing at least a minimally configured hardware system has been downloaded to the FPGA, XMD is used to download the cross-compiled U-Boot to the Microblaze soft processor:

XMD> connect mb mdm
XMD> dow <u-boot-xlnlx>/build/u-boot
XMD> run

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.

Documentation on U-Boot may be found at http://www.denx.de/wiki/DULG/Manual .

Running Linux using U-Boot

Building the Linux images for U-Boot

Specific details on building the kernel for MicroBlaze are contained here for big endian (PLB) and here for little endian (AXI).

The kernel and the root filesystem must be wrapped with a U-Boot header in order for U-Boot to accept these files. The mkimage utility is used for this purpose, however, it is not part of the Microblaze GNU tools. It is part of U-Boot itself and if U-Boot has been compiled as specified on this page, it will be found under <u-boot-xlnx>/build/tools/ .

When building linux.bin, the kernel build process automatically creates an additional image, with the ".ub" suffix. linux.bin.ub is the Linux binary image wrapped with a U-Boot header. The Linux compilation process will automatically invoke mkimage, therefore, it is important to include the path to the U-Boot tools in the PATH environment variable.

The root filesystem also needs to be wrapped with a U-Boot header as follows:

mkimage -A microblaze -O linux -T ramdisk -C gzip -d ramdisk.image.gz uramdisk.image.gz

Booting Linux

XMD or TFTP may be used to download Linux to the FPGA (memory). U-Boot can then use these files to boot Linux. Once the kernel, root filesystem, and device tree images are present in memory, the command to boot Linux is:

U-Boot> bootm <addr of kernel> <addr of rootfs> <addr of device tree blob (dtb)>

Note: Make sure the kernel and root filesystem images are wrapped by with the U-Boot header. The device tree blob does not need to be wrapped with the U-Boot header.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License