Added config.h

This commit is contained in:
apio 2022-09-07 15:02:54 +02:00
parent aa6c578a3c
commit c2391cee5d
3 changed files with 29 additions and 3 deletions

View File

@ -14,6 +14,10 @@ NASMFLAGS := -felf64
ASFLAGS := ASFLAGS :=
LDFLAGS := -T$(MOON_DIR)/moon.ld -nostdlib -lgcc -Wl,--build-id=none -z max-page-size=0x1000 LDFLAGS := -T$(MOON_DIR)/moon.ld -nostdlib -lgcc -Wl,--build-id=none -z max-page-size=0x1000
ifneq ($(MOON_BUILD_STABLE), 1)
CFLAGS := ${CFLAGS} -D_MOON_SUFFIX="$(shell git rev-parse --short HEAD)"
endif
rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d)) rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
CXX_SRC = $(call rwildcard,$(MOON_SRC),*.cpp) CXX_SRC = $(call rwildcard,$(MOON_SRC),*.cpp)

21
kernel/include/config.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef STRINGIZE
#define STRINGIZE(x) #x
#endif
#ifndef STRINGIZE_VALUE_OF
#define STRINGIZE_VALUE_OF(x) STRINGIZE(x)
#endif
#ifndef MOON_MAJOR
#define MOON_MAJOR 0
#endif
#ifndef MOON_MINOR
#define MOON_MINOR 1
#endif
#ifndef _MOON_SUFFIX
#define MOON_SUFFIX "stable"
#else
#define MOON_SUFFIX STRINGIZE_VALUE_OF(_MOON_SUFFIX)
#endif

View File

@ -3,6 +3,7 @@
#include "acpi/RSDT.h" #include "acpi/RSDT.h"
#include "assert.h" #include "assert.h"
#include "bootboot.h" #include "bootboot.h"
#include "config.h"
#include "cpu/CPU.h" #include "cpu/CPU.h"
#include "debug.h" #include "debug.h"
#include "gdt/GDT.h" #include "gdt/GDT.h"
@ -40,7 +41,7 @@ extern "C" void _start()
Init::early_init(); Init::early_init();
Debug::DebugStatus::the()->PassBootStage(Color::White); Debug::DebugStatus::the()->PassBootStage(Color::White);
kinfoln("Hello World!"); kinfoln("Starting Moon %d.%d-%s", MOON_MAJOR, MOON_MINOR, MOON_SUFFIX);
Debug::DebugStatus::the()->StartBootStage(Color::Gray); Debug::DebugStatus::the()->StartBootStage(Color::Gray);
GDT::load(); GDT::load();
@ -142,8 +143,8 @@ extern "C" void _start()
KernelMemoryManager::release_unaligned_mapping(rootSDT); KernelMemoryManager::release_unaligned_mapping(rootSDT);
/*sleep(2500); sleep(2500);
shutdown();*/ shutdown();
while (1) halt(); while (1) halt();
loop: loop: