mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] MAKEALL: source defconfig after determining correct CROSS_COMPILE
Date: Mon, 12 Jun 2023 14:47:39 +0200	[thread overview]
Message-ID: <20230612124739.1080762-1-a.fatoum@pengutronix.de> (raw)

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




             reply	other threads:[~2023-06-12 12:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-12 12:47 Ahmad Fatoum [this message]
2023-06-26  9:51 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230612124739.1080762-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox