Skip to content

Commit

Permalink
build: save faillogs for devices that fail to build
Browse files Browse the repository at this point in the history
  • Loading branch information
pktpls committed Jul 1, 2024
1 parent a420aa5 commit 39ef73e
Showing 1 changed file with 43 additions and 33 deletions.
76 changes: 43 additions & 33 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ packageset="$(cat "packageset/$(echo "$fversion" | cut -d'-' -f1)/$variant.txt"

# let's get to work
cd "$ibdir"
mkdir -p "bin/targets/$target/faillogs"

# falter feed for imagebuilder
arch="$(grep CONFIG_TARGET_ARCH_PACKAGES .config | cut -d'=' -f 2 | tr -d '"')"
Expand Down Expand Up @@ -191,41 +192,50 @@ EOF
continue
fi

# customize image based on device quirks (see below)
packages="$packageset"
info="$(echo "SELECT flashmb, rammb FROM toh WHERE firmwareopenwrtinstallurl LIKE '%$profile%' LIMIT 1" | sqlite3 -batch "$rootdir/tmp/toh.db")"

# devices with <= 8 MB disk space
flashmb="$(echo "$info" | cut -d'|' -f 1)"
if [ -n "$flashmb" ] && [ "$flashmb" -le 8 ] || [ "x$p" = "xubnt_unifiac-mesh" ]; then
packages="-mtr -iperf3 -tmux -vnstat -falter-berlin-service-registrar -luci-app-falter-service-registrar -luci-i18n-falter-service-registrar-de $packages"
fi

# devices with <= 32 MB RAM
rammb="$(echo "$info" | cut -d'|' -f 2)"
if [ -n "$rammb" ] && [ "$rammb" -le 32 ]; then
packages="zram-swap $packages"
fi

# qualcomm wave1 devices shouldn't use the CT/CandelaTech wifi driver
devpkgs="$(make info | grep "$profile:" -A 2 | tail -n1 | cut -d':' -f2)"
if [[ "$devpkgs" =~ ath10k-firmware-qca9887 ]]; then
packages="kmod-ath10k ath10k-firmware-qca9887 -kmod-ath10k-ct -ath10k-firmware-qca9887-ct $packages"
# subshell because we save the device build log if it fails
(
# customize image based on device quirks (see below)
packages="$packageset"
info="$(echo "SELECT flashmb, rammb FROM toh WHERE firmwareopenwrtinstallurl LIKE '%$profile%' LIMIT 1" | sqlite3 -batch "$rootdir/tmp/toh.db")"

# devices with <= 8 MB disk space
flashmb="$(echo "$info" | cut -d'|' -f 1)"
if [ -n "$flashmb" ] && [ "$flashmb" -le 8 ] || [ "x$p" = "xubnt_unifiac-mesh" ]; then
packages="-mtr -iperf3 -tmux -vnstat -falter-berlin-service-registrar -luci-app-falter-service-registrar -luci-i18n-falter-service-registrar-de $packages"
fi

# devices with <= 32 MB RAM
rammb="$(echo "$info" | cut -d'|' -f 2)"
if [ -n "$rammb" ] && [ "$rammb" -le 32 ]; then
packages="zram-swap $packages"
fi

# qualcomm wave1 devices shouldn't use the CT/CandelaTech wifi driver
devpkgs="$(make info | grep "$profile:" -A 2 | tail -n1 | cut -d':' -f2)"
if [[ "$devpkgs" =~ ath10k-firmware-qca9887 ]]; then
packages="kmod-ath10k ath10k-firmware-qca9887 -kmod-ath10k-ct -ath10k-firmware-qca9887-ct $packages"
fi
if [[ "$devpkgs" =~ ath10k-firmware-qca988x ]]; then
packages=" kmod-ath10k ath10k-firmware-qca988x -kmod-ath10k-ct -ath10k-firmware-qca988x-ct $packages"
fi

# broken kernel module (6/2024)
if [ "x$target" = "xx86/64" ]; then
packages=" -kmod-dwmac-intel $packages"
fi

# build images for this device
make image PROFILE="$p" PACKAGES="$packages" FILES=embedded-files EXTRA_IMAGE_NAME="freifunk-falter-$fversion" || true
) \
|& tee "bin/targets/$target/faillogs/$p.log" >&2

# if build resulted in image files, we can delete the log
if ls "bin/targets/$target/"*"$p"* >/dev/null ; then
rm -v "bin/targets/$target/faillogs/$p.log"
fi
if [[ "$devpkgs" =~ ath10k-firmware-qca988x ]]; then
packages=" kmod-ath10k ath10k-firmware-qca988x -kmod-ath10k-ct -ath10k-firmware-qca988x-ct $packages"
fi

# broken kernel module (6/2024)
if [ "x$target" = "xx86/64" ]; then
packages=" -kmod-dwmac-intel $packages"
fi

# build images for this device
make image PROFILE="$p" PACKAGES="$packages" FILES=embedded-files EXTRA_IMAGE_NAME="freifunk-falter-$fversion"

done
) |& tee "$destdir/build.log" >&2
) \
|& tee "$destdir/build.log" >&2

mv "$ibdir/bin/targets/$target"/* "$destdir/"

Expand Down

0 comments on commit 39ef73e

Please sign in to comment.