* [U-Boot] [RFC PATCH] Kbuild: introduce Makefile in arch/$ARCH/
@ 2014-11-19 20:12 Daniel Schwierzeck
2014-11-21 3:48 ` Masahiro Yamada
2014-11-21 22:51 ` [U-Boot] [PATCH v2] " Daniel Schwierzeck
0 siblings, 2 replies; 6+ messages in thread
From: Daniel Schwierzeck @ 2014-11-19 20:12 UTC (permalink / raw)
To: u-boot
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>
---
This patch depends on Masahiro's patch series
'kbuild: descend into SOC directory from CPU directory'
http://patchwork.ozlabs.org/patch/410229/
http://patchwork.ozlabs.org/patch/410230/
http://patchwork.ozlabs.org/patch/410231/
http://patchwork.ozlabs.org/patch/410232/
This patch should not cause any functional changes. It is compile-tested
on sandbox, aarch64, arm, mips, powerpc and x86.
Makefile | 20 ++------------------
arch/arc/Makefile | 8 ++++++++
arch/arm/Makefile | 29 +++++++++++++++++++++++++++++
arch/avr32/Makefile | 8 ++++++++
arch/blackfin/Makefile | 8 ++++++++
arch/m68k/Makefile | 8 ++++++++
arch/microblaze/Makefile | 8 ++++++++
arch/mips/Makefile | 8 ++++++++
arch/nds32/Makefile | 8 ++++++++
arch/nios2/Makefile | 8 ++++++++
arch/openrisc/Makefile | 8 ++++++++
arch/powerpc/Makefile | 11 +++++++++++
arch/sandbox/Makefile | 8 ++++++++
arch/sh/Makefile | 8 ++++++++
arch/sparc/Makefile | 8 ++++++++
arch/x86/Makefile | 12 ++++++++++++
config.mk | 3 +++
scripts/Makefile.spl | 23 +----------------------
18 files changed, 154 insertions(+), 40 deletions(-)
create mode 100644 arch/arc/Makefile
create mode 100644 arch/arm/Makefile
create mode 100644 arch/avr32/Makefile
create mode 100644 arch/blackfin/Makefile
create mode 100644 arch/m68k/Makefile
create mode 100644 arch/microblaze/Makefile
create mode 100644 arch/mips/Makefile
create mode 100644 arch/nds32/Makefile
create mode 100644 arch/nios2/Makefile
create mode 100644 arch/openrisc/Makefile
create mode 100644 arch/powerpc/Makefile
create mode 100644 arch/sandbox/Makefile
create mode 100644 arch/sh/Makefile
create mode 100644 arch/sparc/Makefile
create mode 100644 arch/x86/Makefile
diff --git a/Makefile b/Makefile
index 590fec8..a2783ca 100644
--- a/Makefile
+++ b/Makefile
@@ -359,7 +359,7 @@ UBOOTRELEASE = $(shell cat include/config/uboot.release 2> /dev/null)
UBOOTVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
export VERSION PATCHLEVEL SUBLEVEL UBOOTRELEASE UBOOTVERSION
-export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR
+export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR SPL_START_S_PATH
export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
export MAKE AWK PERL PYTHON
@@ -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))
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
new file mode 100644
index 0000000..de25cc9
--- /dev/null
+++ b/arch/arc/Makefile
@@ -0,0 +1,8 @@
+#
+# 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/
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
new file mode 100644
index 0000000..117ed30
--- /dev/null
+++ b/arch/arm/Makefile
@@ -0,0 +1,29 @@
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+head-y := arch/arm/cpu/$(CPU)/start.o
+
+ifeq ($(CONFIG_SPL_BUILD),y)
+ifneq ($(SPL_START_S_PATH),)
+head-y := $(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
diff --git a/arch/avr32/Makefile b/arch/avr32/Makefile
new file mode 100644
index 0000000..e9b3184
--- /dev/null
+++ b/arch/avr32/Makefile
@@ -0,0 +1,8 @@
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+head-y := arch/avr32/cpu/start.o
+
+libs-y += arch/avr32/cpu/
+libs-y += arch/avr32/lib/
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
new file mode 100644
index 0000000..787475e
--- /dev/null
+++ b/arch/blackfin/Makefile
@@ -0,0 +1,8 @@
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+head-y := arch/blackfin/cpu/start.o
+
+libs-y += arch/blackfin/cpu/
+libs-y += arch/blackfin/lib/
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
new file mode 100644
index 0000000..aa3d2fa
--- /dev/null
+++ b/arch/m68k/Makefile
@@ -0,0 +1,8 @@
+#
+# 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/
diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
new file mode 100644
index 0000000..ae4adc2
--- /dev/null
+++ b/arch/microblaze/Makefile
@@ -0,0 +1,8 @@
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+head-y := arch/microblaze/cpu/start.o
+
+libs-y += arch/microblaze/cpu/
+libs-y += arch/microblaze/lib/
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
new file mode 100644
index 0000000..1907b57
--- /dev/null
+++ b/arch/mips/Makefile
@@ -0,0 +1,8 @@
+#
+# 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/
diff --git a/arch/nds32/Makefile b/arch/nds32/Makefile
new file mode 100644
index 0000000..e1eccba
--- /dev/null
+++ b/arch/nds32/Makefile
@@ -0,0 +1,8 @@
+#
+# 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/
diff --git a/arch/nios2/Makefile b/arch/nios2/Makefile
new file mode 100644
index 0000000..18685a9
--- /dev/null
+++ b/arch/nios2/Makefile
@@ -0,0 +1,8 @@
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+head-y := arch/nios2/cpu/start.o
+
+libs-y += arch/nios2/cpu/
+libs-y += arch/nios2/lib/
diff --git a/arch/openrisc/Makefile b/arch/openrisc/Makefile
new file mode 100644
index 0000000..c4da3ce
--- /dev/null
+++ b/arch/openrisc/Makefile
@@ -0,0 +1,8 @@
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+head-y := arch/openrisc/cpu/start.o
+
+libs-y += arch/openrisc/cpu/
+libs-y += arch/openrisc/lib/
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
new file mode 100644
index 0000000..8aa1d60
--- /dev/null
+++ b/arch/powerpc/Makefile
@@ -0,0 +1,11 @@
+#
+# 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/
diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
new file mode 100644
index 0000000..23fdcdb
--- /dev/null
+++ b/arch/sandbox/Makefile
@@ -0,0 +1,8 @@
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+head-y := arch/sandbox/cpu/start.o
+
+libs-y += arch/sandbox/cpu/
+libs-y += arch/sandbox/lib/
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
new file mode 100644
index 0000000..ca55fac
--- /dev/null
+++ b/arch/sh/Makefile
@@ -0,0 +1,8 @@
+#
+# 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/
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
new file mode 100644
index 0000000..2d4c971
--- /dev/null
+++ b/arch/sparc/Makefile
@@ -0,0 +1,8 @@
+#
+# 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/
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
new file mode 100644
index 0000000..36a6018
--- /dev/null
+++ b/arch/x86/Makefile
@@ -0,0 +1,12 @@
+#
+# 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/
diff --git a/config.mk b/config.mk
index 64c2951..b957c1d 100644
--- a/config.mk
+++ b/config.mk
@@ -31,6 +31,9 @@ endif
ifneq ($(CONFIG_SYS_SOC),)
SOC := $(CONFIG_SYS_SOC:"%"=%)
endif
+ifneq ($(CONFIG_SPL_START_S_PATH),)
+SPL_START_S_PATH := $(CONFIG_SPL_START_S_PATH:"%"=%)
+endif
# Some architecture config.mk files need to know what CPUDIR is set to,
# so calculate CPUDIR before including ARCH/SOC/CPU config.mk files.
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 69f7c9f..1341894 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -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/
@@ -93,13 +79,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)))
--
2.1.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [RFC PATCH] Kbuild: introduce Makefile in arch/$ARCH/
2014-11-19 20:12 [U-Boot] [RFC PATCH] Kbuild: introduce Makefile in arch/$ARCH/ Daniel Schwierzeck
@ 2014-11-21 3:48 ` Masahiro Yamada
2014-11-21 21:06 ` Daniel Schwierzeck
2014-11-21 22:51 ` [U-Boot] [PATCH v2] " Daniel Schwierzeck
1 sibling, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2014-11-21 3:48 UTC (permalink / raw)
To: u-boot
Hi Daniel,
On Wed, 19 Nov 2014 21:12:14 +0100
Daniel Schwierzeck <daniel.schwierzeck@gmail.com> wrote:
> 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>
I guess this patch is the one you mentioned on the way to the station
after the u-boot mini summit.
I think basically this is a good step forward
although we need more efforts if we want to deprecate
arch/$ARCH/cpu/$CPU/config.mk, board/$BOARD/config.mk as well.
Some comments below.
I will probably ack it if you send v2.
> This patch should not cause any functional changes. It is compile-tested
> on sandbox, aarch64, arm, mips, powerpc and x86.
This patch looks good for the other architecture, too.
> diff --git a/Makefile b/Makefile
> index 590fec8..a2783ca 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -359,7 +359,7 @@ UBOOTRELEASE = $(shell cat include/config/uboot.release 2> /dev/null)
> UBOOTVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
>
> export VERSION PATCHLEVEL SUBLEVEL UBOOTRELEASE UBOOTVERSION
> -export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR
> +export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR SPL_START_S_PATH
> export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
> export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
> export MAKE AWK PERL PYTHON
Why do you need to export SPL_START_S_PATH?
It is unnecessary, I think.
> index 0000000..117ed30
> --- /dev/null
> +++ b/arch/arm/Makefile
> @@ -0,0 +1,29 @@
> +#
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +
> +head-y := arch/arm/cpu/$(CPU)/start.o
> +
> +ifeq ($(CONFIG_SPL_BUILD),y)
> +ifneq ($(SPL_START_S_PATH),)
> +head-y := $(SPL_START_S_PATH)/start.o
> +endif
> +endif
Because only some ARM boards are using CONFIG_SPL_START_S_PATH,
perhaps we can directly handle it in arch/arm/Makefile and remove it from config.mk
ifeq ($(CONFIG_SPL_BUILD),y)
ifneq ($(CONFIG_SPL_START_S_PATH),)
head-y := $(CONFIG_SPL_START_S_PATH:"%"=%)/start.o
endif
endif
> diff --git a/config.mk b/config.mk
> index 64c2951..b957c1d 100644
> --- a/config.mk
> +++ b/config.mk
> @@ -31,6 +31,9 @@ endif
> ifneq ($(CONFIG_SYS_SOC),)
> SOC := $(CONFIG_SYS_SOC:"%"=%)
> endif
> +ifneq ($(CONFIG_SPL_START_S_PATH),)
> +SPL_START_S_PATH := $(CONFIG_SPL_START_S_PATH:"%"=%)
> +endif
Can we remove this?
Thanks!
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [RFC PATCH] Kbuild: introduce Makefile in arch/$ARCH/
2014-11-21 3:48 ` Masahiro Yamada
@ 2014-11-21 21:06 ` Daniel Schwierzeck
0 siblings, 0 replies; 6+ messages in thread
From: Daniel Schwierzeck @ 2014-11-21 21:06 UTC (permalink / raw)
To: u-boot
Hi Masahiro,
On 21.11.2014 04:48, Masahiro Yamada wrote:
> Hi Daniel,
>
>
> On Wed, 19 Nov 2014 21:12:14 +0100
> Daniel Schwierzeck <daniel.schwierzeck@gmail.com> wrote:
>
>> 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>
>
>
> I guess this patch is the one you mentioned on the way to the station
> after the u-boot mini summit.
yes
>
> I think basically this is a good step forward
> although we need more efforts if we want to deprecate
> arch/$ARCH/cpu/$CPU/config.mk, board/$BOARD/config.mk as well.
>
>
> Some comments below.
>
> I will probably ack it if you send v2.
>
>
>
>
>
>> This patch should not cause any functional changes. It is compile-tested
>> on sandbox, aarch64, arm, mips, powerpc and x86.
>
> This patch looks good for the other architecture, too.
>
>
>
>> diff --git a/Makefile b/Makefile
>> index 590fec8..a2783ca 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -359,7 +359,7 @@ UBOOTRELEASE = $(shell cat include/config/uboot.release 2> /dev/null)
>> UBOOTVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
>>
>> export VERSION PATCHLEVEL SUBLEVEL UBOOTRELEASE UBOOTVERSION
>> -export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR
>> +export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR SPL_START_S_PATH
>> export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
>> export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
>> export MAKE AWK PERL PYTHON
>
>
> Why do you need to export SPL_START_S_PATH?
> It is unnecessary, I think.
>
boards form ARM and PowerPC defined CONFIG_SPL_START_S_PATH so I moved
it to config.mk and made it consistent with the other variables. But if
only some ARM boards really use it, it is unnecessary.
>
>
>
>> index 0000000..117ed30
>> --- /dev/null
>> +++ b/arch/arm/Makefile
>> @@ -0,0 +1,29 @@
>> +#
>> +# SPDX-License-Identifier: GPL-2.0+
>> +#
>> +
>> +head-y := arch/arm/cpu/$(CPU)/start.o
>> +
>> +ifeq ($(CONFIG_SPL_BUILD),y)
>> +ifneq ($(SPL_START_S_PATH),)
>> +head-y := $(SPL_START_S_PATH)/start.o
>> +endif
>> +endif
>
>
> Because only some ARM boards are using CONFIG_SPL_START_S_PATH,
> perhaps we can directly handle it in arch/arm/Makefile and remove it from config.mk
>
> ifeq ($(CONFIG_SPL_BUILD),y)
> ifneq ($(CONFIG_SPL_START_S_PATH),)
> head-y := $(CONFIG_SPL_START_S_PATH:"%"=%)/start.o
> endif
> endif
>
>
>
>
>> diff --git a/config.mk b/config.mk
>> index 64c2951..b957c1d 100644
>> --- a/config.mk
>> +++ b/config.mk
>> @@ -31,6 +31,9 @@ endif
>> ifneq ($(CONFIG_SYS_SOC),)
>> SOC := $(CONFIG_SYS_SOC:"%"=%)
>> endif
>> +ifneq ($(CONFIG_SPL_START_S_PATH),)
>> +SPL_START_S_PATH := $(CONFIG_SPL_START_S_PATH:"%"=%)
>> +endif
>
>
> Can we remove this?
Yes, I will move it to arch/arm/Makefile
--
- Daniel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH v2] Kbuild: introduce Makefile in arch/$ARCH/
2014-11-19 20:12 [U-Boot] [RFC PATCH] Kbuild: introduce Makefile in arch/$ARCH/ Daniel Schwierzeck
2014-11-21 3:48 ` Masahiro Yamada
@ 2014-11-21 22:51 ` Daniel Schwierzeck
2014-11-25 3:51 ` Masahiro Yamada
2014-12-08 21:43 ` [U-Boot] [U-Boot,v2] " Tom Rini
1 sibling, 2 replies; 6+ messages in thread
From: Daniel Schwierzeck @ 2014-11-21 22:51 UTC (permalink / raw)
To: u-boot
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>
---
This patch depends on Masahiro's patch series
'kbuild: descend into SOC directory from CPU directory'
http://patchwork.ozlabs.org/patch/410229/
http://patchwork.ozlabs.org/patch/410230/
http://patchwork.ozlabs.org/patch/410231/
http://patchwork.ozlabs.org/patch/410232/
This patch should not cause any functional changes. It is compile-tested
on sandbox, aarch64, arm, mips, powerpc and x86.
Changes in v2:
- move handling of CONFIG_SPL_START_S_PATH to arch/arm/Makefile
- depends on three new patches by Masahiro
http://patchwork.ozlabs.org/patch/412940/
http://patchwork.ozlabs.org/patch/412941/
http://patchwork.ozlabs.org/patch/412942/
Makefile | 18 +-----------------
arch/arc/Makefile | 8 ++++++++
arch/arm/Makefile | 29 +++++++++++++++++++++++++++++
arch/avr32/Makefile | 8 ++++++++
arch/blackfin/Makefile | 8 ++++++++
arch/m68k/Makefile | 8 ++++++++
arch/microblaze/Makefile | 8 ++++++++
arch/mips/Makefile | 8 ++++++++
arch/nds32/Makefile | 8 ++++++++
arch/nios2/Makefile | 8 ++++++++
arch/openrisc/Makefile | 8 ++++++++
arch/powerpc/Makefile | 11 +++++++++++
arch/sandbox/Makefile | 8 ++++++++
arch/sh/Makefile | 8 ++++++++
arch/sparc/Makefile | 8 ++++++++
arch/x86/Makefile | 12 ++++++++++++
scripts/Makefile.spl | 23 +----------------------
17 files changed, 150 insertions(+), 39 deletions(-)
create mode 100644 arch/arc/Makefile
create mode 100644 arch/arm/Makefile
create mode 100644 arch/avr32/Makefile
create mode 100644 arch/blackfin/Makefile
create mode 100644 arch/m68k/Makefile
create mode 100644 arch/microblaze/Makefile
create mode 100644 arch/mips/Makefile
create mode 100644 arch/nds32/Makefile
create mode 100644 arch/nios2/Makefile
create mode 100644 arch/openrisc/Makefile
create mode 100644 arch/powerpc/Makefile
create mode 100644 arch/sandbox/Makefile
create mode 100644 arch/sh/Makefile
create mode 100644 arch/sparc/Makefile
create mode 100644 arch/x86/Makefile
diff --git a/Makefile b/Makefile
index 590fec8..938c040 100644
--- a/Makefile
+++ b/Makefile
@@ -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))
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
new file mode 100644
index 0000000..de25cc9
--- /dev/null
+++ b/arch/arc/Makefile
@@ -0,0 +1,8 @@
+#
+# 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/
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
new file mode 100644
index 0000000..ebb7dc3
--- /dev/null
+++ b/arch/arm/Makefile
@@ -0,0 +1,29 @@
+#
+# 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
diff --git a/arch/avr32/Makefile b/arch/avr32/Makefile
new file mode 100644
index 0000000..e9b3184
--- /dev/null
+++ b/arch/avr32/Makefile
@@ -0,0 +1,8 @@
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+head-y := arch/avr32/cpu/start.o
+
+libs-y += arch/avr32/cpu/
+libs-y += arch/avr32/lib/
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
new file mode 100644
index 0000000..787475e
--- /dev/null
+++ b/arch/blackfin/Makefile
@@ -0,0 +1,8 @@
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+head-y := arch/blackfin/cpu/start.o
+
+libs-y += arch/blackfin/cpu/
+libs-y += arch/blackfin/lib/
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
new file mode 100644
index 0000000..aa3d2fa
--- /dev/null
+++ b/arch/m68k/Makefile
@@ -0,0 +1,8 @@
+#
+# 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/
diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
new file mode 100644
index 0000000..ae4adc2
--- /dev/null
+++ b/arch/microblaze/Makefile
@@ -0,0 +1,8 @@
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+head-y := arch/microblaze/cpu/start.o
+
+libs-y += arch/microblaze/cpu/
+libs-y += arch/microblaze/lib/
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
new file mode 100644
index 0000000..1907b57
--- /dev/null
+++ b/arch/mips/Makefile
@@ -0,0 +1,8 @@
+#
+# 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/
diff --git a/arch/nds32/Makefile b/arch/nds32/Makefile
new file mode 100644
index 0000000..e1eccba
--- /dev/null
+++ b/arch/nds32/Makefile
@@ -0,0 +1,8 @@
+#
+# 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/
diff --git a/arch/nios2/Makefile b/arch/nios2/Makefile
new file mode 100644
index 0000000..18685a9
--- /dev/null
+++ b/arch/nios2/Makefile
@@ -0,0 +1,8 @@
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+head-y := arch/nios2/cpu/start.o
+
+libs-y += arch/nios2/cpu/
+libs-y += arch/nios2/lib/
diff --git a/arch/openrisc/Makefile b/arch/openrisc/Makefile
new file mode 100644
index 0000000..c4da3ce
--- /dev/null
+++ b/arch/openrisc/Makefile
@@ -0,0 +1,8 @@
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+head-y := arch/openrisc/cpu/start.o
+
+libs-y += arch/openrisc/cpu/
+libs-y += arch/openrisc/lib/
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
new file mode 100644
index 0000000..8aa1d60
--- /dev/null
+++ b/arch/powerpc/Makefile
@@ -0,0 +1,11 @@
+#
+# 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/
diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
new file mode 100644
index 0000000..23fdcdb
--- /dev/null
+++ b/arch/sandbox/Makefile
@@ -0,0 +1,8 @@
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+head-y := arch/sandbox/cpu/start.o
+
+libs-y += arch/sandbox/cpu/
+libs-y += arch/sandbox/lib/
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
new file mode 100644
index 0000000..ca55fac
--- /dev/null
+++ b/arch/sh/Makefile
@@ -0,0 +1,8 @@
+#
+# 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/
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
new file mode 100644
index 0000000..2d4c971
--- /dev/null
+++ b/arch/sparc/Makefile
@@ -0,0 +1,8 @@
+#
+# 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/
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
new file mode 100644
index 0000000..36a6018
--- /dev/null
+++ b/arch/x86/Makefile
@@ -0,0 +1,12 @@
+#
+# 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/
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 69f7c9f..1341894 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -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/
@@ -93,13 +79,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)))
--
2.1.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH v2] Kbuild: introduce Makefile in arch/$ARCH/
2014-11-21 22:51 ` [U-Boot] [PATCH v2] " Daniel Schwierzeck
@ 2014-11-25 3:51 ` Masahiro Yamada
2014-12-08 21:43 ` [U-Boot] [U-Boot,v2] " Tom Rini
1 sibling, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2014-11-25 3:51 UTC (permalink / raw)
To: u-boot
Hi Daniel,
On Fri, 21 Nov 2014 23:51:33 +0100
Daniel Schwierzeck <daniel.schwierzeck@gmail.com> wrote:
> 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>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [U-Boot,v2] Kbuild: introduce Makefile in arch/$ARCH/
2014-11-21 22:51 ` [U-Boot] [PATCH v2] " Daniel Schwierzeck
2014-11-25 3:51 ` Masahiro Yamada
@ 2014-12-08 21:43 ` Tom Rini
1 sibling, 0 replies; 6+ messages in thread
From: Tom Rini @ 2014-12-08 21:43 UTC (permalink / raw)
To: u-boot
On Fri, Nov 21, 2014 at 11:51:33PM +0100, Daniel Schwierzeck wrote:
> 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>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141208/b32ad1e4/attachment.pgp>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-12-08 21:43 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-19 20:12 [U-Boot] [RFC PATCH] Kbuild: introduce Makefile in arch/$ARCH/ Daniel Schwierzeck
2014-11-21 3:48 ` Masahiro Yamada
2014-11-21 21:06 ` Daniel Schwierzeck
2014-11-21 22:51 ` [U-Boot] [PATCH v2] " Daniel Schwierzeck
2014-11-25 3:51 ` Masahiro Yamada
2014-12-08 21:43 ` [U-Boot] [U-Boot,v2] " Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox