main: Move assembly code into an individual arch-specific folder

Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
This commit is contained in:
ivoszbg 2022-06-16 14:37:20 +03:00
parent 79c5d972e1
commit 7ce00a6ed2
6 changed files with 9 additions and 7 deletions

2
.gitignore vendored
View File

@ -1,7 +1,7 @@
uniLoader uniLoader
*.o *.o
main/*.o main/*.o
main/linker.lds arch/aarch64/linker.lds
board/*/*.o* board/*/*.o*
board/*.a* board/*.a*
soc/*/*.o* soc/*/*.o*

View File

@ -10,6 +10,7 @@
# o use make's built-in rules and variables # o use make's built-in rules and variables
# (this increases performance and avoids hard-to-debug behaviour); # (this increases performance and avoids hard-to-debug behaviour);
# o print "Entering directory ..."; # o print "Entering directory ...";
ARCH ?= aarch64
MAKEFLAGS += -rR --no-print-directory MAKEFLAGS += -rR --no-print-directory
# To put more focus on warnings, be less verbose as default # To put more focus on warnings, be less verbose as default
@ -334,14 +335,15 @@ endif # $(dot-config)
# command line. # command line.
# This allow a user to issue only 'make' to build a kernel including modules # 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 # 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 # List of main executables
main-y := main/main.o main-y := main/main.o
main-y += main/Start.o main-y += arch/$(ARCH)/Start.o
# Object directories # Object directories
objs-y := main objs-y := main
objs-y += arch
libs-y := soc libs-y := soc
libs-y += board libs-y += board
libs-y += lib libs-y += lib
@ -355,9 +357,9 @@ uniLoader-all := $(uniLoader-objs) $(uniLoader-libs)
# Do modpost on a prelinked vmlinux. The finally linked vmlinux has # Do modpost on a prelinked vmlinux. The finally linked vmlinux has
# relevant sections renamed as per the linker script. # relevant sections renamed as per the linker script.
quiet_cmd_uniLoader = LD $@.o 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 $@ $(CPP) $< -DKERNEL_PATH=$(KERNEL_PATH) -DDTB_PATH=$(DT_PATH) -P -o $@
uniLoader: $(uniLoader-all) uniLoader: $(uniLoader-all)

1
arch/Makefile Normal file
View File

@ -0,0 +1 @@
obj-y += $(ARCH)/Start.o

View File

@ -13,7 +13,7 @@ INPUT(DTB_PATH)
SECTIONS SECTIONS
{ {
.boot : { .boot : {
main/Start.o arch/aarch64/Start.o
} }
.dtb ALIGN(0x1000) : { .dtb ALIGN(0x1000) : {

View File

@ -1,2 +1 @@
obj-y := main.o obj-y := main.o
obj-y += Start.o