YaST2 Developers Documentation: Bootloader installation and configuration

Bootloader installation and configuration

modules/BootStorage.ycp
Module includes specific functions for handling storage data. The idea is handling all storage data necessary for bootloader in one module.
  • Jozef Uhliarik

This module has an unstable interface.

Imports

  • Arch
  • Mode
  • Storage
  • StorageDevices

Global Variables

Global Functions

Local Variables

Local Functions

global disk_change_time_InitBootloader -> integer

Saved change time from target map - only for MapAllPartitions()

global disk_change_time_MapAllPartitions -> integer

Saved change time from target map - only for MapAllPartitions()

global disk_change_time_checkCallingDiskInfo -> integer

Saved change time from target map - only for checkCallingDiskInfo()

global all_partitions -> map<string,map>

bnc #468922 - problem with longtime running the parsing a huge number of disks map the map of all partitions with info about it -> necessary for Dev2MountByDev() in routines/misc.ycp

local target_map -> map<string,map>

bnc #468922 - problem with longtime running the parsing a huge number of disks map target map try to minimalize calling Storage::GetTargetMap()

global all_devices -> map<string, string>

mapping all devices udev-name to kernel name importnat for init fucntion of perl-Bootloader

local storage_initialized -> boolean

Storage locked

global multipath_mapping -> map<string,string>

device mapping between real devices and multipath

global mountpoints -> map<string,any>

mountpoints for perl-Bootloader

global partinfo -> list<list>

list of all partitions for perl-Bootloader

global md_info -> map<string,list<string> >

information about MD arrays for perl-Bootloader

global bois_id_missing -> boolean

Flag indicates that bios_id_missing in disk true if missing false if at least one disk has bios_id

global device_mapping -> map<string,string>

device mapping between Linux and firmware

global BootPartitionDevice -> string

string sepresenting device name of /boot partition same as RootPartitionDevice if no separate /boot partition

global RootPartitionDevice -> string

string representing device name of / partition

global ExtendedPartitionDevice -> string

string representing device name of extended partition

global floppy_devices -> list<string>

list of installed floppy devices

global InitMapDevices () -> boolean

Init and fullfil internal data for perl-Bootloader

Return value:
true if init reset/fullfil data or false and used cached data
local MapAllPartitions () -> boolean

bnc #468922 - problem with longtime running the parsing a huge number of disks Function initialize all_partitions only if storage change partitioning of disk true if init all_partitions

local checkCallingDiskInfo () -> boolean

Check if function was called or storage change partitionig of disk. It is usefull fo using cached data about disk. Data is send to perl-Bootloader and it includes info about partitions, multi path and md-raid

Return value:
false if it is posible use cached data
global InitDiskInfo () -> void

Function init data for perl-Bootloader about disk It means fullfil md_info, multipath_mapping, partinfo and mountpoints

local isHd0 (list<string> devices) -> boolean

Returns true if any device from list devices is in device_mapping marked as hd0.

Parameters:
devices
local getKey (string value, map<string, string> mapping) -> string

Returns first key from mapping associated with value. Example: map = $[ "a" : "1", "b" : "2", "c" : "3", "d" : "2"]; getDeviceFromMapping("1", map) -> "a" getDeviceFromMapping("2", map) -> "b"

Parameters:
value
mapping
local changeOrderInDeviceMapping (list<string> bad_devices) -> void

This function changes order of devices in device_mapping. All devices listed in bad_devices are maped to "hdN" are moved to the end (with changed number N). And second step is putting device with boot partition on top (i.e. device_mapping[dev_with_boot] = "hd0").

Example: device_mapping = $[ "/dev/sda" : "hd0", "/dev/sdb" : "hd1", "/dev/sdc" : "hd2", "/dev/sdd" : "hd3", "/dev/sde" : "hd4" ]; bad_devices = [ "/dev/sda", "/dev/sdc" ];

Parameters:
bad_devices
local checkMDRaidDevices (list<string> devices, map<string,map> tm) -> boolean

Check if MD raid is build on disks not on paritions

Parameters:
devices - list of devices from MD raid
tm - unfiltered target map
Return value:
- true if MD RAID is build on disks (not on partitions)
local isDiskInList (string disk, list<string> devices) -> boolean

Function check if disk is in list of devices

Parameters:
disk
devices
Return value:
true if success
local isDiskInMDRaid (string disk, map<string,map> tm) -> boolean

Check if disk is in MDRaid it means completed disk is used in RAID

Parameters:
disk (/dev/sda)
tm - target map
Return value:
- true if disk (not only part of disk) is in MDRAID
Info:

Generate device map proposal, store it in internal variables.

FATE #302075: When user is installing from USB media or any non IDE disk or bios simply set any non IDE disk as first and user is not installing on this removable (non IDE) disk, the order of disks proposed by bios must be changed because of future remove of USB disk. This function must find right place for bootloader (which is most probably boot sector of boot partition (where /boot dir is located)) and change the order of disks in device map. This method is only heuristic because order of disks after remove of usb disk can't be determined by any method.

global DisksOrder () -> list<string>

Get the order of disks according to BIOS mapping

Return value:
a list of all disks in the order BIOS sees them
global remapDeviceMap (map<string,string> device_map) -> map<string,string>

Function remap device map to device name (/dev/sda) or to label (ufo_disk)

Parameters:
device_map
Return value:
new device map
global getFloppyDevices () -> list<string>

Get the list of installed floppy drives

Return value:
a list of floppy devices
global getHintedPartitionList (list<string> parts_to_get) -> list<string>

Returns list of partitions with "mount by" hints. Goes through the list of partitions passed as a parameter and creates a list of partitions with hints according to the current partitioning requested from yast2-storage. To be used in a combobox or menu.

Parameters:
parts_to_get list partitions to list
Return value:
a list of strings containing a partition name and a hint (if applicable)
global getPartitionList (symbol type, string bl) -> list<string>

Returns list of partitions. Requests current partitioning from yast2-storage and creates list of partition for combobox, menu or other purpose.

Parameters:
type symbol `boot - for bootloader installation `root - for kernel root `boot_other - for bootable partitions of other systems `all - all partitions `parts_old - all partitions, except those what will be created during isntallation `deleted - all partitions deleted in current proposal `kept - all partitions that won't be deleted, new created or formatted `destroyed - all partition which are new, deleted or formatted
bl
Return value:
a list of strings