Skoll, Microblaze and Linux: How to run Linux on Skoll Kintex 7 FPGA Module

April 21, 2016

Introduction

FPGAs are best known their flexibility and versatility. Such flexibility allows FPGAs not only be used for custom logic circuits but also implement a processor on it and even run Linux (or other operating systems for that matter!) on the processor! The possibilities are only limited by imagination! (err, and also by FPGA speed grade and size). This article will discuss how to create/implement Microblaze processor and run Linux on Skoll Kintex 7 FPGA Module. This series is based on our previous article series for Saturn Spartan 6 FPGA Module. So we highly recommend that you read the series for Saturn and get yourself familiar with the steps. So let’s dive right in.

Structure:

This article is structured into 4 sections.

  • Section I: Creating the Microblaze based design for Skoll
  • Section II: Generating Device Tree
  • Section III: Building Linux Image
  • Section IV: Running Linux on Skoll

Prerequisites:

For following this article, you would need these:

  • Hardware:
    1. Skoll Kintex 7 FPGA Module
    2. Xilinx Platform Cable JTAG debugger.
  • Software:
    1. Xilinx Vivado installed on either Windows or Linux system
    2. Linux system (author used Ubuntu 14.04 64-bit on a Virtual Machine
  • Good internet connectivity

Creating the Microblaze based design for Skoll

Creating a Microblaze based design for Skoll is very straight forward. Detailed steps for creating a Microblaze design is available in this article. Please read through this article and follow the steps to create a vanilla Microblaze based design and make sure the Memory Test program runs and passes all tests.

We will be modifying the design created above to run our Linux system. Open the block design created above, and double click on the Microblaze block. We need to modify this IP block to be able to run Linux on our board.

Skoll_Linux_1_Microblaze_MMU

Choose “Linux with MMU” configuration as shown in the image above.

We also have to increase the baudrate of UART. Double click on “uartlite” IP and change its baudrate to 115200.

Skoll_Linux_2_uartlite_115200

Now, we are ready to build our Linux capable design. Click “Generate Bitstream” and click “Yes” when it asks for running Synthesis and Implementation before that.

Once the bitstream is successfully generated, export the hardware along with bitstream. We will launch SDK later in next section.

Generating Device Tree

Having completed all the steps before, now download the device-tree repository from Xilinx’s github account: https://github.com/Xilinx/device-tree-xlnx.git . If you have downloaded the zip, extract it in the same location as your SDK workspace. In case of the author, the directory structure was “E:\Skoll\Skoll_Microblaze\Skoll_Microblaze.sdk\device-tree-xlnx-master\”.

Step 1: In Vivado, select File -> Launch SDK. This opens the Xilinx SDK

Step 2: In SDK, go to Xilinx Tools -> Repositories.

Skoll_Linux_3_repositories

Step 3: In the Dialog window, we have a section named “Local Repositories”.  Select “New” and select the device tree folder which you had downloaded and extracted to SDK workspace. Final result should look like in the below image.

Skoll_Linux_4_repositories_new

Step 4: Go to File -> New -> Board Support Package. In the Dialog window, select “device_tree” under “Board Support Package OS” and press “Finish” and then “OK” in another dialog that opens.

Skoll_Linux_5_device_tree_bsp

This should generate a system.dts file along with a .dtsi file. We need both of them

Skoll_Linux_6_device_tree_files

Step 5: We have to merge the ‘.dtsi’ and ‘.dts’ files. So open both of them in some text editor (Notepad++ etc) and copy the contents of system.dts and paste them in the .dtsi file just after the line ” model = “Xilinx MicroBlaze” .  Don’t forget to add “/dts-v1/;” at the top of .dtsi file also. The final content should look like this:

Now, save this modified file as “skollkintex7.dts”. And copy “skollkintex7.dts” file to your Linux System.

Building Linux Image

Now we need a Linux system for performing next steps. The author used Ubuntu 14.04 64-bit for his work.

Step 1: On a clean Ubuntu 14.04 installation, you will need a few packages to make Buildroot work. Run the following command to install those:

Step 2: Now create a convenient folder on your Linux machine and ‘cd’ to that folder. The author created “SkollLinux” directory inside his “home” directory. Now, download buildroot to that folder, either manually or using below command:

Skoll_Linux_8_download_buildroot

You can use latest buildroot release instead of the above. Now, extract the downloaded tarball archive using following command:

All files should be extracted to the folder “buildroot-2015.11”

Step 3: Now download the Linux Kernel defconfig file for Skoll from here and place it under the directory “buildroot-2015.11/board/numato/skoll/” You will need to create respective directories named “numato” and “skoll”. Now copy the “skollkintex7.dts” to the same folder as well. Now, also download buildroot defconfig file “numato_skoll_defconfig” from here and copy it to the “configs” folder inside buildroot root directory (ie. “buildroot-2015.11/” ) Please note the kernel base address is set to 0x80000000 in the Linux kernel defconfig file. Please change it appropriately if the DDR3 base address is different in your Vivado project.

After setting up buildroot as mentioned above, execute the following commands at the buildroot root directory:

This will create a .config file for buildroot. Next, type:

This command will build the kernel and its file system. This downloads the kernel sources and lots of other tools from internet. It will take some time to finish building the kernel image, from 30 minutes to over an hour, or even more, depending on your machine’s capabilities and your internet speed.

Upon completion, this step creates a “simpleImage.skollkintex7” linux image in the directory “buildroot-2015.11/output/images/”. This is the Linux kernel with a root file system (initramfs) attached to it. We will use this file to boot Linux on Skoll Kintex 7 FPGA Module.

Running Linux on Skoll

Step 1: Copy the Linux image and place it in a convenient directory and open Xilinx SDK. Connect the Xilinx Platform Cable to the Skoll FPGA Module and power it up. Make sure the FT2232’s channel B is configured for RS232. Open any Serial terminal program (Putty, TeraTerm etc) and connect to Skoll at 115200 baudrate.

Step 2: Run “Hello World” program again in SDK to make sure everything is connected properly and works. Now, open Xilinx XMD and type the following:

If the xmd successfully connects to microblaze running on Skoll, it will show output similar to this:

Skoll_Linux_9_xmd_connect

We’ll download the kernel image on to FPGA, before which you need to make sure the image is placed at location where SDK project files are located. Navigate to the correct folder where image file is located. Use cd command to change directory as necessary. Finally in the correct directory, type:

Skoll_Linux_12_xmd_run_kernel

Wait for download to complete. If the image is successfully downloaded, continue the processor from DDR3’s address. In author’s case it was:

If all the steps so far went as planned, you should see Linux booting in the serial terminal as shown below:

Skoll_Linux_11_kernel_running

You can login to Linux with username “root” and password as “skoll”. Now we have a successfully running Linux kernel in Skoll Kintex 7 FPGA Board! Congratulations! In the next article we will see how to flash kernel image to the onboard SPI Flash on Skoll!

Was this helpful?

Leave A Comment

*
*