diff options
author | Ian Moffett <ian@osmora.org> | 2025-09-13 18:00:04 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-09-13 18:00:04 -0400 |
commit | 56d5c946c208e2b8f66608d0212714e70c9f480c (patch) | |
tree | d2d4a7986439cb853a1bce61354cfc4b572a82da /src/sys | |
parent | b4dd90f9e51a0d15b7300e6338873eee8f12968d (diff) |
kernel: Add kern_init.c
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys')
-rw-r--r-- | src/sys/Makefile | 11 | ||||
-rw-r--r-- | src/sys/arch/i386/Makefile | 2 | ||||
-rw-r--r-- | src/sys/arch/i386/locore.S | 2 | ||||
-rw-r--r-- | src/sys/kern/Makefile | 25 | ||||
-rw-r--r-- | src/sys/kern/kern_init.c | 8 |
5 files changed, 45 insertions, 3 deletions
diff --git a/src/sys/Makefile b/src/sys/Makefile index 52e4e20..a00f247 100644 --- a/src/sys/Makefile +++ b/src/sys/Makefile @@ -6,7 +6,15 @@ LD = AS = .PHONY: all -all: md +all: target md kern + +.PHONY: target +target: + mkdir -p target/ + +.PHONY: kern +kern: + cd kern; make CC=$(CC) LD=$(LD) AS=$(AS) .PHONY: md md: @@ -15,3 +23,4 @@ md: .PHONY: clean clean: cd $(TARGETDIR); make clean + cd kern; make clean diff --git a/src/sys/arch/i386/Makefile b/src/sys/arch/i386/Makefile index 2db5f9a..78e6e4c 100644 --- a/src/sys/arch/i386/Makefile +++ b/src/sys/arch/i386/Makefile @@ -14,7 +14,7 @@ ASMOBJECTS = $(ASMFILES:.S=.S.o) DEPS = $(CFILES:.c=.d) ASMDEPS = $(ASMFILES:.S=.S.d) OBJECTS = $(CFILES:%.c=%.o) -LD_FLAGS = -Tconf/sys.ld +LD_FLAGS = -Tconf/sys.ld -L../../target -lkern .PHONY: all all: $(OBJECTS) $(ASMOBJECTS) diff --git a/src/sys/arch/i386/locore.S b/src/sys/arch/i386/locore.S index c1eb715..5f7c3df 100644 --- a/src/sys/arch/i386/locore.S +++ b/src/sys/arch/i386/locore.S @@ -35,7 +35,7 @@ _start: mov stack_bottom, %esp push %ebx push %eax - jmp . + jmp main .section .bss stack_bottom: diff --git a/src/sys/kern/Makefile b/src/sys/kern/Makefile new file mode 100644 index 0000000..dda389b --- /dev/null +++ b/src/sys/kern/Makefile @@ -0,0 +1,25 @@ +include ../conf/sys.mk + +.SILENT: +override PROMPT := printf "%s\t\t%s\n" + +TARGET = ../target/libkern.a +CFLAGS = -I../include/ -I../include/lib/ -I../target/header/ $(MI_CFLAGS) +CFILES = $(shell find . -name "*.c") + +DEPS = $(CFILES:.c=.d) +OBJECTS = $(CFILES:%.c=%.o) + +.PHONY: all +all: $(OBJECTS) + $(PROMPT) " MI.AR " $< + ar rcs $(TARGET) $(OBJECTS) + +-include $(DEPS) +%.o: %.c + $(PROMPT) " MI.CC " $< + $(CC) -c $(CFLAGS) $< -o $@ + +.PHONY: clean +clean: + rm -f $(DEPS) $(OBJECTS) diff --git a/src/sys/kern/kern_init.c b/src/sys/kern/kern_init.c new file mode 100644 index 0000000..10ffeae --- /dev/null +++ b/src/sys/kern/kern_init.c @@ -0,0 +1,8 @@ +/* + * Kernel entrypoint + */ +__dead void +main(void) +{ + for (;;); +} |