Patchwork [U-Boot] MAKEALL: add support for per architecture toolchains

login
register
mail settings
Submitter Allen Martin
Date Jan. 24, 2013, 6:48 p.m.
Message ID <1359053304-3691-1-git-send-email-amartin@nvidia.com>
Download mbox | patch
Permalink /patch/215478/
State Superseded
Headers show

Comments

Allen Martin - Jan. 24, 2013, 6:48 p.m.
Add support for per architecture CROSS_COMPILE toolchain definitions
via CROSS_COMPILE_ARCH where "ARCH" is any of the supported u-boot
architectures.  This allows building every supported u-boot board in a
single pass of MAKEALL.

Signed-off-by: Allen Martin <amartin@nvidia.com>
---
 MAKEALL |   32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)
Simon Glass - Jan. 25, 2013, 9:21 p.m.
On Fri, Jan 25, 2013 at 7:48 AM, Allen Martin <amartin@nvidia.com> wrote:
> Add support for per architecture CROSS_COMPILE toolchain definitions
> via CROSS_COMPILE_ARCH where "ARCH" is any of the supported u-boot
> architectures.  This allows building every supported u-boot board in a
> single pass of MAKEALL.
>
> Signed-off-by: Allen Martin <amartin@nvidia.com>

Acked-by: Simon Glass <sjg@chromium.org>

See below for a small suggestion.

> ---
>  MAKEALL |   32 +++++++++++++++++++++++++-------
>  1 file changed, 25 insertions(+), 7 deletions(-)
>
> diff --git a/MAKEALL b/MAKEALL
> index 5b06c54..18b4e4d 100755
> --- a/MAKEALL
> +++ b/MAKEALL
> @@ -35,6 +35,9 @@ usage()
>         Environment variables:
>           BUILD_NCPUS      number of parallel make jobs (default: auto)
>           CROSS_COMPILE    cross-compiler toolchain prefix (default: "")
> +         CROSS_COMPILE_ARM cross-compiler toolchain prefix for
> +                          architecture "ARM".  Substitute "ARM" for any
> +                          supported architecture (default: "")

Perhaps better expressed as CROSS_COMPILE_<ARCH>?

>           MAKEALL_LOGDIR   output all logs to here (default: ./LOG/)
>           BUILD_DIR        output build directory (default: ./)
>           BUILD_NBUILDS    number of parallel targets (default: 1)
> @@ -180,13 +183,6 @@ else
>         JOBS=""
>  fi
>
> -
> -if [ "${CROSS_COMPILE}" ] ; then
> -       MAKE="make CROSS_COMPILE=${CROSS_COMPILE}"
> -else
> -       MAKE=make
> -fi
> -
>  if [ "${MAKEALL_LOGDIR}" ] ; then
>         LOG_DIR=${MAKEALL_LOGDIR}
>  else
> @@ -585,6 +581,18 @@ get_target_maintainers() {
>         echo "$mail"
>  }
>
> +get_target_arch() {
> +       local target=$1
> +
> +       # Automatic mode
> +       local line=`egrep -i "^[[:space:]]*${target}[[:space:]]" boards.cfg`
> +
> +       if [ -z "${line}" ] ; then echo "" ; return ; fi
> +
> +       set ${line}
> +       echo "$2"
> +}
> +
>  list_target() {
>         if [ "$PRINT_MAINTS" != 'y' ] ; then
>                 echo "$1"
> @@ -655,6 +663,16 @@ build_target() {
>
>         export BUILD_DIR="${output_dir}"
>
> +       target_arch=$(get_target_arch ${target})
> +       eval cross_toolchain=\$CROSS_COMPILE_${target_arch^^}
> +       if [ "${cross_toolchain}" ] ; then
> +           MAKE="make CROSS_COMPILE=${cross_toolchain}"
> +       elif [ "${CROSS_COMPILE}" ] ; then
> +           MAKE="make CROSS_COMPILE=${CROSS_COMPILE}"
> +       else
> +           MAKE=make
> +       fi
> +
>         ${MAKE} distclean >/dev/null
>         ${MAKE} -s ${target}_config
>
> --
> 1.7.10.4
>

Patch

diff --git a/MAKEALL b/MAKEALL
index 5b06c54..18b4e4d 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -35,6 +35,9 @@  usage()
 	Environment variables:
 	  BUILD_NCPUS      number of parallel make jobs (default: auto)
 	  CROSS_COMPILE    cross-compiler toolchain prefix (default: "")
+	  CROSS_COMPILE_ARM cross-compiler toolchain prefix for
+	                   architecture "ARM".  Substitute "ARM" for any
+	                   supported architecture (default: "")
 	  MAKEALL_LOGDIR   output all logs to here (default: ./LOG/)
 	  BUILD_DIR        output build directory (default: ./)
 	  BUILD_NBUILDS	   number of parallel targets (default: 1)
@@ -180,13 +183,6 @@  else
 	JOBS=""
 fi
 
-
-if [ "${CROSS_COMPILE}" ] ; then
-	MAKE="make CROSS_COMPILE=${CROSS_COMPILE}"
-else
-	MAKE=make
-fi
-
 if [ "${MAKEALL_LOGDIR}" ] ; then
 	LOG_DIR=${MAKEALL_LOGDIR}
 else
@@ -585,6 +581,18 @@  get_target_maintainers() {
 	echo "$mail"
 }
 
+get_target_arch() {
+	local target=$1
+
+	# Automatic mode
+	local line=`egrep -i "^[[:space:]]*${target}[[:space:]]" boards.cfg`
+
+	if [ -z "${line}" ] ; then echo "" ; return ; fi
+
+	set ${line}
+	echo "$2"
+}
+
 list_target() {
 	if [ "$PRINT_MAINTS" != 'y' ] ; then
 		echo "$1"
@@ -655,6 +663,16 @@  build_target() {
 
 	export BUILD_DIR="${output_dir}"
 
+	target_arch=$(get_target_arch ${target})
+	eval cross_toolchain=\$CROSS_COMPILE_${target_arch^^}
+	if [ "${cross_toolchain}" ] ; then
+	    MAKE="make CROSS_COMPILE=${cross_toolchain}"
+	elif [ "${CROSS_COMPILE}" ] ; then
+	    MAKE="make CROSS_COMPILE=${CROSS_COMPILE}"
+	else
+	    MAKE=make
+	fi
+
 	${MAKE} distclean >/dev/null
 	${MAKE} -s ${target}_config