[Notice: This guide is outdated, but works. I will upload
a guide for newer sources sometime in the future!]
Before we start
Disclaimers: I am sharing what works for me. It may not work for you or it may fail over time. You may suffer data loss or worse. I disclaim all warranties and representations.
This guide is based on the one from digilent which you can find here, and the one from Jan Gray
which you can find here.
For this guide I used an Arch GNU/Linux x86_64 box and the Xilinx ISE Design Suite, version 14.7 which you can get from
here.
This guide will probably work on any GNU/Linux box which can run the Xilinx tools, but I can’t guarantee anything. If you
are using another os, it will probably work with some modifications, but I can’t guarantee that either.
In this post I will guide you through the process of getting a headless Linaro GNU/Linux system running on the ZedBoard. For those of you not familiar with the ZedBoard, which I highly doubt
since you are here, read this.
So, why run Linaro on Zedboard?
Well, there are two main reasons for that:
Linaro comes with a working gnu toolchain so you can actually build and debug directly on it, without the need of your main workstation.
As it is based on Ubuntu, you can have access to the large collections of programs in its repos, making the customization of the system a lot easier.
What we’re going to build
An XPS design for ZedBoard, which we’ll export to the SDK.
A u-boot.elf (Linux boot loader).
An FSBL (first stage boot loader) using the SDK.
The linux kernel.
A devicetree blob named devicetree.dtb.
A FAT32 partition on our SD card that comprises these files BOOT.BIN, uImage, and devicetree.dtb.
An ext4 partition on our SD card with the pre-built Linaro Ubuntu userland .
Prerequisities
Just make sure ISE 14.7 w/ EDK is there and working.
Prepare the SD card
To boot the system on the ZedBoard you’ll need a SD memory card. The SD card should have at least 4 GB of storage and it is recommended to use a card with speed-grade 6
or higher to achieve optimal file transfer performance. The SD card needs to be partitioned with two partitions. I suggest to make the first one be about 256MB in size and the second one
should take up the remaining space. For optimal performance make sure that the partitions are 4MB aligned. The first partition needs to be formatted with a FAT filesystem. It will
hold the bootloader, devicetree and kernel images. Name it ZED_BOOT. The second partition needs to be formatted with a ext4 filesystem. Name it ROOT_FS. It will store the systems root filesystem.
Use whatever tool you want to do it :-).
Building the programmable logic hardware
Download the reference design for ZedBoard from here.
Create a folder named tutorial.
1
$ mkdir tutorial
Change folder to tutorial.
1
$ cd tutorial
Unzip the file you download above, in here.
1
$ unzip ../ZedBoard_Linux_Design.zip .
Change folder to ZedBoard_Linux_Design.
1
$ cd ZedBoard_Linux_Design
Open system.xmp file in hw/xps_proj with xps.
1
$ xps hw/xps_proj/system.xmp &
Click yes when asked to upgrade cores to newer version.
Click Generate BitStream and start making fun of windows l-usersplay some ksp
work-ahead on the u-boot and linux kernel steps below, while you check back on the progress on this step. When it’s finished, check if there are no errors and
pretend you don’t see the warnings.
Click Export Design. Select Export and Launch SDK. (Continued below.)
Build u-boot, the Linux boot-loader
If you have properly installed the ISE suite in your box, you should already have the ARM cross compile toolchain installed, which will work just fine.
Fetch the source:
1
$ git clone https://github.com/Digilent/u-boot-digilent.git ../u-boot-digilent ; cd ../u-boot-digilent
Build u-boot with the cross-compile tools
12
$ make CROSS_COMPILE=arm-xilinx-linux-gnueabi- zynq_zed_config
Configuring for zynq_zed board...
1
$ make CROSS_COMPILE=arm-xilinx-linux-gnueabi-
After the compilation, the ELF (Executable and Linkable File) generated is named u-boot. We
need to add the ‘.elf’ extension to the file name so that Xilinx SDK can read the file layout and
generate BOOT.BIN. In this tutorial, we are going to move the u-boot.elf to boot_image
folder and substitute the u-boot.elf that comes along with ZedBoard Embedded Linux Design
Package.
This consists of the FSBL (first stage boot loader), the system.bit configuration bitstream, and the U-boot Linux boot-loader u-boot.elf. Follow exactly the instructions.
By now xps should have finished generating the bitstream. So at xps, export the hardware design to Xilinx SDK by clicking on Project -> Export Hardware Design to SDK
Click Export & Launch SDK
Set Workspace to ZedBoard_Linux_Design/hw/xps_proj/SDK/SDK_Export and click ok
After SDK launches, the hardware platform project is already present in Project Explorer on the
left of the SDK main window. We now need to create a First Stage
Bootloader (FSBL). Click File->New->Project
In the New Project window, select Xilinx->Application Project, and then Click Next.
We will name the project FSBL. Select xps_proj_hw_platform for Target Hardware because it
is the hardware project we just exported. Select standalone for OS Platform. Click Next.
Select Zynq FSBL as template, and click Finish
For the ZedBoard, we need to reset the USB PHY chip by toggling the USB-Reset pin in the FSBL.
Add the following code to main.c of the FSBL project after the line 565
1234567891011121314151617181920212223
/* Reset the USB */
fsbl_printf(DEBUG_GENERAL, "Reset USB...\r\n");
/* Set data dir */
*(unsigned int *)0xe000a284 = 0x00000001;
/* Set OEN */
*(unsigned int *)0xe000a288 = 0x00000001;
Xil_DCacheFlush();
/* For REVB Set data value low for reset, then back high */
#ifdef ZED_REV_A
*(unsigned int *)0xe000a048 = 0x00000001;
Xil_DCacheFlush();
*(unsigned int *)0xe000a048 = 0x00000000;
Xil_DCacheFlush();
#else
*(unsigned int *)0xe000a048 = 0x00000000;
Xil_DCacheFlush();
*(unsigned int *)0xe000a048 = 0x00000001;
Xil_DCacheFlush();
#endif
After you have saved the changes to main.c, the project will rebuild itself automatically. If it does
not rebuild, Click Project->Clean to clean the project files, and Project->Build All to rebuild all
the projects. The compiled ELF file is located in
ZedBoard_Linux_Design/hw/xps_proj/SDK/SDK_Export/FSBL/Debug/FSBL.elf
Now, we have all the files ready to create BOOT.BIN. Click Xilinx Tools -> Create Zynq Boot Image.
In the Create Zynq Boot Image window, choose Create new Biff file and click Browse. Go to tutorial-zedboard/ZedBoard_Linux_Design/boot_image/ path and
type BOOT.bif as the filename you want. It does not yet exist but it will get created.
Next in the Boot image partitions area click add, choose Partition type -> bootloader, add
the FSBL.elf found at ZedBoard_Linux_Design/hw/xps_proj/SDK/SDK_Export/FSBL/Debug/
to the file path and click ok.
Click add again, Partition type -> datafile, add to the file path the system.bit found at
ZedBoard_Linux_Design/hw/xps_proj/SDK/SDK_Export/xps_proj_hw_platform/ and click ok.
Repeat the above, but this time add u-boot.elf found at ZedBoard_Linux_Design/boot_image/.
Finally click Create Image and a file named output.bin is generated in the ZedBoard_Linux_Design/boot_image folder.
Change the name of output.bin to BOOT.BIN and you are done.
12
$ cd ZedBoard_Linux_Design/boot_image
$ mv output.bin BOOT.BIN
Build the Linux Kernel
Get the Linux kernel source code from Digilent git repository. Make sure you are in the tutorial root folder.
We will start to configure the kernel with the default configuration for ZedBoard. The
configuration is located at arch/arm/configs/digilent_zed_defconfig. To use the default
configuration, you can use:
1
$ make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- digilent_zed_defconfig
We will keep the default kernel configuration, so use the command bellow and then just press exit.
1
$ make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- menuconfig
Build the Kernel
1
$ make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi-
After the compilation, the kernel image is located at arch/arm/boot/zImage. Copy it to the boot_image folder.
Copy to the ZED_BOOT partition of the sd card, that has the FAT filesystem, the files BOOT.BIN, devicetree.dtb, zImage that we created before, found in the
ZedBoard_Linux_Design/boot_image folder.
Now it’s time to download the Linaro image, which you can find here.
Create a folder under /tmp named linaro, and copy the zipped Linaro image to it.
Unmount before removing the SD card to make sure all the files have been synchronized to it.
Unmounting /tmp/sd_ext4 may take several minutes, but you must wait to see that umount
returns before removing the SD card.
1
$ umount /tmp/sd_ext4
Everything is ready!!
Booting the SD Card
Once you complete these guide instructions, the SD card will have everything it needs to boot Linux
on the ZedBoard. Complete the procedures in steps 1-7 to test your SD card with the ZedBoard.
Insert the SD card into the ZedBoard.
Set the jumpers on the ZedBoard as follows:
MIO 6: set to GND
MIO 5: set to 3V3
MIO 4: set to 3V3
MIO 3: set to GND
MIO 2: set to GND
VADJ Select: Set to 1V8
JP6: Shorted
JP2: Shorted
All other jumpers should be left unshorted
Attach a computer running a terminal emulator to the UART port with a Micro-USB cable.
Configure the terminal emulator with the following settings:
Baud: 115200
8 data bits
1 stop bit
no parity
Attach a 12V power supply to the ZedBoard and power it on.
Connect to the appropriate port in the terminal emulator. You should begin to see feedback
from the boot process within a few seconds, depending on the speed of the SD card.
Wait for the boot process to complete. If it gets stuck at the u-boot prompt just type reset and it will work.
You now have a complete GNU/Linux system running on the ZedBoard.