Provides a reproducible Debian-based build environment with: - Clang + LLD for cross-compilation to i386-elf targets - GRUB 2 tools (grub-pc-bin, xorriso, mtools) for bootable ISO and floppy image generation - QEMU (i386) for integration test execution - CMake + Ninja for the build system The Dockerfile includes a self-test that verifies Clang + lld can produce a valid ELF 32-bit i386 binary before the image is accepted.
44 lines
1.3 KiB
Docker
44 lines
1.3 KiB
Docker
# ClaudeOS build environment
|
|
#
|
|
# Provides everything needed to build and test a bare-metal i386 kernel:
|
|
# - Clang + LLD for cross-compilation to i386-elf
|
|
# - GRUB 2 tools for generating bootable ISO and floppy images
|
|
# - QEMU (i386) for running integration tests
|
|
# - CMake + Ninja for the build system
|
|
# - xorriso and mtools used internally by grub-mkrescue / grub-mkimage
|
|
|
|
FROM debian:bookworm-slim
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
# Core build tools
|
|
clang \
|
|
lld \
|
|
cmake \
|
|
ninja-build \
|
|
make \
|
|
git \
|
|
# GRUB image generation
|
|
grub-pc-bin \
|
|
grub-common \
|
|
xorriso \
|
|
mtools \
|
|
# QEMU for running the OS
|
|
qemu-system-x86 \
|
|
# Handy utilities
|
|
file \
|
|
ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Verify the cross-compilation toolchain can produce an i386-elf binary.
|
|
RUN echo 'void _start(void){for(;;)__asm__("hlt");}' > /tmp/test.c \
|
|
&& clang -target i386-elf -m32 -march=i386 -ffreestanding -fno-stack-protector \
|
|
-nostdlib -fuse-ld=lld -Wl,-e,_start \
|
|
/tmp/test.c -o /tmp/test.elf \
|
|
&& file /tmp/test.elf | grep -q "ELF 32-bit.*80386" \
|
|
&& echo "Toolchain OK" \
|
|
&& rm /tmp/test.c /tmp/test.elf
|
|
|
|
WORKDIR /workspaces/claude-os
|