summaryrefslogtreecommitdiff
path: root/firmware
Commit message (Collapse)AuthorAgeFilesLines
* Reland "2api: Add vb2_boot_mode in vb2_context denoted the current boot mode"stabilize-14396.Bstabilize-14395.BHsuan Ting Chen2021-12-127-42/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit f0ba3fe277fdc623565eab0725aed743e24a1a44. Reason for revert: We can try another reland after the coreboot CL https://review.coreboot.org/c/coreboot/+/58253 is downstreamed and the guybrush psp_verstage.bin is signed again. Original change's description: > Revert "2api: Add vb2_boot_mode in vb2_context denoted the current boot mode" > > This reverts commit 2cf76574dbf57c70da3a835f2a45d5619dc058f5. > > Reason for revert: b:202258389 > > Original change's description: > > 2api: Add vb2_boot_mode in vb2_context denoted the current boot mode > > > > Add enum vb2_boot_mode which denotes the most relevant boot mode between > > normal, manual recovery, broken recovery, diagnostic, and developer. > > > > The boot mode constant stores in vb2_context, is exposed externally, and > > decided in vb2api_fw_phase1. > > > > Split out the logic of manual recovery and broken screen. (The broken > > recovery is a recovery boot with !vb2api_allow_recovery) > > > > Add the fifth boot mode, diagnostic boot mode > > > > A boot could match more the one boot mode, this api will pick the most > > relevant boot mode based on the following order: > > 1. Manual recovery boot > > 2. Broken recovery boot > > 3. Diagnostics boot > > 4. Developer boot > > 5. Normal boot > > > > This constant is used in: > > * lib/vboot_api_kernel.c: VbSelectAndLoadKernel() > > * lib/vboot_kernel.c: replace the original vb2_boot_mode > > * coreboot/bootmode for adding elogs > > > > Also bump the vb2sd minor version from 0 to 1. > > > > BUG=b:185551931, b:177196147, b:181931817 > > BRANCH=none > > TEST=CC=x86_64-pc-linux-gnu-clang; > > make clean && make runtests > > TEST=emerge coreboot vboot_reference depthcharge > > > > Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> > > Change-Id: I421e4d51c261ba2bdec996a5fb2ebccb33513fa4 > > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2944250 > > Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> > > Bug: b:185551931, b:177196147, b:181931817 > Change-Id: Ic184a24f5b580bcaf40d75045476ae77c674dd3d > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3209725 > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Commit-Queue: Bhanu Prakash Maiya <bhanumaiya@google.com> Bug: b:185551931, b:177196147, b:181931817 Change-Id: Ie480bf76eb0164f6e498b72e0533cd5c5762d6f6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3274699 Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org> Tested-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Hsuan Ting Chen <roccochen@chromium.org>
* Reland "2lib/2api: Deprecate vb2ex_ec_trusted()"Hsuan Ting Chen2021-12-103-18/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit b9644352d7717d4f564be90aac6c41bef583d930. Reason for revert: We can try another reland after the coreboot CL https://review.coreboot.org/c/coreboot/+/58253 is downstreamed and the guybrush psp_verstage.bin is signed again. Original change's description: > Revert "2lib/2api: Deprecate vb2ex_ec_trusted()" > > This reverts commit 7c73bb07fd3ca45ce650b993a9c6a5850ddb2707. > > Reason for revert: b:202258389 > > Original change's description: > > 2lib/2api: Deprecate vb2ex_ec_trusted() > > > > coreboot will support check the EC_IN_RW during verstage_main(), which > > performs the equivalent tasks as vb2ex_ec_trusted(). > > > > In the previous CL, we remove the check of vb2ex_ec_trusted(), so the > > whole implementation of this function among vboot_reference and > > depthcharge could be deprecated and removed. > > > > BUG=b:181931817 > > BRANCH=none > > TEST=CC=x86_64-pc-linux-gnu-clang; > > make clean && make runtests > > TEST=emerge coreboot vboot_reference depthcharge > > > > Cq-Depend: chromium:3139956 > > Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> > > Change-Id: I4f592d7dec2480475762e1336791cbb34fa143ba > > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3139539 > > Reviewed-by: Julius Werner <jwerner@chromium.org> > > Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> > > Bug: b:181931817 > Change-Id: Ia127ce89b7f9413db9fd6ca4561ad06efb36d7e1 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3211006 > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Commit-Queue: Bhanu Prakash Maiya <bhanumaiya@google.com> Bug: b:181931817 Cq-Depend: chromium:3275254 Change-Id: I2c4db28b5800e5756f6f12b8bf69924f373a5c58 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3274698 Tested-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Hsuan Ting Chen <roccochen@chromium.org>
* Reland "2lib: Use ctx flag VB2_CONTEXT_EC_TRUSTED instead of vb2ex_ec_trusted"Hsuan Ting Chen2021-12-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 1269365169791c65a6bf6f364583209195874138. Reason for revert: We can try another reland after the coreboot CL https://review.coreboot.org/c/coreboot/+/58253 is downstreamed and the guybrush psp_verstage.bin is signed again. Original change's description: > Revert "2lib: Use ctx flag VB2_CONTEXT_EC_TRUSTED instead of vb2ex_ec_trusted" > > This reverts commit 8aded7005e2830f54cf53b329946cbb1f11548f2. > > Reason for revert: b:202258389 > > Original change's description: > > 2lib: Use ctx flag VB2_CONTEXT_EC_TRUSTED instead of vb2ex_ec_trusted > > > > In vb2api_allow_recovery(), we need to check if EC is trusted for > > booting into manual recovery mode. This was implemented by a function > > vb2ex_ec_trusted() which defined in vboot_reference and implemented in > > depthcharge by reading the corresponding EC_IN_RW GPIO flags. > > > > By introducing new boot mode architecture, coreboot will now calling > > these functions to determine the current boot mode and support the > > similar functionalities about checking if EC is trusted (i.e. EC is not > > in RW). > > > > We leverages the existing ctx flag VB2_CONTEXT_EC_TRUSTED for fulfilling > > this. This flag will be set at coreboot vboot_logic.c:verstage_main() > > and can be used deciding the boot mode in vboot_reference: > > vb2api_fw_phase1() and is cleared while EC jumps to RW (i.e. > > 2ec_sync.c:sync_ec()). > > > > BRANCH=none > > BUG=b:181931817 > > TEST=emerge-trogdor coreboot vboot_reference depthcharge > > > > Cq-Depend: chromium:3088889 > > Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> > > Change-Id: I50f35f48ce75e421094ea21e45c24b82e6e55a6c > > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3106329 > > Reviewed-by: Julius Werner <jwerner@chromium.org> > > Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> > > Bug: b:181931817 > Change-Id: I11ae3b2d71c040dfe45b34f74974845dafa92b42 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3211007 > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Commit-Queue: Bhanu Prakash Maiya <bhanumaiya@google.com> Bug: b:181931817 Cq-Depend: chromium:3284392 Change-Id: Ie7d87b6608631b03f31651eacf9b40f8f891da1a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3274604 Tested-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Hsuan Ting Chen <roccochen@chromium.org>
* vboot: Remove vb2_screen and vb2_ui_error enumsedisonhello2021-12-081-77/+0
| | | | | | | | | | | | | | | Since all the functions that use these two enums are already removed, these enums can be deleted as well. BUG=b:172339016 TEST=DEBUG=1 make -j test_setup && make -j runtests BRANCH=none Cq-Depend: chromium:3142709 Signed-off-by: edisonhello <edisonhello@google.com> Change-Id: I1de42569e0f030b612ec3c6d00575a7efdcfdab9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3144447 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot: Remove vb2ex_display_ui, vb2ex_prepare_log_screenedisonhello2021-12-082-55/+0
| | | | | | | | | | | | | | | After UI code is centralized, these functions are not used in vboot anymore. Remove these two functions. BUG=b:172339016 TEST=DEBUG=1 make -j test_setup && make -j runtests BRANCH=none Cq-Depend: chromium:3142705 Signed-off-by: edisonhello <edisonhello@google.com> Change-Id: If773de4bbe835cb75f76c501429f305ef8d4fec4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3144446 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* firmware: VB2_REC_OR_DIE() should not abort before vb2_check_recovery()Julius Werner2021-12-033-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately, CL:3168437 introduced a new problem when booting with a broken TPM: secdata accessors no longer return failure but instead just abort when booting in normal mode and continue when we're in recovery mode. The problem is that when accessing secdata very early in vb2api_fw_phase1(), we have not decided whether we're booting in recovery mode yet. If vb2_secdata_firmware_init() fails, we will call vb2api_fail() and then continue knowing that vb2_check_recovery() will later see the recovery reason in NVRAM and decide to boot directly into recovery from here. But if the code in-between accesses secdata, the VB2_CONTEXT_RECOVERY_MODE flag is technically not yet set, so our secdata accessor thinks we are booting in normal mode and something terrible happened (because it shouldn't be possible to boot in normal mode when secdata_init failed), so it aborts. In order to try to solve this problem in a more general way, introduce a new VB2_SD_STATUS_RECOVERY_DECIDED status flag that gets set once we reach the point where we have conclusively decided whether we are booting into recovery mode and set the appropriate context flags. Any code using VB2_REC_OR_DIE() before that point will play it safe and assume that we may still go into recovery mode, so we shouldn't abort. BRANCH=none BUG=none TEST=none Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Ic3daa8dac932286257cbceebfff8712d25c3a97a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3301540 Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* firmware/2lib: Remove BOOT_EXTERNAL_ON_DEVJakub Czapiga2021-11-251-3/+0
| | | | | | | | | | | | | | | | | | BOOT_EXTERNAL_ON_DEV was not used anymore, so it was removed from the Makefile and source code. BUG=b:206031372 BRANCH=none TEST=make runtests TEST=emerge-guybrush depthcharge Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: I463a77f2de8f59954704495708025321ca1571d8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3289345 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Tested-by: Jakub Czapiga <czapiga@google.com> Commit-Queue: Jakub Czapiga <czapiga@google.com>
* vboot: Remove VbExIsShutdownRequestededisonhello2021-11-073-34/+1
| | | | | | | | | | | | | | | | | | Remove function VbExIsShutdownRequested, since this function is not used in vboot anymore after UI code is centralized. Remove VB_SHUTDOWN_* macros since they are not used in vboot now. These macros will be added in depthcharge in the dependent CL. BUG=b:172339016 TEST=DEBUG=1 make -j test_setup && make -j runtests BRANCH=none Cq-Depend: chromium:3142698 Signed-off-by: edisonhello <edisonhello@google.com> Change-Id: I024b34212a5c9e42b880d51d21c7a90a6170b3c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3143814 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* ui: Add VB2_UI_ERROR_MINIOS_BOOT_FAILEDstabilize-14324.72.Bstabilize-14324.62.Bstabilize-14324.41.Bstabilize-14324.13.Bstabilize-14321.Brelease-R97-14324.BYu-Ping Wu2021-10-291-0/+2
| | | | | | | | | | | | | | | Add a new error type VB2_UI_ERROR_MINIOS_BOOT_FAILED for MiniOS boot failure. BUG=b:200750322 TEST=emerge-cherry depthcharge BRANCH=none Change-Id: Ia567c9ec735e7aae830ad311b2261e01fed53876 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3249590 Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
* vboot: Support booting from non-active miniOS partitionYu-Ping Wu2021-10-154-9/+24
| | | | | | | | | | | | | | | | | | To support booting from the non-active miniOS partition in recovery UI, add minios_flags argument to VbTryLoadMiniOsKernel. Currently there is only one flag: VB_MINIOS_FLAG_NON_ACTIVE. When it is set, we will attempt to boot from the non-active partition only. BUG=b:200750322 TEST=make runtests BRANCH=none Cq-Depend: chromium:3219727 Change-Id: I6221f10c09de2487e89e6113981bc9e9755d67f4 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3219901 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
* Revert "2lib: Use ctx flag VB2_CONTEXT_EC_TRUSTED instead of vb2ex_ec_trusted"stabilize-14285.Bfirmware-chameleon-14280.BHsuan Ting Chen2021-10-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 8aded7005e2830f54cf53b329946cbb1f11548f2. Reason for revert: b:202258389 Original change's description: > 2lib: Use ctx flag VB2_CONTEXT_EC_TRUSTED instead of vb2ex_ec_trusted > > In vb2api_allow_recovery(), we need to check if EC is trusted for > booting into manual recovery mode. This was implemented by a function > vb2ex_ec_trusted() which defined in vboot_reference and implemented in > depthcharge by reading the corresponding EC_IN_RW GPIO flags. > > By introducing new boot mode architecture, coreboot will now calling > these functions to determine the current boot mode and support the > similar functionalities about checking if EC is trusted (i.e. EC is not > in RW). > > We leverages the existing ctx flag VB2_CONTEXT_EC_TRUSTED for fulfilling > this. This flag will be set at coreboot vboot_logic.c:verstage_main() > and can be used deciding the boot mode in vboot_reference: > vb2api_fw_phase1() and is cleared while EC jumps to RW (i.e. > 2ec_sync.c:sync_ec()). > > BRANCH=none > BUG=b:181931817 > TEST=emerge-trogdor coreboot vboot_reference depthcharge > > Cq-Depend: chromium:3088889 > Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> > Change-Id: I50f35f48ce75e421094ea21e45c24b82e6e55a6c > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3106329 > Reviewed-by: Julius Werner <jwerner@chromium.org> > Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Bug: b:181931817 Change-Id: I11ae3b2d71c040dfe45b34f74974845dafa92b42 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3211007 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Bhanu Prakash Maiya <bhanumaiya@google.com>
* Revert "2lib/2api: Deprecate vb2ex_ec_trusted()"Hsuan Ting Chen2021-10-073-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 7c73bb07fd3ca45ce650b993a9c6a5850ddb2707. Reason for revert: b:202258389 Original change's description: > 2lib/2api: Deprecate vb2ex_ec_trusted() > > coreboot will support check the EC_IN_RW during verstage_main(), which > performs the equivalent tasks as vb2ex_ec_trusted(). > > In the previous CL, we remove the check of vb2ex_ec_trusted(), so the > whole implementation of this function among vboot_reference and > depthcharge could be deprecated and removed. > > BUG=b:181931817 > BRANCH=none > TEST=CC=x86_64-pc-linux-gnu-clang; > make clean && make runtests > TEST=emerge coreboot vboot_reference depthcharge > > Cq-Depend: chromium:3139956 > Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> > Change-Id: I4f592d7dec2480475762e1336791cbb34fa143ba > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3139539 > Reviewed-by: Julius Werner <jwerner@chromium.org> > Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Bug: b:181931817 Change-Id: Ia127ce89b7f9413db9fd6ca4561ad06efb36d7e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3211006 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Bhanu Prakash Maiya <bhanumaiya@google.com>
* Revert "2api: Add vb2_boot_mode in vb2_context denoted the current boot mode"Hsuan Ting Chen2021-10-077-121/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 2cf76574dbf57c70da3a835f2a45d5619dc058f5. Reason for revert: b:202258389 Original change's description: > 2api: Add vb2_boot_mode in vb2_context denoted the current boot mode > > Add enum vb2_boot_mode which denotes the most relevant boot mode between > normal, manual recovery, broken recovery, diagnostic, and developer. > > The boot mode constant stores in vb2_context, is exposed externally, and > decided in vb2api_fw_phase1. > > Split out the logic of manual recovery and broken screen. (The broken > recovery is a recovery boot with !vb2api_allow_recovery) > > Add the fifth boot mode, diagnostic boot mode > > A boot could match more the one boot mode, this api will pick the most > relevant boot mode based on the following order: > 1. Manual recovery boot > 2. Broken recovery boot > 3. Diagnostics boot > 4. Developer boot > 5. Normal boot > > This constant is used in: > * lib/vboot_api_kernel.c: VbSelectAndLoadKernel() > * lib/vboot_kernel.c: replace the original vb2_boot_mode > * coreboot/bootmode for adding elogs > > Also bump the vb2sd minor version from 0 to 1. > > BUG=b:185551931, b:177196147, b:181931817 > BRANCH=none > TEST=CC=x86_64-pc-linux-gnu-clang; > make clean && make runtests > TEST=emerge coreboot vboot_reference depthcharge > > Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> > Change-Id: I421e4d51c261ba2bdec996a5fb2ebccb33513fa4 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2944250 > Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Bug: b:185551931, b:177196147, b:181931817 Change-Id: Ic184a24f5b580bcaf40d75045476ae77c674dd3d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3209725 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Bhanu Prakash Maiya <bhanumaiya@google.com>
* stub: Print error messages by vb2ex_printf()stabilize-ambassador-14268.43.Bstabilize-14268.67.Bstabilize-14268.52.Bstabilize-14268.51.Brelease-R96-14268.BYu-Ping Wu2021-10-072-41/+34
| | | | | | | | | | | | | | | | | | | | CL:3167016 in depthcharge mocks vb2ex_printf() to avoid segmentation fault when running depthcharge unit tests, but the same problem still exists for all vboot stub functions that use fprintf() to print error messages. Instead of mocking all the vb2ex_* functions in depthcharge, we use a simpler approach: always printing error messages using vb2ex_printf() (or other equivalences) for vboot stubs. BUG=b:200234887 TEST=make clean && make runtests TEST=(depthcharge) make unit-tests BRANCH=none Change-Id: Idf758070a61b28284864a698475ca582719f4789 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3199053 Reviewed-by: Jakub Czapiga <czapiga@google.com> Reviewed-by: Julius Werner <jwerner@chromium.org>
* 2api: Add vb2_boot_mode in vb2_context denoted the current boot modestabilize-14267.Bfactory-ambassador-14265.BHsuan Ting Chen2021-10-017-42/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add enum vb2_boot_mode which denotes the most relevant boot mode between normal, manual recovery, broken recovery, diagnostic, and developer. The boot mode constant stores in vb2_context, is exposed externally, and decided in vb2api_fw_phase1. Split out the logic of manual recovery and broken screen. (The broken recovery is a recovery boot with !vb2api_allow_recovery) Add the fifth boot mode, diagnostic boot mode A boot could match more the one boot mode, this api will pick the most relevant boot mode based on the following order: 1. Manual recovery boot 2. Broken recovery boot 3. Diagnostics boot 4. Developer boot 5. Normal boot This constant is used in: * lib/vboot_api_kernel.c: VbSelectAndLoadKernel() * lib/vboot_kernel.c: replace the original vb2_boot_mode * coreboot/bootmode for adding elogs Also bump the vb2sd minor version from 0 to 1. BUG=b:185551931, b:177196147, b:181931817 BRANCH=none TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=emerge coreboot vboot_reference depthcharge Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I421e4d51c261ba2bdec996a5fb2ebccb33513fa4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2944250 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* 2lib/2api: Deprecate vb2ex_ec_trusted()Hsuan Ting Chen2021-09-283-18/+4
| | | | | | | | | | | | | | | | | | | | | | coreboot will support check the EC_IN_RW during verstage_main(), which performs the equivalent tasks as vb2ex_ec_trusted(). In the previous CL, we remove the check of vb2ex_ec_trusted(), so the whole implementation of this function among vboot_reference and depthcharge could be deprecated and removed. BUG=b:181931817 BRANCH=none TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=emerge coreboot vboot_reference depthcharge Cq-Depend: chromium:3139956 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I4f592d7dec2480475762e1336791cbb34fa143ba Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3139539 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot: boot from miniOS recovery kernels on diskstabilize-14249.BJoel Kitching2021-09-245-10/+234
| | | | | | | | | | | | | | | | | | | Add VbTryLoadMiniOsKernel() to vboot API, which boots from a miniOS recovery kernel located on internal disk. In this boot path, an attempt is made to verify and boot this kernel. Recovery proceeds from within the miniOS kernel by downloading a recovery image over the network. No USB disk is used in the process. For more information, see go/nbr-firmware. BUG=b:188121855, b:186682292 TEST=make clean && make runtests BRANCH=none Change-Id: Ic4d1fe5642a2bf71c51c78fd7830ad2b6e9eebeb Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2856364 Reviewed-by: Julius Werner <jwerner@chromium.org>
* 2lib: Use ctx flag VB2_CONTEXT_EC_TRUSTED instead of vb2ex_ec_trustedHsuan Ting Chen2021-09-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | In vb2api_allow_recovery(), we need to check if EC is trusted for booting into manual recovery mode. This was implemented by a function vb2ex_ec_trusted() which defined in vboot_reference and implemented in depthcharge by reading the corresponding EC_IN_RW GPIO flags. By introducing new boot mode architecture, coreboot will now calling these functions to determine the current boot mode and support the similar functionalities about checking if EC is trusted (i.e. EC is not in RW). We leverages the existing ctx flag VB2_CONTEXT_EC_TRUSTED for fulfilling this. This flag will be set at coreboot vboot_logic.c:verstage_main() and can be used deciding the boot mode in vboot_reference: vb2api_fw_phase1() and is cleared while EC jumps to RW (i.e. 2ec_sync.c:sync_ec()). BRANCH=none BUG=b:181931817 TEST=emerge-trogdor coreboot vboot_reference depthcharge Cq-Depend: chromium:3088889 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I50f35f48ce75e421094ea21e45c24b82e6e55a6c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3106329 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* 2api: Adjust the order of checking dev switch in vb2api_fw_phase1stabilize-14238.BHsuan Ting Chen2021-09-231-14/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL is a revert to CL:300621. In that CL, we adjusted the order of checking dev switch (vb2_check_dev_switch) and move it after the check for recovery step (vb2_check_recovery). The reason of that adjustment was because vb2_check_dev_switch might return very early if the TPM is broken and it failed to retrieve the secdata. However, retrieving the secdata becomes a function which cannot fail nowadays and it is not necessary to handle that scenario of the early return in vb2_check_dev_switch. So we adjust them back to the original order. We also remove the related outdated unit tests in vb2_api_tests.c BUG=none BRANCH=none TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: Iada8092e73ed9282242b1d67d101c836860e13c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3168437 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: Remove VbExKeyboard* functions from vboot APIedisonhello2021-09-172-88/+0
| | | | | | | | | | | | | | | | | Since the UI code has been moved to depthcharge, VbExKeyboardRead and VbExKeyboardReadWithFlags are not used in any function in vboot now. Remove these two functions in vboot. BUG=b:172339016 TEST=DEBUG=1 make -j test_setup && make -j runtests BRANCH=none Cq-Depend: chromium:3142696 Signed-off-by: edisonhello <edisonhello@google.com> Change-Id: I6ce983bf400141681dfd33a0e3c30fe74a992c77 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3143812 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot: Remove vb2ex_diag_storage_test_controledisonhello2021-09-172-17/+0
| | | | | | | | | | | | | | | | | | Remove function vb2ex_diag_storage_test_control, after UI code centralize, since this function is not used anymore in vboot. Remove enum vb2_diag_storage_test, which is for the parameter of vb2ex_diag_storage_test_control. BUG=b:172339016 TEST=DEBUG=1 make -j test_setup && make -j run_test_scripts BRANCH=none Cq-Depend: chromium:3142697 Signed-off-by: edisonhello <edisonhello@google.com> Change-Id: Ie9cdeecd78973074cf363bf41bd37244a3b6d1af Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3143813 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: Remove 2ui, 2ui_screens, and vb2_ui*_testsstabilize-rust-14225.Bstabilize-rust-14224.Bstabilize-rust-14220.Bedisonhello2021-09-144-1211/+0
| | | | | | | | | | | | | | | | Since all the screens and tests are already moved to depthcharge in previous CLs, remove all internal UI functions and tests from vboot. BUG=b:172339016 TEST=DEBUG=1 make -j test_setup && make -j runtests BRANCH=none Signed-off-by: edisonhello <edisonhello@google.com> Change-Id: Ifbd005a5761e5c354e010fc70487a63cd17cf4b3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3139540 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: Remove diagnostics menu and related testsedisonhello2021-09-146-374/+18
| | | | | | | | | | | | | | | | | | | | | | This CL is a part of centralizing ui codes. The removed screens and unit tests will be added in depthcharge. Remove diagnostics menu, diagnostics storage and memory checking screens. Remove unit tests for above screens and menu. BUG=b:172339016 TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=0; \ make -j test_setup && make -j runtests TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=1; \ make -j test_setup && make -j runtests BRANCH=none Cq-Depend: chromium:3138687 Signed-off-by: edisonhello <edisonhello@google.com> Change-Id: I5eb1bee6a5f1aedb77298acbddab20156c1c086e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3139537 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: Remove developer menu and related testsedisonhello2021-09-146-421/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | This CL is a part of centralizing ui codes. The removed screens and unit tests will be added in depthcharge. Remove developer menu and its action function. Remove developer mode, developer to norm, developer boot external, developer invalid disk, developer select altfw screens. Remove unit tests for above screens and menu. BUG=b:172339016 TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=0; \ make -j test_setup && make -j runtests TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=1; \ make -j test_setup && make -j runtests BRANCH=none Cq-Depend: chromium:3132550 Signed-off-by: edisonhello <edisonhello@google.com> Change-Id: I45332f8e059eba612231362cc56a70da1336c7c2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3132504 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/ui: Remove manual recovery and related screenedisonhello2021-09-146-205/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL is a part of centralizing ui codes. The removed screens and unit tests will be added in depthcharge. Remove manual recovery menu and its action function. Remove recovery select, recovery phone step *, recovery disk step *, recovery invalid screens. Add vb2ex_manual_recovery_ui declaration. Remove unit tests of above screens, menu and actions. BUG=b:172339016 TEST=Hayato booted into developer mode TEST=Hayato showed manual recovery screen TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=0; \ make -j test_setup && make -j runtests TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=1; \ make -j test_setup && make -j runtests BRANCH=none Cq-Depend: chromium:3099529 Signed-off-by: edisonhello <edisonhello@google.com> Change-Id: I330098200d45d094d4faab90b96355b5b19e3fea Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3116108 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: Remove broken recovery screenedisonhello2021-09-147-47/+18
| | | | | | | | | | | | | | | | | | | | | Remove broken recovery screen in vboot, and migrate to depthcharge. Remove broken recovery related tests in vboot. BUG=b:172339016 TEST=Hayato booted into developer mode TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=0; \ make -j test_setup && make -j runtests TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=1; \ make -j test_setup && make -j runtests BRANCH=none Cq-Depend: chromium:3116129 Change-Id: I7d830e992d9ae1703befba570dfbe3061319b9fe Signed-off-by: edisonhello <edisonhello@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3060559 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: Rename UI functionsedisonhello2021-09-144-32/+35
| | | | | | | | | | | | | | | | | | | | | Prepare for copying UI functions to depthcharge. Rename UI functions which will be copied to depthcharge in vboot in order to avoid linking time error after copying the functions. BUG=b:172339016 TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=0; \ make -j test_setup && make -j runtests TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=1; \ make -j test_setup && make -j runtests TEST=Hayato booted into developer mode BRANCH=none Change-Id: I840de3121dc2ccd8f6d05ec8a1538c3761f806da Signed-off-by: edisonhello <edisonhello@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3060558 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* 2lib/2ec_sync: Clear VB2_CONTEXT_EC_TRUSTED before jumping to RWHsuan Ting Chen2021-09-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | Currently the EC is trusted if any of the conditions are met: * The ctx flag VB2_CONTEXT_EC_TRUSTED is set. * vb2ex_ec_trusted() returns trusted. With introducing the boot mode area in ctx, the vb2ex_ec_trusted will be deprecated and the VB2_CONTEXT_EC_TRUSTED will become the only condition to decide if EC is trusted. This CL clears the flag while EC jumps to RW, which is the prerequisite before landing the coreboot changes. Also update the tests of ec_sync() BRANCH=none BUG=b:181931817 TEST=emerge-trogdor coreboot vboot_reference depthcharge Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I4711093353f5a92157c4c00c859c01f08fc3607f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3139538 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* run2tests: fix more compilation problemsVadim Bendebury2021-09-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | The compiler is too zealous when deciding which addresses are allowed to be accessed. While it is correct in principal, in some controlled cases the code indeed needs to calculate addresses which are beyond the structures boundaries. This patch modifies the code to placate the compiler. BRANCH=none BUG=none TEST='make run2tests' inside chroot does not fail to compile and passes. Change-Id: Iba99714da569a5f28ae95939e93ee1d09da20caa Signed-off-by: Vadim Bendebury <vbendeb@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3133544 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
* vboot/ui: Show error box on internal boot failureYu-Ping Wu2021-08-312-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | CL:2917623 changes the behavior when failing to boot from internal disk in developer UI. However, it causes the device to potentially enter a reboot loop (b/197216832). Instead of either triggering recovery or returning an error from the UI loop, change the behavior to showing an error message in a dialog box and staying in the UI. This is similar to the behavior when booting from an invalid external disk, where an error screen will be shown to the user. Add VB2_UI_ERROR_INTERNAL_BOOT_FAILED to vb2_ui_error enum. BUG=b:197216832, b:197911901 TEST=make runtests BRANCH=none Cq-Depend: chromium:3123160 Change-Id: Ic5ace55fc8b93ba0836e5722b7c5011fd490c35e Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3124395 Reviewed-by: Julius Werner <jwerner@chromium.org>
* Allow use of fallthrough directlystabilize-14189.BSimon Glass2021-08-271-3/+3
| | | | | | | | | | | | | | | | | | | There is a standard way of handling fallthrough, at least in linux and U-Boot, of defining 'fallthrough' as the required attribute. At present, vboot always defines this itself, which is incompatible with this convention. Use double underscores around the definition of VBOOT_FALLTHROUGH to maintain compatibility. BUG=b:191646387 BRANCH=none TEST=FEATURES=test sudo -E emerge vboot_reference Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Id62f126f77311360fb7859ee956f1476378d87c0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3032350 Reviewed-by: Julius Werner <jwerner@chromium.org>
* 2nvstorage: Clear FIRMWARE_SETTINGS_RESET flag on a clean bootJulius Werner2021-08-131-0/+5
| | | | | | | | | | | | | | | | | | | The FIRMWARE_SETTINGS_RESET flag was intended to show when nvdata was forcibly reset due to CRC failures. However, in practice it is useless because it never gets cleared again and just stays set forever. This patch fixes that by clearing it on every normal boot (i.e. a boot where the existing nvdata was valid and didn't need to be reset). BRANCH=None BUG=None TEST=Booted CoachZ, confirmed flag got cleared. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I8c88ea134bf92ccb5f1d9a710d86c5ec5198def8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3063692 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Tested-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* firmware: 2sysincludes: Remove byteswap.h and memory.hJulius Werner2021-08-131-5/+0
| | | | | | | | | | | | | | | | | | | | These have always been in here but I don't think anyone remembers what they are for. The firmware library doesn't require endian accesses (other than the TPM2 marshalling code which provides its own... and I guess the GPT code isn't actually safe for big-endian systems, which is probably bad, but a topic for another patch). As far as I can tell, none of our environments actually define the macros that these two are guarded by. Let's get rid of them and see what breaks. BRANCH=none BUG=none TEST=none Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I277336cf768d7d9f5aaf7c032632e4a299b4bb51 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3063691 Commit-Queue: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot_reference: Add GPT GUID for hibernateEvan Green2021-08-121-0/+2
| | | | | | | | | | | | | | Add a known partition type guid for hibernate partitions, so that they can be uniquely distinguished from other data partitions. BUG=b:196224292 TEST=build volteer with disk_layout_v4 BRANCH=main Change-Id: I62d969671ee1f80388c2c0cc5982051f5cb1bd0c Signed-off-by: Evan Green <evgreen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3088839 Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: Remove unnecessary flag unset operationsstabilize-14150.882.Bstabilize-14150.881.Bstabilize-14150.74.Bstabilize-14150.734.Bstabilize-14150.64.Bstabilize-14150.43.Bstabilize-14150.376.Brelease-R94-14150.Brelease-R94-14150.49.Bedisonhello2021-08-122-11/+6
| | | | | | | | | | | | | | | | | | Since all flags are initialized as 0 in vb2api_init(), some flag unset operations are not needed. Edit few comments to make it more accurate. BUG=none TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1; \ make -j32 test_setup && make -j32 runtests; BRANCH=none Signed-off-by: edisonhello <edisonhello@google.com> Change-Id: I0129f43342598195800ff671b965100d3d568564 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3066803 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/misc: Add validity check in vb2api_enable_developer_modeedisonhello2021-08-124-3/+21
| | | | | | | | | | | | | | | | | | | | | | | Check vb2api_allow_recovery before actual changes in vb2api_enable_developer_mode. Add new API error type VB2_ERROR_API_ENABLE_DEV_NOT_ALLOWED in vb2_error_t. Add spaces in the output message of vb2_misc_tests for indentation. BUG=b:172339016 TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=0; \ make -j32 test_setup && make -j32 runtests; TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=1; \ make -j32 test_setup && make -j32 runtests; TEST=Hayato booted into developer mode BRANCH=none Change-Id: Ifebdd01ca87cf944c394907eca73a09fc3bf5457 Signed-off-by: edisonhello <edisonhello@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3056240 Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/ui: Check allocated pointer before using the pointerstabilize-14149.Bedisonhello2021-08-101-1/+1
| | | | | | | | | | | | | | | | | Change the order of checking whether the allocated pointer is null and memset the allocated pointer. Prevent using a null pointer, which may cause segmentation fault. BUG=none TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 \ make -j32 test_setup && make -j32 runtests; TEST=emerge-asurada depthcharge BRANCH=none Signed-off-by: edisonhello <edisonhello@google.com> Change-Id: I5fc91b5157b32b6b7263d580998eceb6efe9a63a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3077962 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot: Publicize and create functions for UI migrationedisonhello2021-07-3011-79/+88
| | | | | | | | | | | | | | | | | | | | | | Publicize vb2api_enable_developer_mode, vb2api_allow_recovery and VbTryLoadKernel, and modify corresponding parts in tests. Create vb2api_disable_dev_request, vb2api_request_diagnostics for wrapping vb2_nv_set(ctx, VB2_NV_DISABLE_DEV_REQUEST, 1) and vb2_nv_set(ctx, VB2_NV_DIAG_REQUEST, 1). BUG=b:172339016 TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=0; \ make -j32 test_setup && make -j32 runtests; TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=1; \ make -j32 test_setup && make -j32 runtests; TEST=Hayato booted into developer mode BRANCH=none Change-Id: I0211a63ed58ce862ee3e17b4835c675544f773a4 Signed-off-by: edisonhello <edisonhello@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3053541 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot: Add DEV_BOOT_*ALLOWED in ctx->flagsedisonhello2021-07-306-66/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | Add DEV_BOOT_ALLOWED, DEV_BOOT_ALTFW_ALLOWED, DEV_BOOT_EXTERNAL_ALLOWED in ctx->flags, which can be used by external functions. These flags will be filled in VbSelectAndLoadKernel, before calling any menu function. In 2ui.c and 2ui_screen.c, all function calls to vb2_dev_boot_*allowed are replaced with corresponding flags in ctx->flags. Remove the parts of mocking these functions in unit tests, and set ctx->flags instead in reset_common_data. BUG=b:172339016 TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=0; \ make -j32 test_setup && make -j32 runtests; TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=1; \ make -j32 test_setup && make -j32 runtests; TEST=Hayato booted into developer mode BRANCH=none Signed-off-by: edisonhello <edisonhello@google.com> Change-Id: Ida9f03557a92a1522d631fc04b281ce85f5049c7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3041498 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot: Add vb2api_set_locale_idedisonhello2021-07-274-2/+15
| | | | | | | | | | | | | | | | | | | Add vb2api_set_locale_id to vboot2 API. Replace the direct access to vb2_nv_get and vb2_nv_set in ui functions with vb2api_get_locale_id and vb2api_set_locale_id. BUG=b:172339016 TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DIAGNOSTIC_UI=1 \ MINIMAL=1; make -j32 test_setup && make -j32 runtests; TEST=Hayato booted into developer mode BRANCH=none Signed-off-by: edisonhello <edisonhello@google.com> Change-Id: I5a92e571eceed6a402d0d80caa567bb9d77341a3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3041506 Commit-Queue: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: Use vb2api_gbb_get_flags instead of vb2_get_gbbedisonhello2021-07-272-5/+4
| | | | | | | | | | | | | | | | | | | Replace direct calls to vb2_get_gbb with vb2api_gbb_get_flags. This is a preparation work for migrating ui codes from vboot to depthcharge. BUG=b:172339016 TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1; \ make -j32 test_setup && make -j32 runtests; TEST=Hayato booted into developer mode BRANCH=none Change-Id: I69b1504c236df1c0b656cb1e6e28a4066d9fad63 Signed-off-by: edisonhello <edisonhello@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3041504 Commit-Queue: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot: add MINIOS_PRIORITY flag to nvstorageJoel Kitching2021-07-193-2/+12
| | | | | | | | | | | | | | | | Flag decides whether MINIOS-A or MINIOS-B is booted. BUG=b:186682292 TEST=make clean && make runtests TEST=Deploy and run `crossystem minios_priority` commands BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I11460bf1522cde8e98e680b0f00a417e2b4ef9a1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2998513 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* Makefile: deprecate config DIAGNOSTIC_UIHsuan Ting Chen2021-07-162-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DIAGNOSTIC_UI is indirectly decided by the diag_payload and minidiag use flag from depthcharge. But with introducing the diagnostic boot mode, coreboot also needs to build minidiag utility functions and enable this building flag. Therefore we consider to deprecate DIAGNOSTIC_UI and always build them. For diag_payload: It is for a diagnostic tool which based on legacy UI and deprecated For minidiag: Mini-diag is set default enabled for newer devices, and we could still use kernel secdata in runtime if we decide to disable it on certain platforms. In conclusion, deprecating DIAGNOSTIC_UI will not affect newer devices. BUG=b:190796342, b:181931817 BRANCH=none TEST=emerge-volteer depthcharge TEST=emerge-volteer coreboot TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests Cq-Depend: chromium:3004223 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I0d804bcd9d31d3952c744a1926ac59cde7b7f841 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3006114 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* Add comments to make it easier to decode return codesstabilize-14094.Bstabilize-14093.Bstabilize-14092.66.Bstabilize-14092.57.Brelease-R93-14092.BSimon Glass2021-07-121-53/+53
| | | | | | | | | | | | | | | At present in some cases it takes quite a while to figure out what enum an error code corresponds to. Add a few comments to make this a little faster. BUG=b:191646387 BRANCH=none TEST=FEATURES=test sudo -E emerge vboot_reference Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I72311d6fdf3c95284f26f28341f2d7d103f6a616 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2975085 Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot_reference: Add GUID type for miniOSJae Hoon Kim2021-07-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MiniOS partitions should not be using the same GUID as the kernel. Refer to bug as to reasons on why. ``` Using disk_layout_v3.json w/ types as "minios" instead of "kernel" and checking the GUID uses the new type. $ /build/zork-minios/usr/bin/cgpt show testimage start size part contents 0 1 PMBR 1 1 Pri GPT header 2 32 Pri GPT table 40 1 1 Label: "" Type: ChromeOS miniOS UUID: 8A23CFDA-316E-B847-ADF2-80C4D1DF6F93 67 32 Sec GPT table 99 1 Sec GPT header $ /build/zork-minios/usr/bin/cgpt show -n testimage start size part contents 0 1 PMBR 1 1 Pri GPT header 2 32 Pri GPT table 40 1 1 Label: "" Type: 09845860-705F-4BB5-B16C-8A8A099CAF52 UUID: 8A23CFDA-316E-B847-ADF2-80C4D1DF6F93 Attr: [0] 67 32 Sec GPT table 99 1 Sec GPT header ``` BUG=b:193182769 TEST=# comment above BRANCH=none Signed-off-by: Jae Hoon Kim <kimjae@google.com> Change-Id: I18beb0c79762d838e580f6af7f4a2601e2980de6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3017301 Tested-by: Jae Hoon Kim <kimjae@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Jae Hoon Kim <kimjae@chromium.org>
* vboot: introduce minios_kernel.keyblockJoel Kitching2021-07-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | miniOS requires a distinct kernel data key, whose dev key pair is added in this CL as minios_kernel_data_key.vb{pub,priv}k. A distinct keyblock is also required. The keyblock should set the kernel keyblock flag MINIOS_1. Other keyblocks are modified appropriately to set MINIOS_0. Keyblocks were generated using the following commands: $ futility vbutil_keyblock --flags 23 --datapubkey tests/devkeys/ec_data_key.vbpubk --signprivate tests/devkeys/ec_root_key.vbprivk --pack tests/devkeys/ec.keyblock Keyblock file: tests/devkeys/ec.keyblock Signature valid Flags: 23 !DEV DEV !REC !MINIOS Data key algorithm: 7 RSA4096 SHA256 Data key version: 1 Data key sha1sum: 5833470fe934be76753cb6501dbb8fbf88ab272b $ futility vbutil_keyblock --flags 23 --datapubkey tests/devkeys/firmware_data_key.vbpubk --signprivate tests/devkeys/root_key.vbprivk --pack tests/devkeys/firmware.keyblock Keyblock file: tests/devkeys/firmware.keyblock Signature valid Flags: 23 !DEV DEV !REC !MINIOS Data key algorithm: 7 RSA4096 SHA256 Data key version: 1 Data key sha1sum: e2c1c92d7d7aa7dfed5e8375edd30b7ae52b7450 $ futility vbutil_keyblock --flags 27 --datapubkey tests/devkeys/recovery_kernel_data_key.vbpubk --signprivate tests/devkeys/recovery_key.vbprivk --pack tests/devkeys/recovery_kernel.keyblock Keyblock file: tests/devkeys/recovery_kernel.keyblock Signature valid Flags: 27 !DEV DEV REC !MINIOS Data key algorithm: 11 RSA8192 SHA512 Data key version: 1 Data key sha1sum: e78ce746a037837155388a1096212ded04fb86eb $ futility vbutil_keyblock --flags 43 --datapubkey tests/devkeys/minios_kernel_data_key.vbpubk --signprivate tests/devkeys/recovery_key.vbprivk --pack tests/devkeys/minios_kernel.keyblock Keyblock file: tests/devkeys/minios_kernel.keyblock Signature valid Flags: 43 !DEV DEV REC MINIOS Data key algorithm: 8 RSA4096 SHA512 Data key version: 1 Data key sha1sum: 65441886bc54cbfe3a7308b650806f4b61d8d142 $ futility vbutil_keyblock --flags 23 --datapubkey tests/devkeys/kernel_data_key.vbpubk --signprivate tests/devkeys/kernel_subkey.vbprivk --pack tests/devkeys/kernel.keyblock Keyblock file: tests/devkeys/kernel.keyblock Signature valid Flags: 23 !DEV DEV !REC !MINIOS Data key algorithm: 4 RSA2048 SHA256 Data key version: 1 Data key sha1sum: d6170aa480136f1f29cf339a5ab1b960585fa444 $ futility vbutil_keyblock --flags 26 --datapubkey tests/devkeys/installer_kernel_data_key.vbpubk --signprivate tests/devkeys/recovery_key.vbprivk --pack tests/devkeys/installer_kernel.keyblock Keyblock file: tests/devkeys/installer_kernel.keyblock Signature valid Flags: 26 DEV REC !MINIOS Data key algorithm: 11 RSA8192 SHA512 Data key version: 1 Data key sha1sum: e78ce746a037837155388a1096212ded04fb86eb BUG=b:188121855 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I5b3e4def83ff29ca156b3c84dfcb8398f4985e67 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2965485 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot/vboot_kernel: clean up vb2_load_partitionJoel Kitching2021-07-031-19/+18
| | | | | | | | | | | | | | | | | | | | - Re-order arguments for consistency with LoadKernel() - Rename `flags` to `lpflags` for clarity - Move enum and friends to top of vboot_kernel.c This CL is part of a series to merge vboot1 and vboot2.0 kernel verification code; see b/181739551. BUG=b:181739551, b:188121855 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I4a1e1eba9f2c72a1393bba29523fc22944a2d73e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2917625 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/vboot_kernel: store kparams pointer instead of copying dataJoel Kitching2021-07-033-48/+17
| | | | | | | | | | | | | | | | | | | | Store kparams as a pointer in vboot_api_kernel.c, rather than a full struct passed around as a "buffer copy". This CL is part of a series to merge vboot1 and vboot2.0 kernel verification code; see b/181739551. BUG=b:181739551 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I7be7280761564c35e928bc947177b3fce61d6215 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2856360 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* Replace an old VB2_CONTEXT_SECDATA_CHANGEDSimon Glass2021-07-021-2/+2
| | | | | | | | | | | | | This enum has changed. Update the one remaining reference. BUG=b:191646387 BRANCH=none TEST=FEATURES=test sudo -E emerge vboot_reference Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: If22fa8cdd9a327e9a54dee01caf423caf7ba4efe Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3002419 Reviewed-by: Julius Werner <jwerner@chromium.org>
* Show error code when kernel is invalidSimon Glass2021-07-011-1/+1
| | | | | | | | | | | | | | | It seems useful to provide a bit more information about why the kernel failed to load. We have a suitable error code, so show it. BUG=b:191646387 BRANCH=none TEST=run through the flow with a VB2_ERROR_LOAD_PARTITION_WORKBUF error, see it is shown Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I426f571e1a4f947c97ccf99a399b4c3ab1c32047 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2975086 Reviewed-by: Joel Kitching <kitching@chromium.org>