From f0226ed24e3848dd23909b836ea9f7c482909ca4 Mon Sep 17 00:00:00 2001 From: OrangePi CM5 Builder Date: Thu, 9 Apr 2026 19:00:23 +0800 Subject: [PATCH] build: fix IGNORE_UPDATES bootstrap placement Ensure missing kernel/u-boot/ATF sources are fetched once even when IGNORE_UPDATES=yes, before compilation starts. --- scripts/main.sh | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/scripts/main.sh b/scripts/main.sh index 1363128a4ddd..65d44ae84543 100755 --- a/scripts/main.sh +++ b/scripts/main.sh @@ -563,6 +563,26 @@ if [[ ${IGNORE_UPDATES} != yes ]]; then BUILD_HOST_TOOLS fi +# IGNORE_UPDATES=yes: prefer local trees, but bootstrap missing sources to avoid hard failures. +if [[ ${IGNORE_UPDATES} == yes ]]; then + # Kernel: if the tree isn't populated, it will be missing the top-level Makefile. + if [[ $BUILD_OPT =~ kernel|image && ! -f "${LINUXSOURCEDIR}/Makefile" ]]; then + display_alert "Kernel sources missing; downloading once" "(IGNORE_UPDATES=yes)" "wrn" + fetch_from_repo "$KERNELSOURCE" "$KERNELDIR" "$KERNELBRANCH" "yes" + fi + + # U-Boot/ATF are required for u-boot/image builds; fetch once if missing. + if [[ $BOARDFAMILY != "cix" && $BUILD_OPT =~ u-boot|image && ! -f "${BOOTSOURCEDIR}/Makefile" ]]; then + display_alert "U-Boot sources missing; downloading once" "(IGNORE_UPDATES=yes)" "wrn" + fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes" + fi + + if [[ -n ${ATFSOURCE} && $BUILD_OPT =~ u-boot|image && ! -f "${EXTER}/cache/sources/${ATFSOURCEDIR}/Makefile" ]]; then + display_alert "ATF sources missing; downloading once" "(IGNORE_UPDATES=yes)" "wrn" + fetch_from_repo "$ATFSOURCE" "${EXTER}/cache/sources/$ATFDIR" "$ATFBRANCH" "yes" + fi +fi + for option in $(tr ',' ' ' <<< "$CLEAN_LEVEL"); do [[ $option != sources ]] && cleaning "$option" done @@ -585,27 +605,6 @@ if [[ $BUILD_OPT == u-boot || $BUILD_OPT == image ]]; then display_alert "File name" "${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb" "info" fi fi - -else - - # IGNORE_UPDATES=yes: prefer local trees, but bootstrap missing sources to avoid hard failures. - # Kernel: if the tree isn't populated, it will be missing the top-level Makefile. - if [[ $BUILD_OPT =~ kernel|image && ! -f "${LINUXSOURCEDIR}/Makefile" ]]; then - display_alert "Kernel sources missing; downloading once" "(IGNORE_UPDATES=yes)" "wrn" - fetch_from_repo "$KERNELSOURCE" "$KERNELDIR" "$KERNELBRANCH" "yes" - fi - - # U-Boot/ATF are required for image builds; fetch once if missing. - if [[ $BOARDFAMILY != "cix" && $BUILD_OPT =~ u-boot|image && ! -f "${BOOTSOURCEDIR}/Makefile" ]]; then - display_alert "U-Boot sources missing; downloading once" "(IGNORE_UPDATES=yes)" "wrn" - fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes" - fi - - if [[ -n ${ATFSOURCE} && $BUILD_OPT =~ u-boot|image && ! -f "${EXTER}/cache/sources/${ATFSOURCEDIR}/Makefile" ]]; then - display_alert "ATF sources missing; downloading once" "(IGNORE_UPDATES=yes)" "wrn" - fetch_from_repo "$ATFSOURCE" "${EXTER}/cache/sources/$ATFDIR" "$ATFBRANCH" "yes" - fi - fi # Compile kernel if packed .deb does not exist or use the one from Orange Pi