rpms/grub/devel grub-0.97-eficd.patch, NONE, 1.1 grub-0.97-printf_hex.patch, NONE, 1.1 grub.spec, 1.80, 1.81

Peter Jones pjones at fedoraproject.org
Mon Mar 2 20:17:23 UTC 2009


Author: pjones

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

Modified Files:
	grub.spec 
Added Files:
	grub-0.97-eficd.patch grub-0.97-printf_hex.patch 
Log Message:
* Mon Mar 02 2009 Peter Jones <pjones at redhat.com> - 0.97-41
- Fix CD Booting on EFI.


grub-0.97-eficd.patch:

--- NEW FILE grub-0.97-eficd.patch ---
--- grub-0.97/stage2/common.c	2009-03-02 14:00:46.000000000 -0500
+++ grub-0.97/stage2/common.c	2009-03-02 14:04:16.000000000 -0500
@@ -32,7 +32,7 @@
 struct multiboot_info mbi;
 unsigned long saved_drive;
 unsigned long saved_partition;
-unsigned long cdrom_drive;
+unsigned long cdrom_drive = 0x100;
 #ifndef STAGE1_5
 unsigned long saved_mem_upper;
 
--- grub-0.97/efi/efidisk.c	2009-03-02 14:00:46.000000000 -0500
+++ grub-0.97/efi/efidisk.c	2009-03-02 14:04:12.000000000 -0500
@@ -534,7 +534,7 @@
 					   unsigned long *drive,
 					   unsigned long *partition)
 {
-  grub_efi_device_path_t *dp;
+  grub_efi_device_path_t *dp, *dp1;
   struct grub_efidisk_data *d, *devices;
   int drv;
   unsigned long part;
@@ -562,6 +563,27 @@
   if (! dp)
     return 0;
 
+  dp1 = dp;
+  while (1)
+    {
+      grub_efi_uint8_t type = GRUB_EFI_DEVICE_PATH_TYPE (dp1);
+      grub_efi_uint8_t subtype = GRUB_EFI_DEVICE_PATH_SUBTYPE(dp1);
+
+      if (type == GRUB_EFI_MEDIA_DEVICE_PATH_TYPE &&
+	      subtype == GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE)
+	{
+	  dp1->type = GRUB_EFI_END_DEVICE_PATH_TYPE;
+	  dp1->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
+	  dp1->length[0] = 4;
+	  dp1->length[1] = 0;
+	}
+
+      if (GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp1))
+	break;
+
+      dp1 = GRUB_EFI_NEXT_DEVICE_PATH(dp1);
+    }
+
   drv = 0;
   for (d = fd_devices; d; d = d->next, drv++)
     {

grub-0.97-printf_hex.patch:

--- NEW FILE grub-0.97-printf_hex.patch ---
--- grub-0.97/stage2/char_io.c	2009-03-02 14:00:46.000000000 -0500
+++ grub-0.97/stage2/char_io.c	2009-03-02 14:04:16.000000000 -0500
@@ -198,13 +198,15 @@
     }
 }
 
-#define format_ascii(buf, val, is_hex, is_cap) ({                   \
+#define format_ascii(buf, val, is_hex, is_cap, num_pad_chars) ({    \
         int _n = sizeof ((buf)) - 2;                                \
         typeof(val) _nval = (val);                                  \
         int _negative = 0;                                          \
         int _mult = is_hex ? 16 : 10;                               \
         char _a = is_cap ? 'A' : 'a';                               \
-        memset((buf), '\0', sizeof ((buf)));                        \
+	int _pad = num_pad_chars; \
+		    char hex[] = "0123456789abcdef"; \
+        memset((buf), '\0', sizeof ((buf)));			    \
         if (!(_nval > 0LL))                                         \
             _negative = 1;                                          \
         if (_nval == 0LL)                                           \
@@ -214,12 +216,15 @@
         do {                                                        \
             int _dig = _nval % _mult;                               \
             (buf)[_n--] = ((_dig > 9) ? _dig + _a - 10 : '0'+_dig); \
+	    if (_pad > 0) _pad--; \
         } while (_nval /= _mult);                                   \
+	while (_pad--) \
+		(buf)[_n--] = '0'; \
         if (_negative)                                              \
             (buf)[_n--] = '-';                                      \
         _mult = 0;                                                  \
         _n++;                                                       \
-        while (_n < sizeof ((buf)))                                 \
+        while (_n < sizeof ((buf)))				    \
             (buf)[_mult++] = (buf)[_n++];                           \
         if (_negative && _mult > 1)                                 \
             ((buf)[_mult-2])++;                                     \
@@ -236,6 +241,8 @@
 
     char *str_arg;
     int int_arg;
+    unsigned char uchar_arg;
+    unsigned ushort_arg;
     unsigned int uint_arg;
     signed long long_arg;
     unsigned long ulong_arg;
@@ -246,7 +253,9 @@
     if (!c)
         return 0;
 
-    int is_fmt = 0, is_long = 0, is_signed = 1, is_cap = 0, restart = 1;
+    int is_fmt = 0, is_long = 0, is_signed = 1, is_cap = 0, is_zero_padded = 0;
+    int num_pad_chars = 0;
+    int restart = 1;
     do {
         if (restart) {
             restart = 0;
@@ -254,6 +263,8 @@
             is_long = 0;
             is_cap = 0;
             is_signed = 1;
+	    is_zero_padded = 0;
+	    num_pad_chars = 0;
             buf[0] = '\0';
             pos = 0;
         }
@@ -279,10 +290,31 @@
                 write_char(&str, c, &count);
                 restart = 1;
                 continue;
+	    case '0':
+	    	if (!is_zero_padded) {
+		    	buf[pos++] = c;
+			buf[pos] = '\0';
+			is_zero_padded++;
+			continue;
+		}
+	    case '1':
+	    case '2':
+	    case '3':
+	    case '4':
+	    case '5':
+	    case '6':
+	    case '7':
+	    case '8':
+	    case '9':
+		buf[pos++] = c;
+		buf[pos] = '\0';
+		num_pad_chars *= 10;
+		num_pad_chars += c - '0';
+		continue;
             case 'l':
                 buf[pos++] = c;
                 buf[pos] = '\0';
-                is_long ++;
+                is_long++;
                 continue;
             case 'L':
                 buf[pos++] = c;
@@ -304,13 +336,13 @@
             case 'd':
                 if (is_long == 0) {
                     int_arg = va_arg(args, signed int);
-                    format_ascii(buf, int_arg, 0, 0);
+                    format_ascii(buf, int_arg, 0, 0, 0);
                 } else if (is_long == 1) {
                     long_arg = va_arg(args, signed long);
-                    format_ascii(buf, long_arg, 0, 0);
+                    format_ascii(buf, long_arg, 0, 0, 0);
                 } else {
                     longlong_arg = va_arg(args, signed long long);
-                    format_ascii(buf, longlong_arg, 0, 0);
+                    format_ascii(buf, longlong_arg, 0, 0, 0);
                 }
                 write_str(&str, buf, &count);
                 restart = 1;
@@ -324,13 +356,13 @@
             case 'U':
                 if (is_long == 0) {
                     uint_arg = va_arg(args, unsigned int);
-                    format_ascii(buf, uint_arg, 0, 0);
+                    format_ascii(buf, uint_arg, 0, 0, 0);
                 } else if (is_long == 1) {
                     ulong_arg = va_arg(args, unsigned long);
-                    format_ascii(buf, ulong_arg, 0, 0);
+                    format_ascii(buf, ulong_arg, 0, 0, 0);
                 } else {
                     ulonglong_arg = va_arg(args, unsigned long long);
-                    format_ascii(buf, ulonglong_arg, 0, 0);
+                    format_ascii(buf, ulonglong_arg, 0, 0, 0);
                 }
                 write_str(&str, buf, &count);
                 restart = 1;
@@ -339,7 +371,8 @@
                 is_cap = 1;
             case 'p':
                 ulong_arg = va_arg(args, unsigned long);
-                format_ascii(buf, ulong_arg, 1, is_cap);
+		is_zero_padded = 1;
+                format_ascii(buf, ulong_arg, 1, is_cap, sizeof(ulong_arg));
                 write_str(&str, is_cap ? "0X" : "0x", &count);
                 write_str(&str, buf, &count);
                 restart = 1;
@@ -347,15 +380,25 @@
             case 'X':
                 is_cap = 1;
             case 'x':
-                if (is_long == 0) {
+	    	if (num_pad_chars == 2) {
+		    int i;
+		    char hex[] = "0123456789abcdef";
+		    uint_arg = va_arg(args, unsigned int);
+		    uchar_arg = uint_arg & 0xff;
+		    format_ascii(buf, uchar_arg, 1, is_cap, num_pad_chars);
+		} else if (num_pad_chars == 4) {
+		    uint_arg = va_arg(args, unsigned int);
+		    ushort_arg = uint_arg & 0xffff;
+		    format_ascii(buf, ushort_arg, 1, is_cap, num_pad_chars);
+		} else if (is_long == 0) {
                     uint_arg = va_arg(args, unsigned int);
-                    format_ascii(buf, uint_arg, 1, is_cap);
+                    format_ascii(buf, uint_arg, 1, is_cap, num_pad_chars);
                 } else if (is_long == 1) {
                     ulong_arg = va_arg(args, unsigned long);
-                    format_ascii(buf, ulong_arg, 1, is_cap);
+                    format_ascii(buf, ulong_arg, 1, is_cap, num_pad_chars);
                 } else {
                     ulonglong_arg = va_arg(args, unsigned long long);
-                    format_ascii(buf, ulonglong_arg, 1, is_cap);
+                    format_ascii(buf, ulonglong_arg, 1, is_cap, num_pad_chars);
                 }
                 write_str(&str, buf, &count);
                 restart = 1;



Index: grub.spec
===================================================================
RCS file: /cvs/extras/rpms/grub/devel/grub.spec,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -r1.80 -r1.81
--- grub.spec	25 Feb 2009 01:16:09 -0000	1.80
+++ grub.spec	2 Mar 2009 20:16:52 -0000	1.81
@@ -1,6 +1,6 @@
 Name: grub
 Version: 0.97
-Release: 40%{?dist}
+Release: 41%{?dist}
 Summary: Grand Unified Boot Loader.
 Group: System Environment/Base
 License: GPLv2+
@@ -29,6 +29,9 @@
 Patch4: 0003-Allow-passing-multiple-image-files-to-the-initrd-com.patch
 Patch5: 0004-Obey-2.06-boot-protocol-s-cmdline_size.patch
 
+Patch6: grub-0.97-printf_hex.patch
+Patch7: grub-0.97-eficd.patch
+
 %description
 GRUB (Grand Unified Boot Loader) is an experimental boot loader
 capable of booting into most free operating systems - Linux, FreeBSD,
@@ -43,6 +46,8 @@
 %patch3 -p1
 %patch4 -p1
 %patch5 -p1
+%patch6 -p1
+%patch7 -p1
 
 %build
 autoreconf
@@ -105,6 +110,9 @@
 %{_datadir}/grub
 
 %changelog
+* Mon Mar 02 2009 Peter Jones <pjones at redhat.com> - 0.97-41
+- Fix CD Booting on EFI.
+
 * Tue Feb 24 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.97-40
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
 




More information about the fedora-extras-commits mailing list