From 157ddf2bc9ac22f711012ffee39a0f0ed7ac6797 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Thu, 2 Apr 2020 16:23:15 +0200 Subject: [PATCH] buildscript: copy all squashfs images for one device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Fabian Bläse --- bsp/board_ar71xx.bsp | 76 +++++++++++++++++++++---------------------- bsp/board_ipq806x.bsp | 2 +- bsp/board_mpc85xx.bsp | 2 +- bsp/board_mt7621.bsp | 4 +-- buildscript | 26 ++++++++------- 5 files changed, 57 insertions(+), 53 deletions(-) diff --git a/bsp/board_ar71xx.bsp b/bsp/board_ar71xx.bsp index 46c5df2..344e2e5 100644 --- a/bsp/board_ar71xx.bsp +++ b/bsp/board_ar71xx.bsp @@ -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-*" ) diff --git a/bsp/board_ipq806x.bsp b/bsp/board_ipq806x.bsp index 1cff488..194049a 100644 --- a/bsp/board_ipq806x.bsp +++ b/bsp/board_ipq806x.bsp @@ -3,5 +3,5 @@ chipset=ipq806x subtarget=generic images=( - "openwrt-${chipset}-${subtarget}-tplink_c2600-squashfs-sysupgrade.bin" + "openwrt-${chipset}-${subtarget}-tplink_c2600-squashfs-*" ) diff --git a/bsp/board_mpc85xx.bsp b/bsp/board_mpc85xx.bsp index 79725d5..6e10035 100644 --- a/bsp/board_mpc85xx.bsp +++ b/bsp/board_mpc85xx.bsp @@ -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-*" ) diff --git a/bsp/board_mt7621.bsp b/bsp/board_mt7621.bsp index 1c91bf5..aef3800 100644 --- a/bsp/board_mt7621.bsp +++ b/bsp/board_mt7621.bsp @@ -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-*" ) diff --git a/buildscript b/buildscript index b0935a4..d4e739d 100755 --- a/buildscript +++ b/buildscript @@ -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 }