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

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

Issue 3066034: Add a script to generate builds signed using the official 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 | « no previous file | scripts/image_signing/customize_image.sh » ('j') | 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 # Determine script directory
8 SCRIPT_DIR=$(dirname $0)
9 GPT=cgpt
10
11 # Read GPT table to find the starting location of a specific partition.
12 # Args: DEVICE PARTNUM
13 # Returns: offset (in sectors) of partition PARTNUM
14 partoffset() {
15 sudo $GPT show -b -i $2 $1
16 }
17
18 # Read GPT table to find the size of a specific partition.
19 # Args: DEVICE PARTNUM
20 # Returns: size (in sectors) of partition PARTNUM
21 partsize() {
22 sudo $GPT show -s -i $2 $1
23 }
24
25 # Mount a partition from an image into a local directory
26 # Args: IMAGE PARTNUM MOUNTDIRECTORY
27 mount_image_partition() {
28 local image=$1
29 local partnum=$2
30 local mount_dir=$3
31 local offset=$(partoffset "$image" "$partnum")
32 sudo mount -o loop,offset=$((offset * 512)) "$image" "$mount_dir"
33 }
34
35 # Extract a partition to a file
36 # Args: IMAGE PARTNUM OUTPUTFILE
37 extract_image_partition() {
38 local image=$1
39 local partnum=$2
40 local output_file=$3
41 local offset=$(partoffset "$image" "$partnum")
42 local size=$(partsize "$image" "$partnum")
43 dd if=$image of=$output_file bs=512 skip=$offset count=$size
44 }
45
OLDNEW
« no previous file with comments | « no previous file | scripts/image_signing/customize_image.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698