aboutsummaryrefslogtreecommitdiffhomepage
path: root/content/2019-10-27-kernel-debugging-qemu
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2023-11-26 01:17:42 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2023-11-26 01:17:42 +0100
commit8eb1161d96890bfb6172090d0d2a6b4c51d6889d (patch)
treeede7108affa3d269e500a2aa92604f19a1f8db79 /content/2019-10-27-kernel-debugging-qemu
parent3e8ff92446ae772c202b581e2250e2eb2affe5cb (diff)
downloadblog-8eb1161d96890bfb6172090d0d2a6b4c51d6889d.tar.gz
blog-8eb1161d96890bfb6172090d0d2a6b4c51d6889d.zip
kernel-dbg: add podman and util targets, add demo screencast
Diffstat (limited to 'content/2019-10-27-kernel-debugging-qemu')
-rw-r--r--content/2019-10-27-kernel-debugging-qemu/Makefile35
-rw-r--r--content/2019-10-27-kernel-debugging-qemu/demo.mp4bin0 -> 1215913 bytes
-rw-r--r--content/2019-10-27-kernel-debugging-qemu/index.md10
3 files changed, 42 insertions, 3 deletions
diff --git a/content/2019-10-27-kernel-debugging-qemu/Makefile b/content/2019-10-27-kernel-debugging-qemu/Makefile
index 11e7c7b..02ec2c2 100644
--- a/content/2019-10-27-kernel-debugging-qemu/Makefile
+++ b/content/2019-10-27-kernel-debugging-qemu/Makefile
@@ -1,3 +1,19 @@
+help:
+ @echo "[H]: Makefile inteded to be used with podman/docker."
+ @echo ""
+ @echo "[C]: Build the podman image and drop into a shell in a container instance."
+ @echo "(Alternative use the 'docker' target)."
+ @echo "> make podman"
+ @echo ""
+ @echo "[C]: Build the initramfs and kernel (run from the container shell)."
+ @echo "> make build"
+ @echo ""
+ @echo "[C]: Start qemu in the background and attach gdb in the foreground."
+ @echo "> make run"
+ @echo ""
+ @echo "[C]: Attach to the qemu serial console. This is done in a loop to handle restarts."
+ @echo "> make con"
+
build:
scripts/build_kernel.sh
scripts/build_initrd.sh
@@ -7,6 +23,19 @@ clean:
$(RM) -r busybox-*
$(RM) initramfs.cpio.gz
-docker:
- DOCKER_BUILDKIT=1 docker build -t kernel-dev .
- docker run -it --rm -v $(PWD):/develop/scripts -v $(PWD)/Makefile:/develop/Makefile kernel-dev
+run:
+ scripts/run.sh
+
+con:
+ while true; do telnet localhost 12345; sleep 1; done
+
+docker: do-docker
+podman: do-podman
+
+do-%:
+ $* build -t kernel-dev .
+ $* run -it --rm --name kernel-dev \
+ -v kernel-dev:/develop \
+ -v $(PWD):/develop/scripts \
+ -v $(PWD)/Makefile:/develop/Makefile \
+ kernel-dev
diff --git a/content/2019-10-27-kernel-debugging-qemu/demo.mp4 b/content/2019-10-27-kernel-debugging-qemu/demo.mp4
new file mode 100644
index 0000000..0b87081
--- /dev/null
+++ b/content/2019-10-27-kernel-debugging-qemu/demo.mp4
Binary files differ
diff --git a/content/2019-10-27-kernel-debugging-qemu/index.md b/content/2019-10-27-kernel-debugging-qemu/index.md
index bda445b..297f82c 100644
--- a/content/2019-10-27-kernel-debugging-qemu/index.md
+++ b/content/2019-10-27-kernel-debugging-qemu/index.md
@@ -217,6 +217,16 @@ follows.
docker run -it kernel-dev
```
+> Alternatively use podman.
+
+## Appendix: Screencast of an example debug session
+
+The screencast gives an example, debugging the Linux kernel using the above
+mentioned Dockerfile.
+
+<video width="100%" height="auto" controls>
+ <source src="demo.mp4" type="video/mp4">
+</video>
[linux-kernel]: https://www.kernel.org
[initrd]: https://www.kernel.org/doc/html/latest/admin-guide/initrd.html