Commit Graph

50 Commits

Author SHA1 Message Date
Randall Spangler
5eb7cdba0e Fix handling of enter and space in developer screens.
At DEV screen:
- Space triggers TONORM
- Enter is ignored unless new GBB flag is set

At TONORM screen:
- Enter always means YES
- Space is ignored

So, if you hold the space key at the dev screen, you'll go to tonorm
and stay there until you press Enter or Esc.  If you hold the Enter
key at the dev screen, nothing will happen.

Add a GBB flag to allow Enter to trigger the TONORM screen; this will
be used by FAFT testing.

BRANCH=all
BUG=chrome-os-partner:12699
TEST=manual

1. press enter at dev screen.  nothing happens.
2. press space at dev screen.  tonorm.
3. press space at tonorm.  nothing happens.
4. press enter at tonorm.  turns off dev mode.

Change-Id: I9f3128d5114e1486911cc4d76d0ccd5649de1680
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/30456
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
2012-08-16 17:40:51 -07:00
Vadim Bendebury
b321dbb6bc Get kernel size/load address from vboot headers
Presently kernel load address and buffer size are programmed in the
u-boot device tree. There is no reason for this: the address and size
are part of the vboot encapsulation headers. Duplicating this
information hardcoded in the device tree does not bring any benefit
and is in fact harmful, as it is easy to get out of sync.

A better way of doing things is to derive kernel load address and size
from the appropriate vboot header. ARM people object to this, as they
want the very same kernel blob operate on devices with DRAM mapped to
different address ranges.

The suggested solution is to exclude the kernel memory section from
the device tree on the platforms where the load address could be
safely taken from the vboot header. In this case u-boot will pass
address of zero to vboot, which will know to derive the address/size
from the appropriate header. vboot then rewrites fields of the u-boot
supplied structure with actual address and size of the kernel blob.

There is no sanity check yet, as it is presumed that there is enough
memory to load any kernel and u-boot does not use the space above
0x100000 for at least 16 megabytes (the kernel partition size). On x86
platform the check could be verify that the top of the kernel space is
well below the stack.

BUG=chrome-os-partner:11994
TEST=manual
  . with the appropriate u-boot change run a Link target through a
    FAFT cycle, observe it succeed.

Change-Id: I3c2c2cefb1e31d16ac497a01894bf32638479ed7
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/29038
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
2012-08-14 14:04:20 -07:00
Hung-Te Lin
9ea8e0d390 firmware: Add TONORM_CONFIRM screen.
We need to alert user his change has been accepted for 5 seconds.

BUG=chrome-os-partner:11078
TEST=emerge-daisy vboot_reference-firmware vboot_reference chromeos-u-boot chromeos-boogimage

Change-Id: I6a3b13e7543479fbd6543d759093ecf501fb1d04
Reviewed-on: https://gerrit.chromium.org/gerrit/29982
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2012-08-13 17:25:13 -07:00
Bill Richardson
f217520215 vboot: add flag to indicate that the EC is slow to program
Some EC's are slow to program their firmware. This could happen at any boot
as part of software sync. This adds the VB_INIT_FLAG_EC_SLOW_UPDATE input
flag to VbInit(), so that vboot knows to display the EC-is-being-programmed
screen when that flag is set.

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

This isn't activated yet by anything, so there's nothing to test.

Change-Id: Id4d12e463fcdee017b7c52b53a2facefc33b745f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/29370
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-08-07 09:08:50 -07:00
Bill Richardson
2934475dbc TONORM screen should display at Dev screen, not Recovery screen.
We're still working out the correct behavior for the keyboard-based
dev-mode. Before this, we rebooted into recovery mode before asking if you
wanted to return to normal mode, so if you said "no, stay in dev-mode" you'd
still be at the recovery screen.

But now the confirmation for returning to normal mode happens at the
dev-mode screen, so you never get to the recovery screen (unless normal mode
won't boot, in which case you get there automatically).

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

First, clear the GBB flags so that you can actually test the virtual dev
switch:

  /usr/share/vboot/bin/set_gbb_flags.sh 0
  reboot

It should come up in normal mode.

Activate keyboard-based dev-mode as before:
- three-finger salute
- Ctrl-D at the recovery screen
- Press ENTER when asked

Now, at the DEV screen, try to leave:
- Press SPACE. It should ask if you want to go to normal mode.
- Press ESC (no). You should be back at the DEV screen again.
- Press ENTER. It should ask if you want to go to normal mode.
- Press ESC (no). You should be back at the DEV screen again.
- Press SPACE. It should ask if you want to go to normal mode.
- Press ENTER (yes). It should reboot into normal mode.

Change-Id: I99af6e7b97fb61f943bd14c8c7166571b5ccf106
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28872
2012-08-02 15:36:42 -07:00
Randall Spangler
7c3a486d6d Flush keyboard at start of screens which take keyboard input
BUG=chrome-os-partner:11887
TEST=manual

Boot with dev mode on.  Boots normally.

Boot with dev mode on, hammering on ENTER key as soon as you release power.
Dev mode screen is shown.
Keep hammering.  Dev screen will stay up as long as you do this.
Wait >2 sec.
Press ENTER.  System reboots to TONORM screen.

Change-Id: I18e35b23c18a65637a84d3d1964b291e0cb5e8c5
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28995
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
2012-08-01 18:01:52 -07:00
Randall Spangler
6c9f097380 Revert "Enter key at DEV screen no longer transition to TONORM screen"
This reverts commit 2b45044edf

We will instead flush the keyboard buffer at the start of screens which accept keyboard input.

Change-Id: I1f5a480c6c1eeb7432b557dd4d984c1450ac973e
Reviewed-on: https://gerrit.chromium.org/gerrit/28952
Commit-Ready: Randall Spangler <rspangler@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-08-01 12:22:49 -07:00
Randall Spangler
2b45044edf Enter key at DEV screen no longer transition to TONORM screen
And space at TONORM screen no longer confirms disabling dev mode

Added Ctrl+Refresh as an alias for tonorm screen request.  U-boot will
need to be enhanced to support that.  Until then, many FAFT tests will
break.

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

1. Boot to DEV screen
2. Press Enter.  Nothing happens.
3. Press Space.  Goes to TONORM screen.
4. Press Space.  Nothing happens.
5. Press Enter.  Reboots with dev mode disabled.

Change-Id: I7f61c4001c668ac916f50f931a79a107752c83b5
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28851
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-31 16:07:33 -07:00
Randall Spangler
0c32130a57 Shut down after EC software sync if lid is closed
So if the EC reboots when the lid is closed (for example, it wakes
from hibernate because the AC adapter was inserted), it won't leave
the AP powered on.

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

   Reboot EC with lid closed ('reboot hard').
   Should finish software sync and shut down.
   Reboot EC with lid open. Boots.
   Hibernate EC and wake with lid open. Boots.
   Hibernate EC and wake with power button press. Boots.
   Reboot into recovery mode. Boots. Press power button; shuts down.
   Reboot into recovery mode. Boots. Close lid; shuts down.

CQ-DEPEND=*22578

Change-Id: I09d5331222aa10b73518f9f574ec5a32d8e6ac23
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28525
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-26 16:50:10 -07:00
Randall Spangler
584e0d2070 Add more specific recovery reasons for EC software sync.
Software sync will, of course, work perfectly, so these will never be needed.

BUG=none
TEST=none (hey, it all works perfectly)

Change-Id: I0014dfb99507c5eb00de73b77edb7538b598658f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28495
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-26 16:25:35 -07:00
Randall Spangler
09d0c2e487 Handle reboots required to protect/unprotect RW firmware
Necessary for updating snow EC

BUG=chrome-os-partner:11087
TEST=force an EC update by loading a slightly old EC and then a new BIOS

Change-Id: Id00257f8a67c08077a5b396cf120a056a7601671
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28436
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-25 18:07:20 -07:00
Randall Spangler
241de33bab EC software sync now updates RW firmware if necessary.
BUG=chrome-os-partner:11087
TEST=manual

1. Update EC to a new version
2. Rebuild EC code and chromeos-bootimage
3. Update BIOS (AP) RW firmware
4. Reboot.  EC should get updated to the version in the BIOS iamge.

CQ-DEPEND=28414

Change-Id: I227d9bf7cc1f4984d6eb13b5372bcf4181ad0df5
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28415
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-25 18:07:20 -07:00
Bill Richardson
1a72ad60d7 Call VbExEcGetExpectedRW() with the correct parameters.
vboot is passing in an index but the function expects an enum.

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

Build with serial enabled, watch what happens. Before, it does this:

  ec.c: VbExEcGetExpectedRW: Unrecognized EC firmware requested.
  VbEcSoftwareSync() - VbExEcGetExpectedRW() returned 65536
  VbSetRecoveryRequest(34)

After this change, it should get a little further:

  ec.c: VbExEcGetExpectedRW: EC-RW image offset 0 size 0.
  ec.c: VbExEcGetExpectedRW: EC image has bogus size.
  VbEcSoftwareSync() - VbExEcGetExpectedRW() returned 65536
  VbSetRecoveryRequest(34)

Sigh.

Change-Id: Ideb5f9d70bc5f3f202a8e04a6ec718e1d674d526
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28341
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-07-24 18:55:36 -07:00
Randall Spangler
029ae65756 VbExEcGetExpectedRW() should take a const **
Since vboot is expected not to modify the contents of the returned pointer.

BUG=chrome-os-partner:11148
TEST=if it builds, it worked

This change MUST be submitted at the same time as u-boot
https://gerrit.chromium.org/gerrit/28146.

Change-Id: Ieeee8f456a7fbd9fe6b108a29e208058310b471b
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28145
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-23 16:12:53 -07:00
Randall Spangler
d4faa060cc Partial EC software sync implementation
Doesn't check the EC hash, but does jump to the correct image, for now
assuming the hash is good.

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

- Power+refresh.  System boots.  EC is in RO (verify via 'ectool version')
- Create a BIOS signed *without* RO-normal.
- Power+refresh.  System boots.  EC ends up in A.
- ectool eventgetb.  Event 0x2000 IS present, indicating EC has rebooted
- ectool eventclearb -1
- Power button to shut down, then power button to power back on.
- ectool eventgetb.  Event 0x2000 is NOT present.
- crossystem recovery_request=123 && reboot.  System reboots to recovery mode
  and EC is in read-only (verify via EC console 'sysinfo')
- Power off and on.  System boots.  EC ends up in A again.

Change-Id: I39682d1bf7215c62a4b20613d029e78194b98826
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27574
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-16 18:23:28 -07:00
Bill Richardson
592567e956 Remove VbExTrustEC() from vboot, so it can go into BIOS.
The VbExTrustEC function should be implemented in the BIOS, not the vboot
library. Also, weak references don't seem to work with our linker, so we'll
have to just require it always.

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

This must go in with a simultaneous change to U-Boot. The only test is
whether or not everything continues to compile.

Change-Id: I8a5ccb167eec3bcacbe892cf0bdcfe550a1f57d6
Reviewed-on: https://gerrit.chromium.org/gerrit/25557
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
2012-06-18 15:21:30 -07:00
Randall Spangler
acd6f4688a Add GBB flags to enable dev mode by default
And enable dev_boot_usb by default.
And disable rollback checks.

The first flag is necessary for factory to build with keyboard
controlled dev mode.  The other flags are really handy for development
on systems where you've defeated firmware WP and are installing custom
firmware.

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

Signed-off-by: Randall Spangler <rspangler@chromium.org>

Change-Id: I9d837fee676cb0186ea98f13005ad60a9ab86393
Reviewed-on: https://gerrit.chromium.org/gerrit/25265
Tested-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Ready: Randall Spangler <rspangler@chromium.org>
2012-06-14 18:57:52 -07:00
Bill Richardson
ec8df1628c Support virtual dev-switch (keyboard-based dev-mode)
BUG=chrome-os-partner:9706
TEST=manual

Currently, Link is the only platform that enables this feature.

To enter dev-mode:

  Boot into recovery mode using the magic key chord. At the Insert screen,
  press Ctrl-D. You'll be asked if you want to enter developer mode. If you
  then press ENTER, it will reboot with dev-mode enabled. If you press SPACE
  or ESC, it will return to the Insert screen.

  If you enter recovery mode through any other means, or if dev-mode is
  already enabled, pressing Ctrl-D at the Insert screen will have no effect.

To return to normal mode:

  Reboot. At the Dev screen, press ENTER or SPACE. It will reboot to
  recovery mode and ask you if you want to return to normal mode. If you
  press ESC or power off, you'll still be in dev-mode. Press ENTER or SPACE,
  and it will reboot into normal mode (of course, if you've messed up your
  images while in dev-mode, you'll just come right back to recovery mode
  again).

  You can also request a direct return to normal mode by running

    crossystem disable_dev_request=1

  and rebooting.

Change-Id: I435905855a6c39932ee466cc046bdc4c4c860f98
Reviewed-on: https://gerrit.chromium.org/gerrit/24160
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
2012-06-08 22:24:05 -07:00
Tom Wai-Hong Tam
2ddd5f6451 Add Ctrl-Enter as an additional key to trigger dev USB boot.
Due to the limitation of servo that is unable to send U keys, dev USB boot
(triggered by Ctrl-U) is unable to be tested on FAFT. To solve it, firmware
should add an addition key combination to workaround it. Ctrl-Enter is the
one we picked.

BUG=chrome-os-partner:6759
TEST=compile the firmware and update it to Lumpy; during the dev screen,
press Ctrl-Enter to trigger USB boot.

Change-Id: I8215a241c3c07dc2f5e194c324459f106d007f47
Reviewed-on: https://gerrit.chromium.org/gerrit/15749
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
2012-02-14 22:25:53 -08:00
Bill Richardson
cbfc6dbd23 Oops. Must still distinguish "no disks" from "no valid disks".
The fix for chrome-os-partner:7715 introduced a new bug. This fixes that.

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

Boot into recovery mode.
Insert invalid USB.

You should see the YUCK screen.

Change-Id: I868287eecd34bb0c48127bee04f573b418f5945c
Reviewed-on: https://gerrit.chromium.org/gerrit/14963
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
2012-01-27 10:54:19 -08:00
Bill Richardson
bf020a0d4d Make VbTryLoadKernel() go to recovery when no valid disks are found
Previously, it was going to recovery only when no disks existed. That didn't
catch the case where disks exist but none of them are usable.

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

I've added a test specifically for this, so just

  make
  make runtests

should verify it.

To test on actual hardware, find a disk or USB drive that has something
other than 512 bytes per LBA, and try it. It won't be bootable, but using it
shouldn't hang the system or cause weird behavior.

Once in recovery, press TAB, and you should see the reason code
VBNV_RECOVERY_RW_NO_DISK

Change-Id: I475ddd01e13fa806025a2107c260c030d098a17e
Reviewed-on: https://gerrit.chromium.org/gerrit/14816
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
2012-01-25 15:12:09 -08:00
Bill Richardson
5fd35971de Be aggressive in saving locale to nvram.
On x86 platforms, the power button and lid switch events have to be handled
by coreboot SMM code, because it needs to interact with the southbridge
and/or EC, and U-Boot doesn't have a way to do that. Once the kernel takes
over, it sends an SMI to that code which tells it to start delivering ACPI
events instead of whatever pre-ACPI handling it has been doing.

U-Boot doesn't have any code to handle either case, and adding it would
either be a major undertaking (adding ACPI support to U-Boot!), or would
require creating yet another special-purpose interface just for our U-Boot
(yuck).

It's much simpler to just make vboot_reference be more aggressive about
writing to the nvram for this one case where it matters.

OTOH, ARM will need U-Boot to handle the lid switch and power button via
GPIOs since it uses only U-Boot and has no SMI handler. This change isn't
necessary for ARM, but shouldn't hurt either.

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

1. Boot to dev-mode screen or recovery screen.
2. Press arrow keys to change locale.
3. Power off (press power button or yank A/C & battery)
4. Power on again.

The BIOS screen locale should still be set to your last choice before
powering off.

Change-Id: I9008811c3be71de47ff1c6899e81955cf0560a52
Reviewed-on: https://gerrit.chromium.org/gerrit/14721
Tested-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-01-24 15:04:46 -08:00
Vincent Palatin
25381875e1 Acknowledge Ctrl+U faster
When the user hits Ctrl+U on the dev screen, we used to change the
screen only after we enumerate the USB devices, load the kernel from USB
mass storage and boot it (about 4 seconds on the current firmware).
Let's blank the screen earlier to show we got the key press.

BUG=chrome-os-partner:7563
TEST=on a Stumpy in developer, hit Ctrl+U on the dev screen with an
invalid key, then a valid key. Check which screen are displayed and how
long it takes to get a new display after the key strokes.

Change-Id: Ifc73b56055bcd50360d71c1cb6dee052d0fdf9aa
Reviewed-on: https://gerrit.chromium.org/gerrit/14395
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2012-01-18 13:15:45 -08:00
Bill Richardson
82e69b9f74 Clean up return codes for better interaction with U-Boot.
BUG=none
TEST=none

Change-Id: I432de92e00444b58c20faadf8671ccc1c0056e28
Reviewed-on: https://gerrit.chromium.org/gerrit/14181
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
2012-01-17 09:09:39 -08:00
Bill Richardson
759d5c4ccd ONLY pressing the recovery button okays booting from USB
BUG=chrome-os-partner:1113
TEST=manual

With the dev-switch OFF, insert a bootable USB drive, reboot while holding
down recovery button. It should boot from the USB without prompting for
removal.

With the dev-switch OFF and the same bootable USB drive inserted, run

  crossystem recovery_request=2
  reboot

The BIOS screen should prompt you to remove the USB drive, then to insert it
before it will boot from the USB.

Prior to this fix, using recovery_request=2 would NOT require removal, while
other non-zero values would. NO values of recovery_request should be able to
override the removal request. Only physically pressing the button should
allow booting immediately from recovery mode with the dev-switch OFF.

Change-Id: I6d63ecb761c4b26820091cc7a97ca540b362c22e
Reviewed-on: https://gerrit.chromium.org/gerrit/12143
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
2011-11-28 12:26:20 -08:00
Bill Richardson
591f07822b Pressing the recovery button okays booting from USB
BUG=chrome-os-partner:1113
TEST=manual

With the dev-switch OFF, insert a bootable USB drive, reboot while holding
down recovery button. It should boot from the USB without prompting for
removal.

With the dev-switch OFF and the same bootable USB drive inserted, run

  crossystem recovery_request=1
  reboot

The BIOS screen should prompt you to remove the USB drive, then to insert it
before it will boot from the USB.

Change-Id: Ie2fe4302443e14b1f85f409b54aa43a94d6c5477
Reviewed-on: https://gerrit.chromium.org/gerrit/11788
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2011-11-16 16:00:42 -08:00
Bill Richardson
0d11efb0dc Add VB_INIT_OUT_ENABLE_ALTERNATE_OS flag
This adds a flag to the list of values returned by VbInit(). When
this flag is set, the BIOS may be asked to boot something other than
ChromeOS. If this requires some sort of special preparation, the BIOS
should do it.

BUG=chromium-os:22454
TEST=none

There is no test for this. It requires a change to the BIOS in order
to do anything differently, and we haven't yet decided whether the
BIOS should pay attention to it.

Change-Id: I5d89e7cd5b745ee74b8ace7fa613c0db03eebefd
Reviewed-on: https://gerrit.chromium.org/gerrit/11714
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2011-11-16 10:16:37 -08:00
Bill Richardson
791d6e6d75 Fix typo, add one VBDEBUG.
BUG=none
TEST=none

Change-Id: Ie82c5eb3052c84272da4bf21d80cc2bf204fd08d
Reviewed-on: https://gerrit.chromium.org/gerrit/11670
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
2011-11-14 17:02:17 -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
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
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
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
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
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
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
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
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
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
ad33485a2f Clear the recovery request after each boot attempt which is allowed to fail
The problem is that the recovery request was only being cleared when
the firmware found a good image, not after a failed attempt was
ignored.

BUG=chromium-os:17846
TEST=see bug for manual test procedure

Change-Id: I4c6b026bef477839def9bf2b0fed626a9922650f
Reviewed-on: http://gerrit.chromium.org/gerrit/4352
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-20 16:25:57 -07:00
Randall Spangler
43101b4b50 Add indication to developer that dev_boot_usb is disabled
BUG=chrome-os-partner:5031
TEST=manual

1. crossystem dev_boot_usb=0
2. Boot with dev switch on and bootable USB device inserted
3. Press Tab.  Should show dev_boot_usb: 0
4. Press Ctrl+U.  Should beep twice

5. crossystem dev_boot_usb=1
6. Boot with dev switch on and nothing in USB/SD
7. Press Tab.  Should show dev_boot_usb: 1
8. Press Ctrl+U.  Should beep once

Change-Id: Ie9b73f86d68337b48c1b859c7c6d76fcb72d13c2
Reviewed-on: http://gerrit.chromium.org/gerrit/4312
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-19 13:25:32 -07:00
Randall Spangler
64ca788195 Add support for merged normal+dev firmware
BUG=chromium-os:17457
TEST=make && make runtests

When this is merged into an actual firmware build, can test it:
* dev switch off -> no dev screen, won't boot self-signed kernel
* dev switch on --> dev warning screen, will boot self-signed kernel
(e.g., it acts like the Cr-48)

Change-Id: I985428256e48b7e05dd4d8fe582a0c0103bf5fb2
Reviewed-on: http://gerrit.chromium.org/gerrit/3901
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-11 18:16:56 -07:00
Randall Spangler
daa807c51e Add support for dev_boot_usb flag
BUG=chromium-os:17433
TEST=make && make runtests.  Additional manual tests:

0. Insert a valid dev-signed USB key.

1. Boot with dev switch off.
`crossystem dev_boot_usb` should print 0.

2. Flip dev switch on.
`crossystem dev_boot_usb` should print 0.
Ctrl+U at dev screen should beep, but not boot USB.

3. Type `crossystem dev_boot_usb=1`.  Should succeed.
`crossystem dev_boot_usb` should print 1.

4. Reboot system.
At the dev mode warning, press Ctrl+U
System should boot from USB key
`crossystem dev_boot_usb` should print 0.

5. Flip dev switch off.
`crossystem dev_boot_usb` should print 0.

6. Flip dev switch on.
`crossystem dev_boot_usb` should print 0.

Note that this does not apply to Cr-48, Alex, or ZGB.

Change-Id: Idf85fdd642f38f531c89e5fa5b1679e84936d4da
Reviewed-on: http://gerrit.chromium.org/gerrit/3875
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-11 18:16:03 -07:00
Randall Spangler
9619112a57 Vboot wrapper - add recovery reason, refactor timing
Pressing Tab at a firmware screen now displays real data, including
the recovery reason, HWID, and contents of VbNvStorage.

Entry point start/end time tracking in VbSharedData now refers to the
new wrapper APIs.

Added capability for calling firmware to request recovery mode (for
example, if it's unable to initialize RAM, can't find the SSD, etc.).
Previously, calling firmware had no (good) way to do this other than
faking the recovery button being pressed.

BUG=chromium-os:17018
TEST=emerge on x86 and tegra2_seaboard

Change-Id: I7d377f279842b30a10d945d13571c41c464633f1
Reviewed-on: http://gerrit.chromium.org/gerrit/3814
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-08 16:19:07 -07:00
Randall Spangler
1b1998dff0 Vboot wrapper initial implementation
Patch 1: Initial change
Patch 2: Fix comment in vboot_struct.h
Patch 3: Revert files unintentionally reverted
Patch 4: (rebase)
Patch 5: (rebase)
Patch 6: Revert files unintentionally reverted (again)
Patch 7: Fix mocked tlcl for ARM build

BUG=chromium-os:17010
TEST=make && make runtests; works on H2C; emerge-tegra2_seaboard chromeos-bootimage compiles

Change-Id: I6e5ce72d41b9297c07a3f330a881eba68cfabee2
Reviewed-on: http://gerrit.chromium.org/gerrit/3593
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-08 13:31:36 -07:00