Documentation
¶
Overview ¶
Package firmware implements logic to update firmware for chromeOS devices.
Index ¶
- Constants
- func DisableSoftwareWriteProtectionByServo(ctx context.Context, run components.Runner, servoPort int, ...) error
- func DisableWriteProtect(ctx context.Context, run components.Runner, log logger.Logger, ...) error
- func InstallFirmwareImage(ctx context.Context, req *InstallFirmwareImageRequest, log logger.Logger) error
- func IsDevKeys(keys []string, log logger.Logger) bool
- func IsMultiFirmwareHwid(hwid string) bool
- func ReadConfigYAML(ctx context.Context, model string, run components.Runner, log logger.Logger) (ecTarget string, apTarget string, err error)
- func ReadFirmwareKeysFromHost(ctx context.Context, run components.Runner, log logger.Logger) ([]string, error)
- func ReadFirmwareManifestKeyFromCrosID(ctx context.Context, run components.Runner) (string, error)
- func ReadGBBByServo(ctx context.Context, timeout time.Duration, run components.Runner, ...) (string, error)
- func ReadSkuKeyFromCrosID(ctx context.Context, run components.Runner) (string, error)
- func RunFirmwareUpdater(ctx context.Context, req *FirmwareUpdaterRequest, run components.Runner, ...) error
- func SetGBBByServo(ctx context.Context, gbb string, timeout time.Duration, run components.Runner, ...) error
- type FirmwareUpdaterRequest
- type InstallFirmwareImageRequest
- type Programmer
Constants ¶
const (
DevSignedFirmwareKeyPrefix = "b11d"
)
Variables ¶
This section is empty.
Functions ¶
func DisableSoftwareWriteProtectionByServo ¶
func DisableSoftwareWriteProtectionByServo(ctx context.Context, run components.Runner, servoPort int, runTimeout time.Duration) error
DisableSoftwareWriteProtectionByServo disable software write protection through servo.
func DisableWriteProtect ¶
func DisableWriteProtect(ctx context.Context, run components.Runner, log logger.Logger, timeout time.Duration, fprom string) error
DisableWriteProtect disables software-controlled write-protect for both FPROMs, and install the RO firmware
func InstallFirmwareImage ¶
func InstallFirmwareImage(ctx context.Context, req *InstallFirmwareImageRequest, log logger.Logger) error
InstallFirmwareImage updates a specific AP or/and EC firmware image on the DUT.
func IsMultiFirmwareHwid ¶
IsMultiFirmwareHwid determines if a given hwid maps to multi-firmware use case by check key existence in targetOverridebyHwid map.
func ReadConfigYAML ¶
func ReadConfigYAML(ctx context.Context, model string, run components.Runner, log logger.Logger) (ecTarget string, apTarget string, err error)
ReadConfigYAML read EC/AP fw targets from yaml file on the DUT.
Copy from http://cs/search?q=ReadConfigYAML%20file:cros-fw-provision&sq=
func ReadFirmwareKeysFromHost ¶
func ReadFirmwareKeysFromHost(ctx context.Context, run components.Runner, log logger.Logger) ([]string, error)
ReadFirmwareKeysFromHost read AP keys from the host.
func ReadFirmwareManifestKeyFromCrosID ¶
ReadFirmwareManifestKeyFromCrosID read FIRMWARE_MANIFEST_KEY of crosid output from the DUT.
func ReadGBBByServo ¶
func ReadGBBByServo(ctx context.Context, timeout time.Duration, run components.Runner, servod components.Servod) (string, error)
ReadGBBByServo read GBB flags from DUT.
func ReadSkuKeyFromCrosID ¶
ReadSkuKeyFromCrosID read SKU of crosid output from the DUT.
func RunFirmwareUpdater ¶
func RunFirmwareUpdater(ctx context.Context, req *FirmwareUpdaterRequest, run components.Runner, log logger.Logger) error
RunFirmwareUpdater run chromeos-firmwareupdate to update firmware on the host.
func SetGBBByServo ¶
func SetGBBByServo(ctx context.Context, gbb string, timeout time.Duration, run components.Runner, servod components.Servod) error
SetGBBByServo updates GBB flags on DUT.
GBB expected in the format of 0x18 or 0x0.
Types ¶
type FirmwareUpdaterRequest ¶
type FirmwareUpdaterRequest struct { // Mode used for updater. // Possible values is: autoupdate, recovery, factory. Mode string // Run updater with force option. Force bool // Time Specified to run firmware updater. UpdaterTimeout time.Duration // AP firmware image (image.bin). If provided firmware updater will use this image // instead of OS bundled firmware. Cannot be used together with FirmwareArchive. ApImage string // EC firmware image (i.e, ec.bin). If provided firmware updater will use this image // instead of OS bundled firmware. Cannot be used together with FirmwareArchive. EcImage string // Firmware archive path. If provided firmware updater extract and use AP and EC image // from the archieve. Cannot be used together with ApImage or EcImage. FirmwareArchive string // If provided it will override firmware target model, see --model option of chromeos-firmwareupdate. Model string // If update should proceed with write protection flag on, means "--wp=1". WriteProtection bool }
FirmwareUpdaterRequest holds request data for running firmware updater.
type InstallFirmwareImageRequest ¶
type InstallFirmwareImageRequest struct { // Board and model of the DUT. Board string Model string // Firmware targets from inventory. // Use this target first if provided. APTarget string ECTarget string // Hwid of the DUT. Hwid string // Dir where we download the fw image file and then extracted. DownloadDir string // Path to the fw-Image file and timeout to download it. DownloadImagePath string DownloadImageTimeout time.Duration // Indicates if --force flag should be specified when invoke chromeos-firmwareupdate or AP programmer. ForceUpdate bool // Specify how many time to attempt when update EC, where 0 means don't not update EC firmware. // Please note attempt count more than 1 only applies when flash via servo. // When recover a DUT from corrupted EC use servo, there may be flakiness and we may need flash a couple of times to get a success. UpdateEcAttemptCount int // Provide board when flash EC. // The system is detecting the board using either the file candidate path or the DUT model. UpdateEcUseBoard bool // Specify how many time to attempt when update AP, where 0 means don't not update AP firmware. // Please note attempt count more than 1 only applies when flash via servo. // When recover a DUT from corrupted AP use servo, there may be flakiness and we may need flash a couple of times to get a success. UpdateApAttemptCount int // GBB flags value need to be set to AP. // Example: 0x18 GBBFlags string // Custom image-name uses when specify image candidate for extracted file. CandidateFirmwareTarget string // Use serial targets when specify image candidates. UseSerialTargets bool // Flash firmware via servo if true, otherwise flash firmware on DUT itself use chromeos-firmwareupdate. FlashThroughServo bool // Use cache extractor to download firmware files. UseCacheToExtractor bool // Runner to execute command on the DUT side. DutRunner components.Runner // Runner to execute command on the servohost. ServoHostRunner components.Runner // servod instance will be used to collect firmware target info and/or flash image. Servod components.Servod // Indicates --mode flag used for chromeos-firwmareupdate, only has effect when flash on the DUT side. // Possible values is: autoupdate, recovery, factory. UpdaterMode string // Timeout value for run firmware updater on the DUT, only has effect when flash on the DUT side. UpdaterTimeout time.Duration // The number of times that the download will be re-attempted // after it has failed once, e.g. due to HTTP 500 errors. DownloadImageReattemptCount int // The wait time before re-attempting the download. DownloadImageReattemptWait time.Duration }
InstallFirmwareImageRequest holds info for InstallFirmwareImage method to flash EC/AP on the DUT.
type Programmer ¶
type Programmer interface { // Prepare programmer for actions. Prepare(ctx context.Context) error // ProgramEC programs EC firmware to devices by servo. ProgramEC(ctx context.Context, fwBoard, imagePath string) error // ProgramAP programs AP firmware to devices by servo. ProgramAP(ctx context.Context, imagePath, gbbHex string, force bool) error // Close closes programming resources. Close(ctx context.Context) error }
Programmer represent interface to flash EC/AP to the ChromeOS devices by servo.
func NewProgrammer ¶
func NewProgrammer(ctx context.Context, run components.Runner, servod components.Servod, log logger.Logger) (Programmer, error)
NewProgrammer creates programmer to flash device firmware by servo.