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

Side by Side Diff: scripts/image_signing/unpack_firmwarefd.sh

Issue 3026018: Add script for re-signing final firmware images with the correct keys. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git
Patch Set: . Created 10 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « scripts/image_signing/resign_firmwarefd.sh ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash
2
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 # Script that unpacks a firmware image (in .fd format) into its component
8 # pieces. Only outputs firmware A and B data, vblocks and the GBB.
9
10 # The fmap_decode tool must be in the system path.
11
12 # Abort on error
13 set -e
14
15 # Check arguments
16 if [ $# -ne 1 ] ; then
17 echo "Usage: $0 src_fd"
18 echo "Outputs firmware.gbb, firmware[A|B].[data|vblock]"
19 exit 1
20 fi
21
22 # Make sure the tools we need are available.
23 type -P fmap_decode &>/dev/null || \
24 { echo "fmap_decode tool not found."; exit 1; }
25
26 src_fd=$1
27
28 # Parse offsets and size of firmware data and vblocks
29 let gbb_offset="$(fmap_decode $1 | grep GBB | cut -b 14-23)"
30 let gbb_size="$(fmap_decode $1 | grep GBB | cut -b 37-46)"
31 set -x
32 for i in "A" "B"
33 do
34 match_str="$i Key"
35 eval let \
36 fw${i}_vblock_offset="$(fmap_decode $1 | grep "$match_str" | cut -b 14-23)"
37 eval let \
38 fw${i}_vblock_size="$(fmap_decode $1 | grep "$match_str" | cut -b 37-46)"
39
40 match_str="$i Data"
41 eval let fw${i}_offset="$(fmap_decode $1 | grep "$match_str" | cut -b 14-23)"
42 eval let fw${i}_size="$(fmap_decode $1 | grep "$match_str" | cut -b 37-46)"
43 done
44
45 echo "Extracting GBB"
46 dd if="${src_fd}" of="firmware.gbb" skip="${gbb_offset}" bs=1 \
47 count="${gbb_size}"
48 echo "Extracting Firmware data and vblock(s)"
49 dd if="${src_fd}" of="firmwareA.data" skip="${fwA_offset}" bs=1 \
50 count="${fwA_size}"
51 dd if="${src_fd}" of="firmwareA.vblock" skip="${fwA_vblock_offset}" bs=1 \
52 count="${fwA_vblock_size}"
53 dd if="${src_fd}" of="firmwareB.data" skip="${fwB_offset}" bs=1 \
54 count="${fwB_size}"
55 dd if="${src_fd}" of="firmwareB.vblock" skip="${fwB_vblock_offset}" bs=1 \
56 count="${fwB_vblock_size}"
OLDNEW
« no previous file with comments | « scripts/image_signing/resign_firmwarefd.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698