refactor (kernel): refactored the directory structure
This commit is contained in:
parent
eaf189b545
commit
766110435a
|
@ -1,5 +1,3 @@
|
|||
build
|
||||
cmake-build-debug
|
||||
.idea
|
||||
.wiki
|
||||
noxos.log
|
|
@ -1,4 +1,25 @@
|
|||
cmake_minimum_required(VERSION 3.00)
|
||||
project(NoxOS)
|
||||
add_subdirectory(kernel)
|
||||
set(C 99)
|
||||
|
||||
set(CMAKE_NASM_COMPILE_OBJECT "nasm <INCLUDES> <FLAGS> -o <OBJECT> <SOURCE>")
|
||||
|
||||
|
||||
add_executable(kernel)
|
||||
add_library (kernel_asm OBJECT)
|
||||
target_include_directories(kernel PRIVATE inc)
|
||||
file(GLOB_RECURSE kernel_src_c "src/**/*.c")
|
||||
file(GLOB_RECURSE kernel_inc "inc/**/*.h")
|
||||
file(GLOB_RECURSE kernel_src_asm "src/**/*.asm")
|
||||
|
||||
|
||||
target_compile_options(kernel PRIVATE -g -fno-stack-protector -fno-stack-check -mno-red-zone -ffreestanding -m64 -march=x86-64 -mabi=sysv)
|
||||
target_link_options(kernel PRIVATE -nostdlib -static -T "${CMAKE_CURRENT_LIST_DIR}/kernel.ld")
|
||||
|
||||
enable_language(ASM_NASM)
|
||||
set(CAN_USE_ASSEMBLER TRUE)
|
||||
|
||||
target_sources(kernel_asm PRIVATE ${kernel_src_asm})
|
||||
target_sources(kernel PRIVATE ${kernel_src_c} ${kernel_inc} $<TARGET_OBJECTS:kernel_asm>)
|
||||
|
||||
|
||||
|
|
23
build.sh
23
build.sh
|
@ -1,25 +1,6 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
# Copyright 2023 Antifallobst <antifallobst@systemausfall.org>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
# this software and associated documentation files (the “Software”), to deal in
|
||||
# the Software without restriction, including without limitation the rights to use,
|
||||
# copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
||||
# Software, and to permit persons to whom the Software is furnished to do so,
|
||||
# subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
# This file is part of noxos and licensed under the MIT open source license
|
||||
|
||||
set -e
|
||||
|
||||
|
@ -91,7 +72,7 @@ generate_image() {
|
|||
cp limine/limine.sys iso
|
||||
cp ../limine.cfg iso
|
||||
cp initrd.tar iso
|
||||
cp cmake/kernel/kernel iso/kernel.elf
|
||||
cp cmake/kernel iso/kernel.elf
|
||||
|
||||
xorriso -as mkisofs -b limine-cd.bin \
|
||||
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
set(C 99)
|
||||
|
||||
set(CMAKE_NASM_COMPILE_OBJECT "nasm <INCLUDES> <FLAGS> -o <OBJECT> <SOURCE>")
|
||||
|
||||
|
||||
add_executable(kernel)
|
||||
add_library (kernel_asm OBJECT)
|
||||
target_include_directories(kernel PRIVATE inc)
|
||||
file(GLOB_RECURSE kernel_src_c "**/*.c")
|
||||
file(GLOB_RECURSE kernel_inc "**/*.h")
|
||||
file(GLOB_RECURSE kernel_src_asm "**/*.asm")
|
||||
|
||||
|
||||
target_compile_options(kernel PRIVATE -g -fno-stack-protector -fno-stack-check -mno-red-zone -ffreestanding -m64 -march=x86-64 -mabi=sysv)
|
||||
target_link_options(kernel PRIVATE -nostdlib -static -T "${CMAKE_CURRENT_LIST_DIR}/kernel.ld")
|
||||
|
||||
enable_language(ASM_NASM)
|
||||
set(CAN_USE_ASSEMBLER TRUE)
|
||||
|
||||
target_sources(kernel_asm PRIVATE ${kernel_src_asm})
|
||||
target_sources(kernel PRIVATE ${kernel_src_c} ${kernel_inc} $<TARGET_OBJECTS:kernel_asm>)
|
||||
|
||||
|
|
@ -58,23 +58,6 @@ void kmain(boot_info_T boot_info) {
|
|||
log(LOG_INFO, "!=====[ Kernel Initialized ]=====!\n");
|
||||
|
||||
|
||||
log(LOG_DEBUG, "0x0000080000000000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000000000));
|
||||
log(LOG_DEBUG, "0x0000080000001000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000001000));
|
||||
log(LOG_DEBUG, "0x0000080000002000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000002000));
|
||||
log(LOG_DEBUG, "0x0000080000003000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000003000));
|
||||
syscall_perform(SYSCALL_MEMORY_MAP, 0x0000080000000000, 4, 0, 0);
|
||||
log(LOG_DEBUG, "performed 'nx_mmap'");
|
||||
log(LOG_DEBUG, "0x0000080000000000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000000000));
|
||||
log(LOG_DEBUG, "0x0000080000001000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000001000));
|
||||
log(LOG_DEBUG, "0x0000080000002000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000002000));
|
||||
log(LOG_DEBUG, "0x0000080000003000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000003000));
|
||||
syscall_perform(SYSCALL_MEMORY_UNMAP, 0x0000080000000000, 4, 0, 0);
|
||||
log(LOG_DEBUG, "performed 'nx_munmap'");
|
||||
log(LOG_DEBUG, "0x0000080000000000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000000000));
|
||||
log(LOG_DEBUG, "0x0000080000001000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000001000));
|
||||
log(LOG_DEBUG, "0x0000080000002000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000002000));
|
||||
log(LOG_DEBUG, "0x0000080000003000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000003000));
|
||||
|
||||
// vfs_node_T* node = vfs_resolve_path(&g_root_fs, "/initrd/test.elf");
|
||||
// void* buffer = memory_allocate(node->size);
|
||||
// vfs_file_read(node, 0, node->size, buffer);
|
Loading…
Reference in New Issue