Kernel Debugging with QEMU: Difference between revisions
imported>Luis-Hebendanz mNo edit summary |
imported>Luis-Hebendanz mNo edit summary |
||
| Line 64: | Line 64: | ||
<syntaxhighlight lang="console"> | <syntaxhighlight lang="console"> | ||
$ qemu-system-x86_64 -s -S \ | $ qemu-system-x86_64 -s -S \ | ||
-kernel ../arch/ | -kernel ../arch/x86/boot/bzImage \ | ||
-hda qemu-img.img \ | -hda qemu-img.img \ | ||
-append "root=/dev/sda console=ttyS0 nokaslr" \ | -append "root=/dev/sda console=ttyS0 nokaslr" \ | ||
| Line 77: | Line 77: | ||
(gdb) target remote :1234 | (gdb) target remote :1234 | ||
(gdb) continue | (gdb) continue | ||
</syntaxhighlight> | |||
== 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. | |||
<syntaxhighlight lang="console"> | |||
$ sudo mount -o loop qemu-image.img mount-point.dir | |||
$ sudo chroot mount-point.dir /bin/bash -i | |||
$ export PATH=$PATH:/bin | |||
$ apt install pciutils tree | |||
</syntaxhighlight> | </syntaxhighlight> | ||