Kernel Debugging with QEMU: Difference between revisions

imported>Luis-Hebendanz
mNo edit summary
imported>Luis-Hebendanz
No edit summary
Line 80: Line 80:


== Installing tools to the image ==
== Installing tools to the image ==
The filesystem is mounted read only so to add tools like lspci, mount and chroot then use apt to install the needed binaries.
The filesystem is mounted read only so to add tools like lspci. Mount and chroot then use apt to install the needed binaries.
<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
  $ sudo  mount -o loop qemu-image.img mount-point.dir
  $ sudo  mount -o loop qemu-image.img mount-point.dir
Line 87: Line 87:
  $ apt install pciutils tree
  $ apt install pciutils tree
</syntaxhighlight>
</syntaxhighlight>
== Debugging drivers ==
Make sure the driver you want to inspect is not compiled into the kernel, look for the option to enable compilation of your driver and check if it is set to Module with <code><M></code>. After compilation copy the driver.ko into the mounted <code>qemu-image.img</code>. Unmount start the kernel and break at the <code>load_module</code> function. Happy hacking!