[U-Boot] [RFC PATCH] Kbuild: introduce Makefile in arch/$ARCH/

Masahiro Yamada yamada.m at jp.panasonic.com
Fri Nov 21 04:48:17 CET 2014


Hi Daniel,


On Wed, 19 Nov 2014 21:12:14 +0100
Daniel Schwierzeck <daniel.schwierzeck at 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 at 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



More information about the U-Boot mailing list