summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* image_signing: Add sha1sum of keys in keyset to VERSION.signer.stabilize-10323.31.Bstabilize-10323.30.Bstabilize-10323.29.Bfactory-soraka-10323.BMarco Chen2018-01-161-0/+9
| | | | | | | | | | | | | | | | | | | | To record sha1sum of keys in keyset can help loem or unibuild projects to verify 1. whether rekey process is performed correctly during the factory build. 2. whether HWID database is updated correctly. BUG=chromium:763328 TEST=1) modify loem.ini to match what coral is. 2) ~/trunk/src/platform/vboot_reference/scripts/image_signing/sign_official_build.sh recovery ./chromeos_10308.0.0_coral_recovery_dev-channel_mp-v4.bin ./src/platform/vboot_reference/tests/loemkeys ./output.bin 3) verify output file - VERSION.signer. BRANCH=none Change-Id: I80deadb04d9dc0eb66fc5ac45dce84e6f41f1a16 Signed-off-by: Marco Chen <marcochen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/866522 Reviewed-by: Simon Glass <sjg@chromium.org>
* image_signing: Fix the wrong output to VERSION.signer.Marco Chen2018-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | The helper function - info redirects msg to stderr and appends some backslash escapes so 1. it can't be redirected to VERSION.signer via stdout again. 2. Even if change to stderr, we also don't want these appended msg. BUG=chromium:760879 TEST==~/trunk/src/platform/vboot_reference/scripts/image_signing/sign_official_build.sh recovery ../build/images/coral/latest/recovery_image.bin ../platform/vboot_reference/tests/devkeys BRANCH=None Change-Id: I46d560fb4cb93756fd02e32412410afb3a4db0e2 Reviewed-on: https://chromium-review.googlesource.com/861694 Commit-Ready: Marco Chen <marcochen@chromium.org> Tested-by: Marco Chen <marcochen@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Revert "Makefile: Build futility without utillib to extend arch support"Randall Spangler2018-01-111-25/+22
| | | | | | | | | | | | | | | | This reverts commit f59d2e41977032f8f3eac113358b93574fc27b4f. The change breaks 'make runtests'. More specifically, 'make runfutiltests'. Also, fix the duplicate FWLIB20 in LDLIBS when linking futility. BUG=None BRANCH=None TEST=make runtests (more specifically, make runfutiltests) Change-Id: Ia079924a814d98e1a3937b8de6ade7b001ff70ef Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/832848
* Makefile: Add pthread library to the futility static buildPaul Kocialkowski2018-01-111-1/+1
| | | | | | | | | | | | | | This adds the pthread library to the linker flags for the static futility build, which allows it to build with recent GCC versions. BUG=None BRACH=None TEST=Build futility and futility_s with a recent GCC version Change-Id: I16d9b94b76d6e9586278cfdc0b99ae749160138a Signed-off-by: Paul Kocialkowski <contact@paulk.fr> Reviewed-on: https://chromium-review.googlesource.com/805374 Reviewed-by: Martin Roth <martinroth@chromium.org>
* firmware: Stop using vboot1 cparams internallyRandall Spangler2018-01-0918-217/+161
| | | | | | | | | | | | | | | | | | Now that vb2_shared_data / vb2_context provides all the same data to lower-level kernel verification code that cparams did, stop passing cparams down to those functions. No change in functionality. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: I86eb1801ee96d8b56404b74843a8d09e3122567f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/852814 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* firmware: Prune down old region APIRandall Spangler2018-01-0925-635/+188
| | | | | | | | | | | | | | | | | | | | | | | | The region API was a way for firmware and kernel verification to get at various blocks of caller-provided data. In practice, we only used it internally as a way to get at parts of the GBB. Prune it down to access only the bits of GBB we still need, from the buffer we already know we have. In the long run we should use the same vb2ex_read_resource() API that vb2 firmware verification does, but that should be done in a follow-up CL since it'll need to be coordinated with support in depthcharge. No change in functionality. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: I5715cb8d88274164a1a73ed4a56bbd93af46f9bf Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/852798 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* firmware: Include vb1 shared data in vb2 structRandall Spangler2018-01-0918-54/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, firmware verification uses entirely vb2 structs, including vb2_shared_data. This goes through an ugly translation to the old vb1 VbSharedData to pass it to depthcharge. The vboot kernel verification maintains an equally ugly translation back to the vb2 struct internally. Eventually, we want to get rid of all that and use vb2 all the way down to what crossystem picks up from the OS. But before we can do that, we need to finish translating kernel verification code to use the new vb2 structs. This is a step on that path, using vb2_shared_data equivalents where present and hiding the old vb1 shared data struct as a member of vb2_shared_data so at least the vboot functions don't need to pass around cparams to get at it. This will be followed by more CLs which convert more vboot internals to use vb2 structs directly, and eventually coreboot/depthcharge CLs which pass the vb2 structs from firmware verification directly to kernel verification. No change in functionality. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: I5df8ce81ba3c3ac3f2cb4229db5461757cd89d8d Reviewed-on: https://chromium-review.googlesource.com/852856 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* firmware: Remove bmpblk codeRandall Spangler2018-01-0915-656/+61
| | | | | | | | | | | | | | | | | | | | All screens are now drawn by depthcharge. ToT firmware does not include a bmpblk / bmpfv section in the GBB. Remove the code paths which are no longer used. Also drop a few cparams parameters from functions that no longer use it, now that those functions don't need to access the GBB. BUG=chromium:502066 BRANCH=none TEST=make -j runtests; build bob firmware and check recovery screens Change-Id: I4d2d0a3ba57c34151e65c6f42581df823192a4ae Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/852371 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* ec_sync: Use vboot2 context instead of cparamsRandall Spangler2018-01-096-58/+84
| | | | | | | | | | | | | | | | | | | Copy sync-related flags from cparams / vboot1 shared data to the equivalent vboot2 structs. This removes the need for ec_sync to access the old structs, which are on their way out. No change in functionality. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: I50ee76cf275a7fba894c2ec2c3dd83b9a8d91b53 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/852489 Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* image_signing: ensure_no_password.sh: support mounted rootfs dirsMike Frysinger2018-01-081-7/+16
| | | | | | | | | | | | BRANCH=None BUG=chromium:714598 TEST=signing images still works Change-Id: Icc848e49b35aa29c1a1206fa9f351be6ec252b13 Reviewed-on: https://chromium-review.googlesource.com/852675 Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: David Riley <davidriley@chromium.org>
* firmware: Align workbuf used sizeRandall Spangler2018-01-0517-114/+160
| | | | | | | | | | | | | | | | | | | | | | | | Previously, workbuf used was not rounded up to a multiple of VB2_WORKBUF_ALIGN. The next allocation would be aligned, but not until it was made. Change this to round up used size when more workbuf is used. This provides better predictability of where the next allocation will be placed. Uncovered this problem when I added a new member to vb2_shared_data which changed its size so it wasn't a multiple of VB2_WORKBUF_ALIGN, and the vb20 and vb21 unit tests which tried to simulate not enough buffer broke in strange ways. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: I0157a1c96326f7fce6be6efbd74d90c3d2942268 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/852488 Reviewed-by: Shelley Chen <shchen@chromium.org>
* firmware: simplify audioRandall Spangler2018-01-0511-854/+261
| | | | | | | | | | | | | | | | | | | | | | Vboot firmware previously supported a rather complex audio looping library. Our original intent was to allow developers to flash a custom beep sequence / tune as an easter egg. We never fully supported that, but the code to allow it lived on. Get rid of that. Vboot also previously made no assumptions about the frequency of VbExGetTimer(), which was only used by the vboot_audio library. So it spent 10ms every boot measuring the frequency. Which is silly now, because depthcharge implements that as a microsecond timer. Get rid of that measurement and define the timer as a microsecond timer. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: I350246874fb36b00149423696285cfcaca0fc526 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/847311 Reviewed-by: Shelley Chen <shchen@chromium.org>
* firmware: use sd->gbb_flagsRandall Spangler2018-01-0510-60/+81
| | | | | | | | | | | | | | | | | | Vboot1 code directly referenced the GBB from cparams even though now it has access to the GBB flags via the vb2 context. Refactor all existing code to use the vb2 context, since that takes us one step closer to getting rid of the old vboot1 cparams. No change in functionality. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: Ic4a5bf215b723a2eacbf0a4cf0eba8b1338155a2 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/847310 Reviewed-by: Shelley Chen <shchen@chromium.org>
* make_dev_ssd: Fix help message.You-Cheng Syu2018-01-041-1/+1
| | | | | | | | | | | | | | Fix the indent and content of the help message. BRANCH=none BUG=none TEST=./make_dev_ssd.sh -h Change-Id: I12f0de807cf5cb8d6edf7f4a6acdc7c11d0114d9 Reviewed-on: https://chromium-review.googlesource.com/848620 Commit-Ready: Youcheng Syu <youcheng@chromium.org> Tested-by: Youcheng Syu <youcheng@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* image_signing: fix zeroing free spaceAmin Hassani2018-01-031-5/+1
| | | | | | | | | | | | | | | | We are not zeroing the free space properly before signing official images. This patch fixes it by using fstrim instead of dd. More info can be found in CL:751809. BRANCH=none BUG=chromium:780291 TEST=used sign_official_build.sh to sign two recovery images (these images produced <zero-space> file) with dev keys. Then generated delta update between the two new images. This time there was no <zero-space> file between the two images. Change-Id: Ib97fb206f5c8bcfd97c43d075990c7fcdaad6f7e Reviewed-on: https://chromium-review.googlesource.com/848237 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* vboot: introduce get_gbb_flags.shRuben Rodriguez Buchillon2017-12-214-59/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | introduce get_gbb_flags.sh command to make automatic annotation of power measurements easier. Also, fix issue where declaring local variables on same line as executing a command would obfuscate error code, thus not triggering set -c and continuing execution. https://github.com/koalaman/shellcheck/wiki/SC2155 Usage: $ /usr/share/vboot/bin/get_gbb_flags.sh [...] ChromeOS GBB set flags: 0x00000329. $ /usr/share/vboot/bin/get_gbb_flags.sh -e [...] ChromeOS GBB set flags: 0x00000329. ChromeOS GBB set flags listed: GBB_FLAG_DEV_SCREEN_SHORT_DELAY GBB_FLAG_FORCE_DEV_SWITCH_ON GBB_FLAG_DISABLE_FW_ROLLBACK_CHECK GBB_FLAG_FAFT_KEY_OVERIDE GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC BUG=chromium:760267 BRANCH=none TEST=manual emerge-soraka vboot_reference cros deploy <IP> vboot_reference (on DUT) /usr/share/vboot/bin/get_gbb_flags.sh -e <same output as above> Change-Id: Idb3b993706c03e7f2831eed2cef12a04b9469fea
* detachables: Add unit testsShelley Chen2017-12-192-0/+936
| | | | | | | | | | | | | | | | | | Initial unit tests for detachable menu UI. With these tests, the coverage is at 81.2% for lines for code and 87.5% for function coverage. I will improve this to closer to 100%, but wanted to get this in as it's still significantly better than before, which was 0%. There are still a lot of tests in the code that are #if 0'd out currently. I still need to go through an enabled/delete those. BUG=b:65025540 BRANCH=None TEST=run COV=1 make and make sure passes without errors Change-Id: If17bfc24fb7f65deb3d2286cc39cdc311d8a6d93 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/830680 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* detach_ui_test: Move variables needed for unit tests to private fileShelley Chen2017-12-182-69/+85
| | | | | | | | | | | | | | | Creating a unit test for testing the detachable UI menus. It'll need access to some previously static variables that we will move into this new file. BUG=b:65025540 BRANCH=None TEST=emerge-fizz vboot_reference with no errors Change-Id: I249b152380dd55160e151506e00efd23bbbd1a5b Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/830679 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Makefile: Build futility without utillib to extend arch supportPaul Kocialkowski2017-12-181-23/+26
| | | | | | | | | | | | | | | | | | | This removes utillib from the futility build and adds only the required files from utillib to its build. Utillib includes arch-specific components (required for crossystem) that only have a limited number of supported architectures, which is undesirable for futility. The number of archs that futility can run on is no longer restricted. BUG=None BRACH=None TEST=Build futility and futility_s Change-Id: Ia9ad2a72b374b5cc3d6004d36c0b7090dbcc97a2 Signed-off-by: Paul Kocialkowski <contact@paulk.fr> Reviewed-on: https://chromium-review.googlesource.com/666625 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
* Makefile: Add support for aarch64 arch for crossystem buildPaul Kocialkowski2017-12-181-0/+2
| | | | | | | | | | | | | | This handles the aarch64 machine returned by uname as arm to allow crossystem to build. BUG=None BRACH=None TEST=Build futility and futility_s on ARMv8 Change-Id: I1d847568a36f47d084e7572b28e2603b9b6ec673 Signed-off-by: Paul Kocialkowski <contact@paulk.fr> Reviewed-on: https://chromium-review.googlesource.com/785911 Reviewed-by: Julius Werner <jwerner@chromium.org>
* Revert "vboot: Fix INSERT screen error when valid Kernel USB is not inserted"Philip Chen2017-12-121-3/+1
| | | | | | | | | | | | | | | BUG=b:70538502 BRANCH=none TEST=enter VB_MENU_TO_DEV reliably This reverts commit 805726997cc7c3a95b1fd24de5e6909712e4f11c. Change-Id: I08a29084ac9ae53794fd5c44128e06ad6e2faea9 Reviewed-on: https://chromium-review.googlesource.com/822050 Reviewed-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org>
* vboot: Use 2nvstorage instead of vboot_nvstorageRandall Spangler2017-12-1135-1549/+413
| | | | | | | | | | | | | | | | | | Remove the old vboot1 vboot_nvstorage library (VbNv*() functions) and use the vboot2 library (vb2_nv_*()) instead. This is needed in preparation for moving to 64-byte records; no sense in implementing that change twice... Should be (better be) no change in system behavior. BUG=chromium:789276 BRANCH=none TEST=make runtests compare output of crossystem before/after change (should be identical) Change-Id: I10f9975b0824263064b9a74a3c6daadcecc085d3 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/794732
* vboot_ui_menu: honour power button press in RECOVERY_NO_GOOD_SCREENRizwan Qureshi2017-12-111-1/+2
| | | | | | | | | | | | | | | | | Curretly power button press is ignored in RECOVERY_NO_GOOD_SCREEN, Allow user to power off system from RECOVERY_NO_GOOD_SCREEN. BUG=None Branch=None Test=verify that the system powers of from NO_GOOD screen. Change-Id: I768cd5a448c4493a4d9de756b2047c19cdf961ef Signed-off-by: Rizwan Qureshi <rizwan.qureshi@intel.com> Signed-off-by: Rizwan Qureshi <rizwan.qureshi@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/812304 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Shelley Chen <shchen@chromium.org>
* vboot: Fix INSERT screen error when valid Kernel USB is not insertedBarnali Sarkar2017-12-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | In Recovery Mode, when an USB key is inserted where valid OS is not present, it shows "VB_SCREEN_RECOVERY_NO_GOOD" screen. But, once removing that USB key, the screen should go back to INSERT screen again. This functionality was not working after the below Commit - I2bab22fcbb0bb3cdfffe585eb633231ba8015fc3 This patch fixes this issue by assigning the current_menu as "VB_MENU_RECOVERY_INSERT" every time when there is No Disk found. BUG=none BRANCH=none TEST=Tested on Soraka to check that INSERT screen comes back once Non-Valid OS Pendrive is removed from board. Change-Id: I74efff562ba00a3e96b82ee158f9613f53c059b5 Signed-off-by: Barnali Sarkar <barnali.sarkar@intel.com> Reviewed-on: https://chromium-review.googlesource.com/810824 Commit-Ready: Rizwan Qureshi <rizwan.qureshi@intel.corp-partner.google.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org>
* vboot_ui: Let keyboard power button shut down systemDaisuke Nojiri2017-12-082-17/+54
| | | | | | | | | | | | | | | | | | This patch allows a power button on a keyboard to shut down the system when waiting for a user interaction at a firmware screen. The firmware menu, which is implemented by vboot_ui_menu, shouldn't be affected. BUG=b:70244028 BRANCH=none TEST=Verify power button on Fizz can shut down the system at recovery screen, broken screen, todev scree, and user confirmation screen using a USB keyboard and a servo. Verify recovery button can confirm dev mode transition. Run 'make runmisctests' successfully. Change-Id: Icc7d7a774da19acac3d2938d5748ad2323ba4856 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/811444 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* firmware: header tweaks for depthchargeRandall Spangler2017-12-012-1/+2
| | | | | | | | | | | | | | | | | | | Depthcharge currently includes vboot_nvstorage.h directly, instead of including only the API header files directly. Add 2nvstorage.h to the list of headers which can be requested impolitely. Also fix the definition of ARRAY_SIZE to match exactly what depthcharge and coreboot provide, so that the compiler does not get sad when it's included from both libpayload.h and 2common.h. BUG=chromium:789276 BRANCH=none TEST=make runtests; emerge-reef depthcharge coreboot Change-Id: Idc0390eaf813c3079df1676781e8bf5bc9b46450 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/802176 Reviewed-by: Shelley Chen <shchen@chromium.org>
* detachables: create menu items for legacy screensstabilize-10176.65.Bstabilize-10176.58.Bstabilize-10176.54.Bstabilize-10176.47.Bstabilize-10176.13.Brelease-R64-10176.BShelley Chen2017-11-231-2/+18
| | | | | | | | | | | | | | | | | Previously, we didn't require any action on these legacy screens, so didn't update current_screen when displaying these. Now, will be adding language switching and debug display for these screens, so need to keep track of them. BUG=b:65470853, b:67371896, b:64400036 BRANCH=None TEST=None Change-Id: I2bab22fcbb0bb3cdfffe585eb633231ba8015fc3 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/676269 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Fix vboot compilation with coreboot-sdkStefan Reinauer2017-11-201-1/+1
| | | | | | | | | | | | | | | | | | | | BUG=none BRANCH=none TEST=Upstream builder does not fail with uninitialized variable anymore like this: firmware/lib/vboot_ui_menu.c: In function 'vb2_get_current_menu_size': firmware/lib/vboot_ui_menu.c:255:15: error: 'temp_menu' may be used uninitialized in this function [-Werror=maybe-uninitialized] *menu_array = temp_menu; ~~~~~~~~~~~~^~~~~~~~~~~ cc1: all warnings being treated as errors Signed-off-by: Stefan Reinauer <reinauer@chromium.org> Change-Id: Idb1690c7b0becf3556cad379160fe152707ae843 Reviewed-on: https://chromium-review.googlesource.com/777805 Commit-Ready: Stefan Reinauer <reinauer@google.com> Tested-by: Stefan Reinauer <reinauer@google.com> Reviewed-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org>
* vboot: Use kernel max rollforward NV storage fieldRandall Spangler2017-11-172-1/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Kernel verification will now roll forward the minimum allowable version in the TPM no farther than the kernel_max_rollforward setting. Note that CL:765573 changes chromeos-setgoodkernel so it always sets kernel_max_rollforward to 0xfffffffe when marking a kernel as good. That ensures that firmware with this setting will behave the same for now as existing firmware. BUG=chromium:783997 BRANCH=none CQ-DEPEND=CL:765573 TEST=make runtests Manual testing: crossystem tpm_kernvel --> print current kernel version in TPM - Resign the kernel with a higher version - Reboot - Wait a minute for chromeos-setgoodkernel to run crossystem kernel_max_rollforward=0 - Reboot crossystem tpm_kernvel --> has not changed - Wait a minute for chromeos-setgoodkernel to run crossystem kernel_max_rollforward -> 0xfffffffe - Reboot crossystem tpm_kernvel --> has changed to the higher version Change-Id: Ia32ecb7fa4078548cd311541ccbe120570cf1bc5 Reviewed-on: https://chromium-review.googlesource.com/765574 Commit-Ready: Randall Spangler <rspangler@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@google.com>
* nvstorage: Add kernel max rollforward NV storage fieldRandall Spangler2017-11-179-29/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This just adds the kernel_max_rollforward field to the nvstorage libraries and crossystem. The firmware does not use it yet; that's coming in a subsequent CL. 16 of the fields's 32 bits are taken from unused bytes of the kernel field. This has no effect on existing usage. BUG=chromium:783997 BRANCH=none TEST=make runtests Also manual testing. In a root shell: crossystem kernel_max_rollforward --> Should default to 0 crossystem kernel_max_rollforward=0xfffffffe crossystem kernel_max_rollforward --> Should be 0xfffffffe (Note that setting it to 0xffffffff is indistinguishable from the -1 value that the crossystem library uses to indicate error, so 0xffffffff isn't actually usable as a max rollforward limit. But 0xfffffffe is, and if we ever get so close to the limit that we need to use 0xffffffff, something has already gone horribly wrong with our versioning strategy...) Change-Id: I008f412e6ed3c0b59beb9881268585af69d1ff2e Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/765572 Reviewed-by: Julius Werner <jwerner@chromium.org>
* detachables: Use Volup+Voldown to exit recovery graphicfactory-fizz-10139.BShelley Chen2017-11-161-7/+11
| | | | | | | | | | | | | | | | | | Previously, we were able to exit the initial recovery graphic with either the volume up or volume down button. However, we would only like the user to exit the screen when they know what they are doing, we are making it so that they can only intentionally exit (with volup + voldown simultaneously pressed). BUG=b:67371896 BRANCH=None TEST=reboot into recovery and press volume up + volume down keys. Make sure we exit to the recovery menu screen. Change-Id: I7dfb4a0e42c8b88e9b075e886cea1adfe248246c Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/766847 Reviewed-by: Julius Werner <jwerner@chromium.org>
* detachables: Implement disable dev mode for enterpriseShelley Chen2017-11-162-101/+43
| | | | | | | | | | | | | | | | | | | | | When develper mode is disabled (through FWMP), don't allow user to see the dev warning screen. Boot straight to TO_NORM and disable the cancel option. Basically, the user will only be able to enable OS verification, power off, or change the language. There is also no 30 second timeout during bootup. BUG=b:65595945 BRANCH=None TEST=Force disable_dev_boot flag to 1 and ensure the TO_NORM menu is displayed w/o a cancel option. Scroll through options to make sure they work as expected. Make sure debug message is displayed indicating dev mode is disabled. Wait > 30 secs to ensure timeout doesn't occur. Change-Id: I7d2bcd369694e886866f9dedff05d81a40f8270a Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/757115 Reviewed-by: Julius Werner <jwerner@chromium.org>
* EC-EFS: Fix in-place signature replacementDaisuke Nojiri2017-11-141-5/+6
| | | | | | | | | | | | | | | | | | | | | | | When futility replaces the old signature in the input file with a new one, it assumes the signature is at the end of RW region. This assumption is wrong for EC-EFS binaries because they place a signature at each end of two EC_RW areas. This patch fixes the issue by specifying the signature address via 'old_sig', which points to the (first) signature address regardless of the input file format (EFS v.s. non-EFS, FMAP v.s. no FMAP). BUG=b:66956286 BRANCH=none TEST=Run 'futility sign --type rwsig --prikey key_ec_efs.vbprik2 ec.bin'. Then run 'futility show --type rwsig ec.bin', which prints 'Signature verification succeeded.' make runtests Change-Id: I730fd31be640de3e9381f156d084162dd4093ba6 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/767596
* vboot_ui_menu: Use volume down short press at recovery menu screenFurquan Shaikh2017-11-141-1/+1
| | | | | | | | | | | | | | | | | Fix the typo made in https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/757123 for usage of volume down button at recovery menu screen. It should be short press instead of long press. BUG=b:64992445,b:65013794 BRANCH=None TEST=Verified that volume down short press works as expected on recovery menu. Change-Id: Ia9a172439ac3bbd1ea395778e83a95c988816e01 Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/767059 Reviewed-by: Shelley Chen <shchen@chromium.org>
* vboot: use VBNV_ constants with VbNvGet()Randall Spangler2017-11-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | The vboot1 library VbNvGet() / VbNvSet() functions use enum VbNvParam (VBNV_*) constants. The vboot2 library vb2_nv_get() / vb2_nv_set() functions use enum vb2_nv_param constants. Do not mix the two. In the one instance where this happens in the current code, we get lucky, because VBNV_DEV_BOOT_FASTBOOT_FULL_CAP and VB2_NV_DEV_BOOT_FASTBOOT_FULL_CAP evaluate to the same value, so this was harmless. But fix that now so nobody else copy/pastes that pattern for a param where this isn't true. BUG=none BRANCH=none TEST=make runtests Change-Id: I1facbe1d97591dc8b1e6b38717924b884949da57 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/764970 Reviewed-by: Julius Werner <jwerner@chromium.org>
* buttons: Update button codes for vup, vdn and powerFurquan Shaikh2017-11-092-13/+24
| | | | | | | | | | | | | | | | | | | 1. Differentiate button codes for short press and long press of volume up and volume down. 2. Add a new code for volume up-down combo press since it is expected to be used for one of the firmware screens. 3. Treat volume down long press as Ctrl-D on developer screen. 4. Treat volume up long press as Ctrl-U on developer screen. CQ-DEPEND=CL:756254 BUG=b:64992445,b:65013794 BRANCH=None TEST=Verified that buttons work as expected on Soraka. Change-Id: I5d443f43f785b973f3ff4aeaac52b152ed2fe0bd Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/757123 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* Resign ec.bin and store EC-RW in bios.binDaisuke Nojiri2017-11-023-8/+65
| | | | | | | | | | | | | | | | This patch makes sign_official_build.sh resign ec.bin and store signed RW copies in bios.bin if the original ec.bin contains signed RW copies. BUG=b:66956286 BRANCH=none CQ-DEPEND=CL:738794,CL:*490792 TEST=sign_official_build.sh recovery recovery_image.bin \ ~/trunk/src/platform/vboot_reference/tests/devkeys /tmp/out.bin Change-Id: I73c7d8da7d8e2f770e5952d0124f8d43bb13e592 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/734295
* Call VbExEcRunningRW to set IN_RW flagDaisuke Nojiri2017-10-305-12/+47
| | | | | | | | | | | | | | | | | | | | | | | | | CL:693008 changed check_ac_active so that we ask CR50 to verify EC is in RO. While this is the right decision, on some platforms ECs can't reset EC_IN_RW. This causes check_ec_active to set IN_RW wrongly when EC is in RO after reboot. This patch replaces VbExTrustEC with VbExEcRunningRW. If RW is owned it may say it's in RO. Then, the software sync will proceed and flash RW while the EC is running RW copy. It also removes redundant checks for VbExTrustEC() when deciding whether to allow developer mode to be enabled from the INSERT screen. The INSERT screen can only be reached by manual recovery, which resets the EC, we don't need to check again before going to TODEV. BUG=b:67976359 BRANCH=none TEST=make runtests Change-Id: Ide722146ca8683411dd9072a39387aa9531f6cfc Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/740878
* EFS: Add key generator for EC EFSDaisuke Nojiri2017-10-271-0/+16
| | | | | | | | | | | | | | | This patch adds a script which generates a key pair for signing & verifying EC-RW copies. BUG=b:66956286 BRANCH=none TEST=Verify the script generates indented key pair Change-Id: Ia5aff7130587d4f1e18bcdfa514a953caa0cf183 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/731824 Reviewed-by: C Shapiro <shapiroc@google.com> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* detachables: Remove screen blankingShelley Chen2017-10-261-5/+0
| | | | | | | | | | | | | | | This is not necessary anymore and rendering is taken care of in depthcharge. BUG=b:35585623 BRANCH=None TEST=reboot and scroll through menus and make sure that rendering is still good. Change-Id: I078751014c8f84fb2ee403b6895e9dfa58e758d6 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/731114 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* make_dev_ssd: Include full command path in error/help messageNicolas Boichat2017-10-251-3/+4
| | | | | | | | | | | | | | | | | | | | Let's use the actual command/path used to call make_dev_ssd.sh, instead of hard-coding './'. BRANCH=none BUG=none TEST=/usr/share/vboot/bin/make_dev_ssd.sh --remove_rootfs_verification outputs a command that can just be copy-pasted: sudo /usr/share/vboot/bin/make_dev_ssd.sh --remove_rootfs_verification --partitions 4 (instead of: sudo ./make_dev_ssd.sh --remove_rootfs_verification --partitions 4 ) Change-Id: I903f94acc1fb310926b149c1e79e4017bf513e27 Reviewed-on: https://chromium-review.googlesource.com/737810 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* vboot_reference: Decouple from modelC Shapiro2017-10-241-12/+14
| | | | | | | | | | | | | | | | | | | | | The signer has no concept of model and doesn't need to. From its perspective, it is simply generating a signature block based on a set of instructions. Changing the comments and variable name to reflect this. BUG=b:68141451 TEST=None BRANCH=None Change-Id: Ia2a3e4a5273a4bcd9c5645db2cf0db80af6c28cf Reviewed-on: https://chromium-review.googlesource.com/733857 Commit-Ready: C Shapiro <shapiroc@google.com> Tested-by: C Shapiro <shapiroc@google.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Jason Clinton <jclinton@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* detachables: Print error if enable normal mode when FORCE_DEV onShelley Chen2017-10-201-13/+28
| | | | | | | | | | | | | | | | | | Print a debug error and beep when user tries to enable normal mode when FORCE_DEV gbb flag is enabled. BUG=b:67828898 BRANCH=None TEST=Boot up with gbb flag 0x8 enabled. Select "Enabled OS Verification" and select confirm. Should see error message printed and a beep. Confirm switching to normal mode screen will not appear. Change-Id: Ic02558eb4a86555cebc9c1cd6972d0f0600b4ff1 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/730415 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot_ui_menu: Checking vb2_update_menu return valueShelley Chen2017-10-181-0/+2
| | | | | | | | | | | | | | If return value is not VBERROR_SUCCESS, return with an error. BUG=None BRANCH=None TEST=None Change-Id: I1402277567b901701cdd68d74968e43e838c89da Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/707496 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* tlcl, tpmc: extend GetVersion to report vendor specific datastabilize-10032.86.Bstabilize-10032.75.Bstabilize-10032.72.Bstabilize-10032.71.Bstabilize-10032.68.Bstabilize-10032.56.Bstabilize-10032.111.Brelease-R63-10032.Bfirmware-scribe-10045.BAndrey Pronin2017-10-127-14/+170
| | | | | | | | | | | | | | | | 1) Extend TlclGetVersion to return vendor specific data, if requested. 2) Extend 'tpmc getver' to include vendor specific data. BRANCH=none BUG=chromium:771561 TEST=unit tests, running 'tpmc getver' Change-Id: Ic04c242d4e6f33b45a80479be9ab9777b317ebe2 Reviewed-on: https://chromium-review.googlesource.com/706240 Commit-Ready: Andrey Pronin <apronin@chromium.org> Tested-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org>
* futility_s: add vbutil_firmware & vbutil_keyMike Frysinger2017-10-101-0/+4
| | | | | | | | | | | | | | The firmware updater relies on these, so include them. BUG=chromium:772862 TEST=build works and futility_s includes new commands BRANCH=None Change-Id: I973e339d11df4d5b72f70d3a9e28916cca4ebbf6 Reviewed-on: https://chromium-review.googlesource.com/708236 Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* Check EC_IN_RW before proceeding to recovery modeDaisuke Nojiri2017-10-059-140/+59
| | | | | | | | | | | | | | | | | | | | | | Depthcharge currently asks EC whether recovery was requested manually or not without verifying EC is in RO or not. If EC-RW is compromised, recovery switch state can be spoofed. This patch makes Depthcharge check EC_IN_RW to determine whether EC is in RO or not. Only if it's in RO and it says recovery button was pressed at boot, we proceed to the recovery process. All other recovery requests including manual recovery requested by a (compromised) host will end up with 'broken' screen. BUG=b:66516882 BRANCH=none TEST=Boot Fizz. make runtests. Change-Id: I01d2df05fe22e79bbc949f5cb83db605147667b3 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/693008 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* vboot: Handle power button press in broken screenDivya Chellap2017-10-051-2/+7
| | | | | | | | | | | | | | | | | | power button press is not being handled in broken screen (VB_SCREEN_OS_BROKEN) if the user wants to exit out of it. BUG=none BRANCH=none TEST=verified power button key functionality in broken screen in Soraka board Change-Id: I64cbb79479e3e0579aeec4e87894441acf26c9fa Signed-off-by: Divya Chellap <divya.chellappa@intel.com> Reviewed-on: https://chromium-review.googlesource.com/674886 Commit-Ready: Divya Chellappa <divya.chellappa@intel.com> Tested-by: Divya Chellappa <divya.chellappa@intel.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Subrata Banik <subrata.banik@intel.com>
* Add a script to generate a keypair for signing Staff RW firmware.Marco Chen2017-10-034-104/+89
| | | | | | | | | | | | | | | | Staff decided to leverage the key format of Hammer therefore this script calls Hammer's one to generate a key pair and renames them to key_staff*. BUG=b:66889892 TEST=Run this script in the chroot and verify the generated key pair. BRANCH=None Change-Id: I73162efaba47a8c08336805130ced0be25ab262a Reviewed-on: https://chromium-review.googlesource.com/688522 Commit-Ready: Marco Chen <marcochen@chromium.org> Tested-by: Marco Chen <marcochen@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* keygeneration: keyset_version_check.sh: support loem keysetsstabilize-9998.BMike Frysinger2017-09-291-7/+37
| | | | | | | | | | | | BUG=None TEST=ran against local devkeys BRANCH=None Change-Id: Ib1c88ae187f12aad4531e9c22da6cda2af1503e3 Reviewed-on: https://chromium-review.googlesource.com/691340 Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: David Riley <davidriley@chromium.org>