|
本帖最后由 求道者 于 2023-1-30 01:24 编辑
打了补丁了似乎没用。
此BUG似乎只出现在iso9660下。
还是同样的报错。
commit='2f4430cc0a44fd8c8aa7aee5c51887667ad3d6c3'
https://git.savannah.gnu.org/git/grub.git
然后我把ISO刻录到U盘上,在实体机里能启动到LBA1的GRUB里,但是GRUB似乎无法检测到iso9660。
在QEMU下也可以模拟USB-CDROM。
同样的结果。
- mkisofs -V "BOOTISO" -A "FirPE Boot ISO" -U -max-iso9660-filenames -D -R -J -joliet-long -hide-joliet boot.catalog -no-emul-boot -boot-load-size 4 -b grldr -eltorito-alt-boot -no-emul-boot -eltorito-platform efi -eltorito-boot efiboot.img -o ~/efiboot.iso .
复制代码
efiboot.iso
链接: https://pan.baidu.com/s/1klHl9beuoGhkfW61BSxwgg&pwd=53d7
密码: 53d7
- diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
- index 7557eb269..75e9292a9 100644
- --- a/grub-core/loader/efi/chainloader.c
- +++ b/grub-core/loader/efi/chainloader.c
- @@ -32,6 +32,7 @@
- #include <grub/efi/api.h>
- #include <grub/efi/efi.h>
- #include <grub/efi/disk.h>
- +#include <grub/efi/memory.h>
- #include <grub/command.h>
- #include <grub/i18n.h>
- #include <grub/net.h>
- @@ -239,11 +240,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
- if (! file)
- goto fail;
-
- - /* Get the root device's device path. */
- - dev = grub_device_open (0);
- - if (! dev)
- - goto fail;
- -
- + dev = file->device;
- if (dev->disk)
- dev_handle = grub_efidisk_get_device_handle (dev->disk);
- else if (dev->net && dev->net->server)
- @@ -266,19 +263,16 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
-
- if (dev_handle)
- dp = grub_efi_get_device_path (dev_handle);
- -
- - if (! dp)
- +
- + if (dp != NULL)
- {
- - grub_error (GRUB_ERR_BAD_DEVICE, "not a valid root device");
- + file_path = make_file_path (dp, filename);
- + if (file_path == NULL)
- goto fail;
- - }
-
- - file_path = make_file_path (dp, filename);
- - if (! file_path)
- - goto fail;
- -
- - grub_printf ("file path: ");
- - grub_efi_print_device_path (file_path);
- + grub_printf ("file path: ");
- + grub_efi_print_device_path (file_path);
- + }
-
- size = grub_file_size (file);
- if (!size)
- @@ -287,7 +281,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
- filename);
- goto fail;
- }
- - pages = (((grub_efi_uintn_t) size + ((1 << 12) - 1)) >> 12);
- + pages = (grub_efi_uintn_t) GRUB_EFI_BYTES_TO_PAGES (size);
-
- status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ANY_PAGES,
- GRUB_EFI_LOADER_CODE,
- @@ -370,6 +364,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
- }
- loaded_image->device_handle = dev_handle;
-
- + /* Build load options with arguments from chainloader command line. */
- if (argc > 1)
- {
- int i, len;
- @@ -400,7 +395,6 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
- }
-
- grub_file_close (file);
- - grub_device_close (dev);
-
- /* We're finished with the source image buffer and file path now. */
- efi_call_2 (b->free_pages, address, pages);
- @@ -411,9 +405,6 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
-
- fail:
-
- - if (dev)
- - grub_device_close (dev);
- -
- if (file)
- grub_file_close (file);
复制代码
|
|