summaryrefslogtreecommitdiff
path: root/host
Commit message (Collapse)AuthorAgeFilesLines
* Report mainfw_act based on VbSharedData780.BRandall Spangler2011-07-152-3/+20
| | | | | | | | | | | | | | | Don't use FDT to report it on ARM. This fixes ARM reporting the wrong thing for RO-normal. BUG=none TEST=none Change-Id: Id3a1bd2a1d2502e1d9493ab362be5a58fa88d70e Reviewed-on: http://gerrit.chromium.org/gerrit/4213 Reviewed-by: Olof Johansson <olofj@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>
* crossystem: arm: use proper gpio referencesOlof Johansson2011-07-141-11/+24
| | | | | | | | | | BUG=none TEST=make sure developer switch and recovery switch runtime reading works as expected (manually) Change-Id: I3b17ac66f88b2b789bebe4e7d271666f8c63a8b0 Reviewed-on: http://gerrit.chromium.org/gerrit/4127 Reviewed-by: Olof Johansson <olofj@chromium.org> Tested-by: Olof Johansson <olofj@chromium.org>
* arm: convert to new device tree usageOlof Johansson2011-07-141-102/+114
| | | | | | | | | | | | | This also includes reading the nonvolatile storage from disk instead of through the device-tree, since it's not updated there. BUG=none TEST=read and write a few crossystem variables Change-Id: I6836a6eb0c92a0560dd393e694690a694bdb77a6 Reviewed-on: http://gerrit.chromium.org/gerrit/4078 Tested-by: Olof Johansson <olofj@chromium.org> Reviewed-by: Rong Chang <rongchang@chromium.org>
* Add support for flags in the firmware preamble.Randall Spangler2011-07-133-3/+7
| | | | | | | | | | | | | | | | | | The old (v2.0) parser is compatible with new (v2.1) structs. That is, this won't break existing firmware or vbutil_firmware. A new (v2.1) parser parsing an old (v2.0) struct will return 0 for the flags. This will be used to support the RO-normal code path in a subsequent CL. BUG=chromium-os:17304 TEST=added unit tests; make && make runtests Change-Id: I73bcd8acd3330b0d7d143061b5ef838e6d79cf1a Reviewed-on: http://gerrit.chromium.org/gerrit/4030 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>
* Introduce arm fdt support in crossystem utilityRong Chang2011-07-111-172/+218
| | | | | | | | | | | | | | | | | | | | This CL builds upon recent changes in u-boot and kernel. (see issue ids: 15744, 16665) - Remove /sys/kernel/debug/chromeos_arm share memory mechanism - Load properties from /proc/device-tree/crossystem/* - Write NVCXT to /dev/mmcblk0:lba[0] BUG=chromium-os:17300 TEST=manual Run crossystem on device console. Check current values of gpio switches. All other values are exported from FDT directly. Change-Id: Ib8db4a4aeb6dc36308ad8882403cb2f5978a5c70 Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: http://gerrit.chromium.org/gerrit/3676 Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
* Add support for dev_boot_usb flagRandall Spangler2011-07-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Vboot wrapper - add recovery reason, refactor timingRandall Spangler2011-07-081-6/+6
| | | | | | | | | | | | | | | | | | | | | 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>
* Vboot wrapper initial implementationRandall Spangler2011-07-081-2/+0
| | | | | | | | | | | | | | | | | | 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>
* crossystem: fix VbSharedDataHeader sizeHung-Te Lin2011-06-301-3/+1
| | | | | | | | | | | | | The content in VbSharedMem should be VbSharedData instead of FMAP. BUG=chromium-os:17168 TEST=crossystem # seeing correct value (the test need a u-boot with fix included) Change-Id: I3d7d1eb2b35c9475c2047e9479cee69464da20b1 Reviewed-on: http://gerrit.chromium.org/gerrit/3436 Reviewed-by: Che-Liang Chiou <clchiou@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org>
* Fix ARM build for vboot_reference crossystem libRandall Spangler2011-06-271-1/+1
| | | | | | | | | | BUG=none TEST=none Change-Id: I655cd69a0e1d2a3ad6ce9f326cbd989fc8ecb43d Reviewed-on: http://gerrit.chromium.org/gerrit/3270 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>
* Verified boot wrapper - add stub implementations for hostRandall Spangler2011-06-2710-97/+93
| | | | | | | | | | | | | | | This is part 2 of the wrapper API refactor. It adds stub implementations for the host, and changes the host-side utilities to use them. Firmware implementation is unchanged in this CL (other than a few updates to macros). BUG=chromium_os:16997 TEST=make && make runtests Change-Id: I63989bd11de1f2239ddae256beaccd31bfb5acef Reviewed-on: http://gerrit.chromium.org/gerrit/3256 Reviewed-by: Stefan Reinauer <reinauer@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>
* Vboot wrapper API - crossystem and header filesRandall Spangler2011-06-274-8/+41
| | | | | | | | | | | | | | | | Header file changes for wrapper API implementation Crossystem support for reading recovery reason from VbSharedData, and explicit support for version 1 VbSharedData structs. BUG=chromium-os:16970 TEST=make && make runtests; run crossystem on Alex and make sure it still reports recovery_reason in recovery mode. Change-Id: I15195b899583e425d3c9e8df09842d764528e2cb Reviewed-on: http://gerrit.chromium.org/gerrit/3203 Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org> Reviewed-by: Che-Liang Chiou <clchiou@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>
* Fixed compiler warning in v-boot reference.Doug Anderson2011-05-251-2/+2
| | | | | | | | | | | | | | The error was: arch/arm/lib/crossystem_arch.c: In function ‘VbReadSharedMemory’: arch/arm/lib/crossystem_arch.c:134: error: format ‘%d’ expects type ‘int’, but argument 5 has type ‘long unsigned int’ BUG=none TEST=(outside choot): cd src/platform/vboot_reference; make Change-Id: I5e1f69abd125fe06cf6ae04a7946568bdbcef83e Reviewed-on: http://gerrit.chromium.org/gerrit/1547 Tested-by: Doug Anderson <dianders@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* crossystem: arm: fix incorrect mainfw_act outputChe-Liang Chiou2011-05-221-1/+1
| | | | | | | | | | | | | | | | BUG=chromium-os:15626 TEST=manual when not recovery boot $ [ $(crossystem mainfw_act) = "A" ] || [ $(crossystem mainfw_act) = "B" ] when recovery boot $ [ $(crossystem mainfw_act) = "recovery" ] Change-Id: I3917106b61e2979d8cb07f01fd0cec044ae725cb Reviewed-on: http://gerrit.chromium.org/gerrit/1345 Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* Ensure ARM crossystem gpio readings match u-boot.Vadim Bendebury2011-05-191-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | U-boot and crossystem interpret the same switch state differently for 'recovery mode' and 'write protect', This change adds the ability to invert certan GPIO readings such that crossystem and u-boot return the same values. BUG=chromium-os:15393 TEST=manual Running crossystem on the target with developer u-boot image: - observe that recoverysw_cur reading matches recoverysw_boot and wpsw_cur reading matches_wpsw_boot. - try rebooting with recovery or developer mode buttons pressed, observe the change in reported values of devsw_boot and recoverysw_boot. - observe reported values of devsw_cur and recoverysw_cur following pressing of the buttons. Change-Id: I628f59b60008719bbff1722d23154ce934af6c36 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: http://gerrit.chromium.org/gerrit/1193 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Introduce arm support in crossystem.Vadim Bendebury2011-05-053-64/+242
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL builds upon earlier firmware and kernel changes (see CLs related to the same bug, chromium-os:12522). ARM firmware now simulates both Nvram storage and VDAT buffer, the structures the x86 version uses extensively to communicate back and forth between firmware/kernel/userland. So, to make crossystem work on arm, all what's needed is to provide architecture specific interface to Nvram and VDAT simulation, and architecture specific processing for variables which are accessed on ARM platforms in a different way. The few discrepancies and platform specifics which had to be addressed for ARM specifically are as follows: - the Nvram contents are cached in the shared memory and available for reading as part of /sys/kernel/debug/chromeos_arm. When writing Nvram, the same file needs to be written, but only the 16 bytes (representing the Nvram contents) are aacepted. - the VDAT buffer also comes from the shared memory (as part of the same sysfs file) - when crossystem starts, it needs to read in this shared memory contents, a` weak' function VbArchInit() is being added such that it is provided on ARM platforms only, on x86 an empty stub is called. - current developer/recovery request/ro firmware switch states are retrieved through GPIO drivers. The GPIO numbers are defined in the file, the GPIO driver is supposed to be configured before crsossystem can operate. - the BINF values are supplied through an array within shared memory, it would be easy to refactor both x86 and ARM use the same code to process BINF values, but with this submission the code is duplicated to minimize x86 impact. - the following crossystem variables do not have ARM equivalents, thier values are reported as '(error)': recoverysw_ec_boot savedmem_base savedmem_size BUG=chromium-os:12522 TEST=manual: . bring up a kaen system . execute the following script to enable the appropriate GPIOSs: for gpio in 56 59 168; do echo $gpio > /sys/class/gpio/export; done . run `crossystem' and observe reasonable output values . to verify that it reads GPIOs properly, try echo $(./crossystem recoverysw_cur) with the miniservo 'GOOG_REC' button pressed and released, observe different readings (note that the state of the button is reversed, the released button is reported as '1') . to verify the write capabilities, note that the nvram contents can be accessed using the following shell commands echo 3 > /proc/sys/vm/drop_caches 2>/dev/null dd if=/dev/mmcblk0 of=/tmp/blk bs=16 count=1 && \ od -t x1 /tmp/blk | head -1 (the first command cause the device cache dropped, and the second command accesses the device contents. vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv localhost var # echo $(./crossystem fwb_tries) 10 localhost var # echo 3 > /proc/sys/vm/drop_caches localhost var # 2>/dev/null dd if=/dev/mmcblk0 of=/tmp/blk bs=16 count=1 && od -t x1 /tmp/blk | head -1 0000000 60 0a 00 be 00 00 00 00 00 00 00 02 00 00 00 a2 localhost var # ./crossystem fwb_tries=9 localhost var # echo $(./crossystem fwb_tries) 9 localhost var # echo 3 > /proc/sys/vm/drop_caches localhost var # 2>/dev/null dd if=/dev/mmcblk0 of=/tmp/blk bs=16 count=1 && od -t x1 /tmp/blk | head -1 0000000 60 09 00 be 00 00 00 00 00 00 00 02 00 00 00 8a localhost var # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Change-Id: Ie4c6ff44441d98a42b1057953208fdb90c08f46d Reviewed-on: http://gerrit.chromium.org/gerrit/113 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Vadim Bendebury <vbendeb@chromium.org>
* Process case of corrupted firmware explicitly.Vadim Bendebury2011-04-191-0/+1
| | | | | | | | | | | | | | | | | | | | | Add the missing return statement to allow to tell between different recovery reasons on legacy firmware. Change-Id: I287e9d91dde040dd0edbe23422dc8914f81cc9f2 BUG=chromium-os:14295 TEST=manual On a system with a chromeOS Flash USB drive plugged in: - preserve currently running firmware - corrupt both RW firmware sections - restart the system (it comes up in recovery mode) - login - run `crossystem recovery_reason' and observe the result: it used to print '66' before the fix, prints '3' after the fix. - restore the firmware Review URL: http://codereview.chromium.org/6879051
* Add crossystem loc_idxRandall Spangler2011-04-121-0/+4
| | | | | | | | | | | | | | | Change-Id: I9fdedabd02b11e5623b9417f24dc388ce092548c R=wfrichar@chromium.org BUG=chromium-os:14069 TEST=manual crossystem loc_idx=3 crossystem loc_idx # prints 3 crossystem loc_idx=0 crossystem loc_idx # prints 0 Review URL: http://codereview.chromium.org/6826057
* Add Mario support for fwupdate_triesRandall Spangler2011-04-111-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I1c4240ebe5783ca923c310061e2a76947aa6601b R=reinauer@chromium.org BUG=chromium-os:14030 TEST=manual On a Mario: crossystem fwupdate_tries=3 crossystem fwupdate_tries # should be 3 cat /mnt/stateful_partition/.need_firmware_update # should be 3 crossystem fwupdate_tries=0 crossystem fwupdate_tries # should be 0 cat /mnt/stateful_partition/.need_firmware_update # should complain file doesn't exist On a newer platform: crossystem fwupdate_tries=3 crossystem fwupdate_tries # should be 3 cat /mnt/stateful_partition/.need_firmware_update # should complain file doesn't exist crossystem fwupdate_tries=0 crossystem fwupdate_tries # should be 0 cat /mnt/stateful_partition/.need_firmware_update # should complain file doesn't exist Review URL: http://codereview.chromium.org/6825047
* Add crossystem fwupdate_tries and fix nv storage writesRandall Spangler2011-04-081-1/+17
| | | | | | | | | | | | | | | | | Change-Id: I1835f4867de80aa3764e4a4c6d90b3fde2dc4308 R=reinauer@chromium.org BUG=chromium_os:13672 TEST=manual crossystem kern_nv=3 crossystem fwupdate_tries # should print 3 crossystem fwupdate_tries=15 crossystem kern_nv # should print 0x0000000F crossystem kern_nv=0 crossystem fwupdate_tries # should print 0 Review URL: http://codereview.chromium.org/6813056
* Add crossystem arch (reports x86 or arm, depending on platform)Randall Spangler2011-04-082-2/+6
| | | | | | | | | | | | Change-Id: I857ead5b108d42195145cdbc5cdafa817f3416b4 R=reinauer@chromium.org BUG=chrome-os-partner:3023 TEST=crossystem arch (reports 'x86' on x86 platform, 'arm' on ARM platform) Review URL: http://codereview.chromium.org/6813054
* Add dummy crossystem_arch implementation for amd64 (host)Randall Spangler2011-04-071-0/+57
| | | | | | | | | Change-Id: Ia87cdd9551af1d592ece641c2abcc02db73869e1 R=piman@chromium.org,jrbarnette@chromium.org BUG=none TEST=sudo emerge vboot_reference TBR=jrbarnette@chromium.org
* Refactor crossystem to move x86-specific implementation to its own file.Randall Spangler2011-04-077-604/+893
| | | | | | | | | | | | | | | | | | | | This should be ready for the ARM team to pick up and work on. I added a placeholder ARM implementation file, though it's not hooked up in the Makefile yet. As soon as you implement the VbNvStorage APIs, all the related crossystem commands will start working. Ditto for VbSharedData. The params which x86 gets from ACPI you'll need to get from u-boot somehow, probably via your own kernel driver. R=robotboy@chromium.org BUG=chromium-os:12522 TEST=emerge-x86-alex vboot_reference, make sure it still works on x86 Review URL: http://codereview.chromium.org/6780008 Change-Id: I628ee56508421b937ed50db7cb9b8385408d2f5e
* Use uint64_t and avoid down casting as much as possible.Gaurav Shah2011-03-251-2/+2
| | | | | | | | | Change-Id: I231d1b3a059907c3806feced7e1b8f1c06575ba5 BUG=chromeos-partner:2912 TEST=make clean all && make runtests Review URL: http://codereview.chromium.org/6733018
* Print LoadKernel() debug data from VbSharedDataRandall Spangler2011-03-211-10/+124
| | | | | | | | | | Change-Id: I60cf9c4dd07e83b1ed1a5bac8a3ce8c2a54df45b R=reinauer@chromium.org BUG=chrome-os-partner:2748 TEST=manually check output of 'crossystem vdat_lkdebug' Review URL: http://codereview.chromium.org/6685097
* Use VbSharedData instead of VbNvStorage for fwb_tries and kernkey_vfyRandall Spangler2011-03-181-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I5ed3509a9d4e578cd2e98f493dab59bc2fbd5827 R=dlaurie@chromium.org BUG=chrome-os-partner:2748 TEST=manual crossystem fwb_tries=3 (reboot) crossystem tried_fwb (should print 1) crossystem fwb_tries=0 (reboot) crossystem tried_fwb (should print 0) In dev mode... Boot a kernel signed with the same key as in the firmware crossystem kernkey_vfy (should print sig) Boot a kernel signed with a different key than the firmware crossystem kernkey_vfy (should print hash) Review URL: http://codereview.chromium.org/6711045
* Add TPM version checkingRandall Spangler2011-03-171-2/+13
| | | | | | | | | | | | | Change-Id: Ic32b7bcf0bc5501e21dc84e79419a256d9b0d095 R=semenzato@chromium.org,reinauer@chromium.org BUG=chrome-os-partner:2832 TEST=manual crossystem tpm_fwver tpm_kernver On a debug system, this will return 0x00010001 0x00010001 Review URL: http://codereview.chromium.org/6685075
* Add VbSharedData field parsingRandall Spangler2011-03-171-40/+92
| | | | | | | | | | | | | | | | | | | | | R=reinauer@chromium.org BUG=chrome-os-partner:2578 TEST=manual crossystem vdat_timers should show 'LFS=0,0 LF=number1,number2 LK=number3,number4' where number1 < number2 < number3 < number4 crossystem vdat_lfdebug run from a dev mode console, should show 'check=12,0 index=0x00 tpmver=(hex number) lowestver=(hex number)' crossystem vdat_flags run from a dev mode console, flags should be 0x04. Review URL: http://codereview.chromium.org/6685068 Change-Id: Id7b958ae300d10cdcdc1b17a1bb17b7e5069166f
* Add VB test error func/numRandall Spangler2011-03-151-0/+8
| | | | | | | | | Change-Id: Ibe253963f0424935554fe91f166ef5040a723c6f BUG=13107 TEST=make && make runtests Review URL: http://codereview.chromium.org/6698032
* Add function for VDAT processing.Vadim Bendebury2011-03-151-0/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL is a user space counterpart of http://codereview.chromium.org/6690023, which provided the ability to retrieve buffers through chromeos_acpi driver. The buffer contents is communicated as a multi line string with each buffer byte represented as a two symbol hex number. `crosstool', on the other has to map the buffer contents into a certain binary structure. This CL add conversion of the multiline string into a binary buffer and also adds a temp. routine to dump the buffer contents on the screen when `crosstool' is invoked. Change-Id: I8dd3eb935332f9bc8769c71de0db302365f12d70 BUG=chromium-os:13069, chromium-os:13091 TEST=manual - Install the new image on a target with firmware providing the VDAT ACPI method. - Run crosstool and watch for the last line: vdat = 11 22 33 44 ff 1f 1c 40 ff 57 74 41 ff ff ff ff # Raw VDAT contents. localhost tmp # Review URL: http://codereview.chromium.org/6695012
* Add check-value support and check /proc/cmdline for cros_nodebugRandall Spangler2011-03-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I35158810184be03f18d98893e4dd640088384579 BUG=12904 TEST=manual crossystem fwb_tries=1 crossystem fwb_tries?1 && echo YES || echo NO --> YES crossystem fwb_tries?0x01 && echo YES || echo NO --> YES crossystem fwb_tries?0 && echo YES || echo NO --> NO crossystem fwb_tries=0 crossystem fwb_tries?0 && echo YES || echo NO --> YES crossystem fwb_tries?1 && echo YES || echo NO --> NO crossystem fwb_tries?0x01 && echo YES || echo NO --> NO crossystem ecfw_act --> RW (if it's not, change RW to RO in the tests below) crossystem ecfw_act?RW && echo YES || echo NO --> YES crossystem ecfw_act?BOB && echo YES || echo NO --> NO For the following tests, boot Alex with dev switch on and fwb_tries=1 Expected output of `crossystem mainfw_type mainfw_act cros_debug` under each of the following scenarios: * Neither "cros_debug" nor" cros_nodebug" in kernel command line: normal B 1 * Kernel command line changed to include "cros_nodebug": normal B 0 * Kernel command line changed to include "cros_nodebugg": normal B 1 * Kernel command line changed to include "ccros_nodebug": normal B 1 Review URL: http://codereview.chromium.org/6665005
* Add cros_debug option to crossystemRandall Spangler2011-03-101-4/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: Ie62364a87f7f144ee647054d2a9ef83522cdbe7d BUG=12904 TEST=manual Expected output of `crossystem mainfw_type cros_debug` under each of the following scenarios: * Boot Alex with dev switch off: normal 0 * Boot Alex with dev switch on (and dev firmware): developer 1 * Boot Alex with dev switch on (and normal firmware): normal 1 * Boot Alex with recovery firmware: recovery 0 * Boot Alex with dev switch off, then turn the dev switch on after booting: normal 0 * Boot Cr-48 with dev switch off: normal 0 * Boot Cr-48 with dev switch on: developer 1 * Boot Cr-48 with recovery firmware: recovery 0 * Boot Alex with dev switch off and kernel command line changed to include "cros_debug": normal 1 * Boot Alex with dev switch off and kernel command line changed to include "cros_debugg": normal 0 * Boot Alex with dev switch off and kernel command line changed to include "ccros_debug": normal 0 * Boot H2O BIOS with kernel command line changed to include "cros_debug": nonchrome 1 * Boot H2O BIOS with kernel command line changed to include "cros_debugg": nonchrome 0 * Boot H2O BIOS with kernel command line changed to include "ccros_debug": nonchrome 0 Review URL: http://codereview.chromium.org/6659021
* Add crossystem support for nvram_cleared and kern_nvRandall Spangler2011-03-011-9/+6
| | | | | | | | | | | | | | | Fix try_b processing And move key block flags check up in LoadFirmware(), which speeds up boot when the dev switch is off because it doesn't do a signature check and then throw it out. BUG=12282 TEST=build firmware, try by hand Review URL: http://codereview.chromium.org/6596081 Change-Id: I10474e9e0ae324906dfe02a351347d04ce847f67
* Add kern_nv field to crossystemRandall Spangler2011-03-011-1/+7
| | | | | | | | | | | | Change-Id: Ifa5cc3bd8367a258fb720162572f450a1be99c03 BUG=none TEST=manual crossystem kern_nv=0x12345678 crossystem kern_nv Review URL: http://codereview.chromium.org/6602040
* rename tried_fwb constantsRandall Spangler2011-02-251-1/+1
| | | | | | | | | Change-Id: Ib8018bfe29eed50766c699d832efe4f1afcabb1a BUG=none TEST=make && make runtests Review URL: http://codereview.chromium.org/6597015
* Add NV storage fields for firmware flagsRandall Spangler2011-02-251-0/+13
| | | | | | | | | | | | | | | 1) Did firmware attempt RW slot B before slot A? 2) Did firmware check the kernel keyblock signature, or just its hash? Added crossystem support as well. BUG=chrome-os-partner:1657 TEST=make && make runtests Review URL: http://codereview.chromium.org/6597011 Change-Id: I0d743ae87cedd938ba988170793717d3fdbd8ce9
* crossystem uses VbNvStorageRandall Spangler2011-02-251-6/+119
| | | | | | | | | | | | | | | | | | | | | | | Change-Id: I3f158115c8514bda0b271674870d68717c4816e6 BUG=12282 TEST=manual crossystem fwb_tries=0 && crossystem fwb_tries This should print 0 on both BIOSes. crossystem fwb_tries=6 && crossystem fwb_tries This should print 1 on an older BIOS and 6 on a new BIOS (0050+) Then reboot and run crossystem mainfw_act This should print 'B', since fwb_tries was non-zero. Review URL: http://codereview.chromium.org/6576059
* Add flashmap base addressRandall Spangler2011-02-241-0/+3
| | | | | | | | | | | | | Change-Id: If2106cbde445edc0970862a06d3837d2e466d9ef BUG=chrome-os-partner:2487 TEST=manual From a root shell, type: crossystem fmap_base Should match the contents of /sys/devices/platform/chromeos_acpi/FMAP (note that you need a new BIOS >0049 to get one that supports FMAP) Review URL: http://codereview.chromium.org/6580037
* Add more properties to crossystemRandall Spangler2011-02-231-3/+155
| | | | | | | | | | | crossystem now covers all data currently provided by chromeos_acpi. Change-Id: I3364c4d65ddf63fe788d3d9c1e9d05e64be22856 BUG=chromium-os:12282 TEST=manual - test on Cr-48 and compare with ACPI values Review URL: http://codereview.chromium.org/6557001
* Add support for CHNV settings to crossystem.Randall Spangler2011-02-181-1/+93
| | | | | | | | | | | | | | | | | | | | | | | | | crossystem can now be used in place of reboot_mode. BUG=12327 TEST=manual by comparing with the old reboot_mode utility crossystem recovery_request=1 reboot_mode crossystem dbg_reset=1 reboot_mode crossystem fwb_tries=1 reboot_mode crossystem recovery_request=0 reboot_mode crossystem dbg_reset=0 reboot_mode crossystem fwb_tries=0 reboot_mode Review URL: http://codereview.chromium.org/6538066 Change-Id: Ifde661d4621129d52e757654d85e386e65f90df5
* Fix WP polarity on MarioRandall Spangler2011-02-171-9/+25
| | | | | | | | | | | | | | | | | | | | | Note that both the current and boot settings are incorrect as reported by the BIOS. This fixes both. Change-Id: Iebd2b4ac91232444e538f6e2763a22cb227f2e4f BUG=chrome-os-partner:2078 TEST=manual Run crossystem on Mario and Alex with WP enabled, disabled and check Verify true hardware WP status by doing: flashrom --wp-enable flashrom --wp-status flashrom --wp-disable flashrom --wp-status On a system with hardware WP enabled, the disable step should fail and write protect will still report enabled. Review URL: http://codereview.chromium.org/6531035
* Add load_firmware_test utility programChe-Liang Chiou2011-02-173-1/+79
| | | | | | | | | | BUG=chromium-os:1302 TEST=emerge vboot_reference && (load_firmware_test firmware_image.bin | grep LOAD_FIRMWARE_SUCCESS) Review URL: http://codereview.chromium.org/6465018 Change-Id: I85fce39aaf4abb50bd70d126ac8c7cb892a7857b
* Initial version of crossystem.Randall Spangler2011-02-073-0/+248
| | | | | | | | | | | Works for getting switch positions, hwid, fwid. BUG=chrome-os-partner:1940 TEST=ran manually on Mario and Alex Review URL: http://codereview.chromium.org/6413002 Change-Id: I874df3b5adf872fec2d36e574cb4b8b4a72d331c
* Fix integration bugs (vboot side)Che-Liang Chiou2010-11-091-5/+15
| | | | | | | | | | | | | | | | | | | | | BUG=chromium-os:8621 TEST=See below 1. Build and run tests of vboot (including linktest) $ make && make runtests 2. Check if *_stub.o are not in vboot_fw.a $ nm /build/<board>/usr/lib/vboot_fw.a | grep _stub.o 3. Build and boot x86-generic image $ ./build_packages --board=x86-generic && ./build_image --board=x86-generic (Then successfully boot the image you just built) See CL=4372001 for u-boot side changes Review URL: http://codereview.chromium.org/4266002 Change-Id: Icc2bcc551c998f370e4b737fbe442ebf029cd81c
* Fix the maximum output size in the call to the external signer.Gaurav Shah2010-11-021-2/+1
| | | | | | | | | | | | | | Maximum output size is the signature size. BUG=7676 TEST=manual 1) Verified that earlier outbufsize value was more than what the external signer would return. 2) Re-ran run_vbutil_tests.sh Change-Id: I180cfea7625ee09a51709d8f7735884c32b8b409 Review URL: http://codereview.chromium.org/4251006
* Add support for using external signing application and .pem private key ↵Gaurav Shah2010-10-294-4/+233
| | | | | | | | | | | | | | | | | | | | | | | | | | files to vbutil_keyblock. This allows signing using a .pem file using an external program. It is assumed that the external program reads input from stdin, and outputs signed data on stdout. It takes one argument - the file name for the .pem private key reference. See external_rsa_signer.sh for an example external program. Example usage: vbutil_keyblock --pack 4096.keyblock \ --datapubkey 4096.vbpubk \ --signprivate_pem 4096.pem \ --pem_algorithm 8 \ --externalsigner "external_rsa_signer.sh" I have tried to make the change such that it doesn't impact existing tools/interfaces (since these are used at various places). That said, I am aware of the places where we could just extend an old interface an avoid code duplication but thought I'd put that re-factoring in as a TODO for now. Let me know if you disagree and I can merge them (and changing the existing interface). BUG=7576 TEST=Extended run_vbutil_tests.sh to test vbutil_keyblock packing using an external signer. To test, make && make runtests (or just run tests/gen_test_keys.sh; tests/run_vbutils_tests.sh) Review URL: http://codereview.chromium.org/4194003 Change-Id: I7cc52c8293c04ef9ba074794d046c9a4f19f6bdd
* New tools to help debug vboot failures.Bill Richardson2010-09-092-0/+12
| | | | | | | | | | | | | | | | | | | This adds some tools to help us figure out why a particular kernel isn't booting. Often we suspect it's because it was signed with the wrong keys, or has flags restricting its use to certain boot modes. This change adds some tools to extract and display all the keys from the BIOS, and try them on the various kernels. We also display the sha1sum of all the keys we find, to make comparing them easier. Change-Id: I38e447bf95cb6c3a0b87aa949611bb135f2f94b4 BUG=chromeos-partner:888 TEST=manual To test, obtain a root shell, and run dev_debug_vboot. You should see lots of useful information go by. Review URL: http://codereview.chromium.org/3303018
* Add additional sanity checks to RSA verification code.Gaurav Shah2010-08-175-17/+19
| | | | | | | | | Also, make algorithm unsigned int in most places. BUG=chrome-os-partner:701 TEST=existing RSA verification tests still pass Review URL: http://codereview.chromium.org/3136017
* Fix KeyBlockVerify() to take an explicit param for whether to use hash only.Randall Spangler2010-08-171-4/+3
| | | | | | | | | Fix VerifyMemberInside(). BUG=chrome-os-partner:703 TEST=make && make runtests Review URL: http://codereview.chromium.org/3126013
* Changes to allow user-signed kernels to be generated.Bill Richardson2010-08-091-6/+11
| | | | | | | | | | | | | Make vbutil_keyblock handle unsigned blocks. Also enable --unpack option and add tests for it. Modify vbutil_kernel to allow unsigned keyblocks, correct usage message, and fix the --debug option which was somehow disabled. Update load_kernel_test to accept /dev/null for the public key, to test non-signed kernel keyblocks. Review URL: http://codereview.chromium.org/3124004