Add devcontainer for i386 kernel development (AI)

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.
This commit is contained in:
2026-02-23 07:13:49 +01:00
parent f3ef92be4f
commit bbd7d3725b
2 changed files with 67 additions and 0 deletions

43
.devcontainer/Dockerfile Normal file
View File

@@ -0,0 +1,43 @@
# 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

View File

@@ -0,0 +1,24 @@
{
"name": "ClaudeOS Dev",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cmake-tools",
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack"
],
"settings": {
"cmake.generator": "Ninja",
"cmake.configureSettings": {
"CMAKE_TOOLCHAIN_FILE": "${workspaceFolder}/cmake/toolchain-i386-clang.cmake"
}
}
}
},
"postCreateCommand": "echo 'ClaudeOS devcontainer ready!'",
"remoteUser": "root"
}