| OLD | NEW |
| 1 #!/bin/sh -u | 1 #!/bin/sh -u |
| 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 # | 5 # |
| 6 # A script to install from removable media to hard disk. | 6 # A script to install from removable media to hard disk. |
| 7 | 7 |
| 8 # Load functions and constants for chromeos-install. | 8 # Load functions and constants for chromeos-install. |
| 9 . "$(dirname "$0")/chromeos-common.sh" || exit 1 | 9 . "$(dirname "$0")/chromeos-common.sh" || exit 1 |
| 10 . /usr/lib/shflags || exit 1 | 10 . /usr/lib/shflags || exit 1 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 sync | 177 sync |
| 178 } | 178 } |
| 179 | 179 |
| 180 ############################################################################## | 180 ############################################################################## |
| 181 | 181 |
| 182 # What do we expect & require to have on the source device? | 182 # What do we expect & require to have on the source device? |
| 183 STATEFUL_IMG=${SRC}1 | 183 STATEFUL_IMG=${SRC}1 |
| 184 KERNEL_IMG=${SRC}2 | 184 KERNEL_IMG=${SRC}2 |
| 185 ROOTFS_IMG=${SRC}3 | 185 ROOTFS_IMG=${SRC}3 |
| 186 ESP_IMG=${SRC}4 |
| 186 | 187 |
| 187 # Steal the PMBR code from the source MBR to put on the dest MBR, for booting | 188 # Steal the PMBR code from the source MBR to put on the dest MBR, for booting |
| 188 # on legacy-BIOS devices. | 189 # on legacy-BIOS devices. |
| 189 sudo dd if=$SRC of=$PMBRCODE bs=512 count=1 | 190 sudo dd if=$SRC of=$PMBRCODE bs=512 count=1 |
| 190 | 191 |
| 191 # Create the GPT. | 192 # Create the GPT. |
| 192 install_gpt $FLAGS_dst $ROOTFS_IMG $KERNEL_IMG $STATEFUL_IMG $PMBRCODE | 193 install_gpt $FLAGS_dst $ROOTFS_IMG $KERNEL_IMG $STATEFUL_IMG $PMBRCODE $ESP_IMG |
| 193 | 194 |
| 194 if [ "$FLAGS_skip_rootfs" -eq "$FLAGS_TRUE" ]; then | 195 if [ "$FLAGS_skip_rootfs" -eq "$FLAGS_TRUE" ]; then |
| 195 echo Done installing partitons. | 196 echo Done installing partitons. |
| 196 exit 0 | 197 exit 0 |
| 197 fi | 198 fi |
| 198 | 199 |
| 199 # Install the content. | 200 # Install the content. |
| 200 echo "Copying kernel..." | 201 echo "Copying kernel..." |
| 201 sudo dd if=${KERNEL_IMG} of=${FLAGS_dst} conv=notrunc bs=512 \ | 202 sudo dd if=${KERNEL_IMG} of=${FLAGS_dst} conv=notrunc bs=512 \ |
| 202 seek=${START_KERN_A} | 203 seek=${START_KERN_A} |
| 203 sudo dd if=${KERNEL_IMG} of=${FLAGS_dst} conv=notrunc bs=512 \ | 204 sudo dd if=${KERNEL_IMG} of=${FLAGS_dst} conv=notrunc bs=512 \ |
| 204 seek=${START_KERN_B} | 205 seek=${START_KERN_B} |
| 205 | 206 |
| 206 echo "Copying rootfs..." | 207 echo "Copying rootfs..." |
| 207 install_rootfs ${ROOTFS_IMG} ${FLAGS_dst} ${START_ROOTFS_A} "H-ROOT-A" | 208 install_rootfs ${ROOTFS_IMG} ${FLAGS_dst} ${START_ROOTFS_A} "H-ROOT-A" |
| 208 install_rootfs ${ROOTFS_IMG} ${FLAGS_dst} ${START_ROOTFS_B} "H-ROOT-B" | 209 install_rootfs ${ROOTFS_IMG} ${FLAGS_dst} ${START_ROOTFS_B} "H-ROOT-B" |
| 209 | 210 |
| 211 echo "Copying ESP..." |
| 212 sudo dd if=${ESP_IMG} of=${DST} conv=notrunc bs=512 seek=${START_ESP} |
| 213 |
| 210 # We can't guarantee that the kernel will see the new partition table, so we | 214 # We can't guarantee that the kernel will see the new partition table, so we |
| 211 # can't use it directly. We could force the kernel to reload it with an ioctl, | 215 # can't use it directly. We could force the kernel to reload it with an ioctl, |
| 212 # but then we might have the UI mounting and displaying any old filesystems | 216 # but then we might have the UI mounting and displaying any old filesystems |
| 213 # left over from the last install, and we don't want that either. So any access | 217 # left over from the last install, and we don't want that either. So any access |
| 214 # that we need to do to the destination partitions will have to go through loop | 218 # that we need to do to the destination partitions will have to go through loop |
| 215 # devices. | 219 # devices. |
| 216 | 220 |
| 217 # Now run the postinstall script in each new rootfs. Note that even though | 221 # Now run the postinstall script in each new rootfs. Note that even though |
| 218 # we're passing the new destination partition number as an arg, the postinst | 222 # we're passing the new destination partition number as an arg, the postinst |
| 219 # script had better not try to access it, for the reasons we just gave. | 223 # script had better not try to access it, for the reasons we just gave. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 loop_offset_cleanup | 259 loop_offset_cleanup |
| 256 trap - EXIT | 260 trap - EXIT |
| 257 | 261 |
| 258 # Force data to disk before we declare done. | 262 # Force data to disk before we declare done. |
| 259 sync | 263 sync |
| 260 | 264 |
| 261 echo "------------------------------------------------------------" | 265 echo "------------------------------------------------------------" |
| 262 echo "" | 266 echo "" |
| 263 echo "Installation to '$FLAGS_dst' complete." | 267 echo "Installation to '$FLAGS_dst' complete." |
| 264 echo "Please shutdown, remove the USB device, cross your fingers, and reboot." | 268 echo "Please shutdown, remove the USB device, cross your fingers, and reboot." |
| OLD | NEW |