summaryrefslogtreecommitdiff
path: root/recipes-core
diff options
context:
space:
mode:
authorJason Reiss <jreiss@multitech.com>2016-11-02 11:19:19 -0500
committerJason Reiss <jreiss@multitech.com>2016-11-02 11:19:19 -0500
commit4a699900a468a228d8280eaea5e7c7f0bb63be05 (patch)
tree59c025b00c685f342c65407c7823268922e17c80 /recipes-core
parent7f176197b131aadcbfdb9e85c424a9ed67543af7 (diff)
parentebbb49d7bcfa7874cb820e6106164ea42d05f723 (diff)
downloadmeta-mlinux-4a699900a468a228d8280eaea5e7c7f0bb63be05.tar.gz
meta-mlinux-4a699900a468a228d8280eaea5e7c7f0bb63be05.tar.bz2
meta-mlinux-4a699900a468a228d8280eaea5e7c7f0bb63be05.zip
Merge remote-tracking branch 'origin' into Conduit_0.1
Diffstat (limited to 'recipes-core')
-rw-r--r--recipes-core/mlinux-scripts/mlinux-scripts-1.0.inc5
-rwxr-xr-xrecipes-core/mlinux-scripts/mlinux-scripts-1.0/mlinux-firmware-upgrade57
-rw-r--r--recipes-core/mlinux-scripts/mlinux-scripts_1.0.bb2
3 files changed, 62 insertions, 2 deletions
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.0.inc b/recipes-core/mlinux-scripts/mlinux-scripts-1.0.inc
index fd75904..979fc4c 100644
--- a/recipes-core/mlinux-scripts/mlinux-scripts-1.0.inc
+++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.0.inc
@@ -6,7 +6,9 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda
SRC_URI = "file://mlinux-wifi-ap \
file://mlinux-dhcpd \
file://mlinux-set-apn \
- file://mlinux-cell-router"
+ file://mlinux-cell-router \
+ file://mlinux-firmware-upgrade \
+"
do_install() {
@@ -15,4 +17,5 @@ do_install() {
install -m 755 ${WORKDIR}/mlinux-dhcpd ${D}${sbindir}
install -m 755 ${WORKDIR}/mlinux-set-apn ${D}${sbindir}
install -m 755 ${WORKDIR}/mlinux-cell-router ${D}${sbindir}
+ install -m 755 ${WORKDIR}/mlinux-firmware-upgrade ${D}${sbindir}
}
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.0/mlinux-firmware-upgrade b/recipes-core/mlinux-scripts/mlinux-scripts-1.0/mlinux-firmware-upgrade
new file mode 100755
index 0000000..94027d5
--- /dev/null
+++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.0/mlinux-firmware-upgrade
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+if [ $# != 1 ]; then
+ echo "Usage: $0 upgrade.bin"
+ exit 1
+fi
+
+set -e
+upgrade=$1
+
+mkdir -p /var/volatile
+cd /var/volatile
+
+# make sure firmware is for this device
+hw_version=$(cat /sys/devices/platform/mts-io/hw-version)
+firmware_model=$(tar -xO -f $upgrade model)
+shopt -s nocasematch
+if [[ ! "$hw_version" =~ ^$firmware_model- ]]; then
+ logger -s -t firmware_upgrade "Wrong firmware for this hardware"
+ logger -s -t firmware_upgrade "hw version: $hw_version"
+ logger -s -t firmware_upgrade "firmware model: $firmware_model"
+ exit 1
+fi
+
+files=(bstrap.bin uboot.bin uImage.bin config.jffs2 oem.jffs2 rootfs.jffs2)
+
+tobeflashed=0
+# verify all MD5 sums
+for (( i = 0; i < ${#files[@]}; i++ )); do
+ file=${files[i]}
+ # if the file is in the tar, md5sum it
+ if tar -t -f $upgrade | grep -F -q "$file"; then
+ logger -s -t firmware_upgrade "Checking MD5 for $file..."
+ if ! tar -x -f $upgrade $file.md5; then
+ logger -s -t firmware_upgrade "MD5 is not found for the $file, upgrade aborted"
+ exit 1
+ fi
+ if ! tar -xO -f $upgrade $file | md5sum -c $file.md5; then
+ logger -s -t firmware_upgrade "MD5 check failed, upgrade aborted"
+ exit 1
+ fi
+ tobeflashed=1
+ fi
+done
+
+if (( $tobeflashed )); then
+ mkdir -p /var/volatile/flash-upgrade
+ mv -f $upgrade /var/volatile/flash-upgrade/upgrade.bin
+ touch /var/volatile/do_flash_upgrade
+ logger -s -t firmware_upgrade "Rebooting"
+ sleep 1
+ reboot
+ exit 0
+else
+ logger -s -t firmware_upgrade "Nothing to be flashed!"
+ exit 1
+fi
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts_1.0.bb b/recipes-core/mlinux-scripts/mlinux-scripts_1.0.bb
index 6b0d37f..9fb8fbd 100644
--- a/recipes-core/mlinux-scripts/mlinux-scripts_1.0.bb
+++ b/recipes-core/mlinux-scripts/mlinux-scripts_1.0.bb
@@ -2,6 +2,6 @@ DESCRIPTION = "Scripts to easily get started with common mLinux use cases"
require mlinux-scripts-1.0.inc
-PR = "r4"
+PR = "r5"
S = "${WORKDIR}/mlinux-scripts-${PV}"