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

Side by Side Diff: src/platform/installer/chromeos-common.sh

Issue 1512001: test-fixet: Automated VMWare test of AutoUpdate (Closed)
Patch Set: fixes for review Created 10 years, 8 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
« no previous file with comments | « no previous file | src/platform/memento_softwareupdate/autoupdated_vm_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 # 4 #
5 # This contains common constants and functions for installer scripts. This must 5 # This contains common constants and functions for installer scripts. This must
6 # evaluate properly for both /bin/bash and /bin/sh, since it's used both to 6 # evaluate properly for both /bin/bash and /bin/sh, since it's used both to
7 # create the initial image at compile time and to install or upgrade a running 7 # create the initial image at compile time and to install or upgrade a running
8 # image. 8 # image.
9 9
10 # Here are the GUIDs we'll be using to identify various partitions. 10 # Here are the GUIDs we'll be using to identify various partitions.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 if [ -x "${DEFAULT_CHROOT_DIR:-}/usr/bin/gpt" ]; then 85 if [ -x "${DEFAULT_CHROOT_DIR:-}/usr/bin/gpt" ]; then
86 GPT="${DEFAULT_CHROOT_DIR:-}/usr/bin/gpt" 86 GPT="${DEFAULT_CHROOT_DIR:-}/usr/bin/gpt"
87 else 87 else
88 echo "can't find gpt tool" 1>&2 88 echo "can't find gpt tool" 1>&2
89 exit 1 89 exit 1
90 fi 90 fi
91 fi 91 fi
92 92
93 93
94 # This installs a GPT into the specified device or file, using the given 94 # This installs a GPT into the specified device or file, using the given
95 # components. If the target is a block device we'll do a full install. 95 # components. If the target is a block device or the FORCE_FULL arg is "true"
96 # Otherwise, it'll be just enough to boot. 96 # we'll do a full install. Otherwise, it'll be just enough to boot.
97 # Invoke as: command (not subshell) 97 # Invoke as: command (not subshell)
98 # Args: TARGET ROOTFS_IMG KERNEL_IMG STATEFUL_IMG PMBRCODE 98 # Args: TARGET ROOTFS_IMG KERNEL_IMG STATEFUL_IMG PMBRCODE FORCE_FULL
99 # Return: nothing 99 # Return: nothing
100 # Side effects: Sets these global variables describing the GPT partitions 100 # Side effects: Sets these global variables describing the GPT partitions
101 # (all untis are 512-byte sectors): 101 # (all untis are 512-byte sectors):
102 # NUM_KERN_SECTORS 102 # NUM_KERN_SECTORS
103 # NUM_ROOTFS_SECTORS 103 # NUM_ROOTFS_SECTORS
104 # NUM_STATEFUL_SECTORS 104 # NUM_STATEFUL_SECTORS
105 # NUM_RESERVED_SECTORS 105 # NUM_RESERVED_SECTORS
106 # START_KERN_A 106 # START_KERN_A
107 # START_STATEFUL 107 # START_STATEFUL
108 # START_ROOTFS_A 108 # START_ROOTFS_A
109 # START_KERN_B 109 # START_KERN_B
110 # START_ROOTFS_B 110 # START_ROOTFS_B
111 # START_RESERVED 111 # START_RESERVED
112 install_gpt() { 112 install_gpt() {
113 local outdev=$1 113 local outdev=$1
114 local rootfs_img=$2 114 local rootfs_img=$2
115 local kernel_img=$3 115 local kernel_img=$3
116 local stateful_img=$4 116 local stateful_img=$4
117 local pmbrcode=$5 117 local pmbrcode=$5
118 local force_full="${6:-}"
118 119
119 # The gpt tool requires a fixed-size target to work on, so we may have to 120 # The gpt tool requires a fixed-size target to work on, so we may have to
120 # create a file of the appropriate size. Let's figure out what that size is 121 # create a file of the appropriate size. Let's figure out what that size is
121 # now. The partition layout is gonna look something like this: 122 # now. The partition layout is gonna look something like this:
122 # 123 #
123 # PMBR (512 bytes) 124 # PMBR (512 bytes)
124 # Primary GPT Header (512 bytes) 125 # Primary GPT Header (512 bytes)
125 # Primary GPT Table (16K) 126 # Primary GPT Table (16K)
126 # Kernel A partition 2 127 # Kernel A partition 2
127 # Kernel B partition 4 128 # Kernel B partition 4
(...skipping 24 matching lines...) Expand all
152 153
153 local num_pmbr_sectors=1 154 local num_pmbr_sectors=1
154 local num_gpt_hdr_sectors=1 155 local num_gpt_hdr_sectors=1
155 local num_gpt_table_sectors=32 # 16K 156 local num_gpt_table_sectors=32 # 16K
156 local num_footer_sectors=$(($num_gpt_hdr_sectors + $num_gpt_table_sectors)) 157 local num_footer_sectors=$(($num_gpt_hdr_sectors + $num_gpt_table_sectors))
157 local num_header_sectors=$(($num_pmbr_sectors + $num_footer_sectors)) 158 local num_header_sectors=$(($num_pmbr_sectors + $num_footer_sectors))
158 159
159 local start_useful=$(roundup $num_header_sectors) 160 local start_useful=$(roundup $num_header_sectors)
160 161
161 # What are we doing? 162 # What are we doing?
162 if [ -b $outdev ]; then 163 if [[ -b "$outdev" || "$force_full" = "true" ]]; then
163 # Block device, need to be root. 164 # Block device, need to be root.
164 local sudo=sudo 165 if [[ -b "$outdev" ]]; then
166 local sudo=sudo
167 else
168 local sudo=""
169 fi
165 170
166 # Full install, use max sizes and create both A & B images. 171 # Full install, use max sizes and create both A & B images.
167 NUM_KERN_SECTORS=$max_kern_sectors 172 NUM_KERN_SECTORS=$max_kern_sectors
168 NUM_ROOTFS_SECTORS=$max_rootfs_sectors 173 NUM_ROOTFS_SECTORS=$max_rootfs_sectors
169 NUM_RESERVED_SECTORS=$max_reserved_sectors 174 NUM_RESERVED_SECTORS=$max_reserved_sectors
170 175
171 # Where do things go? 176 # Where do things go?
172 START_KERN_A=$start_useful 177 START_KERN_A=$start_useful
173 START_KERN_B=$(($START_KERN_A + $NUM_KERN_SECTORS)) 178 START_KERN_B=$(($START_KERN_A + $NUM_KERN_SECTORS))
174 START_RESERVED=$(($START_KERN_B + $NUM_KERN_SECTORS)) 179 START_RESERVED=$(($START_KERN_B + $NUM_KERN_SECTORS))
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 # Args: DEVICE PARTNUM 309 # Args: DEVICE PARTNUM
305 # Returns: size (in sectors) of partition PARTNUM 310 # Returns: size (in sectors) of partition PARTNUM
306 partsize() { 311 partsize() {
307 # get string 312 # get string
308 local X=$(_partinfo $1 $2) 313 local X=$(_partinfo $1 $2)
309 # detect success or failure here 314 # detect success or failure here
310 [ -n "$X" ] 315 [ -n "$X" ]
311 echo ${X#* } 316 echo ${X#* }
312 } 317 }
313 318
OLDNEW
« no previous file with comments | « no previous file | src/platform/memento_softwareupdate/autoupdated_vm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698