diff --git a/Makefile b/Makefile index 24c3964..7de14ea 100644 --- a/Makefile +++ b/Makefile @@ -17,9 +17,9 @@ OBJCOPY = $(TOOL_PREFIX)objcopy OBJDUMP = $(TOOL_PREFIX)objdump # Define the flags we'll need for our tools -INCLUDES = -I include +INCLUDES = -I include -I arch/$(ARCH)/include KCFLAGS = -g -Wall -Wextra -Werror -nostdlib -nostartfiles -fno-builtin -std=gnu99 -include config.h $(INCLUDES) -KLDFLAGS = -T link.ld -L /usr/lib/gcc/arm-elf/4.7.0/ +KLDFLAGS = -T arch/$(ARCH)/kernel.ld -L /usr/lib/gcc/arm-elf/4.7.0/ EXTRA_LIBS = -lgcc # Include the config file so we don't compile/link unnecessary objects @@ -30,7 +30,7 @@ KOBJS := # Initialize sub-directory Makefile inclusion BASEDIR = $(shell pwd) -SUBDIRS := boot kernel drivers +SUBDIRS := arch/$(ARCH) kernel drivers ifneq (,$(SUBDIRS)) include $(patsubst %,%/kernel.mk,$(SUBDIRS)) endif diff --git a/arch/arm/include/arch/types.h b/arch/arm/include/arch/types.h new file mode 100644 index 0000000..72e875c --- /dev/null +++ b/arch/arm/include/arch/types.h @@ -0,0 +1,21 @@ +/* + Copyright (C) 2012, Aaron Lindsay + + This file is part of Aedrix. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include diff --git a/link.ld b/arch/arm/kernel.ld similarity index 100% rename from link.ld rename to arch/arm/kernel.ld diff --git a/boot/kernel.mk b/arch/arm/kernel.mk similarity index 74% rename from boot/kernel.mk rename to arch/arm/kernel.mk index b4f1b32..c8dab6d 100644 --- a/boot/kernel.mk +++ b/arch/arm/kernel.mk @@ -1,5 +1,5 @@ -DIRNAME := boot -SUBDIRS := +DIRNAME := arch/arm +SUBDIRS := kernel include $(BASEDIR)/header.mk diff --git a/arch/arm/kernel/kernel.mk b/arch/arm/kernel/kernel.mk new file mode 100644 index 0000000..71b6419 --- /dev/null +++ b/arch/arm/kernel/kernel.mk @@ -0,0 +1,10 @@ +DIRNAME := kernel +SUBDIRS := + +include $(BASEDIR)/header.mk + +OBJS_$(d) := $(d)/mmu.o + +KOBJS += $(OBJS_$(d)) + +include $(BASEDIR)/footer.mk diff --git a/kernel/mmu.c b/arch/arm/kernel/mmu.c similarity index 100% rename from kernel/mmu.c rename to arch/arm/kernel/mmu.c diff --git a/boot/start.S b/arch/arm/start.S similarity index 100% rename from boot/start.S rename to arch/arm/start.S diff --git a/include/arch-generic/types.h b/include/arch-generic/types.h new file mode 100644 index 0000000..8dd868a --- /dev/null +++ b/include/arch-generic/types.h @@ -0,0 +1,21 @@ +/* + Copyright (C) 2012, Aaron Lindsay + + This file is part of Aedrix. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +typedef unsigned int uint32; diff --git a/include/types.h b/include/types.h index 8dd868a..d5eae69 100644 --- a/include/types.h +++ b/include/types.h @@ -18,4 +18,4 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -typedef unsigned int uint32; +#include diff --git a/kernel/kernel.mk b/kernel/kernel.mk index bf1dddb..869e581 100644 --- a/kernel/kernel.mk +++ b/kernel/kernel.mk @@ -12,7 +12,6 @@ OBJS_$(d) := $(d)/atags.o \ $(d)/list.o \ $(d)/math.o \ $(d)/mm.o \ - $(d)/mmu.o \ $(d)/print.o KOBJS += $(OBJS_$(d))