| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 # Rewrite grub table | 66 # Rewrite grub table |
| 67 grub_dm_table_a=${dm_table//${old_root}/\$linuxpartA} | 67 grub_dm_table_a=${dm_table//${old_root}/\$linuxpartA} |
| 68 grub_dm_table_b=${dm_table//${old_root}/\$linuxpartB} | 68 grub_dm_table_b=${dm_table//${old_root}/\$linuxpartB} |
| 69 sed -e "s|DMTABLEA|${grub_dm_table_a}|g" \ | 69 sed -e "s|DMTABLEA|${grub_dm_table_a}|g" \ |
| 70 -e "s|DMTABLEB|${grub_dm_table_b}|g" \ | 70 -e "s|DMTABLEB|${grub_dm_table_b}|g" \ |
| 71 "${template_dir}"/efi/boot/grub.cfg | | 71 "${template_dir}"/efi/boot/grub.cfg | |
| 72 sudo dd of="${esp_fs_dir}"/efi/boot/grub.cfg | 72 sudo dd of="${esp_fs_dir}"/efi/boot/grub.cfg |
| 73 | 73 |
| 74 # Rewrite syslinux DM_TABLE | 74 # Rewrite syslinux DM_TABLE |
| 75 usb_target="${FLAGS_usb_disk//\//\\\/}" | 75 syslinux_dm_table_usb=${dm_table//\/dev\/${old_root}/${FLAGS_usb_disk}} |
| 76 syslinux_dm_table_usb=${dm_table//\/dev\/${old_root}/${usb_target}} | |
| 77 sed -e "s|DMTABLEA|${syslinux_dm_table_usb}|g" \ | 76 sed -e "s|DMTABLEA|${syslinux_dm_table_usb}|g" \ |
| 78 "${template_dir}"/syslinux/usb.A.cfg | | 77 "${template_dir}"/syslinux/usb.A.cfg | |
| 79 sudo dd of="${esp_fs_dir}"/syslinux/usb.A.cfg | 78 sudo dd of="${esp_fs_dir}"/syslinux/usb.A.cfg |
| 80 | 79 |
| 81 syslinux_dm_table_a=${dm_table//\/dev\/${old_root}/HDROOTA} | 80 syslinux_dm_table_a=${dm_table//\/dev\/${old_root}/HDROOTA} |
| 82 sed -e "s|DMTABLEA|${syslinux_dm_table_a}|g" \ | 81 sed -e "s|DMTABLEA|${syslinux_dm_table_a}|g" \ |
| 83 "${template_dir}"/syslinux/root.A.cfg | | 82 "${template_dir}"/syslinux/root.A.cfg | |
| 84 sudo dd of="${esp_fs_dir}"/syslinux/root.A.cfg | 83 sudo dd of="${esp_fs_dir}"/syslinux/root.A.cfg |
| 85 | 84 |
| 86 syslinux_dm_table_b=${dm_table//\/dev\/${old_root}/HDROOTB} | 85 syslinux_dm_table_b=${dm_table//\/dev\/${old_root}/HDROOTB} |
| 87 sed -e "s|DMTABLEA|${syslinux_dm_table_a}|g" \ | 86 sed -e "s|DMTABLEB|${syslinux_dm_table_b}|g" \ |
| 88 "${template_dir}"/syslinux/root.B.cfg | | 87 "${template_dir}"/syslinux/root.B.cfg | |
| 89 sudo dd of="${esp_fs_dir}"/syslinux/root.B.cfg | 88 sudo dd of="${esp_fs_dir}"/syslinux/root.B.cfg |
| 90 | 89 |
| 91 # Copy the vmlinuz's into place for syslinux | 90 # Copy the vmlinuz's into place for syslinux |
| 92 sudo cp -f "${template_dir}"/vmlinuz "${esp_fs_dir}"/syslinux/vmlinuz.A | 91 sudo cp -f "${template_dir}"/vmlinuz "${esp_fs_dir}"/syslinux/vmlinuz.A |
| 93 sudo cp -f "${template_dir}"/vmlinuz "${esp_fs_dir}"/syslinux/vmlinuz.B | 92 sudo cp -f "${template_dir}"/vmlinuz "${esp_fs_dir}"/syslinux/vmlinuz.B |
| 94 | 93 |
| 95 # The only work left for the installer is to pick the correct defaults | 94 # The only work left for the installer is to pick the correct defaults |
| 96 # and replace HDROOTA and HDROOTB with the correct /dev/sd%D%P. | 95 # and replace HDROOTA and HDROOTB with the correct /dev/sd%D%P. |
| 97 } | 96 } |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 ${FLAGS_kernel_partition_offset} \ | 211 ${FLAGS_kernel_partition_offset} \ |
| 213 ${FLAGS_kernel_partition_sectors} \ | 212 ${FLAGS_kernel_partition_sectors} \ |
| 214 ${device} \ | 213 ${device} \ |
| 215 "'dm=\"${dm_table}\"'") | 214 "'dm=\"${dm_table}\"'") |
| 216 sudo dd bs=1 count=`stat --printf="%s" ${MBR_SCRIPT_UIMG}` \ | 215 sudo dd bs=1 count=`stat --printf="%s" ${MBR_SCRIPT_UIMG}` \ |
| 217 if="$MBR_SCRIPT_UIMG" of=${FLAGS_to} | 216 if="$MBR_SCRIPT_UIMG" of=${FLAGS_to} |
| 218 info "Emitted new ARM MBR to ${FLAGS_to}" | 217 info "Emitted new ARM MBR to ${FLAGS_to}" |
| 219 fi | 218 fi |
| 220 | 219 |
| 221 set +e | 220 set +e |
| OLD | NEW |