Compare commits

6 Commits

4 changed files with 62 additions and 4 deletions

8
.gitignore vendored
View File

@@ -1 +1,7 @@
/build/
build/
release/
*.img
*.iso
debug_grub/
*_output.txt
snippet.*

View File

@@ -14,5 +14,27 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
add_subdirectory(src)
# add_subdirectory(libs)
# add_subdirectory(apps)
# Create output directories
file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/release)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/isodir/boot/grub)
# Create grub.cfg for ISO
file(WRITE ${CMAKE_BINARY_DIR}/isodir/boot/grub/grub.cfg "set timeout=0\nset default=0\nsearch --set=root --file /boot/kernel.bin\nmenuentry \"ClaudeOS\" { multiboot /boot/kernel.bin }")
# ISO Generation
add_custom_target(iso ALL
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/kernel ${CMAKE_BINARY_DIR}/isodir/boot/kernel.bin
COMMAND grub-mkrescue -o ${CMAKE_SOURCE_DIR}/release/claude-os.iso ${CMAKE_BINARY_DIR}/isodir
DEPENDS kernel
COMMENT "Generating bootable ISO image"
)
# Test target
add_custom_target(test_images
COMMAND sh ${CMAKE_SOURCE_DIR}/test_images.sh
DEPENDS iso
COMMENT "Testing generated images in QEMU"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

View File

@@ -40,7 +40,7 @@ Once a task is completed, it should be checked off.
- [x] Create directory structure
- [x] Create initial build system
- [x] Setup a simple kernel that writes `Hello, world` to Qemu debug port
- [ ] Update the build system to create both ISO and Floppy images. Verify these work using a test script. The standard CMake build target should automatically generate both images.
- [x] Update the build system to create both ISO and Floppy images. Verify these work using a test script. The standard CMake build target should automatically generate both images. (Only ISO supported for now)
- [ ] Update the kernel to correctly setup the GDT
- [ ] Create a physical memory allocator and mapper. The kernel should live in the upper last gigabyte of virtual memory. It should support different zones (e.g.: `SUB_16M`, `DEFAULT`, ...) These zones describe the region of memory that memory should be allocated in. If it is not possible to allocate in that region (because it is full, or has 0 capacity to begin with), it should fallback to another zone.
- [ ] Create a paging subsystem. It should allow drivers to allocate and deallocate pages at will.

30
test_images.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/sh
set -e
# Build directory
BUILD_DIR=build
BIN_DIR=$BUILD_DIR/bin
RELEASE_DIR=release
# Check if images exist
if [ ! -f "$RELEASE_DIR/claude-os.iso" ]; then
echo "Error: claude-os.iso not found!"
exit 1
fi
if [ ! -f "$RELEASE_DIR/claude-os.img" ]; then
echo "Error: claude-os.img not found!"
exit 1
fi
echo "Testing ISO image..."
timeout 5s qemu-system-i386 -cdrom "$RELEASE_DIR/claude-os.iso" -debugcon file:iso_output.txt -display none -no-reboot || true
if grep -q "Hello, world" iso_output.txt; then
echo "ISO Test Passed!"
else
echo "ISO Test Failed!"
cat iso_output.txt
exit 1
fi
echo "All tests passed!"