The Board Support Package is composed by a set files, patches, recipes, configuration files, etc. This chapter gives you the information you need when you want to customize something, fix a bug, or simply learn how the all thing has been assembled.
The bootloader used by ZedBoard is u-boot. If you want to browse/modify the sources first you have to get them. There are two viable ways to do that:
Bitbake will place u-boot sources under:
/path/to/build/tmp/work/zedboard_zynq7-poky-linux-gnueabi/u-boot-xlnx/v2013.01-xilinx+gitAUTOINC+20a6cdd301-r1/git
this means that within the virtual machine you will find them under:
/home/architech/architech_sdk/architech/zedboard/yocto/build/tmp/work/zedboard_zynq7-poky-linux-gnueabi/u-boot-xlnx/v2013.01-xilinx+gitAUTOINC+20a6cdd301-r1/git
We suggest you to don’t work under Bitbake build directory, you will pay a speed penalty and you can have troubles syncronizing the all thing. Just copy the sources some place else and do what you have to do.
If you didn’t build them already with Bitbake, or you just want to make every step by hand, you can always get the sources from the Internet by cloning the proper repository and checking out the proper commit:
cd ~/Documents
git clone git://github.com/Xilinx/u-boot-xlnx.git
cd u-boot-xlnx
git checkout 20a6cdd301941b97961c9c5425b5fbb771321aac
and by properly patching the sources:
cd ~/Documents
git clone git://git.yoctoproject.org/meta-xilinx.git
cd meta-xilinx/
git checkout cb7329a596a5ab2d1392c1962f9975eeef8e4576
cd ..
patch -p1 -d u-boot-xlnx/ < meta-xilinx/recipes-bsp/u-boot/u-boot-xlnx/*
Suppose you modified something and you want to recompile the sources to test your patches, well, you need a cross-toolchain (see Cross compiler Section). If you are not working with the virtual machine, the most comfortable way to get the toolchain is to ask Bitbake for it:
bitbake meta-toolchain
When Bitbake finishes, you will find an install script under directory:
Host
path/to/build/tmp/deploy/sdk/
Install the script, and you will get under the installation directory a script to source to get your environment almost in place for compiling. The name of the script is:
environment-setup-armv7a-vfp-neon-poky-linux-gnueabi
Anyway, the environment is not quite right for compiling the bootloader and the Linux kernel, you need to unset a few variables:
unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
Inside the virtual machine, the toolchain is already installed under:
/home/architech/architech_sdk/architech/zedboard/toolchain
In the very same directory there is a file, environment-nofs, that you can source that takes care of the environment for you when you want to compile the bootloader or the kernel
source /home/architech/architech_sdk/architech/zedboard/toolchain/environment-nofs
Ok, now you a have working environment to compile u-boot, just do:
cd ~/Documents/u-boot-xlnx/
make mrproper
make zynq_zed_config
make [-j parallelism factor] all
if you omit -j parameter, make will run one task after the other, if you specify it make will parallelize the tasks execution while respecting the dependencies between them. Generally, you will place a value for -j parameter corresponding to the double of your processor’s cores number, for example, on a quad core machine you will place -j 8.
Once the build process is complete, you will find u-boot file in your sources directory, that’s your binary. However, u-boot file alone is not able to boot the board, you are going to need a First Stage Bootloader and a Bitstream to make the board properly boot.
Like we saw for the bootloader, the first thing you need is: sources. Get them from Bitbake build directory (if you built the kernel with it) or get them from the Internet.
Bitbake will place the sources under directory:
/path/to/build/tmp/work/zedboard_zynq7-poky-linux-gnueabi/linux-xlnx/3.8-xilinx+gitf4ff79d44a966ebea6229213816d17eb472b303e-r1/git
If you are working with the virtual machine, you will find them under directory:
/home/architech/architech_sdk/architech/zedboard/yocto/build/tmp/work/zedboard_zynq7-poky-linux-gnueabi/linux-xlnx/3.8-xilinx+gitf4ff79d44a966ebea6229213816d17eb472b303e-r1/git
We suggest you to don’t work under Bitbake build directory, you will pay a speed penalty and you could have troubles syncronizing the all thing. Just copy them some place else and do what you have to do.
If you didn’t build them already with Bitbake or you just want to do make every step by hand, you can always get them from the Internet by cloning the proper repository and checking out the proper hash commit:
cd ~/Documents
git clone git://github.com/Xilinx/linux-xlnx
cd linux-xlnx
git checkout f4ff79d44a966ebea6229213816d17eb472b303e
and by properly patching the sources:
cd ~/Documents
git clone git://git.yoctoproject.org/meta-xilinx.git
cd meta-xilinx/
git checkout cb7329a596a5ab2d1392c1962f9975eeef8e4576
cd ..
patch -p1 -d linux-xlnx/ < meta-xilix/recipes-kernel/linux/linux-xlnx/libtraceevent-Remove-hard-coded-include-to-usr-local.patch
cp /home/architech/architech_sdk/architech/zedboard/yocto/meta-xilinx/conf/machine/boards/common/zynq_defconfig_3.8.cfg ~/linux-xlnx/.config
Source the script to load the proper evironment for the cross-toolchain (see Cross compiler Section) and you are ready to customize the kernel:
cd ~/Documents/linux-xlnx
make menuconfig
and to compile it:
Host
make -j <2 * number of processor’s cores> uImage
By the end of the build process you will get uImage under arch/arm/boot.
Host
~/Documents/linux-xlnx/arch/arm/boot/uImage
Enjoy!
A Yocto/OpenEmbedded meta-layer is a directory that contains recipes, configuration files, patches, etc., all needed by Bitbake to properly “see” and build a BSP, a distrubution, a (set of) package(s), whatever. meta-xilinx is a meta-layer which defines the BSP for Xilinx devices, ZedBoard included. You can get it with git:
git clone git://git.yoctoproject.org/meta-xilinx.git
cd meta-xilinx/
git checkout cb7329a596a5ab2d1392c1962f9975eeef8e4576
Please, refer to the README file contained inside the meta-layer directory.
The machine name corresponding to ZedBoard is zedboard-zynq7.
The final root file system will be packaged as a .tar.gz file that, at the end of the build process, Bitbake will let you find it under directory:
/path/to/yocto/build/tmp/deploy/images/zedboard-zynq7/
this means that within the SDK the actual path of the directory is:
/home/architech/architech_sdk/architech/zedboard/yocto/build/tmp/deploy/images/zedboard-zynq7/
To deploy the root file system, you are going to need an SD card with two partitions on it.
The first partition must be formatted as FAT16, its size must be sufficient to contain all the following files (64MB are more than enough):
To have a better understanding of those components and how to boot the board please refer to Let’s boot Section.
The second partition, our root file system partition, can be formatted as EXT2.
We assume that the second partition of the SD card gets mounted (in your SDK virtual machine) under:
/media/rootfs
Warning
If that’s not the case for your configuration, please find out what is the proper mounting point for such a partition on your system and replace it in the following instructions.
Untar the file corresponding to your root file system inside such a partition:
sudo rm -rf /media/rootfs/*
sudo tar -xzf /home/architech/architech_sdk/architech/zedboard/yocto/build/tmp/deploy/images/zedboard-zynq7/<image>-zedboard-zynq7.tar.gz -C /media/rootfs/
where <image> is the name of the recipe you used to build your root file system. For example, if you built core-image-minimal-dev with Bitbake, then the name of the tarball will be core-image-minimal-dev-zedboard-zynq7.tar.gz
Important
sudo password is architech