[PATCH v11 3/3] added buildrelease() for release process also changed image comparing at sysupgrade to sha256 and added the related tool

Jan Kraus mayosemmel at googlemail.com
Di Apr 5 17:58:21 CEST 2016


Signed-off-by: Jan Kraus <mayosemmel at gmail.com>
---
 bsp/ar71xx/.config                             |  1 +
 bsp/default/root_file_system/etc/sysupgrade.sh | 10 ++++-----
 buildscript                                    | 30 ++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/bsp/ar71xx/.config b/bsp/ar71xx/.config
index bbf34a9..dfc275c 100644
--- a/bsp/ar71xx/.config
+++ b/bsp/ar71xx/.config
@@ -12,6 +12,7 @@ CONFIG_ATH_USER_REGD=y
 # CONFIG_BUSYBOX_CONFIG_FEATURE_NTPD_SERVER is not set
 CONFIG_BUSYBOX_CONFIG_FEATURE_WGET_TIMEOUT=y
 CONFIG_BUSYBOX_CONFIG_HTTPD=y
+CONFIG_BUSYBOX_CONFIG_SHA256SUM=y
 CONFIG_CLEAN_IPKG=y
 CONFIG_FASTD_ENABLE_CIPHER_NULL=y
 CONFIG_FASTD_ENABLE_MAC_UHASH=y
diff --git a/bsp/default/root_file_system/etc/sysupgrade.sh b/bsp/default/root_file_system/etc/sysupgrade.sh
index d71ef35..2cc21ee 100755
--- a/bsp/default/root_file_system/etc/sysupgrade.sh
+++ b/bsp/default/root_file_system/etc/sysupgrade.sh
@@ -44,19 +44,19 @@ fi
 FILE="${FIRMWARE_COMMUNITY}-${VERSION}-${SOC}-generic-${BOARD}-squashfs-sysupgrade.bin"
 echo -ne "Downloading $FILE\n\n"
 wget $(uci get firmware.upgrade.path)/${FILE}
-wget $(uci get firmware.upgrade.path)/${FILE}.md5
+wget $(uci get firmware.upgrade.path)/${FILE}.sha256
 
-echo -ne "\ndone. Comparing md5 sums: "
-md5sum -c ${FILE}.md5
+echo -ne "\ndone. Comparing sha256 sums: "
+sha256sum -c ${FILE}.sha256
 ret=$?
 echo
 if [ $ret -ne 0 ]; then
-  echo -ne "md5 sums do not match. Try restarting this script to redownload the firmware.\n\n"
+  echo -ne "sha256 sums do not match. Try restarting this script to redownload the firmware.\n\n"
   rm -f ${FILE}*
   exit 1
 else
   while true; do
-    read -p "md5 sums correct. Should I start upgrading the firmware (y/N)? " yn
+    read -p "sh256 sums correct. Should I start upgrading the firmware (y/N)? " yn
     case $yn in
         [Yy] ) echo -ne "\nStarting firmware upgrade. Don't touch me until I reboot.\n\n\n"; sysupgrade ${FILE}; break;;
         [Nn]|* ) echo -ne "\nAborting firmware upgrade.\n\n"; rm -f ${FILE}*; exit 0;;
diff --git a/buildscript b/buildscript
index f916c6a..8116460 100755
--- a/buildscript
+++ b/buildscript
@@ -279,6 +279,25 @@ cp_firmware() {
     done
 }
 
+buildrelease() {
+    if [ "$1" = "all" ];then
+        buildall
+    elif [ "$1" = "fast" ];then
+        build fast
+    elif [ "$1" = "all" ] && [ "$2" = "fast" ];then
+        buildall fast
+    else
+        build
+    fi
+    cd bin
+    for binary in *.bin; do
+        md5sum "$binary" > ./"$binary".md5
+        sha256sum "$binary" > ./"$binary".sha256
+    done
+    cd ..
+    echo -e "VERSION:$version" > ./bin/release.nfo
+}
+
 clean() {
     /bin/rm -rf bin $builddir src/openwrt
 
@@ -416,6 +435,16 @@ case "$1" in
             buildall "$2" "$3"
         fi
         ;;
+    "release")
+        if [ "$2" = help ]; then
+            echo "This option builds the firmware for a given board. It also creates hash sums and a the file release.nfo"
+            echo
+            echo "Usage: $0 $1 [all] [fast]"
+            echo
+        else
+            buildrelease "$2"
+        fi
+        ;;
     *)
         echo "This is the Build Environment Script of the Freifunk Community Franken."
         echo
@@ -427,6 +456,7 @@ case "$1" in
         echo "  config openwrt"
         echo "  build [fast|debug]"
         echo "  buildall <community-file> [fast]"
+        echo "  release [all] [fast]"
         echo "  clean"
         echo ""
         echo "If you need help to one of these options just type: $0 <command> help"
-- 
2.1.4




Mehr Informationen über die Mailingliste franken-dev