chromiumos/platform/firmware.git
14 months agofirmware-updater: Detect legacy flashrom program. 50/58950/3 factory-4290.B factory-4455.B factory-pit-4390.B factory-pit-4471.B firmware-falco_peppy-4389.B firmware-leon-4389.26.B firmware-pit-4482.B firmware-wolf-4389.24.B master release-R29-4319.B release-R30-4537.B stabilize-4443.B stabilize-4512.B
Hung-Te Lin [Tue, 18 Jun 2013 01:50:40 +0000 (09:50 +0800)]
firmware-updater: Detect legacy flashrom program.

When updating with programs from old system, we must detect and use the old
"-p internal:bus=*" syntax.

BUG=chrome-os-partner:20261
TEST=manually: remove the flashrom from firmware updater bundle and see flashrom
     invoked with "-p internal:bus=*" param.
CQ-DEPEND=CL:58933

Change-Id: I2669d50bab48d18bb8045d6f2d8b278ed5c2341f
Reviewed-on: https://gerrit.chromium.org/gerrit/58950
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Commit-Queue: Doug Anderson <dianders@chromium.org>

14 months agofirmware-updater: Use new '-p ec' and '-p host' aliases 33/58933/3
Doug Anderson [Mon, 17 Jun 2013 23:19:26 +0000 (16:19 -0700)]
firmware-updater: Use new '-p ec' and '-p host' aliases

These new aliases will properly select the EC and host flash as
appropriate for the board.

CQ-DEPEND=CL:58950
CQ-DEPEND=CL:59070
BUG=chrome-os-partner:20261
TEST=On snow on kernel and kernel-next, run:
  chromeos-firmwareupdate -v --mode=recovery -d
...and see that it is flashing the ec using "-p ec" and "-p host".

Change-Id: Ie889110284a3c8af7b48e858257b47b953ac4b1a
Reviewed-on: https://gerrit.chromium.org/gerrit/58933
Tested-by: Doug Anderson <dianders@chromium.org>
Commit-Queue: Doug Anderson <dianders@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
14 months agoupdater: Add message for EC updates on reboot. 62/58362/3 factory-spring-4262.B stabilize-4287.B
Hung-Te Lin [Wed, 12 Jun 2013 16:12:03 +0000 (09:12 -0700)]
updater: Add message for EC updates on reboot.

For systems with EC Software Sync, the updater may provide additional messages
when a new EC is found.

BUG=chrome-os-partner:20115
TEST=emerge-$BOARD chromeos-firmware-$BOARD

Change-Id: I982f3d5d84796a4f451694d0906a84115f52e8f9
Reviewed-on: https://gerrit.chromium.org/gerrit/58362
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>

14 months agoUpdater: Find real static tool programs. 84/56784/3 stabilize-4255.B
Hung-Te Lin [Tue, 28 May 2013 07:12:33 +0000 (15:12 +0800)]
Updater: Find real static tool programs.

Many tool programs, especially vboot_reference utilities, are now integrated
into 'futility'. Some of them are stubs to old_bins/* and some of them (ex,
dump_fmap) are now symlinks to futility.

To always pickup the static ones without dependency, we must first check
old_bins and then resolve symlink before embedding programs into firmware
updater.

BUG=chromium:244347
TEST=manual: emerge-link chromeos-firmware-link
     /build/link/usr/sbin/chromeos-firmware --sb_extract .
     file * # all tool programs are now statically linked.

Change-Id: I493d70ef2ee5418df5c72757f2d1240e5cf8012d
Reviewed-on: https://gerrit.chromium.org/gerrit/56784
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>

15 months agoupdater: Add "cros_override_rw_firmware_by_version" to simplify customization. 86/49886/3 factory-4128.B factory-spring-4131.B release-R28-4100.B stabilize-4100.38.B stabilize-spring-4100.53.B toolchainB
Hung-Te Lin [Thu, 2 May 2013 09:54:40 +0000 (17:54 +0800)]
updater: Add "cros_override_rw_firmware_by_version" to simplify customization.

This is based on the customization script from Snow firmware updater.
Usage: cros_override_rw_firmware_by_version CURRENT_VER MINIMAL_VER

If CURRENT_VER is less than MINIMAL_VER, IMAGE_MAIN will be replaced by
IMAGE_MAIN_RW (the image without RO_NORMAL flag).

BUG=chromium:237432
TEST=manual: Add cros_override_rw_firmware_by_version "$RO_FWID" "$TARGET_FWID"
             and then emerge-$BOARD chromeos-firmware-$BOARD,
             sh chromeos-firmwareupdate --mode=autoupdate # see RW replaced.

Change-Id: Ie1c53d729ee462df481d91a4bd8581a1781360bf
Reviewed-on: https://gerrit.chromium.org/gerrit/49886
Commit-Queue: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
15 months agopack_firmware: Add --create_bios_rw_image to re-sign RW images directly. 56/49856/4
Hung-Te Lin [Thu, 2 May 2013 04:33:11 +0000 (12:33 +0800)]
pack_firmware: Add --create_bios_rw_image to re-sign RW images directly.

To simplify and prevent the process of manually building RW firmware update
payload, add an option in updater creation script to re-sign and generate proper
image on-the-fly.

BUG=chromium:237432
TEST=./pack_firmware -b bios.bin --create_bios_rw_image -o test.sh
     ./test.sh -V # see image.rw.bin

Change-Id: I46af445e14d28f14b55cbaa4333d0134b202c262
Reviewed-on: https://gerrit.chromium.org/gerrit/49856
Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
16 months agoupdater: Add "fast_version_check" for checking if an updater is required. 07/47007/5 stabilize-4008.0.B stabilize-4035.0.B stabilize-4068.0.B
Hung-Te Lin [Mon, 1 Apr 2013 08:54:03 +0000 (16:54 +0800)]
updater: Add "fast_version_check" for checking if an updater is required.

Add a special mode "fast_version_check" that checks only firmware version
numbers. GBB, root/recovery keys, RW vblocks and kernel/firmware key versions
are all not checked.

This is for developers and factories that won't install firmware images with
wrong key set and still want to quickly update firmware when a new version
number is released.

BUG=chrome-os-partner:18479
TEST=manually: emerge-link chrome-firmware-link
     chromeos-firmwareupdate --mode fast_version_check

Change-Id: I415956c183bc0fadc7dd167d9b3b6ba18d5292a8
Reviewed-on: https://gerrit.chromium.org/gerrit/47007
Commit-Queue: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
17 months agoupdater: Check correct firmware when updating with firmware B in active. 23/44623/2 factory-spring-3842.B firmware-spring-3824.4.B firmware-spring-3824.55.B firmware-spring-3824.84.B firmware-spring-3824.B firmware-spring-3833.B release-R27-3912.B stabilize-3881.0.B stabilize-3912.79.B toolchainA
Hung-Te Lin [Tue, 5 Mar 2013 07:57:56 +0000 (15:57 +0800)]
updater: Check correct firmware when updating with firmware B in active.

"is_equal_slot" function compares "current" and "target" firmware payloads,
while the real files we need to check when updating when firmware B in active
should be all "current" files.

BUG=chromium-os:39282
TEST=emerge-linkg chromeos-firmware-daisy; crossystem fwb_tries=1; reboot
     chromeos-firmwareupdate --mode=autoupdate --debug # see update action
     flashrom -w bios.bin -i RW_SECTION_B  # write garbage into B slot
     chromeos-firmwareupdate --mode=autoupdate --debug # see "retry in next boot"

Change-Id: I3bc1f517b08f8a413dd7825eb6686d65ef0ddb5a
Reviewed-on: https://gerrit.chromium.org/gerrit/44623
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>

17 months agoupdater: Allow updating when one reboot does happened between two updates. 37/44137/3
Hung-Te Lin [Wed, 27 Feb 2013 02:55:39 +0000 (10:55 +0800)]
updater: Allow updating when one reboot does happened between two updates.

We used to rely on two reboots between two firmware updates. However for RW
firmware, after system reboots everything is already in RAM and never re-reads
from flash. That means we can eliminate one reboot if content of RW A firmware
is already identical to RW B firmware.

BUG=chromium-os:39282
TEST=emerge-daisy chromeos-firmware-daisy;
     Receive an update (or using fwb_tries=1, reboot) and then
     invoke chromeos-firmwareupdate --mode=autoupdate # success.

Change-Id: Ie4b088ad94eca9061a8129f5242e2b69583d7221
Reviewed-on: https://gerrit.chromium.org/gerrit/44137
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>

19 months agofirmware: Allow overriding EC update procedure. 44/41344/3 stabilize-3658.0.0 stabilize-3701.30.0 stabilize-3701.30.0b stabilize-bluetooth-smart
Hung-Te Lin [Wed, 16 Jan 2013 03:41:33 +0000 (11:41 +0800)]
firmware: Allow overriding EC update procedure.

For devices with 3rd party EC, we probably need to do something (Ex, calling
mosys to notify EC of firmware updates) after EC is updated. Moreover, writing
EC should be only one time - either RW or ALL - to help post update procedure
being called properly.

BUG=chrome-os-partner:17046
TEST=emerge-$BOARD chromeos-firmware-$BOARD

Change-Id: I1b800d6d154951092cd725595f09f3b82bd2eb5a
Reviewed-on: https://gerrit.chromium.org/gerrit/41344
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Bowgo Tsai <bowgotsai@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>

19 months agofirmware: Support RW BIOS. 87/40587/6
Hung-Te Lin [Tue, 8 Jan 2013 07:47:14 +0000 (15:47 +0800)]
firmware: Support RW BIOS.

To support more devices with RW BIOS in future, we should add official RW
support in updater packer.  The output file name is also defined as
IMAGE_RW_MAIN for customization script to use.

BUG=none
TEST=emerge-daisy chromeos-firmware-daisy

Change-Id: I3d9b5474fceb954bdb178e83f0289fd6ecc00a77
Reviewed-on: https://gerrit.chromium.org/gerrit/40587
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>

19 months agoupdater: Change TPM failure to error exit. 21/40921/2 factory-3536.B
Hung-Te Lin [Wed, 9 Jan 2013 04:06:48 +0000 (12:06 +0800)]
updater: Change TPM failure to error exit.

Simply die upon TPM retrieval failure.

BUG=chromium-os:33680
TEST=emerge-link chromeos-firmware-link

Change-Id: I5c7e7bee7f1f9546a436c946f3f93e4245037fa7
Reviewed-on: https://gerrit.chromium.org/gerrit/40921
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>

19 months agoupdater: Fix reboot procedure. 75/39075/2
Hung-Te Lin [Mon, 3 Dec 2012 09:43:22 +0000 (17:43 +0800)]
updater: Fix reboot procedure.

 Having multiple 'sync' by script is not helpful (ex,
 http://utcc.utoronto.ca/~cks/space/blog/unix/TheLegendOfSync ).

 Instead, for systems with low-speed storage (ex, hard disk), we should use
 sleep to help hardware getting I/O completed.

 Also, command 'reboot' exits immediately, so we must block (using sleep) to
 prevent further command execution.

BUG=none
TEST=chromeos-firmwareupdate --mode=startup

Change-Id: I9f94ecbd0f84bbe3cb67f2472a0e798e260b807b
Reviewed-on: https://gerrit.chromium.org/gerrit/39075
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>

20 months agopack_firmware: Check shflags evaluation. 65/39365/2 toolchain-3428.65.B
Hung-Te Lin [Fri, 7 Dec 2012 04:37:21 +0000 (12:37 +0800)]
pack_firmware: Check shflags evaluation.

When the command line is too long or invalid for shflags to parse, pack script
may ignore some parameters; we should raise error for that case.

Example warning without this check:
./lib/shflags/shflags: eval: line 745: unexpected EOF while looking for matching
`''
./lib/shflags/shflags: eval: line 746: syntax error: unexpected end of file
./pack_firmware.sh: eval: line 41: unexpected EOF while looking for matching `''
./pack_firmware.sh: eval: line 42: syntax error: unexpected end of file

BUG=chromium-os:36794
TEST=emerge-x86-zgb chromeos-firmware-zgb

Change-Id: I80ee3df5feaab554cc412c7e6a73c57f8e0bb154
Reviewed-on: https://gerrit.chromium.org/gerrit/39365
Reviewed-by: Rong Chang <rongchang@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

21 months agocrosutil: Fix incorrect return value when HWWP is enabled. 05/38705/2 stabilize2
Hung-Te Lin [Tue, 27 Nov 2012 03:56:05 +0000 (11:56 +0800)]
crosutil: Fix incorrect return value when HWWP is enabled.

A typo in return value.

BUG=chrome-os-partner:16315
TEST=chromeos-firmwareupdate --mode=recovery # Successfully triggered
     RW-only update on WP'ed Lumpy.

Change-Id: I235e10e61a7cc7d6226f8dee34fbc5d7040aac72
Reviewed-on: https://gerrit.chromium.org/gerrit/38705
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

21 months agoupdater: Return error code '4' for 'Need RO update (disable WP)'. 90/38290/2
Hung-Te Lin [Mon, 19 Nov 2012 04:26:28 +0000 (12:26 +0800)]
updater: Return error code '4' for 'Need RO update (disable WP)'.

BUG=chromium-os:36415
TEST=chromeos-firmwareupdate --mode=factory; echo $? # see 4 on WP devices

Change-Id: If8e8b56593cd17aab8e18f32b85b8acb67d2010d
Reviewed-on: https://gerrit.chromium.org/gerrit/38290
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

21 months agocrosutil: Support devices with incomplete wpsw_cur support. 10/38510/2
Hung-Te Lin [Thu, 22 Nov 2012 04:58:44 +0000 (12:58 +0800)]
crosutil: Support devices with incomplete wpsw_cur support.

For devices without proper wpsw_cur implementation, we should fallback to
wpsw_boot before assuming system is write-protected.

BUG=chrome-os-partner:16315
TEST=chromeos-firmwareupdate --mode=recovery # see wpsw_* messages, and correct WP state.

Change-Id: I086a2ec18e6dc170e940386e1d56a553313dd446
Reviewed-on: https://gerrit.chromium.org/gerrit/38510
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
21 months agoupdater: Don't write EC RW section when write protection is enabled. 20/37820/3
Hung-Te Lin [Mon, 12 Nov 2012 11:34:38 +0000 (19:34 +0800)]
updater: Don't write EC RW section when write protection is enabled.

Currently device using software sync will write-protect EC RW once firmware
booting stage is finished; so we can't update RW EC even in recovery mode.

BUG=chrome-os-partner:16087
TEST=emerge-link chromeos-firmware-link

Change-Id: I619db876736f13a03f2695c56e131237ed4bebeb
Reviewed-on: https://gerrit.chromium.org/gerrit/37820
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

21 months agoupdater: Prevent getting EC WP status in autoupdate & bootok modes. 79/37979/2
Hung-Te Lin [Wed, 14 Nov 2012 04:10:03 +0000 (12:10 +0800)]
updater: Prevent getting EC WP status in autoupdate & bootok modes.

BUG=none
TEST=chromeos-firmwareupdate --mode=bootok # no EC WP
     chromeos-firmwareupdate --mode=autoupdate # no EC WP
     chromeos-firmwareupdate --mode=recovery # see EC WP

Change-Id: I09e79e91c2b40d7d61bfd56316df496eb30da655
Reviewed-on: https://gerrit.chromium.org/gerrit/37979
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

21 months agoupdater: Improve locking checks. 19/37819/5
Hung-Te Lin [Mon, 12 Nov 2012 11:29:10 +0000 (19:29 +0800)]
updater: Improve locking checks.

If firmware updater is terminated by Ctrl-C, we should always check previous
instance first before being aborted.

BUG=chrome-os-partner:15642
TEST=chromeos-firmwareupdate # Ctrl-C to break
     chromeos-firmwareupdate & # Removed locked file and continue
     chromeos-firmwareupdate # abort as expected.

Change-Id: I0a27e7f6d68952d43dc921e761e259d54d593acb
Reviewed-on: https://gerrit.chromium.org/gerrit/37819
Reviewed-by: Jon Salz <jsalz@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
23 months agocrosutil: Add "cros_compare_version" API to simplify board customization. factory-2985.B factory-2993.B factory-3004.B
Hung-Te Lin [Fri, 28 Sep 2012 05:03:04 +0000 (13:03 +0800)]
crosutil: Add "cros_compare_version" API to simplify board customization.

Added a version compare function (based on "sort -V") to help testing firmware
version compatibility.

BUG=none
TEST=Simply copied from Link customization script.

Change-Id: I642c086e7fc1651c07eb1968d27ee2d3a80a19ee
Reviewed-on: https://gerrit.chromium.org/gerrit/34259
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

23 months agofirmware-updater: Prevent flashrom from SIGPIPE factory-2914.B stabilize
Rong Chang [Thu, 6 Sep 2012 12:25:42 +0000 (20:25 +0800)]
firmware-updater: Prevent flashrom from SIGPIPE

The grep utility with quiet flag breaks the pipe before flashrom
finishes its operation. Under heavy CPU load, this might leave
EC in an unwanted state. Split write protect detection into two lines
solved this issue.

BUG=chrome-os-partner:13176
TEST=manual
  Boot ChromeBook and check /var/log/update_engine.log after 80 seconds.
  Both 'Main' and 'EC' write protect status are correct.

Change-Id: Ida67ed9326f72f2d6c4a38b6512daeb6dbc7631d
Reviewed-on: https://gerrit.chromium.org/gerrit/32384
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Ready: Rong Chang <rongchang@chromium.org>
Tested-by: Rong Chang <rongchang@chromium.org>
23 months agoFix firmware packing for EC + BIOS version string containing slash char. factory-2846.B factory-2848.B
Shawn Nematbakhsh [Wed, 29 Aug 2012 01:20:08 +0000 (18:20 -0700)]
Fix firmware packing for EC + BIOS version string containing slash char.

If '/' is present in the EC or BIOS version string, pack_firmware.sh
will fail because '/' is the sed delimiter character. Here we change the
delimiter character to ascii 001 (SOH), which is not very likely to
appear in our strings. The delimiter changing feature of sed is
documented in the sed manual:

http://www.gnu.org/software/sed/manual/sed.html#Addresses

BUG=chromium-os:33969
TEST=emerge-boardname chromeos-firmware-boardname

Change-Id: I789b6bb735ba22d1ac25e5178d9cd55902563ab6
Reviewed-on: https://gerrit.chromium.org/gerrit/31668
Tested-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: Jon Salz <jsalz@chromium.org>
Commit-Ready: Shawn Nematbakhsh <shawnn@chromium.org>

2 years agoupdater: Add RO_FWID and show more RO-related system information. factory-2717.B factory-2723.14.B firmware-butterfly-2788.B firmware-stout-2817.B
Hung-Te Lin [Fri, 3 Aug 2012 02:52:51 +0000 (10:52 +0800)]
updater: Add RO_FWID and show more RO-related system information.

RO_FWID is helpful in checking RO compatibility, so let's always retrieve it.
RO_NORMAL tag is also useful for debugging twostop related issue, so now always
logged.

BUG=none
TEST=emerge-link chromeos-firmware-link; (DUT) chromeos-firmwareupdate --mode=recovery

Change-Id: I8093203fde80075c2b980ac805902c01cb66910a
Reviewed-on: https://gerrit.chromium.org/gerrit/29127
Reviewed-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2 years agoIncrease Try-B Counter when doing EC software sync.
Hung-Te Lin [Wed, 1 Aug 2012 07:46:25 +0000 (15:46 +0800)]
Increase Try-B Counter when doing EC software sync.

BUG=chrome-os-partner:11845
TEST=emerge-link chromeos-firmware

Change-Id: I927bb16e1e1ded7c4801c43d975f9e83d1d876fb
Reviewed-on: https://gerrit.chromium.org/gerrit/28926
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

2 years agoupdater: unpack FMAP only when required. firmware-link-2695.2.B firmware-link-2695.B firmware-parrot-2685.B firmware-snow-2695.90.B firmware-snow-2695.B
Hung-Te Lin [Sat, 28 Jul 2012 01:01:32 +0000 (09:01 +0800)]
updater: unpack FMAP only when required.

For platforms using incomplete or buggy EC FMAP during development time, we need
to use FMAP only when really being required.

BUG=chrome-os-partner:11934
TEST=emerge-daisy chromeos-firmware-daisy

Change-Id: I9b3eb8511492e54f221633cf00e064b1780c77bc
Reviewed-on: https://gerrit.chromium.org/gerrit/28648
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
Reviewed-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

2 years agoupdater: Use static-linked tool programs if available.
Hung-Te Lin [Sat, 28 Jul 2012 03:09:17 +0000 (11:09 +0800)]
updater: Use static-linked tool programs if available.

Making every tool programs in rootfs static may exceed recovery kernel size
limit, so we want to use static ones only in updater bundle.

BUG=chromium-os:32967
TEST=emerge-link chromeos-firmware-link # found static tools

Change-Id: I1284dc45f35d42fdf160d54f28045f2c3c39e43a
Reviewed-on: https://gerrit.chromium.org/gerrit/28658
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

2 years agofirmware updater: Fix v4 (chromeos-ec) updating path.
Hung-Te Lin [Thu, 26 Jul 2012 10:29:29 +0000 (18:29 +0800)]
firmware updater: Fix v4 (chromeos-ec) updating path.

Fix updater logic for new chromeos-ec (using EC software sync approach).

This is required so we can enable --mode=bootok (required to BIOS stable A/B
update) again on v4 platforms.

BUG=none
TEST=chromeos-firmwareupdate --mode=recovery # pass

Change-Id: Ifc60ac18733541c83fd73d815088d799fe70c1f2
Reviewed-on: https://gerrit.chromium.org/gerrit/28486
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

2 years agofirmware: No more EC updates on startup time. factory-2338.B factory-2368.B factory-2394.B factory-2460.B factory-2475.B factory-2569.B firmware-link-2348.B release-R21-2465.B
Hung-Te Lin [Tue, 15 May 2012 10:41:14 +0000 (18:41 +0800)]
firmware: No more EC updates on startup time.

For ChromeOS-EC, we won't update EC on startup time.
It should be done in autoupdate stage (not implemented yet).

BUG=chrome-os-partner:9461
TEST=chromeos-firmwareupdate --mode=startup

Change-Id: I1567959edfca524e75811dc0ff6bfc8a3aa5a91e
Reviewed-on: https://gerrit.chromium.org/gerrit/22694
Tested-by: Hung-Te Lin <hungte@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
2 years agoSystem utility for native updater.
Hung-Te Lin [Tue, 15 May 2012 08:14:19 +0000 (16:14 +0800)]
System utility for native updater.

Prepare to migrate into native code implementation.

BUG=chromium-os:28371
TEST=none (not used by anyone yet).

Change-Id: I647f83724beeedbd0c8636795251bda270eb3be4
Reviewed-on: https://gerrit.chromium.org/gerrit/22689
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

2 years agofirmware: experimental updater using MTD driver. factory-2305.B
Hung-Te Lin [Tue, 15 May 2012 06:16:32 +0000 (14:16 +0800)]
firmware: experimental updater using MTD driver.

BUG=chrome-os-partner:9430,chrome-os-partner:9081
TEST=chromeos-firmwareupdate --mode=recovery

Change-Id: I1b1bde01ab18064f57bcfa9e61132e93a408cca6
Reviewed-on: https://gerrit.chromium.org/gerrit/22678
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

2 years agofirmware: Support chromeos-ec. factory-2268.16.B release-R20-2268.B
Hung-Te Lin [Wed, 9 May 2012 05:12:04 +0000 (13:12 +0800)]
firmware: Support chromeos-ec.

Since the layout of chromeos-ec is very different and we're seeing more and more
incompatible issues, let's branch now to not break existing devices.

BUG=chrome-os-partner:9461
TEST=emerge-link chromeos-firmware;
     chromeos-firmwareupdate --mode=bootok
     chromeos-firmwareupdate --mode=startup
     # Unexpected EC reboots are gone.

Change-Id: I42f190f6d36dcae2823f081a4b1b0708c3440b6f
Reviewed-on: https://gerrit.chromium.org/gerrit/22211
Reviewed-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

2 years agofirmware: create new updater branch.
Hung-Te Lin [Wed, 9 May 2012 05:10:19 +0000 (13:10 +0800)]
firmware: create new updater branch.

We're going to create a new updater for chromeos-ec.

BUG=chrome-os-partner:9461
TEST=none, simply fork.

Change-Id: Ic1f2f7027706e6b4f5264930680f3ab6d02112b7
Reviewed-on: https://gerrit.chromium.org/gerrit/22203
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

2 years agofirmware: Build PATH by checking executables availability.
Hung-Te Lin [Sat, 24 Mar 2012 06:30:59 +0000 (14:30 +0800)]
firmware: Build PATH by checking executables availability.

To support 32->64 AU, we should first try bundled binary programs, or provided
extra folder, then system default.

BUG=chrome-os-partner:8409
TEST=emerge-x86-zgb chromeos-firmwareupdate # 64 bit
     ./chromeos-firmwareupdate --mode=autoupdate # sucess on 32bit systems

Change-Id: Ibd7a42a00514fd16f98440483d42c4ac86b37c8d
Reviewed-on: https://gerrit.chromium.org/gerrit/19026
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

2 years ago[firmware] add OWNERS
Elly Jones [Fri, 6 Apr 2012 19:12:15 +0000 (15:12 -0400)]
[firmware] add OWNERS

TEST=None
BUG=chromium-os:22007

Change-Id: I7cbdc7bfdcab92509a31487fd8dc9204e6266337
Signed-off-by: Elly Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/19769
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
2 years agofirmware: Change TPM & firmware key version debug output to hex number.
Hung-Te Lin [Wed, 21 Mar 2012 06:55:45 +0000 (14:55 +0800)]
firmware: Change TPM & firmware key version debug output to hex number.

The reported number should use same format as crossystem.

BUG=chromium-os:23825
TEST=emerge-x86-zgb chromeos-firmware-zgb
     Setup a key-rollback envirnoment, then
     chromeos-firmwareupdate --mode-autoupdate
     # see "Firmware key (0x10001) will be rejected by TPM (0x10002).

Change-Id: Ib6fccc82583d09a44c16b3ca04e1a40f6b68bfb3
Reviewed-on: https://gerrit.chromium.org/gerrit/18637
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

2 years agofirmware-updater: Speed up flashrom writing. factory-1987.B release-R18-1660.B
Hung-Te Lin [Tue, 10 Jan 2012 07:09:45 +0000 (15:09 +0800)]
firmware-updater: Speed up flashrom writing.

flashrom has new "--fast-verify" command and speeds up writing time.
Redundant flashrom options are also removed (ex, TARGET_MAIN_OPT) from
individual updaters.

BUG=chromium-os:21943
TEST=time chromeos-firmwareupdate --mode=autoupdate --force
     # For partial update on Stumpy without any real changes, the time has
     # reduced from 23s to 17s
Change-Id: I9ea7f6d206d40be4b0c3bf3c72d6ebe1aa8ccc77
Reviewed-on: https://gerrit.chromium.org/gerrit/14154
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
2 years agofirmware-updater: Improve write protection reporting
Hung-Te Lin [Wed, 18 Jan 2012 07:46:05 +0000 (15:46 +0800)]
firmware-updater: Improve write protection reporting

It's confusing when firmware updater only reports hardware write protection
state without software status. This CL tries to report all (hardware switch,
software main/ec register) write protections in a better format.

BUG=chromium-os:21943
TEST=chromeos-firmwareupdate --mode=todev
     # See message: - Write protection: Hardware: ON, Software: Main=off EC=ON

Change-Id: Ie5662a4dab882d07dbd5b30b4ec8c0001d911e51
Reviewed-on: https://gerrit.chromium.org/gerrit/14371
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

2 years agofirmware-updater: cleanup scripts
Hung-Te Lin [Wed, 18 Jan 2012 07:56:25 +0000 (15:56 +0800)]
firmware-updater: cleanup scripts

"die" is a more common function name in shell scripts. We should use "die"
instead of "err_die".

inherit-review-settings-ok is a deprecated file for previous review system,
so it's time to remove that file.

Some debug messages (ex, cros_compare_file) have been also revised.

BUG=chromium-os:21943
TEST=chromeos-firmwareupdate --mode=autoupdate

Change-Id: I8e0c5287c9d17f8062e79d08dc9940b350851da6
Reviewed-on: https://gerrit.chromium.org/gerrit/14374
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

2 years agochromeos-firmware: Don't preserve bitmaps for updater v3+.
Hung-Te Lin [Wed, 21 Dec 2011 10:11:30 +0000 (18:11 +0800)]
chromeos-firmware: Don't preserve bitmaps for updater v3+.

Since v3, firmware can render HWID directly so official firmware should carry
its own bitmaps; no need to preserve bitmaps anymore.

BUG=chrome-os-partner:7328,chrome-os-partner:7171
TEST=chromeos-firmwareupdate --mode=recovery

Change-Id: I198b12c6eee107e4b5d7624aa88407dfa77b3713
Reviewed-on: https://gerrit.chromium.org/gerrit/13331
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2 years agofirmware-updater: Fix EC version ID matching for mosys r430+
Hung-Te Lin [Mon, 19 Dec 2011 05:49:41 +0000 (13:49 +0800)]
firmware-updater: Fix EC version ID matching for mosys r430+

Trailng spaces in EC firmware version string will be scrubbed by mosys since
r430.  We need to fix this in updater record.

BUG=chromium-os:24365
TEST=emerge-x86-alex chromeos-firmware-alex
     # EC version string does not contain trailing spaces.

Change-Id: Ic8bd63ce26b422fbba9fb005d382740ce7a7bb67
Reviewed-on: https://gerrit.chromium.org/gerrit/13133
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2 years agofirmware-updater: Ignore FMAP for old EC binary images (ex, CR48)
Hung-Te Lin [Mon, 19 Dec 2011 09:35:15 +0000 (17:35 +0800)]
firmware-updater: Ignore FMAP for old EC binary images (ex, CR48)

When reading images without FMAP (and overriding with layout files), we should
add --ignore-fmap option when calling flashrom.

BUG=chrome-os-partner:7260
TEST=chromeos-firmwareupdate --mode=startup # on Mario, EC updates correctly.

Change-Id: I258ef1b5f6a10ae761c822fba443b53c19f62df9
Reviewed-on: https://gerrit.chromium.org/gerrit/13136
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2 years agofirmware-updater: add a simplified updater for v1 platforms (Mario).
Hung-Te Lin [Thu, 15 Dec 2011 09:24:12 +0000 (17:24 +0800)]
firmware-updater: add a simplified updater for v1 platforms (Mario).

Modified from v3 updater with simplified rules for v1.

BUG=chrome-os-partner:1767
TEST=chromeos-firmwareupdate --mode=autoupdate # see startup updates scheduled
     chromeos-firmwareupdate --mode=startup # updates EC
     chromeos-firmwareupdate --mode=bootok # do nothing
     chromeos-firmwareupdate --mode=recovery # overwrite both EC and BIOS RW A/B

Change-Id: I246f949282fff78c3ccaa874189d6e7dd6791015
Reviewed-on: https://gerrit.chromium.org/gerrit/12976
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2 years agofirmware-updater: Clean recovery and incorrect cookies after setup.
Hung-Te Lin [Fri, 16 Dec 2011 04:34:00 +0000 (12:34 +0800)]
firmware-updater: Clean recovery and incorrect cookies after setup.

Some cookies (ex, recovery_request) stored in CMOS/NVRAM may cause factory
installation to enter recovery screen after reboot.

To prevent that, (and to clear any unexpected NVData caused by non-chrome
firmware transition), we add "crossystem recovery_request=0" when clearing
update cookies, and do "mosys nvram clear" after factory installation.

BUG=chrome-os-partner:6990
TEST=Non-chromeos firmware:
       chromeos-firmwareupdate --mode=factory_install
       reboot  # not seeing recovery screen
     Already using chromeos firmware.
       crossystem recovery_request=1
       chromeos-firmwareupdate --mode=factory_install
       crossystem recovery_request  # see 0
       reboot  # not seeing recovery screen

Change-Id: I3fd306e405b857d8a3117012c20ef75ebc22b4d7
Reviewed-on: https://gerrit.chromium.org/gerrit/13075
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2 years agofirmware-updater: Preserve VPD in more fault-tolerance way.
Hung-Te Lin [Thu, 15 Dec 2011 05:37:44 +0000 (13:37 +0800)]
firmware-updater: Preserve VPD in more fault-tolerance way.

When the system active firmware has FMAP, we should trust it and preserve VPD
from that; if the firmware (ex, non-chrome) does not have FMAP, use the FMAP
from target image.

And for all cases, check if the VPD partition is valid; otherwise reset it.

BUG=chrome-os-partner:7185
TEST=Prepare two incompatible firmware: (ex, H2O v.s. H2C or *boot)
     that VPD is located in different location (examples in 7185);
     Set some VPD values (vpd -i RO_VPD -s a=b);
     Run chromeos-firmwareupdate --mode=factory_install;
     Then, reboot and verify if VPD is preserved correctly (vpd -i RO_VPD -l)

Change-Id: I2f6cfc4275c25c342d6fc93fe5c2c14fc4a89fd7
Reviewed-on: https://gerrit.chromium.org/gerrit/12974
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2 years agochromeos-firmware: improve key/TPM checking error reports
Hung-Te Lin [Thu, 8 Dec 2011 03:38:32 +0000 (11:38 +0800)]
chromeos-firmware: improve key/TPM checking error reports

BUG=chromium-os:23825
TEST=manual
     1. remove TARGET_UNSTABLE="TRUE" flag
     2. chromeos-firmwareupdate --mode=autoupdate # on devices with different
        TPM / rootkey
     3. see new messages

Change-Id: Ic988b0707cd76ab10fe6dd4f6cc7f3af6e9278e1
Reviewed-on: https://gerrit.chromium.org/gerrit/12607
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

2 years agofirmware-updater: fix typo in alert messages
Hung-Te Lin [Wed, 7 Dec 2011 04:18:19 +0000 (12:18 +0800)]
firmware-updater: fix typo in alert messages

A typo is found when checking issue chromium-os:23817 (This is a CL to improve
the error message in that issue, not the one to fix it).

BUG=chromium-os:23817
TEST=chromeos-firmwareupdate --mode=recovery # on a system with older TPM version

Change-Id: I813b0b87c995ce1d71822d455e808fef25b6ed16
Reviewed-on: https://gerrit.chromium.org/gerrit/12531
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2 years agochromeos-firmware: prevent non-chrome transition error in factory installation
Hung-Te Lin [Tue, 6 Dec 2011 01:25:57 +0000 (09:25 +0800)]
chromeos-firmware: prevent non-chrome transition error in factory installation

crossystem commands may fail if the firmware is nonchrome, even for setting
NVRAM variables.  To solve this in factory installation, we need to ignore
return values in that case.

BUG=chrome-os-partner:7082
TEST=chromeos-firmwareupdate --mode=factory # within nonChrome firmware

Change-Id: I6e9986b5ae58db0811013ac7136549d2031110cf
Reviewed-on: https://gerrit.chromium.org/gerrit/12476
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2 years agofirmware_updater: allow preserving GBB flags in RO updates
Hung-Te Lin [Fri, 2 Dec 2011 04:13:48 +0000 (12:13 +0800)]
firmware_updater: allow preserving GBB flags in RO updates

For developers testing unstable firmware, we always update in RO+RW mode;
that will overwrite GBB, which may be a problem if the default firmware is using
factory-setting flags (ex, 0x0001).

This CL allows preserving GBB flags in RO-update modes (recovery,
autoupdate[RO], incompatible) and still overwriting flags in factory mode.

BUG=chrome-os-partner:7047
TEST=1. make sure GBB flag is zero
        (flashrom -i GBB -r bios.bin; gbb_utility --flags bios.bin)
     2. chromeos-firmwareupdate --mode=autoupdate
     3. Check GBB flags again. It should be still zero.

Change-Id: Ib065ad683e5837af39d92ed442faf5dc2dee9087
Reviewed-on: https://gerrit.chromium.org/gerrit/12369
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2 years agochromeos-firmwareupdate: support new dev_boot_signed_only option.
Hung-Te Lin [Fri, 18 Nov 2011 03:57:38 +0000 (11:57 +0800)]
chromeos-firmwareupdate: support new dev_boot_signed_only option.

To make firmware updater work with latest crossystem change -
renamed (and changed polarity) option dev_boot_custom to dev_boot_signed_only.

BUG=chrome-os-partner:5954
TEST=chromeos-firmwareupdate --mode=todev # ctrl-u works for self-signed kernel

Change-Id: I8e913646c7cd4362807656e0e669a39935a008dd
Reviewed-on: https://gerrit.chromium.org/gerrit/11894
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2 years agochromeos-firmwareupdate: support new dev_boot_custom option.
Hung-Te Lin [Thu, 17 Nov 2011 05:13:39 +0000 (13:13 +0800)]
chromeos-firmwareupdate: support new dev_boot_custom option.

Without setting dev_boot_custom, some version of firmware won't boot self-signed
kernels on USB, even SSD.

BUG=chrome-os-partner:5954
TEST=chromeos-firmwareupdate --mode=todev # ctrl-u works

Change-Id: I8e9ce8cab4cbebf4e1cfbdea625f1f75caa5c206
Reviewed-on: https://gerrit.chromium.org/gerrit/11839
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2 years agofirmware: fix vblock comparison in v3 updater
Hung-Te Lin [Thu, 10 Nov 2011 03:56:24 +0000 (11:56 +0800)]
firmware: fix vblock comparison in v3 updater

The 'need_update_main_vblock' should return true if is_equal_slot returns false

BUG=none, found during sanity check
TEST=chromeos-firmwareupdate --mode=autoupdate

Change-Id: Iafd268490c8b5c04dd56b159aeeeeb79d1d84987
Reviewed-on: https://gerrit.chromium.org/gerrit/11463
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

2 years agofirmware: fix write protection test when EC is not available factory-1284.B firmware-kiev-2.112.B firmware-uboot_v2-1299.B
Hung-Te Lin [Fri, 28 Oct 2011 03:10:02 +0000 (11:10 +0800)]
firmware: fix write protection test when EC is not available

When EC is not available (or FLAGS_update_ec is FALSE), we should not do any
EC write protection test. Previous code will return early whenever EC is not
available.

BUG=chrome-os-partner:6660
TEST=(on stumpy) chromeos-firmwareupdate --mode=factory  # success

Change-Id: I174092daf5d30b417e09eb718da0d1011a9b5034
Reviewed-on: https://gerrit.chromium.org/gerrit/10837
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2 years agoChange to use new location of shflags factory-1235.B
Sonny Rao [Fri, 21 Oct 2011 09:22:09 +0000 (09:22 +0000)]
Change to use new location of shflags

BUG=chromium-os:21742
TEST=manual verify this works with new dev-utils/shflags package

Change-Id: Ia56251ee44708f76a747281bf9f0f10275541840
Reviewed-on: http://gerrit.chromium.org/gerrit/10481
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Ready: Sonny Rao <sonnyrao@chromium.org>
Tested-by: Sonny Rao <sonnyrao@chromium.org>
2 years agofirmware: support updating EC in updater v3 (two-stop firmware)
Hung-Te Lin [Wed, 19 Oct 2011 11:06:13 +0000 (19:06 +0800)]
firmware: support updating EC in updater v3 (two-stop firmware)

BUG=chromium-os:21840
TEST=emerge-* chromeos-firmware-*; # platform having two-stop firmware with EC
     chromeos-firmwareupdate --mode=autoupdate
     chromeos-firmwareupdate --mode=recovery
     chromeos-firmwareupdate --mode=startup

Change-Id: I056e76c3e6d04cbde319e701969886fe14261086
Reviewed-on: http://gerrit.chromium.org/gerrit/10293
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>

2 years agofirmware: check each firmware only if ID is different release-R16-1193.B
Hung-Te Lin [Fri, 30 Sep 2011 02:06:35 +0000 (10:06 +0800)]
firmware: check each firmware only if ID is different

If EC is changed, BIOS will be also checked for bit-by-bit comparison without
this CL.  We should only check and update firmware if its ID is different for
v2 vboot.

BUG=chromium-os:20978
TEST=emerge-x86-zgb chromeos-firmware-zgb

Change-Id: I13dd3a4083d88d0c5a0f6816de03d29aa43203e6
Reviewed-on: http://gerrit.chromium.org/gerrit/8539
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2 years agofirmware: show resource extracting destination path
Hung-Te Lin [Tue, 4 Oct 2011 00:02:09 +0000 (08:02 +0800)]
firmware: show resource extracting destination path

BUG=chrome-os-partner:6201
TEST=emerge-x86-zgb chromeos-firmware-zgb
     chromeos-firmwareupdate --sb_extract # see Extracting to: /tmp/tmp.D9Zkdq3WwS

Change-Id: Ie24ea0809ef75a135b1120827aa4e5d728b23e66
Reviewed-on: http://gerrit.chromium.org/gerrit/8713
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2 years agofirmware: when extracting, re-invoke updater itself with sh
Hung-Te Lin [Wed, 28 Sep 2011 06:45:45 +0000 (14:45 +0800)]
firmware: when extracting, re-invoke updater itself with sh

On most Chromebooks, /tmp (and stateful partition) are mounted as noexec by
default; developers used to copy updater from USB stick into /tmp and then do
"sh ./chromeos-firmwareupdate --XXX".  Self extraction (calling $SELF) will
cause permission denied in this case.

Since the pack_stub clearly knows it self as shell script, we can fix that by
adding "sh" before starting self extraction.

BUG=chromium-os:20027
TEST=copy updater to /tmp on a Chromebook without remounting /tmp,
     run "sh ./chromeos-firmware --mode=recovery"  # success

Change-Id: I9a7b33a9a9f4878c9f659ff4751a6e4078a7e088
Reviewed-on: http://gerrit.chromium.org/gerrit/8408
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2 years agofirmware: use shar to replace tar+gz, for better AU delta generation
Hung-Te Lin [Sat, 3 Sep 2011 10:22:27 +0000 (18:22 +0800)]
firmware: use shar to replace tar+gz, for better AU delta generation

The firmware updater was using tar+gz to create an archive bundle for firmware
image, supporting programs and scripts. However time stamps and compression in
tar+gz caused OS AU delta generation to have problem creating minimized diff
output.

This CL replaced tar+gz with "shar" so that changes in each individual file
won't affect other files (especially that the largest blob, main firmware image,
usually don't change).

Compare "bsdiff" result for two builds without changing contents in firmware
updater:
 - Before this CL, diff size = 1905142 bytes
 - After this CL, diff size = 255 bytes

BUG=chromium-os:20027
TEST=emrege-x86-zgb chromeos-firmware-zgb
     ./chromeos-firmware --sb_extract . # see files extracted in place
     ./chromeos-firmware --sb_repack /tmp/xxx # files in bundle updated
     ./chromeos-firmware --mode=recovery # works as normal

Change-Id: I3a4c8f0c636c0c4f22eede59911039c4b7c46994
Reviewed-on: http://gerrit.chromium.org/gerrit/7310
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2 years agofirmware: make --allow_reboot a global option and allow "reboot" to be hooked.
Hung-Te Lin [Wed, 14 Sep 2011 10:52:06 +0000 (18:52 +0800)]
firmware: make --allow_reboot a global option and allow "reboot" to be hooked.

There are several requests (from FAFT and factory/RMA) to allow changing
firmware into developer mode without rebooting. We should provide a parameter so
that people can prevent reboots and make their special test.

BUG=chromium-os:19710
TEST=(zgb) chromeos-firmwareupdate --mode=todev # rebooted
           chromeos-firmwareupdate --mode=todev --noallow_reboot # not rebooted

Change-Id: I3da71810df7e10530675bcfb0e972950ed5fd702
Reviewed-on: http://gerrit.chromium.org/gerrit/7700
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2 years agoFirmware updater should show the target EC version correctly factory-1020.B release-1011.B
Jay Kim [Sat, 3 Sep 2011 00:49:32 +0000 (17:49 -0700)]
Firmware updater should show the target EC version correctly

Move the verbose_msg lines to display the firmware version after calling
updater_custom_main since the $TARGET_ECID can be updated in the
updater_custom_main.

BUG=chrome-os-partner:5817
TEST=Run chromeos-firmwareupdate and see if it can show a correct
version of EC firmware on board and shellball

Change-Id: I2e6c1a5b2e41412e8e8f8619d865245922a794b3
Reviewed-on: http://gerrit.chromium.org/gerrit/7235
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Tested-by: Jay Kim <yongjaek@chromium.org>
2 years agofirmware: clean up firmware updater packaging content factory-980.B test-982.B
Hung-Te Lin [Wed, 31 Aug 2011 04:00:36 +0000 (12:00 +0800)]
firmware: clean up firmware updater packaging content

Since updater[n].sh is versioned and no dependency with each other, we should
remove inactivate updater scripts to minimize the output updater.

BUG=chromium-os:17296
TEST=emerge-x86-alex chromeos-firmware-alex
     # see only updater2.sh in output updater, no updater[13].sh

Change-Id: I204003d115fcf0f8ec1d490f68d1d207ef75ed8a
Reviewed-on: http://gerrit.chromium.org/gerrit/6978
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
3 years agofirmware: check firmware preamble flag and warn if FWID won't be changed
Hung-Te Lin [Mon, 22 Aug 2011 13:36:06 +0000 (21:36 +0800)]
firmware: check firmware preamble flag and warn if FWID won't be changed

If write protection is enabled and preamble flag is marked as "RO-NORMAL",
FWID won't change even after we've updated the RW firmware sections because that
will be a "key block only" update.

Since this may be confusing, this CL checks that and warn user in log.

BUG=chrome-os-partner:5507
TEST=(on aebl) chromeos-firmwareupdate --mode=autoupdate

Change-Id: Ibd7c69ace3cdaf7d8dbb021c5d0cd3b3ca01751d
Reviewed-on: http://gerrit.chromium.org/gerrit/6398
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
3 years agofirmware: refine firmware updater branch layout
Hung-Te Lin [Mon, 22 Aug 2011 12:20:27 +0000 (20:20 +0800)]
firmware: refine firmware updater branch layout

To make firmware updater work better with further firmware/vboot design
changes, this CL tries to make the updater branches more organized.

- updaters are now labeled with vboot/firmware protocol in numeric version.
  (updater1 replaced legacy_updater.sh)
- behavior and output messages synchronization for updater v2/v3

This is part of preparation for new firmware updater.

BUG=chromium-os:19453,chromium-os:18002,chromium-os:17296
TEST=emerge-x86-zgb chromeos-firmware-zgb
     emerge-tegra2_aebl chromeos-firmware-aebl

Change-Id: I9713b4616499a5c0f2773f31af4be46372ae7367
Reviewed-on: http://gerrit.chromium.org/gerrit/6397
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
3 years agofirmware-updater: disable "autoupdate" path on legacy system
Hung-Te Lin [Tue, 16 Aug 2011 01:50:30 +0000 (09:50 +0800)]
firmware-updater: disable "autoupdate" path on legacy system

We want to prevent any further update checks on legacy (v1, like Mario) systems
and still have recovery mode (update RW sections) working.

BUG=chromium-os:19083
TEST=chromeos-firmwareupdate --mode=autoudpate # exits silently
     chromeos-firmwareupdate --mode=startup # exits silently
     chromeos-firmwareupdate --mode=recovery # works as usual
     chromeos-firmwareupdate --mode=factory_install # works as usual

Change-Id: Iba9a4bed1473736c0ab50bd2add5b93a420fb43f
Reviewed-on: http://gerrit.chromium.org/gerrit/6047
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
3 years agofirmware updater: add "gbb_utility" into bundled programs 0.15.877.B firmware-881-u-boot-v1 firmware-u-boot-v1
Hung-Te Lin [Fri, 5 Aug 2011 03:19:58 +0000 (11:19 +0800)]
firmware updater: add "gbb_utility" into bundled programs

The gbb_utility was changed and being incompatible on certain old systems. We
should include that in the bundled programs.

BUG=chromium-os:18752
TEST=emerge-tegra2-XXX chromeos-firmware-XXX
     # seeing gbb_utility in output list

Change-Id: Id93029a768dc4b0a77f3caee9c4547c900c783fe
Reviewed-on: http://gerrit.chromium.org/gerrit/5368
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
3 years agofirmware: fix updater v3 behavior for developer mode.
Hung-Te Lin [Wed, 27 Jul 2011 01:52:01 +0000 (09:52 +0800)]
firmware: fix updater v3 behavior for developer mode.

The "developer mode" in two-stop design is different.

In v2 design: devsw=1, devfw=0: "root-shell", allow autoupdates.
              devsw=1, devfw=1: "developer mode, no autoupdates.
In two-stop: Whenever devsw=1, devfw=1.

However since we do want to allow updating in root-shell mode,
two-stop should perform autoupdates in developer mode.

factory_final, in this design, also becomes an empty command.

BUG=chromium-os:17296
TEST=(turn on developer mode) ./chromeos-firmwareupdate --mode=autoupdate

Change-Id: I60c7664f544b3a961cb4e29bea5b9329d5e9bd5c
Reviewed-on: http://gerrit.chromium.org/gerrit/4783
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
3 years agofirmware: updater v3
Hung-Te Lin [Sat, 23 Jul 2011 13:34:25 +0000 (21:34 +0800)]
firmware: updater v3

The new firmware updater, designed for:
 - Two-stop firmware design
 - Only main firmware (no EC)
 - No need to update RO at startup (assuming no sleep/resume issue)

BUG=chromium-os:17296
TEST=./chromeos-firmwareupdate --mode=startup # nothing
     ./chromeos-firmwareupdate --mode=todev # crossystem dev_boot_usb => 1
     ./chromeos-firmwareupdate --mode=tonormal # crossystem dev_boot_usb => 0
     ./chromeos-firmwareupdate --mode=factory_final # same as tonormal
     ./chromeos-firmwareupdate --mode=factory # flashrom whole file
     ./chromeos-firmwareupdate --mode=bootok # see dup A to B
     ./chromeos-firwmareupdate --mode=recovery
     # full copy if not write-protected, otherwise RW A+B+SHARED
     ./chromeos-firmwareupdate --mode=autoupdate
     # copy RW_SECTION_B to slot B

Change-Id: If7180c8a71c81c4641c54ed0f0fd343b075da736
Reviewed-on: http://gerrit.chromium.org/gerrit/4634
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
3 years agofirmware: fix checking write protection for incompatible updates 0.14.811.B
Hung-Te Lin [Sat, 23 Jul 2011 02:34:34 +0000 (10:34 +0800)]
firmware: fix checking write protection for incompatible updates

When running incompatible updates, we should only abort if write protection is
enabled and cannot be disabled.

BUG=chromium-os:18072
TEST=(disable wp) chromeos-firmwareupdate --force --mode=incompatible_update

Change-Id: I9757c752d6f67cb11d10e0d056f52de4e379ab37
Reviewed-on: http://gerrit.chromium.org/gerrit/4631
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
3 years agofirmware: fix --mode=todev for non-two-stop firmware
Hung-Te Lin [Sat, 23 Jul 2011 00:26:39 +0000 (08:26 +0800)]
firmware: fix --mode=todev for non-two-stop firmware

A missing part when running with non-two-stop firmware

BUG=chrome-os-partner:5108
TEST=chromeos-firmwareupdate --force --mode=todev # on ZGB

Change-Id: I3a0a17fd57d7e03643405cc2a0e53e50e2260fd0
Reviewed-on: http://gerrit.chromium.org/gerrit/4626
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
3 years agofirmware: ignore errors when clearing updater cookies
Hung-Te Lin [Fri, 22 Jul 2011 13:15:04 +0000 (21:15 +0800)]
firmware: ignore errors when clearing updater cookies

The factory_install and recovery mode of firmware updater may be executed on
systems with legacy firmware or broken crossytem, which caused all clear_cookie
commands to fail. We should ignore such errors.

BUG=chromium-os:18053
TEST=create updater, put into factory (make_factory_package --firmware XXX)
     and then pass installation with systems having legacy firmware installed

Change-Id: I8b1922edd0469dfe1f0b7aff8bdd57cc311da094
Reviewed-on: http://gerrit.chromium.org/gerrit/4575
Reviewed-by: Rong Chang <rongchang@chromium.org>
Tested-by: Rong Chang <rongchang@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
3 years agofirmware: allow todev in two_stop firmware even if firmware is incompatible
Hung-Te Lin [Fri, 22 Jul 2011 05:10:18 +0000 (13:10 +0800)]
firmware: allow todev in two_stop firmware even if firmware is incompatible

In two_stop firmware, todev/tonormal does not need to update firmware image; so
it's free to invoke even if the firmware itself is not compatible.

todev/tonormal should also clear the updater cookies in two-stop mode.

BUG=chromium-os:18012, chromium-os:18002
TEST=chromeos-firmwareupdate --mode=todev

Change-Id: I864594386a40e4dd554b3b78b3308f45980ba59d
Reviewed-on: http://gerrit.chromium.org/gerrit/4553
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
3 years agofirmware: refine and prepare for new updater
Hung-Te Lin [Wed, 6 Jul 2011 13:28:11 +0000 (21:28 +0800)]
firmware: refine and prepare for new updater

- Cleanup for next next generation of firmware updater.
- Add --script and --unstable for ebuild to assign platform-specific information
  without using customization file and hard coding platform names
- Merge --mode=incompatible and --mode=recovery, and let recovery automatically
  decide how to update firmware (RO or RO+RW).
- Move the logic from firmware-factory-wipe into --mode=factory_final to support
  two-stop firmware

BUG=chromium-os:17296
TEST=./chromeos-firmware --mode=todev
     ./chromeos-firmware --mode=autoupdate
     ./chromeos-firmware --mode=recovery
Change-Id: I8eec63183ad1a3026654be998bf7eee788445ab6
Reviewed-on: http://gerrit.chromium.org/gerrit/4484
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
3 years agofirmware: support two-stop style firmware "todev" mode (enable ctrl-u).
Hung-Te Lin [Thu, 21 Jul 2011 08:50:26 +0000 (16:50 +0800)]
firmware: support two-stop style firmware "todev" mode (enable ctrl-u).

For systems supporting two-stop, firmware updater should simply execute
crossystem dev_boot_usb=1 and then exit without reboot.

BUG=chromium-os:17857,chrome-os-partner:4745
TEST=(on aebl) ./chromeos-firmware --force --mode=todev # see Ctrl-U info
     (on zgb) ./chromeos-firmware --force --mode=todev # see update and then reboot

Change-Id: I34158a393a0e7843131620ea8380e0c15ae6af4b
Reviewed-on: http://gerrit.chromium.org/gerrit/4480
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
3 years agofirmware: fix usage help messages
Hung-Te Lin [Thu, 21 Jul 2011 02:50:52 +0000 (10:50 +0800)]
firmware: fix usage help messages

The usage of firmware updater was confusing. We should always provide complete
usage help and prevent --help being blocked by --force check.

BUG=chromium-os:17365
TEST=./chromeos-firmwareupdate --help  # seeing complete usage help
     ./chromeos-firmwareupdate -- --help # seeing updater usage or blocked by no --force
     ./chromeos-firmwareupdate --force --help # seeing updater usage and updater ends with failure.
     ./chromeos-firmwareupdate --force -- --help # error as expected

Change-Id: If3622f41242b16502732c787e46dfdaf3b8633df
Reviewed-on: http://gerrit.chromium.org/gerrit/4468
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
3 years agofirmware: improve error message when failed to preserve VPD
Hung-Te Lin [Mon, 18 Jul 2011 07:23:33 +0000 (15:23 +0800)]
firmware: improve error message when failed to preserve VPD

The error messages in preserve_vpd was confusing and having typos.
This CL checks...
 - check if current system firmware is zero bytes in size
 - if the size of firmware image is incompatible
 - hint the "target firmwre" may be invalid

BUG=chromium-os:17646
TEST=emerge-tegra2_aebl chromeos-firmware-tegra2

Change-Id: Ia7adbb6d5ba8f67e5e5e40b4c359a35be93a8e36
Reviewed-on: http://gerrit.chromium.org/gerrit/4247
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
3 years agofirmware: fix error when update-engine is not started. 780.B
Hung-Te Lin [Thu, 19 May 2011 17:35:04 +0000 (01:35 +0800)]
firmware: fix error when update-engine is not started.

BUG=none, found during last test
TEST=initctl stop update-engine; chromeos-firmwareupdate --mode=todev

Change-Id: I48ffd4c2bbbbb4c44ed80a70ffaa56895c4a75ec
Reviewed-on: http://gerrit.chromium.org/gerrit/3675
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
3 years agochromeos-firmware: check TPM keys before updating firmware
Hung-Te Lin [Wed, 8 Jun 2011 12:26:35 +0000 (20:26 +0800)]
chromeos-firmware: check TPM keys before updating firmware

Updating a firmware image with keys older than the key version stored in TPM
would cause "rollback" failure and unable to boot system.

To preven that, we should check firmware key before updating system.

BUG=chrome-os-partner:2817
TEST=verified on z*.
     (first install fw key v2): updating would fail
     (re-key with key v1): updating would success

Change-Id: I50cde54c8079c51c840522b0bfe41c7a43405e30
Reviewed-on: http://gerrit.chromium.org/gerrit/2291
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
3 years agoFW: When booted from FW slot B, return 3, not 2, as magic number.
Andrew de los Reyes [Mon, 13 Jun 2011 22:38:01 +0000 (15:38 -0700)]
FW: When booted from FW slot B, return 3, not 2, as magic number.

This will clue the updater in that we booted from FW slot B.

BUG=chromium-os:14343
TEST=on device test

Change-Id: Ia322bce3291d1789d674d3ba33f0b8a3b790bd44
Reviewed-on: http://gerrit.chromium.org/gerrit/2561
Tested-by: Andrew de los Reyes <adlr@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
3 years agofirmware: correctly log failed fw update
Andrew de los Reyes [Wed, 8 Jun 2011 20:20:10 +0000 (13:20 -0700)]
firmware: correctly log failed fw update

The old code is incorrect in the presense of "set -e"

BUG=chromium-os:14343
TEST=on device test

Change-Id: Ieef35422badfbbc9a95f62f2df3b52f5fc727c40
Reviewed-on: http://gerrit.chromium.org/gerrit/2305
Tested-by: Andrew de los Reyes <adlr@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
3 years agoFW Updater: propogate return code in pack_stub
Andrew de los Reyes [Tue, 7 Jun 2011 16:05:07 +0000 (09:05 -0700)]
FW Updater: propogate return code in pack_stub

This is necessary, because the firmware updater returns 3 if the
machine booted from FW slot B, and this needs to get back to the
updater.

BUG=chromium-os:14343
TEST=on device test

Change-Id: I1021f27edf99ff29d870adabbc39cf9677a048d0
Reviewed-on: http://gerrit.chromium.org/gerrit/2218
Tested-by: Andrew de los Reyes <adlr@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
3 years agochromeos-firmware: make platform checking a pre-defined variable 0.13.558.B
Hung-Te Lin [Thu, 19 May 2011 12:12:28 +0000 (20:12 +0800)]
chromeos-firmware: make platform checking a pre-defined variable

The platform checking in firmware updater needs a more reliable approach;
and this CL makes (FWID, ECID, PLATFORM) collected in a unified way.

"autoupdate" checking in stub was also moved to inside the updater itself,
to prevent redundant checks, also removing the dependency of external programs
in stub.

BUG=chrome-os-partner:3943,chromium-os:14934
TEST=built a firmware with wrong platform;
     then chromeos-firmwareupdate # seeing platform warning
     add --nocheck_platform # update starts
     run with same FWID # update passed without doing anything
     run with different FWID # seeing updater to run
     (on Mario) run # seeing legacy update message

Change-Id: I3bfd9e752bbb27b7195b854f9e5ed821e93ec3f1
Reviewed-on: http://gerrit.chromium.org/gerrit/1175
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
3 years agoUse space in addition to dot as separators of PLATFORM name from fwid.
Tom Wai-Hong Tam [Wed, 18 May 2011 10:36:12 +0000 (18:36 +0800)]
Use space in addition to dot as separators of PLATFORM name from fwid.

Since ARM fwid is something like "U-Boot 2010.09 (May 18 2011 - 12:48:56)".

BUG=15248
TEST=Run firmware updater on ARM. It runs normally.

Change-Id: I1c1b21c1b78aa1b38eaf98dc8ee220ab8d85e5be
Reviewed-on: http://gerrit.chromium.org/gerrit/1106
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
3 years agochromeos-firmware: improve the speed of mode=bootok (dup2)
Hung-Te Lin [Tue, 17 May 2011 02:45:41 +0000 (10:45 +0800)]
chromeos-firmware: improve the speed of mode=bootok (dup2)

By the design of flashrom, reading is faster than writing, even if there's no
actual write operations. So in the updater side, we should check if we really
need to perform writing before invoking flashrom.

BUG=chrome-os-partner:3832
TEST=# prepare firmware so that slot A = B
     (old updater) time chromeos-firmwareupdate --mode=bootok # 12.7s
     (new updater) time chromeos-firmwareupdate --mode=bootok # 3.4s

Change-Id: I6606639df68e6c245203f7bb29ab96a2513ef8b7
Reviewed-on: http://gerrit.chromium.org/gerrit/979
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
3 years agofirmware: cleanup stub loader: move CR48 logic to main legacy script
Hung-Te Lin [Thu, 5 May 2011 16:43:40 +0000 (00:43 +0800)]
firmware: cleanup stub loader: move CR48 logic to main legacy script

The workaround in stub can be executed inside the legacy updater,
so we should move it to simplify the stub loader.

BUG=chromium-os:14934
TEST=emerge-x86-* chromeos-firmware; # success
     chromeos-firmwareupdate; # on CR48, see the workaround executed

Change-Id: Idc0dba079b43e23d63733ea625ec4595652d2701
Reviewed-on: http://gerrit.chromium.org/gerrit/345
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
3 years agofirmware: refine firmware-factory-wipe to minimize disk access
Hung-Te Lin [Thu, 5 May 2011 12:27:08 +0000 (20:27 +0800)]
firmware: refine firmware-factory-wipe to minimize disk access

By using the new flashrom with FMAP support, we can disacrd all dd and
processing.

Execution time is reduced from 50 seconds to 23 seconds.

BUG=chromium-os:14942
TEST=time firmware-factory-wipe # 23 seconds

Change-Id: I857214b1e9f20f394ec1151e7b799b1baa5edaa4
Reviewed-on: http://gerrit.chromium.org/gerrit/333
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
3 years agopass on --force to the actual updater script. 53/353/2
Stefan Reinauer [Thu, 5 May 2011 18:28:01 +0000 (11:28 -0700)]
pass on --force to the actual updater script.

Change-Id: Icbdb52f12b57f02be933c49fde4f35cbec32c54c

3 years agofirmware: preserve VPD in factory / incompatibe update modes 77/277/3
Hung-Te Lin [Wed, 4 May 2011 16:30:36 +0000 (00:30 +0800)]
firmware: preserve VPD in factory / incompatibe update modes

Firmware updating should always preserve the content in RO/RW VPD area.

BUG=chrome-os-partner:3540
TEST=vpd -i RO_VPD -s ro=1; vpd -i RW_VPD -s rw=2;
     vpd -l # put some value
     flashrom -r bios_old.bin; # for backup
     ./updater --mode=factory; vpd -l # see values not changed
     flashrom -r bios_new.bin; # new firmware
     (mkdir old; cd old; dump_fmap -x ../bios_old.bin)
     (mkdir new; cd new; dump_fmap -x ../bios_new.bin)
     for X in old/*; do cmp "$X" "new/$(basnema $X)" || echo "diff"; done
     # seeing only RO_VPD and RW_VPD are different

Change-Id: I05ffb907e246d0243c3af3d9c318dc604d9834d4

3 years agofix mode=autoupdate on CR48
Stefan Reinauer [Sat, 30 Apr 2011 00:41:09 +0000 (17:41 -0700)]
fix  mode=autoupdate on CR48

Change-Id: I7a260a1c3e6f0f4e673365cf8b65d9e869aabfa6

BUG=chromium-os:14654
TEST=chromeos-firmwareupdate --mode=autoupdate on Cr-48

Review URL: http://codereview.chromium.org/6880299

3 years agoinit: replace "reboot_mode" by crossystem
Hung-Te Lin [Wed, 27 Apr 2011 02:51:12 +0000 (10:51 +0800)]
init: replace "reboot_mode" by crossystem

Clean up to prepare removing "reboot_mode" utility.

BUG=chromium-os:11748
TEST=none, simply clean up

Change-Id: I6b275a47730cc4522e8ff95e9adf6d2518b3255d

R=rspangler@chromium.org

Review URL: http://codereview.chromium.org/6903028

3 years agochromeos-firmware: detect and assign EC version information by image content 0.13.434.B
Hung-Te Lin [Thu, 21 Apr 2011 01:46:59 +0000 (09:46 +0800)]
chromeos-firmware: detect and assign EC version information by image content

In the future EC will contian "RO_FRID" section.
We should always trust it if available, and fallack to assigned param if that
does not exist.

BUG=chromium-os:14195
TEST=emerge-x86-XXXX chromeos-firmware; # seeing current FRID is not corrupted.

Change-Id: I352f144eaae58f08362e4621be3442cc79a51500

R=reinauer@chromium.org,yjlou@chromium.org

Review URL: http://codereview.chromium.org/6881080

3 years agocall the version comparison too, but don't bail out.
Stefan Reinauer [Thu, 21 Apr 2011 00:11:55 +0000 (17:11 -0700)]
call the version comparison too, but don't bail out.

Change-Id: I53ea5a2e45db09ea3650c75dedb323099e101d9e

R=rspangler@google.com,adlr@google.com,hungte@google.com
BUG=chrome-os-partner:3384
TEST=run chromeos-fwu --mode=autoupdate with the same firmware already installed.

Review URL: http://codereview.chromium.org/6878029

3 years agore-indent error message correctly
Stefan Reinauer [Thu, 21 Apr 2011 00:10:37 +0000 (17:10 -0700)]
re-indent error message correctly

Change-Id: I832e3ea1d70ac762a2257c2dd742e133ee12e8ce

R=rspangler@google.com
BUG=none
TEST=none

Review URL: http://codereview.chromium.org/6881061

3 years agodrop extra fi
Stefan Reinauer [Tue, 19 Apr 2011 21:48:54 +0000 (14:48 -0700)]
drop extra fi

Change-Id: Ieb2ea51318e7d7d7f81822ddfe35e27dc8d29dd7

R=krisr@google.com,rspangler@google.com
BUG=chrome-os-partner:3407
TEST=run chromeos-firmwareupdate

Review URL: http://codereview.chromium.org/6879058

3 years agothrow an error if autoupdate is issued while in slot B
Stefan Reinauer [Tue, 19 Apr 2011 20:14:30 +0000 (13:14 -0700)]
throw an error if autoupdate is issued while in slot B

Change-Id: I2d8874fdbad667c0568094bcd9ff6b8a70800944

R=rspangler@google.com,adlr@google.com,hungte@google.com
BUG=chrome-os-partner:3383
TEST=boot from firmware b, run autoupdate

Review URL: http://codereview.chromium.org/6883026

3 years agowarn if hardware write protect is enabled and update_ro_* is specified.
Stefan Reinauer [Tue, 19 Apr 2011 20:00:20 +0000 (13:00 -0700)]
warn if hardware write protect is enabled and update_ro_* is specified.

Change-Id: I12b4b68506079cb35f9935fb3bfb1245ba7adefb

R=rspangler@google.com
BUG=none
TEST=chromeos-firmwareupdate --mode=recovery with hw write protection on

Review URL: http://codereview.chromium.org/6880019

3 years agochromeos-firmware: add crossystem into default bundle list.
Hung-Te Lin [Tue, 19 Apr 2011 01:23:05 +0000 (09:23 +0800)]
chromeos-firmware: add crossystem into default bundle list.

We need to put crossystem into updater embedded program because it's highly
version dependent.

BUG=chromium-os:14029
TEST=emerge-x86-XXXX chromeos-firmware # seeing crossystem in bundle

Change-Id: I3fff158e88948689da30d8728386d3d12400dab0

R=rspangler@chromium.org

Review URL: http://codereview.chromium.org/6869048

3 years agochromeos-firmware: detect and assign version information by image content
Hung-Te Lin [Tue, 19 Apr 2011 01:22:11 +0000 (09:22 +0800)]
chromeos-firmware: detect and assign version information by image content

The recent firmware has its firmware ID in RO_FRID section, so we can easily
extract the version information from there, preventing any mistake by manually
updating the ebuild files.

BUG=chromium-os:14195
TEST=emerge-x86-XXXX chromeos-firmware; # see correct FRID

Change-Id: I4426bf11cdd806adb9ad49de513b977ffc2d6195

R=reinauer@chromium.org

Review URL: http://codereview.chromium.org/6870032

3 years agoadd --mode=tonormal support for chromeos-firmwareupdate
Stefan Reinauer [Mon, 18 Apr 2011 21:36:28 +0000 (14:36 -0700)]
add --mode=tonormal support for chromeos-firmwareupdate

Change-Id: I38fb7876b80363a2c8ad5d776d84deb529eb267f

BUG=chromium-os:13535
TEST=run chromeos-firmwareupdate --mode=tonormal manually

Review URL: http://codereview.chromium.org/6747016

3 years agodon't update to dev firmware unless fwb tries is 0 or --force is specified.
Stefan Reinauer [Mon, 18 Apr 2011 21:20:09 +0000 (14:20 -0700)]
don't update to dev firmware unless fwb tries is 0 or --force is specified.

Change-Id: Ib6427e0703562286ebe208f9635587ebdda78960

R=rspangler@chromium.org
BUG=chromium-os:14206
TEST=chromeos-firmwareupdate while fwb_tries != 0

Review URL: http://codereview.chromium.org/6873054