chromiumos/platform/vboot_reference.git
38 hours agoProvide MTD version of common functions 91/49791/4 factory-4290.B master
Albert Chaulk [Thu, 28 Mar 2013 22:25:33 +0000 (15:25 -0700)]
Provide MTD version of common functions

Provide an MTD implementation of several common functions in cgpt_common.c

BUG=chromium:221745
BRANCH=none
TEST=none

Original-Change-Id: Ib3248c283ca31e33a91b9ea0c14b2f72ea7c5850
Reviewed-on: https://gerrit.chromium.org/gerrit/47029
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
Tested-by: Albert Chaulk <achaulk@chromium.org>
(cherry picked from commit b0bd7e4cf8dd15cc3c371dac157093c7e7c7a874)

Change-Id: I243c2bf98a88d0019c332b274868459b5f1b8ea1
Reviewed-on: https://gerrit.chromium.org/gerrit/49791
Reviewed-by: Albert Chaulk <achaulk@chromium.org>
Tested-by: Albert Chaulk <achaulk@chromium.org>
Commit-Queue: Albert Chaulk <achaulk@chromium.org>

5 days agoImplement no-op commands 90/49790/3 factory-pit-4280.B stabilize-4287.B
Albert Chaulk [Fri, 29 Mar 2013 17:27:08 +0000 (10:27 -0700)]
Implement no-op commands

Provide implementations for "boot" and "legacy" that error out in MTD mode and
"repair" that is a no-op. Eventually if/when we add redundancy, repair will do
something, but boot/legacy never will.

BUG=chromium:221745
BRANCH=none
TEST=none

Original-Change-Id: Ie537f20d8dff9d14fb83d0431bd48453bff0217d
Reviewed-on: https://gerrit.chromium.org/gerrit/46883
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
Reviewed-by: Albert Chaulk <achaulk@chromium.org>
Tested-by: Albert Chaulk <achaulk@chromium.org>
(cherry picked from commit 00c4bc52e35c7c77ebe73322693a457b3dd072f9)

Change-Id: I90e6118114554a05245fb8cfcec9567c4705ea96
Reviewed-on: https://gerrit.chromium.org/gerrit/49790
Reviewed-by: Albert Chaulk <achaulk@chromium.org>
Tested-by: Albert Chaulk <achaulk@chromium.org>
Commit-Queue: Albert Chaulk <achaulk@chromium.org>

7 days agoAdd GBB flags for disabling software sync and defaulting to legacy boot 70/58270/2 factory-spring-4262.B
Randall Spangler [Tue, 11 Jun 2013 23:53:07 +0000 (16:53 -0700)]
Add GBB flags for disabling software sync and defaulting to legacy boot

1) GBB flag to skip EC software sync, so EC will be untouched.  Needed
for EC development.

2) GBB flag to default to booting legacy at end of dev screen timeout.
Very handy for booting Ubuntu (or other OS).

Also added unit tests for the new flags.

BUG=chrome-os-partner:20111
BRANCH=none
TEST=make runtests

Change-Id: I9da87d87014881a1b1393b0b4a5acb921d080066
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/58270
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
7 days agoEC software sync no longer checks for shutdown requested 09/58109/4
Randall Spangler [Mon, 10 Jun 2013 19:31:00 +0000 (12:31 -0700)]
EC software sync no longer checks for shutdown requested

This means that in normal mode the system will boot all the way to the
OS before shutting down.

In developer or recovery modes, the BIOS screens will still check for
shutdown requested and shut down if so.  This is necessary in
developer mode for security reasons, and because there's no guarantee
that a dev OS will still pay attention to the lid switch.

BUG=chrome-os-partner:17521
BRANCH=spring
TEST=make runtests; unit tests pass

Change-Id: I0698b659ad0febcf73043f1e8c5b98681c1bc5ba
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/58109

9 days agoIntegrate the flash key-value store code into cgpt. 89/49789/6 stabilize-4255.B
Albert Chaulk [Wed, 20 Mar 2013 21:46:50 +0000 (14:46 -0700)]
Integrate the flash key-value store code into cgpt.

Integrates the FTS driver into cgpt. This driver is binary-format compatible
with the linux driver for interoperabiilty. The cgpt changes load & store a
hex-encoded mtd partition table in the FTS; we need some sort of encoding
because FTS only stores NUL-terminated strings.

Currently, the mtd code paths aren't executed in cgpt, only in the tests. It's
also not hooked up to the vboot code yet, we will need to do that eventually.

BUG=chromium:221745
TEST=new unit test added
BRANCH=none

Change-Id: I94eb0389d29aca0beb9d9a644465c7d86161b3c2
Original-Change-Id: I9fe2fa91b666572563426adb8fa9d426f9b60bbf
Reviewed-on: https://gerrit.chromium.org/gerrit/46796
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
Reviewed-by: Albert Chaulk <achaulk@chromium.org>
Tested-by: Albert Chaulk <achaulk@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49789

3 weeks agocrossystem: Add device IDs for haswell 75/56075/2
Duncan Laurie [Tue, 21 May 2013 18:20:18 +0000 (11:20 -0700)]
crossystem: Add device IDs for haswell

0x8086,0x0a04 is Haswell ULT
0x8086,0x0c04 is Haswell Mobile

BUG=chrome-os-partner:19263
BRANCH=none
TEST=manual test on slippy hardware:

$ crossystem platform_family
Haswell

Change-Id: Ia885d0c8f0be2fb626257ca513f581df50259173
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56075
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 weeks agoChanged to use sed for regex pattern matching 03/51503/4
Paul Taysom [Thu, 16 May 2013 21:27:09 +0000 (14:27 -0700)]
Changed to use sed for regex pattern matching

The code was using a mixture of shell patterns and
sed regular expression. Changed code to just used
sed regex. This will let me use more complex regex
that are needed for adding PARTUUID to uuids.

BUG=chromium:241572
TEST=./security_test_image
BRANCH=none

Change-Id: I2e8570051b31d580ae36cb82f05383a33236b88e
Reviewed-on: https://gerrit.chromium.org/gerrit/51503
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Paul Taysom <taysom@chromium.org>
Tested-by: Paul Taysom <taysom@chromium.org>
4 weeks agoAdded support for PARTUUID= 03/51303/3
Paul Taysom [Wed, 15 May 2013 16:23:39 +0000 (09:23 -0700)]
Added support for PARTUUID=

The Linux kernel expects partitions that are identified by uuid,
to have the the uuid prefixed by "PARTUUID=" and an optional suffix
of "PARTRNOFF=%d".

The change adds additional pattern matching for these strings.

This will also let get rid of custom uuid processing in dm-verity,
dm-bootcache and dm-verity-chromeos.

BUG=chromium:224066
TEST=security_test_image with old and new command line
BRANCH=none

Change-Id: I71b89dd1df8d7ccd5768c2784078bb869d546bf3
Reviewed-on: https://gerrit.chromium.org/gerrit/51303
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Paul Taysom <taysom@chromium.org>
Tested-by: Paul Taysom <taysom@chromium.org>
6 weeks agotpmc: Fix compilation with MOCK_TPM=1 25/50225/2 factory-4128.B factory-spring-4131.B release-R28-4100.B stabilize-4100.38.B
Duncan Laurie [Mon, 6 May 2013 22:13:10 +0000 (15:13 -0700)]
tpmc: Fix compilation with MOCK_TPM=1

The tpmc utility is failing to build with:
MOCK_TPM=1 emerge vboot_reference

Because some functions are not exported by the
mocked_tlcl library.  This commit adds mocked
functions for TlclPacketSize() and TlclSendReceive()

BUG=chrome-os-partner:19263
BRANCH=none
TEST=manual: MOCK_TPM=1 emerge-fox_wtm2 vboot_reference

Change-Id: Iaf4c2dff78272c41572e3b89444346a03be35fbe
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50225
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
6 weeks agocrossystem: Add LynxPoint to list of valid x86 chipset types 24/50224/2
Duncan Laurie [Mon, 6 May 2013 22:11:07 +0000 (15:11 -0700)]
crossystem: Add LynxPoint to list of valid x86 chipset types

Haswell CPUs are paired with the LynxPoint chipset and this
needs to be a valid controller name for crossystem.

BUG=chrome-os-partner:19263
BRANCH=none
TEST=manual

This was tested on a wtm2 system to ensure that a GPIO
defined in chromeos ACPI that is exported by the kernel at
/sys/devices/platform/chromeos_acpi/GPIO.# is used by crossystem
and the GPIO is exported in /sys/class/gpio and read.

$ cat /sys/devices/platform/chromeos_acpi/GPIO.1/GPIO.2
34
$ cat /sys/class/gpio/gpio196/value
1
$ crossystem wpsw_cur
1

Change-Id: I04064109e99270d7d26b27182b17fffbf47b025b
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50224
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
6 weeks agoRefactor CgptAdd and CgptPrioitize to remove gpt-specific code 88/49788/3
Albert Chaulk [Tue, 26 Mar 2013 20:43:02 +0000 (13:43 -0700)]
Refactor CgptAdd and CgptPrioitize to remove gpt-specific code

- Refactor cgpt_prioitize.c to completely remove gpt-specific code.
- Refactor cgpt_add.c to isolate gpt-dependence to one helper function
and the backup/restore logic
- Change several common apis to take a struct drive* rather than a GptData*,
this provides a path to cleanly implement mtd versions

BUG=chromium:221745
TEST=no functional changes, existing tests cover this
BRANCH=none

Change-Id: I27ed166aae390aa5dc83062f62939e45122edc76
Original-Change-Id: I1b0a73509efbf22411c4ae5cf044feede0a49a33
Reviewed-on: https://gerrit.chromium.org/gerrit/46548
Tested-by: Albert Chaulk <achaulk@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49788

6 weeks agoImplement cgptlib for MTD devices. 93/48793/4
Albert Chaulk [Wed, 20 Mar 2013 23:03:49 +0000 (16:03 -0700)]
Implement cgptlib for MTD devices.

Defines MTD on-disk structures & API in mtdlib.h/c that closely mirrors
the existing cgpt implementation. Currently, the disk structures do not
contain guids or labels, and the number of available partition types and
quantities are limited, exactly what we want to support should be decided
before we ship this.

Adds appropriate test coverage to the unit test library - either by modifying
existing tests, or copying them and changing them accordingly.

BUG=chromium:221745
TEST=added appropriate tests to the unittests
BRANCH=none

Change-Id: Iee19864498024c72229bc3c7811594fe762f52de
Original-Change-Id: I031eca69d6c8e825b02bd0522d57e92b05eb191a
Reviewed-on: https://gerrit.chromium.org/gerrit/46082
Tested-by: Albert Chaulk <achaulk@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48793
Reviewed-by: Albert Chaulk <achaulk@chromium.org>
2 months agovboot_reference: change position of 'const' 83/47883/3 stabilize-4008.0.B stabilize-4035.0.B stabilize-4068.0.B
Yunlian Jiang [Thu, 11 Apr 2013 18:16:59 +0000 (11:16 -0700)]
vboot_reference: change position of 'const'

BUG=chromium:230465
BRANCH=none
TEST=USE="chrome_internal"  CFLAGS="-clang -print-cmdline"
       CXXFLAGS="-clang -print-cmdline" emerge-x86-alex vboot_reference
       passes.

Change-Id: I42466ac27b1ad7f473fc9400461b553646c04617
Reviewed-on: https://gerrit.chromium.org/gerrit/47883
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
2 months agovbutil_kernel: copy zeropage fully 32/47832/2
Kees Cook [Thu, 11 Apr 2013 01:05:51 +0000 (18:05 -0700)]
vbutil_kernel: copy zeropage fully

When copying the vmlinuz zeropage, the entries were being truncated even
though the boot protocol version was being retained. This means that
booting a kernel that depended on details from the zeropage's ignored
areas would find invalid information. Fix this by copying out the entire
possible range of memory.

BUG=chromium:230212
TEST=kernels can boot with CONFIG_RELOCATABLE
BRANCH=None

Change-Id: Ifb94bedcf881e17ab20fff44d8c1c1885b15ef9e
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47832
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2 months agoClarify comment in VbInit() 47/47747/2
Randall Spangler [Wed, 10 Apr 2013 17:37:57 +0000 (10:37 -0700)]
Clarify comment in VbInit()

In recovery mode we ignore all TPM errors.

Just a comment change; no code change.

BUG=none
BRANCH=none
TEST=build vboot

Change-Id: I43ed89d0d38347b55e1f6e17b712814f9b972156
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47747
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2 months agoBuild dump_fmap into futility. 72/47672/2
Bill Richardson [Tue, 9 Apr 2013 17:15:26 +0000 (10:15 -0700)]
Build dump_fmap into futility.

This stops creating dump_fmap as a standalone utility and builds it into
futility. Since it was already invoked as a symlink, no user-visible changes
should be observed.

BUG=chromium:224734
BRANCH=none
TEST=manual, trybots

  sudo FEATURES=test emerge vboot_reference
  FEATURES=test emerge-$BOARD vboot_reference

Change-Id: I68d1bea0c1867043b2633e15509b95c2717009a7
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47672
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2 months agoBuild both static and dynamic versions of futility. 66/47466/6
Bill Richardson [Fri, 5 Apr 2013 20:30:43 +0000 (13:30 -0700)]
Build both static and dynamic versions of futility.

In almost every case we want the dynamically linked version of futility,
because it's smaller and the openssl functions require it (they use
dl_open() to invoke the correct RSA libraries).

However, the AU shellball requires three futility functions (crossystem,
gbb_utility, and dump_fmap). Those pretty much have to be built statically,
because they run from the new rootfs and packing all the dynamic libraries
into the shellball is way too large and complicated.

This change prepares to build both futility (full featured) and futility_s
(just those functions). The scripts that create the AU shellball will
already choose futility_s from /build/$BOARD/.

BUG=chromium:224734
BRANCH=none
TEST=none
CQ-DEPEND=CL:47589

Nothing to test just yet. The AU shellball is currently broken (it uses the
dynamic version of futility and doesn't copy the symlinks anyway), so this
should have no effect. We just need to ensure that the _s version doesn't go
into any of the other images.

Change-Id: I60b8dcd17e135f12a0d29ddacfb9fe8275567c70
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47466

2 months agoAdd framework for testing builtin futility functions. 32/47432/3
Bill Richardson [Fri, 5 Apr 2013 16:49:24 +0000 (09:49 -0700)]
Add framework for testing builtin futility functions.

This tweaks the Makefile and adds a couple of placeholder tests to prepare
for testing the builtin futility operations. There aren't any useful builtin
functions yet, but this lets us start adding them along with the tests.

BUG=chromium:224734
BRANCH=none
TEST=none

This doesn't actually do anything yet.

Change-Id: Iff0ca514f7d26346f072bd80a3bcd04621284843
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47432
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2 months agoInclude generated dependency files for all object files. 07/47407/2
Bill Richardson [Fri, 5 Apr 2013 04:08:50 +0000 (21:08 -0700)]
Include generated dependency files for all object files.

This just fixes the dependencies for repeated manual builds, so that
touching just a couple of files will rebuild the right things. It doesn't do
anything for ebuilds, since those always (or should!) compile everything
from an empty directory.

BUG=chromium:224734
BRANCH=none
TEST=none

Actually, I tested this by adding a fake target that removed all the listed
generated object and dependency files (a side effect of compilation).

  foo:
       rm -f ${ALL_OBJS} ${ALL_DEPS}
       find ${BUILD} -name '*.[od]'

Then run "make clean; make; make foo". If there are any .o or .d files left
over, they needed to be listed explicitly. I found a bunch. This CL takes
care of them.

Change-Id: If33f7e13a9f3dbee023b63aa21a47691746bad25
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47407
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2 months agoFix Makefile to only build fwlib when asked to, not hostlib too. 06/47406/2
Bill Richardson [Fri, 5 Apr 2013 01:16:39 +0000 (18:16 -0700)]
Fix Makefile to only build fwlib when asked to, not hostlib too.

BUG=chromium:224734
BRANCH=none
TEST=manual, trybots

Change-Id: I5811a89c3b68de7fd2da032ecf5a56800b4754a4
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47406
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2 months agoMassive refactoring of external header files. 21/47021/4
Bill Richardson [Fri, 29 Mar 2013 18:09:30 +0000 (11:09 -0700)]
Massive refactoring of external header files.

This reduces the number of exported header files to the minimum needed by
the existing userspace utilities and firmware implementations.

BUG=chromium:221544
BRANCH=none
TEST=manual, trybots
CQ-DEPEND=CL:47019,CL:47022,CL:47023

  sudo FEATURES=test emerge vboot_reference
  FEATURES=test emerge-$BOARD \
                vboot_reference \
                chromeos-cryptohome \
                chromeos-installer \
                chromeos-u-boot \
                peach-u-boot \
                depthcharge

Change-Id: I2946cc2dbaf5459a6c5eca92ca57d546498e6d85
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47021
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2 months agoSimplify the exported FindKernelConfig() function. 34/46834/4
Bill Richardson [Fri, 29 Mar 2013 00:31:24 +0000 (17:31 -0700)]
Simplify the exported FindKernelConfig() function.

FindKernelConfig() is used to extract the kernel cmdline from a kernel
partition. It's only used in the chromeos-installer, but was a bit awkward.
This changes the calling parameters to make it simpler.

BUG=chromium:221544
BRANCH=none
TEST=manual
CQ-DEPEND=CL:46835

  FEATURES=test sudo emerge vboot_reference
  FEATURES=test emerge-$BOARD vboot_reference

Change-Id: Ib7192175d72ad51387d8d122ead4490a4aa62300
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46834

2 months agoAdd a QUIET Makefile option to reduce non-error output 33/46533/2
Simon Glass [Tue, 26 Mar 2013 18:39:21 +0000 (11:39 -0700)]
Add a QUIET Makefile option to reduce non-error output

At present building vboot results in some output when there are no warnings/
errors. Add a QUIET option to suppress this.

BUG=none
BRANCH=none
TEST=manual
Build without QUIET=1

    CC            firmware/lib/cryptolib/padding.o
    CC            firmware/lib/cryptolib/rsa.o
    CC            firmware/lib/cryptolib/rsa_utility.o
    CC            firmware/lib/cryptolib/sha1.o
    CC            firmware/lib/cryptolib/sha256.o
    CC            firmware/lib/cryptolib/sha512.o
    CC            firmware/lib/cryptolib/sha_utility.o
    CC            firmware/lib/stateful_util.o
    CC            firmware/lib/vboot_api_firmware.o
    CC            firmware/lib/vboot_common.o
    CC            firmware/lib/vboot_firmware.o
    CC            firmware/lib/tpm_bootmode.o
    CC            firmware/lib/crc8.o
    CC            firmware/lib/utility.o
    CC            firmware/lib/vboot_api_init.o
    CC            firmware/lib/vboot_common_init.o
    CC            firmware/lib/vboot_nvstorage.o
    CC            firmware/lib/rollback_index.o
    CC            firmware/lib/tpm_lite/tlcl.o
    CC            firmware/lib/cgptlib/cgptlib.o
    CC            firmware/lib/cgptlib/cgptlib_internal.o
    CC            firmware/lib/cgptlib/crc32.o
    CC            firmware/lib/utility_string.o
    CC            firmware/lib/vboot_api_kernel.o
    CC            firmware/lib/vboot_audio.o
    CC            firmware/lib/vboot_display.o
    CC            firmware/lib/vboot_kernel.o
    RM            vboot_fw.a
    AR            vboot_fw.a

Build with QUIET=1:

(no output from Makefile)

Change-Id: I35e057df6c640ed06325092365934d870240b9cf
Reviewed-on: https://gerrit.chromium.org/gerrit/46533
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Commit-Queue: Simon Glass <sjg@chromium.org>

2 months agocrossystem: Fix cros_debug detection on non-chrome systems. 06/46106/2 release-R27-3912.B stabilize-3912.79.B toolchainA
Hung-Te Lin [Thu, 21 Mar 2013 05:02:46 +0000 (13:02 +0800)]
crossystem: Fix cros_debug detection on non-chrome systems.

"cros_debug" is usually the last token of kernel command line on UEFI/legacy
BIOS systems.

However, kernel command line may end with new line ("\n") and that may cause
strcmp to fail (i.e., can't detect "cros_debug" if it's the last parameter in
command line), so we need to add that into strtok delimiters.

BRANCH=none
BUG=chromium:222248
TEST=crossystem cros_debug # display 1 on UEFI system with cros_debug

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

2 months agoApply consistent naming scheme for hostlib functions. 44/46044/3
Bill Richardson [Wed, 20 Mar 2013 22:02:34 +0000 (15:02 -0700)]
Apply consistent naming scheme for hostlib functions.

The chromeos-installer uses several functions from the vboot_reference
userspace library, but the names of those functions are inconsistent:

  IsZero
  MapFile
  VbGetSystemPropertyString
  cgpt_add
  cgpt_boot
  cgpt_create
  cgpt_get_boot_partition_number
  cgpt_get_num_non_empty_partitions
  cgpt_get_partition_details
  cgpt_prioritize
  cgpt_set_attributes
  find_kernel_config

The Google C++ style guide says types and functions should use CamelCase,
while variables use lower_case_with_underscores.

Kernel style (which vboot_reference tries to be more-or-less compatible
with) uses lower_case_with_underscores for everything, but that really only
has to apply to firmware stuff. For userspace, we can use the Google style.

BUG=chromium:221544
BRANCH=none
TEST=buildbot
CQ-DEPEND=CL:46045

Renaming/cleanup only; no functional changes.

Change-Id: I9c82c9ff8909be88586194c8ffdb435fc771195f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46044

3 months agoRemove unused 'autotest' directory (real one's in autotest repo). 94/45994/2
Bill Richardson [Tue, 19 Mar 2013 17:59:56 +0000 (10:59 -0700)]
Remove unused 'autotest' directory (real one's in autotest repo).

There are three tests in the local autotest directory. All of them have been
moved to the autotest repository long ago.

BUG=none
BRANCH=none
TEST=trybot

Change-Id: I53d858db44bd2f84de8a7d61995ebe3d737eaebe
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45994
Reviewed-by: Randall Spangler <rspangler@chromium.org>
3 months agoGet rid of some crufty macros. 87/45687/4
Gabe Black [Sat, 16 Mar 2013 11:03:40 +0000 (04:03 -0700)]
Get rid of some crufty macros.

These were macros that were never used, or that were only set to one thing and
could be substituted up front.

I left in code guarded by the HAVE_ENDIAN_H and HAVE_LITTLE_ENDIAN macros even
though those are never defined because they guard a reportedly significantly
faster implementation of some functionality, at least according to a comment
in the source. It would be a good idea to enable that code path and see if it
really does make a big difference before removing it entirely.

BUG=None
TEST=Built for Link, Daisy, and the host with FEATURES=test. Built depthcharge
for Link and booted in normal mode.
BRANCH=None

Change-Id: I934a4dd0da169ac018ba07350d56924ab88b1acc
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/45687
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
3 months agoGet rid of the now unused biosincludes.h headers. 86/45686/2 stabilize-3881.0.B
Gabe Black [Sat, 16 Mar 2013 08:10:30 +0000 (01:10 -0700)]
Get rid of the now unused biosincludes.h headers.

These are no longer necessary.

BUG=None
TEST=Built for Daisy, Link, Lumpy.
BRANCH=None

Change-Id: I8db7dde1ba52bd5cf1881481ef6a502a5b509439
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/45686
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>

3 months agoDon't include biosincludes.h any more. 85/45685/2
Gabe Black [Sat, 16 Mar 2013 04:19:42 +0000 (21:19 -0700)]
Don't include biosincludes.h any more.

It's no longer necessary and adds complexity.

BUG=None
TEST=Built vboot_reference (with FEATURES=test), chromeos-u-boot, depthcharge,
chromeos-factory, chromeos-factoryinstall, chromeos-initramfs, and
chromeos-cryptohome for daisy, lumpy, link, alex, and fox_wtm2 where
applicable. Built vboot_reference for the host.
BRANCH=None

Change-Id: Ic2d70b92b25d57fd9ca1d9ad47d9889f6adc85e7
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/45685
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
3 months agoWrap all vboot utilities with futility. 71/44871/3 factory-spring-3842.B firmware-spring-3833.B
Bill Richardson [Thu, 7 Mar 2013 20:54:29 +0000 (12:54 -0800)]
Wrap all vboot utilities with futility.

This moves all the old userspace utilities generated by vboot_reference into
a subdirectory not in $PATH, and replaces them with symlinks to a single
executable named 'futility'. At the moment that utility just execs the
original utilities (optionally logging that fact first).

Ultimately, the old utilities will be subsumed into a single binary instead
of multiple separate executables.

There is a matching CL needed to make the recovery image creation work.

BUG=chromium-os:37062
BRANCH=none
CQ-DEPEND=CL:44864
TEST=auto

To test, build everything, test everything. It should work as before in all
cases. I have built normal images, test images, factory installers, recovery
images; they all seem to work.

I've run trybots on daisy-paladin link-paladin lumpy-paladin and alex-paladin.

Change-Id: Ie93db676f2ed2a64e4b13b3b5dc6b65a77db0f8c
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44871
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
3 months agoRename Strncat to StrnAppend, use it instead of strncat. 72/44572/4 firmware-spring-3824.4.B firmware-spring-3824.55.B firmware-spring-3824.B
Bill Richardson [Mon, 4 Mar 2013 23:11:38 +0000 (15:11 -0800)]
Rename Strncat to StrnAppend, use it instead of strncat.

Strncat() looks almost like strncat(), but it's completely different. Change
the name to reduce confusion.

Also fix a place where strncat() was misused anyway.

BUG=none
BRANCH=all
TEST=manual

sudo FEATURES=test emerge vboot_reference
FEATURES=test emerge-$BOARD vboot_reference

Change-Id: I39c30d391aa6566ec67461462e800720ade66a91
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44572

3 months agoUse Memcpy to avoid unaligned accesses when using RollbackKernelSpace. 03/44503/2
Gabe Black [Sun, 3 Mar 2013 05:00:03 +0000 (21:00 -0800)]
Use Memcpy to avoid unaligned accesses when using RollbackKernelSpace.

This structure, like RollbackSpaceFirmware in my previous CL, contains members
that are inherently unaligned. This breaks when the machine running vboot
cares about alignment. Like before, I'm using Memcpy to avoid the direct
unaligned accesses.

BUG=chrome-os-partner:17340
TEST=Built and booted into depthcharge on Snow. Without this change, there's
an unaligned access in RollbackKernelRead. After this change, the unaligned
access goes away and vboot gets at the kernel version successfully.
BRANCH=None

Change-Id: Ifcdcee1ab4bbce74d05e563cb82bef73a1aa9a84
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/44503
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
3 months agoUse Memcpy to access the fw_versions member of RollbackSpaceFirmware. 99/44499/3
Gabe Black [Sun, 3 Mar 2013 02:19:41 +0000 (18:19 -0800)]
Use Memcpy to access the fw_versions member of RollbackSpaceFirmware.

This structure has two uint8_t members and then fw_versions which is a
uint32_t. That means that fw_versions is 32 bits wide but only has 16 bit
alignment, and architectures that care about that sort of thing won't be able
to access it. ARM generally cares about alignment, but there's a bit which
lets you select whether 32 bit accesses can be unaligned. In the past this bit
was ignored, and because this is a 32 bit data type the right load happened to
be used.

To avoid the unaligned access all together, this change makes vboot use Memcpy
to access fw_versions. The number of accesses should be very small so the
overhead should be minimal.

BUG=chrome-os-partner:17340
TEST=Built and booted depthcharge on Snow. Without this change, there was an
unaligned exception during SetupTPM when the fw_versions member was accessed
as part of a VBDEBUG call. With this change, the exception went away and the
TPM was initialized successfully.
BRANCH=None

Change-Id: I1ed705f2de450c65f986c1c7ba30da15c0150f74
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/44499
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
3 months agoMove CgptManager from vboot_reference to installer 42/44442/3
Bill Richardson [Thu, 28 Feb 2013 21:53:09 +0000 (13:53 -0800)]
Move CgptManager from vboot_reference to installer

The C++ wrapper around various vboot_reference functions doesn't belong in
the vboot repo itself. Put it in the installer repo instead.

BUG=chromium-os:39228
BRANCH=none
TEST=auto
CQ-DEPEND=CL:44441, CL:44443

Refactoring only, no new code. Everything should continue to work as before.

Change-Id: I15ba416987e38905825fedcc87d7b75ebdc4fd1f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44442
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
3 months agoRemove the mount-encrypted utility from vboot_reference 03/44303/3
Bill Richardson [Thu, 28 Feb 2013 18:10:29 +0000 (10:10 -0800)]
Remove the mount-encrypted utility from vboot_reference

This utility sets up the encrypted directories for Chrome OS at boot time.
It uses some of the TPM-related libraries from vboot_reference, but it
isn't really part of the verified boot process itself so I'm moving it into
the cryptohome repo where it belongs.

This CL just removes the code from vboot_reference. Another CL will put it
into cryptohome, and yet another will change the ebuilds to notices.

BUG=chromium-os:39264
BRANCH=none
TEST=auto
CQ-DEPEND=CL:44301, CL:44302

This is just refactoring, not a new feature. After all the CLs are in, the
platform_EncryptedStateful autotest should continue to pass as before.

Change-Id: I6bb436ae57140e89581cb0be5dc2385b8f3ff5e2
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44303
Reviewed-by: Kees Cook <keescook@chromium.org>
3 months agoPoint to new libchrome-180609 for CgptManager stuff 63/44063/3
Bill Richardson [Tue, 26 Feb 2013 18:57:13 +0000 (10:57 -0800)]
Point to new libchrome-180609 for CgptManager stuff

vboot_reference really shouldn't have anything to do with this.

BUG=chromium-os:38949
BRANCH=none
TEST=manual
CQ-DEPEND=CL:44062

Tested by running cbuildbot.

Change-Id: Idd99cb698a735b85169e7ebcbb0b7dc82c057b40
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44063
Reviewed-by: Chris Masone <cmasone@chromium.org>
3 months agoSplit off modules required for VbInit() and VbSelectFirmware() 76/44076/2
Randall Spangler [Tue, 26 Feb 2013 19:03:57 +0000 (11:03 -0800)]
Split off modules required for VbInit() and VbSelectFirmware()

This makes it more obvious which modules and VbEx*() functions must be
implemented to call these entry points.

This change only moves functions between modules and adds two
link-test binaries; it doesn't change any functionality.

BUG=chromium-os:39262
BRANCH=none
TEST=make && make runtests

Change-Id: If3edf0b1989b631f0e7ad18de7ccdad8315181b5
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44076
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
3 months agorollback_index: fix -Wshadow warnings 44/44044/2
Aaron Durbin [Tue, 26 Feb 2013 15:51:58 +0000 (09:51 -0600)]
rollback_index: fix -Wshadow warnings

The rollback_index.c file uses a macro RETURN_ON_FAILURE which creates
a locally block-scoped variable named 'result'. However, when built with
-Wshadow -Werror the compile will break because the 'result' variable
will shadow the one function scoped variable. Fix this warning by
changing the variable name from 'result'  to 'result_' in
the RETURN_ON_FAILURE macro.

BUG=chrome-os-partner:17695
BRANCH=None
TEST=built fwlib with -Werror -Wshadow. Compiles correctly.
     runtests still passes as well.

Change-Id: I9fedef5567411beacdc1c0b8ed182573601f24aa
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44044
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
3 months agovboot_display: fix -Wwrite-strings compiler errors 43/44043/2
Aaron Durbin [Tue, 26 Feb 2013 15:02:02 +0000 (09:02 -0600)]
vboot_display: fix -Wwrite-strings compiler errors

VbHWID() returns a fixed string which can also be a returning a
string that lives in the read only text segment or read only flash.
Because of this the compiler will rightfully error when built with
-Werror and -Wwrite-strings because the const qualifier is being
ignored.  Correct this and the ripple effect in VbRenderTextAtPos().
VbRenderTextAtPos() should be using constant strings anyhow.

BUG=chrome-os-partner:17695
BRANCH=None
TEST=built fwlib with -Werror -Wwrite-strings. Compiles correctly. make
     runtests still passes as well.

Change-Id: Id03a783d2d9b5de4cc3b3ce0fa6d74934751cca4
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44043
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
3 months agofwlib: fix errors with -Wmissing-prototypes 42/44042/2
Aaron Durbin [Tue, 26 Feb 2013 15:40:55 +0000 (09:40 -0600)]
fwlib: fix errors with -Wmissing-prototypes

When the fwlib is built with -Wmissing-prototypes and -Werror
there build breakages that occur. Fix these errors by either
including the header file with the correct declaration or provide
the declaration at the top of the c files for global symbols that
are used by tests.

BUG=chrome-os-partner:17695
BRANCH=None
TEST=built fwlib library with -Wmissing-prototypes and -Werror. Also
     'make runtests' still passes.

Change-Id: I992516ee2545509054887173bc65234905381e06
Signed-off-by: Aaron Durbin
Reviewed-on: https://gerrit.chromium.org/gerrit/44042
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Aaron Durbin <adurbin@chromium.org>
Tested-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
3 months agomount-encrypted: issue sync()s between umount stages 36/43736/2
Kees Cook [Thu, 21 Feb 2013 18:38:46 +0000 (10:38 -0800)]
mount-encrypted: issue sync()s between umount stages

In an effort to reduce the chances of a kernel bug wrecking filesystems
during encrypted-stateful shutdown, add explicit sync() calls during
shutdown.

BUG=chrome-os-partner:17610
TEST=link build, shutdown with simulated panic in LOOP_CLR_FD results in
 successful journal replays
BRANCH=None

Change-Id: I4be981ebd0270d275ae81a79e3195bc72b70d984
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43736
Reviewed-by: Grant Grundler <grundler@chromium.org>
4 months agoLet the Makefile install the utilities, not the ebuild. 37/43237/3
Bill Richardson [Wed, 13 Feb 2013 22:38:29 +0000 (14:38 -0800)]
Let the Makefile install the utilities, not the ebuild.

The ebuild has been pulling various bits of the vboot utilities out of the
build directory and shoving them random places. That's really the job of the
Makefile's "install" target. This cleans it up a bit.

Note that there's a simultaneous CL for the ebuild that must go in at the
same time.

BUG=chromium-os:37062
BRANCH=none
TEST=none
CQ-DEPEND=CL:43236

This is just a refactoring of the Makefile/ebuild interaction. The end
result should be the same: install the vboot utilities in the correct places
on both host and target.

I ran:

  sudo emerge vboot_reference
  emerge-link vboot_reference

And inspected every file that was touched as a result. I ran a trybot on
daisy-paladin link-paladin lumpy-paladin, too. Seems to be working.

Change-Id: I1aac93a62609c1c9840cafca7cb00c92f7cdc905
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43237
Reviewed-by: Randall Spangler <rspangler@chromium.org>
4 months agoRemove hardcoded path in unused chromeos-tpm-recovery-test 74/43174/2
Bill Richardson [Wed, 13 Feb 2013 17:39:34 +0000 (09:39 -0800)]
Remove hardcoded path in unused chromeos-tpm-recovery-test

AFAICT, we don't actually run this test anywhere. If we do, we shouldn't
hard-code the path to the real chromeos-tpm-recovery utility, because we
may need to move it around.

BUG=none
BRANCH=none
TEST=none

Change-Id: I295d57d659adf564ca964efc91d95dfdd1ff00aa
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43174
Reviewed-by: Randall Spangler <rspangler@chromium.org>
4 months agoSoftware sync checks for shutdown-requested in all code paths 44/43044/2
Randall Spangler [Mon, 11 Feb 2013 18:08:51 +0000 (10:08 -0800)]
Software sync checks for shutdown-requested in all code paths

Previously,
1) AP-RO, EC-RO -> checked
2) AP-RW, EC-RO transition to EC-RW -> checked
3) AP-RW, EC-RW already -> NOT checked

Now, (3) calls VbExIsShutdownRequested() as well.

This fix is needed to avoid inconsistent behavior of software sync
after we ship a RW update.

Whether we *should* actually shut down or not based on how/why we
booted is a separate issue to be addressed by the U-boot
implementation of VbExIsShutdownRequested() in a separate CL.

BUG=chromium-os:38645
BRANCH=all
TEST=make runtests

Manual testing also possible - force AP-RW firmware, then reboot with
lid closed.  Previously, the first boot would shut down because of
(2), but subsequent reboots of the AP only wouldn't because of (3).

Change-Id: I226202f48d793b88a30ffa62731de878f8c22315
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43044
Reviewed-by: Simon Glass <sjg@chromium.org>
4 months agoAdd more display tests 46/42846/3
Randall Spangler [Thu, 7 Feb 2013 01:10:55 +0000 (17:10 -0800)]
Add more display tests

BUG=chromium-os:38139
BRANCH=none
TEST=make runtests && FEATURES=test emerge-daisy vboot_reference

Change-Id: I28cd31f995f078d1715acaeaccce6e864930a986
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42846
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoAdd more vboot_api_kernel tests 69/42669/3 stabilize-bluetooth-smart
Randall Spangler [Tue, 5 Feb 2013 20:42:36 +0000 (12:42 -0800)]
Add more vboot_api_kernel tests

BUG=chromium-os:38139
BRANCH=none
TEST=make runtests && FEATURES=test emerge-daisy vboot_reference

Change-Id: Ib280b80ba707f8a2141d728f78ae296774b1301a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42669

4 months agoFix and enable vboot_api_kernel_tests 68/42668/3
Randall Spangler [Tue, 5 Feb 2013 18:23:38 +0000 (10:23 -0800)]
Fix and enable vboot_api_kernel_tests

Previously, these were not being run, and failed due to a test config
problem when they were run (vboot_api_kernel.c worked correctly, but
the test checked the wrong recovery reason).

BUG=chromium-os:38139
BRANCH=none
TEST=make runtests && FEATURES=test emerge-daisy vboot_reference

Change-Id: Ibefe5fe32f99a2c40f619a85df1bbfc81eb0c26c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42668

4 months agoReformat to kernel style 24/42624/4
Randall Spangler [Tue, 5 Feb 2013 17:44:31 +0000 (09:44 -0800)]
Reformat to kernel style

No code changes, just reformatting.

BUG=none
BRANCH=none
TEST=make runtests

Change-Id: Ibffadf6c8a5911b79a29f8f554ca00c595f6b27b
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42624

4 months agoEC software sync uses precomputed hash if available 67/42567/6
Randall Spangler [Mon, 4 Feb 2013 23:00:09 +0000 (15:00 -0800)]
EC software sync uses precomputed hash if available

This removes the need to load the EC code at all when the precomputed
hash matches.

BUG=chrome-os-partner:17606
BRANCH=spring
TEST=wouldn't that be nice

Change-Id: If4438b9db8b1449b8fd4d90ef3acb3bbec5e09a0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42567

4 months agoRemove +x permissions from source files. 48/42648/2
Bill Richardson [Tue, 5 Feb 2013 21:23:03 +0000 (13:23 -0800)]
Remove +x permissions from source files.

There's no need to give execute permissions to files that aren't supposed to
executed.

BUG=none
BRANCH=none
TEST=manual

make runtests

Change-Id: I2480b97b39124e98c2f639d56be54cadfdc17f9b
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42648
Reviewed-by: Randall Spangler <rspangler@chromium.org>
4 months agoset_lsb_release: enable batch modification 01/42601/2
Mike Frysinger [Tue, 5 Feb 2013 05:22:55 +0000 (00:22 -0500)]
set_lsb_release: enable batch modification

When setting a field, this script mounts the image, unmounts, mounts
it, then writes the field, then unmounts it.  When setting 4 or 5
keys at once, this is quite a waste.

Tweak it so we only mount it once, and we can set multiple keys in
a single call by looping over the input args.

BUG=None
TEST=`./signing_unittests.py` passes
BRANCH=None

Change-Id: Id7dc4e8ef58113cc4632721851fcab04ef1e69eb
Reviewed-on: https://gerrit.chromium.org/gerrit/42601
Reviewed-by: Ryan Cui <rcui@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
4 months agoAdd VbExEcGetExpectedRWHash() 66/42566/3
Randall Spangler [Mon, 4 Feb 2013 22:59:21 +0000 (14:59 -0800)]
Add VbExEcGetExpectedRWHash()

This is used by vboot to retrieve the precomputed hash of the expected
EC image, which requires reading less data from EEPROM than getting
the entire EC image.

BUG=chrome-os-partner:17606
BRANCH=spring
TEST=none; just a new API not used yet

Change-Id: I226643144280acabba147d345ef1f83a77a91fbc
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42566

4 months agoReformat to kernel style 65/42565/2
Randall Spangler [Mon, 4 Feb 2013 22:01:04 +0000 (14:01 -0800)]
Reformat to kernel style

No code changes, just reformatting.

BUG=none
BRANCH=none
TEST=make runtests

Change-Id: I0adb8044ff79a1653a5093ba24934d87b142c9b7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42565
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoAdd even more load kernel tests 72/42472/2 stabilize-3658.0.0
Randall Spangler [Fri, 1 Feb 2013 21:31:20 +0000 (13:31 -0800)]
Add even more load kernel tests

BUG=chromium-os:38139
BRANCH=none
TEST=make runtests && FEATURES=test emerge-daisy vboot_reference

Change-Id: I49ac7f64c1d0ef17afab5dcc8fcb9f777d6cab1c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42472
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoAdd more vboot_kernel tests 00/42400/2
Randall Spangler [Wed, 30 Jan 2013 21:19:19 +0000 (13:19 -0800)]
Add more vboot_kernel tests

BUG=chromium-os:38139
BRANCH=none
TEST=make runtests && FEATURES=test emerge-daisy vboot_reference

Change-Id: I69fdbb9d392ba34c8411362aef0f9f0ace284a3c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42400
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoReformat cgptlib to kernel style 97/42397/2
Randall Spangler [Wed, 30 Jan 2013 20:52:02 +0000 (12:52 -0800)]
Reformat cgptlib to kernel style

No code changes, just reformatting.

BUG=none
BRANCH=none
TEST=make runtests

Change-Id: Ib8748df93c64395c88e1f789805393fcfe3ac419
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42397
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoReformat to kernel style 63/42263/3
Randall Spangler [Tue, 29 Jan 2013 23:01:12 +0000 (15:01 -0800)]
Reformat to kernel style

No code changes, just reformatting.

BUG=none
BRANCH=none
TEST=make runtests

Change-Id: Id690c8334147970784db5ac54933ad1f5a58dcc1
Reviewed-on: https://gerrit.chromium.org/gerrit/42263
Tested-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Randall Spangler <rspangler@chromium.org>

4 months agoAdd kernel tests 14/42314/2
Randall Spangler [Tue, 29 Jan 2013 22:28:16 +0000 (14:28 -0800)]
Add kernel tests

BUG=chromium-os:38139
BRANCH=none
TEST=make runtests

Change-Id: Iee7c965d5c29063259c66d0ccb117c60f4f4a92e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42314

4 months agoAdd tlcl tests 61/42261/3
Randall Spangler [Tue, 29 Jan 2013 00:23:48 +0000 (16:23 -0800)]
Add tlcl tests

Verifies the right TPM commands are called, but doesn't check at a
detailed level that they're packed properly.

BUG=chromium-os:38139
BRANCH=none
TEST=make runtests

Change-Id: I6c14db083ac0a40d4738582d200d9687cddb99de
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42261
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoReformat files to kernel style 71/42171/2
Randall Spangler [Mon, 28 Jan 2013 23:00:56 +0000 (15:00 -0800)]
Reformat files to kernel style

No code changes, just reformatting.

BUG=none
BRANCH=none
TEST=make runtests

Change-Id: I93507c45c0790da6162758e0fb02031441169f65
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42171
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoAdd display tests 70/42170/2
Randall Spangler [Mon, 28 Jan 2013 21:43:04 +0000 (13:43 -0800)]
Add display tests

BUG=chromium-os:38139
BRANCH=none
TEST=make runtests

Change-Id: Ibfd3f5f2b7ac8871a99e5d8603baae17926ab972
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42170
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoFixed error in verify 31/42231/2
Paul Taysom [Tue, 29 Jan 2013 17:49:55 +0000 (09:49 -0800)]
Fixed error in verify

Fixed the error when running "sign_official_build.sh verify"
that was introduced by https://gerrit.chromium.org/gerrit/#/c/40052/

BUG=chromium-os:38229
TEST=sign_official_buils.sh verify on parrot recovery image
BRANCH=none

Change-Id: Ice1933347811c006005f622d178869df12344998
Reviewed-on: https://gerrit.chromium.org/gerrit/42231
Tested-by: Paul Taysom <taysom@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Paul Taysom <taysom@chromium.org>

4 months agoReformat files to kernel style 53/42053/2
Randall Spangler [Fri, 25 Jan 2013 23:05:08 +0000 (15:05 -0800)]
Reformat files to kernel style

No code changes, just reformatting.

BUG=none
BRANCH=none
TEST=make runtests

Change-Id: I30c7f74217c10ac7cc618aee30a22febe1e41f5c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42053
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoAdd more vboot common tests 52/42052/2
Randall Spangler [Fri, 25 Jan 2013 21:56:55 +0000 (13:56 -0800)]
Add more vboot common tests

BUG=chromium-os:38139
BRANCH=none
TEST=make runtests

Change-Id: Iad795956c1bb7f6444d6cce0bb618687e26d6025
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42052
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoRemove dead ECPreamble code 18/42018/2
Randall Spangler [Fri, 25 Jan 2013 18:14:10 +0000 (10:14 -0800)]
Remove dead ECPreamble code

BUG=none
BRANCH=none
TEST=make runtests

Change-Id: I99d8124a7d5a3a644f0d8d64ad36f51e78d851e5
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42018
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoReformat header files to kernel style 16/42016/2
Randall Spangler [Fri, 25 Jan 2013 00:15:35 +0000 (16:15 -0800)]
Reformat header files to kernel style

No code changes, just reformatting.

BUG=none
BRANCH=none
TEST=make runtests

Change-Id: Id5bac79545e9803d19b45da160c535f7e06465c6
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42016
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoStart adding display tests 15/42015/2
Randall Spangler [Thu, 24 Jan 2013 22:19:56 +0000 (14:19 -0800)]
Start adding display tests

BUG=chromium-os:38139
BRANCH=none
TEST=make runtests

Change-Id: Idd1c275077a9a00cd2f7eab684238eb5b2d235dd
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42015
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoFix incorrect CFLAGS when compiling for host 14/42014/2
Randall Spangler [Fri, 25 Jan 2013 17:34:26 +0000 (09:34 -0800)]
Fix incorrect CFLAGS when compiling for host

Both HOSTLIB and FWLIB depend on FWLIB_OBJS, and it's the OBJS which
need to override their CFLAGS.  The way it was, depending on the order
of evaluation of HOSTLIB and FWLIB, the OBJS would get compiled with
different flags.

So 'make' worked, because it depended on fwlib before hostlib.  But
'make runtests' failed, because it depended on hostlib but not fwlib.

BUG=none
BRANCH=none
TEST=make runtests

Change-Id: Id4e4cb4f7a58c7ab8d9fd00d91c4ab8f4518d4bc
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42014
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoImprove coverage of cgptlib.c 55/41955/4
Randall Spangler [Thu, 24 Jan 2013 20:25:26 +0000 (12:25 -0800)]
Improve coverage of cgptlib.c

BUG=chromium-os:38139
BRANCH=none
TEST=make runtests

Change-Id: I5719c6b8aa1a23fc65bf38d7096320479152f0ca
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41955
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoReformat cgptlib_test 54/41954/3
Randall Spangler [Thu, 24 Jan 2013 19:19:55 +0000 (11:19 -0800)]
Reformat cgptlib_test

No code changes, just reformat to kernel style

BUG=none
BRANCH=none
TEST=make runtests

Signed-off-by: Randall Spangler <rspangler@chromium.org>
Change-Id: Icfcf54327c4da607392f1769fddcbc33f889395c
Reviewed-on: https://gerrit.chromium.org/gerrit/41954
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Randall Spangler <rspangler@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
4 months agoRemove unused vbutil_ec 53/41953/3
Randall Spangler [Thu, 24 Jan 2013 18:59:12 +0000 (10:59 -0800)]
Remove unused vbutil_ec

EC verification is done via software sync; the EC doesn't do vboot on
its own.

BUG=chromium-os:38139
BRANCH=none
TEST=manual

make runtests
emerge-link vboot_reference chromeos-u-boot chromeos-bootimage

Change-Id: I6e5c0db8fc54b474f044d37c2603a9c116747a85
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41953
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoReformat vboot_common_tests 52/41952/2
Randall Spangler [Thu, 24 Jan 2013 18:42:13 +0000 (10:42 -0800)]
Reformat vboot_common_tests

No code changes, just reformat to kernel style

BUG=none
BRANCH=none
TEST=make runtests

Change-Id: Ic75f40d6a7e862d51398b7e3bbd1a86fa8a1b33d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41952
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoImprove coverage of vboot_api_init.c 96/41896/3
Randall Spangler [Thu, 24 Jan 2013 00:30:54 +0000 (16:30 -0800)]
Improve coverage of vboot_api_init.c

BUG=chromium-os:38139
BRANCH=none
TEST=make runtests

Change-Id: I3d39feb712eb7e572f9c57f27449f19e8e809ed0
Reviewed-on: https://gerrit.chromium.org/gerrit/41896
Commit-Queue: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
4 months agoReformat vboot_api_init_tests 95/41895/2
Randall Spangler [Thu, 24 Jan 2013 00:14:14 +0000 (16:14 -0800)]
Reformat vboot_api_init_tests

No code changes, just reformat to kernel style

BUG=none
BRANCH=none
TEST=make runtests

Change-Id: I9b07af36b915ead519a8908b3dc5b93aedc5d4be
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41895
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoImprove coverage of rollback_index.c 59/41859/2
Randall Spangler [Wed, 23 Jan 2013 21:04:05 +0000 (13:04 -0800)]
Improve coverage of rollback_index.c

BUG=chromium-os:38139
BRANCH=none
TEST=make runtests

Change-Id: I21b62b5dd3fc6037f54f7c3bac768c2b67a4c12d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41859
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoImprove coverage of vbnvstorage test 50/41850/4
Randall Spangler [Wed, 23 Jan 2013 20:25:10 +0000 (12:25 -0800)]
Improve coverage of vbnvstorage test

BUG=chromium-os:38139
BRANCH=none
TEST=make runtests

Change-Id: I93aabedb99fdeba01954a4b59e3e089b4087380c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41850
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoFix architecture definitions. 38/41838/3
Randall Spangler [Wed, 23 Jan 2013 18:20:16 +0000 (10:20 -0800)]
Fix architecture definitions.

We should use only arm, x86, and x86_64; currently we also use i386 to
mean x86, and amd64 to mean x86_64.

BUG=chromium-os:26317
BRANCH=none
TEST=manual

sudo FEATURES=test emerge vboot_reference
FEATURES=test emerge-link vboot_reference chromeos-u-boot chromeos-installer
FEATURES=test emerge-daisy vboot_reference chromeos-u-boot chromeos-installer
FEATURES=test emerge-x86-alex vboot_reference chromeos-installer
make && make runtests (both inside and outside chroot)

Change-Id: I4fb64fafa9c48a76ded862e074776cab9ea54ab3
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41838
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoClean up building code coverage 24/41824/4
Randall Spangler [Wed, 23 Jan 2013 17:29:54 +0000 (09:29 -0800)]
Clean up building code coverage

Now 'COV=1 make' will make coverage automagically.

Coverage stats are reported separately for the firmware subdirectory,
for easier tracking.

BUG=chromium-os:38139
BRANCH=none
TEST='COV=1 make' then browse to build/coverage/index.html

Change-Id: Ie671a82b402beeb17882536f89b9230821fc4d13
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41824

4 months agoConvert common tests from shell scripts to running directly 86/41786/2
Randall Spangler [Tue, 22 Jan 2013 23:34:07 +0000 (15:34 -0800)]
Convert common tests from shell scripts to running directly

So they can run under qemu.

Also, mount /proc and /dev before running qemu in the chroot.

BUG=chromium-os:37916
BRANCH=none
TEST=manual

make runtests
sudo FEATURES=test emerge vboot_reference
FEATURES=test emerge-daisy vboot_reference
FEATURES=test emerge-link vboot_reference

Change-Id: I940ce370bd149621e666250b07cf9219f9e22bac
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41786
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
4 months agoComplete refactoring of Makefile 68/41768/5
Bill Richardson [Thu, 17 Jan 2013 23:28:17 +0000 (15:28 -0800)]
Complete refactoring of Makefile

Cleaning up the Makefile to add correct dependencies, avoid using variables
before they're fully defined (which required .SECONDEXPANSION to work
around), generally improve readability.

There are so many changes that there's no point in trying to compare old
vs new - just look at the final result. And this still isn't perfect, but
it's a big step forward.

BUG=chromium-os:37062
BRANCH=none
TEST=manual

All these should continue to work:

  make && make runtests
  sudo emerge vboot_reference
  emerge-$BOARD vboot_reference

Change-Id: Ic05a19231155d7e6427732e41d1682012d2dcdca
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41768
Reviewed-by: Randall Spangler <rspangler@chromium.org>
4 months ago(modify and resend) Trigger sync right after writing. 45/41345/3
Louis Yung-Chieh Lo [Wed, 16 Jan 2013 03:52:17 +0000 (11:52 +0800)]
(modify and resend) Trigger sync right after writing.

This can trigger the sync mechanism earlier so that the kernel has enough
time to schedule a real disk sync before system reboots.

We sent this in CL 41269, however it is reverted because the sync() and
syncfs() make test cases timeout (tons of disk access). So we only sync
file itself in this CL and leave the whoe system sync outside cgpt.

BUG=chromium-os:35992
TEST=make && make runtests ; and trybot
BRANCH=none

Change-Id: I9c6b602220131f1f011e7865788a122d4c379e73
Reviewed-on: https://gerrit.chromium.org/gerrit/41345
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: Yung-Chieh Lo <yjlou@chromium.org>
Tested-by: Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
5 months agoFixed the cmdline modification for bootcache 52/40052/5
Paul Taysom [Thu, 20 Dec 2012 23:45:43 +0000 (15:45 -0800)]
Fixed the cmdline modification for bootcache

Changed the manipulation of the device mapper arguments in the
command line to handle bootcache. Had to maintain backwards
compatibility with older versions because the signer is used
with older images.

BUG=chromium-os:37114, 37061
TEST=On a parrot with dev signed keys, signed and installed an R-23 image (2913),
a image with bootcache disabled  and an image with bootcache enabled.
BRANCH=none

Change-Id: I59c46ccc3ff8b89ae9c4515f020ea9fbe6d96c7c
Reviewed-on: https://gerrit.chromium.org/gerrit/40052
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Paul Taysom <taysom@chromium.org>
Tested-by: Paul Taysom <taysom@chromium.org>
5 months agomount-encrypted: expprt nvram contents to tmpfs 33/41433/3
Will Drewry [Tue, 15 Jan 2013 02:55:30 +0000 (20:55 -0600)]
mount-encrypted: expprt nvram contents to tmpfs

Export the NVRAM contents to tmpfs (/tmp) for use during boot without
incurring the cost of repeated trips through the TPM.

Signed-off-by: Will Drewry <wad@chromium.org>
BUG=chromium-os:37367
TEST=builds, boots, emits lockbox.nvram which validates using in-progress lockbox-cache
BRANCH=none
Change-Id: I8b1103f4bd22bd75e98a7617a571bdb3a06d2914
Reviewed-on: https://gerrit.chromium.org/gerrit/41433
Reviewed-by: Kees Cook <keescook@chromium.org>
Commit-Queue: Will Drewry <wad@chromium.org>
Reviewed-by: Will Drewry <wad@chromium.org>
Tested-by: Will Drewry <wad@chromium.org>
5 months agofix s_tpm_pcr_read_cmd structure name typo 82/41482/2
Kees Cook [Wed, 16 Jan 2013 23:25:31 +0000 (15:25 -0800)]
fix s_tpm_pcr_read_cmd structure name typo

Che-Liang Chiou noticed this structure was misnamed. Luckily, they have
the same offsets to the useful fields.

BUG=None
TEST=link build, manual verification
BRANCH=None

Change-Id: I40abd21f053f19758e47c7775333208ad1c3c33d
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41482
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
5 months agoRun some tests under qemu when cross-compiling 17/41317/3
Randall Spangler [Wed, 16 Jan 2013 00:16:43 +0000 (16:16 -0800)]
Run some tests under qemu when cross-compiling

BUG=chromium-os:26317
BRANCH=none
TEST=manual

sudo FEATURES=test emerge vboot_reference
FEATURES=test emerge-link vboot_reference chromeos-u-boot chromeos-installer
FEATURES=test emerge-daisy vboot_reference chromeos-u-boot chromeos-installer
make && make runtests (both inside and outside chroot)

Change-Id: Ie829e375736ce0df46ddd5a3345efb0ca7e33aba
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41317

5 months agoRevert "Trigger sync right after writing." 06/41306/2
Bill Richardson [Tue, 15 Jan 2013 22:08:36 +0000 (14:08 -0800)]
Revert "Trigger sync right after writing."

This reverts commit f3613b60c7374dfcf54c922d46c7da8feeb22000.

That commit attempts to solve a disk-syncing problem by forcing numerous
sync() calls inside cgpt. However, it's too much of a sledgehammer approach.

Some subset of buildbots now run a short test suite when compiling
vboot_reference. On my z620, commit f3613b60c737 increases the time to run
"make runcgpttests" from 1.6 seconds to over eight minutes.

We need a different solution to this problem.

BUG=chromium-os:35992
TEST=manual
BRANCH=none

To test:

  cd vboot_reference
  make && make runtests

Change-Id: I0489906103dbc93edf201570bd9158621c651d54
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41306
Reviewed-by: Randall Spangler <rspangler@chromium.org>
5 months agoFix missing dependency 33/41233/2
Randall Spangler [Mon, 14 Jan 2013 20:59:05 +0000 (12:59 -0800)]
Fix missing dependency

BUG=chromium-os:26317
BRANCH=none
TEST=make && make runtests

Change-Id: I420e81a9f9cb1333c233abedfad5cae8984f11b7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41233
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
5 months agoTrigger sync right after writing. 69/41269/4
Louis Yung-Chieh Lo [Tue, 15 Jan 2013 05:13:07 +0000 (13:13 +0800)]
Trigger sync right after writing.

This can trigger the sync mechanism earlier so that the kernel has enough
time to schedule a real disk sync before system reboots.

BUG=chromium-os:35992
TEST=compile only
BRANCH=none

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

5 months agoUse 'install' to do installation, prepare for futility installation. 28/41228/2
Bill Richardson [Mon, 14 Jan 2013 20:37:15 +0000 (12:37 -0800)]
Use 'install' to do installation, prepare for futility installation.

Previously we've been using manual cp and chmod operations to implement
"make install". This switches to using the install utility instead, which
can handle permissions and so forth.

This also tweaks the DESTDIR slightly to prepare the way for futility.

BUG=chromium-os:26317
BRANCH=none
TEST=manual

Run

  sudo emerge vboot_reference

Shouldn't see any difference.

Change-Id: I667ddbb9de3ab7713921ddd734d1fbcbe3b936b1
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41228
Reviewed-by: Randall Spangler <rspangler@chromium.org>
5 months agoAdd .PHONY targets for phony targets 85/41185/2
Bill Richardson [Sat, 12 Jan 2013 06:53:00 +0000 (22:53 -0800)]
Add .PHONY targets for phony targets

We have a bunch of manual dependency targets. They need to be marked as
.PHONY so that they'll always work.

Also made the spacing around the ':' more consistent so it's easier to find
specific instances.

BUG=chromium-os:26317
BRANCH=none
TEST=manual

sudo emerge vboot_reference
emerge-link vboot_reference chromeos-u-boot chromeos-installer
emerge-daisy vboot_reference chromeos-u-boot chromeos-installer

Change-Id: I00a1b8abcd588bdbab33b172c64a4b305b6d7237
Reviewed-on: https://gerrit.chromium.org/gerrit/41185
Commit-Queue: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
5 months agoMake tpmc able to send and receive raw datagrams. 66/41166/3
Luigi Semenzato [Fri, 11 Jan 2013 23:50:39 +0000 (15:50 -0800)]
Make tpmc able to send and receive raw datagrams.

This is immediately needed to debug a Parrot TPM problems, but
we've had similar situation in the past and probably will again
in the future.

BUG=chromium-os:37819
TEST=manually tested with a couple of different packets, and error inputs
BRANCH=none

Change-Id: Id7f66bdbdfe5887fa49cd62af4a9b807fa3d9a89
Reviewed-on: https://gerrit.chromium.org/gerrit/41166
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
5 months agoRename files and defines to simplify makefile. 52/41152/3
Randall Spangler [Fri, 11 Jan 2013 18:55:11 +0000 (10:55 -0800)]
Rename files and defines to simplify makefile.

BUG=chromium-os:26317
BRANCH=none
TEST=manual

sudo emerge vboot_reference
emerge-link vboot_reference chromeos-u-boot chromeos-installer
emerge-daisy vboot_reference chromeos-u-boot chromeos-installer

Signed-off-by: Randall Spangler <rspangler@chromium.org>
Change-Id: I8c55ca40f3f0cacf08530ab63c886fe351bcee8e
Reviewed-on: https://gerrit.chromium.org/gerrit/41152

5 months agoUnify vboot build into a single makefile 06/40906/6
Randall Spangler [Tue, 8 Jan 2013 18:44:23 +0000 (10:44 -0800)]
Unify vboot build into a single makefile

This is a necessary precursor to getting coverage working.

BUG=chromium-os:26317
BRANCH=none
TEST=manual

sudo emerge vboot_reference
emerge-link vboot_reference chromeos-u-boot
emerge-daisy vboot_reference chromeos-u-boot

Change-Id: Ibed91c64a5ca5fa486169d64fb01a9e868ce27e5
Signed-off-by: Randall Spangler <rspangler@chromium.org>
(cherry picked from commit 13ed1f4812f810ee0a47b946ad990f1fa93f366c)
Reviewed-on: https://gerrit.chromium.org/gerrit/40906
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
5 months agoAdd missing TlclLibClose function for mock TPM interface 31/41131/2
Duncan Laurie [Fri, 11 Jan 2013 18:32:29 +0000 (10:32 -0800)]
Add missing TlclLibClose function for mock TPM interface

BUG=none
BRANCH=none
TEST=manual: MOCK_TPM=1 emerge vboot_reference

Change-Id: I81ae9bb646b1a1186629e1a3ba8317efe8397faf
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41131
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
5 months agoFix bad free order in tlcl_generator.c. 02/40902/2 factory-3536.B
Luigi Semenzato [Wed, 9 Jan 2013 00:23:11 +0000 (16:23 -0800)]
Fix bad free order in tlcl_generator.c.

Fix suggested by the OpenSUSE friends:

https://build.opensuse.org/package/view_file?expand=1&file=fix-tlcl-generator.patch&package=vboot&project=devel%3AFactory%3AARM%3AContrib%3AChromebook

for this bug:

http://paste.opensuse.org/86254908

BUG=chromium-os:37707
TEST=emerge-daisy vboot_reference
BRANCH=none

Change-Id: I61c116152fab7b997a84f44da89c93b89659e852
Reviewed-on: https://gerrit.chromium.org/gerrit/40902
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>

5 months agoMove lengthy tests from 'make runtests' to 'make runlongtests' 74/40374/2
Randall Spangler [Thu, 3 Jan 2013 00:49:38 +0000 (16:49 -0800)]
Move lengthy tests from 'make runtests' to 'make runlongtests'

This reduces 'make runtests' from ~90 sec on a z620 to ~8 sec, which
is short enough we can run it as part of the continuous build.

BUG=chromium-os:26317
BRANCH=none
TEST=make && time make runtests && time make runlongtests

Change-Id: I8165efaf8b8290ca3c8f8da73e3f8a54c2bc19f9
Reviewed-on: https://gerrit.chromium.org/gerrit/40374
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Randall Spangler <rspangler@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
5 months agoUse a separate knob for SHA512 unrolling 55/40155/3
Simon Glass [Sat, 22 Dec 2012 13:43:43 +0000 (05:43 -0800)]
Use a separate knob for SHA512 unrolling

The SH512 code gets quite large when unrolled, about 20KB larger on x86.
This is a net loss on machines with slow SPI. Split this out into a
separate knob, and don't enable it on any architecture for now.

Also swap the code around so that we do #ifdef...#else...#endif instead
of #ifndef...#else...#endif.

BUG=chrome-os-partner:13961
BRANCH=none
TEST=manual
build and boot to kernel on link

U-Boot image size before this change:
   text    data     bss     dec     hex filename
 319403    8260   83988  411651   64803 u-boot

after:
 293227    8260   85492  386979   5e7a3 u-boot

This is a saving of about 25KB.

Signed-off-by: Simon Glass <sjg@chromium.org>
Change-Id: I9fa7ea8eba6691d8a06df9374950303e6f2ce2fd
Reviewed-on: https://gerrit.chromium.org/gerrit/40155
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
5 months agoAdd support for a V option which selects verbose Makefile output. 11/40011/2
Gabe Black [Thu, 20 Dec 2012 08:26:59 +0000 (00:26 -0800)]
Add support for a V option which selects verbose Makefile output.

When V=1, the full command lines are printed. When V is not 1, then only a
small summary line is printed which shows what commands are being executed.
The command lines themselves are usually quite long and are overwhelming to
see fly by on the console. Abbreviated command lines are easier to read and
don't fill up your console so quickly.

This change is primarily targeted at vboot_fw.a and probably excludes some
things which could also be converted. The indentation between the action
string (OBJCOPY, CC, etc.) and the target is three spaces longer than "normal",
aka what's used in depthcharge, so that when this make is run from the other,
you can tell the difference between the commands run by each.

BUG=chrome-os-partner:8339
TEST=Built with and without V=1 and saw and did not see the full command
lines, respectively.
BRANCH=None

Change-Id: Ibee244c24dc44b8da109b8c23ac7273174836bb9
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/40011
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
6 months agomount-encrypted: finalize if keyfile missing 83/39883/2 toolchain-3428.65.B
Kees Cook [Mon, 10 Dec 2012 20:34:23 +0000 (12:34 -0800)]
mount-encrypted: finalize if keyfile missing

If a system key is available (could read TPM NVRAM), but the "finalization
needed" file exists, it means that we are in the situation where either
cryptohome was interrupted, or the TPM was temporarily unavailable at an
earlier boot. In this case, it is up to mount-encrypted to perform the
finalization. Before, we were making the very bad assumption that the
keyfile was valid if a system key was found, meaning we would delete the
"finalization needed" file, leaving us with no way to find the encryption
key leading to an OOBE on the next boot.

BUG=chrome-os-partner:15960
TEST=daisy build, manual testing
BRANCH=None

Change-Id: Ifb6d74d8a38100e00d9a4597c25a71a6c33f806c
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39883
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Elly Jones <ellyjones@chromium.org>
Reviewed-by: Will Drewry <wad@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
6 months agoAdd recovery_subcode field to nvstorage and crossystem 03/39803/2
Bill Richardson [Mon, 17 Dec 2012 22:35:22 +0000 (14:35 -0800)]
Add recovery_subcode field to nvstorage and crossystem

This just adds a one-byte field in the nvstorage region for use in debugging
hard-to-catch errors. There's no official meaning or expectation for this
field. It's just a handy place to emit some information.

BUG=chrome-os-partner:11534
BRANCH=parrot
TEST=manual

Just change the value and ensure that it persists across a (working) reboot.
It's only updated at specific points under very exacting error conditions,
so all we really want to test is that it works as a place to store some
extra info.

  crossystem recovery_subcode
  crossystem recovery_subcode=14
  reboot
  crossystem recovery_subcode

The recovery_subcode byte is at index [6] of the VbNv.raw bytes that appear
when you press TAB, so you can find it there too:

  VbNv.raw: 60 20 00 00 00 00 0e 00 00 00 00 00 00 00 00 65

Decimal 14 == 0x0e

Change-Id: I1930b8f81a03ab838dbee99a8d72c35a444efdfd
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39803
Reviewed-by: Randall Spangler <rspangler@chromium.org>