summaryrefslogtreecommitdiff
path: root/shim.c
diff options
context:
space:
mode:
Diffstat (limited to 'shim.c')
-rw-r--r--shim.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/shim.c b/shim.c
index 2a65627a..8130ed8c 100644
--- a/shim.c
+++ b/shim.c
@@ -39,6 +39,7 @@
#include "PeImage.h"
#include "shim.h"
#include "signature.h"
+#include "netboot.h"
#define SECOND_STAGE L"\\grub.efi"
#define MOK_MANAGER L"\\MokManager.efi"
@@ -774,7 +775,6 @@ static EFI_STATUS read_header(void *data, unsigned int datasize,
Print(L"Malformed security header\n");
return EFI_INVALID_PARAMETER;
}
-
return EFI_SUCCESS;
}
@@ -1081,6 +1081,8 @@ EFI_STATUS start_image(EFI_HANDLE image_handle, CHAR16 *ImagePath)
EFI_LOADED_IMAGE *li, li_bak;
EFI_DEVICE_PATH *path;
CHAR16 *PathName = NULL;
+ void *sourcebuffer = NULL;
+ UINTN sourcesize = 0;
void *data = NULL;
int datasize;
@@ -1106,14 +1108,30 @@ EFI_STATUS start_image(EFI_HANDLE image_handle, CHAR16 *ImagePath)
goto done;
}
- /*
- * Read the new executable off disk
- */
- efi_status = load_image(li, &data, &datasize, PathName);
+ if (findNetboot(image_handle)) {
+ efi_status = parseNetbootinfo(image_handle);
+ if (efi_status != EFI_SUCCESS) {
+ Print(L"Netboot parsing failed: %d\n", efi_status);
+ return EFI_PROTOCOL_ERROR;
+ }
+ efi_status = FetchNetbootimage(image_handle, &sourcebuffer,
+ &sourcesize);
+ if (efi_status != EFI_SUCCESS) {
+ Print(L"Unable to fetch TFTP image\n");
+ return efi_status;
+ }
+ data = sourcebuffer;
+ datasize = sourcesize;
+ } else {
+ /*
+ * Read the new executable off disk
+ */
+ efi_status = load_image(li, &data, &datasize, PathName);
- if (efi_status != EFI_SUCCESS) {
- Print(L"Failed to load image\n");
- goto done;
+ if (efi_status != EFI_SUCCESS) {
+ Print(L"Failed to load image\n");
+ goto done;
+ }
}
/*