buildscript: copy all squashfs images for one device

So far, we are selecting specific squashfs images to be copied
from openwrt bin folder to our "final" bin directory. This has
the disadvantage that additional image types/names have to be
added explicitly, bloating the relevant code in buildscript.

With this patch, this behavior is changed in order to copy all
squashfs images for a particular device. To achieve that, the
image names in the bsp files are changed to contain a wildcard
that will be evaluated in buildscript.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
This commit is contained in:
Adrian Schmutzler 2020-04-02 16:23:15 +02:00
parent 873dd49d99
commit 157ddf2bc9
5 changed files with 57 additions and 53 deletions

View File

@ -1,42 +1,42 @@
machine=ar71xx
chipset=ar71xx
subtarget=tiny
images=("openwrt-${chipset}-${subtarget}-archer-c25-v1-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-archer-c60-v1-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-archer-c60-v2-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-archer-c7-v2-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-archer-c7-v5-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-cpe210-220-v1-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-cpe210-v2-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-cpe210-v3-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-cpe510-520-v1-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-gl-ar150-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-mr3020-v1-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wa850re-v1-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wa860re-v1-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wa901nd-v2-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wdr3500-v1-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wdr3600-v1-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wdr4300-v1-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wdr4310-v1-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wr1043nd-v1-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wr1043nd-v2-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wr1043nd-v3-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wr1043nd-v4-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wr1043n-v5-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wr740n-v4-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wr741nd-v2-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wr741nd-v4-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wr841-v7-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wr841-v8-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wr841-v9-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wr841-v10-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wr841-v11-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wr841-v12-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wr842n-v2-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-ubnt-bullet-m-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-ubnt-loco-m-xw-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-ubnt-nano-m-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-ubnt-unifi-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-ubnt-unifiac-lite-squashfs-sysupgrade.bin"
images=("openwrt-${chipset}-${subtarget}-archer-c25-v1-squashfs-*"
"openwrt-${chipset}-${subtarget}-archer-c60-v1-squashfs-*"
"openwrt-${chipset}-${subtarget}-archer-c60-v2-squashfs-*"
"openwrt-${chipset}-${subtarget}-archer-c7-v2-squashfs-*"
"openwrt-${chipset}-${subtarget}-archer-c7-v5-squashfs-*"
"openwrt-${chipset}-${subtarget}-cpe210-220-v1-squashfs-*"
"openwrt-${chipset}-${subtarget}-cpe210-v2-squashfs-*"
"openwrt-${chipset}-${subtarget}-cpe210-v3-squashfs-*"
"openwrt-${chipset}-${subtarget}-cpe510-520-v1-squashfs-*"
"openwrt-${chipset}-${subtarget}-gl-ar150-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-mr3020-v1-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wa850re-v1-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wa860re-v1-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wa901nd-v2-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wdr3500-v1-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wdr3600-v1-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wdr4300-v1-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wdr4310-v1-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wr1043nd-v1-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wr1043nd-v2-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wr1043nd-v3-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wr1043nd-v4-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wr1043n-v5-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wr740n-v4-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wr741nd-v2-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wr741nd-v4-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wr841-v7-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wr841-v8-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wr841-v9-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wr841-v10-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wr841-v11-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wr841-v12-squashfs-*"
"openwrt-${chipset}-${subtarget}-tl-wr842n-v2-squashfs-*"
"openwrt-${chipset}-${subtarget}-ubnt-bullet-m-squashfs-*"
"openwrt-${chipset}-${subtarget}-ubnt-loco-m-xw-squashfs-*"
"openwrt-${chipset}-${subtarget}-ubnt-nano-m-squashfs-*"
"openwrt-${chipset}-${subtarget}-ubnt-unifi-squashfs-*"
"openwrt-${chipset}-${subtarget}-ubnt-unifiac-lite-squashfs-*"
)

View File

@ -3,5 +3,5 @@ chipset=ipq806x
subtarget=generic
images=(
"openwrt-${chipset}-${subtarget}-tplink_c2600-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tplink_c2600-squashfs-*"
)

View File

@ -3,5 +3,5 @@ chipset=mpc85xx
subtarget=generic
images=(
"openwrt-${chipset}-${subtarget}-tl-wdr4900-v1-squashfs-sysupgrade.bin"
"openwrt-${chipset}-${subtarget}-tl-wdr4900-v1-squashfs-*"
)

View File

@ -3,6 +3,6 @@ chipset=ramips
subtarget=mt7621
images=(
"openwrt-ramips-mt7621-ubnt-erx-squashfs-sysupgrade.bin"
"openwrt-ramips-mt7621-ubnt-erx-sfp-squashfs-sysupgrade.bin"
"openwrt-ramips-mt7621-ubnt-erx-squashfs-*"
"openwrt-ramips-mt7621-ubnt-erx-sfp-squashfs-*"
)

View File

@ -292,18 +292,22 @@ cp_firmware() {
mkdir -p "bin/$variant"
for image in ${images[@]}; do
filename_build=${image//openwrt/fff-${version}}
filename_build=${filename_build//squashfs-/}
filename_build=${filename_build//${chipset}-${subtarget}-/}
cp "$builddir/bin/targets/${chipset}/${subtarget}/$image" "./bin/$variant/$filename_build"
imagesrcpath="$builddir/bin/targets/${chipset}/${subtarget}"
imagedestpath="./bin/$variant"
for region in "" "-eu" "-us"; do
image_factory=${image/sysupgrade/factory$region}
if [[ -f "$builddir/bin/targets/${chipset}/${subtarget}/$image_factory" ]]; then
filename_build_factory=${filename_build/sysupgrade/factory$region}
cp "$builddir/bin/targets/${chipset}/${subtarget}/$image_factory" "./bin/$variant/$filename_build_factory"
fi
for image in ${images[@]}; do
# This assumes the set of images names is given with a wildcard
fullsrcpattern=$imagesrcpath/$image
if ! ls $fullsrcpattern >/dev/null 2>/dev/null; then
echo "Warning: $image not found."
continue
fi
for f in $fullsrcpattern; do
filename_build=${f##*/}
filename_build=${filename_build//openwrt/fff-${version}}
filename_build=${filename_build//squashfs-/}
filename_build=${filename_build//${chipset}-${subtarget}-/}
cp "$f" "$imagedestpath/$filename_build"
done
done
}