Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Unified Diff: scripts/image_signing/unpack_firmwarefd.sh

Issue 3050019: Don't use hardcoded offsets for parsing. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/image_signing/unpack_firmwarefd.sh
diff --git a/scripts/image_signing/unpack_firmwarefd.sh b/scripts/image_signing/unpack_firmwarefd.sh
index a9a0f9fbad5a25acd771b571efc594af572dd1fd..f16f6b49bff66db5dfba9a02f3a3ecce13849ae1 100755
--- a/scripts/image_signing/unpack_firmwarefd.sh
+++ b/scripts/image_signing/unpack_firmwarefd.sh
@@ -25,21 +25,34 @@ type -P fmap_decode &>/dev/null || \
src_fd=$1
-# Parse offsets and size of firmware data and vblocks
-let gbb_offset="$(fmap_decode $1 | grep GBB | cut -b 14-23)"
-let gbb_size="$(fmap_decode $1 | grep GBB | cut -b 37-46)"
-set -x
+# Grab GBB Area offset and size
+match_str="GBB Area"
+line=$(fmap_decode $1 | grep "$match_str")
+offset="$(echo $line | sed -e 's/.*area_offset=\"\([a-f0-9x]*\)\".*/\1/')"
+let gbb_offset="$offset"
vb 2010/07/27 18:18:50 is 'let' needed here and in line 34?
gauravsh 2010/07/27 18:45:26 Yes, to force hex->decimal conversion since dd doe
+size="$(echo $line | sed -e 's/.*area_size=\"\([a-f0-9x]*\)\".*/\1/')"
+let gbb_size="$size"
+
+# Grab Firmware A and B offset and size
for i in "A" "B"
do
match_str="$i Key"
+ line=$(fmap_decode $1 | grep "$match_str")
+ offset="$(echo $line | sed -e 's/.*area_offset=\"\([a-f0-9x]*\)\".*/\1/')"
eval let \
- fw${i}_vblock_offset="$(fmap_decode $1 | grep "$match_str" | cut -b 14-23)"
+ fw${i}_vblock_offset="$offset"
+ size="$(echo $line | sed -e 's/.*area_size=\"\([a-f0-9x]*\)\".*/\1/')"
eval let \
- fw${i}_vblock_size="$(fmap_decode $1 | grep "$match_str" | cut -b 37-46)"
+ fw${i}_vblock_size="$size"
match_str="$i Data"
- eval let fw${i}_offset="$(fmap_decode $1 | grep "$match_str" | cut -b 14-23)"
- eval let fw${i}_size="$(fmap_decode $1 | grep "$match_str" | cut -b 37-46)"
+ line=$(fmap_decode $1 | grep "$match_str")
+ offset="$(echo $line | sed -e 's/.*area_offset=\"\([a-f0-9x]*\)\".*/\1/')"
+ eval let \
+ fw${i}_offset="$offset"
+ size="$(echo $line | sed -e 's/.*area_size=\"\([a-f0-9x]*\)\".*/\1/')"
+ eval let \
+ fw${i}_size="$size"
done
echo "Extracting GBB"
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698