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