| OLD | NEW | 
|---|
| 1 #!/bin/sh | 1 #!/bin/sh | 
| 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 | 7 | 
| 8 # Used to determine whether to run the firmware updater in the critical path | 8 # Used to determine whether to run the firmware updater in the critical path | 
| 9 # (hence get_startup_update_tries() is not in chromeos-firmware-update) | 9 # (hence get_startup_update_tries() is not in chromeos-firmware-update) | 
| 10 get_startup_update_tries() { | 10 get_startup_update_tries() { | 
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 96 # DEVMODE is used to determine if we're booted in developer mode, | 96 # DEVMODE is used to determine if we're booted in developer mode, | 
| 97 # by checking only the developer and recovery switch states. | 97 # by checking only the developer and recovery switch states. | 
| 98 # Values: 0=recovery/non-dev mode, 1=dev (SSD) mode, 2=bypass devcheck | 98 # Values: 0=recovery/non-dev mode, 1=dev (SSD) mode, 2=bypass devcheck | 
| 99 crossystem devsw_boot?1 recoverysw_boot?0 | 99 crossystem devsw_boot?1 recoverysw_boot?0 | 
| 100 DEVMODE=$((! $?)) | 100 DEVMODE=$((! $?)) | 
| 101 | 101 | 
| 102 # Check if we need to perform firmware update. | 102 # Check if we need to perform firmware update. | 
| 103 FIRMWARE_UPDATE_SCRIPT='/usr/sbin/chromeos-firmwareupdate' | 103 FIRMWARE_UPDATE_SCRIPT='/usr/sbin/chromeos-firmwareupdate' | 
| 104 FIRMWARE_UPDATE_LOGS='/mnt/stateful_partition/var/log/update_firmware.log' | 104 FIRMWARE_UPDATE_LOGS='/mnt/stateful_partition/var/log/update_firmware.log' | 
| 105 if [ -x "$FIRMWARE_UPDATE_SCRIPT" ]; then | 105 if [ -x "$FIRMWARE_UPDATE_SCRIPT" ]; then | 
| 106   tries="$(get_startup_update_tries)" | 106   if [ "$(crossystem mainfw_type)" = developer ]; then | 
| 107   if [ $tries -gt 0 ]; then | 107     FIRMWARE_UPDATE_LOGS="/dev/tty1 $FIRMWARE_UPDATE_LOGS" | 
| 108     if [ "$DEVMODE" = "1" -o -f /root/.dev_mode ]; then | 108     "$FIRMWARE_UPDATE_SCRIPT" --mode=devstartup 2>&1 | | 
| 109       # More message on console for developer mode and dev builds | 109       tee $FIRMWARE_UPDATE_LOGS | 
| 110       FIRMWARE_UPDATE_LOGS="/dev/tty1 $FIRMWARE_UPDATE_LOGS" | 110   else | 
|  | 111     tries="$(get_startup_update_tries)" | 
|  | 112     if [ $tries -gt 0 ]; then | 
|  | 113       set_startup_update_tries $(( $tries - 1 )) | 
|  | 114 | 
|  | 115       if [ "$DEVMODE" = "1" -o -f /root/.dev_mode ]; then | 
|  | 116         # More message on console for developer mode and dev builds | 
|  | 117         FIRMWARE_UPDATE_LOGS="/dev/tty1 $FIRMWARE_UPDATE_LOGS" | 
|  | 118       fi | 
|  | 119       mkdir -p /mnt/stateful_partition/var/log | 
|  | 120       [ -z "$BOOT_SPLASH_PID" ] || wait $BOOT_SPLASH_PID | 
|  | 121       chromeos-boot-alert update_firmware /dev/tty1 | 
|  | 122 | 
|  | 123       "$FIRMWARE_UPDATE_SCRIPT" --mode=startup 2>&1 | | 
|  | 124         tee $FIRMWARE_UPDATE_LOGS | 
| 111     fi | 125     fi | 
| 112     mkdir -p /mnt/stateful_partition/var/log |  | 
| 113     [ -z "$BOOT_SPLASH_PID" ] || wait $BOOT_SPLASH_PID |  | 
| 114     chromeos-boot-alert update_firmware /dev/tty1 |  | 
| 115 |  | 
| 116     set_startup_update_tries $(( $tries - 1 )) |  | 
| 117 |  | 
| 118     "$FIRMWARE_UPDATE_SCRIPT" --mode=startup 2>&1 | |  | 
| 119       tee $FIRMWARE_UPDATE_LOGS |  | 
| 120   fi | 126   fi | 
| 121 fi | 127 fi | 
| 122 | 128 | 
| 123 # If we've switched from verified mode to developer mode, clobber the state. | 129 # If we've switched from verified mode to developer mode, clobber the state. | 
| 124 # The reverse is not possible to detect reliably, but we try. | 130 # The reverse is not possible to detect reliably, but we try. | 
| 125 # In addition, normal and unsupported are treated are equivalent otherwise | 131 # In addition, normal and unsupported are treated are equivalent otherwise | 
| 126 # booting the first time on a legacy device would clobber state for no reason. | 132 # booting the first time on a legacy device would clobber state for no reason. | 
| 127 # (NOTE, this will not be triggered in recovery mode.) | 133 # (NOTE, this will not be triggered in recovery mode.) | 
| 128 | 134 | 
| 129 # File used to trigger a stateful reset | 135 # File used to trigger a stateful reset | 
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 318 # | 324 # | 
| 319 ureadahead & | 325 ureadahead & | 
| 320 | 326 | 
| 321 # Some things freak out if no hostname is set. | 327 # Some things freak out if no hostname is set. | 
| 322 hostname localhost | 328 hostname localhost | 
| 323 | 329 | 
| 324 bootstat post-startup | 330 bootstat post-startup | 
| 325 | 331 | 
| 326 # Always return success to avoid killing init | 332 # Always return success to avoid killing init | 
| 327 exit 0 | 333 exit 0 | 
| OLD | NEW | 
|---|