To run a kernel on a piece of hardware, you need several tools and a stable environment to do your job in.
Here is my tool lists, with a hyperlink so that you may easy to download them and repeat my job
Let’s just begin with environment.
I recommend doing your entire job in Linux OS. To compile a linux kernel in a linux environment is the safest way to do, and fastest.
There are plenty of distributions for Linux out there for you to choose.
According to my experience with different distributions, here is my recommendation:
1. RHEL/CentOS 5.x or 6.x
Although in different names, RHEL (RedHat Enterprise Linux) and CentOS are basically the same. They share same rpm repositories, same kernel version, just named differently.
It is the environment that is most stable and hardly ever goes wrong. It may be a little bit slow to run on your laptop, but it’s the first choice for a beginner.
I know a lot of people who are fond of Ubuntu, because of its glorious desktop. As more and more people are switching to it, it has a great support community on-line. You can easily find any solution to your problem. If you want a linux system on your personal laptop, it will be a good choice.
For people who have experience with Linux, I would like to recommend Debian. I am personally fond of Debian, because of its speed in compilation. Debian is the fastest system for software compilation. It takes one thirds time to compile a kernel than Fedora. However, as not many people work on it, you may need to solve your problems alone. So, if you are a linux guru, pick this one
Another important thing to mention is that you’d better have enough space to build your kernel source. Xilinx Tools may cost you about 10GB of your file system and the kernel source folder after compilation will cost 1GB. When you have more than one kernel sources in your system… that’s quite a lot space…
There is a saying that if you want to do a job right, you need to find proper tools. Here is what you need to build kernel on your FPGA board.
1. Xilinx Design Suite
That’s definitely what you need to build up an microblaze system on your FPGA and that’s the piece of hardware you will run you kernel on.
The version of Xilinx DS I recommended currently are 12.4 or 13.2.
It can be downloaded from http://www.xilinx.com
Well, I have to say, the installation package gets bigger and bigger these days… You’d better have enough space for that.
2. Cross-compilation Tool Chain
As you are going to compile linux kernel for Xilinx Microblaze instead Intel CPU, you need a cross-platform compilation tool chain to do the work for you. The reason that they are named “cross-compilation” is that they themselves run on x86 or x64 systems while their output binaries run on other platforms.
For cross-compilation tool chain we use here, there are two places you may get them:
These gnu compilation collection work for microblaze (Big-Endian) by default. If your design is an AXI based system, you need to add –mlittle-endian to compilation flags and –EL to link flags.
b> They are available at http://git.xilinx.com
You may download and compile them for your own system.
3. Kernel Resource
Actually, xilinx open source wiki keeps a neat and clean tree for linux kernel. the source files can be download at: http://git.xilinx.com
For details, you may refer to xilinx open source wiki at http://xilinx.wikidot.com
4. Device Tree
To make your kernel know about your hardware, especially how the virtual memory of CPU are organized and which part of physical memory each peripheral device locates at, you need device tree to get all these information for kernel. The device tree for Xilinx EDK is available at: http://git.xilinx.com . It will generate a dts file for your hardware automatically and checks out the necessary peripheral devices necessary for linux kernel.
Requirement on Hardware
For the hard ware system you want to run linux on, here are a set of things you have to instantiate in your design:
1> a memory over 10 MBytes.
You need space to hold kernel image and stacks for processes. However, I am still checking on the exactly minimum size of memory needed.
2> Interrupt controller
You definitely need this. This is how OS interface with outside world and avoids busy waiting.
Without timer, OS cannot do scheduling.
This is the easiest way to interact with your kernel, and see what’s going on.
5> you may add other ip cores you want or your custom ones.
Besides all these peripherals, you also need to configure microblaze.
1> Enable MMU
In early days, embedded linux system always claim that a kernel without MMU is its advantage, as it runs fast and works tight with hardware registers underneath. However, as embedded systems run faster, embedded OS’s are able to provide better memory management functionalities to user processes. As stated clearly on xilinx open source wiki, MMU is required with 2 protection zones available.
cache is needed for synchronous SRAM or SDRAM to make the system run faster.
3> FPU, MULT, SHIFT, etc.
add and configure as you like. Certainly, they can be helpful.
After settle down all these, you can begin to build your kernel for your hardware now.