aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm2708/base-files
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/brcm2708/base-files')
-rw-r--r--target/linux/brcm2708/base-files/lib/upgrade/platform.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/target/linux/brcm2708/base-files/lib/upgrade/platform.sh b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh
index 1d4b694574..2f2aeb098e 100644
--- a/target/linux/brcm2708/base-files/lib/upgrade/platform.sh
+++ b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh
@@ -1,5 +1,19 @@
+get_magic_at() {
+ local file="$1"
+ local pos="$2"
+ get_image "$file" | dd bs=1 count=2 skip="$pos" 2>/dev/null | hexdump -v -n 2 -e '1/1 "%02x"'
+}
+
platform_check_image() {
- # i know no way to verify the image
+ local file="$1"
+ local magic
+
+ magic=$(get_magic_at "$file" 510)
+ [ "$magic" != "55aa" ] && {
+ echo "Failed to verify MBR boot signature."
+ return 1
+ }
+
return 0;
}