Debugging Linux Kernel on i.MX6 over Ethrnet with Visual Studio

This tutorial shows how to use VisualKernel to debug your Linux kernel running on an i.MX6 board over Ethernet. Before you begin, install VisualKernel 2.1 or later.

  1. Before you begin, build a debug-enabled kernel for your device by following this tutorial. Enable the CONFIG_NETPOLL, CONFIG_KGDB, CONFIG_TRACEPOINT and CONFIG_FTRACE settings in your kernel as described here to ensure the KGDBoE module has all the necessary functionality it requires.
  2. Start Visual Studio and select File->New Project->VisualKernel->Linux Kernel Module Wizard:
  3. Proceed with the default "Create a new kernel module" selection:
  4. Select your i.MX6 board as the targeted Linux computer and choose the machine where you built the kernel as the additional Linux computer to build the module. Ensure you uncheck the "detect and install headers and symbols" checkbox as the kernel was built manually:
  5. On the next page select the directory with the kernel sources as the Kernel header directory and enter the cross-compiler settings as shown below. Then select "Install symbols for another kernel" to begin the process of importing the kernel symbols for VisualKernel:
  6. In the symbol import wizard select "Specify kernel symbols and sources manually":
  7. Then enter the locations of the kernel binary, kernel source directory and the GDB binary from the Linaro toolchain as shown below:
  8. Press "Finish" to import the symbols and click "Next" to open the source settings page. Proceed with the default source location settings by pressing "Next "once more:
  9. On the Debug Settings page select "debug over network" and click Finish:
  10. Press Ctrl-Shift-B to automatically upload your sources to the Linux machine used for building and build it there:
  11. Ensure that the board and the Linux machine used for building the module are located in the same subnet, set a breakpoint at the init() function and press F5 to start debugging. VisualKernel will automatically build and deploy the KGDBoE module needed for ethernet-based debugging:
  12. Once the debug connection is establshed, VisualKernel will load your module, load the symbols for it and the breakpoint you set will automatically trigger:From this point on, you can debug your module as if you were debugging a normal Windows program - breakpoints, call stack and output window will work as usual.