Make 'make' more resilient

This commit is contained in:
2024-04-24 11:31:00 -04:00
parent b5d13f000e
commit 90700e9595

View File

@@ -671,18 +671,14 @@ fromSource() {
# make dirclean # compiled output, toolchain, build tools # make dirclean # compiled output, toolchain, build tools
# make distclean # compiled output, toolchain, build tools, .config, feeds, .ccache # make distclean # compiled output, toolchain, build tools, .config, feeds, .ccache
# Make image # Make prep
(( DEBUG )) && make_opts+=("V=s") (( DEBUG )) && make_opts+=("V=s")
execute make "${make_opts[@]}" "-j1" defconfig download clean execute make "${make_opts[@]}" "-j1" defconfig download clean
make_opts+=("-j$(($(nproc) - 2))") # Make image
#make_opts+=("-j1") # for debugging purposes if ! execute make "${make_opts[@]}" "-j$(($(nproc)+1))" world; then
if ! execute make "${make_opts[@]}" world; then
echo "Error: make failed, retrying using slow mode" echo "Error: make failed, retrying using slow mode"
execute make V=s -j1 dirclean if ! execute make V=s -j1 dirclean world; then
if ! execute make V=s -j1 world; then
echo "Error: slow make failed" echo "Error: slow make failed"
return 1 return 1
fi fi
@@ -690,7 +686,7 @@ fromSource() {
popd || return 1 popd || return 1
# Provide symlinks to images in root of BINDIR (to match Image Builder) # Symlink output images to root of BINDIR (match Image Builder)
shopt -s nullglob shopt -s nullglob
for image in "$BINDIR/targets/${TARGET}/"*.{img,img.gz,ubi}; do for image in "$BINDIR/targets/${TARGET}/"*.{img,img.gz,ubi}; do
ln -fs "$image" "$BINDIR/${image##*/}" ln -fs "$image" "$BINDIR/${image##*/}"