fix: ensure inlining
authorMinep <zelong56@gmail.com>
Sun, 23 Oct 2022 11:49:15 +0000 (12:49 +0100)
committerMinep <zelong56@gmail.com>
Sun, 23 Oct 2022 11:49:15 +0000 (12:49 +0100)
prerequisites check before compiling
add some housekeeping stuff

lunaix-os/README.md
lunaix-os/flags.h
lunaix-os/kernel/tty/lxconsole.c
lunaix-os/makefile

index 234ea1bf115cbcf0c4f928b07b52dd40ff92d853..f3d24d07618e63cc57badb06e8aa0b0a15c866a8 100644 (file)
@@ -7,6 +7,8 @@
 + `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
index 90a5a5a5e845fdc305c92ef5d3b6a222437e4706..d4262dfa4fbbe921fc33da1672b4025991d8ef0e 100644 (file)
@@ -1,10 +1,15 @@
 #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 */
index 3404450048a9802cd638e0bdac58170db5abc902..ae5701b5002f8f752032d3e3d6eee6712f610032 100644 (file)
@@ -29,7 +29,7 @@ static volatile char ttychr;
 
 static volatile pid_t fg_pgid = 0;
 
-inline void
+static inline void
 print_control_code(const char cntrl)
 {
     console_write_char('^');
index 058bcc8e8da5a5741a3f1e76f71028663bc7f008..ede34f48a624bb7c0e3b726038ef5fba49ce4680 100644 (file)
@@ -3,10 +3,26 @@ include config/make-os
 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)
 
@@ -32,12 +48,12 @@ $(BIN_DIR)/$(OS_BIN): $(OBJECT_DIR) $(BIN_DIR) $(SRC)
        @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
@@ -51,7 +67,6 @@ all-debug: clean $(BUILD_DIR)/$(OS_ISO)
 
 clean:
        @rm -rf $(BUILD_DIR) || exit 1
-       @sleep 1
 
 run: $(BUILD_DIR)/$(OS_ISO)
        @qemu-system-i386 $(QEMU_OPTIONS)