[Buildroot] [PATCH v7 7/9] external-toolchain: check if a buildroot SDK has already been relocated

Arnout Vandecappelle arnout at mind.be
Thu Jul 20 00:12:24 UTC 2017



On 05-07-17 18:53, Wolfgang Grandegger wrote:
> The location of the buildroot SDK is stored in the file "sdk-location"
> in "share/buildroot". If it's content does not match the current
> SDK location, ask the user to run the script "relocate-sdk.sh" in the
> top directory once. The external toolchain may be a pre-installed one
> in a directory that is not writeable by us. Therefore, we can't run
> the script directly.
> 
> Signed-off-by: Wolfgang Grandegger <wg at grandegger.com>
> ---
>  toolchain/helpers.mk                                   | 18 ++++++++++++++++++
>  toolchain/toolchain-external/pkg-toolchain-external.mk |  1 +
>  2 files changed, 19 insertions(+)
> 
> diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
> index 6136aef..5c6539e 100644
> --- a/toolchain/helpers.mk
> +++ b/toolchain/helpers.mk
> @@ -476,3 +476,21 @@ define simplify_symlink
>  	ln -sf "$${DOTS}$${REL_DEST}" "$${FULL_SRC}" ; \
>  )
>  endef
> +
> +#
> +# Check if it's a buildroot toolchain and if it's already relocatable by
> +# reading and testing the toolchain location file
> +#
> +# $1: toolchain installation directory
> +#
> +define check_buildroot_sdk_relocated
> +( \

 The brackets here are redundant. Yes, I know, most other functions in this file
add them, but really they shouldn't.

> +	if [ -r $(1)/share/buildroot/sdk-location ]; then \
> +		sdkroot=`dirname "$(1)"`; \

 Is this correct? Shouldn't it be just $(1)? Yes it should :-)

 Otherwise looks good to me.

 Regards,
 Arnout

> +		if [ "`cat $(1)/share/buildroot/sdk-location`" != "$${sdkroot}" ]; then \
> +			echo "Please relocate the buildroot SDK by executing \"$${sdkroot}/relocate-sdk.sh\" once!" ; \
> +			exit 1 ; \
> +		fi \
> +	fi \
> +)
> +endef
> diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
> index 33449d3..afccbb6 100644
> --- a/toolchain/toolchain-external/pkg-toolchain-external.mk
> +++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
> @@ -519,6 +519,7 @@ endif
>  # matches the configuration provided in Buildroot: ABI, C++ support,
>  # kernel headers version, type of C library and all C library features.
>  define $(2)_CONFIGURE_CMDS
> +	$$(Q)$$(call check_buildroot_sdk_relocated,$$(TOOLCHAIN_EXTERNAL_INSTALL_DIR))
>  	$$(Q)$$(call check_cross_compiler_exists,$$(TOOLCHAIN_EXTERNAL_CC))
>  	$$(Q)$$(call check_unusable_toolchain,$$(TOOLCHAIN_EXTERNAL_CC))
>  	$$(Q)SYSROOT_DIR="$$(call toolchain_find_sysroot,$$(TOOLCHAIN_EXTERNAL_CC))" ; \
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF


More information about the buildroot mailing list