[PATCH] buildscript: Remove target binaries from build dir before building

Adrian Schmutzler freifunk at adrianschmutzler.de
Mi Okt 2 17:42:35 CEST 2019


So far, if build fails, but images from last successful build are
present in OpenWrt build directory (build/bin/targets/...), those
are copied even after unsuccessful build.

This results in the old images being copied to the bin folder and
being labelled with the new firmware revision. (!)
As our error check also only looks at whether images are there,
the image copying process will look like a success.

This patch deletes old images of the target/subtarget to be built,
so that the copy-firmware step will find nothing if the build
stop to early.

Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
---
 buildscript | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/buildscript b/buildscript
index c2de5759..81974a97 100755
--- a/buildscript
+++ b/buildscript
@@ -212,6 +212,8 @@ prebuild() {
 build() {
     prebuild
 
+    rm_firmware
+
     opath=$(pwd)
     cd "$target"
     cpus=$(grep -c processor /proc/cpuinfo)
@@ -269,6 +271,12 @@ config() {
     cd "$opath"
 }
 
+rm_firmware() {
+    [ -n "$subtarget" ] || subtarget="generic"
+
+    rm -rf $target/bin/targets/${chipset}/${subtarget}
+}
+
 cp_firmware() {
     [ -n "$subtarget" ] || subtarget="generic"
 
-- 
2.20.1



Mehr Informationen über die Mailingliste franken-dev