Create directory structure and initial build system (AI)
This commit is contained in:
13
src/CMakeLists.txt
Normal file
13
src/CMakeLists.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
add_executable(kernel
|
||||
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
|
||||
)
|
||||
3
src/kernel.c
Normal file
3
src/kernel.c
Normal file
@@ -0,0 +1,3 @@
|
||||
void _start() {
|
||||
while(1) {}
|
||||
}
|
||||
28
src/linker.ld
Normal file
28
src/linker.ld
Normal file
@@ -0,0 +1,28 @@
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = 1M;
|
||||
|
||||
.text BLOCK(4K) : ALIGN(4K)
|
||||
{
|
||||
KEEP(*(.multiboot))
|
||||
*(.text)
|
||||
}
|
||||
|
||||
.rodata BLOCK(4K) : ALIGN(4K)
|
||||
{
|
||||
*(.rodata)
|
||||
}
|
||||
|
||||
.data BLOCK(4K) : ALIGN(4K)
|
||||
{
|
||||
*(.data)
|
||||
}
|
||||
|
||||
.bss BLOCK(4K) : ALIGN(4K)
|
||||
{
|
||||
*(COMMON)
|
||||
*(.bss)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user