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

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

Issue 2440005: RootFS size customization params added (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: added check for rootfs size and its partition Created 10 years, 6 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/scripts/build_gpt.sh » ('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. NOTE: The 10 # Here are the GUIDs we'll be using to identify various partitions. NOTE: The
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 # START_STATEFUL 124 # START_STATEFUL
125 install_gpt() { 125 install_gpt() {
126 local outdev=$1 126 local outdev=$1
127 local rootfs_img=$2 127 local rootfs_img=$2
128 local kernel_img=$3 128 local kernel_img=$3
129 local stateful_img=$4 129 local stateful_img=$4
130 local pmbrcode=$5 130 local pmbrcode=$5
131 local esp_img=$6 131 local esp_img=$6
132 local force_full="${7:-}" 132 local force_full="${7:-}"
133 local recovery="${8:-}" 133 local recovery="${8:-}"
134 local rootfs_size="${9:-1024}" # 1G
134 135
135 # The gpt tool requires a fixed-size target to work on, so we may have to 136 # The gpt tool requires a fixed-size target to work on, so we may have to
136 # create a file of the appropriate size. Let's figure out what that size is 137 # create a file of the appropriate size. Let's figure out what that size is
137 # now. The full partition layout will look something like this (indented 138 # now. The full partition layout will look something like this (indented
138 # lines indicate reserved regions that do not have any useful content at the 139 # lines indicate reserved regions that do not have any useful content at the
139 # moment). 140 # moment).
140 # 141 #
141 # PMBR (512 bytes) 142 # PMBR (512 bytes)
142 # Primary GPT Header (512 bytes) 143 # Primary GPT Header (512 bytes)
143 # Primary GPT Table (16K) 144 # Primary GPT Table (16K)
(...skipping 19 matching lines...) Expand all
163 # an existing partition, 2) we want to be able to add new partitions later 164 # an existing partition, 2) we want to be able to add new partitions later
164 # without breaking current scripts, and 3) we may someday need to increase 165 # without breaking current scripts, and 3) we may someday need to increase
165 # the size of the rootfs during an upgrade, which means shrinking the size of 166 # the size of the rootfs during an upgrade, which means shrinking the size of
166 # the stateful partition on a live system. 167 # the stateful partition on a live system.
167 # 168 #
168 # The EFI GPT spec requires that all valid partitions be at least one sector 169 # The EFI GPT spec requires that all valid partitions be at least one sector
169 # in size, and non-overlapping. 170 # in size, and non-overlapping.
170 171
171 # Here are the size limits that we're currently requiring 172 # Here are the size limits that we're currently requiring
172 local max_kern_sectors=32768 # 16M 173 local max_kern_sectors=32768 # 16M
173 local max_rootfs_sectors=2097152 # 1G 174 local max_rootfs_sectors=$((${rootfs_size} * 2 * 1024)) # 1G by default
174 local max_oem_sectors=32768 # 16M 175 local max_oem_sectors=32768 # 16M
175 local max_reserved_sectors=131072 # 64M 176 local max_reserved_sectors=131072 # 64M
176 local max_esp_sectors=32768 # 16M 177 local max_esp_sectors=32768 # 16M
177 local min_stateful_sectors=262144 # 128M, expands to fill available space 178 local min_stateful_sectors=262144 # 128M, expands to fill available space
178 179
179 local num_pmbr_sectors=1 180 local num_pmbr_sectors=1
180 local num_gpt_hdr_sectors=1 181 local num_gpt_hdr_sectors=1
181 local num_gpt_table_sectors=32 # 16K 182 local num_gpt_table_sectors=32 # 16K
182 local num_footer_sectors=$(($num_gpt_hdr_sectors + $num_gpt_table_sectors)) 183 local num_footer_sectors=$(($num_gpt_hdr_sectors + $num_gpt_table_sectors))
183 local num_header_sectors=$(($num_pmbr_sectors + $num_footer_sectors)) 184 local num_header_sectors=$(($num_pmbr_sectors + $num_footer_sectors))
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 local dev_path=/sys/block/${1}/device 527 local dev_path=/sys/block/${1}/device
527 while [ -d "${dev_path}" -a "${dev_path}" != "/sys" ]; do 528 while [ -d "${dev_path}" -a "${dev_path}" != "/sys" ]; do
528 if [ -f "${dev_path}/${2}" ]; then 529 if [ -f "${dev_path}/${2}" ]; then
529 cat "${dev_path}/${2}" 530 cat "${dev_path}/${2}"
530 return 531 return
531 fi 532 fi
532 dev_path=$(readlink -f ${dev_path}/..) 533 dev_path=$(readlink -f ${dev_path}/..)
533 done 534 done
534 echo '[Unknown]' 535 echo '[Unknown]'
535 } 536 }
OLDNEW
« no previous file with comments | « no previous file | src/scripts/build_gpt.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698