From 617d73fc9eff5b08a80b873fd97f66caa7e80fc9 Mon Sep 17 00:00:00 2001 From: johannst Date: Thu, 15 Jul 2021 21:16:42 +0200 Subject: added dockerfile for kernel dev --- content/20191027-kernel-debugging-qemu.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'content/20191027-kernel-debugging-qemu.md') 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 : 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 -- cgit v1.2.3