In many cases you may want to stop target execution early during kernel initialization in order to walk up to some point of failure. The easiest way to do this is to set a hardware breakpoint on the start_kernel function in the Linux kernel.
- Stop the target prior to kernel execution.
- Load the kernel symbols.
- Create a hardware breakpoint at the start_kernel function.
- Resume target execution until the breakpoint is hit.
All steps are described in detail below.
- To stop the target prior to kernel execution, choose one of the following steps:
- Reset the target and stop at the reset vector.
- Boot the target to the OS boot loader or BIOS boot selection screen and stop the target execution in the debugger.
- Use the LOAD command to load your kernel symbols. See also Use Case: Loading Symbols for the Linux* Kernel.
- Select View > Source Files to open the Source Files window.
- Double-click the file main.c and search for the start_kernel function in the source code of this file.
- Select Debug > Create Breakpoint...to open the Create Breakpoint dialog box.
- In the Location field, enter start_kernel.
- Check the Hard checkbox.
The breakpoint is set and is displayed with a red icon at the start_kernel function in the Source window of main.c.
Select Run > Run or Continue to resume the target execution.
The target stops at the breakpoint you set. A yellow pointer in the Source window indicates the current execution point is at your breakpoint.