diff --git a/kernel/Makefile b/kernel/Makefile index ced0695b..fce3a997 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -14,6 +14,10 @@ NASMFLAGS := -felf64 ASFLAGS := 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)) CXX_SRC = $(call rwildcard,$(MOON_SRC),*.cpp) diff --git a/kernel/include/config.h b/kernel/include/config.h new file mode 100644 index 00000000..6a0a4d62 --- /dev/null +++ b/kernel/include/config.h @@ -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 \ No newline at end of file diff --git a/kernel/src/main.cpp b/kernel/src/main.cpp index 99a0d576..18a90e7f 100644 --- a/kernel/src/main.cpp +++ b/kernel/src/main.cpp @@ -3,6 +3,7 @@ #include "acpi/RSDT.h" #include "assert.h" #include "bootboot.h" +#include "config.h" #include "cpu/CPU.h" #include "debug.h" #include "gdt/GDT.h" @@ -40,7 +41,7 @@ extern "C" void _start() Init::early_init(); 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); GDT::load(); @@ -142,8 +143,8 @@ extern "C" void _start() KernelMemoryManager::release_unaligned_mapping(rootSDT); - /*sleep(2500); - shutdown();*/ + sleep(2500); + shutdown(); while (1) halt(); loop: