[OpenWrt-Devel] [PATCH] buildscript: copy all squashfs images for one device

mail at adrianschmutzler.de mail at adrianschmutzler.de
Thu Apr 2 09:53:40 EDT 2020


Sorry, wrong list, please ignore.

Those git-send macros make it too easy.

Adrian

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Adrian Schmutzler
> Sent: Donnerstag, 2. April 2020 15:51
> To: openwrt-devel at lists.openwrt.org
> Subject: [OpenWrt-Devel] [PATCH] 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. As before, this will _not_ copy initramfs images.
> 
> Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ---
> 
> This has been tested with my firmware, but not after porting to official.
> 
> ---
>  buildscript | 27 ++++++++++++++++-----------
>  1 file changed, 16 insertions(+), 11 deletions(-)
> 
> diff --git a/buildscript b/buildscript
> index b0935a4c..bbfb2f92 100755
> --- a/buildscript
> +++ b/buildscript
> @@ -292,18 +292,23 @@ cp_firmware() {
> 
>      mkdir -p "bin/$variant"
> 
> +    imagesrcpath="$builddir/bin/targets/${chipset}/${subtarget}"
> +    imagedestpath="./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"
> -
> -        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
> +        # the following line is no mistake, since the first expression
> +        # is evaluated, while the second is used literally
> +        fullsrcpath=$imagesrcpath/${image//squashfs-*/squashfs-*}
> +        if ! ls $fullsrcpath >/dev/null 2>/dev/null; then
> +            echo "Warning: $image not found."
> +            continue
> +        fi
> +        for f in $fullsrcpath; 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
>  }
> --
> 2.20.1
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20200402/573224fc/attachment.sig>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list