Message ID | 20200402135059.33253-1-freifunk@adrianschmutzler.de |
---|---|
State | Not Applicable |
Headers | show |
Series | [OpenWrt-Devel] buildscript: copy all squashfs images for one device | expand |
Sorry, wrong list, please ignore. Those git-send macros make it too easy. Adrian > -----Original Message----- > From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org] > On Behalf Of Adrian Schmutzler > Sent: Donnerstag, 2. April 2020 15:51 > To: openwrt-devel@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@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@lists.openwrt.org > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
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 }
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@adrianschmutzler.de> --- This has been tested with my firmware, but not after porting to official. --- buildscript | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-)