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

Side by Side Diff: chromeos-common.sh

Issue 3054041: Use max-size kernel partition on USB image, too. (Closed) Base URL: ssh://gitrw.chromium.org/installer.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
« no previous file with comments | « no previous file | 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
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 # The GPT tables describe things in terms of 512-byte sectors, but some 10 # The GPT tables describe things in terms of 512-byte sectors, but some
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 # an existing partition, 2) we want to be able to add new partitions later 152 # an existing partition, 2) we want to be able to add new partitions later
153 # without breaking current scripts, and 3) we may someday need to increase 153 # without breaking current scripts, and 3) we may someday need to increase
154 # the size of the rootfs during an upgrade, which means shrinking the size of 154 # the size of the rootfs during an upgrade, which means shrinking the size of
155 # the stateful partition on a live system. 155 # the stateful partition on a live system.
156 # 156 #
157 # The EFI GPT spec requires that all valid partitions be at least one sector 157 # The EFI GPT spec requires that all valid partitions be at least one sector
158 # in size, and non-overlapping. 158 # in size, and non-overlapping.
159 159
160 # Here are the size limits that we're currently requiring 160 # Here are the size limits that we're currently requiring
161 local max_kern_sectors=32768 # 16M 161 local max_kern_sectors=32768 # 16M
162 # Verified boot adds 64KB of .vblock at the beginning of
163 # the kernel and ~20KB at the end. Add some padding to handle this.
164 local num_vboot_sectors=512 # 256K
165 local max_rootfs_sectors=$((${rootfs_size} * 2 * 1024)) # 1G by default 162 local max_rootfs_sectors=$((${rootfs_size} * 2 * 1024)) # 1G by default
166 local max_oem_sectors=32768 # 16M 163 local max_oem_sectors=32768 # 16M
167 local max_reserved_sectors=131072 # 64M 164 local max_reserved_sectors=131072 # 64M
168 local max_esp_sectors=32768 # 16M 165 local max_esp_sectors=32768 # 16M
169 local min_stateful_sectors=262144 # 128M, expands to fill available space 166 local min_stateful_sectors=262144 # 128M, expands to fill available space
170 167
171 local num_pmbr_sectors=1 168 local num_pmbr_sectors=1
172 local num_gpt_hdr_sectors=1 169 local num_gpt_hdr_sectors=1
173 local num_gpt_table_sectors=32 # 16K 170 local num_gpt_table_sectors=32 # 16K
174 local num_footer_sectors=$(($num_gpt_hdr_sectors + $num_gpt_table_sectors)) 171 local num_footer_sectors=$(($num_gpt_hdr_sectors + $num_gpt_table_sectors))
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 NUM_STATEFUL_SECTORS=$(($START_ROOTFS_B - $START_STATEFUL)) 228 NUM_STATEFUL_SECTORS=$(($START_ROOTFS_B - $START_STATEFUL))
232 else 229 else
233 # Just a local file. 230 # Just a local file.
234 local sudo= 231 local sudo=
235 232
236 # We're just going to fill partitions 1, 2, 3, 8, and 12. The others will 233 # We're just going to fill partitions 1, 2, 3, 8, and 12. The others will
237 # be present but as small as possible. The disk layout isn't crucial here, 234 # be present but as small as possible. The disk layout isn't crucial here,
238 # because we won't be able to upgrade this image in-place as it's only for 235 # because we won't be able to upgrade this image in-place as it's only for
239 # installation purposes. 236 # installation purposes.
240 NUM_STATEFUL_SECTORS=$(roundup $(numsectors $stateful_img)) 237 NUM_STATEFUL_SECTORS=$(roundup $(numsectors $stateful_img))
241 # Need to make room for kernel, key, preamble, added by key management. 238 NUM_KERN_SECTORS=$max_kern_sectors
242 NUM_KERN_SECTORS=$(roundup \
243 $(($num_vboot_sectors + $(numsectors $kernel_img))))
244 local num_kern_a_sectors=$NUM_KERN_SECTORS 239 local num_kern_a_sectors=$NUM_KERN_SECTORS
245 local kern_a_priority=15 240 local kern_a_priority=15
246 local num_kern_b_sectors=1 241 local num_kern_b_sectors=1
247 local kern_b_priority=0 242 local kern_b_priority=0
248 NUM_ROOTFS_SECTORS=$(roundup $(numsectors $rootfs_img)) 243 NUM_ROOTFS_SECTORS=$(roundup $(numsectors $rootfs_img))
249 local num_rootfs_a_sectors=$NUM_ROOTFS_SECTORS 244 local num_rootfs_a_sectors=$NUM_ROOTFS_SECTORS
250 local num_rootfs_b_sectors=1 245 local num_rootfs_b_sectors=1
251 NUM_OEM_SECTORS=$max_oem_sectors 246 NUM_OEM_SECTORS=$max_oem_sectors
252 NUM_ESP_SECTORS=$(roundup $(numsectors $esp_img)) 247 NUM_ESP_SECTORS=$(roundup $(numsectors $esp_img))
253 NUM_RESERVED_SECTORS=1 248 NUM_RESERVED_SECTORS=1
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 local dev_path=/sys/block/${1}/device 460 local dev_path=/sys/block/${1}/device
466 while [ -d "${dev_path}" -a "${dev_path}" != "/sys" ]; do 461 while [ -d "${dev_path}" -a "${dev_path}" != "/sys" ]; do
467 if [ -f "${dev_path}/${2}" ]; then 462 if [ -f "${dev_path}/${2}" ]; then
468 cat "${dev_path}/${2}" 463 cat "${dev_path}/${2}"
469 return 464 return
470 fi 465 fi
471 dev_path=$(readlink -f ${dev_path}/..) 466 dev_path=$(readlink -f ${dev_path}/..)
472 done 467 done
473 echo '[Unknown]' 468 echo '[Unknown]'
474 } 469 }
OLDNEW
« 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