blob: dfcfc2cf402d5a315e8f24e4f21004758ce5083c [file] [log] [blame]
# Copyright 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Flash system main (AP) firmware to netboot firmware.
Sometimes in order to re-run factory flow, or to update partitions that can't be
updated by Chrome OS Factory Software (for example, the disk partition itself,
or release and test image rootfs), we may want to flash system firmware and
restart the process.
The `flash_netboot` test provides an easy way to flash netboot firmware into
system using `flashrom` utility, and preserving VPD sections.
Note that it doesn't reboot after flashing firmware. Please run reboot
step after it.
Test Procedure
This is an automated test without user interaction.
Start the test and it will reflash system firmware using specified image.
- Utility `flashrom` (
- System firmware is structured with FMAP.
- Chrome OS Verified Boot firmware utility 'futility'.
To flash netboot firmware in provided default location, add this in test list::
"pytest_name": "flash_netboot"
To flash netboot firmware from a special location::
"pytest_name": "flash_netboot",
"args": {
"image": "/usr/local/factory/3rdparty/netboot.bin"
import logging
import factory_common # pylint: disable=unused-import
from cros.factory.test import test_case
from cros.factory.test import test_ui
from import flash_netboot
from cros.factory.utils.arg_utils import Arg
class FlashNetbootTest(test_case.TestCase):
ARGS = [
Arg('image', str,
('Path of netboot firmware image. Default to use %s' %
ui_class = test_ui.ScrollableLogUI
def ShowResult(self, message):
def runTest(self):
netboot_flasher = flash_netboot.FlashNetboot(self.args.image,