Linux on MicroBlaze. Part 2

2012-04-30Publicerad av Sven-Åke Andersson


Before we can download and build the Linux image we have to do two things:

  • Generate a device tree file
  • Install the GNU toolchain

The device tree

The MicroBlaze kernel uses a device tree to describes the hardware system such that the kernel can configure itself during boot. We could hand edit the device tree file but a better way is to use a device tree generator. The device tree generator can be pulled from the Xilinx GIT repository at git:// See the following page for more information about the process,

Download the device tree generator


The following command will get the device-tree repository from the Xilinx Git repository:

git clone git://


Generate the DTS file

Starting in EDK 12.4, the device-tree generation was moved from EDK/XPS to SDK. It now must be generated in the SDK which can be launched from the EDK (or other ways). After getting the device tree generator from git://, we will need to unpack and save the 'bsp' directory and contents to any location that can be accessed by the SDK. The SDK requires the user to point it to the directory that contains the bsp folder. From here on we can follow this description to generate the xilinx.dts file. It will end up here:



Download and install the GNU toolchain

The MicroBlaze toolchain contains all of the compiler and support libraries you need to build executables and libraries for a MicroBlaze architecture. Since the MicroBlaze processor is configurable for optimization (variants), both the compiler and support libraries can be configured to make use of architecture specific code through a variants configuration file. For more information see the MicroBlaze GNU Tools page. The following command can be used to get the tools and ramdisk images from the Xilinx GIT server for the little endian (LE) MicroBlaze version used on the SP605 board:

git clone git://



Uncompress the tar file and place the microblaze-unknown-linux-gnu directory on your filesystem as shown in the following command:

tar zxfv microblaze-unknown-linux-gnu.tar.gz

Set the path to access the tools and setup the environment variable for the Linux kernel build process with the following command (added to the .bashrc):

export CROSS_COMPILE=<full_path>/microblaze-unknown-linux-gnu/bin/microblaze-unknown-linux-gnu-  

After unpacking the tar file, the installation looks like this:


Prebuilt ram disk image

A RAM disk is a portion of RAM which is being used as if it were a disk drive. RAM disks have fixed sizes, and act like regular disk partitions. Access time is much faster for a RAM disk than for a real, physical disk. However, any data stored on a RAM disk is lost when the system is shut down or powered off. RAM disks can be a great place to store temporary data. A ramdisk image, initramfs_minimal_le.cpio.gz, is provided in the repository of the Xilinx Git server.
initramfs_minimal.cpio.gz is a prebuilt ramdisk image that Xilinx provides to get us started with a basic or bare bones Linux system. It contains a minimal set of files that are required to boot and run the Linux kernel on MicroBlaze. For a Little Endian MicroBlaze system, Xilinx only provides the minimal image and not one (initramfs_complete.cpio.gz like on the PowerPC Linux kernel) with more libraries or modules added to it for more Linux functionality.


The Linux kernel for MicroBlaze

The following command gets the kernel tree from the Xilinx Git server.

git clone git:// master

Copy the device tree file

The device tree file xilinx.dts must be copied to the following directory in Linux kernel installation:  ..../master/arch/microblaze/boot/dts

Copy ram disk files

The file initramfs_minimal_le.cpio.gz must be copied to the Linux kernel master directory.

Configuring the kernel

Configuration of the kernel is done in the same manner as any other Linux kernel. The kernel should be configured to a known configuration before building it. Here are the commands used:

cd ....../Xilinx/master
make ARCH=microblaze menuconfig

There is a default kernel configuration file provided for the SP605 reference design. To use the default configuration execute the following command:

make ARCH=microblaze sp605_le_defconfig 

Building the Linux kernel

Building the kernel is done using a simple make command. The result of building process is an elf file in arch/microblaze/boot named simpleImage.<dts file name> based on the dts specified. The build process for the kernel searches in the arch/microblaze/boot/dts directory for a specified device tree file and then builds the device tree into the kernel image. We will use the following command to build the ELF file. Note that the <dts file name> does not include the file extension ".dts".

make ARCH=microblaze simpleImage.xilinx

After a few minutes the build has finished. Here are the last lines from the build process.

Configuring the FPGA

To configure the FPGA we start SDK and click the <Program FPGA> button. We add the bitstream file (ise_top.bit), the bmm file (edkBmmFile_bd.bmm) and the simple bootloader (bootloop) and click Program.



Connect a console

We will use gtkTerm as our console program.



Loading the kernel

In XMD, the following commands can be used to load and run the kernel.

cd ....../Xilinx/master
XMD% connect mb mdm


XMD% dow arch/microblaze/boot/simpleImage.xilinx


XMD% run


Booting Linux

The kernel should start booting in less than 20 seconds showing this on the connected console:




More information about the Linux kernel


To find out more about our Linux system we can list some of the files in the proc directory.




Setting up an IP address

Use this command to give an IP address to the SP605 board.

--> ifconfig eth0 <ip address> netmask



Connecting from our host.




Connect via telnet.


Use tftp to copy a file from the host.



BusyBox is a multi-call binary that combines many common Unix utilities into a single executable. Most people will create a link to busybox for each function they wish to use and BusyBox will act like whatever it was invoked as.

We have Linux running in our system. Congratulations!