| OLD | NEW |
| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 # START_STATEFUL | 119 # START_STATEFUL |
| 120 install_gpt() { | 120 install_gpt() { |
| 121 local outdev=$1 | 121 local outdev=$1 |
| 122 local rootfs_img_sectors=$2 | 122 local rootfs_img_sectors=$2 |
| 123 local stateful_img_sectors=$3 | 123 local stateful_img_sectors=$3 |
| 124 local pmbrcode=$4 | 124 local pmbrcode=$4 |
| 125 local esp_img_sectors=$5 | 125 local esp_img_sectors=$5 |
| 126 local force_full="${6:-}" | 126 local force_full="${6:-}" |
| 127 local rootfs_default_size=2048 # 2GiB | 127 local rootfs_default_size=2048 # 2GiB |
| 128 local rootfs_size="${7:-$rootfs_default_size}" | 128 local rootfs_size="${7:-$rootfs_default_size}" |
| 129 local large_test_partitions="${8:-false}" | 129 local large_test_partitions="${8:-${FLAGS_FALSE}}" |
| 130 | 130 |
| 131 if [ "$rootfs_size" = "default" ]; then | 131 if [ "$rootfs_size" = "default" ]; then |
| 132 rootfs_size=$rootfs_default_size | 132 rootfs_size=$rootfs_default_size |
| 133 fi | 133 fi |
| 134 | 134 |
| 135 # The gpt tool requires a fixed-size target to work on, so we may have to | 135 # 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 | 136 # 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 | 137 # 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 | 138 # lines indicate reserved regions that do not have any useful content at the |
| 139 # moment). | 139 # moment). |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 local dev_path=/sys/block/${1}/device | 444 local dev_path=/sys/block/${1}/device |
| 445 while [ -d "${dev_path}" -a "${dev_path}" != "/sys" ]; do | 445 while [ -d "${dev_path}" -a "${dev_path}" != "/sys" ]; do |
| 446 if [ -f "${dev_path}/${2}" ]; then | 446 if [ -f "${dev_path}/${2}" ]; then |
| 447 cat "${dev_path}/${2}" | 447 cat "${dev_path}/${2}" |
| 448 return | 448 return |
| 449 fi | 449 fi |
| 450 dev_path=$(readlink -f ${dev_path}/..) | 450 dev_path=$(readlink -f ${dev_path}/..) |
| 451 done | 451 done |
| 452 echo '[Unknown]' | 452 echo '[Unknown]' |
| 453 } | 453 } |
| OLD | NEW |