Author: odabrunz
Date: Tue Jul 10 22:37:55 2007
New Revision: 39303
URL: http://svn.opensuse.org/viewcvs/yast?rev=39303&view=rev
Log:
- GRUB only: integrated the new boot_*, generic_mbr and activate
keys (found in the "globals" map) from the new
widget/perl-Bootloader interface into the internal workings of
the grub code
- for grub, this obsoletes the global variables loader_device,
selected_location (aka loader_location), repl_mbr and activate
- fixes loosing the information of multiple selected bootloader
installation devices (#245680)
- fixes faulty detection of user-changes to the "/boot" and "/"
devices from yast2-storage (#247852)
- decided that boot_mbr_md key is unneeded, because the decision
to write to the MBRs of all underlying devices of a soft-RAID
is automatic (kept commented-out sample code for boot_mbr_md)
- decided that boot_extended is unneeded, because the decision to
write the bootloader to the extended partition instead of to an
un-activatable "/boot" or "/" partition is automatic (kept
commented-out sample code for boot_extended)
- removed wrapper code for variable translation from
BootGRUB::Propose()
- made private copies of functions in grub/misc.ycp and changed
the code to use the new interface variables only (this is also
wanted for better code separation between bootloaders, to
reduce amount of special-case handling (to be worked on)):
* from routines/misc.ycp:
grub_getPartitionToActivate ()
grub_getPartitionsToActivate ()
grub_getMbrsToRewrite ()
grub_getFileChangeDate ()
grub_saveMBR ()
grub_updateMBR ()
grub_DetectDisks ()
* from routines/lilolike.ycp:
grub_ProposeDeviceMap ()
( ^^ really needed? no changes here, it just "belongs"
to grub...)
grub_ConfigureLocation()
grub_DetectDisks ()
grub_DisksChanged ()
grub_LocationProposal ()
- added helper functions:
grub/misc.ycp: SetBootloaderDevice()
routines/misc.ycp: GetBootloaderDevices()
- added note to to-be-phased-out functions:
routines/misc.ycp: GetBootloaderDevice()
- made some functions globally accessible:
routines/popup.ycp: askLocationResetPopup ()
routines/misc.ycp: myToInteger ()
routines/lilolike.ycp: FindMBRDisk ()
- fixed bug with the detection of MD-RAID devices (both in
grub_getPartitionToActivate and getPartitionToActivate): BIOS
ID was assumed to be less than 128, but it starts at 128
- commented out some obsolete and broken code that would activate
the "/boot" device on installation of the bootloader to MBR;
the code was cancelled out by program logic ("activate" flag)
though;
this also simplified the interface to getPartitionToActivate ()
- added conditionals to Bootloader.ycp and BootCommon.ycp: do not
handle obsolete variables for grub
- commented out probably obsolete code in BootGRUB::Read() to
determine old_style loader_device from read devices (including
old-style "mbr_md")
- added several FIXME:s
- changed a fixed FIXME to FIXED
- when reading settings from the system: convert custom boot device
names in globals to the kernel device names (#248162)
- corrected whitespace in grub/helps.ycp and ppc/helps.ycp
Modified:
trunk/bootloader/src/grub/helps.ycp
trunk/bootloader/src/grub/misc.ycp
trunk/bootloader/src/modules/BootCommon.ycp
trunk/bootloader/src/modules/BootGRUB.ycp
trunk/bootloader/src/modules/BootPOWERLILO.ycp
trunk/bootloader/src/modules/Bootloader.ycp
trunk/bootloader/src/ppc/helps.ycp
trunk/bootloader/src/routines/autoinstall.ycp
trunk/bootloader/src/routines/lilolike.ycp
trunk/bootloader/src/routines/misc.ycp
trunk/bootloader/src/routines/popups.ycp
Modified: trunk/bootloader/src/grub/helps.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/grub/helps.ycp?rev=39303&r1=39302&r2=39303&view=diff
==============================================================================
--- trunk/bootloader/src/grub/helps.ycp (original)
+++ trunk/bootloader/src/grub/helps.ycp Tue Jul 10 22:37:55 2007
@@ -128,44 +128,44 @@
global map grub_descriptions = $[
"boot" : _("Boot Loader Locations"),
"activate" : _("Set active Flag in Partition Table for Boot Partition"),
- "timeout" : _("Timeout in Seconds"),
- "default" : _("Default Boot Section"),
- "generic_mbr" : _("Write generic Boot Code to MBR"),
- "boot_custom" : _("Custom Boot Partition"),
- "boot_mbr" : _("Boot from Master Boot Record"),
- "boot_root" : _("Boot from Root Partition"),
- "boot_boot" : _("Boot from Boot Partition"),
- "serial" : _("Serial Connection Parameters"),
- "terminal" : _("Terminal Definition"),
- "fallback" : _("Fallback Sections if default Fails"),
- "hiddenmenu" : _("Hide Menu on Boot"),
- "gfxmenu" : _("Graphical Menu File"),
- "password" : _("Password for the Menu Interface"),
- "debug" : _("Debugging Flag"),
- "type_image" : _("Image Section"),
- "image_image" : _("Kernel Image"),
- "image_root" : _("Root Device"),
- "image_vgamode" : _("Vga Mode"),
- "image_append" : _("Optional Kernel Command Line Parameter"),
- "image_initrd" : _("Initial RAM Disk"),
- "image_noverifyroot" : _("Do not verify Filesystem before Booting"),
+ "timeout" : _("Timeout in Seconds"),
+ "default" : _("Default Boot Section"),
+ "generic_mbr" : _("Write generic Boot Code to MBR"),
+ "boot_custom" : _("Custom Boot Partition"),
+ "boot_mbr" : _("Boot from Master Boot Record"),
+ "boot_root" : _("Boot from Root Partition"),
+ "boot_boot" : _("Boot from Boot Partition"),
+ "serial" : _("Serial Connection Parameters"),
+ "terminal" : _("Terminal Definition"),
+ "fallback" : _("Fallback Sections if default Fails"),
+ "hiddenmenu" : _("Hide Menu on Boot"),
+ "gfxmenu" : _("Graphical Menu File"),
+ "password" : _("Password for the Menu Interface"),
+ "debug" : _("Debugging Flag"),
+ "type_image" : _("Image Section"),
+ "image_image" : _("Kernel Image"),
+ "image_root" : _("Root Device"),
+ "image_vgamode" : _("Vga Mode"),
+ "image_append" : _("Optional Kernel Command Line Parameter"),
+ "image_initrd" : _("Initial RAM Disk"),
+ "image_noverifyroot" : _("Do not verify Filesystem before Booting"),
"type_other" : _("Chainloader Section"),
- "other_lock" : _("Use Password Protection"),
- "other_chainloader" : _("Other System"),
+ "other_lock" : _("Use Password Protection"),
+ "other_chainloader" : _("Other System"),
"other_noverifyroot" : _("Do not verify Filesystem before Booting"),
- "other_makeactive" : _("Activate this Partition when selected for Boot"),
- "other_blockoffset" : _("Block Offset for Chainloading"),
- "type_xen" : _("Xen Section"),
- "xen_xen" : _("Hypervisor"),
- "xen_xen_append" : _("Additional Xen Hypervisor Parameters"),
- "xen_image" : _("Kernel Image"),
- "xen_root" : _("Root Device"),
+ "other_makeactive" : _("Activate this Partition when selected for Boot"),
+ "other_blockoffset" : _("Block Offset for Chainloading"),
+ "type_xen" : _("Xen Section"),
+ "xen_xen" : _("Hypervisor"),
+ "xen_xen_append" : _("Additional Xen Hypervisor Parameters"),
+ "xen_image" : _("Kernel Image"),
+ "xen_root" : _("Root Device"),
"xen_vgamode" : _("Vga Mode"),
- "xen_append" : _("Optional Kernel Command Line Parameter"),
- "xen_initrd" : _("Initial RAM Disk"),
- "type_menu" : _("Menu Section"),
- "menu_root" : _("Partition of Menu File"),
- "menu_configfile" : _("Menu Description File"),
+ "xen_append" : _("Optional Kernel Command Line Parameter"),
+ "xen_initrd" : _("Initial RAM Disk"),
+ "type_menu" : _("Menu Section"),
+ "menu_root" : _("Partition of Menu File"),
+ "menu_configfile" : _("Menu Description File"),
];
Modified: trunk/bootloader/src/grub/misc.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/grub/misc.ycp?rev=39303&r1=39302&r2=39303&view=diff
==============================================================================
--- trunk/bootloader/src/grub/misc.ycp (original)
+++ trunk/bootloader/src/grub/misc.ycp Tue Jul 10 22:37:55 2007
@@ -21,91 +21,929 @@
import "StorageDevices";
import "Mode";
import "BootCommon";
+ import "PackageSystem";
+
+
+// --------------------------------------------------------------
+// --------------------------------------------------------------
+// updateMBR and related stuff (taken from routines/misc.ycp)
/**
- * Propose whether allow or not embedding of 1.5 stage
- * @return boolean true to allow
- */
- define boolean allowEmbed15 () {
- // allow only for /boot or /root device selected
- if (! (BootCommon::loader_device == BootCommon::BootPartitionDevice
- || BootCommon::loader_device == BootCommon::RootPartitionDevice
- || BootCommon::loader_device == BootCommon::mbrDisk
- ))
- {
- return false;
- }
- // check filesystem on /boot for Reiserfs and JFS
- map mp = Storage::GetMountPoints ();
- list bp_info
- = mp["/boot"]:mp["/"]:[];
- list<map> partitions
- = Storage::GetTargetMap ()[bp_info[2]:"", "partitions"]:[];
- boolean ret = false;
- foreach (map p, partitions, {
- if (p["device"]:"" == BootCommon::BootPartitionDevice)
- {
- symbol fs = (symbol)p["used_fs"]:nil;
- if (fs == `reiser || fs == `jfs)
- ret = true;
- }
- });
- return ret;
- }
-
- /**
- * Encrypt the password before storing it in variables
- * @param passwd string unencrypted password
- * @return string password in the form to write to GRUB's menu.lst
+ * Given a device name to which we install the bootloader (loader_device),
+ * get the name of the partition which should be activated.
+ * Also return the device file name of the disk device that corresponds to
+ * loader_device (i.e. where the corresponding MBR can be found).
+ * @param loader_device string the device to install bootloader to
+ * @return a map $[ "dev" : string, "mbr": string, "num": any]
+ * containing device (eg. "/dev/hda4"), disk (eg. "/dev/hda") and
+ * partition number (eg. 4)
+ */
+// * @param boot_partition string the partition holding /boot subtree
+// map getPartitionToActivate (string boot_partition,
+// string loader_device)
+ map grub_getPartitionToActivate (string loader_device)
+ {
+ map p_dev = Storage::GetDiskPartition (loader_device);
+ integer num = BootCommon::myToInteger( p_dev["nr"]:nil );
+ string mbr_dev = p_dev["disk"]:"";
+
+ // If loader_device is /dev/md* (which means bootloader is installed to
+ // /dev/md*), return the info map for the first device in BIOS ID order
+ // that underlies the soft-RAID and that has a BIOS ID (devices without
+ // BIOS ID are excluded).
+ // If no device is found in this way, return the info map for the
+ // soft-RAID device ("/dev/md", "/dev/md[0-9]*").
+ // FIXME: use ::storage to detect md devices, not by name!
+ // FIXME: return info for ALL underlying soft-RAID devices here, so
+ // that all MBRs can be backed-up and all partitions that need to be
+ // activated can be activated. This requires a map