blob: 912daf6038a177ec2a6dc276f3ebf8333cd3f61a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
#[============================================================================[
# The Kernel Library
#]============================================================================]
set(TEACHOS_KERNEL_LINKER_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/kernel.ld")
mark_as_advanced(TEACHOS_KERNEL_LINKER_SCRIPT)
target_sources("_kernel" PRIVATE
"src/kernel/main.cpp"
"src/kernel/cpu/control_register.cpp"
"src/kernel/cpu/lgdt.cpp"
"src/kernel/cpu/msr.cpp"
"src/kernel/cpu/ss.cpp"
"src/kernel/cpu/tlb.cpp"
)
target_link_options("_kernel" PRIVATE
"-T${TEACHOS_KERNEL_LINKER_SCRIPT}"
)
set_target_properties("_kernel" PROPERTIES
LINK_DEPENDS "${TEACHOS_KERNEL_LINKER_SCRIPT}"
)
#[============================================================================[
# The Bootstrap Library
#]============================================================================]
target_sources("_boot" PRIVATE
"src/boot/boot.s"
"src/boot/crti.s"
"src/boot/crtn.s"
"src/boot/multiboot.s"
)
#[============================================================================[
# The Video Library
#]============================================================================]
target_sources("_video" PRIVATE
"src/video/vga/text.cpp"
)
#[============================================================================[
# The Memory Library
#]============================================================================]
target_sources("_memory" PRIVATE
"src/memory/main.cpp"
"src/memory/multiboot/elf_symbols_section.cpp"
"src/memory/multiboot/reader.cpp"
"src/memory/allocator/area_frame_allocator.cpp"
"src/memory/allocator/tiny_frame_allocator.cpp"
"src/memory/allocator/physical_frame.cpp"
"src/memory/paging/page_entry.cpp"
"src/memory/paging/page_table.cpp"
"src/memory/paging/temporary_page.cpp"
"src/memory/paging/virtual_page.cpp"
"src/memory/paging/active_page_table.cpp"
"src/memory/paging/inactive_page_table.cpp"
"src/memory/heap/bump_allocator.cpp"
"src/memory/heap/memory_block.cpp"
"src/memory/heap/linked_list_allocator.cpp"
"src/memory/heap/global_heap_allocator.cpp"
)
#[============================================================================[
# The STL Library
#]============================================================================]
target_sources("_stl" PRIVATE
"src/stl/mutex.cpp"
)
#[============================================================================[
# The Exception handling Library
#]============================================================================]
target_sources("_exception" PRIVATE
"src/exception_handling/assert.cpp"
"src/exception_handling/abort.cpp"
"src/exception_handling/panic.cpp"
"src/exception_handling/pure_virtual.cpp"
)
#[============================================================================[
# The Context switching Library
#]============================================================================]
target_sources("_context" PRIVATE
"src/context_switching/descriptor_table/access_byte.cpp"
"src/context_switching/descriptor_table/gdt_flags.cpp"
"src/context_switching/descriptor_table/global_descriptor_table.cpp"
"src/context_switching/descriptor_table/global_descriptor_table_pointer.cpp"
"src/context_switching/descriptor_table/segment_descriptor.cpp"
)
#[============================================================================[
# The Bootable ISO Image
#]============================================================================]
find_package("grub-mkrescue")
if(grub-mkrescue_FOUND)
file(GENERATE
OUTPUT "isofs/boot/grub/grub.cfg"
INPUT "support/grub.cfg.in"
)
add_custom_target("bootable-iso"
COMMAND "${GRUB_MKRESCUE_EXE}"
"-o"
"${PROJECT_BINARY_DIR}/teachos-$<CONFIGURATION>.iso"
"${CMAKE_CURRENT_BINARY_DIR}/isofs"
"$<TARGET_FILE:teachos::kernel>"
"2>/dev/null"
DEPENDS
"$<TARGET_FILE:teachos::kernel>"
"isofs/boot/grub/grub.cfg"
BYPRODUCTS "${PROJECT_BINARY_DIR}/teachos-$<CONFIGURATION>.iso"
COMMENT "Creating bootable ISO image"
)
endif()
|