How-To Debug Linux Kernel with Xilinx FPGA

To compile and successfully boot an operating on a piece of hardware is an interesting job. Anyone who is interested in understanding how a computer system work will always find it fascinating to run a full OS kernel on a hardware that you create yourself.

Back to the days when I studied linux kernel in my senior years, the first thing I got to do is to compile a linux kernel on your own laptop. It is very likely that the kernel panics during the boot sequence. Well, as it is the kernel, you have no way to debug but reboot your computer, browse through the internet to see which configuration you missed or misconfigured, reconfigure the kernel, and wait another hour to get it recompiled.

These days, I am trying to run linux kernel on Digilent Atlys FPGA boards (with Xilinx Spartan6 LX45 FPGA on it). With the help of Xilinx Design Suites and the kernel maintained at http://git.xilinx.com. It will be easy to do debug for Linux kernel and understand how the kernel works.

Here is the procedure to follow to debug linux kernel on Xilinx FPGAs:

Ø Start two Xilinx Bash shell. One as a debug port that downloading linux image onto Atlys, while the other as the gdb debugging interface.

Ø Browse to where your linux kernel is located. run xmd.
Connect to atlys board by typing:

% connect mb mdm -cable type xilinx_plugin modulename digilent_plugin

Note: A GDB server will open on localhost:1234 with tcp protocol.

clip_image001[3]

Ø Dowload the kernel image onto FPGA

% dow simpleImage.Atlys_mmu

clip_image002[3]

Ø In the other Xilinx bash shell, go to the root directory of the kernel you built.
Launch mb-gdb by

% mb-gdb -nw vmlinux

clip_image003[3]

Ø Connect to localhost:1234 for remote debug.

(gdb) target remote localhost:1234

clip_image004[3]

Now we have set up the debugging tool chane for Linux Debugging on FPGA.

 

WordPress Tags: MMU,Debug,Linux,Kernel,Xilinx,FPGA,Digilent,Atlys,Microblaze

Advertisements