From 0ca5b0796de0a91a08cbd1efc092731b84f7a8ae Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Feb 14 2012 19:56:28 +0000 Subject: Fix TFTP booting on systems with multiple NICs - Fix ISO size calculation when not on an optical disc. --- diff --git a/grub-fedora-17.patch b/grub-fedora-17.patch index 33808ec..b114750 100644 --- a/grub-fedora-17.patch +++ b/grub-fedora-17.patch @@ -71,7 +71,7 @@ git diff grub-0.97 fedora-17 efi/ia32/loader/switch.h | 19 efi/ia32/reloc.c | 79 efi/ia32/setjmp.S | 86 - efi/pxe.c | 444 ++ + efi/pxe.c | 456 ++ efi/pxe.h | 237 + efi/ugadebug.h | 201 + efi/x86_64/callwrap.S | 274 + @@ -122,7 +122,7 @@ git diff grub-0.97 fedora-17 stage2/filesys.h | 28 stage2/fsys_ext2fs.c | 394 +- stage2/fsys_fat.c | 41 - stage2/fsys_iso9660.c | 6 + stage2/fsys_iso9660.c | 8 stage2/fsys_jfs.c | 12 stage2/fsys_minix.c | 10 stage2/fsys_reiserfs.c | 44 @@ -152,7 +152,7 @@ git diff grub-0.97 fedora-17 util/Makefile.in | 131 util/grub-crypt.in | 80 util/grub-install.in | 334 + - 141 files changed, 28056 insertions(+), 10647 deletions(-) + 141 files changed, 28068 insertions(+), 10649 deletions(-) diff --git a/.gitignore b/.gitignore new file mode 100644 @@ -27383,10 +27383,10 @@ index 0000000..38c33af +0: jmp *20(%ecx) /* done, return.... */ diff --git a/efi/pxe.c b/efi/pxe.c new file mode 100644 -index 0000000..1a74315 +index 0000000..d3084a4 --- /dev/null +++ b/efi/pxe.c -@@ -0,0 +1,444 @@ +@@ -0,0 +1,456 @@ + +#include +#include @@ -27735,11 +27735,23 @@ index 0000000..1a74315 + char hexip[9]; + int hexiplen; + -+ pxe = grub_efi_locate_protocol(&PxeBaseCodeProtocol, NULL); -+ if (pxe == NULL) -+ return NULL; ++ grub_efi_handle_t *handle, *handles; ++ grub_efi_uintn_t num_handles; + -+ if (!pxe->Mode->Started) ++ handles = grub_efi_locate_handle(GRUB_EFI_BY_PROTOCOL, ++ &PxeBaseCodeProtocol, ++ NULL, &num_handles); ++ for (handle = handles; num_handles--; handle++) { ++ pxe = grub_efi_open_protocol(*handle, &PxeBaseCodeProtocol, ++ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); ++ if (!pxe || !pxe->Mode) ++ continue; ++ if (pxe->Mode->Started && pxe->Mode->DhcpAckReceived) ++ break; ++ } ++ grub_free(handles); ++ ++ if (!pxe) + return NULL; + + set_pxe_info(LoadedImage, pxe); @@ -42485,7 +42497,7 @@ index f40e658..f1157f4 100644 } diff --git a/stage2/fsys_iso9660.c b/stage2/fsys_iso9660.c -index 90e4aa8..4d8a300 100644 +index 90e4aa8..858238b 100644 --- a/stage2/fsys_iso9660.c +++ b/stage2/fsys_iso9660.c @@ -56,8 +56,8 @@ struct iso_inode_info { @@ -42508,6 +42520,15 @@ index 90e4aa8..4d8a300 100644 /* * We have to use own devread() function since BIOS return wrong geometry +@@ -81,8 +81,6 @@ iso9660_devread (int sector, int byte_offset, int byte_len, char *buf) + if (byte_len <= 0) + return 1; + +- sector += (byte_offset >> sector_size_lg2); +- byte_offset &= (buf_geom.sector_size - 1); + asm volatile ("shl%L0 %1,%0" + : "=r"(sector) + : "Ic"((int8_t)(ISO_SECTOR_BITS - sector_size_lg2)), diff --git a/stage2/fsys_jfs.c b/stage2/fsys_jfs.c index 307f836..d63b1de 100644 --- a/stage2/fsys_jfs.c diff --git a/grub.spec b/grub.spec index c50a61c..5d99697 100644 --- a/grub.spec +++ b/grub.spec @@ -1,6 +1,6 @@ Name: grub Version: 0.97 -Release: 86%{?dist} +Release: 87%{?dist} Epoch: 1 Summary: Grand Unified Boot Loader. Group: System Environment/Base @@ -120,6 +120,10 @@ fi /sbin/grub-crypt %changelog +* Tue Feb 14 2012 Peter Jones - 0.97-87 +- Fix TFTP booting on systems with multiple NICs +- Fix ISO size calculation when not on an optical disc. + * Thu Feb 09 2012 Peter Jones - 0.97-86 - Add EFI filesystem stuff for mac booting.