| commit | 697a4648233394678c9d65c7d50c3c140b1aa684 | [log] [tgz] |
|---|---|---|
| author | Hung-Te Lin <[email protected]> | Thu Oct 11 06:52:47 2018 |
| committer | ChromeOS Commit Bot <[email protected]> | Fri Oct 12 05:28:49 2018 |
| tree | 65a5e90351600d1d9ddba4b8c9ff74aed6a06e80 | |
| parent | 2913c4e264404048591088227b1a04fdfc9e8786 [diff] |
pack_firmware: Keep extra firmware images in top level folder.
The signer bot does not process bin/*.bin, but currently all files
listed in EXTRA (which will be copied by CopyElfs) will live in bin/ sub
folder.
"Extra firmware images" is eliminated in M71+, so we want some simple
work around for M69 and M70, by copying files directly if the file
name looks like *.bin.
BUG=chromium:894324
TEST=Revert CL:*684050, then run: emerge-daisy chromeos-firmware-daisy;
chromeos-firmwareupdate -V | grep '\.bin'
# 7f5b0669d9f43b0075cded5688a0a343 *./bios-snow-2695.132.ro.bin
# 673c3efd476ac9a803cfc2f724c24806 *./bios_rw.bin
# 0d2c9045017a843ad16d492897481d88 *./ec-2695.132.bin
# 3849d1915bc50fb1a9a168c648517d37 *./bios-snow-2695.132.rw.bin
# e9306cb76c8e636b4f5847cc7702abe7 *./bios.bin
Change-Id: Ie718e7a7e14606f01f7fc934c8f8c7ece0e63be0
Reviewed-on: https://chromium-review.googlesource.com/c/1278545
Tested-by: Hung-Te Lin <[email protected]>
Trybot-Ready: Hung-Te Lin <[email protected]>
Reviewed-by: Mike Frysinger <[email protected]>
Commit-Queue: Hung-Te Lin <[email protected]>
This repository contains the firmware updater (chromeos-firmwareupdate) that will update firmware images related to verified boot, usually AP (also known as BIOS or MAIN) and EC.
Auto update is one of the most important feature in Chrome OS. Updating firmware is one of the most complicated process, since all Chromebooks come with firmware that implemented verified boot and must be able to update in background silently.
The firmware updater was made as a “shellball”, a self-executable file containing updater logic (shell scripts), utility programs, and firmware images.
In all modes, updater will try to preserve few firmware data, for example the VPD sections (
RO_VPD,RW_VPD),HWIDandGBB flags(inGBBsection).
Usually you can find the updater in /usr/sbin/chromeos-firmwareupdate on a ChromeOS device (or the rootfs partition of a disk image).
To look at its contents (firmware images and versions):
chromeos-firmwareupdate -V
Usually for people who wants to “update all my firmware to right states”, do:
chromeos-firmwareupdate --mode=recovery
The
recoverymode will try to update RO+RW if your write protection is not enabled, otherwise only RW.
If your are not sure about write protection status but you only want RW to be updated, run:
chromeos-firmwareupdate --mode=recovery --wp=1
The
--wpargument will override you real write protection status.
The ChromeOS Auto Update (update_engine) runs updater in a different way - a two-step trial process.
If you want to simulate and test that, do:
chromeos-firmwareupdate --mode=autoupdate --wp=1
The updater is provided by the virtual/chromeos-firmware package in Chromium OS source tree, which will be replaced and includes the chromeos-base/chromeos-firmware-${BOARD} package in private board overlays.
To build an updater locally, in chroot run:
emerge-${BOARD} chromeos-firmware-${BOARD}
If your board overlay has defined USE flags bootimage or cros_ec, chromeos-firwmare-${BOARD} package will add dependency to firmware and EC source packages (chromeos-bootimage and chromeos-ec), and have the firmware images in /build/${BOARD}/firmware/{image,ec}.bin. A “local” updater will be also generated in /build/${BOARD}/firmware/updater.sh so you can run it to test the locally built firmware images.
In other words, you can remove
bootimageandcros_ecin branches that you don't need firmware from source, for example the factory branches or ToT, especially if there are external partners who only has access to particular board private overlays. To do that, find themake.confin board overlay and addUSE="-bootimage -cros_ec".
The firmware updater packages lives in private board overlays: src/private-overlays/overlay-${BOARD}-private/chromeos-base/chromeos-firmware-${BOARD}/chromeos-firmware-${BOARD}-9999.ebuild. Find a template here in chromiumos-base/chromeos-firmware-null.
Usually there are few fields you have to fill:
A reference to the Main (AP) firmware image, which usually comes from emerge-${BOARD} chromeos-booimage then /build/${BOARD}/firmware/image.bin.
Usually this implies both RO and RW. See CROS_FIRMWARE_MAIN_RW_IMAGE below for more information.
You have to run
ebuild-${BOARD} chromeos-firmware-${BOARD}.ebuild manifestwhenever you've changed the image files (CROS_FIRMWARE_*_IMAGE).
A reference to the Main (AP) firmware image and only used for RW sections.
If this value is set, CROS_FIRMWARE_MAIN_IMAGE will be used for RO and this will be used for RW.
A reference to the Embedded Controller (EC) firmware image, which usually comes from emerge-${BOARD} chromeos-ec then /build/${BOARD}/firmware/ec.bin.
The firmware updater is built by running pack_firmware.py, which collects firmware image and extra files, all files under pack_dist folder, archived by running shar, with a special bootstrap stub pack_stub.
Since the verified boot has been evolved with so much differences, we put the updating logic in different files according to the generation of firmware: pack_dist/updater*.sh. Most Chromebooks today should use updater4.sh.
Usually we will increase a “logic version” when the verified boot has been changed so much that the updater code for previous versions would almost won't work. Currently we have defined these versions (Use Developer Info page to find the mapping from board names to product names):
This will be mapped to what you should set in the CROS_FIRMWARE_SCRIPT value in ebuild files.
Here's a detailed list of how each updater mode works:
--mode=autoupdate: Invoked by update_engine when a payload is installed.
update_engine will invoke chromeos-setgoodfirmware after 60 secs, which will update or mark booted RW firmware to active.CROS_FIRMWARE_MAIN_IMAGE. If yes, go 2. Otherwise, do --mode=recovery.--mode=recovery: Invoked by recovery shim after installed.
--mode=factory_install: Used for factory initial imaging.