| 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 . "$(dirname "$0")/common.sh" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 "${ESP_FS_DIR}" \ | 176 "${ESP_FS_DIR}" \ |
| 177 "${FLAGS_from}" | 177 "${FLAGS_from}" |
| 178 | 178 |
| 179 # Install the syslinux loader on the ESP image (part 12) so it is ready when | 179 # Install the syslinux loader on the ESP image (part 12) so it is ready when |
| 180 # we cut over from rootfs booting (extlinux). | 180 # we cut over from rootfs booting (extlinux). |
| 181 if [[ ${FLAGS_install_syslinux} -eq ${FLAGS_TRUE} ]]; then | 181 if [[ ${FLAGS_install_syslinux} -eq ${FLAGS_TRUE} ]]; then |
| 182 sudo umount "${ESP_FS_DIR}" | 182 sudo umount "${ESP_FS_DIR}" |
| 183 sudo syslinux -d /syslinux "${ESP_DEV}" | 183 sudo syslinux -d /syslinux "${ESP_DEV}" |
| 184 fi | 184 fi |
| 185 elif [[ "${FLAGS_arch}" = "arm" ]]; then | 185 elif [[ "${FLAGS_arch}" = "arm" ]]; then |
| 186 # Extract kernel flags | |
| 187 kernel_cfg= | |
| 188 old_root="sd%D%P" | |
| 189 if [[ -n "${FLAGS_kernel_cmdline}" ]]; then | |
| 190 info "Using supplied kernel_cmdline to update templates." | |
| 191 kernel_cfg="${FLAGS_kernel_cmdline}" | |
| 192 elif [[ -n "${FLAGS_kernel_partition}" ]]; then | |
| 193 info "Extracting the kernel command line from ${FLAGS_kernel_partition}" | |
| 194 kernel_cfg=$(dump_kernel_config "${kernel_partition}") | |
| 195 fi | |
| 196 dm_table= | |
| 197 if echo "$kernel_cfg" | grep -q 'dm="'; then | |
| 198 dm_table=$(echo "$kernel_cfg" | sed -s 's/.*dm="\([^"]*\)".*/\1/') | |
| 199 fi | |
| 200 # TODO(wad) assume usb_disk contains the arm boot location for now. | |
| 201 new_root="${FLAGS_usb_disk}" | |
| 202 info "Replacing dm slave devices with /dev/${new_root}" | |
| 203 dm_table="${dm_table//ROOT_DEV/\/dev\/${new_root}}" | |
| 204 dm_table="${dm_table//HASH_DEV/\/dev\/${new_root}}" | |
| 205 | |
| 206 warn "FIXME: cannot replace root= here for the arm bootloader yet." | |
| 207 dm_table="" # TODO(wad) Clear it until we can fix root=/dev/dm-0 | |
| 208 | |
| 209 # Copy u-boot script to ESP partition | 186 # Copy u-boot script to ESP partition |
| 210 if [ -r "${FLAGS_from}/boot-A.scr.uimg" ]; then | 187 if [ -r "${FLAGS_from}/boot-A.scr.uimg" ]; then |
| 211 sudo mkdir -p "${ESP_FS_DIR}/u-boot" | 188 sudo mkdir -p "${ESP_FS_DIR}/u-boot" |
| 212 sudo cp "${FLAGS_from}/boot-A.scr.uimg" \ | 189 sudo cp "${FLAGS_from}/boot-A.scr.uimg" \ |
| 213 "${ESP_FS_DIR}/u-boot/boot.scr.uimg" | 190 "${ESP_FS_DIR}/u-boot/boot.scr.uimg" |
| 214 fi | 191 fi |
| 215 fi | 192 fi |
| 216 | 193 |
| 217 set +e | 194 set +e |
| OLD | NEW |