Skip to contentSkip to conversation

osdetect.lua improvement

PATCH In review Bean 4 participants 4 messages Jul 11, 2009 – Dec 24, 2009

lore
Share & tools
lore

Bean

author
#0 lore raw

PATCH 1/1 osdetect.lua improvement

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 ?)

Signature · 1 line
Bean
util/osdetect.lua +10 -4
index 38a9099..ebda940 100644
@@ -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-" ..
#1 lore raw
Quoted 6 lines · Bean

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 ?)

Looks good to me. Actually, the logic should be changed so that we don't add "chainloader" and "drivemap" for Linux and FreeBSD, but it could be a separate patch.

What's really needed in osdetect.lua is elimination of partitions with invalid bootloader signatures. If the first sector doesn't end with 0x55 0xaa, the partition should not appear with the "chainloader" command.

For "Other OS", it would be nice to specify the partition in the menu title. Actually, maybe we should provide partitions for all names. Since osdetect.lua scans all drives, it would be nice to distinguish Linux 2.6.30 that boots Fedora from Linux 2.6.30 that boots SUSE.

Signature · 2 lines
Regards,
Pavel Roskin
#2 lore raw
In reply to Bean
Quoted 4 lines · Bean

Hi,

This patch would check for drive number and use drivemap to map disks, this is required to boot DOS/Windows from secondary drive.

Committed with exception for Vista (it neither needs nor supports drivemap). Thanks

Quoted 6 lines

------------------------------------------------------------------------

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#3 lore raw
Quoted 7 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 4 lines · Bean

Hi,

This patch would check for drive number and use drivemap to map disks, this is required to boot DOS/Windows from secondary drive.

Committed with exception for Vista (it neither needs nor supports drivemap). Thanks

Uhm it's a bit confusing to discuss grub-extras patches here. I wouldn't want to give the impression that the GRUB / grub-extras separation is just a "charade", since it has a purpose for legal reasons.

Should I create a new mailing list for grub-extras?

Signature · 3 lines
Robert Millan

  "Be the change you want to see in the world" -- Gandhi