summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/2lib/2ui_screens.c11
-rw-r--r--firmware/2lib/include/2api.h2
-rw-r--r--tests/vb2_ui_tests.c5
3 files changed, 14 insertions, 4 deletions
diff --git a/firmware/2lib/2ui_screens.c b/firmware/2lib/2ui_screens.c
index a2ad2b63..d6ee6839 100644
--- a/firmware/2lib/2ui_screens.c
+++ b/firmware/2lib/2ui_screens.c
@@ -727,14 +727,21 @@ vb2_error_t developer_mode_init(struct vb2_ui_context *ui)
vb2_error_t vb2_ui_developer_mode_boot_internal_action(
struct vb2_ui_context *ui)
{
+ vb2_error_t rv;
+
if (!(ui->ctx->flags & VB2_CONTEXT_DEVELOPER_MODE) ||
!(ui->ctx->flags & VB2_CONTEXT_DEV_BOOT_ALLOWED)) {
VB2_DEBUG("ERROR: Dev mode internal boot not allowed\n");
return VB2_SUCCESS;
}
- VB2_TRY(VbTryLoadKernel(ui->ctx, VB_DISK_FLAG_FIXED));
- return VB2_REQUEST_UI_EXIT;
+ rv = VbTryLoadKernel(ui->ctx, VB_DISK_FLAG_FIXED);
+ if (rv == VB2_SUCCESS)
+ return VB2_REQUEST_UI_EXIT;
+
+ VB2_DEBUG("ERROR: Failed to boot from internal disk: %#x\n", rv);
+ ui->error_beep = 1;
+ return set_ui_error(ui, VB2_UI_ERROR_INTERNAL_BOOT_FAILED);
}
vb2_error_t vb2_ui_developer_mode_boot_external_action(
diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h
index b973417d..6144c84b 100644
--- a/firmware/2lib/include/2api.h
+++ b/firmware/2lib/include/2api.h
@@ -1456,6 +1456,8 @@ enum vb2_ui_error {
VB2_UI_ERROR_UNTRUSTED_CONFIRMATION,
/* To-norm not allowed */
VB2_UI_ERROR_TO_NORM_NOT_ALLOWED,
+ /* Internal boot failed */
+ VB2_UI_ERROR_INTERNAL_BOOT_FAILED,
/* External boot is disabled */
VB2_UI_ERROR_EXTERNAL_BOOT_DISABLED,
/* Alternate bootloader is disabled */
diff --git a/tests/vb2_ui_tests.c b/tests/vb2_ui_tests.c
index 54f76037..948c6af5 100644
--- a/tests/vb2_ui_tests.c
+++ b/tests/vb2_ui_tests.c
@@ -635,8 +635,9 @@ static void developer_tests(void)
/* If fail to load internal disk, don't boot */
reset_common_data(FOR_DEVELOPER);
add_mock_vbtlk(VB2_ERROR_LK_NO_DISK_FOUND, VB_DISK_FLAG_FIXED);
- TEST_EQ(vb2_developer_menu(ctx), VB2_ERROR_LK_NO_DISK_FOUND,
- "if fail to load internal disk, don't boot");
+ TEST_NEQ(vb2_developer_menu(ctx), VB2_SUCCESS,
+ "if fail to load internal disk, don't boot");
+ TEST_EQ(mock_calls_until_shutdown, 0, " loop forever");
/* Select boot internal in dev menu */
reset_common_data(FOR_DEVELOPER);