diff options
author | johannst <johannes.stoelp@gmail.com> | 2021-07-15 21:16:42 +0200 |
---|---|---|
committer | johannst <johannes.stoelp@gmail.com> | 2021-07-15 21:16:42 +0200 |
commit | 617d73fc9eff5b08a80b873fd97f66caa7e80fc9 (patch) | |
tree | 170fe178500cbc7815f5a9fbb4751bb9b14c2cc0 /content/20191027-kernel-debugging-qemu/run.sh | |
parent | 1a088951089023d4ee18f01a0b83b71287c4d847 (diff) | |
download | blog-617d73fc9eff5b08a80b873fd97f66caa7e80fc9.tar.gz blog-617d73fc9eff5b08a80b873fd97f66caa7e80fc9.zip |
added dockerfile for kernel dev
Diffstat (limited to 'content/20191027-kernel-debugging-qemu/run.sh')
-rwxr-xr-x | content/20191027-kernel-debugging-qemu/run.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/content/20191027-kernel-debugging-qemu/run.sh b/content/20191027-kernel-debugging-qemu/run.sh new file mode 100755 index 0000000..b0a84ae --- /dev/null +++ b/content/20191027-kernel-debugging-qemu/run.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +VER=5.13.2 + +# Launch the emulator with our kernel. +qemu-system-x86_64 \ + -kernel ./linux-$VER/arch/x86/boot/bzImage \ + -nographic \ + -append "earlyprintk=ttyS0 console=ttyS0 nokaslr init=/init debug" \ + -initrd ./initramfs.cpio.gz \ + -serial telnet:localhost:12345,server,nowait \ + -monitor none \ + -gdb tcp::1234 \ + -S & + +# Kill qemu when we exit. +QEMU_PID=$! +trap "kill $QEMU_PID" EXIT + +# Give qemu some time to come up. +sleep 0.5 + +# Attach debugger to qemu and load the kernel symbols. +gdb -ex 'target remote :1234' ./linux-$VER/vmlinux |