Lines Matching +full:- +full:- +full:host
3 # Use of this source code is governed by a BSD-style license that can be
11 fix problems by updating or re-installing the firmware.
17 re-install firmware of current faft stable_version via servo
22 firmware that is out-of-date from the designated version. This model
23 also supplys `GeneralFirmwareRepair` to re-install firmware that
39 # pylint: disable=missing-docstring
59 # _FIRMWARE_REPAIR_POOLS - The set of pools that should be
69 def _is_firmware_testing_device(host): argument
71 check if a host is dedicated for firmware testing.
77 @return A true value if the host should use `FirmwareStatusVerifier`
80 info = host.host_info_store.get()
84 def _is_firmware_update_supported(host): argument
89 pool) need their firmware kept up-to-date with
95 @param host The host to be checked for update policy.
96 @return A true value if the host should use
99 return not _is_firmware_testing_device(host)
102 def _get_available_firmware(host, model): argument
105 @param host The host to get available firmware for.
109 result = host.run('chromeos-firmwareupdate --manifest', ignore_status=True)
114 # The manifest is a JSON in .model.host.versions.rw
117 key += '.host.versions.rw'
125 Verify that a host's firmware is in a good state.
129 appears that firmware should be re-flashed using servo.
133 def verify(self, host): argument
134 if not _is_firmware_testing_device(host):
142 'do flashrom -p host -r -i $section:$section; '
144 host.run(cmd)
147 cmd = ('vbutil_firmware --verify /tmp/verify_firmware/VBLOCK_%c'
148 ' --signpubkey /usr/share/vboot/devkeys/root_key.vbpubk'
149 ' --fv /tmp/verify_firmware/FW_MAIN_%c')
151 rv = host.run(cmd % (c, c), ignore_status=True)
157 host.run('rm -rf /tmp/verify_firmware')
174 def _get_faft_stable_build(self, host): argument
175 info = host.host_info_store.get()
178 def _get_os_stable_build(self, host): argument
180 return host.get_cros_repair_image_name()
182 def _run_faft_repair(self, host, build): argument
183 host.firmware_install(build)
185 def _run_general_repair(self, host, build): argument
190 if host._servo_host.validate_image_usbkey() != build:
194 ec_image, bios_image = host._servo_host.prepare_repair_firmware_image()
198 info = host.host_info_store.get()
209 if host.health_profile:
210 host.health_profile.set_firmware_stable_version(build)
214 host.servo.program_ec(ec_image, copy_image=False)
217 host._servo_host.flash_ap_firmware_via_servo(bios_image)
220 host.servo.get_power_state_controller().reset()
221 host.wait_up(timeout=host.BOOT_TIMEOUT)
224 host.run('/usr/share/vboot/bin/set_gbb_flags.sh 0', ignore_status=True)
225 host.run('crossystem disable_dev_request=1', ignore_status=True)
226 host.reboot()
234 def repair(self, host): argument
235 repair_utils.require_servo(host, ignore_state=True)
236 build = self._get_faft_stable_build(host)
238 self._run_faft_repair(host, build)
242 build = self._get_os_stable_build(host)
247 self._run_general_repair(host, build)
249 def _is_applicable(self, host): argument
250 return _is_firmware_testing_device(host)
254 return 'Re-install the stable firmware(faft) via servo'
258 """Reinstall the firmware for non-faft DUTs.
260 we want only try re-install firmware if all other RepairAction could
264 def repair(self, host): argument
265 repair_utils.require_servo(host, ignore_state=True)
266 build = self._get_os_stable_build(host)
271 self._run_general_repair(host, build)
273 def _is_applicable(self, host): argument
274 if _is_firmware_testing_device(host):
276 if not host.servo:
279 ' minimum requirement to flash firmware.', host.hostname)
283 dhp = host.health_profile
299 candidate_build = self._get_os_stable_build(host)
306 ' no need to retry.', flashed_build, host.hostname)
318 return 'Re-install the stable firmware(non-faft) via servo'
326 is up-to-date, or that the target firmware can be installed from the
339 firmware using `chromeos-firmwareupdate`. Failure to install will
349 out-of-band. But a firmware update will likely hit all DUTs at
353 the stable repair image. If the firmware is out-of-date, but the
359 def _get_rw_firmware(host): argument
360 result = host.run('crossystem fwid', ignore_status=True)
390 def _is_stable_image_installed(self, host): argument
391 """Verify that ChromeOS image on host is a stable version.
394 from installing the firmware from bad/broken/no-tested image. Bad
398 nocturne-release/R89-13728.0.0
399 Check compare version from host to version provide as stable image
400 from host-info file.
402 @param host CrosHost instance.
404 os_from_host = host.get_release_builder_path()
405 os_from_host_info = host.get_cros_repair_image_name()
413 def verify(self, host): argument
414 # Test 1 - The DUT is not excluded from updates.
415 if not _is_firmware_update_supported(host):
417 # Test 2 - The DUT has an assigned stable firmware version.
418 info = host.host_info_store.get()
437 # `chromeos-firmwareupdate` isn't what we expect, we log an
442 # Test 3 - The DUT is not running the target stable firmware.
443 current_firmware = self._get_rw_firmware(host)
450 # Test 4 - The firmware supplied in the running OS build is not
452 available_firmware = _get_available_firmware(host, info.model)
457 self._is_stable_image_installed(host)
467 host.run('chromeos-firmwareupdate --mode=autoupdate')
468 host.reboot()
470 message = ('chromeos-firmwareupdate failed: from '
475 final_firmware = self._get_rw_firmware(host)
477 message = ('chromeos-firmwareupdate failed: tried upgrade '
484 return 'The firmware on this DUT is up-to-date'