bootloader.c.rej 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. --- boot/source/bootloader.c
  2. +++ boot/source/bootloader.c
  3. @@ -231,10 +231,14 @@
  4. &LoadedImageProtocol,
  5. (VOID **)&loaded_image
  6. );
  7. - if (EFI_ERROR(status)) return status;
  8. + if (EFI_ERROR(status)) {
  9. + Print(L"HandleProtocol LoadedImage error: %r\n", status);
  10. + uefi_call_wrapper(SystemTable->BootServices->Stall, 1, 5000000);
  11. + return status;
  12. + }
  13. EFI_DEVICE_PATH *kernel_path = FileDevicePath(loaded_image->DeviceHandle, L"\\EFI\\BOOT\\bzImage");
  14. - if (kernel_path == NULL) return EFI_OUT_OF_RESOURCES;
  15. + if (kernel_path == NULL) { Print(L"Kernel path null\n"); return EFI_OUT_OF_RESOURCES; }
  16. EFI_HANDLE kernel_img = NULL;
  17. status = uefi_call_wrapper(
  18. @@ -247,7 +251,11 @@
  19. 0,
  20. &kernel_img
  21. );
  22. - if (EFI_ERROR(status)) return status;
  23. + if (EFI_ERROR(status)) {
  24. + Print(L"LoadImage kernel error: %r\n", status);
  25. + uefi_call_wrapper(SystemTable->BootServices->Stall, 1, 5000000);
  26. + return status;
  27. + }
  28. // 5. Play the boot animation (expanding nucleus) from ESP
  29. if (gop) {
  30. @@ -254,6 +262,9 @@
  31. VOID *anim_buffer = NULL;
  32. UINTN anim_size = 0;
  33. status = read_file_from_esp(ImageHandle, SystemTable, L"\\EFI\\BOOT\\animation.bin", &anim_buffer, &anim_size);
  34. + if (EFI_ERROR(status)) {
  35. + Print(L"read_file_from_esp error: %r\n", status);
  36. + }
  37. if (!EFI_ERROR(status)) {
  38. UINTN num_frames = 60;
  39. UINTN expected_size = num_frames * anim_width * anim_height * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
  40. @@ -293,6 +304,8 @@
  41. }
  42. uefi_call_wrapper(SystemTable->BootServices->FreePages, 2, (EFI_PHYSICAL_ADDRESS)(UINTN)anim_buffer, (anim_size + 4095) / 4096);
  43. }
  44. + } else {
  45. + Print(L"GOP is NULL!\n");
  46. }
  47. // 6. Set command line options for the kernel