From 7ce00a6ed2e811de4b356bba74eff647940b38da Mon Sep 17 00:00:00 2001 From: ivoszbg Date: Thu, 16 Jun 2022 14:37:20 +0300 Subject: [PATCH] main: Move assembly code into an individual arch-specific folder Signed-off-by: Ivaylo Ivanov --- .gitignore | 2 +- Makefile | 10 ++++++---- arch/Makefile | 1 + {main => arch/aarch64}/Start.S | 0 {main => arch/aarch64}/linker.lds.S | 2 +- main/Makefile | 1 - 6 files changed, 9 insertions(+), 7 deletions(-) create mode 100644 arch/Makefile rename {main => arch/aarch64}/Start.S (100%) rename {main => arch/aarch64}/linker.lds.S (94%) diff --git a/.gitignore b/.gitignore index 1d4fc0b..89dda01 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ uniLoader *.o main/*.o -main/linker.lds +arch/aarch64/linker.lds board/*/*.o* board/*.a* soc/*/*.o* diff --git a/Makefile b/Makefile index 1a3854a..5c3c142 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ # o use make's built-in rules and variables # (this increases performance and avoids hard-to-debug behaviour); # o print "Entering directory ..."; +ARCH ?= aarch64 MAKEFLAGS += -rR --no-print-directory # To put more focus on warnings, be less verbose as default @@ -334,14 +335,15 @@ endif # $(dot-config) # command line. # This allow a user to issue only 'make' to build a kernel including modules # Defaults to vmlinux, but the arch makefile usually adds further targets -all: main/linker.lds uniLoader +all: arch/$(ARCH)/linker.lds uniLoader # List of main executables main-y := main/main.o -main-y += main/Start.o +main-y += arch/$(ARCH)/Start.o # Object directories objs-y := main +objs-y += arch libs-y := soc libs-y += board libs-y += lib @@ -355,9 +357,9 @@ uniLoader-all := $(uniLoader-objs) $(uniLoader-libs) # Do modpost on a prelinked vmlinux. The finally linked vmlinux has # relevant sections renamed as per the linker script. quiet_cmd_uniLoader = LD $@.o - cmd_uniLoader = $(LD) $(main-y) $(uniLoader-libs) -o $@.o --script=main/linker.lds + cmd_uniLoader = $(LD) $(main-y) $(uniLoader-libs) -o $@.o --script=arch/$(ARCH)/linker.lds -main/linker.lds: main/linker.lds.S $(KERNEL_PATH) +arch/$(ARCH)/linker.lds: arch/$(ARCH)/linker.lds.S $(KERNEL_PATH) $(CPP) $< -DKERNEL_PATH=$(KERNEL_PATH) -DDTB_PATH=$(DT_PATH) -P -o $@ uniLoader: $(uniLoader-all) diff --git a/arch/Makefile b/arch/Makefile new file mode 100644 index 0000000..e403bdc --- /dev/null +++ b/arch/Makefile @@ -0,0 +1 @@ +obj-y += $(ARCH)/Start.o diff --git a/main/Start.S b/arch/aarch64/Start.S similarity index 100% rename from main/Start.S rename to arch/aarch64/Start.S diff --git a/main/linker.lds.S b/arch/aarch64/linker.lds.S similarity index 94% rename from main/linker.lds.S rename to arch/aarch64/linker.lds.S index ce9b1c1..e145266 100644 --- a/main/linker.lds.S +++ b/arch/aarch64/linker.lds.S @@ -13,7 +13,7 @@ INPUT(DTB_PATH) SECTIONS { .boot : { - main/Start.o + arch/aarch64/Start.o } .dtb ALIGN(0x1000) : { diff --git a/main/Makefile b/main/Makefile index 2ee57c4..c4f4b11 100644 --- a/main/Makefile +++ b/main/Makefile @@ -1,2 +1 @@ obj-y := main.o -obj-y += Start.o