summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorAlexey Gavrilov <alexey.gavrilov@mail.com>2026-03-27 14:03:55 +0700
committerAlexey Gavrilov <alexey.gavrilov@mail.com>2026-03-27 14:03:55 +0700
commit6ffe96d1e3f0289c2070e050cf8e1a30288e6d91 (patch)
tree746485cfc0f55dad82d1d0daad9677bf63475cba /kernel
parenta4dea4148157a94a9143dbbd92fdd88b4358676c (diff)
Cmake build generator support: build stage
Multi-target architecture implementation: each root source code directory presents the one *INTERFACE* target to it's subdirectory subtargets that link only as *STATIC* library. For instance, *arch* directory presents *Architecture* target then *Architecture* target has *CPUID*, *IO*, *PORT* and etc. dependencies Exact order of linking targets is: boot.o CRTIBUNDLE <TARGETS> CRTNBUNDLE. Sequence destruction cause to UB. Please to pay attention to this. TODO - Debug information - Build type - Toolchain file - Image creation - Build by WinGW compiler on Windows platform (optional) Signed-off-by: Alexey Gavrilov <alexey.gavrilov@mail.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/CMakeLists.txt14
-rw-r--r--kernel/boot.s16
-rw-r--r--kernel/details/CMakeLists.txt8
-rw-r--r--kernel/kernel.cpp (renamed from kernel/kernel.c)0
4 files changed, 22 insertions, 16 deletions
diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt
new file mode 100644
index 0000000..cd249d0
--- /dev/null
+++ b/kernel/CMakeLists.txt
@@ -0,0 +1,14 @@
+target_link_options(CXX_LINKER_REQUIREMENTS INTERFACE
+ LINKER:-T${CMAKE_CURRENT_LIST_DIR}/linker.ld
+)
+
+add_library(Kernel INTERFACE)
+
+add_library(Main STATIC)
+target_sources(Main PRIVATE
+ ${CMAKE_CURRENT_LIST_DIR}/kernel.cpp
+)
+target_link_libraries(Main PUBLIC CXX_COMPILER_REQUIREMENTS Architecture Include)
+target_link_libraries(Kernel INTERFACE Main)
+
+add_subdirectory(details)
diff --git a/kernel/boot.s b/kernel/boot.s
deleted file mode 100644
index 11175af..0000000
--- a/kernel/boot.s
+++ /dev/null
@@ -1,16 +0,0 @@
-section .text
-extern main, _estack, _init
-global _start:function
-_start:
- ; Stack setup
- mov eax, _estack
- ; Align stack to odd address
- and eax, 0xFFFFFFFE
- mov esp, eax
-
- call _init
- call main
- cli
-.hang: hlt
- jmp .hang
-; .end:
diff --git a/kernel/details/CMakeLists.txt b/kernel/details/CMakeLists.txt
new file mode 100644
index 0000000..881d360
--- /dev/null
+++ b/kernel/details/CMakeLists.txt
@@ -0,0 +1,8 @@
+target_sources(CPUID
+ PUBLIC
+ FILE_SET HEADERS
+ BASE_DIRS
+ ${CMAKE_CURRENT_LIST_DIR}
+ FILES
+ ${CMAKE_CURRENT_LIST_DIR}/Platform.h
+)
diff --git a/kernel/kernel.c b/kernel/kernel.cpp
index c280755..c280755 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.cpp