patch to support ub* device names in grub-install

Jeff Carr jcarr@wit.org
Thu, 18 Nov 2004 18:52:20 -0800


This is a multi-part message in MIME format.
--------------050800080908000403090208
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

This is a simple patch so that grub-install can install onto devices 
with names like /dev/ub[a-z] (this looks as if it's going to be the 
normal name for usb devices.)

The current of 2.6.9 kernel (on sid) uses this naming scheme, so if you 
want to make a bootable USB device, it fails to allow you to install 
grub on /dev/ub* named devices.

I also had to comment out a check for errors around line 480:

+#    if test $count -eq 0; then
+#      echo "The file $file not read correctly." 1>&2
+#      exit 1
+#    fi

since I get the error when installing:

Error 18: Selected cylinder exceeds maximum supported by BIOS

However, this doesn't seem to keep grub from installing correctly on the 
usb drive.

Thanks,
Jeff

PS: is there a way to turn off the grub installer from always making the 
"recovery mode" entries for every kernel? It would be nice if grub just 
had a checkbox or keystroke that automatically would toggle appending 
"single" and instead display something right on the main screen.

--------------050800080908000403090208
Content-Type: text/x-patch;
 name="grub.usb.devname.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="grub.usb.devname.patch"

--- grub-install	2004-11-19 02:48:41.000000000 -0800
+++ /sbin/grub-install	2004-11-19 02:55:52.000000000 -0800
@@ -104,6 +104,7 @@
 
 	# Convert RAID devices list into a list of disks
 	tmp_disks=`echo "$devices" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \
+	                                 -e 's%\(ub[a-z]\)[0-9]*$%\1%' \
 					 -e 's%\(d[0-9]*\)p[0-9]*$%\1%' \
 					 -e 's%\(fd[0-9]*\)$%\1%' \
 					 -e 's%/part[0-9]*$%/disc%' \
@@ -144,11 +145,13 @@
 		/dev/md*)  set -- `getraid_mdadm $1`
 	esac
 	tmp_disk=`echo "$1" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \
+	                          -e 's%\(ub[a-z]\)[0-9]*$%\1%' \
 				  -e 's%\(d[0-9]*\)p[0-9]*$%\1%' \
 				  -e 's%\(fd[0-9]*\)$%\1%' \
 				  -e 's%/part[0-9]*$%/disc%' \
 				  -e 's%\(c[0-7]d[0-9]*\).*$%\1%'`
 	tmp_part=`echo "$1" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' \
+	                          -e 's%.*/ub[a-z]\([0-9]*\)$%\1%' \
 				  -e 's%.*d[0-9]*p*%%' \
 				  -e 's%.*/fd[0-9]*$%%' \
 				  -e 's%.*/floppy/[0-9]*$%%' \

--------------050800080908000403090208--