+ `arch` 平台相关代码,LunaixOS的内核引导就在这里。
+ `hal` 硬件抽象层,存放主板相关的代码,提供了一些访问主板功能(比如CPU,计时器)的抽象
+ `includes` 所有头文件
++ `debug` 内核调试服务器
++ `config` makefile配置问题
+ `kernel` 这里就是内核了
+ `asm` 共内核使用的,且平台相关的代码。
+ `ds` 提供一些基本的数据结构支持。
+ `peripheral` 外部设备驱动(如键盘)。
+ `time` 为内核提供基本的时间,计时服务。
+ `tty` 提供基本的显存操作服务。
+ + `fs` 文件系统。
+ + `device` 设备(通用)抽象层
+ + `block` 块设备抽象层
+ + `process` 进程相关
+ + `demos` 简单的测试程序
+ `lib` 一些内核使用的运行时库,主要提供是内核模式下的一些C标准库里的实现。
-+ `link` 链接器脚本
\ No newline at end of file
++ `link` 链接器脚本
++ `scripts` 其他脚本(如:用于代码生成)
\ No newline at end of file
#ifndef __LUNAIX_FLAGS_H
#define __LUNAIX_FLAGS_H
-/*
- Uncomment below to force LunaixOS use kernel page table when context switch to kernel space
- NOTE: This will make the kernel global.
+/*
+ Uncomment below to force LunaixOS use kernel page table when context switch
+ to kernel space NOTE: This will make the kernel global.
*/
// #define USE_KERNEL_PG
+/*
+ Uncomment below to disable all assertion
+*/
+// #define __LUNAIXOS_NASSERT__
+
#endif /* __LUNAIX_FLAGS_H */
include config/make-cc
include config/make-debug-tool
+DEPS := $(CC) $(LD) xorriso grub-mkrescue
+
INCLUDES := $(patsubst %, -I%, $(INCLUDES_DIR))
SOURCE_FILES := $(shell find -name "*.[cS]")
SRC := $(patsubst ./%, $(OBJECT_DIR)/%.o, $(SOURCE_FILES))
+$(DEPS):
+ @echo -n "checking $@ .... "
+ @if which $@ > /dev/null; then \
+ echo "ok";\
+ else\
+ echo "failed" && exit 1;\
+ fi
+
+check-cc:
+ @echo -n "checking target i686-elf.... "
+ @test "`i686-elf-gcc -dumpmachine`" = "i686-elf" && echo ok || (echo "failed" && exit 1)
+
+check: $(DEPS) check-cc
+
$(OBJECT_DIR):
@mkdir -p $(OBJECT_DIR)
@echo " LD $(BIN_DIR)/$(OS_BIN)"
@$(CC) -T link/linker.ld -o $(BIN_DIR)/$(OS_BIN) $(SRC) $(LDFLAGS)
-$(BUILD_DIR)/$(OS_ISO): $(ISO_DIR) $(BIN_DIR)/$(OS_BIN) GRUB_TEMPLATE
+$(BUILD_DIR)/$(OS_ISO): check $(ISO_DIR) $(BIN_DIR)/$(OS_BIN) GRUB_TEMPLATE
@./config-grub.sh ${OS_NAME} $(ISO_GRUB_DIR)/grub.cfg
@cp $(BIN_DIR)/$(OS_BIN) $(ISO_BOOT_DIR)
@grub-mkrescue -o $(BUILD_DIR)/$(OS_ISO) $(ISO_DIR)
-all: clean $(BUILD_DIR)/$(OS_ISO)
+all: $(BUILD_DIR)/$(OS_ISO)
instable: CFLAGS := -g -std=gnu99 -ffreestanding $(O) $(W) $(ARCH_OPT) -D__LUNAIXOS_DEBUG__
instable: all
clean:
@rm -rf $(BUILD_DIR) || exit 1
- @sleep 1
run: $(BUILD_DIR)/$(OS_ISO)
@qemu-system-i386 $(QEMU_OPTIONS)