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

Submitted by Jan Kraus on April 5, 2016, 3:58 p.m.

Details

Message ID 1459871901-32657-4-git-send-email-mayosemmel@gmail.com
State Superseded, archived
Headers show

Commit Message

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

Patch hide | download patch | download mbox

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"

Comments

Tim Niemeyer April 5, 2016, 7:40 p.m.
Hi

Wenn du bitte die drei Anmerkungen einarbeitest, darfst du ein 
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
dran hängen.

Bitte beim Subject die Zeilenlänge von 50(?) Zeichen beachten. Das
Hauptanliegen in den Subject, den Rest mit einer Leerzeile getrennt in
die Commit-Message.

Am Dienstag, den 05.04.2016, 17:58 +0200 schrieb Jan Kraus:
> Signed-off-by: Jan Kraus <mayosemmel@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
Wie im IRC angekündigt, es fehlt die Anpassung an den anderen .config's.

Den Check vom sha256 hätte ich auch in einem vierten Patch gesehen. Mach
dir jetzt nicht deswegen die Arbeit, es hätte nur den Vorteil gehabt,
dass wir das sha256 Feature separat hätten diskutieren können, während
Patch1-3 hätte applied werden können.

> 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
Gemeint ist sha256 nicht sh256.

Tim

>      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
>
Jan Kraus April 5, 2016, 7:43 p.m.
Danke für dein Review!
Ich werde gleich noch ne v12 abschicken mit den geänderten Commit
messages. Außerdem werde ich noch den Hinweis von Tobias einarbeiten,
das ich das sha256 bei den anderen Boards noch vergessen habe. Denke da
immer nicht dran, weil ich solche nicht habe.

Am Dienstag, den 05.04.2016, 21:40 +0200 schrieb Tim Niemeyer:
> Hi
> 
> Wenn du bitte die drei Anmerkungen einarbeitest, darfst du ein 
> Reviewed-by: Tim Niemeyer <tim@tn-x.org>
> dran hängen.
> 
> Bitte beim Subject die Zeilenlänge von 50(?) Zeichen beachten. Das
> Hauptanliegen in den Subject, den Rest mit einer Leerzeile getrennt in
> die Commit-Message.
> 
> Am Dienstag, den 05.04.2016, 17:58 +0200 schrieb Jan Kraus:
> > Signed-off-by: Jan Kraus <mayosemmel@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
> Wie im IRC angekündigt, es fehlt die Anpassung an den anderen .config's.
> 
> Den Check vom sha256 hätte ich auch in einem vierten Patch gesehen. Mach
> dir jetzt nicht deswegen die Arbeit, es hätte nur den Vorteil gehabt,
> dass wir das sha256 Feature separat hätten diskutieren können, während
> Patch1-3 hätte applied werden können.
> 
> > 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
> Gemeint ist sha256 nicht sh256.
> 
> Tim
> 
> >      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
> > 
>