Commit Graph

8 Commits

Author SHA1 Message Date
Bill Richardson
ec15b1fce9 Protect ARRAY_SIZE macro from being #defined twice
BUG=chrome-os-partner:7459
TEST=none

Change-Id: I3664ad9db4a4e0cecd38443bf01f99531ba80972
Reviewed-on: https://gerrit.chromium.org/gerrit/22183
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-05-09 10:46:38 -07:00
Bill Richardson
2448d3b3bc Create vbutil_ec tool for signing EC firmware.
This just adds the vbutil_ec tool (and a simple test of the library
functions related to it).

BUG=chrome-os-partner:7459, chromium-os:27142
TEST=manual

  make
  make runtests

Change-Id: I2a2c4e7cfb8ac6ce2229c5de4252a5cc89321fa5
Reviewed-on: https://gerrit.chromium.org/gerrit/21868
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2012-05-04 12:16:45 -07:00
Randall Spangler
a712e01ae7 Add support for flags in the firmware preamble.
The old (v2.0) parser is compatible with new (v2.1) structs.  That is,
this won't break existing firmware or vbutil_firmware.

A new (v2.1) parser parsing an old (v2.0) struct will return 0 for the
flags.

This will be used to support the RO-normal code path in a subsequent CL.

BUG=chromium-os:17304
TEST=added unit tests; make && make runtests

Change-Id: I73bcd8acd3330b0d7d143061b5ef838e6d79cf1a
Reviewed-on: http://gerrit.chromium.org/gerrit/4030
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-13 10:13:12 -07:00
Vadim Bendebury
c3574086a8 Introduce arm support in crossystem.
This CL builds upon earlier firmware and kernel changes (see CLs
related to the same bug, chromium-os:12522).

ARM firmware now simulates both Nvram storage and VDAT buffer, the
structures the x86 version uses extensively to communicate back and
forth between firmware/kernel/userland.

So, to make crossystem work on arm, all what's needed is to provide
architecture specific interface to Nvram and VDAT simulation, and
architecture specific processing for variables which are accessed on
ARM platforms in a different way.

The few discrepancies and platform specifics which had to be addressed
for ARM specifically are as follows:

- the Nvram contents are cached in the shared memory and available for
  reading as part of /sys/kernel/debug/chromeos_arm. When writing
  Nvram, the same file needs to be written, but only the 16 bytes
  (representing the Nvram contents) are aacepted.

- the VDAT buffer also comes from the shared memory (as part of the
  same sysfs file)

- when crossystem starts, it needs to read in this shared memory
  contents, a` weak' function VbArchInit() is being added such that it
  is provided on ARM platforms only, on x86 an empty stub is called.

- current developer/recovery request/ro firmware switch states are
  retrieved through GPIO drivers. The GPIO numbers are defined in the
  file, the GPIO driver is supposed to be configured before
  crsossystem can operate.

- the BINF values are supplied through an array within shared memory,
  it would be easy to refactor both x86 and ARM use the same code to
  process BINF values, but with this submission the code is duplicated
  to minimize x86 impact.

- the following crossystem variables do not have ARM equivalents,
  thier values are reported as '(error)':

   recoverysw_ec_boot
   savedmem_base
   savedmem_size

BUG=chromium-os:12522
TEST=manual:

. bring up a kaen system
. execute the following script to enable the appropriate GPIOSs:

 for gpio in 56 59 168; do echo $gpio > /sys/class/gpio/export; done

. run `crossystem' and observe reasonable output values

. to verify that it reads GPIOs properly, try

  echo $(./crossystem recoverysw_cur)

  with the miniservo 'GOOG_REC' button pressed and released, observe
  different readings (note that the state of the button is reversed,
  the released button is reported as '1')

. to verify the write capabilities, note that the nvram contents can
  be accessed using the following shell commands

     echo 3 > /proc/sys/vm/drop_caches
     2>/dev/null dd if=/dev/mmcblk0 of=/tmp/blk bs=16 count=1 && \
       od -t x1 /tmp/blk | head -1

 (the first command cause the device cache dropped, and the second
 command accesses the device contents.

   vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
   localhost var # echo $(./crossystem fwb_tries)
   10
   localhost var # echo 3 > /proc/sys/vm/drop_caches
   localhost var # 2>/dev/null dd if=/dev/mmcblk0 of=/tmp/blk bs=16 count=1 && od -t x1 /tmp/blk | head -1
   0000000 60 0a 00 be 00 00 00 00 00 00 00 02 00 00 00 a2
   localhost var # ./crossystem fwb_tries=9
   localhost var # echo $(./crossystem fwb_tries)
   9
   localhost var # echo 3 > /proc/sys/vm/drop_caches
   localhost var # 2>/dev/null dd if=/dev/mmcblk0 of=/tmp/blk bs=16 count=1 && od -t x1 /tmp/blk | head -1
   0000000 60 09 00 be 00 00 00 00 00 00 00 02 00 00 00 8a
   localhost var #
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Change-Id: Ie4c6ff44441d98a42b1057953208fdb90c08f46d
Reviewed-on: http://gerrit.chromium.org/gerrit/113
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
2011-05-05 14:42:09 -07:00
Randall Spangler
95c4031ce9 This is necessary to pass additional information about whether firmware A or B is being run. This change also passes the GBB directly into LoadFirmware() and LoadKernel().
Change-Id: I976c11c82c3d665a4feb88226e919f16c2440f60

BUG=chrome-os-partner:1657
TEST=manual - see below

make && make runtests

Then test verifying a test image in both dev mode (-b1, no key specified) and recovery mode (key specified)

build/utility/load_kernel_test -b1 ~/b/USB_images/0.11.224.0-alex/chromiumos_test_image.bin

build/utility/load_kernel_test ~/b/USB_images/0.11.224.0-alex/chromiumos_test_image.bin tests/devkeys/recovery_key.vbpubk

And make sure the firmware with this change actually boots to USB and SSD.

NOTE: u-boot-next needs to change to work with this change.  will attempt a follow-up CL with that change

Review URL: http://codereview.chromium.org/6626045
2011-03-09 15:54:16 -08:00
Randall Spangler
138acfe1ba Fix KeyBlockVerify() to take an explicit param for whether to use hash only.
Fix VerifyMemberInside().

BUG=chrome-os-partner:703
TEST=make && make runtests

Review URL: http://codereview.chromium.org/3126013
2010-08-17 15:45:21 -07:00
Randall Spangler
87c13d806b Added size param to VerifyData()
Also renamed verify preamble functions, now that they do not need the
'2' at the end to differentiate them from the now-deleted original
implementation.

BUG=4501
TEST=Ran make runtests; all pass.

Review URL: http://codereview.chromium.org/3027009
2010-07-19 10:35:40 -07:00
Randall Spangler
620c38cf34 Remove unused files, and tidy the directory structure of the remaining ones.
Review URL: http://codereview.chromium.org/2815011
2010-06-17 14:45:22 -07:00