From 85e0d527833af770be802a39b6aec7737c99cdd8 Mon Sep 17 00:00:00 2001 From: pointer-to-bios Date: Tue, 16 Jan 2024 20:39:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9E=84=E5=BB=BA=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {src/include => include}/kernel/arch/x86_64/kernel.h | 0 {src/include => include}/kernel/arch/x86_64/memm.h | 0 {src/include => include}/kernel/kernel.h | 0 {src/include => include}/kernel/klog.h | 0 {src/include => include}/kernel/memm.h | 0 {src/include => include}/kernel/memm/allocator/raw.h | 0 {src/include => include}/kernel/tty.h | 0 {src/include => include}/libk/bits.h | 0 {src/include => include}/libk/lst.h | 0 {src/include => include}/libk/math.h | 0 {src/include => include}/libk/multiboot2.h | 0 {src/include => include}/libk/multiboot2/bootinfo.h | 0 {src/include => include}/libk/string.h | 0 {src/include => include}/types.h | 0 {src/include => include}/utils.h | 0 src/Makefile | 5 +++-- src/kernel/Makefile | 12 +++++++----- .../arch/x86_64/{memm_x86_64_s.s => memm_x86_64.s} | 0 src/kernel/klog/klog.c | 0 src/libk/Makefile | 9 +++------ 20 files changed, 13 insertions(+), 13 deletions(-) rename {src/include => include}/kernel/arch/x86_64/kernel.h (100%) rename {src/include => include}/kernel/arch/x86_64/memm.h (100%) rename {src/include => include}/kernel/kernel.h (100%) rename {src/include => include}/kernel/klog.h (100%) rename {src/include => include}/kernel/memm.h (100%) rename {src/include => include}/kernel/memm/allocator/raw.h (100%) rename {src/include => include}/kernel/tty.h (100%) rename {src/include => include}/libk/bits.h (100%) rename {src/include => include}/libk/lst.h (100%) rename {src/include => include}/libk/math.h (100%) rename {src/include => include}/libk/multiboot2.h (100%) rename {src/include => include}/libk/multiboot2/bootinfo.h (100%) rename {src/include => include}/libk/string.h (100%) rename {src/include => include}/types.h (100%) rename {src/include => include}/utils.h (100%) rename src/kernel/arch/x86_64/{memm_x86_64_s.s => memm_x86_64.s} (100%) delete mode 100644 src/kernel/klog/klog.c diff --git a/src/include/kernel/arch/x86_64/kernel.h b/include/kernel/arch/x86_64/kernel.h similarity index 100% rename from src/include/kernel/arch/x86_64/kernel.h rename to include/kernel/arch/x86_64/kernel.h diff --git a/src/include/kernel/arch/x86_64/memm.h b/include/kernel/arch/x86_64/memm.h similarity index 100% rename from src/include/kernel/arch/x86_64/memm.h rename to include/kernel/arch/x86_64/memm.h diff --git a/src/include/kernel/kernel.h b/include/kernel/kernel.h similarity index 100% rename from src/include/kernel/kernel.h rename to include/kernel/kernel.h diff --git a/src/include/kernel/klog.h b/include/kernel/klog.h similarity index 100% rename from src/include/kernel/klog.h rename to include/kernel/klog.h diff --git a/src/include/kernel/memm.h b/include/kernel/memm.h similarity index 100% rename from src/include/kernel/memm.h rename to include/kernel/memm.h diff --git a/src/include/kernel/memm/allocator/raw.h b/include/kernel/memm/allocator/raw.h similarity index 100% rename from src/include/kernel/memm/allocator/raw.h rename to include/kernel/memm/allocator/raw.h diff --git a/src/include/kernel/tty.h b/include/kernel/tty.h similarity index 100% rename from src/include/kernel/tty.h rename to include/kernel/tty.h diff --git a/src/include/libk/bits.h b/include/libk/bits.h similarity index 100% rename from src/include/libk/bits.h rename to include/libk/bits.h diff --git a/src/include/libk/lst.h b/include/libk/lst.h similarity index 100% rename from src/include/libk/lst.h rename to include/libk/lst.h diff --git a/src/include/libk/math.h b/include/libk/math.h similarity index 100% rename from src/include/libk/math.h rename to include/libk/math.h diff --git a/src/include/libk/multiboot2.h b/include/libk/multiboot2.h similarity index 100% rename from src/include/libk/multiboot2.h rename to include/libk/multiboot2.h diff --git a/src/include/libk/multiboot2/bootinfo.h b/include/libk/multiboot2/bootinfo.h similarity index 100% rename from src/include/libk/multiboot2/bootinfo.h rename to include/libk/multiboot2/bootinfo.h diff --git a/src/include/libk/string.h b/include/libk/string.h similarity index 100% rename from src/include/libk/string.h rename to include/libk/string.h diff --git a/src/include/types.h b/include/types.h similarity index 100% rename from src/include/types.h rename to include/types.h diff --git a/src/include/utils.h b/include/utils.h similarity index 100% rename from src/include/utils.h rename to include/utils.h diff --git a/src/Makefile b/src/Makefile index 39da335..b647f1e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,5 +1,6 @@ ARCH := $(shell uname -m) -SOURCE := $(shell pwd)/scripts +PWD := $(shell pwd) +SOURCE := ${PWD}/scripts ifeq (${ARCH},x86_64) ASM = nasm ASMFLAGS = -f elf64 @@ -11,7 +12,7 @@ endif SUBOBJS = kernel/kernel.o libk/libk.o -DEFINES = ARCH="${ARCH}" ASM="${ASM}" ASMFLAGS="${ASMFLAGS}" SOURCE="${SOURCE}" +DEFINES = ARCH="${ARCH}" ASM="${ASM}" ASMFLAGS="${ASMFLAGS}" SOURCE="${SOURCE}" PWD="${PWD}" ifdef release DEFINES := ${DEFINES} release=1 endif diff --git a/src/kernel/Makefile b/src/kernel/Makefile index 969fe82..4bdad92 100644 --- a/src/kernel/Makefile +++ b/src/kernel/Makefile @@ -1,15 +1,17 @@ +.SUFFIXES: + ################################ # C语言环境变量 CC = gcc -CCFLAGS = -m64 -mcmodel=large -I ../include \ +CCFLAGS = -m64 -mcmodel=large -I ../../include \ -fno-stack-protector -fno-exceptions \ -fno-builtin -nostdinc -nostdlib ifdef release CCFLAGS := ${CCFLAGS} -O2 endif -C_SRCS = main.c tty.c klog.c font.c memm.c memm_${ARCH}.c raw.c +C_SRCS = main.c tty.c font.c memm.c memm_${ARCH}.c raw.c C_OBJS = ${C_SRCS:.c=.c.o} ################################ @@ -17,9 +19,9 @@ C_OBJS = ${C_SRCS:.c=.c.o} ################################ # rust语音环境变量 -RSCFLAGS = --emit=obj --target x86_64-unknown-linux-gnu --crate-type=bin +RSCFLAGS = --emit obj --crate-type lib -L crate="${PWD}/src/" -RS_SRCS = +RS_SRCS = klog.rs RS_OBJS = ${RS_SRCS:.rs=.rs.o} ################################ @@ -34,7 +36,7 @@ endif ASMFLAGS := ${ASMFLAGS} ASMFLAGS32 = -f elf32 -S_SRCS = entry32.s entry.s memm_${ARCH}_s.s +S_SRCS = entry32.s entry.s memm_${ARCH}.s S_OBJS = ${S_SRCS:.s=.s.o} ################################ diff --git a/src/kernel/arch/x86_64/memm_x86_64_s.s b/src/kernel/arch/x86_64/memm_x86_64.s similarity index 100% rename from src/kernel/arch/x86_64/memm_x86_64_s.s rename to src/kernel/arch/x86_64/memm_x86_64.s diff --git a/src/kernel/klog/klog.c b/src/kernel/klog/klog.c deleted file mode 100644 index e69de29..0000000 diff --git a/src/libk/Makefile b/src/libk/Makefile index 9a200e3..aec1bdb 100644 --- a/src/libk/Makefile +++ b/src/libk/Makefile @@ -1,13 +1,10 @@ -ARCH := $(shell uname -m) -ifdef release - release = 1 -endif +.SUFFIXES: ################################ # C语言环境变量 CC = gcc -CCFLAGS = -m64 -mcmodel=large -I ../include \ +CCFLAGS = -m64 -mcmodel=large -I ../../include \ -fno-stack-protector -fno-exceptions \ -fno-builtin -nostdinc -nostdlib ifdef release @@ -22,7 +19,7 @@ C_OBJS = ${C_SRCS:.c=.c.o} ################################ # rust语音环境变量 -RSCFLAGS = --emit=obj --target x86_64-unknown-linux-gnu --crate-type=bin +RSCFLAGS = --emit obj --crate-type lib -L crate="${PWD}/src/" RS_SRCS = RS_OBJS = ${RS_SRCS:.rs=.rs.o}