aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile30
1 files changed, 14 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 1dc3d51..ed090a3 100644
--- a/Makefile
+++ b/Makefile
@@ -13,44 +13,42 @@ RAMFS_FILES=PL_0_test.img
all : kernel.img
+src = src:$(wildcard src/*)
+VPATH=$(src)
+
%.o : %.c
arm-none-eabi-gcc $(CFLAGS) -c $^ -o $@
%.img : %.elf
arm-none-eabi-objcopy $^ -O binary $@
-%.o : %.S
+%.o: %.S
arm-none-eabi-as -mcpu=cortex-a7 $^ -o $@
%_embeddable.o : %.img
arm-none-eabi-objcopy -I binary -O elf32-littlearm -B arm $^ $@
-PL_0_test.elf : PL0_test.ld $(PL_0_TEST_OBJECTS)
+PL_0_test.elf : src/PL0/PL0_test.ld $(PL_0_TEST_OBJECTS)
arm-none-eabi-gcc -T $< -o $@ $(ELFFLAGS) $(PL_0_TEST_OBJECTS)
-kernel_stage1.o : kernel_stage1.S kernel_stage2.img
+kernel_stage1.o : src/boot/kernel_stage1.S kernel_stage2.img
arm-none-eabi-as -mcpu=cortex-a7 $< -o $@
-kernel.elf : kernel_stage1.ld kernel_stage1.o
+kernel.elf : src/boot/kernel_stage1.ld kernel_stage1.o
arm-none-eabi-gcc -T $< -o $@ $(ELFFLAGS) kernel_stage1.o
-kernel_stage2.elf : kernel_stage2.ld $(KERNEL_STAGE2_OBJECTS)
+kernel_stage2.elf : src/boot/kernel_stage2.ld $(KERNEL_STAGE2_OBJECTS)
arm-none-eabi-gcc -T $< -o $@ $(ELFFLAGS) $(KERNEL_STAGE2_OBJECTS)
-loader_stage2.elf : loader_stage2_linker.ld $(LOADER_STAGE2_OBJECTS)
+loader_stage2.elf : src/boot/loader_stage2_linker.ld $(LOADER_STAGE2_OBJECTS)
arm-none-eabi-gcc -T $< -o $@ $(ELFFLAGS) $(LOADER_STAGE2_OBJECTS)
-loader_stage1.o : loader_stage1.S loader_stage2.img
+loader_stage1.o : src/boot/loader_stage1.S loader_stage2.img
arm-none-eabi-as -mcpu=cortex-a7 $< -o $@
-loader.elf : loader_stage1_linker.ld loader_stage1.o
+loader.elf : src/boot/loader_stage1_linker.ld loader_stage1.o
arm-none-eabi-gcc -T $< -o $@ $(ELFFLAGS) loader_stage1.o
-loader.img : loader.elf
- arm-none-eabi-objcopy $^ -O binary $@
-# check if the resulting image is not too big
- test -n "$$(find $@ -size -16384c)" || exit -1
-
qemu-elf : kernel.elf
qemu-system-arm -m 256 -M raspi2 -serial stdio -kernel $^
@@ -64,16 +62,16 @@ run-on-rpi : kernel.img pipe_image
./pipe_image --stdout | sudo socat FILE:/dev/ttyUSB0,b115200,raw -
screen /dev/ttyUSB0 115200,cs8,-parenb,-cstopb,-hupcl
-pipe_image : pipe_image.c lib/rs232/rs232.c
+pipe_image : src/utils/pipe_image.c lib/rs232/rs232.c
gcc -Wall -std=gnu99 -O3 $^ -o $@
-makefs : makefs.c
+makefs : src/memory/makefs.c
gcc -Wall -std=gnu99 -O3 $^ -o $@
ramfs.img : makefs $(RAMFS_FILES)
./makefs $(RAMFS_FILES) > $@
clean :
- -rm *.img *.elf *.o pipe_image makefs
+ -rm -f *.img *.elf *.o pipe_image makefs
.PHONY: all qemu-elf qemu-bin clean