Hi,

This patch would check for drive number and use drivemap to map disks,
this is required to boot DOS/Windows from secondary drive. It also
change commands like root (hd0,0) to root=hd0,0 (I remember someone
want to remove the root command ?)

-- 
Bean
diff --git a/util/osdetect.lua b/util/osdetect.lua
index 38a9099..ebda940 100644
--- a/util/osdetect.lua
+++ b/util/osdetect.lua
@@ -42,7 +42,13 @@ function enum_device (device, fs, uuid)
   end
 
   root = "(" .. device .. ")/"
-  source = "root (" .. device .. ")\nchainloader +1"
+  source = "root=" .. device .. "\nchainloader +1"
+
+  local drive_num = string.match (device, "hd(%d+)")
+  if (drive_num ~= nil) and (drive_num ~= "0") then
+    source = source .. "\ndrivemap -s hd0 hd" .. drive_num
+  end
+
   title = nil
   if (grub.file_exist (root .. "bootmgr") and
       grub.file_exist (root .. "boot/bcd")) then
@@ -60,7 +66,7 @@ function enum_device (device, fs, uuid)
     title = "FreeDOS"
   elseif (grub.file_exist (root .. "boot/loader") and
 	  grub.file_exist (root .. "boot/device.hints")) then
-    source = "root (" .. device .. ")\nfreebsd /boot/loader" ..
+    source = "root=" .. device .. "\nfreebsd /boot/loader" ..
       "\nfreebsd_loadenv /boot/device.hints"
     title = "FreeBSD"
   else
@@ -71,8 +77,8 @@ function enum_device (device, fs, uuid)
 	local initrd
 
 	title = "Linux " .. kernels[i]
-	source = "root (" .. device ..
-	  ")\nlinux /boot/vmlinuz-" .. kernels[i] ..
+	source = "root=" .. device ..
+	  "\nlinux /boot/vmlinuz-" .. kernels[i] ..
 	  " root=UUID=" .. uuid .. " ro"
 
 	if grub.file_exist (root .. "boot/initrd-" ..
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to