Browse Source

arch/arm: Separate out architecture-specifics

Aaron Lindsay 7 years ago
parent
commit
a1fb385d97

+ 3 - 3
Makefile

@@ -17,9 +17,9 @@ OBJCOPY = $(TOOL_PREFIX)objcopy
17 17
 OBJDUMP = $(TOOL_PREFIX)objdump
18 18
 
19 19
 # Define the flags we'll need for our tools
20
-INCLUDES = -I include
20
+INCLUDES = -I include -I arch/$(ARCH)/include
21 21
 KCFLAGS = -g -Wall -Wextra -Werror -nostdlib -nostartfiles -fno-builtin -std=gnu99 -include config.h $(INCLUDES)
22
-KLDFLAGS = -T link.ld -L /usr/lib/gcc/arm-elf/4.7.0/
22
+KLDFLAGS = -T arch/$(ARCH)/kernel.ld -L /usr/lib/gcc/arm-elf/4.7.0/
23 23
 EXTRA_LIBS = -lgcc
24 24
 
25 25
 # Include the config file so we don't compile/link unnecessary objects
@@ -30,7 +30,7 @@ KOBJS :=
30 30
 
31 31
 # Initialize sub-directory Makefile inclusion
32 32
 BASEDIR = $(shell pwd)
33
-SUBDIRS := boot kernel drivers
33
+SUBDIRS := arch/$(ARCH) kernel drivers
34 34
 ifneq (,$(SUBDIRS))
35 35
 	include $(patsubst %,%/kernel.mk,$(SUBDIRS))
36 36
 endif

+ 21 - 0
arch/arm/include/arch/types.h

@@ -0,0 +1,21 @@
1
+/*
2
+    Copyright (C) 2012, Aaron Lindsay <aaron@aclindsay.com>
3
+
4
+    This file is part of Aedrix.
5
+
6
+    This program is free software; you can redistribute it and/or modify
7
+    it under the terms of the GNU General Public License as published by
8
+    the Free Software Foundation; either version 2 of the License, or
9
+    (at your option) any later version.
10
+
11
+    This program is distributed in the hope that it will be useful,
12
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
+    GNU General Public License for more details.
15
+
16
+    You should have received a copy of the GNU General Public License along
17
+    with this program; if not, write to the Free Software Foundation, Inc.,
18
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
+ */
20
+
21
+#include <arch-generic/types.h>

link.ld → arch/arm/kernel.ld


boot/kernel.mk → arch/arm/kernel.mk

@@ -1,5 +1,5 @@
1
-DIRNAME := boot
2
-SUBDIRS :=
1
+DIRNAME := arch/arm
2
+SUBDIRS := kernel
3 3
 
4 4
 include $(BASEDIR)/header.mk
5 5
 

+ 10 - 0
arch/arm/kernel/kernel.mk

@@ -0,0 +1,10 @@
1
+DIRNAME := kernel
2
+SUBDIRS :=
3
+
4
+include $(BASEDIR)/header.mk
5
+
6
+OBJS_$(d) := $(d)/mmu.o
7
+
8
+KOBJS += $(OBJS_$(d))
9
+
10
+include $(BASEDIR)/footer.mk

kernel/mmu.c → arch/arm/kernel/mmu.c


boot/start.S → arch/arm/start.S


+ 21 - 0
include/arch-generic/types.h

@@ -0,0 +1,21 @@
1
+/*
2
+    Copyright (C) 2012, Aaron Lindsay <aaron@aclindsay.com>
3
+
4
+    This file is part of Aedrix.
5
+
6
+    This program is free software; you can redistribute it and/or modify
7
+    it under the terms of the GNU General Public License as published by
8
+    the Free Software Foundation; either version 2 of the License, or
9
+    (at your option) any later version.
10
+
11
+    This program is distributed in the hope that it will be useful,
12
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
+    GNU General Public License for more details.
15
+
16
+    You should have received a copy of the GNU General Public License along
17
+    with this program; if not, write to the Free Software Foundation, Inc.,
18
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
+ */
20
+
21
+typedef unsigned int uint32;

+ 1 - 1
include/types.h

@@ -18,4 +18,4 @@
18 18
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 19
  */
20 20
 
21
-typedef unsigned int uint32;
21
+#include <arch/types.h>

+ 0 - 1
kernel/kernel.mk

@@ -12,7 +12,6 @@ OBJS_$(d) := $(d)/atags.o \
12 12
 	$(d)/list.o \
13 13
 	$(d)/math.o \
14 14
 	$(d)/mm.o \
15
-	$(d)/mmu.o \
16 15
 	$(d)/print.o
17 16
 
18 17
 KOBJS += $(OBJS_$(d))