chromiumos/platform/dev-util.git
4 hours agopaycheck: close metadata signature file 36/56336/2 master
Gilad Arnold [Thu, 23 May 2013 00:21:58 +0000 (17:21 -0700)]
paycheck: close metadata signature file

Paycheck used to open it but not closing it. Cleaned up now.

BUG=None
TEST=Integration tests

Change-Id: I101f2acd394bcbe5e5d683b5eecc6170ab1bcf2d
Reviewed-on: https://gerrit.chromium.org/gerrit/56336
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

22 hours agopaycheck: move stuff from checker_unittest.py to test_utils.py 15/47615/19
Gilad Arnold [Tue, 2 Apr 2013 23:24:41 +0000 (16:24 -0700)]
paycheck: move stuff from checker_unittest.py to test_utils.py

This is all stuff that'll come in handy when testing other modules.

BUG=chromium:217039,chromium:215780,chromium:189855
TEST=Passes unittests

Change-Id: I57d1fae97330f22748885f8028352f07b5058396
Reviewed-on: https://gerrit.chromium.org/gerrit/47615
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

22 hours agopaycheck: move default pubkey handling inside the library 35/56335/2
Gilad Arnold [Thu, 23 May 2013 00:12:56 +0000 (17:12 -0700)]
paycheck: move default pubkey handling inside the library

This is a more sensible choice given that the pubkey ships within the
library directory and hence should not be specified explicitly by an
outside entity (like paycheck). From the practical standpoint, it makes
this useful feature available to clients who use the library directly.

BUG=chromium:241283
TEST=Unit + integration tests

Change-Id: I059302326af1e0e394829466ee97ad2f60de4986
Reviewed-on: https://gerrit.chromium.org/gerrit/56335
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

25 hours agodevserver: IsDelta -> IsDeltaPayload; Boolean value in lowercase 97/56297/2
Gilad Arnold [Wed, 22 May 2013 18:36:32 +0000 (11:36 -0700)]
devserver: IsDelta -> IsDeltaPayload; Boolean value in lowercase

This fixes two problems: (i) the devserver uses 'IsDelta' as the field
name for the Omaha response the reflects whether a payload is a delta,
which is wrong (should be 'IsDeltaPayload');  (ii) it uses Python
built-in Boolean-to-string conversion, which results in capitalized
'True'/'False' values; unfortunately, the update engine expects
a lowercase value.

BUG=chromium:243011
TEST=IsDeltaPayload field set correctly

Change-Id: Idb8c2527ed6c55af676aad868f29e3e908fc4967
Reviewed-on: https://gerrit.chromium.org/gerrit/56297
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

2 days agoIf there is an error reading write_gpt.sh use the default value. 92/56092/2
Chris Sosa [Tue, 21 May 2013 20:36:03 +0000 (13:36 -0700)]
If there is an error reading write_gpt.sh use the default value.

BUG=chromium:242276
TEST=Tested against an old and recent payload (both delta + full).

Change-Id: I5333126a89e0d15bac437eb9abe39ecbfc11c99f
Reviewed-on: https://gerrit.chromium.org/gerrit/56092
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>

5 days agocros_bundle_firmware: Automatically select BL1/BL2 for daisy/peach 98/49398/5
Simon Glass [Fri, 26 Apr 2013 23:38:42 +0000 (16:38 -0700)]
cros_bundle_firmware: Automatically select BL1/BL2 for daisy/peach

Rather than using the wrong default, select the Exynos model name based on
the board type.

BUG=chrome-os-partner:18451
TEST=manual
Run cros_bundle_firmware with '-b peach_pit' and see that it no longer
complains about missing Exynos 5250 files. Run with '-b daisy' and see
that it picks up the 5250 files.

Force 'model' to none, and see that when no '--bl1' is provided, we get
a fairly sensible error:

    Cannot find value for entry property 'exynos-bl1'

Change-Id: I3e83fe90f5ab509dc3a5a3bfd916529f457f57a9
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49398
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
6 days agocros_bundle_firmware: Tidy up servo messages 02/49402/3
Simon Glass [Sat, 27 Apr 2013 00:55:55 +0000 (17:55 -0700)]
cros_bundle_firmware: Tidy up servo messages

When using '--servo none' we should not say that we are using servo to
reset the board.

BUG=chromium:216858
TEST=manual
Try on link with '--servo none' and check that the reset message no longer
appears, and link is not reset. Try with '--servo 7777' and see that it
does print the message and reset.

Also try the same with snow.

Change-Id: I9d28ed69e6cbe5f5bf169a0921b3f45d6277c1f6
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49402

6 days agocros_bundle_firmware: Correct missing binascii import 01/49401/3
Simon Glass [Sat, 27 Apr 2013 00:37:19 +0000 (17:37 -0700)]
cros_bundle_firmware: Correct missing binascii import

This import is missing and without this the code will not work.

BUG=chromium:220915
TEST=manual
Build image with an embedded 'fdtmap' section. See that it now succeeds
instead of giving an error:

NameError: global name 'binascii' is not defined

Change-Id: I0dbe38b119108d33e557b454bfc71d22556fd48f
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49401

7 days agoUpdate paycheck to understand the updated update_metadata fields. 99/50899/7
Don Garrett [Fri, 10 May 2013 22:01:36 +0000 (15:01 -0700)]
Update paycheck to understand the updated update_metadata fields.

When checking a payload, always start by printing a description of the
payload being checked.

Recompiled (with protoc) the updated update_metadata.proto from the
update_engine.

BUG=chromium:226310
TEST=Manual Run
CQ-DEPEND=CL:47347

Change-Id: Ib60c6e6978d30444db7b65ef6d09540c9ffacdb8
Reviewed-on: https://gerrit.chromium.org/gerrit/50899
Commit-Queue: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
7 days agoPass along arguments to populate a human friendly payload description. 64/50864/2
Don Garrett [Wed, 1 May 2013 23:43:10 +0000 (16:43 -0700)]
Pass along arguments to populate a human friendly payload description.

These new command line arguments are passed to the delta_generator
unmodified.

BUG=chromium:226310
TEST=Manual Testing

Change-Id: I1feff5f0aa72f3dffad11c1e4f0b22aae515145c
Reviewed-on: https://gerrit.chromium.org/gerrit/50864
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>

8 days agopaycheck: allow src_extents to span the whole new partition size 38/51138/2
Gilad Arnold [Tue, 14 May 2013 16:19:17 +0000 (09:19 -0700)]
paycheck: allow src_extents to span the whole new partition size

In a previous fix, we allowed paycheck to consider the whole new
partition (beyond just the filesystem) as valid range for write
operations. However, since updates are done in place, they should also
be considered valid for read operations. This is now fixed.

BUG=chromium:240726
TEST=Previously failing delta update now verified successfully

Change-Id: Ib904c0265e2fd61ab0768169b3257c4131441888
Reviewed-on: https://gerrit.chromium.org/gerrit/51138
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

9 days agopaycheck: applier honors sparse holes 58/50558/2 factory-4128.B factory-spring-4131.B
Gilad Arnold [Thu, 9 May 2013 00:57:54 +0000 (17:57 -0700)]
paycheck: applier honors sparse holes

Up until now, paycheck's applier ignored sparse (aka pseudo-) extents
completely, except for REPLACE operations (where a sparse extent is an
indicator for a signature blob). This is now fixed.

BUG=chromium:221846
TEST=Passes integration test

Change-Id: I8b7fde6e4bb20912a59ce9a509a20c00c5c0751b
Reviewed-on: https://gerrit.chromium.org/gerrit/50558
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

9 days agopaycheck: support for in-place BSDIFF operations 86/50486/4
Gilad Arnold [Wed, 8 May 2013 20:12:53 +0000 (13:12 -0700)]
paycheck: support for in-place BSDIFF operations

When applying BSDIFF operations in payloads, we used to extract the
block sequences from the old partition and serialize it into a temporary
file, and vice versa for the new partition. This worked but did not
allow us to test bspatch as it is actually being used by the update
engine.

This CLs allows paycheck to invoke bspatch so that it reads/writes block
extents directly from/to the partition file, in the same way it's being
used by the update engine. Since performance is the same, this is the
new default behavior; users can opt for the aforementioned old behavior
using a command-line flag (-x or --extract-bsdiff).

BUG=chromium:229705
TEST=bspatch invoked differently depending on the -x flag
TEST=Passes unit/integration tests

Change-Id: I8821754e1163b357617ece6befa42d1c2e575930
Reviewed-on: https://gerrit.chromium.org/gerrit/50486
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

10 days agopaycheck: src/dst -> old/new in applier code 30/50130/7
Gilad Arnold [Sun, 5 May 2013 04:40:39 +0000 (21:40 -0700)]
paycheck: src/dst -> old/new in applier code

The old/new terminology is consistent with that used in update payload
manifest, as well as other parts of the update_payload library (e.g.
checker).

BUG=None
TEST=Unit/integration test passes

Change-Id: I91244ae8adf073b958e8cd7e7670341f056c848e
Reviewed-on: https://gerrit.chromium.org/gerrit/50130
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

10 days agopaycheck: improved test script error message 11/51011/2
Gilad Arnold [Mon, 13 May 2013 19:29:58 +0000 (12:29 -0700)]
paycheck: improved test script error message

Makes it clear what exactly is not found (i.e. the paycheck.py at the
same location as test_paycheck.sh).

BUG=None
TEST=Error message as expected

Change-Id: I240c75ecb38c1003882aff76a65f92b661f8a607
Reviewed-on: https://gerrit.chromium.org/gerrit/51011
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

10 days agopaycheck: fix integration test script 85/50985/2
Gilad Arnold [Mon, 13 May 2013 15:12:39 +0000 (08:12 -0700)]
paycheck: fix integration test script

Now that paycheck comes equipped with the Chrome OS standard public key
and infers metadata signature filenames automatically, we don't need
these extra arguments handed to the test script. Also, fixes a small bug
in option inference during paycheck invocation.

BUG=None
TEST=integration test script works as intended

Change-Id: If2c0d512c2e9476c3788e9c7179e954ba2502657
Reviewed-on: https://gerrit.chromium.org/gerrit/50985
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

2 weeks agopaycheck: make gpyling happy 93/50393/3
Gilad Arnold [Wed, 8 May 2013 00:12:50 +0000 (17:12 -0700)]
paycheck: make gpyling happy

Small conformance issues, now fixed.

BUG=None
TEST=Still running

Change-Id: I96a085d4fdc22edff65629b8b01d6d595f1f7b2d
Reviewed-on: https://gerrit.chromium.org/gerrit/50393
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
2 weeks agopaycheck: fixed an undefined variable bug 92/50392/3
Gilad Arnold [Wed, 8 May 2013 00:08:18 +0000 (17:08 -0700)]
paycheck: fixed an undefined variable bug

BUG=None
TEST=It is running now

Change-Id: I7ed7c17811700f34e7556bac89182db6b8e29992
Reviewed-on: https://gerrit.chromium.org/gerrit/50392
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
2 weeks agoRemove hardcoded perf install 90/50490/2
Sonny Rao [Wed, 8 May 2013 20:57:26 +0000 (13:57 -0700)]
Remove hardcoded perf install

perf is now in the base image, and also a virtual package anyway, so
explicitly installing it during dev_install is wrong in two ways now.

BUG=chromium:238326
TEST=dev_install test in VMTests passes

Change-Id: I5f59129ce70f159fe49dc3ef31d6a1a1841b3a3b
Reviewed-on: https://gerrit.chromium.org/gerrit/50490
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Sonny Rao <sonnyrao@chromium.org>
Tested-by: Sonny Rao <sonnyrao@chromium.org>
2 weeks agopaycheck: refined default metadata signature logic 38/50138/3 release-R28-4100.B
Gilad Arnold [Sun, 5 May 2013 05:57:45 +0000 (22:57 -0700)]
paycheck: refined default metadata signature logic

We now only discover and use a default metadata signature when check is
actually triggered and a public key provided; otherwise, we could be
forcing the check to fail. This also avoids unnecessary output and
directs informational output to stderr.

BUG=chromium:238507
TEST=Unit/integration tests pass

Change-Id: I39df4060afd12a5d54869a6803141bc3e0d2f89b
Reviewed-on: https://gerrit.chromium.org/gerrit/50138
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>

2 weeks agopaycheck: use base64 encoding for SHA256 hashes throughout 04/50104/5
Gilad Arnold [Sat, 4 May 2013 07:24:58 +0000 (00:24 -0700)]
paycheck: use base64 encoding for SHA256 hashes throughout

Turns out we were using base64 when adding SHA256 data to a payload
report, but intermittently using hex encoding in error messages. This is
now fixed.

BUG=None
TEST=No mention of hex encoding in the code
TEST=gpylinted correctly
TEST=Passes unit tests

Change-Id: Id2dc2fcd154d4647cc1a076579dde7a789c09e40
Reviewed-on: https://gerrit.chromium.org/gerrit/50104
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>

2 weeks agopaycheck: enforce physical partition size correctly 03/50103/4
Gilad Arnold [Fri, 3 May 2013 19:49:28 +0000 (12:49 -0700)]
paycheck: enforce physical partition size correctly

During payload checking, payload has wrongly interpreted the size
reported in the update payload to be the physical partition size,
whereas this is in fact the size of the filesystem portion only (a
misnomer). This sometimes caused it to emit errors on out-of-bounds
operations, which are otherwise harmless in real-world scenarios.

This CL makes a clear distinction between the two, with the following
semantics:

- The payload's embedded filesystem size must by <= the physical
  partition sizes.

- Reading/writing from/to the new partition must be within the physical
  partition size boundaries, and not the filesystem ones.

- Reading from the old partition is only allowed from filesystem
  boundaries; this is unchanged from current behavior and appears to be
  consistent with how we perform delta updates.

- Old/new SHA256 verification during payload application is now limited
  to the allotted filesystem portion only (and not the full partition
  size). This is consistent with the update engine's semantics.

- Other than that, this change currently has no further effect on
  payload application, which remains more permissive wrt to partition
  sizes.  This also means that the sizes of partitions resulting from
  a payload application will not necessarily abide by the predetermined
  physical partition sizes.  This is in line with the prevailing
  division of responsibilities between payload checking (strict) and
  application (relaxed).

BUG=chromium:221847
TEST=Payload checking respects partition size override
TEST=Unit tests pass
TEST=Integration tests pass

Change-Id: I0dbc88d538c0cc53b7551f4dfa8f543bcf480cd5
Reviewed-on: https://gerrit.chromium.org/gerrit/50103
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>

2 weeks agopaycheck: --disalbed_tests implies --check 02/50102/2
Gilad Arnold [Fri, 3 May 2013 15:36:06 +0000 (08:36 -0700)]
paycheck: --disalbed_tests implies --check

This is in line with other check-related options whose use implies
--check.

BUG=None
TEST=Integrity check is implied as expected

Change-Id: I5c2d964d9b6462c76747358129900acbba411d04
Reviewed-on: https://gerrit.chromium.org/gerrit/50102
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>

2 weeks agoAdd public update key as default. 04/49704/4
Don Garrett [Wed, 1 May 2013 01:42:29 +0000 (18:42 -0700)]
Add public update key as default.

This adds the key, and makes it default.

BUG=chromium:237064
TEST=Ran tool manually.

Change-Id: I0c47515980dd0349e6d427524b933ff812b61318
Reviewed-on: https://gerrit.chromium.org/gerrit/49704
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>

2 weeks agoAdd default name for the metadata signature file. 32/49832/3
Don Garrett [Wed, 1 May 2013 23:56:16 +0000 (16:56 -0700)]
Add default name for the metadata signature file.

If the metadata signature file isn't specified, and a file exists with the
name <payload_file>.metadata-signature, use it for the metadata signature.

BUG=None
TEST=Manual

Change-Id: I193dcbeece659e6fa9da8a7a22b871aa53622ceb
Reviewed-on: https://gerrit.chromium.org/gerrit/49832
Commit-Queue: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
2 weeks agoPass the rootfs partition size for full updates. 27/49927/2
Chris Sosa [Thu, 2 May 2013 19:28:56 +0000 (12:28 -0700)]
Pass the rootfs partition size for full updates.

Since I added the rootfs size check, we should pass the partition
size for full updates as well as deltas. Otherwise images that
are > 1GB will fail to generate update payloads.

BUG=chromium:237511
TEST=cros_generate_update_payload on a full payload.

Change-Id: I149570b2f2deb475deee1e1f4beddb6f600006e3
Reviewed-on: https://gerrit.chromium.org/gerrit/49927
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
3 weeks agopaycheck: test script puts temporary files in /tmp 77/49677/8
Gilad Arnold [Tue, 30 Apr 2013 22:40:01 +0000 (15:40 -0700)]
paycheck: test script puts temporary files in /tmp

Avoids bloating the platform/dev directory, which affects emerge time.

BUG=None
TEST=Emerge time reduced dramatically

Change-Id: I09ce977a011adca3276682997022d8b1f2acc2b1
Reviewed-on: https://gerrit.chromium.org/gerrit/49677
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

3 weeks agopaycheck: allow to disable specific checks 76/49676/7
Gilad Arnold [Tue, 30 Apr 2013 22:38:22 +0000 (15:38 -0700)]
paycheck: allow to disable specific checks

This became necessary as the delta generator appears to generate
payloads that fail certain checks (e.g. during update_engine unit
testing).

BUG=None
TEST=Disabled checks not being triggered

Change-Id: I4491e0cb32ef44f85e11ffb0402b40d1371525ae
Reviewed-on: https://gerrit.chromium.org/gerrit/49676
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

3 weeks agoGet the Rootfs partition size of the image and pass it to the delta generator. 76/49376/2
Chris Sosa [Fri, 26 Apr 2013 22:37:10 +0000 (15:37 -0700)]
Get the Rootfs partition size of the image and pass it to the delta generator.

BUG=chromium:234556
TEST=Built both a delta and a full payload with other changes.
CQ-DEPEND=I443c82013a6a2cb566e5d0bc1fb8c67647412f58

Change-Id: I616e4265c0c948e0ede6d5891660d90233fa71d4
Reviewed-on: https://gerrit.chromium.org/gerrit/49376
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>

3 weeks agodev: Delete power_info.sh. 75/49675/3
Daniel Erat [Tue, 30 Apr 2013 18:38:00 +0000 (11:38 -0700)]
dev: Delete power_info.sh.

It looks like this isn't used anymore (the fact that it
doesn't appear to get installed is a pretty big hint).

BUG=chromium:236858
TEST=none

Change-Id: If17dba4f56d56af18c3713cef01923424cf571b0
Reviewed-on: https://gerrit.chromium.org/gerrit/49675
Reviewed-by: Daniel Erat <derat@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>

3 weeks ago[Autotest] Add free disk space check in devserver 52/49252/5
Dan Shi [Thu, 25 Apr 2013 23:06:32 +0000 (16:06 -0700)]
[Autotest] Add free disk space check in devserver

Add a new method, check_health, to collect the health status of devserver.
Initially, collect the free disk space. The method is extendable to return more
information. The caller will determine if the devserver is ready for staging
image based on the returned health status.

BUG=chromium:219330
TEST=tested with run_suite in local machine, which runs as devserver as well.
DEPLOY=apache

Change-Id: Ib97672ca142b73ee9e0e4dbe8b6cc2c4c583b979
Reviewed-on: https://gerrit.chromium.org/gerrit/49252
Tested-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Dan Shi <dshi@chromium.org>

3 weeks agoMake sure that cros_write_firmware returns errors when appropriate 38/49438/2 stabilize-4068.0.B
Vadim Bendebury [Sat, 27 Apr 2013 20:59:28 +0000 (13:59 -0700)]
Make sure that cros_write_firmware returns errors when appropriate

The cros_write_firmware utility does not always return error status,
it should return success is and only if the image was successfully
written to a removable device.

With this change the nonzero error is returned both when the utility
is interrupted while waiting for a device to be plugged in and when
there is more than one removable device found without clearly
indicating which one to use..

BUG=none
TEST=manual
  . plug in two removable devices and run the utility, get the
    following:

    vvvvvvvvvvvvvvvvvvvvvvv
    Please specify destination as '-w sd:<disk_description>'
     - <disk_description> can be either . for the only disk,
       or the full device name, one of listed below:
    /dev/sde - Realtek USB3.0 Card Reader 2.0 GB
    /dev/sdg - Realtek USB3.0 Card Reader 3.9 GB
    ^^^^^^^^^^^^^^^^^^^^^^^^

  . hit ^C while the utility is waiting for the card to be plugged in,
    get the following:

    vvvvvvvvvvvvvvvvvvvvvvv
    No removable device found, interrupted
    ^^^^^^^^^^^^^^^^^^^^^^^^

   In both cases exit status is set to 1

Change-Id: Icc385274b04557d058d0cbe01c9a640f3d794fc8
Reviewed-on: https://gerrit.chromium.org/gerrit/49438
Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 weeks agoDo not fail right away if removable media not found 37/49437/2
Vadim Bendebury [Sat, 27 Apr 2013 20:25:13 +0000 (13:25 -0700)]
Do not fail right away if removable media not found

When cros_write_firmware is invoked and no removable device is found,
the utility terminates with a failure. It is better to have it prompt
the user to plug in a card and wait for it to happen.

Also, introduce a way to suppress the ellipsis addition to progress
messages, display a spinning wheel instead to demonstrate that the
program is waiting.

BUG=none
TEST=manual
  . run the utility without the SD card plugged in, observe it spin
    waiting for the user to insert a card. Verify that ^C terminates
    the utility gracefully.

Change-Id: I61af5319e8443fe3c54bad16b57769228fcbfd74
Reviewed-on: https://gerrit.chromium.org/gerrit/49437
Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 weeks agoFix pylint warnings 36/49436/2
Vadim Bendebury [Sat, 27 Apr 2013 21:10:45 +0000 (14:10 -0700)]
Fix pylint warnings

Pyling was complaining about the use of reserved word 'type' as a
parameter name and about an unused import.

BUG=none
TEST=manual
   . the presubmit hook does not complain anymore

Change-Id: I978aedbf8d5b57b9c3a977b1fadb979913234d24
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49436
Reviewed-by: Simon Glass <sjg@chromium.org>
4 weeks agoSupport rotating devserver logs. 31/48931/5
J. Richard Barnette [Tue, 23 Apr 2013 18:05:19 +0000 (11:05 -0700)]
Support rotating devserver logs.

If the devserver is started with a log file specified, the log
handler will be configured to rotate the logs once a week, to
prevent the logs from growing unmanageably large.

BUG=chromium:219168
TEST=test the feature with log rotation temporarily set to one minute

Change-Id: I0252b928c470b9d053efd4e3148eba8857bbb19e
Reviewed-on: https://gerrit.chromium.org/gerrit/48931
Commit-Queue: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Tested-by: Richard Barnette <jrbarnette@chromium.org>
4 weeks agoAU: Add --chunk_size option to cros_generate_update_payload. 63/48663/2
Darin Petkov [Fri, 19 Apr 2013 17:06:34 +0000 (19:06 +0200)]
AU: Add --chunk_size option to cros_generate_update_payload.

The option is passed to the delta generator and allows us to specify delta
payload chunk size that is smaller than whole files.

BUG=chromium:229797
TEST=Ran cros_generate_update_payload with and without the --chunk_size option.
CQ-DEPEND=I21502118088bfbac75aa8009eb144f6aaf23a83a

Change-Id: I03f19c88327a108e1aa42a75f0d0cad6bb8e2d17
Reviewed-on: https://gerrit.chromium.org/gerrit/48663
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Darin Petkov <petkov@chromium.org>

4 weeks agopaycheck: perform payload integrity check by default 73/48373/3
Gilad Arnold [Wed, 17 Apr 2013 17:00:55 +0000 (10:00 -0700)]
paycheck: perform payload integrity check by default

Currently, paycheck requires that --check, or one of its sub-options
(e.g.  --type), is specified explicitly on the command-line in order to
trigger full payload checking. This means that invoking paycheck without
*any* optional arguments will amount to loading the payload manifest and
quitting. This is not a useful behavior.

Instead, we want payload integrity check to be the default behavior when
nothing else is requested. This also edits the help text to clarify the
distinction between verifying/applying a payload, and what guarantees
are provided wrt the actual CrOS update engine.

BUG=None
TEST=Payload checking triggered when no other argument is given; passes
unit/integrity testing.

Change-Id: I8199813d4654f5598fcf152a3cdc62efbfc533da
Reviewed-on: https://gerrit.chromium.org/gerrit/48373
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

4 weeks agoRevert "Broke the devservers with error: /home/chromeos-test/chromiumos/src/platform... 96/48796/2
Gilad Arnold [Mon, 22 Apr 2013 18:27:38 +0000 (11:27 -0700)]
Revert "Broke the devservers with error: /home/chromeos-test/chromiumos/src/platform/dev/devserver.py 8080 --archive_dir /home/chromeos-test/images -t --production Traceback (most recent call last):   File "/home/chromeos-test/chromiumos/src/platform/dev/devserve"

(The missing dependencies that necessitated the original revert have since been added.)

This reverts commit 40836b21dd61fb48a6528ec83238975aa63708b0

Change-Id: Iabc948c61797d208907ad3e89bf86696348445c8
Reviewed-on: https://gerrit.chromium.org/gerrit/48796
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

6 weeks agocros_bundle_firmware: update mmc flashing syntax 04/47504/2 stabilize-4008.0.B stabilize-4035.0.B
Allen Martin [Sat, 6 Apr 2013 00:05:39 +0000 (17:05 -0700)]
cros_bundle_firmware: update mmc flashing syntax

2013.01 upstream u-boot has a different mechanism for selecting boot
partition.  Instead of specifying it in the "mmc read" or "mmc write"
command, it is specified during "mmc open".  Wrap the read and write
commands with an "mmc open" / "mmc close" to select the boot
partition.

BUG=None
TEST=flashed on puppy with: "cros_bundle_firmware --board=puppy
  --flash=mmc --write=usb
  --dt=/build/puppy/firmware/dts/tegra114-dalmore.dts --servo=none"

Change-Id: If14f20771d38982cd610df12a4510900cda045fe
Signed-off-by: Allen Martin <amartin@nvidia.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/47504
Reviewed-by: Tom Warren <twarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 weeks agopaycheck: unit tests + fixes to checker module 29/45429/12
Gilad Arnold [Fri, 8 Mar 2013 21:22:31 +0000 (13:22 -0800)]
paycheck: unit tests + fixes to checker module

This adds missing unit tests for the checker module, bundled with fixes
to some bugs that surfaced due to unit tests. This includes:

* A fake extent (signified by start_block == UINT64_MAX) that
  accompanies a signature data blob bears different requirements than
  previously implemented.  Specifically, the extent sequence must have
  exactly one extent; and the number of blocks is not necessarily one,
  rather it is the correct number that corresponds to the actual length
  of the signature blob.

* REPLACE/REPLACE_BZ operations must contain data.

* MOVE operation validation must ensure that all of the actual message
  extents are being used.

* BSDIFF operation must contain data (the diff).

* Signature pseudo-operation should be a REPLACE.

BUG=chromium-os:34911,chromium-os:33607,chromium-os:7597
TEST=Passes unittests (upcoming); works with actual payloads.

Change-Id: I4d839d1d4da1fbb4a493b208958a139368e2c8ca
Reviewed-on: https://gerrit.chromium.org/gerrit/45429
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

7 weeks agoAllow creating firmware images without GBB 65/47165/2
Vadim Bendebury [Tue, 2 Apr 2013 20:01:22 +0000 (13:01 -0700)]
Allow creating firmware images without GBB

Do not fail creating an image in case '/config/nogbb' object is
present in the device tree, just do not build the GBB section in that
case.

BUG=chrome-os-partner:18329
TEST=manual
  . with the upcoming chromeos-bootimage and peach-u-boot modifications

   $ emerge-peach_pit chromeos-bootimage

   succeeds for both peach_pit and smdk5420 device trees.

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Change-Id: I482a1e2686437cd06a25385f564b349bd91fe10b
Reviewed-on: https://gerrit.chromium.org/gerrit/47165
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>

7 weeks agoRework the devserver help to make it much easier to use. 37/46937/2
Chris Sosa [Fri, 29 Mar 2013 18:47:00 +0000 (11:47 -0700)]
Rework the devserver help to make it much easier to use.

After debugging and working with others to debug their issues with the
devserver, it has become clear that the devserver help is awful. This CL
does a much needed touch up on the devserver help message. Now you get
a full doc with options grouped based on who should use them. For the most part
most people should only ever need data_dir, port, and -t. Please take a look
over both the main docstring and which group I put each option in and let
me know if you disagree.

I also started the work in deprecating for_vm and replacing it with
no_patch_kernel.

BUG=chromium:225129
TEST=--help and also ran with every combination of --for_vm and
--no_patch_kernel.

Change-Id: Ic8d2c8519e7c9d4737a8e24ae44cbfe5f9ee1c84
Reviewed-on: https://gerrit.chromium.org/gerrit/46937
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Masone <cmasone@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>

7 weeks agoModify paycheck to print out hashes in base64. 10/46910/4
Chris Sosa [Fri, 29 Mar 2013 21:31:43 +0000 (14:31 -0700)]
Modify paycheck to print out hashes in base64.

Both the update engine and sha256_partitions.sh print out hashes in
base64 encoding. Let's stay consistent with ourselves so we can diagnose
hash mismatches correctly.

BUG=None
TEST=Ran it with a delta payload and compared hashes with sha256_partitions.sh
and logs from applying it in the update_engine.

Change-Id: I90c511b936792a073fbe069065ff53c24f47041c
Reviewed-on: https://gerrit.chromium.org/gerrit/46910
Commit-Queue: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
7 weeks agocros_bundle_firmware: Correct format of crc32 command 32/46832/2
Simon Glass [Thu, 28 Mar 2013 20:06:05 +0000 (13:06 -0700)]
cros_bundle_firmware: Correct format of crc32 command

This command now uses the length of the argument to decide if it is a
hex string or an environment variable. Remove the 0x prefix so that the
flasher still works. This prefix is not needed anyway.

BUG=chrome-os-partner:18451
TEST=Manual

Use this to write to SD card:

$ cros_bundle_firmware -b peach_pit -s -M exynos -F spi -w sd:.

Then insert SD card in pit, boot from SD and see that it flashes correctly.

Change-Id: Ie786ada7d2d6114e0859b902c63f986932bf1259
Reviewed-on: https://gerrit.chromium.org/gerrit/46832
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Commit-Queue: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
7 weeks agocros_bundle_firmware: Extract TEXT_BASE always 31/46831/2
Simon Glass [Fri, 29 Mar 2013 00:03:41 +0000 (17:03 -0700)]
cros_bundle_firmware: Extract TEXT_BASE always

We need this for the SD flasher always, so let's calculate the U-Boot
TEXT_BASE for both USB and SD boot.

BUG=chrome-os-partner:18451
TEST=Manual

Use this to write to SD card:

$ cros_bundle_firmware -b peach_pit -s -M exynos -F spi -w sd:.

Then insert SD card in pit, boot from SD and see that it flashes correctly.

Change-Id: I7f6064b3d3f4dffad5d326fa409602ba2125e5e3
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46831
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
8 weeks agoBroke the devservers with error: 12/46812/2
Simran Basi [Thu, 28 Mar 2013 22:08:17 +0000 (15:08 -0700)]
Broke the devservers with error:
/home/chromeos-test/chromiumos/src/platform/dev/devserver.py 8080 --archive_dir /home/chromeos-test/images -t --production
Traceback (most recent call last):
  File "/home/chromeos-test/chromiumos/src/platform/dev/devserver.py", line 21, in <module>
    import autoupdate
  File "/home/chromeos-test/chromiumos/src/platform/dev/autoupdate.py", line 25, in <module>
    import update_payload
  File "/home/chromeos-test/chromiumos/src/platform/dev/host/lib/update_payload/__init__.py", line 10, in <module>
    from payload import Payload
  File "/home/chromeos-test/chromiumos/src/platform/dev/host/lib/update_payload/payload.py", line 10, in <module>
    import applier
  File "/home/chromeos-test/chromiumos/src/platform/dev/host/lib/update_payload/applier.py", line 24, in <module>
    import common
  File "/home/chromeos-test/chromiumos/src/platform/dev/host/lib/update_payload/common.py", line 11, in <module>
    import update_metadata_pb2
  File "/home/chromeos-test/chromiumos/src/platform/dev/host/lib/update_payload/update_metadata_pb2.py", line 3, in <module>
    from google.protobuf import descriptor
ImportError: No module named google.protobuf

Revert "devserver: return correct IsDelta value in Omaha response"

This reverts commit 2902159b01543a5e67fb89c0a2a86f0e0ad11614

Change-Id: I8aaf6394491592f18880808df801bc8c5200d5b6
Reviewed-on: https://gerrit.chromium.org/gerrit/46812
Reviewed-by: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
8 weeks agoWait for operation to complete when writing to SD card 65/46765/2
Vadim Bendebury [Thu, 28 Mar 2013 16:50:00 +0000 (09:50 -0700)]
Wait for operation to complete when writing to SD card

The actual data transfer does not complete when the 'dd' operation
exits. Pulling out the removable media too soon causes corruption.

Make sure the utility waits till data is synced.

BUG=None
TEST=manual
   . used cros_write_firmware to put an image to the SD card

Change-Id: If60107194d9c830525ae32f6269904028d9b359d
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46765
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
8 weeks agoFix errors/warnings reported by pylint 60/46660/3
Vadim Bendebury [Wed, 27 Mar 2013 18:52:58 +0000 (11:52 -0700)]
Fix errors/warnings reported by pylint

This change is supposed to be a noop, which is confirmed by
successfully passing unittests AND using
cros_bundle_firmware/cros_write_firmware to generate a functional SD
card.

BUG=None
TEST=manual
    FEATURES=test sudo -E emerge cros-devutils
    will run trybot too

Change-Id: I8ec9afc297809c2a58a409caa805f108823088b2
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46660
Reviewed-by: Simon Glass <sjg@chromium.org>
8 weeks agoDevserver: Add perf_data dep to telemetry source list. 28/46328/3
Simran Basi [Fri, 22 Mar 2013 23:40:04 +0000 (16:40 -0700)]
Devserver: Add perf_data dep to telemetry source list.

Splitting telemetry and perf data into separate deps, both need to
be installed for telemetry to run.

BUG=chromium:223237
TEST=Local devserver

Change-Id: I8f6f7531526cb345fd42a31e1172467360dc07c7
Reviewed-on: https://gerrit.chromium.org/gerrit/46328
Commit-Queue: Simran Basi <sbasi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
8 weeks agoUse base board name to find default flash map 56/46656/2
Vadim Bendebury [Wed, 27 Mar 2013 18:23:25 +0000 (11:23 -0700)]
Use base board name to find default flash map

When using board variants (as denoted by _<variant> prefix in the
board name) use the base board name to figure out the default flash
map.

BUG=chrome-os-partner:18329
TEST=manual
  . peach_pit bootimage builds and executes fine

Change-Id: Icccb9a54d023f00bd7db5b368925ddb435afcb72
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46656
Reviewed-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 weeks agoRemove an extra quote in no-update-response for v3.0 34/46534/2
Jay Srinivasan [Tue, 26 Mar 2013 18:05:06 +0000 (11:05 -0700)]
Remove an extra quote in no-update-response for v3.0

This was inadvertent and harmless typo and caused a error message about
XML being invalid in update_engine logs. That message should go away
now.

BUG=chromium:224001
TEST=Verified with image to live invalid xml error went away in UE.
Change-Id: Ieab1748e1d8dc2beadff4ddf8086129a50a07e8a
Reviewed-on: https://gerrit.chromium.org/gerrit/46534
Reviewed-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>

2 months agoFix device size calculations in write_firmware.py 17/46217/3 release-R27-3912.B stabilize-3912.79.B toolchainA
Vadim Bendebury [Fri, 22 Mar 2013 02:09:35 +0000 (19:09 -0700)]
Fix device size calculations in write_firmware.py

The _GetDiskCapacity() function expects the device size to be reported
as XXXX MB, but large devices have their size reported as XX.X
GB. Common for all devices is reporting the size in bytes in the end
of the string.

The regex fishing out the device size is being changed to look for the
bytes size number, then the function converts it into Gigabytes and
returns.

Some other refactoring included

 - reporting the situation where no removable devices have been found;
 - eliminating the ability to include device description as the
   command line parameter;
 - adjusting the help message
 - corrected a call site of _ExtractPayloadParts() reported as a
   problem by Lint

BUG=none
TEST=manual

  . both the following commands now work even with the cards reporting
    their size in GB:

    $ cros_write_firmware --board=peach -w sd:. -i image.bin
    $ cros_write_firmware --board=peach -w sd:/dev/sdc -i image.bin

    . when no removable device is available, the following error
      message is printed:

       No removable devices found
       Did you forget to plug in the SD card?

    . unit tests still pass
    $ FEATURES=test sudo -E emerge cros-devutils

   . when a wrong device is specified in the command line, the list of
     available devices is printed:

     $ cros_write_firmware --board=peach -w sd:/dev/sda -i image.bin
     Please specify destination -w 'sd:<disk_description>':
        - description can be . for the only disk, or
          the full device name, one of listed below:
     Found 1 available disks.
        /dev/sdc: Generic Mass Storage Device 3.9 GB

Change-Id: Ie19e34712d48179fe6ea32716d202a4ddbc1b02c
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46217
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
2 months ago99devinstall: drop hardcoded libdir 50/45450/2
Mike Frysinger [Thu, 14 Mar 2013 19:05:17 +0000 (15:05 -0400)]
99devinstall: drop hardcoded libdir

Let the ebuild autopopulate this.

BUG=None
TEST=`emerge-x32-generic dev-install` produces a proper LD_LIBRARY_PATH

Change-Id: I13197a8999c526fdc1b7da66349d81c428f6928e
Reviewed-on: https://gerrit.chromium.org/gerrit/45450
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
2 months agodevserver: return correct IsDelta value in Omaha response 37/43537/22
Gilad Arnold [Sat, 16 Feb 2013 00:19:17 +0000 (16:19 -0800)]
devserver: return correct IsDelta value in Omaha response

The devserver now uses the newly introduced update_payload module to
actually parse payload files and determine whether they are delta/full
with certainty. This fix includes both locally and remotely served
files. Also fixes a potential problem with remote file attribute
fetching.

BUG=chromium-os:37688
TEST=(1) update response contains correct IsDelta value; (2)
api/fileinfo correctly returns is_delta value.
CQ-DEPEND=I8f426f55d2ee7fb0fa265ae4d5ad84f3c68ca702

Change-Id: I7258d81a66a5c763cc62f6800965fe1a57a0008e
Reviewed-on: https://gerrit.chromium.org/gerrit/43537
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

2 months agocros_bundle_firmware: Add default flashmap for peach 53/46053/3
Simon Glass [Wed, 20 Mar 2013 22:42:02 +0000 (15:42 -0700)]
cros_bundle_firmware: Add default flashmap for peach

Add a default flashmap so that peach can be written.

BUG=chrome-os-partner:18329
TEST=manual
Run cros_bundle_firmware, see that peach boots to a prompt

cros_bundle_firmware -b peach -u u-boot.bin --bl2 spl/smdk5420-spl.bin \
--bl1 ../E5420.nbl1.bin -d board/samsung/dts/exynos5420-smdk5420.dts \
-w sd:. -I arch/arm/dts/ -s

Change-Id: Ie4cba8ea575aa64e219c7ac9410ed5fb4c683002
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46053
Reviewed-by: Doug Anderson <dianders@chromium.org>
2 months agoAU Suite is a tarball artifact (does not include autotest packages). 22/45722/2 stabilize-3881.0.B
Chris Sosa [Mon, 18 Mar 2013 04:59:54 +0000 (21:59 -0700)]
AU Suite is a tarball artifact (does not include autotest packages).

BUG=None
TEST=Pylint + unittests + ran with au control file.

Change-Id: Ie45b6ad466bea132a2365ac7fb3e137279ea61e0
Reviewed-on: https://gerrit.chromium.org/gerrit/45722
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
2 months agoFix update out-of-bounds check for partition boundary. 53/44953/3
Gilad Arnold [Fri, 8 Mar 2013 20:05:59 +0000 (12:05 -0800)]
Fix update out-of-bounds check for partition boundary.

This is an off-by-one error caught during the implementation of unit
tests.

BUG=None
TEST=Unit tests (upcoming) pass as expected.

Change-Id: I9a5da10588f0ac4314e9a35280ff1f38c34c88ac
Reviewed-on: https://gerrit.chromium.org/gerrit/44953
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
2 months agoTwo fixes for AUTest to work on builders. 05/45505/4
Chris Sosa [Thu, 14 Mar 2013 22:27:36 +0000 (15:27 -0700)]
Two fixes for AUTest to work on builders.

Fix timeout logic. It's possible for the builders to be going under so much
work that the timeout will pass before we enter the while loop. Fix this.

I've also gone ahead and check for error code 127 to avoid ever having an issue
where we can't find gsutil in the future. I spent a long time debugging this
before realizing the devserver couldn't find gsutil.

BUG=chromium:196387
TEST=Ran this code on a builder where it used to fail. Also ran unittests and
modified unittests to test new behavior.

Change-Id: Ibaeeb04c00c29783fc83547c4828972b1f38fce5
Reviewed-on: https://gerrit.chromium.org/gerrit/45505
Commit-Queue: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
2 months agoSimplify logic around download package.provided file now that it is a directory 69/45169/2 factory-spring-3842.B firmware-spring-3833.B
Chris Sosa [Tue, 12 Mar 2013 02:24:33 +0000 (19:24 -0700)]
Simplify logic around download package.provided file now that it is a directory

Now that package.provided is a directory, no need to >> things together.

BUG=chromium:182299
TEST=Ran it with fix.
CQ-DEPEND=If95eddc2f687d5ccc983d964d5fba7b0e4631c02

Change-Id: Ife3d5ac2a3c598c31441f2fe6f88b07a1842498a
Reviewed-on: https://gerrit.chromium.org/gerrit/45169
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>

2 months agoblockdiff.py: a binary file block differ 40/43040/20 firmware-spring-3824.4.B firmware-spring-3824.55.B firmware-spring-3824.B
Gilad Arnold [Wed, 6 Feb 2013 00:49:51 +0000 (16:49 -0800)]
blockdiff.py: a binary file block differ

This is a simple tool that'll output sequences of corresponding blocks
in two binary files that are not identical. Together with paycheck.py
-b/-B, it can be used to trace the origin of a block that did not update
correctly wrt a reference target partition.

BUG=chromium-os:34911,chromium-os:33607
TEST=Diffing two partition files shows the correct block differences

Change-Id: I9ccf011bbc275a039875d23b5ab01266587bff60
Reviewed-on: https://gerrit.chromium.org/gerrit/43040
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

2 months agoUpdate payload library + command-line tool 41/43041/18
Gilad Arnold [Sat, 26 Jan 2013 09:00:39 +0000 (01:00 -0800)]
Update payload library + command-line tool

An initial implementation of a Python module for parsing, checking and
applying a Chrome OS update payload. Comes with a command-line tool
(paycheck.py) for applying such operations on payload files, and a test
script (test_paycheck.sh) for ensuring that the library and tool are
working correctly.

Since update_payload is introduced as a package, we're moving some
previously merged utilities into the package's directory.

(Unit testing for this code will be uploaded on a separate CL; see
chromium-os:39663)

BUG=chromium-os:34911,chromium-os:33607,chromium-os:7597
TEST=test_paycheck.sh successful on MP-signed payloads
CQ-DEPEND=I5746a1d80e822a575f0d96f94d0b4e765fc64507

Change-Id: I77123a1fffbb2059c239b7145c6922968fdffb6a
Reviewed-on: https://gerrit.chromium.org/gerrit/43041
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

2 months agoDev Install: Add support for --yes option to assume y's to all prompts. 63/44763/4
Chris Sosa [Wed, 6 Mar 2013 19:04:31 +0000 (11:04 -0800)]
Dev Install: Add support for --yes option to assume y's to all prompts.

Also some fixes to gmerge workflow to allow easy integration testing.

BUG=chromium-os:12388, chromium-os:37901
TEST=Ran it with devmode-test

Change-Id: If511a65fb81fb2ed3d425005490efc9353283274
Reviewed-on: https://gerrit.chromium.org/gerrit/44763
Commit-Queue: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
2 months agobuilder.py: use anchored globbing to match DEFAULT_INSTALL_MASK 14/44614/4
John Sheu [Tue, 5 Mar 2013 04:25:18 +0000 (20:25 -0800)]
builder.py: use anchored globbing to match DEFAULT_INSTALL_MASK

We exclude files according to DEFAULT_INSTALL_MASK for binpkgs that
gmerge generates.  Using unanchored globbing for the exclusion results
in unwanted exclusion; for example, the entry "/firmware" will exclude
both "/firmware" and "/lib/firmware", the latter of which we want to
keep, as its prefix is not wildcarded.

This change adds the "--anchored" flag to the tar command to make sure
we match a prefix of the file's path.

BUG=chromium-os:21099 (firmware packaging issues)
TEST=local build, run on host machine

Change-Id: Iaf2fc8092ebd7a1bbaa6330d0d6035a651c1215f
Reviewed-on: https://gerrit.chromium.org/gerrit/44614
Commit-Queue: John Sheu <sheu@chromium.org>
Reviewed-by: John Sheu <sheu@chromium.org>
Tested-by: John Sheu <sheu@chromium.org>
2 months agoMake gsutil_util more friendly to interactive scripts. 47/44247/3
Chris Sosa [Wed, 27 Feb 2013 23:33:35 +0000 (15:33 -0800)]
Make gsutil_util more friendly to interactive scripts.

gsutil_util was written to be extremely protected against Google
Storage hiccups that can occur when it is continuously running.
However, for interactive clients, its over-retrying will make it hard
to use interactively when a file really doesn't exist.

This change makes it so you can have both by checking the stderr
of gsutil to check for error msgs. If matched no objects or
non-existent object are returned, it's not gs flake.

BUG=chromium-os:37575
TEST=Ran it with autotest change.

Change-Id: I4db15f4ebbb426b2ec1f09e473de914c495a11f5
Reviewed-on: https://gerrit.chromium.org/gerrit/44247
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>

2 months agocros_bundle_firmware: Improve USB download reliability on exynos 84/43284/10
Simon Glass [Thu, 14 Feb 2013 17:35:54 +0000 (09:35 -0800)]
cros_bundle_firmware: Improve USB download reliability on exynos

It seems that we no longer need the cold reset workaround, and in fact it
seems to cause occassional failures with the upstream U-Boot.

Also with a reset delay of 0.1s, the download sometimes doesn't work.
Increase this to 0.2s.

BUG=chromium-os:28229
TEST=run this script:

while true; do
  cros_bundle_firmware -b daisy -d board/samsung/dts/exynos5250-snow.dts \
       -I arch/arm/dts -I cros/dts -u u-boot-dtb.bin \
       --bl2 spl/smdk5250-spl.bin -s -M exynos -w usb -O out
done

Change-Id: I9e3e93bb3b0a1ea81c0593fb1015eea36bf9965c
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43284
Tested-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2 months agocros_bundle_firmware: Allow FDT to be placed in image where anyone can find it 61/43261/8
Simon Glass [Sun, 10 Feb 2013 19:16:46 +0000 (11:16 -0800)]
cros_bundle_firmware: Allow FDT to be placed in image where anyone can find it

At present the FDT is attached to U-Boot, which is great for U-Boot but
not so good for everyone else. It is not easy for tools to locate the FDT
in an existing image.

Add a new fdtmap blob type which contains the FDT and therefore provides full
access to the flashmap and all private device data. This can then be included
in flashmaps which want it.

BUG=chromium-os:38794
TEST=manual
Build an image with an fdtmap but not an FMAP. Use flashrom to read a section
from it, and use the -V flag so that all sections are displayed.

Change-Id: I13899335dccb2ea82da4f92618a3d7dc214b52e1
Reviewed-on: https://gerrit.chromium.org/gerrit/43261
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2 months agoMove update_metadata_pb2.py to host/lib/update_payload 09/43809/2
Gilad Arnold [Fri, 22 Feb 2013 20:14:16 +0000 (12:14 -0800)]
Move update_metadata_pb2.py to host/lib/update_payload

This is necessary for proper packaging of the upcoming update_payload
library. Has to be done in a separate CL so that pylint checks can be
disabled (--no-verify).

BUG=None

TEST=None

Change-Id: I5746a1d80e822a575f0d96f94d0b4e765fc64507
Reviewed-on: https://gerrit.chromium.org/gerrit/43809
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

2 months agocros_bundle_firmware: Allow arbitrary blob type 59/43759/2
Che-Liang Chiou [Thu, 21 Feb 2013 23:18:03 +0000 (15:18 -0800)]
cros_bundle_firmware: Allow arbitrary blob type

This would let us add new blob types to fmap structure of device tree
much easier when the blobs do not require special treatments.

BUG=chrome-os-partner:17716
TEST=with U-boot changes, be able to pack arbitrary blob type

Change-Id: I0f56199cb6807422a1bc7f118b88e5cebdcd60ba
Reviewed-on: https://gerrit.chromium.org/gerrit/43759
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Commit-Queue: Che-Liang Chiou <clchiou@chromium.org>

2 months agoAllow easy gmerge overrides for board and devserver_url. 63/43463/7
Chris Sosa [Sat, 16 Feb 2013 01:37:49 +0000 (17:37 -0800)]
Allow easy gmerge overrides for board and devserver_url.

Right now, we only use what's in /etc/lsb-release for gmerge
settings. This is fine for a developer, but now with dev_install
fixed in R27, gmerge has become very useful for devs in dev mode.

The /usr/local override specifically has been long wanted.

Also did a little refactoring and fixed some pylint warnings.

BUG=chromium-os:37782
TEST=Ran it on a stumpy Chrome OS machine after dev_install and using
local workstation to build and install screen w/without options.

Change-Id: Ie1bac164bc8a2e3028bfa449bdbeba85e8bec66a
Reviewed-on: https://gerrit.chromium.org/gerrit/43463
Commit-Queue: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
2 months agoUtilities needed for update payload checking. 31/43431/6
Gilad Arnold [Tue, 12 Feb 2013 18:42:54 +0000 (10:42 -0800)]
Utilities needed for update payload checking.

These provide required functionality for an upcoming payload checking
tool. Includes two modules: format_utils.py and histogram.py, along with
unittest modules. Note that the run_unittests script can be used to run
these modules, just run from host/lib:

 $ ../../run_unittests

Otherwise, unit tests are run by the ebuild, too (see CQ-DEPEND for the
CL that implements this).

BUG=chromium-os:34911,chromium-os:33607
TEST=Unit tested; function as intended in upcoming client code.
CQ-DEPEND=I4f23c961e4ed3d56bffe719d44927bd4a45ae8b3

Change-Id: I72e2199ad6b9161c5ba1be86ef92245eccfd308a
Reviewed-on: https://gerrit.chromium.org/gerrit/43431
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

3 months agoFix tools unittest on canaries. 21/43621/2
David James [Wed, 20 Feb 2013 19:41:06 +0000 (11:41 -0800)]
Fix tools unittest on canaries.

BUG=chromium-os:39079
TEST=CHROMEOS_OFFICIAL=1 USER=chrome-bot ./tools.py --test

Change-Id: I65fbd288f7a02c966b0a42635e6220911d611694
Reviewed-on: https://gerrit.chromium.org/gerrit/43621
Commit-Queue: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
3 months agotools.py: improve GetChromeosVersion() unit test 07/43607/3
Gilad Arnold [Wed, 20 Feb 2013 16:50:14 +0000 (08:50 -0800)]
tools.py: improve GetChromeosVersion() unit test

- Stricter pattern matching: added ^ and $ to ensure that we match
  against the whole version string.

- More informative failure witness: now showing the actual vs expected
  pattern values.

BUG=chromium-os:39071

TEST=Fails with proper message when added '_foo' to reported_version;
succeeds otherwise

Change-Id: I73db2dcad9158b143a84de6cae86743cb1187e6c
Reviewed-on: https://gerrit.chromium.org/gerrit/43607
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Paul Taysom <taysom@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

3 months agoImprove handling serial port feedback in different modes of operation 82/43582/2
Vadim Bendebury [Wed, 20 Feb 2013 01:37:18 +0000 (17:37 -0800)]
Improve handling serial port feedback in different modes of operation

The recently introduced capability of accessing the DUT CPU console
UART to confirm status of write operation backfired in certain modes
of operation: when there is no servo or when flash programming is not
required.

This patch prevents attempts to receive UART feedback when it is not
provided.

BUG=None
TEST=manual
 . the following command previously failed reporting target dead, it
   now passes.

   cros_bundle_firmware -b daisy -d exynos5250-snow -w usb -v 3

  .unittest still passes

   $ FEATURES=test sudo -E emerge cros-devutils

 . command expecting UART console feedback also still passes

   $ cros_write_firmware -b daisy -w usb -d exynos5250-snow  -F spi -i \
         /tmp/3690/image-snow.bin  -V

Change-Id: Iaeba35d37fad9cca97bcf6f37fab839d23fe48e0
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43582
Reviewed-by: Simon Glass <sjg@chromium.org>
3 months agocros_bundle_firmware: Remove FDT when extracting U-Boot from image 03/43503/4
Simon Glass [Tue, 19 Feb 2013 00:56:29 +0000 (16:56 -0800)]
cros_bundle_firmware: Remove FDT when extracting U-Boot from image

To flash an image onto a board we download a flasher to the board, complete
with a script telling it what to do. The flasher is itself just U-Boot, and
we doctor up the FDT with a suitable script.

If no u-boot.bin is available, it is convenient to be able to extract the
U-Boot from the image being flashed. It is exactly the same binary, so there
is no problem with doing this.

However, at present the code that does this doesn't correctly determine the
end of U-Boot, partly since there is no defined way to do this. The intent
is that we will start using the fdtmap instead of FMAP, and so will have
access to that information. Until then, we need a workaround.

Search for the FDT magic word at the end of the extract image portion. Since
the FDT is attached to the end of U-Boot, this magic word marks the end of
the original u-boot.bin which was placed in the image. Use this smaller
portion as our u-boot.bin. When the flasher code adds its specially
doctored-up FDT, it will go in right place, and the flasher will work.

BUG=TBD, Vadim?
TEST=manual
Without this change:

$ cros_write_firmware -b daisy -w usb \
-d /build/daisy/firmware/dts/exynos5250-snow.dts \
-F spi -i /build/daisy/firmware/image-snow.bin -V -D -O out

just does a verified boot into the kernel.

With this change, it runs the flasher.

Change-Id: I53a50fd9bb19ec2ff2dc2e88b0dc894937678957
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43503

3 months agoMove update_metadata_pb2.py to host/lib 51/43551/2
Gilad Arnold [Tue, 19 Feb 2013 23:20:00 +0000 (15:20 -0800)]
Move update_metadata_pb2.py to host/lib

This is the proper location in order for it to be included when
dependent code is being run from the chroot.

BUG=None
TEST=File imported appropriately

Change-Id: I86dc54d542aad89affa7628b2446ffaed2f274f6
Reviewed-on: https://gerrit.chromium.org/gerrit/43551
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
3 months agoTelemetry-Autotest Integration: Run telemetry from Devservers. 13/43313/7
Simran Basi [Thu, 14 Feb 2013 21:39:18 +0000 (13:39 -0800)]
Telemetry-Autotest Integration: Run telemetry from Devservers.

As part of integrating telemetry into the autotest lab, we need the
devservers to extract and install telemetry for a given build.

BUG=chromium-os:37411
TEST=ran local devserver and through the rpc's downloaded the desired
build and made the rpc call to setup and stage telemetry and ensured
that it ran successfully.

Change-Id: I88cde49a177e484d8277369f6764e28a313dfd3e
Reviewed-on: https://gerrit.chromium.org/gerrit/43313
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Simran Basi <sbasi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
3 months agoMake devtools operate without chroot directories present 99/43499/4
Vadim Bendebury [Tue, 12 Feb 2013 21:19:50 +0000 (13:19 -0800)]
Make devtools operate without chroot directories present

To be able to program images when servo is controlled by the
Beaglebone board, the cros-devutils suite must be capable of operating
not only ouside chroot, but also in a situation where there is no
Chrome OS chroot directory tree present.

This change prevents the exception previously thrown in this case.

BUG=chrome-os-partner:15610
TEST=manual

   . programming DUT from inside chroot still works (the following
     command succeeds):

    $ cros_write_firmware -b daisy -w usb -d exynos5250-snow -F spi -i \
          /build/daisy/firmware/image-snow.bin -V

   . unittests still pass

    $ FEATURES=test sudo -E emerge cros-devutils

   . programming when servod is hosted by Beaglebone also works

Change-Id: I7a075b92898f93b1447bed70eca27a6510329482
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43499
Reviewed-by: Simon Glass <sjg@chromium.org>
3 months agoDo not add 'sudo' when run by root 26/43526/2
Vadim Bendebury [Tue, 19 Feb 2013 20:38:15 +0000 (12:38 -0800)]
Do not add 'sudo' when run by root

Attempting to sun commands with sudo when the user is root are
harmful, don't do that.

BUG=chrome-os-partner:15610
TEST=manual

   . verified that cros_write_firmware works when run a root on
     Beaaglebone board:

    cros_write_firmware -b daisy -w usb -d /var/tmp/3690/dts/exynos5250-snow.dts \
      -F spi -i /var/tmp/3690/image-snow.bin -V -D

   . unittests still pass

   FEATURES=test sudo -E emerge cros-devutils

Change-Id: I798b948e2881cab388da732e6edf55f5112ef17f
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43526
Reviewed-by: Simon Glass <sjg@chromium.org>
3 months agoUpdate payload protobuf compiled to a Python module 90/43390/2
Gilad Arnold [Fri, 15 Feb 2013 08:45:42 +0000 (00:45 -0800)]
Update payload protobuf compiled to a Python module

We need this file as a dependency for update payload parsing. It is
compiled from src/platform/update_engine/update_metadata.proto by
invoking:

protoc --proto_path=.../src/platform/update_engine \
  --python_out=.../src/platform/dev/host \
  .../src/platform/update_engine/update_metadata.proto

Note that we will need to regenerate this file every time the original
is being updated.

BUG=None
TEST=None

Change-Id: Ic66c9591d1d741aca24da5c098df283e42bf1486
Reviewed-on: https://gerrit.chromium.org/gerrit/43390
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

3 months agoAvoid leaving temp directory behind unintentionally 28/43428/4
Vadim Bendebury [Fri, 15 Feb 2013 18:19:57 +0000 (10:19 -0800)]
Avoid leaving temp directory behind unintentionally

In some cases when cros utilities are interrupted, the temporary
directory is left behind in the /tmp folder. It is not completely
clear why it happens, as the directory is supposed to be removed by
the __exit__() method of the Tools class.

This patch streamlines the logic (if user provides the temp directory
name, it will not be deleted even if -p flag is not given), and makes
sure that the directory uses a distinct name, so is there are some
leftovers it is easy to associate them with this utility.

BUG=None
TEST=manual

   . made sure that

    $ FEATURES=test sudo -E emerge cros-devutils

   still succeeds

   . tried different variants of invoking cros_write_firmware

   $ cros_write_firmware -b daisy -w usb -d exynos5250-snow \
       -F spi -i /build/daisy/firmware/image-snow.bin -V

    no tmp directory left behind

   -----
   $ cros_write_firmware -b daisy -w usb -d exynos5250-snow \
       -F spi -i /build/daisy/firmware/image-snow.bin -V

    /tmp/cros-dev.SicHJJ left behind

   -----
   $ cros_write_firmware -b daisy -w usb -d exynos5250-snow \
       -F spi -i /build/daisy/firmware/image-snow.bin -V -O /tmp/xyz

   /tmp/xyz was created and left behind
   -----
   $ cros_write_firmware -b daisy -w usb -d exynos5250-snow \
       -F spi -i /build/daisy/firmware/image-snow.bin -V -O /xyz/zyx
   fails with error message:

   Cannot make output directory '/xyz/zyx': 'Permission denied'

Change-Id: Ia365fdb8eea8e994ea3c9453c61ca5ee51ac6e3c
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43428

3 months agoAdd artifact_info to the Makefile for the devserver to work in the chroot. 85/43485/2
Chris Sosa [Mon, 18 Feb 2013 03:29:41 +0000 (19:29 -0800)]
Add artifact_info to the Makefile for the devserver to work in the chroot.

BUG=None
TEST=Ran devserver in the chroot after working on / merging cros-devutils.

Change-Id: I67f1fb59f9f194516866a7bb4157e37cc0804664
Reviewed-on: https://gerrit.chromium.org/gerrit/43485
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
3 months agoImplement stage RPC which allows user to specify artifacts. 01/42401/9
Chris Sosa [Thu, 31 Jan 2013 20:11:38 +0000 (12:11 -0800)]
Implement stage RPC which allows user to specify artifacts.

As specified in goto/devserver-cache, implement the stage RPC
and replace existing calls download/symbol/wait_for_status/stage_images
with their respective stage calls.

I'm supporting the old rpc's by mapping them to stage for now until
all callers use the new RPC. Advantage of using the new rpc means
less being downloaded (only download what you need rather than
everything).

This is a very large code change, sadly I can't really break it up that
much. Fortunately it's mostly deleting old/dead code.

If you haven't read the doc yet, please read it before reviewing (
http://goto.google.com/devserver-cache ). You can
pretty much review all the new code stand-alone without looking at what
we are replacing.

BUG=chromium-os:38427
TEST=Pylint + Unittests + download, wait_for_status, stage separately
using different combinations. Still continuing testing of debug symbols
etc.

Change-Id: I201dcdaa8a14024247eca222a8f2e47deea464b9
Reviewed-on: https://gerrit.chromium.org/gerrit/42401
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
3 months agoAlways use the final 1MB of the coreboot image when building a bootstub. 80/43380/2
Gabe Black [Fri, 15 Feb 2013 05:32:10 +0000 (21:32 -0800)]
Always use the final 1MB of the coreboot image when building a bootstub.

This coincidentally works when building for x86 systems which have 8MB images
which have Coreboot in the final 1MB, and for ARM systems with 1MB images
where Coreboot occupies the whole thing. The final image will be 4MB, but the
image produced by Coreboot itself is 1MB.

This has all worked by coincidence before and will continue too with this
approach, only in more cases. A more robust mechanism should be found.

BUG=chrome-os-partner:17340
TEST=Built and booted depthcharge on Link.
BRANCH=None

Change-Id: Ia8aaf14cf2f4e56452c3d2e057ca6001758229db
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/43380
Reviewed-by: Ronald G. Minnich <rminnich@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
3 months agoFix lint warnings 66/43366/2
Vadim Bendebury [Thu, 14 Feb 2013 23:40:34 +0000 (15:40 -0800)]
Fix lint warnings

While submitting the previous change noticed that there are many
warnings generated by pylint (ignored until now...).

The vast majority of them were indicating genuine problems, a few of
them did not make sense and had to be suppressed through the
`#pylint:' comment

BUG=none
TEST=run the unit tests

      $ FEATURES=test sudo -E emerge cros-devutils

    also made sure the following command succeeds:

     $ cros_write_firmware -b daisy -w usb -d exynos5250-snow \
          -F spi -i /build/daisy/firmware/image-snow.bin -V

Change-Id: Id5451ff9bff38e611091e029cb0079197f774131
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43366
Reviewed-by: Simon Glass <sjg@chromium.org>
3 months agoMake test failures trigger ebuild failures. 65/43365/2
Vadim Bendebury [Thu, 14 Feb 2013 23:24:17 +0000 (15:24 -0800)]
Make test failures trigger ebuild failures.

Many crosdev tests use the doctest.testmod() method to run inlined
tests. The problem is that test failures go unnoticed, as the return
value of the testmod() method is ignored. It is possible to invoke
this method such that it would throw an exception on any test failure,
but this would prevent the following tests from running.

A better solution is to assert in number of encountered failures is
not zero.

BUG=none
TEST=manual
    . try running

     $ FEATURES=test sudo -E emerge cros-devutils

    twice, first time with the code as submitted(it passes) and
    another time with one of asserts replaced with

    'assert doctest.testmod().failed != 0'

    in which case the ebuild reports failure.

Change-Id: I379b0f6f6f9286f4e65cc79dcef17c745b50b25b
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43365
Reviewed-by: Simon Glass <sjg@chromium.org>
3 months agocros_bundle_firmware: Add an option to disable defaults 04/43004/8
Simon Glass [Sat, 9 Feb 2013 21:44:14 +0000 (13:44 -0800)]
cros_bundle_firmware: Add an option to disable defaults

These tools have a lot of default settings. They are useful in normal
operation but can also obscure problems or missing files.

Add a -D option to disable all defaults. Every file needed by the
tool will then need to be provided explicitly using command line
parameters.

Add tests for this functionality also.

BUG=chromium-os:38684
TEST=FEATURES=test sudo -E emerge cros-devutils

Change-Id: I26121f4fe3095d86bb10bbc266df69dc0f8f1dc6
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43004

3 months agoEnhance cros_write_firmware to properly report results 56/43256/3
Vadim Bendebury [Thu, 14 Feb 2013 03:25:22 +0000 (19:25 -0800)]
Enhance cros_write_firmware to properly report results

There are many different failure modes cros_write_firmare may
experience. This change exposes them all in the final error message.

BUG=none
TEST=manual
  . tried running it in many different failure modes, all reported as expected.
  . ebuild tests pass too:

   $ FEATURES=test sudo -E emerge cros-devutils

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Change-Id: I21d4e5f9c0dd4b7494b4cdb558b13f270a897975
Reviewed-on: https://gerrit.chromium.org/gerrit/43256
Reviewed-by: Simon Glass <sjg@chromium.org>
Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
3 months agocros_write_firmware: Extract U-Boot from payload image in extremis 05/43005/4
Simon Glass [Sat, 9 Feb 2013 19:59:36 +0000 (11:59 -0800)]
cros_write_firmware: Extract U-Boot from payload image in extremis

When using cros_write_firmware outside of the chroot, it is inconvenient
to have to provide u-boot.bin and other components just so that
write_firmware can build a flasher.

In fact all the necessary components are in the image and can be extracted
from this automatically. Add this feature.

BUG=chromium-os:38684
TEST=manual
Remove the files from the firmware directory:

$ sudo rm /build/daisy/firmware/smdk5250-spl.*
$ sudo rm /build/daisy/firmware/E5250.nbl1.bin
$ sudo rm /build/daisy/firmware/u-boot.bin

Check that cros_write_firmware still works and prints appropriate warnings:

$ cros_write_firmware -b daisy /build/daisy/firmware/image-snow.bin \
-d exynos250-snow -F spi
Extracting U-Boot from payload
Extracting BL1 from payload
Extracting BL2 from payload
...

Run the same with the -D flag:
$ cros_write_firmware -b daisy /build/daisy/firmware/image-snow.bin \
-d /build/daisy/firmware/dts/exynos5250-snow.dts -F spi
Extracting U-Boot from payload
Extracting BL1 from payload
Extracting BL2 from payload
...

Change-Id: I38a5651d3fe82f256d64a1d628f514bbadfc753f
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43005

3 months agocros_bundle_firmware: Tidy up selection of defaults 03/43003/4
Simon Glass [Sat, 9 Feb 2013 21:44:14 +0000 (13:44 -0800)]
cros_bundle_firmware: Tidy up selection of defaults

At present the code to setup default filenames is called from SelectFdt(),
so cros_write_firmware ends up calling it twice. Untangle this.

BUG=chromium-os:38684
TEST=FEATURES=test sudo -E emerge cros-devutils

Change-Id: Ieaa25930b38fc4eb96e77c856666acfb1cd0292e
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43003

3 months agocros_bundle_firmware: Allow operation without servo 02/43002/4
Simon Glass [Sat, 9 Feb 2013 21:39:26 +0000 (13:39 -0800)]
cros_bundle_firmware: Allow operation without servo

While servo is useful for automation, we should respect a request to not
use it. For em100 and Tegra it isn't really needed. Even for exynos is
can be avoided if the user pressed buttons at the right time.

BUG=none
TEST=FEATURES=test sudo -E emerge cros-devutils

Change-Id: I78b7151b9117556cd7ce306dab354164f8126e13
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43002

3 months agocros_bundle_firmware: Deal with missing skeleton file 01/43001/3
Simon Glass [Sat, 9 Feb 2013 21:38:03 +0000 (13:38 -0800)]
cros_bundle_firmware: Deal with missing skeleton file

This file is optional, so don't require it.

BUG=none
TEST=FEATURES=test sudo -E emerge cros-devutils

Change-Id: Ib73844957aae1f34d9864a7138ced6fd8e28c4e4
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43001
Reviewed-by: Randall Spangler <rspangler@chromium.org>
3 months agodev_install: dereference symlinks 89/43189/2
Mike Frysinger [Wed, 13 Feb 2013 19:25:37 +0000 (14:25 -0500)]
dev_install: dereference symlinks

If the files in /etc/make.profile are symlinks, dereference them.
Otherwise, when we try to update/modify those files, we get an
error because they're pointing to files in /.

This is needed now that dev-install installs into /usr/share and
then symlinks its files into /etc.

BUG=chromium-os:38789
TEST=`dev_install` on board now works (no longer errors out on read-only rootfs)

Change-Id: Ic52e635c08cd5d33ada7c75377ed5bb2fada8c44
Reviewed-on: https://gerrit.chromium.org/gerrit/43189
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
3 months agoMake sure cros_write_firmware reports actual status 60/43160/3
Vadim Bendebury [Wed, 13 Feb 2013 01:00:06 +0000 (17:00 -0800)]
Make sure cros_write_firmware reports actual status

The cros_write_firmware/cros_bundle_firmware utilities (both using
write_firmware.py) when programming ARM targets make the best effort
but do not have actual information about the flash programming
success/failure.

A recent enhancement of the servo driver allows the client to access
the CPU console output, where the programming success/failure is
reported. This change makes use of that enhancement.

When an ARM bootprom is being programmed and the -V (verify) option is
included, the programmer starts console output capture before
programming and examines the console stream generated while
programming, looking for the strings confirming success of failure of
the procedure.

Some refactoring is also thrown in:

 . the update and verify flags are stored in the Write object instead
   of being passed through multiple layers

 . _PrepareFlasher() is a private method

 . DutControl() becomes a public method

BUG=chrome-os-partner:15610
TEST=manual
 . run the following commands:
   $ cros_write_firmware -b daisy -w usb -d exynos5250-snow -F spi -i \
           /build/daisy/firmware/image-snow.bin -V

   - succeeds

   $ cros_write_firmware -b daisy -w usb -d exynos5250-snow -F spi -i \
          /build/daisy/firmware/image-snow.bin -V \
          -U /build/daisy/firmware/ec.bin

   - fails with "Target console dead, programming failed" error
     message (notice the bogus flasher)

Change-Id: I08c3d26833e842d23608d9c1b78000ff9cf32ae3
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43160
Reviewed-by: Simon Glass <sjg@chromium.org>
3 months agoAdd backup files ending in ~ to .,gitignore 00/43000/3
Simon Glass [Sat, 9 Feb 2013 19:27:55 +0000 (11:27 -0800)]
Add backup files ending in ~ to .,gitignore

This is a common backup file name (e.g. for Kate), so ignore it.

BUG=none
TEST=manual
In the source directory
$ touch backup-file~
$ git status
See that 'backup-file~' does not appear in the output now

Change-Id: Ia6714af27eb78a4a386cb341de05288ea78efc21
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43000
Reviewed-by: Mike Frysinger <vapier@chromium.org>
3 months agocros_bundle_firmware: Improve error message for bad flashmap 39/42939/5
Simon Glass [Fri, 8 Feb 2013 18:58:25 +0000 (10:58 -0800)]
cros_bundle_firmware: Improve error message for bad flashmap

Add a bit more detail to this error message to help the user find the
right node.

BUG=none
TEST=FEATURES=test sudo  -E emerge cros-devutils

With an incorrect node in the flashmap such as:

/* ---- Section: Rewritable VPD 32 KB ---- */
rw-vpd {
label = "rw-vpd";
/* Alignment: 4k (for updating) */
rexg = <0x003f0000 0x00008000>;
type = "wiped";
wipe-value = [ff];
};

it would previously say:

Must specify either 'reg' or 'size' in flashnode

but that doesn't really help find where the problem is. With this change
we get:

Must specify either 'reg' or 'size' in flashnode 'rw-vpd'

Change-Id: I2468414bcad19e179dc7fb106560eb6cabdd7808
Reviewed-on: https://gerrit.chromium.org/gerrit/42939
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Commit-Queue: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
3 months agoEnhance cros_write_firmware to report success explicitly 18/42818/3
Vadim Bendebury [Thu, 7 Feb 2013 00:36:28 +0000 (16:36 -0800)]
Enhance cros_write_firmware to report success explicitly

When cros_write_firmware utility is invoked to program an ARM system's
firmware, the verification success is not reported on the console (the
failures are reported implicitly when a CRC mismatch is
detected). After this change both success and failure are reported
explicitly, which allows scripting tools to look for known patterns.

BUG=chrome-os-partner:15610
TEST=manual
  . run the following command:

    $ cros_write_firmware -b daisy -w usb -d exynos5250-snow  -F spi \
        -i /build/daisy/firmware/image-daisy.bin  -V
    observed

Image Programmed Successfully

    showing up on the DUT console

  . corrupted the SPI Flash contents on Snow, modified
    write_firmware.py to update only part of the image and reran the
    above command.

    observed

        CRC32 for 43e66000 ... 44265fff ==> 1e801933 != 4d3a430a ** ERROR **
        ** Checksum error on readback, programming failed!! **

    showing up on the DUT console

Change-Id: Id25884ba1be5d5d3b8e0efb957c1a3b671883e33
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42818
Reviewed-by: Simon Glass <sjg@chromium.org>
3 months agocros_bundle_firmware: Use 'size' property in flashmap if available 38/42938/4
Simon Glass [Fri, 8 Feb 2013 18:11:56 +0000 (10:11 -0800)]
cros_bundle_firmware: Use 'size' property in flashmap if available

We permit use of a 'size' property instead of the full:

   reg = <offset size>;

so use this in the function that reads a size from a flashmap node.

BUG=chrome-os-partner:17757
TEST=FEATURES=test sudo  -E emerge cros-devutils

Change-Id: Ibce2aa7735010560a63a91fffac750676b5aca8d
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42938
Reviewed-by: Randall Spangler <rspangler@chromium.org>
3 months agocros_bundle_firmware: Track %age of each region used, and total 37/42937/4
Simon Glass [Thu, 17 Jan 2013 21:01:24 +0000 (13:01 -0800)]
cros_bundle_firmware: Track %age of each region used, and total

This makes it easier to see how much space is being wasted in the image.

BUG=chrome-os-partner:17757
TEST=FEATURES=test sudo  -E emerge cros-devutils

Plus manually run cros_bundle_firmware and see that it prints out the
information:

$ cros_bundle_firmware -b daisy -v2

It prints lines like this:
Entry: RW_VPD, size 0x8000, data 0x8000, usage 100%
Entry: VBLOCK_B, size 0x2000, data 0x112c, usage 53%

Change-Id: I448d3e5e27bfaf6763566a39838aa635c8a05a26
Reviewed-on: https://gerrit.chromium.org/gerrit/42937
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Commit-Queue: Simon Glass <sjg@chromium.org>

3 months agocros_bundle_firmware: Remove test.dtb file now it is generated 36/42936/4 stabilize-bluetooth-smart
Simon Glass [Fri, 8 Feb 2013 19:00:29 +0000 (11:00 -0800)]
cros_bundle_firmware: Remove test.dtb file now it is generated

This file is generated by a script, so we can remove it from the repo
now.

BUG=none
TEST=FEATURES=test sudo  -E emerge cros-devutils

Change-Id: I5071872881fe2672cce66777436c4c1bdc09a127
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42936
Reviewed-by: Mike Frysinger <vapier@chromium.org>
3 months agocros_bundle_firmware: Add a script to build the test file 35/42935/5
Simon Glass [Fri, 8 Feb 2013 18:58:53 +0000 (10:58 -0800)]
cros_bundle_firmware: Add a script to build the test file

Instead of checking in the test file as a binary, create a script to
build it.

BUG=none
TEST=FEATURES=test sudo -E emerge cros-devutils

Change-Id: I47077c349b88ba934ad5d1238aa775f8b59e8679
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42935
Reviewed-by: Mike Frysinger <vapier@chromium.org>