feat: some clean up and validation of multiboot header

This commit is contained in:
2021-03-04 22:18:58 +01:00
parent 300e80c2e8
commit e532099ea7
9 changed files with 419 additions and 15 deletions

View File

@@ -1,17 +1,12 @@
cmake_minimum_required(VERSION 3.15)
project(new_kernel C ASM)
#set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_C_FLAGS "-I/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include -mno-sse -g -ffreestanding -Wall -Wextra -fno-exceptions -fno-stack-protector -nostdinc -nostdlib -fno-pie -m32")
#set(CMAKE_ASM_NASM_OBJECT_FORMAT "elf")
set(CMAKE_ASM_FLAGS --32)
#set(CMAKE_ASM-ATT_FLAGS --32)
SET(CMAKE_EXE_LINKER_FLAGS "-T${CMAKE_CURRENT_LIST_DIR}/linker.ld -lgcc -ffreestanding -nostdlib")
set(CMAKE_ASM_COMPILER "/usr/bin/as")
#ENABLE_LANGUAGE(ASM_NASM)
#enable_language(ASM)
#SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(GCC_INCLUDE_DIR "/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include")
SET(CMAKE_C_FLAGS "-I${GCC_INCLUDE_DIR} -mno-sse -g -ffreestanding -Wall -Wextra -fno-exceptions -fno-stack-protector -nostdinc -nostdlib -fno-pie -m32")
SET(CMAKE_ASM_FLAGS "${CFLAGS} -m32 -x assembler-with-cpp" )
SET(CMAKE_EXE_LINKER_FLAGS "-T${CMAKE_CURRENT_LIST_DIR}/linker.ld -lgcc -ffreestanding -nostdlib -no-pie")
include_directories(AFTER kernel boot)
include_directories("/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include")
set(CMAKE_C_STANDARD 99)
@@ -19,7 +14,10 @@ FILE(GLOB_RECURSE kernel_src kernel/**.c)
FILE(GLOB_RECURSE kernel_asm kernel/**.S)
FILE(GLOB_RECURSE boot_asm boot/boot.S)
# Run IDE in DMA mode if available (NYI)
#add_compile_definitions(IDE_ENABLE_INTERRUPT)
# Run the kernel shell as the main task
add_compile_definitions(K_SHELL)
add_executable(my-kernel.bin ${kernel_src} ${kernel_asm} ${boot_asm})
set_source_files_properties(${kernel_src} PROPERTIES LANGUAGE C COMPILE_FLAGS "")