summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sys/Makefile11
-rw-r--r--src/sys/arch/i386/Makefile2
-rw-r--r--src/sys/arch/i386/locore.S2
-rw-r--r--src/sys/kern/Makefile25
-rw-r--r--src/sys/kern/kern_init.c8
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 (;;);
+}