Kernel debug
This chapter covers the basics of Linux Kernel projects including creating and debugging a static Kernel.
Note:
- To debug Kernel Debugging applications with QEMU emulator, please install the xplor-studio-kernel blueprint first. Please refer to Guidelines for more information.
- In this release, Debugging Kernel feature is only available on Ubuntu.
Create a new project
Select “File > New > C/C++ Project”, choose Linux Kernel Project and Next.
Enter the Project name and select Embedded Linux XploR Toolchain for RISC-V in the Toolchains box, then click Next.
Select Kernel Source Path then click Finish.
Update build settings
With build settings, users can switch from 32 bits to 64 bits as well as different floating point ABI options (except Single Precision). The kernels are specified via those options.
Please refer to the below table to select the correct options for each target.
Platform | Core | Architecture | Floating Point |
---|---|---|---|
QEMU | RISC-V emulator | RV32 | None |
QEMU | RISC-V emulator | RV32 | RVFD |
QEMU | RISC-V emulator | RV64 | None |
QEMU | RISC-V emulator | RV64 | RVFD |
Build project
Warning: The Static Kernel project does not need to be built because the XploR Studio uses a pre-build kernel image for debugging.
Running the kernel with QEMU emulator
Note: XploR Studio does not support to the run Static Kernel project!
Debugging the kernel with QEMU emulator
Note: Before debugging the kernel, the users should select the architecture and floating point options. By default, the combine (RV64, None) is selected. Please refer to Section 2: Update build settings
There are two ways to debug the kernel:
- On the Project explorer, right-click on the project name and select Debug as > RISC-V Kernel application with QEMU.
- Create the new RISC-V Kernel Debugging configurations: Right-click on the project name then select Debug As > Debug Configurations.
Double-click on RISC-V Kernel Debugging, then click Debug to start the Kernel debugging session.
When starting kernel debugging, the kernel is suspended in the start_kernel function and the terminal/console pauses at kernel booting.
To debug an embedded Linux applications, the kernel should be booted completely.
Note:
To switch arch between 32-bit and 64-bit, users should remove the old Debug Kernel Configuration and create a new one to change the kernel (vmlinux).
Or users can replace vmlinux manually at: ~/.xplor/blueprints/rootfs-debug/rv***_debugkernel/vmlinux
Sometimes unable to debug Kernel for the first time with information such as follows:
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.