1. Install cross compile tool chain
download xilinx-2011.09-50-arm-xilinx-linux-gnueabi.bin and just run in terminal as follows:
sudo ./xilinx-2011.09-50-arm-xilinx-linux-gnueabi.bin
and it gives some useful information such as how to sovle the dash problem , and you just need to switch to the current mode using the given command and select no .
now it will gives some extra useless query , you just need to make a choice and enter ENTER to continue , keep going .
after that , you will find in your install directory , such as /root/CodeSourgery/... , indeed i just use /opt/cs as the install directory because i hate the long and terrible path , so in the /opt/cs/bin
directory , you will find :
yes , it has installed on the specified path , but when you type
arm-xilinx-linux-gnueabi-gcc -v
you will find the tool chain can not be found , we need to include the current path
into system search path .
sudo gedit /etc/environment
and add /opt/cs/bin into the text :
PATH="/opt/cs/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
make sure you have type : symbol correctly .
after that , we need to source the PATH :
source /etc/environment
then re-type the command to see its version information :
okay ,here we have installed the tool chain correctly .
2. Build the linux kernel
we need to download the source code from xilinx linux : https://github.com/Xilinx
after downloaded , we just decompress , make sure we have the xilinx_zynq_defconfig file , and it‘s the defualt config file for zynq chip .
now we open a terminal and enter the root directory of source tree .
at first , we need to export the ARCH variable into current session :
export ARCH=armexport CROSS_COMPILE=arm-xilinx-linux-gnueabi-
and we can use
echo $ARCHecho $CROSS_COMPILE
to make sure it has been exported normally.
second , we need to import the defualt config from xilinx_zynq_defconfig :
make xilinx_zynq_defconfig
as follows :
and then :
make menuconfig
we get :
this is because the simple UI is based on ncurses interface , and we need to install it before we go ahead .
sudo apt-get install libncurses5-dev
after that , we will see the normal menuconfig UI .
if you have the necessary information of how to config kernel , we can modify the configuration free . now we just skip configuration and using the defualt configuration from xilinx_zynq_defconfig .
select Exit to write the configuraiton into .config file .
Third , we now just build the kernel source :
make UIMAGE_LOADADDR=0x8000 uImage
and waitting for about 20-30 minutes depending on your host performance .
- problem : we maybe find some file missing such as follows :
indeed , i can find the chip.c in tar exploer , but after i decompress it , i can NOT find the chip.c anywhere .
so i need to copy the chip.c into kernel/irq/ directory .
- problem: "mkimage" command not found - U-Boot images will not be built
this is okay , because the application mkimage is built from u-boot . besides , if we need not to use uImage , we just ignore the errors .
if you want to use uImage , please refer to here.