Commit e19db555b4ac79dafa04cc5ff98bdbff01e19388

Authored by Daniel Schwierzeck
Committed by Tom Rini
1 parent eb8a4fe0dc

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: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

Showing 17 changed files with 150 additions and 39 deletions Side-by-side Diff

... ... @@ -503,6 +503,7 @@
503 503 -path ./include/config/auto.conf -newer $(KCONFIG_CONFIG)))
504 504 ifneq ($(autoconf_is_current),)
505 505 include $(srctree)/config.mk
  506 +include $(srctree)/arch/$(ARCH)/Makefile
506 507 endif
507 508  
508 509 # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
509 510  
510 511  
... ... @@ -601,17 +602,11 @@
601 602 #########################################################################
602 603 # U-Boot objects....order is important (i.e. start must be first)
603 604  
604   -head-y := $(CPUDIR)/start.o
605   -head-$(CONFIG_4xx) += arch/powerpc/cpu/ppc4xx/resetvec.o
606   -head-$(CONFIG_MPC85xx) += arch/powerpc/cpu/mpc85xx/resetvec.o
607   -
608 605 HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n)
609 606  
610 607 libs-y += lib/
611 608 libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
612   -libs-y += $(CPUDIR)/
613 609 libs-$(CONFIG_OF_EMBED) += dts/
614   -libs-y += arch/$(ARCH)/lib/
615 610 libs-y += fs/
616 611 libs-y += net/
617 612 libs-y += disk/
... ... @@ -650,17 +645,6 @@
650 645 libs-$(CONFIG_HAS_POST) += post/
651 646 libs-y += test/
652 647 libs-y += test/dm/
653   -
654   -ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610))
655   -libs-y += arch/$(ARCH)/imx-common/
656   -endif
657   -
658   -ifneq (,$(filter $(SOC), armada-xp kirkwood))
659   -libs-y += arch/$(ARCH)/mvebu-common/
660   -endif
661   -
662   -libs-$(CONFIG_ARM) += arch/arm/cpu/
663   -libs-$(CONFIG_PPC) += arch/powerpc/cpu/
664 648  
665 649 libs-y += $(if $(BOARDDIR),board/$(BOARDDIR)/)
666 650  
  1 +#
  2 +# SPDX-License-Identifier: GPL-2.0+
  3 +#
  4 +
  5 +head-y := arch/arc/cpu/$(CPU)/start.o
  6 +
  7 +libs-y += arch/arc/cpu/$(CPU)/
  8 +libs-y += arch/arc/lib/
  1 +#
  2 +# SPDX-License-Identifier: GPL-2.0+
  3 +#
  4 +
  5 +head-y := arch/arm/cpu/$(CPU)/start.o
  6 +
  7 +ifeq ($(CONFIG_SPL_BUILD),y)
  8 +ifneq ($(CONFIG_SPL_START_S_PATH),)
  9 +head-y := $(CONFIG_SPL_START_S_PATH:"%"=%)/start.o
  10 +endif
  11 +endif
  12 +
  13 +libs-y += arch/arm/cpu/$(CPU)/
  14 +libs-y += arch/arm/cpu/
  15 +libs-y += arch/arm/lib/
  16 +
  17 +ifeq ($(CONFIG_SPL_BUILD),y)
  18 +ifneq (,$(CONFIG_MX23)$(CONFIG_MX35)$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35))
  19 +libs-y += arch/arm/imx-common/
  20 +endif
  21 +else
  22 +ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610))
  23 +libs-y += arch/arm/imx-common/
  24 +endif
  25 +endif
  26 +
  27 +ifneq (,$(filter $(SOC), armada-xp kirkwood))
  28 +libs-y += arch/arm/mvebu-common/
  29 +endif
  1 +#
  2 +# SPDX-License-Identifier: GPL-2.0+
  3 +#
  4 +
  5 +head-y := arch/avr32/cpu/start.o
  6 +
  7 +libs-y += arch/avr32/cpu/
  8 +libs-y += arch/avr32/lib/
arch/blackfin/Makefile
  1 +#
  2 +# SPDX-License-Identifier: GPL-2.0+
  3 +#
  4 +
  5 +head-y := arch/blackfin/cpu/start.o
  6 +
  7 +libs-y += arch/blackfin/cpu/
  8 +libs-y += arch/blackfin/lib/
  1 +#
  2 +# SPDX-License-Identifier: GPL-2.0+
  3 +#
  4 +
  5 +head-y := arch/m68k/cpu/$(CPU)/start.o
  6 +
  7 +libs-y += arch/m68k/cpu/$(CPU)/
  8 +libs-y += arch/m68k/lib/
arch/microblaze/Makefile
  1 +#
  2 +# SPDX-License-Identifier: GPL-2.0+
  3 +#
  4 +
  5 +head-y := arch/microblaze/cpu/start.o
  6 +
  7 +libs-y += arch/microblaze/cpu/
  8 +libs-y += arch/microblaze/lib/
  1 +#
  2 +# SPDX-License-Identifier: GPL-2.0+
  3 +#
  4 +
  5 +head-y := arch/mips/cpu/$(CPU)/start.o
  6 +
  7 +libs-y += arch/mips/cpu/$(CPU)/
  8 +libs-y += arch/mips/lib/
  1 +#
  2 +# SPDX-License-Identifier: GPL-2.0+
  3 +#
  4 +
  5 +head-y := arch/nds32/cpu/$(CPU)/start.o
  6 +
  7 +libs-y += arch/nds32/cpu/$(CPU)/
  8 +libs-y += arch/nds32/lib/
  1 +#
  2 +# SPDX-License-Identifier: GPL-2.0+
  3 +#
  4 +
  5 +head-y := arch/nios2/cpu/start.o
  6 +
  7 +libs-y += arch/nios2/cpu/
  8 +libs-y += arch/nios2/lib/
arch/openrisc/Makefile
  1 +#
  2 +# SPDX-License-Identifier: GPL-2.0+
  3 +#
  4 +
  5 +head-y := arch/openrisc/cpu/start.o
  6 +
  7 +libs-y += arch/openrisc/cpu/
  8 +libs-y += arch/openrisc/lib/
arch/powerpc/Makefile
  1 +#
  2 +# SPDX-License-Identifier: GPL-2.0+
  3 +#
  4 +
  5 +head-y := arch/powerpc/cpu/$(CPU)/start.o
  6 +head-$(CONFIG_4xx) += arch/powerpc/cpu/ppc4xx/resetvec.o
  7 +head-$(CONFIG_MPC85xx) += arch/powerpc/cpu/mpc85xx/resetvec.o
  8 +
  9 +libs-y += arch/powerpc/cpu/$(CPU)/
  10 +libs-y += arch/powerpc/cpu/
  11 +libs-y += arch/powerpc/lib/
arch/sandbox/Makefile
  1 +#
  2 +# SPDX-License-Identifier: GPL-2.0+
  3 +#
  4 +
  5 +head-y := arch/sandbox/cpu/start.o
  6 +
  7 +libs-y += arch/sandbox/cpu/
  8 +libs-y += arch/sandbox/lib/
  1 +#
  2 +# SPDX-License-Identifier: GPL-2.0+
  3 +#
  4 +
  5 +head-y := arch/sh/cpu/$(CPU)/start.o
  6 +
  7 +libs-y += arch/sh/cpu/$(CPU)/
  8 +libs-y += arch/sh/lib/
  1 +#
  2 +# SPDX-License-Identifier: GPL-2.0+
  3 +#
  4 +
  5 +head-y := arch/sparc/cpu/$(CPU)/start.o
  6 +
  7 +libs-y += arch/sparc/cpu/$(CPU)/
  8 +libs-y += arch/sparc/lib/
  1 +#
  2 +# SPDX-License-Identifier: GPL-2.0+
  3 +#
  4 +
  5 +head-y := arch/x86/cpu/start.o
  6 +ifeq ($(CONFIG_SPL_BUILD),y)
  7 +head-y += arch/x86/cpu/start16.o
  8 +head-y += arch/x86/cpu/resetvec.o
  9 +endif
  10 +
  11 +libs-y += arch/x86/cpu/
  12 +libs-y += arch/x86/lib/
scripts/Makefile.spl
... ... @@ -34,6 +34,7 @@
34 34 endif
35 35  
36 36 include $(srctree)/config.mk
  37 +include $(srctree)/arch/$(ARCH)/Makefile
37 38  
38 39 # Enable garbage collection of un-used sections for SPL
39 40 KBUILD_CFLAGS += -ffunction-sections -fdata-sections
... ... @@ -45,21 +46,6 @@
45 46  
46 47 HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n)
47 48  
48   -ifdef CONFIG_SPL_START_S_PATH
49   -START_PATH := $(CONFIG_SPL_START_S_PATH:"%"=%)
50   -else
51   -START_PATH := $(CPUDIR)
52   -endif
53   -
54   -head-y := $(START_PATH)/start.o
55   -head-$(CONFIG_X86) += $(START_PATH)/start16.o $(START_PATH)/resetvec.o
56   -head-$(CONFIG_4xx) += $(START_PATH)/resetvec.o
57   -head-$(CONFIG_MPC85xx) += $(START_PATH)/resetvec.o
58   -
59   -libs-y += arch/$(ARCH)/lib/
60   -
61   -libs-y += $(CPUDIR)/
62   -
63 49 libs-y += $(if $(BOARDDIR),board/$(BOARDDIR)/)
64 50 libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
65 51  
... ... @@ -93,13 +79,6 @@
93 79 libs-$(CONFIG_SPL_USB_HOST_SUPPORT) += drivers/usb/host/
94 80 libs-$(CONFIG_OMAP_USB_PHY) += drivers/usb/phy/
95 81 libs-$(CONFIG_SPL_SATA_SUPPORT) += drivers/block/
96   -
97   -ifneq (,$(CONFIG_MX23)$(CONFIG_MX35)$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35))
98   -libs-y += arch/$(ARCH)/imx-common/
99   -endif
100   -
101   -libs-$(CONFIG_ARM) += arch/arm/cpu/
102   -libs-$(CONFIG_PPC) += arch/powerpc/cpu/
103 82  
104 83 head-y := $(addprefix $(obj)/,$(head-y))
105 84 libs-y := $(addprefix $(obj)/,$(libs-y))