Restructured some files. Nameing is more consistent
i686 is a newer revision of i386 and is the version my compiler supports Files and folders have been updated to the i686 naming Makefile has been updated
This commit is contained in:
parent
241c95fd89
commit
3899428044
27
Makefile
27
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...";
|
||||
|
|
|
@ -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 <stdint.h>
|
||||
#include <stddef.h>
|
|
@ -1,2 +0,0 @@
|
|||
#include <arch/i386/vga.h>
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
#include <arch/i686/vga.h>
|
||||
|
|
@ -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!");
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <kernel/tty.h>
|
||||
#include <arch/i386/vga.h>
|
||||
#include <arch/i686/vga.h>
|
||||
#include <string.h>
|
||||
|
||||
size_t terminal_row;
|
||||
|
|
Loading…
Reference in New Issue