OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 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 | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # Helper script that generates the legacy/efi bootloader partitions. | 7 # Helper script that generates the legacy/efi bootloader partitions. |
8 # It does not populate the templates, but can update a loop device. | 8 # It does not populate the templates, but can update a loop device. |
9 | 9 |
10 . "$(dirname "$0")/common.sh" | 10 # --- BEGIN COMMON.SH BOILERPLATE --- |
11 . "$(dirname "$0")/chromeos-common.sh" # installer | 11 # Load common CrOS utilities. Inside the chroot this file is installed in |
| 12 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
| 13 # location. |
| 14 find_common_sh() { |
| 15 local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")")) |
| 16 local path |
| 17 |
| 18 SCRIPT_ROOT= |
| 19 for path in "${common_paths[@]}"; do |
| 20 if [ -r "${path}/common.sh" ]; then |
| 21 SCRIPT_ROOT=${path} |
| 22 break |
| 23 fi |
| 24 done |
| 25 } |
| 26 |
| 27 find_common_sh |
| 28 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
| 29 # --- END COMMON.SH BOILERPLATE --- |
| 30 |
| 31 # Need to be inside the chroot to load chromeos-common.sh |
| 32 assert_inside_chroot |
| 33 |
| 34 # Load functions and constants for chromeos-install |
| 35 . "/usr/lib/installer/chromeos-common.sh" || \ |
| 36 die "Unable to load /usr/lib/installer/chromeos-common.sh" |
12 | 37 |
13 get_default_board | 38 get_default_board |
14 | 39 |
15 # Flags. | 40 # Flags. |
16 DEFINE_string arch "x86" \ | 41 DEFINE_string arch "x86" \ |
17 "The boot architecture: arm or x86. (Default: x86)" | 42 "The boot architecture: arm or x86. (Default: x86)" |
18 # TODO(wad) once extlinux is dead, we can remove this. | 43 # TODO(wad) once extlinux is dead, we can remove this. |
19 DEFINE_boolean install_syslinux ${FLAGS_FALSE} \ | 44 DEFINE_boolean install_syslinux ${FLAGS_FALSE} \ |
20 "Controls whether syslinux is run on 'to'. (Default: false)" | 45 "Controls whether syslinux is run on 'to'. (Default: false)" |
21 DEFINE_string from "/tmp/boot" \ | 46 DEFINE_string from "/tmp/boot" \ |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 elif [[ "${FLAGS_arch}" = "arm" ]]; then | 211 elif [[ "${FLAGS_arch}" = "arm" ]]; then |
187 # Copy u-boot script to ESP partition | 212 # Copy u-boot script to ESP partition |
188 if [ -r "${FLAGS_from}/boot-A.scr.uimg" ]; then | 213 if [ -r "${FLAGS_from}/boot-A.scr.uimg" ]; then |
189 sudo mkdir -p "${ESP_FS_DIR}/u-boot" | 214 sudo mkdir -p "${ESP_FS_DIR}/u-boot" |
190 sudo cp "${FLAGS_from}/boot-A.scr.uimg" \ | 215 sudo cp "${FLAGS_from}/boot-A.scr.uimg" \ |
191 "${ESP_FS_DIR}/u-boot/boot.scr.uimg" | 216 "${ESP_FS_DIR}/u-boot/boot.scr.uimg" |
192 fi | 217 fi |
193 fi | 218 fi |
194 | 219 |
195 set +e | 220 set +e |
OLD | NEW |