GRUB MTD DISKONCHIP patch failure with "grub-2003-01-08-doc.patch" on file stage2/disk_io.c using latest GRUB CVS

Mike Gore magore at sympatico.ca
Mon Nov 10 22:11:32 EST 2003


I downloaded the latest CVS for grub on 10 Nov 2003 at 9:30pmEST and 
attempted to apply the MTD patch grub-2003-01-08-doc.patch
Besides the expected Changelog and Authors errors I got one rejected 
section on stage2/disk_io.c (see below for copy of the failed section)

It is not totally clear to me how to fix this - looking at the code it 
seems that the patch is using a different parsing method and as such it 
is not clear  how to proceed since
I do not have the grub code from the original patch date - nor do I know 
what bugs it may have had and or have fixed...

I suspect the problem must be recent since others have reported success 
with patching GRUB in the last few months

I would be thankfull for any pointers

Here is disk_io.c.rej

***************
*** 964,987 ****
                return device + 2;
            }
 
-         if ((*device == 'f' || *device == 'h' || *device == 'n')
-             && (device += 2, (*(device - 1) != 'd')))
-           errnum = ERR_NUMBER_PARSING;
 
-         if (ch == 'n')
-           current_drive = NETWORK_DRIVE;
-         else
            {
              safe_parse_maxint (&device, (int *) &current_drive);
             
              disk_choice = 0;
              if (ch == 'h')
                current_drive += 0x80;
            }
        }
 
        if (errnum)
-       return 0;
 
        if (*device == ')')
        {
--- 1024,1060 ----
                return device + 2;
            }
 
+         device += 2;
 
+ #define MK16(a,b) ( ((a)<<8) + (b) )
+
+         switch (MK16(ch, *(device-1)))
            {
+           case MK16('n','d'):
+             current_drive = NETWORK_DRIVE;
+             break;
+            
+           case MK16('d','c'):
              safe_parse_maxint (&device, (int *) &current_drive);
+             disk_choice = 0;
+             current_drive += DISK_ON_CHIP;
+             break;
             
+           case MK16('h','d'):
+           case MK16('f','d'):
+             safe_parse_maxint (&device, (int *) &current_drive);
              disk_choice = 0;
              if (ch == 'h')
                current_drive += 0x80;
+             break;
+            
+           default:
+             errnum = ERR_NUMBER_PARSING;
            }
        }
 
        if (errnum)
+        return 0;
 
        if (*device == ')')
        {



-- 
# Mike Gore
# At Home:	InfoWrite Consulting
# Mail:		405 Midwood Cres, Waterloo Ontario, N2L 5N4
# Phone:	1-519-884-4943
# Fax:		1-519-885-0548
# Email:	magore at sympatico.ca
#
# At Work: 	Technical Support, CSCF
# Smail:   	DC3549C, University of Waterloo, 200 University Ave
#	     	Waterloo Ontario, Canada, N2L 3G1
# Phone:	1-519-888-4567, x6205
# Fax:		1-519-746-5036
# Email:	magore at uwaterloo.ca





More information about the linux-mtd mailing list