YaST2 Developers Documentation: Bootloader installation and configuration

Bootloader installation and configuration

include/bootloader/routines/misc-common.ycp
Miscelaneous functions for bootloader configuration and installation
  • Jiri Srain
  • Olaf Dabrunz

This module has an unstable interface.

WARNING: To be included to BootCommon.ycp only, requires function getLoaderType to avoid include-import cycle Use import "BootCommon" instead.

Imports

  • Directory
  • FileUtils
  • FileUtils
  • Installation
  • Kernel
  • Misc
  • Mode
  • ProductFeatures
  • Report
  • Stage
  • Storage
  • StorageDevices
  • String

Global Functions

Local Functions

global getLoaderName (string bootloader, symbol mode) -> string

return printable name of bootloader

Parameters:
bootloader string bootloader type internal string
mode symbol `combo or `summary (because of capitalization)
Return value:
printable bootloader name
global getBooleanAttrib (string attrib) -> boolean

Get value of specified boolean bootloader attribute

Parameters:
attrib string attribute name
Return value:
value of attribute
global getAnyTypeAttrib (string attrib, any defaultv) -> any

Get value of specified bootloader attribute

Parameters:
attrib string attribute name
defaultv any default value of the attribute (if not found)
Return value:
value of attribute
global updateTimeoutPopupForFloppy (string bootloader) -> void

Update the text of countdown widget

Parameters:
bootloader string printable name of used bootloader
global remapGlobals (map<string,string> globals_set) -> map<string,string>

Function remap globals settings "boot_custom" device name (/dev/sda) or to label (ufo_partition)

Parameters:
globals_set
Return value:
globals
local remapResume (string append, boolean to_persistent) -> string

Function remap "resume" from section (append) to device name (/dev/sda) or to label (ufo_partition)

Parameters:
append
to_persistent
Return value:
sections
global remapSections (list<map<string,any> > sec) -> list<map<string,any> >

Function remap section "root" and "resume" to device name (/dev/sda) or to label (ufo_partition) it also prepared measured files for export

Parameters:
sec
Return value:
list of sections
global isBlank (string s) -> boolean

returns true if char is blank (newline, tab or space)

Parameters:
s single char string
Return value:
blank/non blank
local difflist (list a, list b) -> list

returns list difference A \ B (items that are in A and are not in B)

Parameters:
a list A
b list B
Return value:
see above
global splitPath (string fullpth) -> list<string>

translate filename path (eg. /boot/kernel) to list of device and relative path

Parameters:
fullpth string fileststem path (eg. /boot/vmlinuz)
Return value:
a list containing device and relative path, eg. ["/dev/hda1", "/vmlinuz"]
global GetBootloaderDevice () -> string

Get bootloader device for specified location FIXME: this function is being phased out. Keeping it around until selected_location and loader_device can be dropped for all bootloader types.

Return value:
device name
global GetBootloaderDevices () -> list<string>

Get list of bootloader device names for all selected or specified locations

Return value:
device names
global IsPartitionBootable (string device) -> boolean

Check if the PBR of the given partition seems to contain a known boot block

Parameters:
device string partition device to check
Return value:
true if the PBR seems to contain a known boot block
global InstallingToFloppy () -> boolean

Check if installation to floppy is performed

Return value:
true if installing bootloader to floppy
local ListKernelParamsInLine (string line) -> list<string>

Get the list of particular kernel parameters

Parameters:
line string the whole kernel command line
Return value:
a list of the kernel parameters split each separaterlly
global getKernelParamFromLine (string line, string key) -> string

get kernel parameter from kernel command line

Parameters:
line string original line
key string parameter key
Return value:
value, "false" if not present, "true" if present key without value
Info:

set kernel parameter to GRUB command line

Parameters:
key string parameter key
line string original line
value string value, "false" to remove key, "true" to add key without value
Return value:
new kernel command line
local getPartitionToActivate (string boot_partition, string loader_device) -> map<string,any>

Get partition which should be activated if doing it during bl inst.

Parameters:
boot_partition string the partition holding /boot subtree
loader_device string the device to install bootloader to
Return value:
a map $[ "dev" : string, "mbr": string, "num": any] containing device (eg. "/dev/hda4"), disk (eg. "/dev/hda") and partition number (eg. 4)
local getPartitionsToActivate () -> list<map<string, any> >

Get a list of partitions to activate if user wants to activate boot partition

Return value:
a list of partitions to activate
local getMbrsToRewrite () -> list<string>

Get the list of MBR disks that should be rewritten by generic code if user wants to do so

Return value:
a list of device names to be rewritten
local getFileChangeDate (string filename) -> string

Get last change time of file

Parameters:
filename string name of file
Return value:
last change date as YYYY-MM-DD-HH-MM-SS
local saveMBR (string device) -> void

Save current MBR to /boot/backup_mbr Also save to /var/lib/YaST2/backup_boot_sectors/%device, if some existing, rename it

Parameters:
device string name of device
global updateMBR () -> boolean

Update contents of MBR (active partition and booting code) FIXME move tis function to lilolike.ycp

Return value:
true on success
global restoreMBR (string device) -> boolean

Rewrite current MBR with /var/lib/YaST2/backup_boot_sectors/%device Warning!!! don't use for bootsectors, 440 bytes of sector are written

Parameters:
device string device to rewrite MBR to
Return value:
true on success
global UpdateKernelParams (string orig) -> string

Update kernel parameters if some were added in Kernel module

Parameters:
orig original kernel parameters or kernel command line
Return value:
kernel command line or parameters with added new parameters
global getSwapPartitions () -> map<string, integer>

Get map of swap partitions

Return value:
a map where key is partition name and value its size
global translateSectionTitle (string orig) -> string

Create translated name of a section

Parameters:
orig string original section name
Return value:
translated section name
local IsMbr (string device) -> boolean

Check if device is MBR of a disk

Parameters:
device string device to check
Return value:
true if is MBR
local AddMbrToDescription (string descr, string device) -> string

Add '(MBR)' to the disk description if it is a MBR of some partition

Parameters:
descr string disk description
device string disk device
Return value:
updated description
global UpdateInstallationKernelParameters () -> void

Update the Kernel::vgaType value to the saved one if not defined

global GetAdditionalFailsafeParams () -> string

Get additional kernel parameters

Return value:
additional kernel parameters
global GetAdditionalKernelParams () -> string

Get additional kernel parameters from control file

Return value:
additional kernel parameters
global ListAdditionalKernelParams () -> list<string>

Get additional kernel parameters splitted to a list

Return value:
a list of additional kernel parameters
global UpdateGfxMenuContents () -> boolean

Update graphical bootloader to contain help text of current language And make the selected installation language default

Return value:
true on success
global UpdateDevice (string device) -> string

Update device name according to changes in kernel (eg. SATA)

Parameters:
device string the original device name
Return value:
updated device
global MemtestPresent () -> boolean

Check if memtest86 is present

Return value:
true if memtest86 section is to be proposed
global BootloaderInstallable () -> boolean

Check if the bootloader can be installed at all with current configuration

Return value:
true if it can
local abs (integer value) -> integer

Function return absolute value of arg

Parameters:
value
Return value:
absolute value
global getBootPartition () -> string

Function return boot device it means return boot partition or root partition if boot partition deosn't exist function return "" if boot partition or root partition is not defined (autoyast)

Return value:
name of boot device (partition)