Created
September 22, 2017 08:34
-
-
Save yalab/7744fe49ec6c542892cf0807b4226a19 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine | |
MAINTAINER yalab <[email protected]> | |
RUN apk --update --no-cache add alpine-sdk ncurses-dev bc linux-headers perl | |
ENV ARCH="x86_64" | |
RUN git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git /linux | |
WORKDIR /linux | |
# docker build . -t kernel-build | |
# docker run -it -v /Users/yalab/vendor/linux:/linux kernel-build /bin/sh | |
# RUN cd /linux/linux && yes "" | make oldconfig | |
# //make x86_64_defconfig | |
# make menuconfig | |
# General setup -> Initial RAM filesystem and RAM disk support | |
# Device Drivers -> Block Devices -> Loopback Device Support | |
# make all && make modules | |
# $ qemu-system-x86_64 -kernel ./arch/bzImage | |
# $ docker exec $(docker ps -q) cat /linux/arch/x86_64/boot/bzImage > bzImage | |
# $ qemu-system-x86_64 -kernel bzImage | |
# $ echo -e '#include <stdio.h>\nint main(){\n while(1){\n printf("Hello kernel world\n");\n }\n return 0;\n}' > hello.c | |
# $ gcc -static hello.c -o hello | |
# $ echo hello | cpio -o -H newc > initramfs.img | |
# $ docker exec $(docker ps -q) cat /linux/boot/initramfs.img > initramfs.img |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment