Commit Graph

828 Commits

Author SHA1 Message Date
Simon Glass
bf5540eb1e Add x86_64 architecture support
This is required for U-Boot's sandbox test system.

BUG=chromium-os:16808
TEST=emerge vboot_reference-firmware for tegra2-seaboard, x86-mario

Change-Id: I18b48b069dc56f9b2c826de99780dfff1e544ded
Reviewed-on: https://gerrit.chromium.org/gerrit/5980
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2011-11-14 15:53:15 -08:00
Simon Glass
c25904536f Add a few comments and warnings when building incorrectly
The Makefile requires a few defines and isn't very friendly if they are
missing. This adds some warnings which should alert as to what is wrong.

BUG=chromium-os:16808
TEST=emerge vboot_reference-firmware for tegra2-seaboard, x86-mario

Change-Id: Id3b20365cfcc7f0aa7d984b33b6a0906ae0d44a5
Reviewed-on: https://gerrit.chromium.org/gerrit/11548
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2011-11-14 13:59:14 -08:00
Bill Richardson
931728a003 Address security concerns for vboot_audio.c
Based on the compile-time constants, I don't think we were in any danger,
but I've added the checks anyway. It never hurts to be certain!

BUG=chromium-os:22786
TEST=none

Change-Id: I469dda19b4589e484a41ca9bae1e107787f3cf4d
Reviewed-on: https://gerrit.chromium.org/gerrit/11516
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
2011-11-14 10:45:56 -08:00
Bill Richardson
01bf572be8 Sanity-check output of VbExDiskGetInfo()
BUG=chromium-os:22724
TEST=none

Source change only, nothing for QA to test.

Change-Id: I058137c04622b5aedae4a94ce6e3887325c16974
Reviewed-on: https://gerrit.chromium.org/gerrit/11546
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
2011-11-14 10:33:00 -08:00
Bill Richardson
c8e4ff7c15 Add flag to GBB to allow loading PCI Option ROMs
As shipped, H2C only loads the option ROM for the built-in video, and that
only when it needs display the BIOS warning screens.

By setting a flag in the GBB, you can allow all option ROMs to be loaded:

Note that we'll never enable this ourselves (and there's a factory test to
ensure that*) because it executes non-verified code. But if a customer wants
to void their warranty and set this flag in the read-only flash so they can
install and use other PCI devices, they should be able to do so.

BUG=chrome-os-partner:6148
TEST=none

The only way to test this is to use a BIOS that was compiled with serial
debugging enabled, so there's nothing for QA to do. If you have such a BIOS,
you can see the difference like so:

  flashrom -r oldbios.bin
  gbb_utility -s --flags=2 oldbios.bin newbios.bin
  flashrom -w newbios.bin
  <reboot>

When bit 1 of the GBB flags is 0, you'll see these lines in the serial
output:

  LoadOpRomImage-->GetSystemConfigurationTable Status = Success
  LoadOpRomImage-->GetH2cBootMode Status = Success

When bit 1 of the GBB flags is 1, you'll see these lines in the serial
output:

  LoadOpRomImage-->GetSystemConfigurationTable Status = Success
  LoadOpRomImage-->GetH2cBootMode Status = Success
  LoadOpRomImage-->PCI OpRom on 1.0.0 is allowed!!!

This happens in any boot mode (normal, developer, recovery).

--
*The factory test for GBB zero flags is gft_clear_gbb_flags.sh, in
 src/platform/factory_test_tools

Change-Id: I31a10cc9d562b4b83669ca8a114b60e87ae28b0a
Reviewed-on: https://gerrit.chromium.org/gerrit/11505
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2011-11-11 11:01:20 -08:00
Bill Richardson
fa9d7782e8 Dev-mode only boots official kernels by default
Although we're now using a single unified BIOS, it is pretty nice to be able
to get a shell in developer mode while still using verified boot for the
kernel and filesystem. Alex & ZGB implemented this by requiring the dev-mode
user to install a special dev-mode BIOS. We don't do that, but we DO require
setting a special flag with "crossystem" to accomplish the same thing.

In order to allow booting a self-signed kernel, you must boot in developer
mode, open a shell, and run this:

  crossystem dev_boot_custom=1

Special note to internal developers: If you're in the habit (as I am) of
booting directly from a USB stick in dev-mode, you'll have to run this:

  crossystem dev_boot_custom=1 dev_boot_usb=1

Just using dev_boot_usb=1 is no longer enough, because the USB kernel is
signed using the recovery key and by pressing Ctrl-U, we validate it with
the kernel data key. That worked before this change because any self-signed
kernel was fine, and that's how the USB key was treated. Now it actually
requires a verified signature until you enable dev_boot_custom=1 also.

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

Boot once in normal mode, which clears the special flags. Then switch to
developer mode. You should be able to boot and get a root shell.

Run

  crossystem dev_boot_usb=1

Obtain a USB recovery image that's keyed differently. For example, if you're
testing with dev-keys, use a PVT-signed image or vice-versa.

Reboot into dev-mode with the USB recovery stick inserted. At the dev-mode
screen, press Ctrl-U. You should hear a single beep, but it should not boot.

Press Ctrl-D to boot from the hard drive, log in to a shell and run

  crossystem dev_boot_custom=1

Repeat the previous test. This time when you press Ctrl-U, it should boot
the recovery image. Turn the system off before it does anything.

That's it.

Change-Id: I1811ee9a188974b3f94c83c52b00b60028b86c69
Reviewed-on: https://gerrit.chromium.org/gerrit/11442
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2011-11-10 14:03:56 -08:00
Stefan Reinauer
fbc4b7d8fd Fix the tree for tangent
u-boot got too big on ARM, so don't unroll the loops there.

BUG=none
TEST=none

Change-Id: I426621e147bef7cff1285b0ce063123fbeea751b
Reviewed-on: https://gerrit.chromium.org/gerrit/11078
Reviewed-by: Vince Laviano <vlaviano@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jon Kliegman <kliegs@chromium.org>
Tested-by: Stefan Reinauer <reinauer@chromium.org>
2011-11-02 15:49:11 -07:00
Stefan Reinauer
b7d2f1efca vboot_reference: clean up CFLAGS and enable unrolled loops
- loop unrolling has a positive effect on execution speed.
- This change also drops the -march=i386 and thus allows
  the compiler to use SSE instructions.
- A few duplicate options are dropped from CFLAGS.
- drop -fno-toplevel-reordering. This sneaked in from
  u-boot where it might be needed by some drivers.

With this change I just successfully booted my Stumpy in 833ms

BUG=chrome-os-partner:4675
TEST=boot tested on stumpy
Change-Id: I805cbcaec48b4f8d1d8fa7d7bed9241178f59a8e
Reviewed-on: https://gerrit.chromium.org/gerrit/11061
Tested-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2011-11-02 13:00:14 -07:00
Stefan Reinauer
66264b5d97 Move Memset from vboot_reference to vbexport/u-boot
All memory operations (except the "safe ones") live in the firmware
so the fast operations can be used. Except Memset. This CL changes that
problem.

This CL needs https://gerrit.chromium.org/gerrit/#change,10992 and a
similar change in H2C.

BUG=chrome-os-partner:6313
TEST=run coreboot/u-boot on Stumpy

Change-Id: Ic961ebbb45470c8fc1316490b902759dcf221deb
Reviewed-on: https://gerrit.chromium.org/gerrit/10993
Tested-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2011-11-02 12:59:54 -07:00
Stefan Reinauer
01f276bb0e vboot_reference: Fix typo in firmware Makefile
BUG=none
TEST=test booting on stumpy

Change-Id: Ie89704d62714d1e78603d83ce86167ce9c682cb0
Reviewed-on: https://gerrit.chromium.org/gerrit/11055
Tested-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2011-11-02 12:59:35 -07:00
Bill Richardson
0600e41e0f new signature for optional easter egg.
BUG=none
TEST=none

Change-Id: I86743dbba3210858d817c8e6982f17df96920420
Reviewed-on: http://gerrit.chromium.org/gerrit/9889
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2011-10-11 15:30:11 -07:00
Bill Richardson
5b96f812de Some easter eggs may need a refresh.
BUG=none
TEST=none

Change-Id: I4b8cffa63dd10261e45a5ca6233b4d5cd2471f62
Reviewed-on: http://gerrit.chromium.org/gerrit/9861
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
2011-10-11 14:12:51 -07:00
Stefan Reinauer
89c1a3b3ef Fix potential NULL pointer dereference in vboot_kernel.c
In the unlikely case that params is not set or the LoadKernelParams
structure is not initialized correctly, LoadKernel will exit before
initializing shcall. However, in LoadKernelExit it will be used to
stire the function's return code, thus potentially dereferencing a
NULL pointer.

BUG=chrome-os-partner:6307
TEST=compile tested.

Change-Id: I691c6b5054d8f77296de86834b3125de06e0e398
Reviewed-on: http://gerrit.chromium.org/gerrit/9791
Tested-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Stefan Reinauer <reinauer@chromium.org>
2011-10-10 15:37:39 -07:00
Bill Richardson
94d7034590 Enable (and test) custom dev-mode sounds
BUG=none
TEST=manual

  cd src/platform/vboot_reference
  make && make runtests

Change-Id: I7f7d50d7c9c5541e0b99031245f882996a6b88ec
Reviewed-on: http://gerrit.chromium.org/gerrit/8731
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2011-10-05 11:09:23 -07:00
Bill Richardson
253a58e383 Refactor dev-mode delay handling into a separate file.
BUG=none
TEST=manual

  cd src/platform/vboot_reference
  make && make runtests

Change-Id: I56feceb7d4fce80e4f50d5d7875eafef325363cc
Reviewed-on: http://gerrit.chromium.org/gerrit/8659
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2011-10-05 11:09:20 -07:00
Bill Richardson
f2ad05f59e Add more debugging info to BIOS screens.
This displays the gbb.flags value when being warned about it being nonzero.
It also decodes the recovery_reason value into English.

BUG=chromium-os:20972
TEST=manual

1. Use gbb_utility to create a BIOS with valid bitmaps, but with gbb.flags
   set to a non-zero value. Boot into recovery mode. You should see the
   warning that gbb.flags is non-zero, and the value itself.

2. Press TAB. The recovery_reason field should display not only a value, but
   also an English string explaining the value.

Change-Id: I99b7aa35bc67453bdf3385b9573491090c3dec1d
Reviewed-on: http://gerrit.chromium.org/gerrit/8459
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
2011-09-28 16:13:34 -07:00
Bill Richardson
25a3dbc83c Make startup delay and noises simpler to change.
BUG=none
TEST=manual

Booted in dev-mode. All noises and delays are unchanged (2 second delay when
gbb.flags is 1, 30-second with beeps at 20 seconds when gbb.flags is 0).

Change-Id: I816e57c4f8f6025299851b3d42b4a350f9925994
Reviewed-on: http://gerrit.chromium.org/gerrit/8240
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
2011-09-26 13:25:26 -07:00
Bill Richardson
4313fba2fb VbExBeep() now returns VbError_t instead of void
This enables us to support playing sounds in the background if the BIOS
allows it, so we don't have to block while beeping is happening. The new
declaration is:

  VbError_t VbExBeep(uint32_t msec, uint32_t frequency);

If the audio codec can run in the background, then:
  zero frequency means OFF, non-zero frequency means ON
  zero msec means return immediately, non-zero msec means delay (and
    then OFF if needed)
else:
  non-zero msec and non-zero frequency means ON, delay, OFF, return
  zero msec or zero frequency means do nothing and return immediately

The return value is used by the caller to determine the capabilities. The
implementation should always do the best it can if it cannot fully support
all features - for example, beeping at a fixed frequency if frequency
support is not available.  At a minimum, it must delay for the specified
non-zero duration.

Currently, VbExBeep() is called only when displaying the dev-mode screen.

BUG=none
TEST=manual

I've tested on x86 and ARM, all timeouts and noises work as before.

Note that ARM and coreboot will require a corresponding change to their
VbExBeep() implementations, which will have to be handled with separate,
simultaneous CLs.

Change-Id: I3417ae4b99d9d0aee63f2ccaeed39b61d4333e5d
Reviewed-on: http://gerrit.chromium.org/gerrit/8234
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
2011-09-23 16:04:15 -07:00
Bill Richardson
ec35beb128 Make BIOS screens warn when GBB.flags is nonzero.
BUG=chrome-os-partner:5919
TEST=manual

Until the factory flow has completed, BIOS screens should display a warning
message about GBB.flags. This message should disappear once the flags field
is zero.

You can see the state of the GBB flags in a particular BIOS image using

  gbb_utility -g --flags BIOS.bin

And set it with

  gbb_utility -s --flags=VALUE BIOS.bin NEWBIOS.bin

Change-Id: I15d336bda571978ece0a9744f19d80f0ae385fb1
Reviewed-on: http://gerrit.chromium.org/gerrit/7719
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2011-09-14 15:22:23 -07:00
Bill Richardson
518d4f39b4 Stub out easter egg, in case BIOS wants to implement one.
BUG=none
TEST=manual

Type 'xyzzy' at dev-mode BIOS screen. What happens next depends on the BIOS.

Change-Id: Ifdb49eb6cb53ecee91f576be91679bd5a232f008
Reviewed-on: http://gerrit.chromium.org/gerrit/7656
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2011-09-14 15:22:15 -07:00
Bill Richardson
c55f0f6c7a Up/Down keys should change locale in BIOS screens.
BUG=chrome-os-partner:5927
TEST=manual

Install BIOS with valid bitmaps, boot to dev-mode or recovery, press arrow
keys.

Change-Id: I3946bac94cc075f9d11b4dd3fcb118807c3318c4
Reviewed-on: http://gerrit.chromium.org/gerrit/7636
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2011-09-13 15:57:53 -07:00
Bill Richardson
3235751eac Change debug messages to use 1-based GPT partition numbers.
BUG=none
TEST=none

Change-Id: Ib717f1008edbb6c11d73fbe42d533ebe45800a45
Reviewed-on: http://gerrit.chromium.org/gerrit/7410
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
2011-09-08 10:27:53 -07:00
Bill Richardson
5de6b40ca7 Display sha1sums in BIOS debug info
BUG=none
TEST=manual

Press 'TAB' at any BIOS screen. You should see some sha1sums.

Change-Id: Id2f034ad198e4c9c53ab2f2a8fa6195f3479f6aa
Reviewed-on: http://gerrit.chromium.org/gerrit/7101
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
2011-09-01 16:38:57 -07:00
Randall Spangler
6c6babc51b Add tests for vboot_firmware.c
Yaay, LoadFirmware() finally has unit tests!

Fix minor memory leak in LoadFirmware().

BUG=chromium-os:17564
TEST=make && make runtests

Change-Id: I7eabc14484271f488b77f286e846781ccc22b8f2
(cherry picked from commit 2b7c5635d7069c55a1d96d11b99d02291b7e308b)
Reviewed-on: http://gerrit.chromium.org/gerrit/7052
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-09-01 09:05:04 -07:00
Randall Spangler
9c9606b7a6 Add tests for rsa_utility.c
BUG=chromium-os:17564
TEST=make && make runtests

Change-Id: Ia86241f5407ba53d93d3862b29c61b510e560e92
Reviewed-on: http://gerrit.chromium.org/gerrit/6959
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-09-01 09:04:46 -07:00
Hung-Te Lin
fec47595ce gbb_utility: add --flags parameter.
The --flags is added to get/set the "flags" field.

BUG=chrome-os-partner:2317
TEST=gbb_utiltiy --get --flags bios.bin # see flags as 0
     gbb_utility --set --flags=0x3052 bios.bin
     # for version error message for GBB1.0 files,
     # and see flag value changed for GBB1.1+ files
     gbb_utility --get --flags bios.bin
     # flag as 0 for GBB1.0, 0x3052 for GBB1.1+

Change-Id: I7aab62c8fc32ea08b4822e496f543511ff5e5ebc
Reviewed-on: http://gerrit.chromium.org/gerrit/6721
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2011-08-29 16:22:09 -07:00
Randall Spangler
46d37cfbbb Remaining unit tests for rollback_index.c
BUG=chromium-os:17564
TEST=make && make runtests

Change-Id: If2fbfb788bc3199603c8646e8f1c9e061199bc6f
Reviewed-on: http://gerrit.chromium.org/gerrit/6832
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-08-29 12:58:38 -07:00
Randall Spangler
cb3313e8cb Partial unit tests for rollback_index
BUG=chromium-os:17564
TEST=make && make runtests

Change-Id: I8ea6bcc15f277e10c5b8539f2ea19ad90be34889
Reviewed-on: http://gerrit.chromium.org/gerrit/6770
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-08-26 14:15:26 -07:00
Randall Spangler
f02bbb4635 Add tests for utility.h and sysincludes.h macros
BUG=chromium-os:17564
TEST=make && make runtests

Change-Id: Id0a834c2b234d5f9cbbb37a69426e2b97c734d0a
Reviewed-on: http://gerrit.chromium.org/gerrit/6608
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-08-24 14:38:02 -07:00
Randall Spangler
1f5d53f7bd Add tests for vboot_reference stateful_util.c
BUG=chromium-os:17564
TEST=make && make runtests

Change-Id: I5d55be2dfead0c5d7af72841cbd6c65485685cd6
Reviewed-on: http://gerrit.chromium.org/gerrit/6596
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-08-24 13:50:51 -07:00
Bill Richardson
0a9977e161 bmpblock v1.2 - render HWID inside vboot_reference
The vboot_api.h doesn't require the BIOS display the ASCII HWID in
a graphical form (ARM U-Boot doesn't know how), so we have to do it
ourselves. This change makes that possible.

Summary of changes:
* bmpblk_font.h defines a structure to map ASCII chars to BMPs
* bmpblk_font utility generates that font structure
* bmpblock format is bumped to version 1.2
  - YAML file specifies font to use for $HWID
  - make_default_yaml updated to emit the new format
  - README updated to describe the difference

BUG=chromium-os:18631
TEST=manual

I've tested this on ARM, like so:

Inside the chroot, build a U-Boot that uses it:

  emerge-tegra2_kaen vboot_reference vboot_reference-firmware
  emerge-tegra2_kaen tegra-bct tegra2-public-firmware-fdts \
                     chromeos-u-boot chromeos-bootimage

Outside chroot, but in src/platform/vboot_reference:

  make
  <copy ./build/utility/bmpblk_font and ./build/utility/bmpblk_utility to
    somewhere in your $PATH>
  make clean

  cd scripts/newbitmaps/fonts
  bmpblk_font --outfile ../images/hwid_fonts.bin outdir/*

  cd scripts/newbitmaps/images
  make arm
  cd out_arm
  <edit DEFAULT.yaml>
  bmpblk_utility -z 2 -c DEFAULT.yaml arm_bmpblock.bin

  <use gbb_utility to replace the bitmaps in the U-Boot image, boot it>

The HWID string is displayed.

Change-Id: I782004a0f30c57fa1f3bb246e8c59a02c5e9f561
Reviewed-on: http://gerrit.chromium.org/gerrit/6544
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
2011-08-24 09:27:12 -07:00
Randall Spangler
a3454fcaa4 Add unit tests for utility.c
Also fixes returned value from Memset().  And SafeMemcmp() should
return 0 (equal) if comparing 0 bytes, to match the behavior of memcmp().

BUG=chromium-os:17564
TEST=make && make runtests

Change-Id: Id43e70eecf04815216e1fd952271af35e0a66396
Reviewed-on: http://gerrit.chromium.org/gerrit/6539
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-08-23 15:30:59 -07:00
Bill Richardson
2e0226309d Cleanup: DEFAULT.yaml should include locale_names section.
bmpblk_utility correctly supports this field, which can be used by the
factory process to map the localization to the correct locale. We forgot to
put the entries in the DEFAULT.yaml file. This change corrects that for
future releases.

BUG=none
TEST=none

Change-Id: Iea65d7439e6ef8cc8730ec1b862abba87041d93f
Reviewed-on: http://gerrit.chromium.org/gerrit/6424
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
2011-08-22 16:05:01 -07:00
Bill Richardson
822eca680f Put VbDisplay* functions into their own file.
This refactoring will enable us to test and mock them separately from the
rest of the vboot_api functions.

BUG=chromium-os:17564
TEST=manual

Built for ARM, ran "vbexport_test display" at U-Boot prompt. Still works.

Change-Id: I2ddb01d3e981603f371aaa7317184457bdff48ac
Reviewed-on: http://gerrit.chromium.org/gerrit/6422
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
2011-08-22 14:31:24 -07:00
Bill Richardson
b1c85a8442 Decompress images in vboot wrapper, not in BIOS.
The vboot library needs to decompress the images so that it can handle those
that are special cases (like rendering the HWID). This means that 1) it
needs access to the BIOS' native decompression routine, and 2) that
VbExDisplayImage() only needs to handle the uncompressed native-format image
and doesn't need to know about how the image is packed in the GBB.

BUG=chromium-os:19134
TEST=manual

This requires a change to vboot_api.h, which requires a (simultaneous)
matching change to the BIOS, at least for U-Boot, which builds separately.
I've made that change and run the "vbexport_test display" command from the
modified U-Boot, but that also requires a change to the way U-Boot is built
so that I can get at the U-Boot commandline.

Change-Id: I449fb467cd3a68e742f27ec41b95d52685459d89
Reviewed-on: http://gerrit.chromium.org/gerrit/6129
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
2011-08-17 13:37:08 -07:00
Randall Spangler
8eead8e560 Clean up calling LoadFirmware() from VbSelectFirmware()
BUG=chromium-os:18383
TEST=compiles for both x86 and ARM; boots on my test system

Change-Id: I6c7dc1dd086fb06e4ad8daa053bccdf61a463240
Reviewed-on: http://gerrit.chromium.org/gerrit/4977
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-29 13:08:12 -07:00
Randall Spangler
010c8a04cd Fix missing call to VbNvTeardown()
BUG=none
TEST=compiles

Change-Id: I7c917eee4a7893d535fc8f07a21410437c50b8a0
Reviewed-on: http://gerrit.chromium.org/gerrit/4956
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-28 14:22:43 -07:00
Randall Spangler
4d3b127d19 Vboot support for GBB flag to reduce boot time warning screen
This is OFF by default, and must be turned on via the gbb_utility.

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

Build a firmware image and flash it.  Should have the same 30-sec
delay as it does now.  Pressing TAB should show GBB flags = 0x0.

Modify the firmware image using gbb_utility to set GBB flags to 1 and
reboot.  Dev delay should be 2 sec.  Pressing TAB should show GBB
flags = 0x00000001.

Change-Id: If96ab9e7d0d142a9cd9a2c6af3849421d073de5e
Reviewed-on: http://gerrit.chromium.org/gerrit/4829
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-27 14:37:46 -07:00
Randall Spangler
cb320035d8 Add flags field to GBB
Still need to update gbb_utility and firmware to use the flags.

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

Change-Id: I16c77a175c78efa3212a00bbf94d68384ef1829f
Reviewed-on: http://gerrit.chromium.org/gerrit/4817
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-27 13:02:27 -07:00
Randall Spangler
99275128b4 If trying firmware B and found invalid kernel, just reboot
When we're trying a new firmware B with a new kernel subkey, if it
can't find any kernels there may still be a kernel which the old
firmware A likes.  So instead of going to recovery mode, just reboot
so we fall back to firmware A.  If firmware A doesn't find any valid
kernels we'll still go to recovery mode.

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

Do a firmware+OS update which involves kernel subkey rotation.  After
installing the new firmware but before rebooting into the new OS,
corrupt the new kernel so that it'll fail validation.  Then reboot.
On previous firmware, this would go to recovery mode.  Now it should
simply reboot and be back in firmware A / kernel A.

Change-Id: I12796f428fd6969ea5ef36f39c4f58cb0a2bff0d
Reviewed-on: http://gerrit.chromium.org/gerrit/4770
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-27 10:16:14 -07:00
Randall Spangler
57e91f713f Move VbNvContext setup/teardown to vboot wrapper funcs
BUG=chromium-os:18226
TEST=make && make runtests

Change-Id: Ie22e99a9796866e646ed92158410bc7a2fdf90f6
Reviewed-on: http://gerrit.chromium.org/gerrit/4754
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-26 13:32:49 -07:00
Vadim Bendebury
68626a6d1b Fix vboot_reference-firmware compilation error when building for coreboot.
When compiling for coreboot the printf format helpers are not
available (they come from the Insyde tree).

The specifier is use in a very limited number of places, it is
probably better to typecast the variable being printed to avoid
compilation errors. This CL accomplishes just that.

BUG=none
TEST=manual:
run the following commands:

emerge-x86-alex -C sys-boot/chromeos-coreboot \
    sys-boot/chromeos-u-boot\
    chromeos-base/vboot_reference \
    chromeos-base/vboot_reference-firmware
emerge-x86-alex chromeos-bootimage

observe the second one succeed.

Change-Id: If19e3a583eb759ba5a21863d1b9b28636c7f00b0
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/4690
2011-07-26 10:40:03 -07:00
Randall Spangler
dfb0175a5b Refactor LoadFirmware() and LoadKernel() to return VbError_t
BUG=chromium-os:18161
TEST=make && make runtests

Change-Id: I1f60654fef84e26ee15fa8bdaacdb87fb1ddf69e
Reviewed-on: http://gerrit.chromium.org/gerrit/4676
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-26 10:28:57 -07:00
Randall Spangler
1cf77cda5e Return more meaningful error codes from vboot entry points
This also fixes one place where TPM error codes were getting lost.

BUG=chromium-os:18132
TEST=make && make runtests

Change-Id: I83c74e1103805f166d1dc7448be7d67bd46d15b3
Reviewed-on: http://gerrit.chromium.org/gerrit/4659
Tested-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2011-07-25 13:16:35 -07:00
Randall Spangler
22e7bb2b8e Refactor TPM calls into vboot wrapper
Try #2, now that ARM has the fix from http://gerrit.chromium.org/gerrit/4667

This cleans up the TPM calls inside vboot_reference.
* TPM calls share mode code between boot modes.
* Better handling for TPM_E_MUST_REBOOT, particularly in recovery mode.
* TAB screen shows current TPM versions.

No changes required to the wrapper API; these changes are internal to vboot.

BUG=chromium-os:18084
TEST=make && make runtests; built for both alex and tegra2-seaboard

Original-Change-Id: I2a52066f2889210af83409872b10f9d6380470af
(cherry picked from commit da55560cddcf7a1aa8a881cdf52792a21a01e766)

Change-Id: I120797145772116f09b8125b9e56fdbb11dc16b3
Reviewed-on: http://gerrit.chromium.org/gerrit/4671
Tested-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2011-07-25 13:11:08 -07:00
Randall Spangler
e11860ea47 Fix missing inttypes define on ARM
BUG=none
TEST=emerge-tegra2_seaboard vboot_reference-firmware

Change-Id: Ia14468885454383945dd47d328a54c7f6b7221e0
Reviewed-on: http://gerrit.chromium.org/gerrit/4667
Tested-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Elly Jones <ellyjones@chromium.org>
2011-07-25 13:02:26 -07:00
Elly Jones
64b2ba41cc Revert "Refactor TPM calls into vboot wrapper"
This reverts commit da55560cddcf7a1aa8a881cdf52792a21a01e766. This commit caused http://build.chromium.org/p/chromiumos/builders/arm%20tegra2%20binary/builds/6301 to fail.

Change-Id: Ie132c1e600ab28f97337ecfe0e7cff053987717d
Reviewed-on: http://gerrit.chromium.org/gerrit/4661
Reviewed-by: Elly Jones <ellyjones@chromium.org>
Tested-by: Elly Jones <ellyjones@chromium.org>
2011-07-25 09:59:05 -07:00
Randall Spangler
4bc713d0df Refactor TPM calls into vboot wrapper
This cleans up the TPM calls inside vboot_reference.
* TPM calls share mode code between boot modes.
* Better handling for TPM_E_MUST_REBOOT, particularly in recovery mode.
* TAB screen shows current TPM versions.

No changes required to the wrapper API; these changes are internal to vboot.

BUG=chromium-os:18084
TEST=make && make runtests; built for both alex and tegra2-seaboard

Change-Id: I2a52066f2889210af83409872b10f9d6380470af
Reviewed-on: http://gerrit.chromium.org/gerrit/4611
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-25 08:56:05 -07:00
Randall Spangler
ad03a439bc Cleanup and preparation for inside-wrapper TPM refactoring.
Add recovery reason for already in recovery and need to reboot to
recovery to let the TPM init.

Add vboot_struct fields.

Fix type for keyblock flags param to SetTPMBootModeState().

BUG=none
TEST=make && make runtests

Change-Id: I4035bdb377aaebaca03a43799be57977166da739
Reviewed-on: http://gerrit.chromium.org/gerrit/4599
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-22 12:39:13 -07:00
Luigi Semenzato
1c9577b213 Implement different strategy for soft-reset workaround on Kaen prototypes.
BUG=chrome-os-partner:5071
TEST=check that factory flow works on Kaen prototypes without HW fix

Change-Id: I56a830ed292d7e998fa25299f52d22d2faac3c77
Reviewed-on: http://gerrit.chromium.org/gerrit/4533
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
2011-07-22 09:27:54 -07:00