| OLD | NEW |
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 | 2 |
| 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 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 # This script is called after an AutoUpdate or USB install. The first argument | 7 # This script is called after an AutoUpdate or USB install. The first argument |
| 8 # is the partition where the new rootfs is installed or empty. If non-empty | 8 # is the partition where the new rootfs is installed or empty. If non-empty |
| 9 # the rootfs should be updated w/ the new bootloader config. If empty, the | 9 # the rootfs should be updated w/ the new bootloader config. If empty, the |
| 10 # rootfs is mounted-read only and should not be updated. | 10 # rootfs is mounted-read only and should not be updated. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 update_firmware() { | 97 update_firmware() { |
| 98 # See if we need to update firmware. NOTE: we must activate new firmware | 98 # See if we need to update firmware. NOTE: we must activate new firmware |
| 99 # only after new kernel is actived (installed and made bootable), | 99 # only after new kernel is actived (installed and made bootable), |
| 100 # otherwise new firmware with all old kernels may lead to recovery screen | 100 # otherwise new firmware with all old kernels may lead to recovery screen |
| 101 # (due to new key). | 101 # (due to new key). |
| 102 FIRMWARE_UPDATE_SCRIPT="${INSTALL_ROOT}/usr/sbin/chromeos-firmwareupdate" | 102 FIRMWARE_UPDATE_SCRIPT="${INSTALL_ROOT}/usr/sbin/chromeos-firmwareupdate" |
| 103 if [ ${FLAGS_update_firmware} -eq "${FLAGS_TRUE}" -a \ | 103 if [ ${FLAGS_update_firmware} -eq "${FLAGS_TRUE}" -a \ |
| 104 -x "${FIRMWARE_UPDATE_SCRIPT}" ]; then | 104 -x "${FIRMWARE_UPDATE_SCRIPT}" ]; then |
| 105 FIRMWARE_UPDATE_MODE="" | 105 FIRMWARE_UPDATE_MODE="" |
| 106 if [ -n "${IS_FACTORY_INSTALL}" ]; then | 106 if [ -n "${IS_FACTORY_INSTALL}" ]; then |
| 107 # factory-mode | 107 # factory-mode (--force must be the first parameter when being invoked) |
| 108 FIRMWARE_UPDATE_MODE="--mode=factory_install" | 108 FIRMWARE_UPDATE_MODE="--force --mode=factory_install" |
| 109 elif [ -n "${IS_RECOVERY_INSTALL}" ]; then | 109 elif [ -n "${IS_RECOVERY_INSTALL}" ]; then |
| 110 # recovery-mode | 110 # recovery-mode |
| 111 FIRMWARE_UPDATE_MODE="--mode=recovery" | 111 FIRMWARE_UPDATE_MODE="--mode=recovery" |
| 112 elif [ -n "${IS_INSTALL}" ]; then | 112 elif [ -n "${IS_INSTALL}" ]; then |
| 113 # installation from chromeos-install | 113 # installation from chromeos-install |
| 114 FIRMWARE_UPDATE_MODE="--mode=recovery" | 114 FIRMWARE_UPDATE_MODE="--mode=recovery" |
| 115 else | 115 else |
| 116 # Default: background update by Update Engine. | 116 # Default: background update by Update Engine. |
| 117 # "--background-update" tells it not to perform any dangerous | 117 # "--background-update" tells it not to perform any dangerous |
| 118 # thing that would require/cause reboot, for example re-writing | 118 # thing that would require/cause reboot, for example re-writing |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 echo "marking part $LEGACY_PART_NUM bootable (new)" | 406 echo "marking part $LEGACY_PART_NUM bootable (new)" |
| 407 "${INSTALL_ROOT}"/usr/bin/cgpt boot -i $LEGACY_PART_NUM ${ROOT_DEV} 2>&1 | 407 "${INSTALL_ROOT}"/usr/bin/cgpt boot -i $LEGACY_PART_NUM ${ROOT_DEV} 2>&1 |
| 408 else | 408 else |
| 409 # The old gpt tool requires a -b arg to specify the PMBR bootcode. We don't | 409 # The old gpt tool requires a -b arg to specify the PMBR bootcode. We don't |
| 410 # want to change the code, so we have to extract it, then put it back. | 410 # want to change the code, so we have to extract it, then put it back. |
| 411 dd if=${ROOT_DEV} bs=512 count=1 of=/tmp/oldpmbr.bin | 411 dd if=${ROOT_DEV} bs=512 count=1 of=/tmp/oldpmbr.bin |
| 412 echo "marking part $LEGACY_PART_NUM bootable (old)" | 412 echo "marking part $LEGACY_PART_NUM bootable (old)" |
| 413 gpt -S boot -i $LEGACY_PART_NUM -b /tmp/oldpmbr.bin ${ROOT_DEV} 2>&1 | 413 gpt -S boot -i $LEGACY_PART_NUM -b /tmp/oldpmbr.bin ${ROOT_DEV} 2>&1 |
| 414 fi | 414 fi |
| 415 fi | 415 fi |
| OLD | NEW |