aboutsummaryrefslogtreecommitdiffhomepage
path: root/content/20191027-kernel-debugging-qemu.md
diff options
context:
space:
mode:
Diffstat (limited to 'content/20191027-kernel-debugging-qemu.md')
-rw-r--r--content/20191027-kernel-debugging-qemu.md30
1 files changed, 30 insertions, 0 deletions
diff --git a/content/20191027-kernel-debugging-qemu.md b/content/20191027-kernel-debugging-qemu.md
index 5189f86..7a97fbc 100644
--- a/content/20191027-kernel-debugging-qemu.md
+++ b/content/20191027-kernel-debugging-qemu.md
@@ -6,6 +6,10 @@ date = 2019-10-27
tags = ["linux", "qemu"]
+++
+**EDIT**:
+- 2021-07-15: Added `Appendix: Dockerfile for Kernel development` and updated
+ busybox + Kernel versions.
+
The other evening while starring at some Linux kernel code I thought, let me
setup a minimal environment so I can easily step through the code and examine
the state.
@@ -186,6 +190,32 @@ type = struct filename {
}
```
+## Appendix: `Dockerfile` for Kernel development
+
+The following `Dockerfile` provides a development environment with all the
+required tools and dependencies, to re-produce all the steps of building and
+debugging the Linux kernel.
+```dockerfile
+{{ include(path="content/20191027-kernel-debugging-qemu/Dockerfile") }}
+```
+
+Save the listing above in a file called `Dockerfile` and build the docker image
+as follows.
+```sh
+docker build -t kernel-dev
+```
+> Optionally set `DOCKER_BUILDKIT=1` to use the newer image builder.
+
+Once the image has been built, an interactive container can be launched as
+follows.
+```sh
+# Some options for conveniene:
+# -v <HOST>:<GUEST> Mount host path to guest path.
+# --rm Remove the container after exiting.
+
+docker run -it kernel-dev
+```
+
[linux-kernel]: https://www.kernel.org
[initrd]: https://www.kernel.org/doc/html/latest/admin-guide/initrd.html
[busybox]: https://busybox.net