FAQ Hero Banner

The Question and the Answer

Creating a Linux Kernel Image to Boot From the ZC702 SD-Card Slot
Creating a Linux Kernel Image to Boot From the ZC702 SD-Card Slot
Creating a Linux Kernel Image to Boot From the ZC702 SD-Card Slot
Question:

Zynq is right around the corner, can you show how to compile your own Linux image from the Xilinx git repo, and load it onto an SD-Card to be placed into the Xilinx ZC702 board?

Answer:

Zynq is right around the corner, and I figured it would be a good time to show you how to compile your own Linux image from the Xilinx git repo, and load it onto an SD-Card to be placed into the Xilinx ZC702 board.

Note: I am running on a x86 (32-bit) version of Ubuntu 11.10 (3.0 kernel).  I am running in a bash prompt that I have already set to root access with this command:

bash> sudo bash

First, pull down the Linux kernel source from the Xilinx git repo.

bash> git clone git://git.xilinx.com/linux-2.6-xlnx.git

This takes a while - like hours depending on your connection - so go grab some coffee.

Okay, now that we have the kernel source pulled down we will need to compile it for the correct target with the correct peripherals.  That means we need to setup two things: 1) the Architecture will need to be set to ARM, and 2) the peripheral set will need to be set to our actual target, the ZC702 board.

As with before, see post Compiling qemu and zynq-linux, we need to setup a few things before we continue.  First, if you don't have git you need to pull that down:

bash> apt-get install git

Once git is installed we need to install the arm tools:

http://wiki.xilinx.com/zynq-tools

And then we need to setup the environment.  At the time of writing this how-to this was the correct commands to run.  Reference the above wiki link to see if there is any difference.

bash> export CROSS_COMPILE=arm-xilinx-linux-gnueabi- 

bash> export PATH=
/CodeSourcery/Sourcery_CodeBench_Lite_for_Xilinx_GNU_Linux/bin:$PATH

Where for me
was just "/root".

Boom, we're ready to compile the Linux kernel.  See, not so hard right?

Since we are compiling for actual hardware (I KNOW, RIGH!?) we will be running the following command:

bash> make ARCH=arm xilinx_zynq_defconfig

If you remember if we were compiling this for our qemu target, we would be replacing "xilinx_zynq_defconfig" with "xilinx_defconfig" as seen here: http://wiki.xilinx.com/zynq-linux#toc8 .  That command will configure the kernel for our specific platform.  It takes just a minute to run and setup the correct config scripts that will be run during the compile.

Next we just need to run 'make' with our ARCH set to arm.

bash> make ARCH=arm

So let that run for a bit - yes, that means get more coffee.  Once it is finished we are ready to setup our SD-Card with a file system and then load the needed Linux files on to it.

So I am going to assume that I have an SD-Card inserted into the machine and it is ready to be wiped and used solely for our Linux Kernel boot image.  With that said we need to setup our file system on the SD-Card with 'fdisk'.  We will be loading a new FAT32 partition onto the card so that the boot loader on the ZC702 board can read it.  We are assuming that we already have a single partition on the SD-Card - we will just be overriding it with a new FAT32 partition table.

To find our SD-Card we can use the df command:

On my VM my SD-Card is sda

Creating a Linux Kernel Image to Boot From the ZC702 SD-Card Slot