[PATCH] MAKEALL: source defconfig after determining correct CROSS_COMPILE
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Jun 12 05:47:39 PDT 2023
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 at 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
More information about the barebox
mailing list