From ee69b4a7bb3fcbf85b170e57a81d40199eb2583e Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Thu, 16 Jan 2020 18:42:07 +0100 Subject: slightly alter the composition of makefile --- build/Makefile | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/build/Makefile b/build/Makefile index cd15ccc..75cfd6e 100644 --- a/build/Makefile +++ b/build/Makefile @@ -15,6 +15,7 @@ ARM_OBJCOPY ?= $(ARM_BASE)-objcopy ARM_ELFFLAGS ?= -nostdlib -lgcc + KERNEL_STAGE2_OBJECTS := setup.o interrupt_vector.o interrupts.o \ uart.o demo_functionality.o paging.o ramfs_embeddable.o \ ramfs.o strings.o io.o atags.o scheduler.o @@ -25,6 +26,7 @@ LOADER_STAGE2_OBJECTS := uart.o strings.o io.o loader_stage2.o RAMFS_FILES := PL0_test.img + empty:= space:= $(empty) $(empty) @@ -34,8 +36,10 @@ vpath %.S $(dirs_colon) vpath %.c $(dirs_colon) vpath %.ld $(dirs_colon) + all : kernel.img + %.o : %.c $(if $(findstring /arm/,$<),\ $(ARM_CC) $(ARM_CFLAGS),$(HOST_CC) $(HOST_CFLAGS)) -c $< -o $@ @@ -52,6 +56,7 @@ all : kernel.img %.elf : %.ld $(ARM_CC) -T $< -o $@ $(ARM_ELFFLAGS) $(filter %.o,$^) + PL0_test.elf : $(PL_0_TEST_OBJECTS) kernel.elf : kernel_stage1.o @@ -62,10 +67,23 @@ loader_stage2.elf : $(LOADER_STAGE2_OBJECTS) loader.elf : loader_stage1.o + kernel_stage1.o : kernel_stage2.img loader_stage1.o : loader_stage2.img + +ramfs.img : makefs $(RAMFS_FILES) + ./makefs $(RAMFS_FILES) > $@ + + +pipe_image : pipe_image.o rs232.o + $(HOST_CC) $^ -o $@ + +makefs : makefs.o + $(HOST_CC) $^ -o $@ + + qemu-elf : kernel.elf qemu-system-arm -m 256 -M raspi2 -serial stdio -kernel $^ @@ -79,16 +97,8 @@ qemu-loader : loader.img kernel.img pipe_image 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 + sudo screen /dev/ttyUSB0 115200,cs8,-parenb,-cstopb,-hupcl -pipe_image : pipe_image.o rs232.o - $(HOST_CC) $^ -o $@ - -makefs : makefs.o - $(HOST_CC) $^ -o $@ - -ramfs.img : makefs $(RAMFS_FILES) - ./makefs $(RAMFS_FILES) > $@ clean : -rm -f *.img *.elf *.o pipe_image makefs -- cgit v1.2.3