- Created driver framework with probe/init lifecycle. Drivers register via REGISTER_DRIVER macro which places pointers in a .drivers linker section. - During boot, init_drivers() iterates the section, probes each driver (checking if hardware is present), and initializes those that respond OK. - Added .drivers section to linker.ld with __drivers_start/__drivers_end symbols for iteration. - Also added .rodata.* pattern to the .rodata section for string literals placed in sub-sections by the compiler. - No drivers are registered yet; the VGA driver will be the first. Tested: boots cleanly with driver scan completing (0 registered, 0 loaded).
26 lines
460 B
CMake
26 lines
460 B
CMake
cmake_minimum_required(VERSION 3.16)
|
|
|
|
add_executable(kernel
|
|
boot.S
|
|
gdt_flush.S
|
|
gdt.c
|
|
idt.c
|
|
isr.c
|
|
pic.c
|
|
pmm.c
|
|
paging.c
|
|
kmalloc.c
|
|
string.c
|
|
driver.c
|
|
interrupts.S
|
|
kernel.c
|
|
)
|
|
|
|
# Use our custom linker script
|
|
target_link_options(kernel PRIVATE -T ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld)
|
|
|
|
target_include_directories(kernel PRIVATE
|
|
${CMAKE_SOURCE_DIR}/vendor
|
|
${CMAKE_SOURCE_DIR}/include # If created later
|
|
)
|