Mailinglist Archive: yast-commit (953 mails)

< Previous Next >
[yast-commit] r49588 - in /trunk/bootloader/src: clients/ grub/ modules/ routines/
  • From: juhliarik@xxxxxxxxxxxxxxxx
  • Date: Fri, 01 Aug 2008 15:20:30 -0000
  • Message-id: <20080801152031.2DF112733A@xxxxxxxxxxxxxxxx>
Author: juhliarik
Date: Fri Aug 1 17:20:30 2008
New Revision: 49588

URL: http://svn.opensuse.org/viewcvs/yast?rev=49588&view=rev
Log:
added support for deleting devices from device.map


Modified:
trunk/bootloader/src/clients/bootloader_proposal.ycp
trunk/bootloader/src/grub/misc.ycp
trunk/bootloader/src/modules/BootCommon.ycp
trunk/bootloader/src/modules/BootGRUB.ycp
trunk/bootloader/src/modules/Bootloader.ycp
trunk/bootloader/src/routines/lilolike.ycp
trunk/bootloader/src/routines/misc.ycp
trunk/bootloader/src/routines/popups.ycp

Modified: trunk/bootloader/src/clients/bootloader_proposal.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/clients/bootloader_proposal.ycp?rev=49588&r1=49587&r2=49588&view=diff
==============================================================================
--- trunk/bootloader/src/clients/bootloader_proposal.ycp (original)
+++ trunk/bootloader/src/clients/bootloader_proposal.ycp Fri Aug 1 17:20:30
2008
@@ -89,6 +89,8 @@
// into our configuration
BootGRUB::merge_level = `main;
Bootloader::Propose ();
+
+
BootGRUB::merge_level = `none;
}
else
@@ -100,6 +102,26 @@

ret = $[ "raw_proposal" : Bootloader::Summary ()];

+
+ if (Bootloader::getLoaderType () == "grub")
+ {
+ import "BootGRUB";
+ if (BootGRUB::CheckDeviceMap())
+ {
+ ret = (map<string,any>) union (ret,
+ $[
+ "warning_level" : `blocker,
+ "warning" :
+ ret["warning"]:"" +
+ _("Configure a valid boot loader location before
continuing.<br>
+The device map includes more than 8 devices and the boot device is out of
range.
+The range is the first 8 devices by BIOS."),
+ ]
+ );
+ return ret;
+ }
+ }
+
//F#300779 - Install diskless client (NFS-root)
//kokso: bootloader will not be installed


Modified: trunk/bootloader/src/grub/misc.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/grub/misc.ycp?rev=49588&r1=49587&r2=49588&view=diff
==============================================================================
--- trunk/bootloader/src/grub/misc.ycp (original)
+++ trunk/bootloader/src/grub/misc.ycp Fri Aug 1 17:20:30 2008
@@ -23,6 +23,7 @@
import "Mode";
import "BootCommon";
import "PackageSystem";
+ import "Map";


// --------------------------------------------------------------
@@ -1115,6 +1116,72 @@
}


+/**
+ * FATE #303548 - Grub: limit device.map to devices detected by BIOS Int 13
+ * The function reduce record (devices) in device.map
+ * Grub doesn't support more than 8 devices in device.map
+ * There is selected the first 7 devices + boot or root device
+ * @param string boot device with udev id name
+ * @return boolean true if there was added boot device (disk) and it the 9th
or following disk in order
+ */
+global boolean ReduceDeviceMapTo8(string boot_dev, string boot_dev_mountby)
+{
+ boolean result = false;
+
+ if (size(BootCommon::device_mapping)>8)
+ {
+ result = true;
+ list <string> bios_order = (list <string> )
Map::Values(BootCommon::device_mapping);
+ //delete all grub devices with order more than 9
+ bios_order = filter(string key, bios_order, {return (size(key) < 4);});
+ bios_order = lsort(bios_order);
+ y2debug("ordered values (grub devices): %1", bios_order);
+ map<string,string> inverse_device_map = $[];
+ map<string,string> new_device_map = $[];
+ y2milestone("Device map before reducing: %1",
BootCommon::device_mapping);
+ foreach(string key, string value, BootCommon::device_mapping,
+ {
+ inverse_device_map[value]=key;
+ });
+
+ y2debug("inverse_device_map: %1", inverse_device_map);
+ integer index = 0;
+ boolean boot_device_added = false;
+ foreach(string key, bios_order,
+ {
+ string device_name = inverse_device_map[key]:"";
+ if (index < 8)
+ {
+ y2debug("adding device: %1 with key: %2 and index is: %3",
device_name, key, index);
+ new_device_map[device_name]=key;
+ if ((device_name == boot_dev) || (device_name ==
boot_dev_mountby))
+ boot_device_added = true;
+ index = index + 1;
+ } else {
+ if (boot_device_added)
+ {
+ //new_device_map[device_name]=key;
+
+ y2milestone("Device map includes boot disk");
+ break;
+ } else {
+
+ y2error("Device map doesn't include boot disk");
+ result = true;
+ break;
+
+ }
+ }
+ });
+ BootCommon::device_mapping = new_device_map;
+ y2milestone("Device map with the first 7 device + boot device: %1",
BootCommon::device_mapping);
+ } else {
+ y2milestone("Device map includes less than 9 devices. It is not
reduced. device_map: %1", BootCommon::device_mapping);
+ }
+ return result;
+}
+
+
} //last "}"

/*

Modified: trunk/bootloader/src/modules/BootCommon.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootCommon.ycp?rev=49588&r1=49587&r2=49588&view=diff
==============================================================================
--- trunk/bootloader/src/modules/BootCommon.ycp (original)
+++ trunk/bootloader/src/modules/BootCommon.ycp Fri Aug 1 17:20:30 2008
@@ -184,6 +184,14 @@
*/
global boolean activate = false;

+
+/** FATE #303548 - Grub: limit device.map to devices detected by BIOS
+ * Ask user if he wants to edit again bootloader settings
+ * It is used if device.map is limited and "boot" disk is out of range
+ * The range is the first 8 devices
+ */
+global boolean ask_user = false;
+
/**
* Replace MBR with generic code after bootloader installation?
*/

Modified: trunk/bootloader/src/modules/BootGRUB.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootGRUB.ycp?rev=49588&r1=49587&r2=49588&view=diff
==============================================================================
--- trunk/bootloader/src/modules/BootGRUB.ycp (original)
+++ trunk/bootloader/src/modules/BootGRUB.ycp Fri Aug 1 17:20:30 2008
@@ -622,9 +622,8 @@
* @param flush boolean true to flush settings to the disk
* @return boolean true if success
*/
-global boolean Save (boolean clean, boolean init, boolean flush) {
-
-
+global boolean Save (boolean clean, boolean init, boolean flush)
+{
// check if windows is on second disk and add remap if it is necessary
// FATE #301994: Correct device mapping in case windows is installed on
the second HD
BootCommon::sections = checkWidnowsSection(BootCommon::sections);
@@ -846,6 +845,17 @@
];
}

+
+global boolean CheckDeviceMap()
+{
+ // FATE #303548 - Grub: limit device.map to devices detected by BIOS
+ string boot_disk = BootCommon::getBootDisk();
+ boolean ret = ReduceDeviceMapTo8(boot_disk,
BootCommon::DevToLabelUdevID(boot_disk));
+
+ return ret;
+
+}
+
} // EOF

/*

Modified: trunk/bootloader/src/modules/Bootloader.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/Bootloader.ycp?rev=49588&r1=49587&r2=49588&view=diff
==============================================================================
--- trunk/bootloader/src/modules/Bootloader.ycp (original)
+++ trunk/bootloader/src/modules/Bootloader.ycp Fri Aug 1 17:20:30 2008
@@ -560,6 +560,7 @@
y2milestone ("Reinitialize bootloader library before saving: %1",
reinit);
ret = blSave (true, reinit, true) && ret;
+
if (! ret)
y2error ("Error before configuration files saving finished");

@@ -684,7 +685,7 @@
dev = Storage::GetDiskPartition(BootCommon::BootPartitionDevice);
else
dev = Storage::GetDiskPartition(BootCommon::RootPartitionDevice);
- if (dev["disk"]:"" == "/dev/nfs")
+ if (dev["disk"]:"" == "/dev/nfs")
{
y2milestone("Bootloader::Write() -> Boot partition is nfs type,
bootloader will not be installed.");
return ret;

Modified: trunk/bootloader/src/routines/lilolike.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/lilolike.ycp?rev=49588&r1=49587&r2=49588&view=diff
==============================================================================
--- trunk/bootloader/src/routines/lilolike.ycp (original)
+++ trunk/bootloader/src/routines/lilolike.ycp Fri Aug 1 17:20:30 2008
@@ -1496,72 +1496,6 @@
return ret;
}

-/**
- * FATE #303548 - Grub: limit device.map to devices detected by BIOS Int 13
- * The function reduce record (devices) in device.map
- * Grub doesn't support more than 8 devices in device.map
- * There is selected the first 7 devices + boot or root device
- * @param string boot device with udev id name
- * @return boolean true if there was deleted any disks from device.map
- */
-global boolean ReduceDeviceMapTo8(string boot_dev)
-{
- boolean result = false;
-
- if (size(device_mapping)>8)
- {
- result = true;
- list <string> bios_order = (list <string> ) Map::Values(device_mapping);
- //delete all grub devices with order more than 9
- bios_order = filter(string key, bios_order, {return (size(key) < 4);});
- bios_order = lsort(bios_order);
- y2debug("ordered values (grub devices): %1", bios_order);
- map<string,string> inverse_device_map = $[];
- map<string,string> new_device_map = $[];
- y2milestone("Device map before reducing: %1", device_mapping);
- foreach(string key, string value, device_mapping,
- {
- inverse_device_map[value]=key;
- });
-
- y2debug("inverse_device_map: %1", inverse_device_map);
- integer index = 0;
- boolean boot_device_added = false;
- foreach(string key, bios_order,
- {
- string device_name = inverse_device_map[key]:"";
- if (index < 7)
- {
- y2debug("adding device: %1 with key: %2 and index is: %3",
device_name, key, index);
- new_device_map[device_name]=key;
- if (device_name == boot_dev)
- boot_device_added = true;
- index = index + 1;
- } else {
- if (boot_device_added)
- {
- new_device_map[device_name]=key;
- break;
- } else {
- if (haskey(device_mapping, boot_dev))
- {
- new_device_map[boot_dev]=device_mapping[boot_dev]:"";
- break;
- } else {
-
- y2error("Boot disk device: %1 was not found in
device_mapping: %2", boot_dev, device_mapping);
- break;
- }
- }
- }
- });
- device_mapping = new_device_map;
- y2milestone("Device map with the first 7 device + boot device: %1",
device_mapping);
- } else {
- y2milestone("Device map includes less than 9 devices. It is not
reduced. device_map: %1", device_mapping);
- }
- return result;
-}

} // EOF


Modified: trunk/bootloader/src/routines/misc.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/misc.ycp?rev=49588&r1=49587&r2=49588&view=diff
==============================================================================
--- trunk/bootloader/src/routines/misc.ycp (original)
+++ trunk/bootloader/src/routines/misc.ycp Fri Aug 1 17:20:30 2008
@@ -1701,5 +1701,38 @@

}

+/** FATE #303548 - Grub: limit device.map to devices detected by BIOS Int 13
+ * Function select boot device - disk
+ *
+ * @return string name of boot device - disk
+ */
+
+global string getBootDisk()
+{
+ string boot_device = "";
+ if (BootCommon::BootPartitionDevice != "")
+ boot_device = BootCommon::BootPartitionDevice;
+ else if (BootCommon::RootPartitionDevice != "")
+ boot_device = BootCommon::RootPartitionDevice;
+
+ if (boot_device == "")
+ {
+ y2milestone("BootPartitionDevice and RootPartitionDevice are
empty");
+ return boot_device;
+ }
+ map p_dev = Storage::GetDiskPartition (boot_device);
+
+ string boot_disk_device = p_dev["disk"]:"";
+
+ if ((boot_disk_device != "") && (boot_disk_device != nil))
+ {
+ y2milestone("Boot device - disk: %1", boot_disk_device);
+ return boot_disk_device;
+ }
+
+ y2milestone("Finding boot disk failed!");
+ return "";
+}
+

} //end of include

Modified: trunk/bootloader/src/routines/popups.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/popups.ycp?rev=49588&r1=49587&r2=49588&view=diff
==============================================================================
--- trunk/bootloader/src/routines/popups.ycp (original)
+++ trunk/bootloader/src/routines/popups.ycp Fri Aug 1 17:20:30 2008
@@ -257,6 +257,7 @@
"));
}

+
/**
* Display popup
*/

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages