diff options
author | James Bottomley <JBottomley@Parallels.com> | 2012-12-06 11:30:01 +0000 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-12-06 11:30:01 +0000 |
commit | eef574b90be397c86ed51b8410a5e5ebee62f066 (patch) | |
tree | 8d2a40d5d1234785a5e46538c6efd8e390e5f6cb | |
parent | 3d42918cb12cfe065100874cdcf211fd685d323d (diff) | |
download | efitools-eef574b90be397c86ed51b8410a5e5ebee62f066.tar.gz |
PreLoader: Add dialogue boxes and make suitable for gummiboot
-rw-r--r-- | PreLoader.c | 54 |
1 files changed, 40 insertions, 14 deletions
diff --git a/PreLoader.c b/PreLoader.c index 42fb7e7..e5a1d8e 100644 --- a/PreLoader.c +++ b/PreLoader.c @@ -22,7 +22,6 @@ EFI_STATUS efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) { EFI_STATUS status; - InitializeLib(image, systab); @@ -51,20 +50,47 @@ efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) goto out; } - status = execute(image, hashtool); - - if (status != EFI_SUCCESS) { - CHAR16 buf[256]; - - StrCpy(buf, L"Failed to start backup programme "); - StrCat(buf, hashtool); - console_error(buf, status); - - goto out; + console_alertbox((CHAR16 *[]) { + L"Failed to start loader", + L"", + L"It is probably in \\boot\\efi\\loader.efi", + L"Please enrol its hash and try again", + L"", + L"I will now execute HashTool for you to do this", + NULL + }); + + for (;;) { + status = execute(image, hashtool); + + if (status != EFI_SUCCESS) { + CHAR16 buf[256]; + + StrCpy(buf, L"Failed to start backup programme "); + StrCat(buf, hashtool); + console_error(buf, status); + + goto out; + } + + /* try to start the loader again */ + status = execute(image, loader); + if (status == EFI_ACCESS_DENIED + || status == EFI_SECURITY_VIOLATION) { + int selection = console_select((CHAR16 *[]) { + L"loader is still giving a security error", + NULL + }, (CHAR16 *[]) { + L"Start HashTool", + L"Exit", + NULL + }, 0); + if (selection == 0) + continue; + } + + break; } - - /* try to start the loader again */ - status = execute(image, loader); out: security_policy_uninstall(); |