Code Monkey home page Code Monkey logo

docker-linux-2.6.26-build's Introduction

docker-linux-2.6.26-build

Docker env for building linux kernel 2.6.26, mainly for debugging the Linux kernel in 32-bit 386 environment.

Tested on macOS M1 and debian bookworm amd64.

build docker image

docker build -t linux-2.6.26-builder:1.0.0 .

run image

docker run --privileged --name linux-builder -itd linux-2.6.26-builder:1.0.0 /bin/bash

compile linux image

First connect to docker container

docker exec -it linux-builder /bin/bash

We have already compiled the linux kernel source code when creating the docker image. The compiled target file is in the following path:

  • /home/linux/vmlinux: the uncompressed Linux kernel executable in the ELF.
  • /home/linux/arch/x86/boot/bzImage: the compressed Linux kernel image that is bootable by the system’s bootloader.

If you want to compile the kernel source code again, you can run the command below

cd /home/linux
make ARCH=i386 menuconfig # change build config if needed or just ignore this
make ARCH=i386 V=1

run kernel image with qemu

qemu-system-i386 -kernel /home/linux/arch/x86/boot/bzImage -initrd /home/initrd/myinitrd.img -append "root=/dev/ram init=/init console=ttyS0" -nographic

If you are interested in the generation of myinitrd.img, just view the Dockerfile.

debug kernel with qemu

Run qemu in debug mode first

qemu-system-i386 -kernel /home/linux/arch/x86/boot/bzImage -initrd /home/initrd/myinitrd.img -append "root=/dev/ram init=/init console=ttyS0" -nographic -S -s

Then connect to docker container in another shell, and then debug vmlinux with gdb.

docker exec -it linux-builder /bin/bash

gdb /home/linux/vmlinux

docker-linux-2.6.26-build's People

Contributors

bitristan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.