Building stock (Xilinx) Linux For Zynq

Hi Everyone,

Sorry for the delay in posting this, but here is step 4a which is building the stock Linux kernel.  We’ll do the stock Linux kernel first and then move on to the root filesystem, then we’ll come back and build the Xenomai variant for all those who want a real time embedded system.  I’ll add some more pictures to this once I’ve gotten some more time, which is hopefully soon.

Let’s get the Linux kernel source from the Xilinx repo.  Clone the repo:

git clone https://github.com/Xilinx/linux-xlnx.git

This may take a while if you have a slow connection, but once it’s sync’d you now have the Linux kernel source.  If you take a look at the directory in the kernel source <path to kernel source>/arch/arm/configs, we should see all the different configurations we can build.  We are interested in the Zynq ones, we’ll use the xilinx_zynq_defconfig.  Make sure we have exported our CROSS_COMPILER environment variable:

exoport CROSS_COMPILER=arm-xilinx-linux-gnueabi-

Just like when we built u-boot make sure we have the cross compiler in our PATH variable.  Once we’ve done that, we can go ahead and start to compile the kernel, let’s first make sure we have a clean build environment:

make mrproper

let’s configure the kernel to build for zynq:

make ARCH=arm xilinx_zynq_defconfig

If we wanted to build in any custom options we can now run

make ARCH=arm menuconfig

This will run the menuconfig utility and allow us to customize the kernel components we want to build.  If you do run that make sure you’ve saved your changes and once your done run:

make ARCH=arm UIMAGE_LOADADDR=0x8000 uImage

The build should take about 5-10 minutes and once we’re complete we should be able to find the image in linux-xlnx/arch/arm/boot/.

The build may fail if you don’t have mkimage installed so depending on your distro do some searching and find what package you need to install.

So we still have two more steps to complete before we can put this on the sdcard and boot the Zybo.  We need to build a root filesystem and compile the device tree binary blob.  The Linux device tree is extremely interesting and is the way the kernel knows what hardware is present in the system.  It’s worth the time to read up about the Linux device tree, especially if you may be building your own custom board.

If you’d rather build from mainline then check out my post here on how to do that.

 

Helpful Links:

http://www.wiki.xilinx.com/Build+Kernel

http://www.wiki.xilinx.com/Build+Device+Tree+Blob

http://www.wiki.xilinx.com/Build+and+Modify+a+Rootfs

13 thoughts on “Building stock (Xilinx) Linux For Zynq

  1. Hello,
    Thanks so much for the tutorial. I have some problems with the device tree.I’m looking forward to seeing the next step.

  2. Your tutorial gives a very nice starting point for the Zybo. I’m really interested in more. Thanks a lot! -RM

  3. I tried to build kernel for zybo and could not find the zynq-zybo.dts source anywhere on the Digilent or Xilinx git sites. I found friendly hacker on the web, I think he was in Japan who had a link to download from his site. I succesfully compiled the linux-xlnx from xilinx web git and assembled the sd boot partition using the devicetree.dtb generated from zynq-zybo.dts which is compatible with the xilinx linux kernel. I also use the uramdisk.image.gz (it has busybox linux system) from xilinx website. Accidentaly the second partition on the sd card had the debian root filing system as a leftover from my BeagleBoneBlack experiments. I was able to chroot from ZYBO to the debian partition and run the debian successfuly on ZYBO. I have posted the devicetree on “sourceforge.net” just search for zybo there or get “http://sourceforge.net/p/zynqzybodts/files”

  4. Hi there ! Great blog! The tutorials are very helpful. I’m trying something similar on the ZYBO. Waiting for you next post .

  5. Hi Greg,

    Which version of Xilinx tool chain did you use for this tutorial?
    How will the instructions change for 2016.x or later?

  6. I used the Linaro toolchain, you may need to change the CROSS_COMPILE prefix to arm-xilinx-linux-gnueabihf- depending on what the xilinx toolchain is prefix with now. I believe as of 2017 they have moved to use the Linaro toolchains.

Leave a reply to gregger31 Cancel reply