summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* crossystem devsw_cur returns devsw_boot if virtual dev switchfactory-2723.14.BRandall Spangler2012-11-022-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | devsw_cur is really a meaningless concept on systems with virtual dev switches; it exists primarily to support factory test of physical developer switches. However, some plugins use this instead of the preferred devsw_boot, and it's easier to modify crossystem than the plugins at this point in time. BUG=chrome-os-partner:12928 BRANCH=none (affects all current products, but is an OS-level change, not FW) TEST=manual - On link, 'crossystem devsw_cur devsw_boot' with dev switch on -> '1 1' - On link, 'crossystem devsw_cur devsw_boot' with dev switch off -> '0 0' - On lumpy or earlier, 'crossystem devsw_cur' should return current dev switch position; check this by toggling the physical switch without rebooting and see that the reported value follows the switch value. Change-Id: Ie7416e5cb03c133572c32af677b55ed18884dfb8 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/34531 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> (cherry picked from commit 09a8447862c7d111d6abdd7891508df1a8f1cc5b) Reviewed-on: https://gerrit.chromium.org/gerrit/37255 Reviewed-by: David Hendricks <dhendrix@chromium.org> Tested-by: Katie Roberts-Hoffman <katierh@chromium.org>
* crossystem should not grumble about older firmwareChe-Liang Chiou2012-11-021-8/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Older firmware does not provide nonvolatile-context-storage FDT property, and crossystem complains about it. This is harmless; so just make it quiet. Signed-off-by: Che-Liang Chiou <clchiou@chromium.org> BRANCH=none BUG=chrome-os-partner:14475 TEST=manual, see blow Run crossystem and make sure its output does not contain "Unable to open FDT property nonvolatile-context-storage" messages. Check crossystem still works by comparing its output w/ and w/o this change. Change-Id: I0b8f40775833457a75d801f185344e931ac08847 Reviewed-on: https://gerrit.chromium.org/gerrit/33896 Commit-Ready: Che-Liang Chiou <clchiou@chromium.org> Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 210c5ef2d9d060bebf5020da886e2cabd6e05d6d) Reviewed-on: https://gerrit.chromium.org/gerrit/37254 Reviewed-by: Che-Liang Chiou <clchiou@chromium.org> Tested-by: Katie Roberts-Hoffman <katierh@chromium.org>
* crossystem should switch on VbNvContext storage typeChe-Liang Chiou2012-11-021-2/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We may have multiple storage types (disk or mkbp) of VbNvContext. crossystem should switch the type and choose the corresponding device driver. After patching U-Boot, you may check storage type: [ "mkbp" = "$(cat /proc/device-tree/firmware/chromeos/nonvolatile-context-storage)" ] And cross-verify crossystem with mosys: $ mosys nvram vboot read 70000000000000000000000000000020 $ crossystem recovery_request 0 $ crossystem recovery_request=123 $ mosys nvram vboot read 70007b0000000000000000000000005d $ mosys nvram vboot write 70000000000000000000000000000020 $ crossystem recovery_request 0 More importantly, crossystem should also work with older version of firmware, which does not pass down this information. Signed-off-by: Che-Liang Chiou <clchiou@chromium.org> BRANCH=none BUG=chrome-os-partner:13766 TEST=Check storage type on a Snow device: [ "mkbp" = "$(cat /proc/device-tree/firmware/chromeos/nonvolatile-context-storage)" ] Make sure that FAFT is still happy: ./run_remote_tests.sh --remote $ADDR --board daisy 'firmware_TryFwB/control$' ./run_remote_tests.sh --remote $ADDR --board daisy 'firmware_TryFwB/control.dev$' More importantly, check crossystem worked well even when ChromeOS is booted from an older version of firmware. Change-Id: I3989a8c181efe03cd9f06127743763e0ad97e281 Reviewed-on: https://gerrit.chromium.org/gerrit/32470 Reviewed-by: Che-Liang Chiou <clchiou@chromium.org> Tested-by: Che-Liang Chiou <clchiou@chromium.org> Commit-Ready: Che-Liang Chiou <clchiou@chromium.org> (cherry picked from commit 770c1b772c0aa9241bc2923354092a14e1c68661) Reviewed-on: https://gerrit.chromium.org/gerrit/37253 Tested-by: Katie Roberts-Hoffman <katierh@chromium.org>
* Searching for __FMAP__ header in 64-byte aligned addresscychiang2012-08-261-1/+1
| | | | | | | | | | BUG=chrome-os-partner:13134,11728 TEST=dump_fmap a firmware image, it will not find fmap of ec image. Change-Id: I48681843a42689271a8c04ced191cd8458d56224 Reviewed-on: https://gerrit.chromium.org/gerrit/31436 Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org> Tested-by: Yung-Chieh Lo <yjlou@chromium.org>
* CHERRY-PICK: Make crossystem look for the write protect switch in the ↵Gabe Black2012-08-211-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | chromeos_arm device The value of the ChromeOS write protect switch is now provided through the new chromeos_arm platform device which avoids the mismatch between U-Boot and kernel GPIO numbering. BUG=chrome-os-partner:11297 TEST=gmerge-ed onto a snow and verified that crossystem got the right value of the write protect switch. BRANCH=snow Change-Id: I9c3f6bf00b7c7ce243eb8fcb32ef14f77431ea1e Signed-off-by: Gabe Black <gabeblack@google.com> Reviewed-on: https://gerrit.chromium.org/gerrit/30534 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Ready: Randall Spangler <rspangler@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 3afe5566ccee0df6c636ab6e9cf882106fe9245b) Reviewed-on: https://gerrit.chromium.org/gerrit/30981 Reviewed-by: Chinyue Chen <chinyue@chromium.org> Tested-by: Chinyue Chen <chinyue@chromium.org>
* vboot: add flag to indicate that the EC is slow to programBill Richardson2012-08-074-8/+16
| | | | | | | | | | | | | | | | | 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>
* mount-encrypted: write key to disk initiallyfactory-2717.BKees Cook2012-08-063-71/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The encrypted partition has been plagued with TPM problems, which means systems that have a wedged TPM, or interrupt the TPM Ownership, Lockbox creation, etc, all fail to keep the encrypted partition across a reboot. As a result, we're forced to write the encryption key to disk initially, and then throw it away once the system key from NVRAM can be used to encrypt it. On most systems that have a sane unowned TPM, the key will only be on disk until the first login finishes and Cryptohome can Finalize the NVRAM area. For all the other systems, they will continue to run, but with their encryption key effectively in the clear. Technically, this is not a regression from R21, so at least we can move forward and work to improve this in the future. Some attempt is made to wipe out the key, but this is especially ugly for SSDs, since doing a "shred" just means the blocks will get moved around. When ext4 supports "secure delete", we can move to that instead. BUG=chromium-os:32951 TEST=alex build, manual testing Change-Id: I9b9a0190ea0f47a277a150eb0882e4a507ff2927 Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/29123 Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
* Crossystem should return at-boot switch positions from VbSharedDataRandall Spangler2012-08-065-63/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is more reliable than reading them through FDT/ACPI, since it reflects the positions as shown to verified boot code. Notes: 1. This affects ALL platforms with virtual dev switches (x86 AND arm) 2. The fix should have no effect on older platforms, but I haven't tested those. BUG=chrome-os-partner:11805 TEST=manual 1. boot in normal mode. devsw_boot = 0 # Developer switch position at boot recovery_reason = 0 # Recovery mode reason for current boot recoverysw_boot = 0 # Recovery switch position at boot wpsw_boot = 1 # Firmware write protect hardware switch position at boot 2. boot in developer mode. localhost ~ # crossystem devsw_boot = 1 # Developer switch position at boot recovery_reason = 0 # Recovery mode reason for current boot recoverysw_boot = 0 # Recovery switch position at boot wpsw_boot = 1 # Firmware write protect hardware switch position at boot 3. boot in developer-recovery mode using keyboard combo. devsw_boot = 1 # Developer switch position at boot recovery_reason = 2 # Recovery mode reason for current boot recoverysw_boot = 1 # Recovery switch position at boot wpsw_boot = 1 # Firmware write protect hardware switch position at boot 4. disable WP and reboot. wpsw_boot should be 0. Change-Id: If4156b5e14c6923c5b331c7e5feaabbffe1dad37 Reviewed-on: https://gerrit.chromium.org/gerrit/29199 Commit-Ready: Randall Spangler <rspangler@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>
* cryptolib: put constant arrays in rodata segmentVincent Palatin2012-08-064-10/+10
| | | | | | | | | | | | | | | | | The SHA256 constants and some algo definitions are currently in the .data segment, this wastes precious RAM on the EC where read-only data are stored in flash only. BUG=chrome-os-partner:12271 TEST=sudo emerge vboot_reference && emerge-daisy vboot_reference vboot_reference-firmware chromeos-ec and manually check the content of the .data segment in the EC binary. Change-Id: I67b8c0f2843312651e8ac287cea2f8cb5f075453 Reviewed-on: https://gerrit.chromium.org/gerrit/29273 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
* Add WAIT screen to default bitmapBill Richardson2012-08-055-6/+15
| | | | | | | | | | | | | | | | | | | | | Some systems take a long time to program the EC firmware (because it's behind a really slow I2C bus or something). This could happen at any boot as part of software sync. If it's necessary to reprogram the EC on a slow system, we need to display a BIOS screen to the user so he/she doesn't think it's bricked. This CL is just to add a new default bitmap so we'll have something to display when we need it. Nothing actually uses it yet. BUG=chrome-os-partner:12254 TEST=none There should be no user-visible changes. We don't invoke this screen yet. Change-Id: Icb922f933e2e921472dbdff7a26a3ca4d58fbba3 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/29241 Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* Fix make_dev_ssd.sh --remove_rootfs_verificationRandall Spangler2012-08-031-8/+1
| | | | | | | | | | | | | | | | | | It was checking for /dev/dm-0, which isn't the case anymore. It now always attempts to remove rootfs verification from the command line; this is harmless (no-op) if it's already removed. BUG=chromium-os:31558 TEST=manual /usr/share/vboot/bin/make_dev_ssd.sh --remove_rootfs_verification reboot touch /opt/google/chrome/chrome Change-Id: I62dc138e8d1d09bdcb16be3faab74d32c5f7675a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/28506 Reviewed-by: David James <davidjames@chromium.org>
* TONORM screen should display at Dev screen, not Recovery screen.Bill Richardson2012-08-023-64/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add missing mocked TPM functionsKees Cook2012-08-021-1/+18
| | | | | | | | | | | | BUG=chromium-os:33110, chromium-os:33111, chromium-os:33112 TEST=alex build, "MOCK_TPM=1 make" links STATUS=Fixed Change-Id: I9d71e49ec6c98e74954a17849ca82bf948d78ff2 Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/28982 Reviewed-by: Luigi Semenzato <semenzato@chromium.org> Reviewed-by: Taylor Hutt <thutt@chromium.org>
* Flush keyboard at start of screens which take keyboard inputRandall Spangler2012-08-011-1/+51
| | | | | | | | | | | | | | | | | | 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>
* mount-encrypted: allow stateful mount check to pass factory installKees Cook2012-08-011-3/+10
| | | | | | | | | | | | | When factory install happens, mount-encrypted is running on a tmpfs, which can be detected via a W_OK check on the root filesystem. BUG=chrome-os-partner:12033 TEST=alex build, manual test Change-Id: I7bf5eaa244a50dd2a0de51760c964e970fa8e3aa Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/28960 Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
* Revert "Enter key at DEV screen no longer transition to TONORM screen"Randall Spangler2012-08-012-7/+7
| | | | | | | | | | | | This reverts commit 2b45044edf702db665865de5b1b903346ed407a8 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>
* mount-encrypted: fix some minor security TODOsKees Cook2012-08-011-3/+6
| | | | | | | | | | | | | | Force mode of created key file to 0600, and make sure there is enough room in the decryption buffer for any possible change to the decryption algo. BUG=None TEST=alex build, manual testing Change-Id: I89dceec22683ff66b5e1f61a63f14a1db1c4e2ee Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/28892 Reviewed-by: Elly Jones <ellyjones@chromium.org>
* vboot_reference: Improve make_dev_firmware script.Hung-Te Lin2012-08-011-48/+35
| | | | | | | | | | | | | | | | | | | | | | Developers testing firmware preamble flags (usually for turn on/off RO-NORMAL bits) need a easy way to change existing firmware, without hacking FDT source / looking for complex script. Also included some minor improvements: * Always enable FORCE_DEV_BOOT_USB and DISABLE_FW_ROLLBACK_CHECK. These are flags most developers need when leaving official signed normal firmware. * --bmpfv is deprecated because our latest firmware now always include official bitmaps in updater, no more DEV bitmaps. BUG=none TEST=./make_dev_firmware.sh -f bios.bin -t new_bios.bin --preamble_flags 0 ./make_dev_firmware.sh -f bios.bin -t new_bios.bin --preamble_flags 1 Change-Id: I7ee72d32b4b7fa28f2be635fd8c7bb678852e132 Reviewed-on: https://gerrit.chromium.org/gerrit/28792 Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Ready: Hung-Te Lin <hungte@chromium.org>
* Fix 'possible use of unassigned' variable 'retval'.Taylor Hutt2012-08-011-0/+1
| | | | | | | | | | | | | | This change ensures that 'retval' is set for all paths to 'done'. BUG=none TEST=Now compiles without warning. Signed-off-by: Taylor Hutt <thutt@chromium.org> Change-Id: I4ab368b5c60afbed28a5b6d5417e18bedf986e2d Reviewed-on: https://gerrit.chromium.org/gerrit/28827 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Taylor Hutt <thutt@chromium.org> Commit-Ready: Taylor Hutt <thutt@chromium.org>
* Enter key at DEV screen no longer transition to TONORM screenRandall Spangler2012-07-312-7/+7
| | | | | | | | | | | | | | | | | | | | | | 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>
* security: Avoid integer wrap on 32-bit platformsBill Richardson2012-07-311-2/+4
| | | | | | | | | | | | | | | | | | | | | This could wrap before the assignment: uint64_t = uint32_t * int; Instead: uint64_t = uint32_t; uint64_t *= int; BUG=chrome-os-partner:11643 TEST=none Nothing to test or verify. If the security guys approve, it's fixed. Change-Id: Ib7c9774998332ac1a29c4551bc039eaa999ee681 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/28841 Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
* vbutil_kernel: gracefully exit if the config file is badLucian Cojocar2012-07-311-0/+4
| | | | | | | | | | | | | | | | If the config file is specified in the parameter list but we aren't able to open (or read) the file, vbutil_kernel should return an error instead of crashing with a Segmentation Fault. BUG=chromium-os:33087 TEST=manual Invoke vbutil_kernel with a bogus path for the config file (--config). Change-Id: I32dab7c381b9094f4015a554bc59989f1bb329ef Signed-off-by: Lucian Cojocar <cojocar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/28740 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Fix "cgpt show" output for large hard drives.Shawn Nematbakhsh2012-07-301-5/+5
| | | | | | | | | | | | | | | | "cgpt show" output table can be incorrect for large hard drives due to the number of digits in the start/size parameters. Fix by adding extra printf padding. BUG=chromium-os:33082 TEST=emerge, "cgpt show -q /dev/sda" on large HDD platform. Change-Id: I21008322739f5cd4a34372a4436a71259565c6e7 Reviewed-on: https://gerrit.chromium.org/gerrit/28730 Tested-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-by: Tammo Spalink <tammo@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Ready: Shawn Nematbakhsh <shawnn@chromium.org>
* Shut down after EC software sync if lid is closedRandall Spangler2012-07-261-11/+15
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* Add more specific recovery reasons for EC software sync.Randall Spangler2012-07-263-11/+34
| | | | | | | | | | | | 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>
* Add human-readable output option to dump_fmapBill Richardson2012-07-261-28/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The '-h' option will display the FMAP in a heirarchical nested format. BUG=none TEST=manual $ dump_fmap -h stumpy_bios.bin SI_BIOS 00180000 00800000 680000 RO_SECTION 0670000 0800000 190000 BOOT_STUB 700000 800000 100000 GBB 680000 700000 80000 RO_PADDING 670840 680000 f7c0 RO_FRID 670800 670840 40 FMAP 670000 670800 800 RO_UNUSED_2 0590000 0670000 e0000 RO_VPD 0570000 0590000 20000 RO_UNUSED_1 0400000 0570000 170000 RW_SECTION_B 0300000 0400000 100000 RW_FWID_B 3fffc0 400000 40 FW_MAIN_B 310000 3fffc0 effc0 VBLOCK_B 300000 310000 10000 RW_SECTION_A 0200000 0300000 100000 RW_FWID_A 2fffc0 300000 40 FW_MAIN_A 210000 2fffc0 effc0 VBLOCK_A 200000 210000 10000 RW_SHARED 01e8000 0200000 18000 DEV_CFG 1fc000 200000 4000 RW_MRC_CACHE 1ec000 1fc000 10000 RW_ENVIRONMENT 1e8000 1ec000 4000 RW_UNUSED 0181000 01e8000 67000 RW_VPD 0180000 0181000 1000 SI_ALL 00000000 00180000 180000 SI_ME 0001000 0180000 17f000 SI_DESC 0000000 0001000 1000 Change-Id: I41672b62528dac32663bc300ff013e8003d3efa8 Reviewed-on: https://gerrit.chromium.org/gerrit/28513 Commit-Ready: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Handle reboots required to protect/unprotect RW firmwareRandall Spangler2012-07-251-13/+25
| | | | | | | | | | | | 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>
* EC software sync now updates RW firmware if necessary.Randall Spangler2012-07-251-28/+81
| | | | | | | | | | | | | | | | | 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>
* utility: Change autoupdate toolkits to statically linked.Hung-Te Lin2012-07-251-10/+14
| | | | | | | | | | | | | | Utilities shared by auto update programs (ex, firmware updater) must be statically linked. BUG=chrome-os-partner:11630 TEST=emerge-link vboot_reference Change-Id: I74f7ad9f365005624f55cc3fcfc8dc31de0d69c2 Reviewed-on: https://gerrit.chromium.org/gerrit/28365 Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Che-Liang Chiou <clchiou@chromium.org> Commit-Ready: Hung-Te Lin <hungte@chromium.org>
* Call VbExEcGetExpectedRW() with the correct parameters.Bill Richardson2012-07-241-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* mount-encrypted: improve ancient Cr48 install detectionKees Cook2012-07-241-38/+82
| | | | | | | | | | | | | | | | If a Cr48 was upgraded from pre-R12, it will lack an NVRAM lockbox area with no way to create one (TPM password has been thrown away already). Detect this case and allow fallback to the other system key methods. If it is a Cr48 running a modern OOBE, treat it like any other device and require a modern NVRAM lockbox area. BUG=chromium-os:32766 TEST=mario build, verified OOBE doesn't repeat, simulated pre-R12 uses UUID. Change-Id: I2acf7ad8c5d16b1f314ba16c673fa3979a40f3de Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/28231 Reviewed-by: Elly Jones <ellyjones@chromium.org>
* VbExEcGetExpectedRW() should take a const **Randall Spangler2012-07-233-5/+27
| | | | | | | | | | | | | | | | 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>
* tests: relocate state file to actual /varKees Cook2012-07-231-1/+1
| | | | | | | | | | | | | | | Since /var has moved to the encrypted partition, use the real system mount location for /var so it doesn't matter which filesystem it is bind mounted to. BUG=None TEST=link build, tests pass Change-Id: I2831949f3c1cf71765d97720b5ca64b869ec1fa4 Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/28033 Reviewed-by: Luigi Semenzato <semenzato@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* This is failing EC unit test and blocking CQ. Since I can get to Randall and ↵Vic Yang2012-07-201-71/+123
| | | | | | | | | | | | | | Hung-Te, revert now to unblock others. Revert "vboot_reference: Change EC signing to apply new FMAP areas." This reverts commit ef0ab3a616acc0d8d18d45c3145852f38744b856 Change-Id: I9248b76c0896190ac6febac9d8239a709554b1ee Reviewed-on: https://gerrit.chromium.org/gerrit/28107 Tested-by: Vic Yang <victoryang@chromium.org> Commit-Ready: Vic Yang <victoryang@chromium.org> Reviewed-by: Vic Yang <victoryang@chromium.org>
* vboot_reference: Change EC signing to apply new FMAP areas.Hung-Te Lin2012-07-201-123/+71
| | | | | | | | | | | | | | | EC FMAP has changed its section names because B partition has been removed. The signing tool should now use area names "FW_MAIN" and "VBLOCK". BUG=chrome-os-partner:11360 TEST=emerge-link vboot_reference Change-Id: I41ff17257b5e2c8a0f4adb11088e121f94e93923 Reviewed-on: https://gerrit.chromium.org/gerrit/27970 Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org> Commit-Ready: Randall Spangler <rspangler@chromium.org>
* mount-encrypted: handle lack of dm-crypt "allow_discard"Kees Cook2012-07-203-8/+21
| | | | | | | | | | | | | | On kernels prior to 3.1, the "allow_discard" option does not exist. Allow for this by attempting to set up the table twice if the allow_discard attempt fails. BUG=chrome-os-partner:11529 TEST=link build, boots 3.2 ok, falls back when option is invalid. Change-Id: I904d3770543ebdeb0eace9ffa8e6c654cf97976d Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/28024 Reviewed-by: Elly Jones <ellyjones@chromium.org>
* Change VbExEcGetExpectedRW so that vboot picks an ec image instead of U-Boot.Gabe Black2012-07-192-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | This changes the signature of the function above so that it takes an additional parameter that specifies which EC image vboot wants. This is better than making U-Boot decide because U-Boot doesn't really keep track of which version it is (it peeks at internal vboot data) and vboot does. Also, some consts were removed from the image pointer pointer. The pointer itself will be changed in the body of the function to tell vboot where the EC has been loaded, and the contents of the buffer will be changed because U-Boot will have to actually load the EC there. BUG=chrome-os-partner:11148 TEST=Built vboot_reference, vboot_reference-firmware, chromeos-u-boot, and chromeos-bootimage for Daisy and Link and saw them complete successfully with and without the signature for U-Boot's version of this function being updated. That works because the function isn't actually being used yet. Change-Id: I2814c8210eb5b3d965bb8bbf23c0f283f9e44c90 Signed-off-by: Gabe Black <gabeblack@google.com> Reviewed-on: https://gerrit.chromium.org/gerrit/27755 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Ready: Gabe Black <gabeblack@chromium.org> Tested-by: Gabe Black <gabeblack@chromium.org>
* mount-encrypted: support static key factory modeKees Cook2012-07-181-13/+41
| | | | | | | | | | | | | | | | For factory images, we want to be able to retain /var across reboots without interacting with the TPM, and ultimately hold the test suite in a pre-built image so we can avoid needing to wipe the entire filesystem when switching modes. BUG=chrome-os-partner:11392, chrome-os-partner:9419 TEST=link build, manual testing Change-Id: I58aab24455670697e3df494632d5105dde75ee85 Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/27793 Reviewed-by: Gaurav Shah <gauravsh@chromium.org> Reviewed-by: Jon Salz <jsalz@chromium.org>
* devkeys: add key.versions and install kernel keysMike Frysinger2012-07-183-0/+4
| | | | | | | | | | | | | This makes it usable by the signer and its scripts. BUG=None TEST=signer can now sign recovery & factory images using these devkeys Change-Id: I3f3443b93cfab2409ec591d5125bb03dc5e6bc4d Reviewed-on: https://gerrit.chromium.org/gerrit/27781 Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Gaurav Shah <gauravsh@chromium.org> Commit-Ready: Mike Frysinger <vapier@chromium.org>
* [vboot_reference] Prepare for the removal of /root/.forget_usernames from ↵Nirnimesh2012-07-171-8/+0
| | | | | | | | | | | | | | | test images /root/.forget_usernames is going away from test images. It was a hack. BUG=chromium-os:31807 TEST=suite:bvt Change-Id: I27b606fa0232514f3ec45a4ed765b89efcf8f07e Reviewed-on: https://gerrit.chromium.org/gerrit/27588 Reviewed-by: Gaurav Shah <gauravsh@chromium.org> Tested-by: Nirnimesh <nirnimesh@chromium.org> Commit-Ready: Nirnimesh <nirnimesh@chromium.org>
* Keep vbutil_ec from dying if EC firmware B isn't presentRandall Spangler2012-07-171-2/+6
| | | | | | | | | | BUG=chrome-os-partner:11451 TEST=build bds firmware with ifdef CONFIG_FW_B removed from config.h Change-Id: I74ef0258988e065f602e4564e3b49903b34013c5 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/27655 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Partial EC software sync implementationRandall Spangler2012-07-165-1/+118
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* Request EC reboot to RO via return code rather than function (vboot portion)Randall Spangler2012-07-161-4/+2
| | | | | | | | | | | | This gives the AP a chance to save NvStorage data first. BUG=chrome-os-partner:11087 TEST=none yet; API isn't used yet Change-Id: Iae7a24958fb076039795b92d9edb73d7e6ebfc6f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/27525 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* crossystem: Let kernel worry about active_low stuffChe-Liang Chiou2012-07-121-3/+2
| | | | | | | | | | | | | | | | | | | As kernel has adjusted the value of /sys/class/gpio/gpio${PORT}/ with active_low stuff before returning it to user, crossystem should not do another adjustment. Signed-off-by: Che-Liang Chiou <clchiou@chromium.org> BUG=chrome-os-partner:11297 TEST=On Snow, run crossystem and see wpsw_boot equals to wpsw_cur. Then invert /sys/class/gpio/gpio${PORT}/active_low value, and see wpsw_boot does not equal to wpsw_cur. Change-Id: I09fec89788bc4393775d5cf9763b8cebeb645ad4 Reviewed-on: https://gerrit.chromium.org/gerrit/27252 Commit-Ready: Che-Liang Chiou <clchiou@chromium.org> Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* crossystem: Return error when trying to read GPIO port zeroChe-Liang Chiou2012-07-121-1/+10
| | | | | | | | | | | | | | | | | | | | For the record, zero is a valid GPIO port number. Unfortunately firmware uses port zero to denote that a GPIO port is not exist. So crossystem should not attempt to read GPIO port zero, but return error instead. Signed-off-by: Che-Liang Chiou <clchiou@chromium.org> BUG=chrome-os-partner:11296 TEST=On Snow, run crossystem and see devsw_cur and recoverysw_cur are "(error)" Change-Id: I70b15824f613df1e46bf152515ad4e9362c9f066 Reviewed-on: https://gerrit.chromium.org/gerrit/27251 Commit-Ready: Che-Liang Chiou <clchiou@chromium.org> Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
* Ensure that the VGA is enabled/disabled as needed.Bill Richardson2012-07-113-5/+25
| | | | | | | | | | | | | | | | | | | | | | On some systems, we require the VGA option ROM to be loaded before VbInit() is called so we can display BIOS screens. If that hasn't happened, we request it and reboot. Alternatively, if we don't need the option ROM (normal mode) but we've already loaded it, we un-request it and reboot just in case there are security vulnerabilities that might be exposed. Not all systems need preloaded option ROMs. There is an additional input flag that indicates whether this matters or not. BUG=chrome-os-partner:8789 TEST=manual Using keyboard-based dev-mode, switch between normal and dev mode and back. It should work as expected. Change-Id: Id1d662014d47ab648c73db4b1647520801f3a0b8 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/27125 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Fix broken tests left from commit dc6b642bBill Richardson2012-07-101-0/+4
| | | | | | | | | | | | BUG=chrome-os-partner:10947 TEST=manual make && make runtests Change-Id: Idd5e10fc0cfed059f035d127f06ca009f0cff03a Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/27124 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Revert "Read virtual switch current values correctly"Che-Liang Chiou2012-07-091-21/+5
| | | | | | | | | | | | | | | | | | | | This reverts commit 7ec59576f6f61effdc35482c8cfd4aa32b643b1a. We would like to keep dev_cur and recovery_cur output "(error)" so that factory process knows that firmware uses virtual switches. I think this is strange, but this is how factory process works for now. Signed-off-by: Che-Liang Chiou <clchiou@chromium.org> BUG=chromium-os:10007 TEST=none Change-Id: I370a3e9f5a8847916445348abb81f7c4bbf3d27f Reviewed-on: https://gerrit.chromium.org/gerrit/26909 Commit-Ready: Che-Liang Chiou <clchiou@chromium.org> Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* Stub out new vboot APIs for EC software syncRandall Spangler2012-07-072-8/+89
| | | | | | | | | | BUG=chrome-os-partner:11087 TEST=make sure it builds; APIs aren't used yet. Change-Id: If86f3465a889b8fa87cf225d2b9876fe79311327 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/26875 Reviewed-by: Simon Glass <sjg@chromium.org>
* Add EC software sync flag to VbInit()Randall Spangler2012-07-071-0/+2
| | | | | | | | | | | | | Nothing uses this yet; this is just a placeholder so the u-boot code which sets the flag based on the FDT can go in. BUG=chrome-os-partner:11087 TEST=if it builds it works Change-Id: Ie04e3330bcda5c07d34a49391627316bd6232b5a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/26874 Reviewed-by: Simon Glass <sjg@chromium.org>