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 signed kernel image | 7 # Helper script that generates the signed kernel image |
8 | 8 |
9 . "$(dirname "$0")/common.sh" | 9 . "$(dirname "$0")/common.sh" |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 "Verified boot error behavior [0: I/O errors, 1: reboot, 2: nothing] \ | 28 "Verified boot error behavior [0: I/O errors, 1: reboot, 2: nothing] \ |
29 (Default: 2)" | 29 (Default: 2)" |
30 DEFINE_integer verity_max_ios 1024 \ | 30 DEFINE_integer verity_max_ios 1024 \ |
31 "Optional number of outstanding I/O operations. (Default: 1024)" | 31 "Optional number of outstanding I/O operations. (Default: 1024)" |
32 | 32 |
33 # Parse flags | 33 # Parse flags |
34 FLAGS "$@" || exit 1 | 34 FLAGS "$@" || exit 1 |
35 eval set -- "${FLAGS_ARGV}" | 35 eval set -- "${FLAGS_ARGV}" |
36 set -e | 36 set -e |
37 | 37 |
| 38 # Only let dm-verity block if rootfs verification is configured. |
| 39 dev_wait=0 |
| 40 if [[ ${FLAGS_enable_rootfs_verification} -eq ${FLAGS_TRUE} ]]; then |
| 41 dev_wait=1 |
| 42 fi |
| 43 |
38 # Common kernel command-line args | 44 # Common kernel command-line args |
39 common_args="quiet console=tty2 init=/sbin/init boot=local rootwait ro noresume" | 45 common_args="quiet console=tty2 init=/sbin/init boot=local rootwait ro noresume" |
40 common_args="${common_args} noswap loglevel=1 ${FLAGS_boot_args}" | 46 common_args="${common_args} noswap loglevel=1 ${FLAGS_boot_args}" |
41 | 47 |
42 # Common verified boot command-line args | 48 # Common verified boot command-line args |
43 verity_common="dm_verity.error_behavior=${FLAGS_verity_error_behavior}" | 49 verity_common="dm_verity.error_behavior=${FLAGS_verity_error_behavior}" |
44 verity_common="${verity_common} dm_verity.max_bios=${FLAGS_verity_max_ios}" | 50 verity_common="${verity_common} dm_verity.max_bios=${FLAGS_verity_max_ios}" |
| 51 # Ensure that dm-verity waits for its device. |
| 52 # TODO(wad) should add a timeout that display a useful message |
| 53 verity_common="${verity_common} dm_verity.dev_wait=${dev_wait}" |
45 | 54 |
46 # Populate the x86 rootfs to support legacy and EFI bios config templates. | 55 # Populate the x86 rootfs to support legacy and EFI bios config templates. |
47 # The templates are used by the installer to populate partition 12 with | 56 # The templates are used by the installer to populate partition 12 with |
48 # the correct bootloader configuration. | 57 # the correct bootloader configuration. |
49 # While we transition to that model, extlinux.conf will still be used | 58 # While we transition to that model, extlinux.conf will still be used |
50 # on the root filesystem. | 59 # on the root filesystem. |
51 if [[ "${FLAGS_arch}" == "x86" ]]; then | 60 if [[ "${FLAGS_arch}" == "x86" ]]; then |
52 # Setup extlinux configuration. | 61 # Setup extlinux configuration. |
53 # TODO: For some reason the /dev/disk/by-uuid is not being generated by udev | 62 # TODO: For some reason the /dev/disk/by-uuid is not being generated by udev |
54 # in the initramfs. When we figure that out, switch to root=UUID=${UUID}. | 63 # in the initramfs. When we figure that out, switch to root=UUID=${UUID}. |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 EOF | 205 EOF |
197 if [[ ${FLAGS_enable_rootfs_verification} -eq ${FLAGS_TRUE} ]]; then | 206 if [[ ${FLAGS_enable_rootfs_verification} -eq ${FLAGS_TRUE} ]]; then |
198 sudo sed -i -e 's/^set default=.*/set default=2/' \ | 207 sudo sed -i -e 's/^set default=.*/set default=2/' \ |
199 "${FLAGS_to}/efi/boot/grub.cfg" | 208 "${FLAGS_to}/efi/boot/grub.cfg" |
200 fi | 209 fi |
201 info "Emitted ${FLAGS_to}/efi/boot/grub.cfg" | 210 info "Emitted ${FLAGS_to}/efi/boot/grub.cfg" |
202 exit 0 | 211 exit 0 |
203 fi | 212 fi |
204 | 213 |
205 info "The target platform does not use bootloader templates." | 214 info "The target platform does not use bootloader templates." |
OLD | NEW |