Showing results for 
Show  only  | Search instead for 
Did you mean: 

PetaLinux Image Debug Series: Debugging the Linux Kernel in Vitis

3 0 1,797

In this blog entry we will discuss how we can debug the Zynq® UltraScale™ Linux Kernel images in Vitis™.

In this blog entry I will show how to use PetaLinux 2020.1 to create the Linux images for a Zynq UltraScale device.

This Blog is part of a Series discussing how to debug various components in the Petalinux Images. 

You can find the other entries at the links below:


I have used the ZCU104 board for this demo. However, the steps should be common for all Zynq UltraScale devices.

Creating the Linux Image:

  • petalinux-create -t project --template zynqMP -n linux_image
  • cd linux_image
  • petalinux-config -c kernel
    • Kernel Hacking
      • kernel debug 
      •  Compile time checks and compiler options
        • [*] Compile the kernel with debugging info
  • CPU Power Management --->
    • CPU Idle --->
      • [ ] CPU idle PM support
  • petalinux-build
  • cd images/linux
  • petalinux-package --boot --fpga system.bit --u-boot


Debugging in Vitis:

I find that the easiest way to debug the boot images is to load the boot image onto your SD/QSPI and debug on the running target. 

Launch Vitis, and close the welcome screen.

Create a new Debug Configuration.

Double Click on Single Application Debug:


Set the Debug Type to "Attach to Running Target":

Note: I am also doing a remote connection, so I set this up too.

Select Apply and Debug. This will open the debug perspective.

You should see the Cortex A53 running (our boot image).


Expand the XSCT (Xilinx Software Command-Line Tool) window.

Here, we want to pass the symbol files to the Cortex A53 #0 for the Linux kernel. This is the vmlinux file in the images/linux folder in the petalinux project directory.

We set the symbol files by using the memmap command in XSCT:


Debugging the kernel init:

We can add a breakpoint on the start_kernel function:


We can also get the function address from the symbol file directly:


Then power cycle, and the kernel should boot, and stop at the break-point:


The user can then use the debug functionality to step through the code: