mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] MAKEALL: source defconfig after determining correct CROSS_COMPILE
@ 2023-06-12 12:47 Ahmad Fatoum
  2023-06-26  9:51 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2023-06-12 12:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

ARM 32- and 64-bit have different GCC compiler backends, but the same
architecture in barebox. MAKEALL handles that by sourcing the defconfig
and then looking for CONFIG_CPU_64 before continuing to build. This is
problematic, because CROSS_COMPILE can only be set after that, so we may
end up with more dynamic Kconfig options being wrongly set the first
time, because CROSS_COMPILE wasn't correctly set. Fix this by always
sourcing the defconfig again once we determine the correct
CROSS_COMPILE.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 MAKEALL | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/MAKEALL b/MAKEALL
index a4e268d54cf8..d3a289fd3839 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -91,21 +91,9 @@ do_build_target() {
 
 	rm -rf "${BUILDDIR}"
 	mkdir -p "${LOGDIR}/${target}"
-	printf "Building ${arch} ${target} \n" >&2 | tee -a "${log_report}"
-
-	tmp=$(echo "${target}" | tr - _)
 
 	MAKE="make -j${JOBS} ARCH=${arch} O=${BUILDDIR}"
-	${MAKE} ${target} 2>&1 > "${log_report}" | tee "${log_err}"
-	for i in ${KCONFIG_ADD}; do
-		./scripts/kconfig/merge_config.sh -m -O \
-			${BUILDDIR} ${BUILDDIR}/.config $i \
-			2>&1 > "${log_report}" | tee "${log_err}"
-	done
-	${MAKE} olddefconfig 2>&1 > "${log_report}" | tee "${log_err}"
-
-	check_pipe_status
-	configure_result="$?"
+	${MAKE} ${target} &>/dev/null
 
 	if [ ${arch} = "arm" ]; then
 		grep -q "CONFIG_CPU_64=y" ${BUILDDIR}/.config
@@ -114,6 +102,8 @@ do_build_target() {
 		fi
 	fi
 
+	tmp=$(echo "${target}" | tr - _)
+
 	cross_compile=$(eval echo '$CROSS_COMPILE_'${tmp})
 	cross_compile_set=$(eval echo '${CROSS_COMPILE_'${tmp}'+set}')
 	if [ "${cross_compile_set}" = "" ]
@@ -126,12 +116,24 @@ do_build_target() {
 		fi
 	fi
 
+	printf "Building ${arch} ${target} \n" >&2 | tee -a "${log_report}"
+	MAKE="${MAKE} CROSS_COMPILE=${cross_compile}"
+	${MAKE} ${target} 2>&1 > "${log_report}" | tee "${log_err}"
+	for i in ${KCONFIG_ADD}; do
+		./scripts/kconfig/merge_config.sh -m -O \
+			${BUILDDIR} ${BUILDDIR}/.config $i \
+			2>&1 > "${log_report}" | tee "${log_err}"
+	done
+	${MAKE} olddefconfig 2>&1 > "${log_report}" | tee "${log_err}"
+
+	check_pipe_status
+	configure_result="$?"
+
 	printf "Configure: " | tee -a "${log_report}"
 
 	if [ "$configure_result" = "0" ]; then
 		printf "OK     \n" | tee -a "${log_report}"
 
-		MAKE="make -j${JOBS} CROSS_COMPILE=${cross_compile} ARCH=${arch} O=${BUILDDIR}"
 		${MAKE} -s 2>&1 >> "${log_report}" | tee -a "${log_err}"
 
 		check_pipe_status
-- 
2.39.2




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] MAKEALL: source defconfig after determining correct CROSS_COMPILE
  2023-06-12 12:47 [PATCH] MAKEALL: source defconfig after determining correct CROSS_COMPILE Ahmad Fatoum
@ 2023-06-26  9:51 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2023-06-26  9:51 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, Jun 12, 2023 at 02:47:39PM +0200, Ahmad Fatoum wrote:
> ARM 32- and 64-bit have different GCC compiler backends, but the same
> architecture in barebox. MAKEALL handles that by sourcing the defconfig
> and then looking for CONFIG_CPU_64 before continuing to build. This is
> problematic, because CROSS_COMPILE can only be set after that, so we may
> end up with more dynamic Kconfig options being wrongly set the first
> time, because CROSS_COMPILE wasn't correctly set. Fix this by always
> sourcing the defconfig again once we determine the correct
> CROSS_COMPILE.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  MAKEALL | 30 ++++++++++++++++--------------
>  1 file changed, 16 insertions(+), 14 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/MAKEALL b/MAKEALL
> index a4e268d54cf8..d3a289fd3839 100755
> --- a/MAKEALL
> +++ b/MAKEALL
> @@ -91,21 +91,9 @@ do_build_target() {
>  
>  	rm -rf "${BUILDDIR}"
>  	mkdir -p "${LOGDIR}/${target}"
> -	printf "Building ${arch} ${target} \n" >&2 | tee -a "${log_report}"
> -
> -	tmp=$(echo "${target}" | tr - _)
>  
>  	MAKE="make -j${JOBS} ARCH=${arch} O=${BUILDDIR}"
> -	${MAKE} ${target} 2>&1 > "${log_report}" | tee "${log_err}"
> -	for i in ${KCONFIG_ADD}; do
> -		./scripts/kconfig/merge_config.sh -m -O \
> -			${BUILDDIR} ${BUILDDIR}/.config $i \
> -			2>&1 > "${log_report}" | tee "${log_err}"
> -	done
> -	${MAKE} olddefconfig 2>&1 > "${log_report}" | tee "${log_err}"
> -
> -	check_pipe_status
> -	configure_result="$?"
> +	${MAKE} ${target} &>/dev/null
>  
>  	if [ ${arch} = "arm" ]; then
>  		grep -q "CONFIG_CPU_64=y" ${BUILDDIR}/.config
> @@ -114,6 +102,8 @@ do_build_target() {
>  		fi
>  	fi
>  
> +	tmp=$(echo "${target}" | tr - _)
> +
>  	cross_compile=$(eval echo '$CROSS_COMPILE_'${tmp})
>  	cross_compile_set=$(eval echo '${CROSS_COMPILE_'${tmp}'+set}')
>  	if [ "${cross_compile_set}" = "" ]
> @@ -126,12 +116,24 @@ do_build_target() {
>  		fi
>  	fi
>  
> +	printf "Building ${arch} ${target} \n" >&2 | tee -a "${log_report}"
> +	MAKE="${MAKE} CROSS_COMPILE=${cross_compile}"
> +	${MAKE} ${target} 2>&1 > "${log_report}" | tee "${log_err}"
> +	for i in ${KCONFIG_ADD}; do
> +		./scripts/kconfig/merge_config.sh -m -O \
> +			${BUILDDIR} ${BUILDDIR}/.config $i \
> +			2>&1 > "${log_report}" | tee "${log_err}"
> +	done
> +	${MAKE} olddefconfig 2>&1 > "${log_report}" | tee "${log_err}"
> +
> +	check_pipe_status
> +	configure_result="$?"
> +
>  	printf "Configure: " | tee -a "${log_report}"
>  
>  	if [ "$configure_result" = "0" ]; then
>  		printf "OK     \n" | tee -a "${log_report}"
>  
> -		MAKE="make -j${JOBS} CROSS_COMPILE=${cross_compile} ARCH=${arch} O=${BUILDDIR}"
>  		${MAKE} -s 2>&1 >> "${log_report}" | tee -a "${log_err}"
>  
>  		check_pipe_status
> -- 
> 2.39.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-26  9:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-12 12:47 [PATCH] MAKEALL: source defconfig after determining correct CROSS_COMPILE Ahmad Fatoum
2023-06-26  9:51 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox