rpms/grub/devel grub-0.97-fat-lowercase.patch, NONE, 1.1 grub-0.97-efipxe.patch, 1.3, 1.4 grub.spec, 1.90, 1.91

Peter Jones pjones at fedoraproject.org
Tue Apr 7 20:06:16 UTC 2009


Author: pjones

Update of /cvs/extras/rpms/grub/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv14966

Modified Files:
	grub-0.97-efipxe.patch grub.spec 
Added Files:
	grub-0.97-fat-lowercase.patch 
Log Message:
* Tue Apr 07 2009 Peter Jones <pjones at redhat.com> - 0.97-47
- Add more filenames to the tftp config file search list
- Tweak FAT filename comparison...
- Vomit.


grub-0.97-fat-lowercase.patch:

--- NEW FILE grub-0.97-fat-lowercase.patch ---
From: Peter Jones <pjones at redhat.com>

diff -urpN grub-0.97/stage2/char_io.c.lowercase grub-0.97/stage2/char_io.c
--- grub-0.97/stage2/char_io.c.lowercase	2009-04-07 15:06:37.000000000 -0400
+++ grub-0.97/stage2/char_io.c	2009-04-07 15:07:19.000000000 -0400
@@ -1346,6 +1346,26 @@ substring (const char *s1, const char *s
   return 1;
 }
 
+int
+subcasestring (const char *s1, const char *s2)
+{
+  while (tolower(*s1) == tolower(*s2))
+    {
+      /* The strings match exactly. */
+      if (! *(s1++))
+	return 0;
+      s2 ++;
+    }
+
+  /* S1 is a substring of S2. */
+  if (*s1 == 0)
+    return -1;
+
+  /* S1 isn't a substring. */
+  return 1;
+}
+
+
 #ifndef STAGE1_5
 /* Terminate the string STR with NUL.  */
 int
diff -urpN grub-0.97/stage2/fsys_fat.c.lowercase grub-0.97/stage2/fsys_fat.c
--- grub-0.97/stage2/fsys_fat.c.lowercase	2009-04-07 15:06:21.000000000 -0400
+++ grub-0.97/stage2/fsys_fat.c	2009-04-07 15:06:56.000000000 -0400
@@ -435,7 +435,7 @@ fat_dir (char *dirname)
 		goto print_filename;
 # endif /* STAGE1_5 */
 	      
-	      if (substring (dirname, filename) == 0)
+	      if (subcasestring (dirname, filename) == 0)
 		break;
 	    }
 	}
@@ -462,7 +462,7 @@ fat_dir (char *dirname)
       if (do_possibilities)
 	{
 	print_filename:
-	  if (substring (dirname, filename) <= 0)
+	  if (subcasestring (dirname, filename) <= 0)
 	    {
 	      if (print_possibilities > 0)
 		print_possibilities = -print_possibilities;
@@ -472,7 +472,7 @@ fat_dir (char *dirname)
 	}
 # endif /* STAGE1_5 */
       
-      if (substring (dirname, filename) == 0)
+      if (subcasestring (dirname, filename) == 0)
 	break;
     }
   
diff -urpN grub-0.97/stage2/shared.h.lowercase grub-0.97/stage2/shared.h
--- grub-0.97/stage2/shared.h.lowercase	2009-04-07 15:06:29.000000000 -0400
+++ grub-0.97/stage2/shared.h	2009-04-07 15:07:01.000000000 -0400
@@ -941,6 +941,7 @@ char *convert_to_ascii (char *buf, int c
 int get_cmdline (char *prompt, char *cmdline, int maxlen,
 		 int echo_char, int history);
 int substring (const char *s1, const char *s2);
+int subcasestring (const char *s1, const char *s2);
 int nul_terminate (char *str);
 int get_based_digit (int c, int base);
 int safe_parse_maxint (char **str_ptr, int *myint_ptr);

grub-0.97-efipxe.patch:

Index: grub-0.97-efipxe.patch
===================================================================
RCS file: /cvs/extras/rpms/grub/devel/grub-0.97-efipxe.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- grub-0.97-efipxe.patch	6 Apr 2009 15:13:28 -0000	1.3
+++ grub-0.97-efipxe.patch	7 Apr 2009 20:06:15 -0000	1.4
@@ -1,19 +1,19 @@
-From cc3b0e11c8322c2c4f81e9964301157cfbcfdf16 Mon Sep 17 00:00:00 2001
+From feede446fb63401cdf36860427bc9feb7e903596 Mon Sep 17 00:00:00 2001
 From: Peter Jones <pjones at redhat.com>
 Date: Tue, 31 Mar 2009 14:55:00 +0500
 Subject: [PATCH] add basic pxe boot support in efi
 
 ---
  efi/Makefile.am    |    2 +-
- efi/byteswap.h     |   37 ++++
- efi/dhcp.h         |  133 +++++++++++++++
+ efi/byteswap.h     |   37 +++++
+ efi/dhcp.h         |  133 ++++++++++++++++
  efi/eficore.c      |   12 ++
  efi/efimain.c      |   41 ++++--
  efi/efimisc.c      |   14 +-
- efi/efitftp.c      |  182 +++++++++++++++++++++
+ efi/efitftp.c      |  179 +++++++++++++++++++++
  efi/grub/efi/efi.h |    6 +
- efi/pxe.c          |  462 ++++++++++++++++++++++++++++++++++++++++++++++++++++
- efi/pxe.h          |  237 +++++++++++++++++++++++++++
+ efi/pxe.c          |  440 ++++++++++++++++++++++++++++++++++++++++++++++++++++
+ efi/pxe.h          |  237 ++++++++++++++++++++++++++++
  grub/Makefile.am   |    2 +-
  grub/efitftp.c     |   34 ++++
  stage2/Makefile.am |    4 +-
@@ -21,7 +21,7 @@
  stage2/efistubs.c  |    7 +
  stage2/efistubs.h  |    8 +
  stage2/filesys.h   |   13 ++-
- 17 files changed, 1185 insertions(+), 26 deletions(-)
+ 17 files changed, 1160 insertions(+), 26 deletions(-)
  create mode 100644 efi/byteswap.h
  create mode 100644 efi/dhcp.h
  create mode 100644 efi/efitftp.c
@@ -317,7 +317,7 @@
  
  grub_efi_status_t
 diff --git a/efi/efimisc.c b/efi/efimisc.c
-index 4818617..d508ada 100644
+index 4818617..995be97 100644
 --- a/efi/efimisc.c
 +++ b/efi/efimisc.c
 @@ -489,11 +489,15 @@ grub_set_config_file (char *path_name)
@@ -336,17 +336,17 @@
 +    grub_memmove (config_file, path_name, path_name_len);
 +    grub_strcpy (config_file + path_name_len, DEFAULT_CONFIG_FILE_NAME);
 +  } else {
-+    grub_memmove (config_file, path_name, path_name_len);
++    grub_memmove (config_file, path_name, path_name_len+1);
 +  }
    if (path_name_len + sizeof (DEFAULT_SAVED_DEFAULT_FILE_NAME) > 128)
      return;
    path_name_len = dir_end + 1 - path_name;
 diff --git a/efi/efitftp.c b/efi/efitftp.c
 new file mode 100644
-index 0000000..9f207e3
+index 0000000..92cdf9b
 --- /dev/null
 +++ b/efi/efitftp.c
-@@ -0,0 +1,182 @@
+@@ -0,0 +1,179 @@
 +#include <grub/efi/efi.h>
 +#include <grub/efi/api.h>
 +#include <grub/efi/misc.h>
@@ -413,7 +413,7 @@
 +static grub_efi_status_t tftp_read_file(
 +	char *Filename,
 +	char *Buffer,
-+	grub_efi_uint64_t BufferSize)
++	grub_efi_uintn_t BufferSize)
 +{
 +	EFI_PXE_BASE_CODE_TFTP_OPCODE OpCode = EFI_PXE_BASE_CODE_TFTP_READ_FILE;
 +	grub_efi_boolean_t Overwrite = 0;
@@ -511,11 +511,8 @@
 +
 +		tftp_info.Buffer = grub_malloc(filemax);
 +
-+		printf("rc: %d filemax: %d\n", rc, filemax);
 +		return 1;
 +	}
-+	printf("rc: %d filemax: %d\n", rc, filemax);
-+
 +	return 0;
 +}
 +
@@ -548,10 +545,10 @@
  grub_efi_handle_t *grub_efi_locate_handle (grub_efi_locate_search_type_t
 diff --git a/efi/pxe.c b/efi/pxe.c
 new file mode 100644
-index 0000000..b38b95a
+index 0000000..1863813
 --- /dev/null
 +++ b/efi/pxe.c
-@@ -0,0 +1,462 @@
+@@ -0,0 +1,440 @@
 +
 +#include <grub/efi/efi.h>
 +#include <grub/efi/api.h>
@@ -593,10 +590,8 @@
 +static void dhcp_option_parser_reset(dhcp_option_parser *parser,
 +				EFI_PXE_BASE_CODE_PACKET *packet)
 +{
-+	char *addr;
-+	//grub_uint64_t addr = (grub_uint64_t)(void *)packet;
++	grub_uint64_t addr = (grub_uint64_t)packet;
 +
-+	addr = (char *)packet;
 +	addr += offsetof(EFI_PXE_BASE_CODE_DHCPV4_PACKET, DhcpOptions);
 +	parser->current_option = (void *)addr;
 +	parser->options = (void *)addr;
@@ -605,15 +600,11 @@
 +static int dhcp_option_parser_next(dhcp_option_parser *parser,
 +				EFI_DHCP4_PACKET_OPTION **option)
 +{
-+	char *current_option;
 +	if (parser->current_option->OpCode == 255) {
 +		*option = NULL;
 +		return 0;
 +	}
-+	current_option = (char *)parser->current_option;
-+	current_option += 2 + parser->current_option->Length;
-+	parser->current_option = (EFI_DHCP4_PACKET_OPTION *)current_option;
-+
++	parser->current_option = (void *)((grub_uint64_t)parser->current_option + 2 + parser->current_option->Length);
 +	*option = parser->current_option;
 +	return 1;
 +}
@@ -846,84 +837,6 @@
 +	return 0;
 +}
 +
-+extern char *grub_efi_pxe_find_config_file(void);
-+char *grub_efi_pxe_find_config_file(void)
-+{
-+	EFI_PXE_BASE_CODE *pxe = NULL;
-+	EFI_PXE_BASE_CODE_DHCPV4_PACKET *packet;
-+	EFI_IP_ADDRESS serveraddr;
-+	char hex[] = "0123456789ABCDEF";
-+	char bootpsrvname[65];
-+	char bootpbootfile[129];
-+	char hexip[9];
-+	char *filepath = NULL;
-+	int hexiplen;
-+
-+	pxe = grub_efi_locate_protocol(&PxeBaseCodeProtocol, NULL);
-+	if (pxe == NULL)
-+		return NULL;
-+
-+	packet = &pxe->Mode->DhcpAck.Dhcpv4;
-+
-+	memcpy(&serveraddr, packet->BootpSiAddr, 4);
-+
-+	packet = &pxe->Mode->DhcpAck.Dhcpv4;
-+#if 0
-+	if (!memcmp(packet->BootpHwAddr + 6, "\x00\x00\x00\x00\x00"
-+					     "\x00\x00\x00\x00\x00", 10) &&
-+			memcmp(packet->BootpHwAddr, "\x00\x00\x00\x00\x00\x00",
-+				6)) {
-+		char mac[21];
-+		sprintf(mac, "00-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c",
-+			hex[(packet->BootpHwAddr[0] & 0xf0) >> 4],
-+			hex[packet->BootpHwAddr[0] & 0xf],
-+			hex[(packet->BootpHwAddr[1] & 0xf0) >> 4],
-+			hex[packet->BootpHwAddr[1] & 0xf],
-+			hex[(packet->BootpHwAddr[2] & 0xf0) >> 4],
-+			hex[packet->BootpHwAddr[2] & 0xf],
-+			hex[(packet->BootpHwAddr[3] & 0xf0) >> 4],
-+			hex[packet->BootpHwAddr[3] & 0xf],
-+			hex[(packet->BootpHwAddr[4] & 0xf0) >> 4],
-+			hex[packet->BootpHwAddr[4] & 0xf],
-+			hex[(packet->BootpHwAddr[5] & 0xf0) >> 4],
-+			hex[packet->BootpHwAddr[5] & 0xf]);
-+		if (grub_efi_pxe_check_for_file(pxe, &serveraddr,
-+					    packet->BootpBootFile, mac,
-+					    &filepath)) {
-+
-+			return filepath;
-+		}
-+	}
-+
-+	sprintf(hexip, "%c%c%c%c%c%c%c%c",
-+		hex[(packet->BootpYiAddr[0] & 0xf0) >> 4],
-+		hex[packet->BootpYiAddr[0] & 0xf],
-+		hex[(packet->BootpYiAddr[1] & 0xf0) >> 4],
-+		hex[packet->BootpYiAddr[1] & 0xf],
-+		hex[(packet->BootpYiAddr[2] & 0xf0) >> 4],
-+		hex[packet->BootpYiAddr[2] & 0xf],
-+		hex[(packet->BootpYiAddr[3] & 0xf0) >> 4],
-+		hex[packet->BootpYiAddr[3] & 0xf]);
-+
-+	for (hexiplen = strlen(hexip); hexiplen > 0; hexiplen--)
-+	{
-+		hexip[hexiplen] = '\0';
-+		if (grub_efi_pxe_check_for_file(pxe, &serveraddr,
-+					    packet->BootpBootFile, hexip,
-+					    &filepath)) {
-+			return filepath;
-+		}
-+	}
-+
-+
-+	if (grub_efi_pxe_check_for_file(pxe, &serveraddr, packet->BootpBootFile,
-+				    "efidefault", &filepath)) {
-+		return filepath;
-+	}
-+#endif
-+	return NULL;
-+}
-+
 +static void get_pxe_server(EFI_PXE_BASE_CODE *pxe, EFI_IP_ADDRESS **Address)
 +{
 +	EFI_IP_ADDRESS *tmp = grub_malloc(sizeof *tmp);
@@ -973,9 +886,12 @@
 +	char *FileName = NULL;
 +	EFI_PXE_BASE_CODE_DHCPV4_PACKET *packet;
 +	uuid_t uuid;
-+	grub_efi_uintn_t FileSize = 0;
++	size_t FileSize = 0;
 +	grub_efi_status_t rc = GRUB_EFI_SUCCESS;
 +	char *ConfigPath = NULL;
++	char hex[] = "0123456789ABCDEF";
++	char hexip[9];
++	int hexiplen;
 +
 +	pxe = grub_efi_locate_protocol(&PxeBaseCodeProtocol, NULL);
 +	if (pxe == NULL)
@@ -999,7 +915,6 @@
 +			uuid.clock_seq_hi, uuid.clock_seq_low,
 +			uuid.node[0], uuid.node[1], uuid.node[2],
 +			uuid.node[3], uuid.node[4], uuid.node[5]);
-+		printf("FileName: \"%s\"\n", FileName);
 +
 +		rc = tftp_get_file_size(FileName, &FileSize);
 +		if (rc == GRUB_EFI_SUCCESS) {
@@ -1012,6 +927,66 @@
 +		}
 +	}
 +
++	packet = &pxe->Mode->DhcpAck.Dhcpv4;
++
++	if (!memcmp(packet->BootpHwAddr + 6, "\x00\x00\x00\x00\x00"
++					     "\x00\x00\x00\x00\x00", 10) &&
++			memcmp(packet->BootpHwAddr, "\x00\x00\x00\x00\x00\x00",
++				6)) {
++		char mac[21];
++		sprintf(mac, "01-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c",
++			hex[(packet->BootpHwAddr[0] & 0xf0) >> 4],
++			hex[packet->BootpHwAddr[0] & 0xf],
++			hex[(packet->BootpHwAddr[1] & 0xf0) >> 4],
++			hex[packet->BootpHwAddr[1] & 0xf],
++			hex[(packet->BootpHwAddr[2] & 0xf0) >> 4],
++			hex[packet->BootpHwAddr[2] & 0xf],
++			hex[(packet->BootpHwAddr[3] & 0xf0) >> 4],
++			hex[packet->BootpHwAddr[3] & 0xf],
++			hex[(packet->BootpHwAddr[4] & 0xf0) >> 4],
++			hex[packet->BootpHwAddr[4] & 0xf],
++			hex[(packet->BootpHwAddr[5] & 0xf0) >> 4],
++			hex[packet->BootpHwAddr[5] & 0xf]);
++
++		rc = tftp_get_file_size(mac, &FileSize);
++		if (rc == GRUB_EFI_SUCCESS) {
++			char *ReturnFile = grub_malloc(strlen("(nd)/") +
++						strlen(mac) + 1);
++			sprintf(ReturnFile, "(nd)/%s", mac);
++			return ReturnFile;
++		}
++
++	}
++
++	sprintf(hexip, "%c%c%c%c%c%c%c%c",
++		hex[(packet->BootpYiAddr[0] & 0xf0) >> 4],
++		hex[packet->BootpYiAddr[0] & 0xf],
++		hex[(packet->BootpYiAddr[1] & 0xf0) >> 4],
++		hex[packet->BootpYiAddr[1] & 0xf],
++		hex[(packet->BootpYiAddr[2] & 0xf0) >> 4],
++		hex[packet->BootpYiAddr[2] & 0xf],
++		hex[(packet->BootpYiAddr[3] & 0xf0) >> 4],
++		hex[packet->BootpYiAddr[3] & 0xf]);
++
++	for (hexiplen = strlen(hexip); hexiplen > 0; hexiplen--)
++	{
++		hexip[hexiplen] = '\0';
++		rc = tftp_get_file_size(hexip, &FileSize);
++		if (rc == GRUB_EFI_SUCCESS) {
++			char *ReturnFile = grub_malloc(strlen("(nd)/") +
++						strlen(hexip) + 1);
++			sprintf(ReturnFile, "(nd)/%s", hexip);
++			return ReturnFile;
++		}
++	}
++
++	rc = tftp_get_file_size("efidefault", &FileSize);
++	if (rc == GRUB_EFI_SUCCESS) {
++		char *ReturnFile = grub_malloc(strlen("(nd)/efidefault")+1);
++		sprintf(ReturnFile, "(nd)/efidefault");
++		return ReturnFile;
++	}
++
 +	return NULL;
 +}
 diff --git a/efi/pxe.h b/efi/pxe.h
@@ -1458,5 +1433,5 @@
  
  /* defines for the block filesystem info area */
 -- 
-1.6.2.2
+1.6.2
 


Index: grub.spec
===================================================================
RCS file: /cvs/extras/rpms/grub/devel/grub.spec,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -r1.90 -r1.91
--- grub.spec	6 Apr 2009 15:13:28 -0000	1.90
+++ grub.spec	7 Apr 2009 20:06:16 -0000	1.91
@@ -1,6 +1,6 @@
 Name: grub
 Version: 0.97
-Release: 46%{?dist}
+Release: 47%{?dist}
 Summary: Grand Unified Boot Loader.
 Group: System Environment/Base
 License: GPLv2+
@@ -37,7 +37,8 @@
 Patch9: grub-0.97-efigraph-use-blt.patch
 Patch10: grub-0.97-efislice.patch
 Patch11: grub-0.97-efistatus.patch
-Patch12: grub-0.97-efipxe.patch
+Patch12: grub-0.97-fat-lowercase.patch
+Patch13: grub-0.97-efipxe.patch
 
 %description
 GRUB (Grand Unified Boot Loader) is an experimental boot loader
@@ -60,6 +61,7 @@
 %patch10 -p1
 %patch11 -p1
 %patch12 -p1
+%patch13 -p1
 
 %build
 autoreconf
@@ -122,6 +124,11 @@
 %{_datadir}/grub
 
 %changelog
+* Tue Apr 07 2009 Peter Jones <pjones at redhat.com> - 0.97-47
+- Add more filenames to the tftp config file search list
+- Tweak FAT filename comparison...
+- Vomit.
+
 * Mon Apr 06 2009 Peter Jones <pjones at redhat.com> - 0.97-46
 - Update gnu-efi buildreq.
 - Fix up pxe code for i386




More information about the fedora-extras-commits mailing list