New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 674799 link

Starred by 2 users

Issue metadata

Status: Archived
Owner:
Closed: Jan 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

firmware updater: Support different RO and RW in same updater package.

Project Member Reported by hungte@chromium.org, Dec 16 2016

Issue description

This comes from discussion of issue : https://code.google.com/p/chrome-os-partner/issues/detail?id=59939.

 The firmware updater was implemented in a way that it always only contains "one single AP firmware", for both RO and RW. The reasons include:
  - Shipped device should only get RW update. What's in RO is usually not important
  - Usually the new RO will be approved and become the new "official RO"
  - Having single version is easier to identify and processing

However, due to testing resource, we know that usually when a firmware is going to merged into release images, device PMs usually need to identify if it's a "RO update" or "RW-only update". Ror current firmware updater there's no difference because it'll need to put the new firmware, for both RO and RW; however for device PMs and AU, they will do this under assumption that "devices have already installed RO in factory, and write protected so RO won't be changed, even if the release image has a newer RO.

The assumption used to be true, but it's also being challenged recently since many projects get "loosen write protection screw" so the devices will actually get RO updated if user starts a recovery process manually (issue 653652).

And things gets even worse, according to issue chrome-os-partner:59939 that due approved RO slots are limited, which means for many projects the new RO will never be approved, and this will cause updating problems especially when there's new LOEM + key update.

The proposal is to make updater supporting old RO + RW directly as a combined image. That includes:

- In ebuild, allow specifying RW image source.
  There was already one - CROS_FIRMWARE_MAIN_RW_IMAGE, for example CROS_FIRMWARE_MAIN_RW_IMAGE=bcs://Samus.8802.tbz2
  Also make sure chromeos-firmwareupdate -V contains RW image info.

- In updater packaging, allow merging RW image to RO image.
  We are going to add a --merge_bios_rw_image for this, which is default True when RW is provided.

- In updater repackaging, handle RO/RW independently.
  This implies we have to add a TARGET_RO_FWID.

- In updater logic, process TARGET_FWID and TARGET_RO_FWID correctly, and update right package info.

 

Comment 1 by dchan@google.com, Dec 16 2016

Cc: shchen@chromium.org waihong@chromium.org
Project Member

Comment 2 by bugdroid1@chromium.org, Dec 28 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/firmware/+/cef563c67d5941265b4d6036783dbfc6b786721c

commit cef563c67d5941265b4d6036783dbfc6b786721c
Author: Hung-Te Lin <hungte@chromium.org>
Date: Thu Dec 15 04:32:30 2016

pack_firmware: Add --merge_bios_rw_image for supporting different RO/RW.

To help updating devices with old RO + new RW, updater should directly
prepare the AP firmware image (bios.bin) by merging RO+RW sections.

BUG= chromium:674799 
TEST=Change Reef include different RO+RW:
     CROS_FIRMWARE_MAIN_IMAGE="bcs://Reef.9012.0.0.tbz2"
     CROS_FIRMWARE_MAIN_RW_IMAGE="bcs://Reef.9053.0.0.tbz2"
     Then build updater (emerge-reef chromeos-firmware-reef),
     extract the upadter and check firmware IDs, found
     RO=9012 and RW=9053.

Change-Id: I2ce4ae1be5ab3b351f34033e9591565d4c227d39
Reviewed-on: https://chromium-review.googlesource.com/420427
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>

[modify] https://crrev.com/cef563c67d5941265b4d6036783dbfc6b786721c/pack_firmware.sh

Project Member

Comment 3 by bugdroid1@chromium.org, Dec 28 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/firmware/+/ff4da9c4440bae282e30f576acc4dc3d7471374d

commit ff4da9c4440bae282e30f576acc4dc3d7471374d
Author: Hung-Te Lin <hungte@chromium.org>
Date: Fri Dec 16 02:46:30 2016

updater: Support images with different RO/RW version.

Add a new TARGET_RO_FWID and handle RO/RW differently.

Updater v1~3 are not changed since we should never release more RW-only
updates to them.

BUG= chromium:674799 
TEST=manually: chromeos-firmwareupdate --mode=autoupdate
     chromeos-firmwareupdate -V
     mkdir tmp;
     chromeos-firmwareupdate --sb_extract tmp
     chromeos-firmwareupdate --sb_repack tmp
     chromeos-firmwareupdate -V

Change-Id: I86fa6fc8cd89c6e6bb4b26d18adddc6d8e59f6b4
Reviewed-on: https://chromium-review.googlesource.com/421386
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>

[modify] https://crrev.com/ff4da9c4440bae282e30f576acc4dc3d7471374d/pack_dist/updater4.sh
[modify] https://crrev.com/ff4da9c4440bae282e30f576acc4dc3d7471374d/pack_stub
[modify] https://crrev.com/ff4da9c4440bae282e30f576acc4dc3d7471374d/pack_firmware.sh
[modify] https://crrev.com/ff4da9c4440bae282e30f576acc4dc3d7471374d/pack_dist/updater5.sh

Comment 4 by hungte@chromium.org, Dec 28 2016

Status: Fixed (was: Started)
Today I tried to build a terra chromeos-firmwareupdate which contains 56.RO and 61.RW. after "dd" command in pack_firmware.sh, the output file is truncated,it makes the build error, then i add the operand "conv=notrunc",the output file as expected

(cr) ((86bf0bf...)) tomato@tomato-X751LN ~/trunk/src/private-overlays/overlay-terra-private/chromeos-base/chromeos-firmware-terra $ ls -l /build/terra/tmp/portage/chromeos-base/chromeos-firmware-terra-9999/temp/tmp.Qi4LxREEmD/bios.bin 
-rwxr-xr-x 1 tomato portage 8388608  1月 15 21:54 /build/terra/tmp/portage/chromeos-base/chromeos-firmware-terra-9999/temp/tmp.Qi4LxREEmD/bios.bin
(cr) ((86bf0bf...)) tomato@tomato-X751LN ~/trunk/src/private-overlays/overlay-terra-private/chromeos-base/chromeos-firmware-terra $ dd if=/build/terra/tmp/portage/chromeos-base/chromeos-firmware-terra-9999/work/chromeos-firmware-terra-9999/.dist/Terra.7287.154.61.tbz2/image.bin of=/build/terra/tmp/portage/chromeos-base/chromeos-firmware-terra-9999/temp/tmp.Qi4LxREEmD/bios.bin bs=1 skip=3080192 seek=3080192 count=983040
983040+0 records in
983040+0 records out
983040 bytes (983 kB) copied, 1.12424 s, 874 kB/s
(cr) ((86bf0bf...)) tomato@tomato-X751LN ~/trunk/src/private-overlays/overlay-terra-private/chromeos-base/chromeos-firmware-terra $ ls -l /build/terra/tmp/portage/chromeos-base/chromeos-firmware-terra-9999/temp/tmp.Qi4LxREEmD/bios.bin 
-rwxr-xr-x 1 tomato portage 4063232  1月 15 21:56 /build/terra/tmp/portage/chromeos-base/chromeos-firmware-terra-9999/temp/tmp.Qi4LxREEmD/bios.bin


(cr) ((86bf0bf...)) tomato@tomato-X751LN ~/trunk/src/private-overlays/overlay-terra-private/chromeos-base/chromeos-firmware-terra $ ls -l /build/terra/tmp/portage/chromeos-base/chromeos-firmware-terra-9999/temp/tmp.gem1bCbWRW/bios.bin 
-rwxr-xr-x 1 tomato portage 8388608  1月 15 21:57 /build/terra/tmp/portage/chromeos-base/chromeos-firmware-terra-9999/temp/tmp.gem1bCbWRW/bios.bin
(cr) ((86bf0bf...)) tomato@tomato-X751LN ~/trunk/src/private-overlays/overlay-terra-private/chromeos-base/chromeos-firmware-terra $ dd if=/build/terra/tmp/portage/chromeos-base/chromeos-firmware-terra-9999/work/chromeos-firmware-terra-9999/.dist/Terra.7287.154.61.tbz2/image.bin of=/build/terra/tmp/portage/chromeos-base/chromeos-firmware-terra-9999/temp/tmp.gem1bCbWRW/bios.bin bs=1 skip=3080192 seek=3080192 count=983040 conv=notrunc
983040+0 records in
983040+0 records out
983040 bytes (983 kB) copied, 0.758065 s, 1.3 MB/s
(cr) ((86bf0bf...)) tomato@tomato-X751LN ~/trunk/src/private-overlays/overlay-terra-private/chromeos-base/chromeos-firmware-terra $ ls -l /build/terra/tmp/portage/chromeos-base/chromeos-firmware-terra-9999/temp/tmp.gem1bCbWRW/bios.bin 
-rwxr-xr-x 1 tomato portage 8388608  1月 15 21:58 /build/terra/tmp/portage/chromeos-base/chromeos-firmware-terra-9999/temp/tmp.gem1bCbWRW/bios.bin

Comment 6 by hungte@chromium.org, Jan 16 2017

Re#5 Yes, that's already an fix for it, waiting to be merged:
https://chromium-review.googlesource.com/#/c/428512/

Comment 7 by hungte@chromium.org, Jan 16 2017

Status: Started (was: Fixed)
Project Member

Comment 8 by bugdroid1@chromium.org, Jan 17 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/firmware/+/dea430866db3e60cc7bbe00ccf97aae1bf7d83c9

commit dea430866db3e60cc7bbe00ccf97aae1bf7d83c9
Author: Hung-Te Lin <hungte@chromium.org>
Date: Mon Jan 16 05:19:28 2017

pack_firmware: Fix corrupted FMAP due to missing conv=notrunc.

The clone_firmware_section didn't add conv=notrunc so for devices having
FMAP located after RW sections, the FMAP will be discarded.

We should always add conv=notrunc so the FMAP of original firmware image
is kept correctly.

BUG= chromium:674799 
TEST=emerge-asuka chromeos-firmware-asuka

Change-Id: I36fb3570366772acf007ed3adde3fa9c9b56fcb9
Reviewed-on: https://chromium-review.googlesource.com/428512
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: YH Lin <yueherngl@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: YH Lin <yueherngl@chromium.org>

[modify] https://crrev.com/dea430866db3e60cc7bbe00ccf97aae1bf7d83c9/pack_firmware.sh

Project Member

Comment 9 by bugdroid1@chromium.org, Jan 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/firmware/+/f25e76e64038d20bb0f29c726e4e4d00d6dd690c

commit f25e76e64038d20bb0f29c726e4e4d00d6dd690c
Author: Hung-Te Lin <hungte@chromium.org>
Date: Mon Jan 16 05:26:33 2017

pack_firmware: Speed up RW image merge execution time.

When cloning firmware, the block size should be selected with a better
large number if possible. 4K is usually supported by the flash chips for
block erase.

Before the change:
 real    0m22.421s
 user    0m11.507s
 sys     0m13.828s

After the change:
 real    0m13.661s
 user    0m10.876s
 sys     0m5.775s

BUG= chromium:674799 
TEST=emerge-asuka chromeos-firmware-asuka

Change-Id: I3769a821d319b98f4b9c83b8f5d72324b0427a6a
Reviewed-on: https://chromium-review.googlesource.com/428513
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: YH Lin <yueherngl@chromium.org>
Reviewed-by: YH Lin <yueherngl@chromium.org>

[modify] https://crrev.com/f25e76e64038d20bb0f29c726e4e4d00d6dd690c/pack_firmware.sh

Project Member

Comment 10 by bugdroid1@chromium.org, Jan 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/firmware/+/6bf164d6049524c06ed5617d877345a1e0a5df96

commit 6bf164d6049524c06ed5617d877345a1e0a5df96
Author: Hung-Te Lin <hungte@chromium.org>
Date: Tue Jan 17 02:46:36 2017

pack_firmware: Support merging EC/PD RW from main firmware.

For devices entering recovery stage, their EC/PD RW will be flashed to
an older version (same as RO) since we only merged main RW firmware.
This is usually fine since first boot after recovery will trigger
software sync and get new EC/PD RW (from main RW) updated.

However, to reduce the extra software sync, and to prevent if the old EC
may have problem on new devices, we want to update the RW sections of
ec.bin and pd.bin using the ecrw/pdrw that main firmware provides in RW
firmware (which will be used for software sync).

BUG= chromium:674799 
TEST=emerge-asuka chromeos-firmware-asuka

Change-Id: I9df975729d1942d9fe10dd0325fb72d0fe5bf954
Reviewed-on: https://chromium-review.googlesource.com/428734
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: YH Lin <yueherngl@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: YH Lin <yueherngl@chromium.org>

[modify] https://crrev.com/6bf164d6049524c06ed5617d877345a1e0a5df96/pack_firmware.sh

Project Member

Comment 11 by bugdroid1@chromium.org, Jan 23 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/firmware/+/3e730d2d05e0756b9f9eb0890d5b955beef52d66

commit 3e730d2d05e0756b9f9eb0890d5b955beef52d66
Author: Hung-Te Lin <hungte@chromium.org>
Date: Thu Jan 19 08:37:18 2017

pack_firmware: Fixes from review feedback.

Fixes from CL:428734.

- change vboot1/vboot2 to fmap/cbfs.
- extract cbfs contents directly without dump_fmap first.
- parse dump_fmap output by bash array and prevent off-hand operations.
- correct EC section size checking: should be '>=' instead of '>'.
- move dd & python into individual python helpers in utils folder.

BUG= chromium:674799 
TEST=emerge-asuka chromeos-firmware-asuka
     emerge-kefka chromeos-firmware-kefka
     emerge-lumpy chromoes-firmware-lumpy

Change-Id: I8b7c136384a708535943df0b14fae08e5253d607
Reviewed-on: https://chromium-review.googlesource.com/430464
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>

[add] https://crrev.com/3e730d2d05e0756b9f9eb0890d5b955beef52d66/utils/merge_file.py
[modify] https://crrev.com/3e730d2d05e0756b9f9eb0890d5b955beef52d66/pack_firmware.sh
[add] https://crrev.com/3e730d2d05e0756b9f9eb0890d5b955beef52d66/utils/decode_int32.py

Status: Fixed (was: Started)
Labels: Merge-Requested Merge-Request-57

Adding merge request to R57. Sync'ing the change (c#11) to R57. Thanks.
Project Member

Comment 14 by sheriffbot@chromium.org, Jan 24 2017

Labels: -Merge-Request-57 Hotlist-Merge-Approved Merge-Approved-57
Your change meets the bar and is auto-approved for M57. Please go ahead and merge the CL to branch 2987 manually. Please contact milestone owner if you have questions.
Owners: amineer@(clank), cmasso@(bling), ketakid@(cros), govind@(desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 15 by bugdroid1@chromium.org, Jan 24 2017

Labels: merge-merged-release-R57-9202.B
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/firmware/+/a6dab71f12ad9de82165acadea1134c837dc3717

commit a6dab71f12ad9de82165acadea1134c837dc3717
Author: Hung-Te Lin <hungte@chromium.org>
Date: Thu Jan 19 08:37:18 2017

pack_firmware: Fixes from review feedback.

Fixes from CL:428734.

- change vboot1/vboot2 to fmap/cbfs.
- extract cbfs contents directly without dump_fmap first.
- parse dump_fmap output by bash array and prevent off-hand operations.
- correct EC section size checking: should be '>=' instead of '>'.
- move dd & python into individual python helpers in utils folder.

BUG= chromium:674799 
TEST=emerge-asuka chromeos-firmware-asuka
     emerge-kefka chromeos-firmware-kefka
     emerge-lumpy chromoes-firmware-lumpy

Change-Id: I8b7c136384a708535943df0b14fae08e5253d607
Reviewed-on: https://chromium-review.googlesource.com/430464
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
(cherry picked from commit 3e730d2d05e0756b9f9eb0890d5b955beef52d66)
Reviewed-on: https://chromium-review.googlesource.com/431003
Reviewed-by: YH Lin <yueherngl@chromium.org>
Commit-Queue: YH Lin <yueherngl@chromium.org>
Tested-by: YH Lin <yueherngl@chromium.org>

[add] https://crrev.com/a6dab71f12ad9de82165acadea1134c837dc3717/utils/merge_file.py
[modify] https://crrev.com/a6dab71f12ad9de82165acadea1134c837dc3717/pack_firmware.sh
[add] https://crrev.com/a6dab71f12ad9de82165acadea1134c837dc3717/utils/decode_int32.py

Project Member

Comment 16 by sheriffbot@chromium.org, Jan 30 2017

This issue has been approved for a merge. Please merge the fix to any appropriate branches as soon as possible!

If all merges have been completed, please remove any remaining Merge-Approved labels from this issue.

Thanks for your time! To disable nags, add the Disable-Nags label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 17 by sheriffbot@chromium.org, Feb 3 2017

This issue has been approved for a merge. Please merge the fix to any appropriate branches as soon as possible!

If all merges have been completed, please remove any remaining Merge-Approved labels from this issue.

Thanks for your time! To disable nags, add the Disable-Nags label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 18 by dchan@google.com, Apr 17 2017

Labels: VerifyIn-59

Comment 19 by dchan@google.com, May 30 2017

Labels: VerifyIn-60
Labels: VerifyIn-61

Comment 21 by dchan@chromium.org, Oct 14 2017

Status: Archived (was: Fixed)

Sign in to add a comment