Fix CMake kernel build and clarify SMP support in ROADMAP

- Fix kernel/CMakeLists.txt to find source files in src/ directory
- Add NASM support to CMake for assembling .asm files
- Update ROADMAP.md to reflect that SMP is intentionally included
- CMake and Makefile now consistent in handling kernel sources

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-28 20:40:49 +00:00
parent c00732bb18
commit 1d0537c57a
2 changed files with 34 additions and 18 deletions

View File

@@ -6,22 +6,38 @@ cmake_minimum_required(VERSION 3.16)
project(MetalOS_Kernel C ASM)
# Source files
file(GLOB KERNEL_C_SOURCES "src/*.c")
file(GLOB KERNEL_ASM_SOURCES "src/*.asm")
set(KERNEL_SOURCES
src/main.c
${KERNEL_C_SOURCES}
)
# Find all source files in subdirectories
file(GLOB_RECURSE CORE_SOURCES "src/core/*.c")
file(GLOB_RECURSE HAL_SOURCES "src/hal/*.c")
file(GLOB_RECURSE DRIVER_SOURCES "src/drivers/*.c")
file(GLOB_RECURSE SYSCALL_SOURCES "src/syscall/*.c")
list(APPEND KERNEL_SOURCES
${CORE_SOURCES}
${HAL_SOURCES}
${DRIVER_SOURCES}
${SYSCALL_SOURCES}
)
# Find NASM assembler
find_program(NASM nasm)
if(NOT NASM)
message(WARNING "NASM not found - assembly files will not be built")
message(WARNING "Install NASM: sudo apt-get install nasm")
else()
message(STATUS "Found NASM: ${NASM}")
# Assemble each .asm file
set(KERNEL_ASM_OBJECTS "")
foreach(asm_file ${KERNEL_ASM_SOURCES})
get_filename_component(asm_name ${asm_file} NAME_WE)
set(asm_obj "${CMAKE_CURRENT_BINARY_DIR}/${asm_name}.o")
add_custom_command(
OUTPUT ${asm_obj}
COMMAND ${NASM} -f elf64 ${asm_file} -o ${asm_obj}
DEPENDS ${asm_file}
COMMENT "Assembling ${asm_name}.asm"
VERBATIM
)
list(APPEND KERNEL_ASM_OBJECTS ${asm_obj})
endforeach()
endif()
# Compiler flags for kernel
set(KERNEL_CFLAGS
@@ -41,7 +57,7 @@ target_include_directories(kernel_obj PRIVATE include)
target_compile_options(kernel_obj PRIVATE ${KERNEL_CFLAGS})
# Create kernel binary
add_executable(kernel_elf $<TARGET_OBJECTS:kernel_obj>)
add_executable(kernel_elf $<TARGET_OBJECTS:kernel_obj> ${KERNEL_ASM_OBJECTS})
set_target_properties(kernel_elf PROPERTIES
OUTPUT_NAME metalos.elf
LINKER_LANGUAGE C