diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2025-03-23 00:19:16 +0100 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2025-03-23 00:19:16 +0100 |
commit | 5b3a414aa57e2f36d61112ad8f88b3ee0e86917b (patch) | |
tree | f048b13f48ca4111daa2074c32a34cdd34fdc8d6 | |
parent | 0eb4531e86daf0361d575feb512530b7685772f6 (diff) | |
download | blog-5b3a414aa57e2f36d61112ad8f88b3ee0e86917b.tar.gz blog-5b3a414aa57e2f36d61112ad8f88b3ee0e86917b.zip |
-rw-r--r-- | content/2021-12-02-toying-with-virtio/Containerfile | 34 | ||||
-rw-r--r-- | content/2021-12-02-toying-with-virtio/Makefile | 24 |
2 files changed, 53 insertions, 5 deletions
diff --git a/content/2021-12-02-toying-with-virtio/Containerfile b/content/2021-12-02-toying-with-virtio/Containerfile new file mode 100644 index 0000000..c2ec735 --- /dev/null +++ b/content/2021-12-02-toying-with-virtio/Containerfile @@ -0,0 +1,34 @@ +FROM ubuntu:20.04 +MAINTAINER Johannes Stoelp <johannes.stoelp@gmail.com> + +RUN apt update \ + && DEBIAN_FRONTEND=noninteractive \ + apt install \ + --yes \ + --no-install-recommends \ + # Download & unpack. + wget \ + ca-certificates \ + xz-utils \ + # Build tools & deps (kernel). + make \ + bc \ + gcc g++ \ + flex bison \ + libelf-dev \ + libncurses-dev \ + # Build tools & deps (initrd). + cpio \ + # Run & debug. + qemu-system-x86 \ + # Convenience. + sudo \ + telnet \ + ripgrep \ + fd-find \ + neovim \ + && rm -rf /var/lib/apt/lists/* \ + && apt-get clean + +# Change default working dir. +WORKDIR /develop diff --git a/content/2021-12-02-toying-with-virtio/Makefile b/content/2021-12-02-toying-with-virtio/Makefile index d4286af..78e9258 100644 --- a/content/2021-12-02-toying-with-virtio/Makefile +++ b/content/2021-12-02-toying-with-virtio/Makefile @@ -22,6 +22,8 @@ help: @echo " attach - Start an additional bash in the container." @echo " This needs an already running container." +# -- BUILD TARGETS -------------------------------------------------------------- + kernel: ./build_kernel.sh @@ -31,6 +33,8 @@ init: ext2: ./build_ext2.sh +# -- RUN TARGETS ---------------------------------------------------------------- + run: qemu-system-x86_64 \ -nographic \ @@ -48,15 +52,25 @@ run: vcon: telnet -4 localhost 2222 +# -- CLEAN TARGET --------------------------------------------------------------- + clean: $(RM) initramfs.cpio.gz $(RM) -r busybox-* $(RM) -r linux-$(VER)* $(RM) blk.ext2 -docker: - DOCKER_BUILDKIT=1 docker build --build-arg UID=$(shell id -u) -t virtio-dev . - docker run --name virtio -it --rm -v $(PWD):/develop --device /dev/kvm virtio-dev +# -- DOCKER TARGETS ------------------------------------------------------------- + +docker podman: + $(MAKE) build-$@ + $@ run --name virtio -it --rm -v $(PWD):/develop --device /dev/kvm virtio-dev + +build-docker: + DOCKER_BUILDKIT=1 docker build -f Dockerfile --build-arg UID=$(shell id -u) -t virtio-dev . +build-podman: + podman build -t virtio-dev . -attach: - docker exec -it virtio bash +attach-docker attach-podman: +attach-%: + $* exec -it virtio bash |