diff --git a/Makefile b/Makefile index 4093d5a..8ccdf7b 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,8 @@ #Standard Compiling Options - -#Something weird with i386 vs i686 -ARCH ?= i386 -C := i686-elf-gcc -CXX := i686-elf-g++ -AS := i686-elf-as +ARCH ?= i686 +C := $(ARCH)-elf-gcc +CXX := $(ARCH)-elf-g++ +AS := $(ARCH)-elf-as #Separate out source directories for better compartmentalization SRCDIR := src @@ -26,13 +24,13 @@ CPPINCEXT := hpp ASSRCEXT := s #Locate C and C++ files -CSOURCES := $(shell find $(SRCDIRS) -type f -name "*.$(CSRCEXT)") -CPPSOURCES := $(shell find $(SRCDIRS) -type f -name "*.$(CPPSRCEXT)") +CSOURCES := $(shell find $(SRCDIR) -type f -name "*.$(CSRCEXT)") +CPPSOURCES := $(shell find $(SRCDIR) -type f -name "*.$(CPPSRCEXT)") #Get object files from C and C++ source files OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(CSOURCES:.$(CSRCEXT)=.o)) $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(CPPSOURCES:.$(CPPSRCEXT)=.o)) #Get assembly source files and create objects from them -ASSOURCES := $(shell find $(SRCDIRS) -type f -name "*.$(ASSRCEXT)") +ASSOURCES := $(shell find $(SRCDIR) -type f -name "*.$(ASSRCEXT)") ASOBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(ASSOURCES:.$(ASSRCEXT)=.o)) #Find dependencies from C and C++ source files @@ -43,7 +41,7 @@ DEPENDENCIES := $(DEPENDENCIES) $(patsubst $(SRCDIR)/%,$(DEPDIR)/%,$(CPPSOURCES: #Directories needed by gcc LIB := LIBDIR := -INC := -I include/ -I include/libc/ +INC := -I include/ -I include/libc/ -I include/ACPICA #Combined flags (Both C and C++) FLAGS := -O2 -Wall -Wextra -g -D__is_kernel -ffreestanding -fstack-protector @@ -66,8 +64,8 @@ GLOBALARCHDIR := $(BUILDDIR)/arch/global-$(ARCH) CRTBEGINOBJ := $($(C) $(CFLAGS) -print-file-name=crtbegin.o) CRTENDOBJ := $($(C) $(CFLAGS) -print-file-name=crtend.o) -CRTBEGIN := $(GLOBALARCHDIR)/crti.o $(GLOBALARCHDIR)/crtbegin.o -CRTEND := $(GLOBALARCHDIR)/crtend.o $(GLOBALARCHDIR)/crtn.o +CRTBEGIN := $(GLOBALARCHDIR)/crti.o $(CRTBEGINOBJ) +CRTEND := $(CRTENDOBJ) $(GLOBALARCHDIR)/crtn.o #Order the objects to prevent weird gcc bugs with global constructors MAINOBJS := $(CRTBEGIN) $(OBJECTS) $(ASOBJECTS) $(CRTEND) @@ -144,11 +142,6 @@ $(BUILDDIR)/%.o: $(SRCDIR)/%.$(ASSRCEXT) #Compile object $(AS) $(ASFLAGS) -o $@ $< -$(GLOBALARCHDIR)/crtbegin.o $(GLOBALARCHDIR)/crtend.o: - OBJ=`$(C) $(CFLAGS) -print-file-name=$(@F)` && cp "$$OBJ" $@ - - - #Clean clean: @echo " Cleaning..."; diff --git a/include/arch/i386/vga.h b/include/arch/i686/vga.h similarity index 94% rename from include/arch/i386/vga.h rename to include/arch/i686/vga.h index af23b80..9069b0e 100644 --- a/include/arch/i386/vga.h +++ b/include/arch/i686/vga.h @@ -1,5 +1,5 @@ -#ifndef ARCH_I386_VGA_H -#define ARCH_I386_VGA_H +#ifndef ARCH_I686_VGA_H +#define ARCH_I686_VGA_H #include #include diff --git a/src/arch/global-i386/crti.s b/src/arch/global-i686/crti.s similarity index 100% rename from src/arch/global-i386/crti.s rename to src/arch/global-i686/crti.s diff --git a/src/arch/global-i386/crtn.s b/src/arch/global-i686/crtn.s similarity index 100% rename from src/arch/global-i386/crtn.s rename to src/arch/global-i686/crtn.s diff --git a/src/arch/i386/vga.c b/src/arch/i386/vga.c deleted file mode 100644 index 08b85bf..0000000 --- a/src/arch/i386/vga.c +++ /dev/null @@ -1,2 +0,0 @@ -#include - diff --git a/src/arch/i386/boot.s b/src/arch/i686/boot.s similarity index 100% rename from src/arch/i386/boot.s rename to src/arch/i686/boot.s diff --git a/src/arch/i686/vga.c b/src/arch/i686/vga.c new file mode 100644 index 0000000..3b744de --- /dev/null +++ b/src/arch/i686/vga.c @@ -0,0 +1,2 @@ +#include + diff --git a/src/kernel/kernel.c b/src/kernel/kernel.c index f818cd7..2ddca88 100644 --- a/src/kernel/kernel.c +++ b/src/kernel/kernel.c @@ -7,16 +7,16 @@ #endif /* This tutorial will only work for the 32-bit ix86 targets. */ -#if !defined(__i386__) +#if !defined(__i686__) #error "This tutorial needs to be compiled with a ix86-elf compiler" #endif - - + + void kernel_main(void) { /* Initialize terminal interface */ terminal_initialize(); /* Newline support is left as an exercise. */ - terminal_writestring("Hello, kernel World!\nHello again!!"); + terminal_writestring("Hello, kernel World!\nHello again!! And one more time!"); } diff --git a/src/kernel/tty.c b/src/kernel/tty.c index c4c2f07..7bee38f 100644 --- a/src/kernel/tty.c +++ b/src/kernel/tty.c @@ -1,5 +1,5 @@ #include -#include +#include #include size_t terminal_row;