diff options
| -rw-r--r-- | kernel/include/stdio.h (renamed from libc/include/stdio.h) | 0 | ||||
| -rw-r--r-- | kernel/include/stdlib.h (renamed from libc/include/stdlib.h) | 0 | ||||
| -rw-r--r-- | kernel/include/string.h (renamed from libc/include/string.h) | 0 | ||||
| -rw-r--r-- | kernel/include/sys/cdefs.h (renamed from libc/include/sys/cdefs.h) | 0 | ||||
| -rw-r--r-- | kernel/makefile | 16 | ||||
| -rw-r--r-- | kernel/std/README.txt (renamed from libc/README.txt) | 4 | ||||
| -rw-r--r-- | kernel/std/abort.c (renamed from libc/abort.c) | 0 | ||||
| -rw-r--r-- | kernel/std/memcmp.c (renamed from libc/memcmp.c) | 0 | ||||
| -rw-r--r-- | kernel/std/memcpy.c (renamed from libc/memcpy.c) | 0 | ||||
| -rw-r--r-- | kernel/std/memmove.c (renamed from libc/memmove.c) | 0 | ||||
| -rw-r--r-- | kernel/std/memset.c (renamed from libc/memset.c) | 0 | ||||
| -rw-r--r-- | kernel/std/printf.c (renamed from libc/printf.c) | 0 | ||||
| -rw-r--r-- | kernel/std/putchar.c (renamed from libc/putchar.c) | 0 | ||||
| -rw-r--r-- | kernel/std/puts.c (renamed from libc/puts.c) | 0 | ||||
| -rw-r--r-- | kernel/std/strlen.c (renamed from libc/strlen.c) | 0 | ||||
| -rw-r--r-- | libc/makefile | 79 | ||||
| -rw-r--r-- | makefile | 21 | ||||
| -rw-r--r-- | setup_sysroot.sh | 6 |
18 files changed, 19 insertions, 107 deletions
diff --git a/libc/include/stdio.h b/kernel/include/stdio.h index eb4e45b..eb4e45b 100644 --- a/libc/include/stdio.h +++ b/kernel/include/stdio.h diff --git a/libc/include/stdlib.h b/kernel/include/stdlib.h index 1d1ee32..1d1ee32 100644 --- a/libc/include/stdlib.h +++ b/kernel/include/stdlib.h diff --git a/libc/include/string.h b/kernel/include/string.h index 4f6b5bd..4f6b5bd 100644 --- a/libc/include/string.h +++ b/kernel/include/string.h diff --git a/libc/include/sys/cdefs.h b/kernel/include/sys/cdefs.h index 1e2c277..1e2c277 100644 --- a/libc/include/sys/cdefs.h +++ b/kernel/include/sys/cdefs.h diff --git a/kernel/makefile b/kernel/makefile index a855808..52f4d00 100644 --- a/kernel/makefile +++ b/kernel/makefile @@ -20,20 +20,22 @@ ifndef SYSROOT $(error No sysroot specified)
endif
-LIBS = -nostdlib -lc -lgcc
+LIBS = -nostdlib -lgcc
#Find all the source files
+C_SRCS := $(shell find . -type f -name '*.c' -not -path './arch/*') \
+ $(shell find $(PWD)/kernel/arch/$(ARCH) -type f -name '*.c')
CPP_SRCS := $(shell find . -type f -name '*.cpp' -not -path './arch/*') \
$(shell find $(PWD)/kernel/arch/$(ARCH) -type f -name '*.cpp')
HEADERS := $(shell find ./include -type f -name '*.h')
ASMFILES := $(shell find . -type f -name '*.asm' -not -path './arch/*') \
$(shell find $(PWD)/kernel/arch/$(ARCH) -type f -name '*.asm')
-#OBJS := $(patsubst %.c,%.o,$(C_SOURCES))
-OBJS := $(patsubst %.cpp,%.o,$(CPP_SRCS))
+OBJS := $(patsubst %.c,%.o,$(C_SRCS))
+OBJS += $(patsubst %.cpp,%.o,$(CPP_SRCS))
OBJS += $(patsubst %.asm,%.o,$(ASMFILES))
-#DEPFILES := $(patsubst %.c,%.d,$(C_SOURCES))
+DEPFILES := $(patsubst %.c,%.d,$(C_SOURCES))
DEPFILES := $(patsubst %.cpp,%.d,$(CPP_SRCS))
# LINKLST := crti.o
@@ -62,7 +64,7 @@ kernel.bin: ${OBJS} $(CC) $(CFLAGS) -MMD -MP -c $< -o $@
%.o: %.asm
- $(info [INFO] Assembling $<)
+# $(info [INFO] Assembling $<)
$(NASM) $< $(ASMFLAGS) -o $@ -g
# crti.o:
@@ -71,8 +73,8 @@ kernel.bin: ${OBJS} # crtn.o:
# $(NASM) arch/$(ARCH)/crtn.asm $(ASMFLAGS) -o $@
-install-headers: $(HEADERS)
- cp -r --preserve=timestamps include/. $(SYSROOT)/usr/include
+# install-headers: $(HEADERS)
+# cp -r --preserve=timestamps include/. $(SYSROOT)/usr/include
clean:
$(info [INFO] Cleaning)
diff --git a/libc/README.txt b/kernel/std/README.txt index 6806bd4..ef7c787 100644 --- a/libc/README.txt +++ b/kernel/std/README.txt @@ -1,5 +1,3 @@ -a temporary(?) libc for the kernel
+some libc functions for the kernel
code based off meaty skeleton from osdev.org
-
-todo:
\ No newline at end of file diff --git a/libc/abort.c b/kernel/std/abort.c index 83873e8..83873e8 100644 --- a/libc/abort.c +++ b/kernel/std/abort.c diff --git a/libc/memcmp.c b/kernel/std/memcmp.c index 93141e1..93141e1 100644 --- a/libc/memcmp.c +++ b/kernel/std/memcmp.c diff --git a/libc/memcpy.c b/kernel/std/memcpy.c index 7e09be7..7e09be7 100644 --- a/libc/memcpy.c +++ b/kernel/std/memcpy.c diff --git a/libc/memmove.c b/kernel/std/memmove.c index 98c787f..98c787f 100644 --- a/libc/memmove.c +++ b/kernel/std/memmove.c diff --git a/libc/memset.c b/kernel/std/memset.c index 67dadfe..67dadfe 100644 --- a/libc/memset.c +++ b/kernel/std/memset.c diff --git a/libc/printf.c b/kernel/std/printf.c index 0bb5506..0bb5506 100644 --- a/libc/printf.c +++ b/kernel/std/printf.c diff --git a/libc/putchar.c b/kernel/std/putchar.c index f0f5783..f0f5783 100644 --- a/libc/putchar.c +++ b/kernel/std/putchar.c diff --git a/libc/puts.c b/kernel/std/puts.c index 8c8c036..8c8c036 100644 --- a/libc/puts.c +++ b/kernel/std/puts.c diff --git a/libc/strlen.c b/kernel/std/strlen.c index 441622a..441622a 100644 --- a/libc/strlen.c +++ b/kernel/std/strlen.c diff --git a/libc/makefile b/libc/makefile deleted file mode 100644 index aec21ef..0000000 --- a/libc/makefile +++ /dev/null @@ -1,79 +0,0 @@ -# libc makefile
-
-ifndef AR
- AR = i686-elf-ar
-endif
-
-ifndef CFLAGS
- CFLAGS = -ffreestanding -Wall -Wextra -g -std=gnu11 -O2 -Iinclude
- CFLAGS += --sysroot=$(SYSROOT)
- CFLAGS += -isystem $(SYSROOT)/usr/include
-endif
-
-ifndef CXXFLAGS
- CXXFLAGS = -ffreestanding -Wall -Wextra -fno-exceptions -fno-rtti -D__is_kernel -g -O2 -Iinclude
- CXXFLAGS += -Iinclude
- CXXFLAGS += --sysroot=$(SYSROOT)
- CXXFLAGS += -isystem $(SYSROOT)/usr/include
-endif
-
-ifndef LDFLAGS
- LDFLAGS = -T arch/$(ARCH)/linker.ld -ffreestanding -g -O2 -Iinclude
- LDFLAGS += --sysroot=$(SYSROOT)
- LDFLAGS += -isystem $(SYSROOT)/usr/include
-endif
-
-ifndef SYSROOT
- $(error No sysroot specified)
-endif
-
-
-LIBS = -nostdlib -lgcc
-
-#Find all the source files
-C_SOURCES := $(shell find $(PWD) -type f -name '*.c')
-#CPP_SOURCES := $(shell find $(PWD)/kernel -type f -name '*.cpp')
-HEADERS := $(shell find $(PWD) -type f -name '*.h')
-#ASMFILES := $(shell find $(PWD) -type f -name '*.asm')
-
-OBJECTS := $(patsubst %.c,%.o,$(C_SOURCES))
-# OBJECTS += $(patsubst %.cpp,%.o,$(CPP_SOURCES))
-# OBJECTS += $(patsubst %.asm,%.o,$(ASMFILES))
-
-DEPFILES := $(patsubst %.c,%.d,$(C_SOURCES))
-# DEPFILES += $(patsubst %.cpp,%.d,$(CPP_SOURCES))
-
-LINKLST += $(OBJECTS)
-LINKLST += $(LIBS)
-
--include $(DEPFILES)
-
-.PHONY: all install-headers install-lib clean
-
-all: libc.a install-lib
-
-libc.a: ${OBJECTS}
- $(info [INFO] Linking $<)
- $(AR) rcs $@ $(OBJECTS)
-
-%.o: %.cpp
- $(info [INFO] Compiling $<)
- $(CXX) ${CXXFLAGS} -MMD -MP -c $< -o $@
-
-%.o: %.c
- $(info [INFO] Compiling $<)
- $(CC) $(CFLAGS) -MMD -MP -c $< -o $@
-
-%.o: %.asm
- $(info [INFO] Assembling $<)
- $(NASM) $< -felf32 -o $@ -g
-
-install-headers:
- cp -r --preserve=timestamps include/. $(SYSROOT)/usr/include
-
-install-lib: libc.a
- cp -r $< $(SYSROOT)/usr/lib/.
-
-clean:
- $(info [INFO] Cleaning)
- $(RM) ${OBJECTS} $(DEPFILES) libc.a
\ No newline at end of file @@ -18,13 +18,9 @@ QEMU = qemu-system-$(ARCH) all: build-all limine
-build-all: kernel/kernel.bin libc/libc.a
+build-all: kernel/kernel.bin
-libc/libc.a: install-headers
- $(info [INFO] Building libc)
- $(MAKE) -C ./libc/ all
-
-kernel/kernel.bin: libc/libc.a install-headers
+kernel/kernel.bin:
$(info [INFO] Building kernel)
$(MAKE) -C ./kernel/ all
@@ -40,16 +36,15 @@ limine: build-all qemu: limine
$(QEMU) -no-shutdown -no-reboot --serial stdio -s -m 1024 -hda $(OS_NAME).iso
-install: install-headers install-libraries
+# install: install-headers install-libraries
-install-headers:
- $(MAKE) -C ./kernel/ install-headers
- $(MAKE) -C ./libc/ install-headers
+# install-headers:
+# $(MAKE) -C ./kernel/ install-headers
+# $(MAKE) -C ./libc/ install-headers
-install-libraries:
- $(MAKE) -C ./libc/ install-lib
+# install-libraries:
+# $(MAKE) -C ./libc/ install-lib
clean:
-@$(MAKE) -C ./kernel/ clean
- -@$(MAKE) -C ./libc/ clean
-@$(RM) $(wildcard *.bin *.a)
diff --git a/setup_sysroot.sh b/setup_sysroot.sh index 5c48677..4a8697b 100644 --- a/setup_sysroot.sh +++ b/setup_sysroot.sh @@ -2,8 +2,4 @@ # creates the needed sysroot folders if non existant mkdir -p sysroot/usr/include -mkdir -p sysroot/usr/lib - -# copies all needed header files for compiling -cp -r kernel/include/* sysroot/usr/include -cp -r libc/include/* sysroot/usr/include
\ No newline at end of file +mkdir -p sysroot/usr/lib
\ No newline at end of file |
