Commit e19db555 authored by Daniel Schwierzeck's avatar Daniel Schwierzeck Committed by Tom Rini

Kbuild: introduce Makefile in arch/$ARCH/

Introduce a Makefile under arch/$ARCH/ and include it in the
top Makefile (similar to Linux kernel). This allows further
refactoringi like moving architecture-specific code out of global
makefiles, deprecating config variables (CPU, CPUDIR, SOC) or
deprecating arch/$ARCH/config.mk.

In contrary to Linux kernel, U-Boot defines the ARCH variable by
Kconfig, thus the arch Makefile can only included conditionally
after the top config.mk.
Signed-off-by: default avatarDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: default avatarMasahiro Yamada <yamada.m@jp.panasonic.com>
parent eb8a4fe0
......@@ -503,6 +503,7 @@ autoconf_is_current := $(if $(wildcard $(KCONFIG_CONFIG)),$(shell find . \
-path ./include/config/auto.conf -newer $(KCONFIG_CONFIG)))
ifneq ($(autoconf_is_current),)
include $(srctree)/config.mk
include $(srctree)/arch/$(ARCH)/Makefile
endif
# If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
......@@ -601,17 +602,11 @@ c_flags := $(KBUILD_CFLAGS) $(cpp_flags)
#########################################################################
# U-Boot objects....order is important (i.e. start must be first)
head-y := $(CPUDIR)/start.o
head-$(CONFIG_4xx) += arch/powerpc/cpu/ppc4xx/resetvec.o
head-$(CONFIG_MPC85xx) += arch/powerpc/cpu/mpc85xx/resetvec.o
HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n)
libs-y += lib/
libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
libs-y += $(CPUDIR)/
libs-$(CONFIG_OF_EMBED) += dts/
libs-y += arch/$(ARCH)/lib/
libs-y += fs/
libs-y += net/
libs-y += disk/
......@@ -651,17 +646,6 @@ libs-$(CONFIG_HAS_POST) += post/
libs-y += test/
libs-y += test/dm/
ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610))
libs-y += arch/$(ARCH)/imx-common/
endif
ifneq (,$(filter $(SOC), armada-xp kirkwood))
libs-y += arch/$(ARCH)/mvebu-common/
endif
libs-$(CONFIG_ARM) += arch/arm/cpu/
libs-$(CONFIG_PPC) += arch/powerpc/cpu/
libs-y += $(if $(BOARDDIR),board/$(BOARDDIR)/)
libs-y := $(sort $(libs-y))
......
#
# SPDX-License-Identifier: GPL-2.0+
#
head-y := arch/arc/cpu/$(CPU)/start.o
libs-y += arch/arc/cpu/$(CPU)/
libs-y += arch/arc/lib/
#
# SPDX-License-Identifier: GPL-2.0+
#
head-y := arch/arm/cpu/$(CPU)/start.o
ifeq ($(CONFIG_SPL_BUILD),y)
ifneq ($(CONFIG_SPL_START_S_PATH),)
head-y := $(CONFIG_SPL_START_S_PATH:"%"=%)/start.o
endif
endif
libs-y += arch/arm/cpu/$(CPU)/
libs-y += arch/arm/cpu/
libs-y += arch/arm/lib/
ifeq ($(CONFIG_SPL_BUILD),y)
ifneq (,$(CONFIG_MX23)$(CONFIG_MX35)$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35))
libs-y += arch/arm/imx-common/
endif
else
ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610))
libs-y += arch/arm/imx-common/
endif
endif
ifneq (,$(filter $(SOC), armada-xp kirkwood))
libs-y += arch/arm/mvebu-common/
endif
#
# SPDX-License-Identifier: GPL-2.0+
#
head-y := arch/avr32/cpu/start.o
libs-y += arch/avr32/cpu/
libs-y += arch/avr32/lib/
#
# SPDX-License-Identifier: GPL-2.0+
#
head-y := arch/blackfin/cpu/start.o
libs-y += arch/blackfin/cpu/
libs-y += arch/blackfin/lib/
#
# SPDX-License-Identifier: GPL-2.0+
#
head-y := arch/m68k/cpu/$(CPU)/start.o
libs-y += arch/m68k/cpu/$(CPU)/
libs-y += arch/m68k/lib/
#
# SPDX-License-Identifier: GPL-2.0+
#
head-y := arch/microblaze/cpu/start.o
libs-y += arch/microblaze/cpu/
libs-y += arch/microblaze/lib/
#
# SPDX-License-Identifier: GPL-2.0+
#
head-y := arch/mips/cpu/$(CPU)/start.o
libs-y += arch/mips/cpu/$(CPU)/
libs-y += arch/mips/lib/
#
# SPDX-License-Identifier: GPL-2.0+
#
head-y := arch/nds32/cpu/$(CPU)/start.o
libs-y += arch/nds32/cpu/$(CPU)/
libs-y += arch/nds32/lib/
#
# SPDX-License-Identifier: GPL-2.0+
#
head-y := arch/nios2/cpu/start.o
libs-y += arch/nios2/cpu/
libs-y += arch/nios2/lib/
#
# SPDX-License-Identifier: GPL-2.0+
#
head-y := arch/openrisc/cpu/start.o
libs-y += arch/openrisc/cpu/
libs-y += arch/openrisc/lib/
#
# SPDX-License-Identifier: GPL-2.0+
#
head-y := arch/powerpc/cpu/$(CPU)/start.o
head-$(CONFIG_4xx) += arch/powerpc/cpu/ppc4xx/resetvec.o
head-$(CONFIG_MPC85xx) += arch/powerpc/cpu/mpc85xx/resetvec.o
libs-y += arch/powerpc/cpu/$(CPU)/
libs-y += arch/powerpc/cpu/
libs-y += arch/powerpc/lib/
#
# SPDX-License-Identifier: GPL-2.0+
#
head-y := arch/sandbox/cpu/start.o
libs-y += arch/sandbox/cpu/
libs-y += arch/sandbox/lib/
#
# SPDX-License-Identifier: GPL-2.0+
#
head-y := arch/sh/cpu/$(CPU)/start.o
libs-y += arch/sh/cpu/$(CPU)/
libs-y += arch/sh/lib/
#
# SPDX-License-Identifier: GPL-2.0+
#
head-y := arch/sparc/cpu/$(CPU)/start.o
libs-y += arch/sparc/cpu/$(CPU)/
libs-y += arch/sparc/lib/
#
# SPDX-License-Identifier: GPL-2.0+
#
head-y := arch/x86/cpu/start.o
ifeq ($(CONFIG_SPL_BUILD),y)
head-y += arch/x86/cpu/start16.o
head-y += arch/x86/cpu/resetvec.o
endif
libs-y += arch/x86/cpu/
libs-y += arch/x86/lib/
......@@ -34,6 +34,7 @@ SPL_BIN := u-boot-spl
endif
include $(srctree)/config.mk
include $(srctree)/arch/$(ARCH)/Makefile
# Enable garbage collection of un-used sections for SPL
KBUILD_CFLAGS += -ffunction-sections -fdata-sections
......@@ -45,21 +46,6 @@ cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \
HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n)
ifdef CONFIG_SPL_START_S_PATH
START_PATH := $(CONFIG_SPL_START_S_PATH:"%"=%)
else
START_PATH := $(CPUDIR)
endif
head-y := $(START_PATH)/start.o
head-$(CONFIG_X86) += $(START_PATH)/start16.o $(START_PATH)/resetvec.o
head-$(CONFIG_4xx) += $(START_PATH)/resetvec.o
head-$(CONFIG_MPC85xx) += $(START_PATH)/resetvec.o
libs-y += arch/$(ARCH)/lib/
libs-y += $(CPUDIR)/
libs-y += $(if $(BOARDDIR),board/$(BOARDDIR)/)
libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
......@@ -94,13 +80,6 @@ libs-$(CONFIG_SPL_USB_HOST_SUPPORT) += drivers/usb/host/
libs-$(CONFIG_OMAP_USB_PHY) += drivers/usb/phy/
libs-$(CONFIG_SPL_SATA_SUPPORT) += drivers/block/
ifneq (,$(CONFIG_MX23)$(CONFIG_MX35)$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35))
libs-y += arch/$(ARCH)/imx-common/
endif
libs-$(CONFIG_ARM) += arch/arm/cpu/
libs-$(CONFIG_PPC) += arch/powerpc/cpu/
head-y := $(addprefix $(obj)/,$(head-y))
libs-y := $(addprefix $(obj)/,$(libs-y))
u-boot-spl-dirs := $(patsubst %/,%,$(filter %/, $(libs-y)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment