kiwi.bootloader.config Package

Submodules

kiwi.bootloader.config.base Module

class kiwi.bootloader.config.base.BootLoaderConfigBase(xml_state, root_dir, custom_args=None)[source]

Bases: object

Base class for bootloader configuration

Parameters:
  • xml_state (object) – instance of XMLState
  • root_dir (string) – root directory path name
  • custom_args (dict) – custom bootloader arguments dictionary
create_efi_path(in_sub_dir='boot/efi')[source]

Create standard EFI boot directory structure

Parameters:in_sub_dir (string) – toplevel directory
Returns:Full qualified EFI boot path
Return type:str
failsafe_boot_entry_requested()[source]

Check if a failsafe boot entry is requested

Returns:True or False
Return type:bool
get_boot_cmdline(uuid=None)[source]

Boot commandline arguments passed to the kernel

Parameters:uuid (string) – boot device UUID
Returns:kernel boot arguments
Return type:str
get_boot_path(target='disk')[source]

Bootloader lookup path on boot device

If the bootloader reads the data it needs to boot, it does that from the configured boot device. Depending if that device is an extra boot partition or the root partition or or based on a non standard filesystem like a btrfs snapshot, the path name varies

Parameters:target (string) – target name: disk|iso
Returns:path name
Return type:str
get_boot_theme()[source]

Bootloader Theme name

Returns:theme name
Return type:str
get_boot_timeout_seconds()[source]

Bootloader timeout in seconds

If no timeout is specified the default timeout applies

Returns:timeout seconds
Return type:int
get_continue_on_timeout()[source]

Check if the boot should continue after boot timeout or not

Returns:True or False
Return type:bool
get_gfxmode(target)[source]

Graphics mode according to bootloader target

Bootloaders which support a graphics mode can be configured to run graphics in a specific resolution and colors. There is no standard for this setup which causes kiwi to create a mapping from the kernel vesa mode number to the corresponding bootloader graphics mode setup

Parameters:target (string) – bootloader name
Returns:boot graphics mode
Return type:str
get_install_image_boot_default(loader=None)[source]

Provide the default boot menu entry identifier for install images

The install image can be configured to provide more than one boot menu entry. Menu entries configured are:

  • [0] Boot From Hard Disk
  • [1] Install
  • [2] Failsafe Install

The installboot attribute controlls which of these are used by default. If not specified the boot from hard disk entry will be the default. Depending on the specified loader type either an entry number or name will be returned.

Parameters:loader (string) – bootloader name
Returns:menu name or id
Return type:str
get_menu_entry_install_title()[source]

Prefixed menu entry title for install images

If no displayname is specified in the image description, the menu title is constructed from the image name

Returns:title text
Return type:str
get_menu_entry_title(plain=False)[source]

Prefixed menu entry title

If no displayname is specified in the image description, the menu title is constructed from the image name and build type

Parameters:plain (bool) – indicate to add built type into title text
Returns:title text
Return type:str
post_init(custom_args)[source]

Post initialization method

Store custom arguments by default

Parameters:custom_args (dict) – custom bootloader arguments
quote_title(name)[source]

Quote special characters in the title name

Not all characters can be displayed correctly in the bootloader environment. Therefore a quoting is required

Parameters:name (string) – title name
Returns:quoted text
Return type:str
setup_disk_boot_images(boot_uuid, lookup_path=None)[source]

Create bootloader images for disk boot

Some bootloaders requires to build a boot image the bootloader can load from a specific offset address or from a standardized path on a filesystem.

Parameters:
  • boot_uuid (string) – boot device UUID
  • lookup_path (string) – custom module lookup path

Implementation in specialized bootloader class required

setup_disk_image_config(boot_uuid, root_uuid, hypervisor, kernel, initrd, boot_options)[source]

Create boot config file to boot from disk.

Parameters:
  • boot_uuid (string) – boot device UUID
  • root_uuid (string) – root device UUID
  • hypervisor (string) – hypervisor name
  • kernel (string) – kernel name
  • initrd (string) – initrd name
  • boot_options (string) – kernel options as string

Implementation in specialized bootloader class required

setup_install_boot_images(mbrid, lookup_path=None)[source]

Create bootloader images for ISO boot an install media

Parameters:
  • mbrid (string) – mbrid file name on boot device
  • lookup_path (string) – custom module lookup path

Implementation in specialized bootloader class required

setup_install_image_config(mbrid, hypervisor, kernel, initrd)[source]

Create boot config file to boot from install media in EFI mode.

Parameters:
  • mbrid (string) – mbrid file name on boot device
  • hypervisor (string) – hypervisor name
  • kernel (string) – kernel name
  • initrd (string) – initrd name

Implementation in specialized bootloader class required

setup_live_boot_images(mbrid, lookup_path=None)[source]

Create bootloader images for ISO boot a live ISO image

Parameters:
  • mbrid (string) – mbrid file name on boot device
  • lookup_path (string) – custom module lookup path

Implementation in specialized bootloader class required

setup_live_image_config(mbrid, hypervisor, kernel, initrd)[source]

Create boot config file to boot live ISO image in EFI mode.

Parameters:
  • mbrid (string) – mbrid file name on boot device
  • hypervisor (string) – hypervisor name
  • kernel (string) – kernel name
  • initrd (string) – initrd name

Implementation in specialized bootloader class required

setup_sysconfig_bootloader()[source]

Create or update etc/sysconfig/bootloader by parameters required according to the bootloader setup

Implementation in specialized bootloader class required

write()[source]

Write config data to config file.

Implementation in specialized bootloader class required

kiwi.bootloader.config.grub2 Module

class kiwi.bootloader.config.grub2.BootLoaderConfigGrub2(xml_state, root_dir, custom_args=None)[source]

Bases: kiwi.bootloader.config.base.BootLoaderConfigBase

grub2 bootloader configuration.

post_init(custom_args)[source]

grub2 post initialization method

Parameters:custom_args (dict) –

Contains grub config arguments

{‘grub_directory_name’: ‘grub|grub2’}
setup_disk_boot_images(boot_uuid, lookup_path=None)[source]

Create/Provide grub2 boot images and metadata

In order to boot from the disk grub2 modules, images and theme data needs to be created and provided at the correct place in the filesystem

Parameters:
  • boot_uuid (string) – boot device UUID
  • lookup_path (string) – custom module lookup path
setup_disk_image_config(boot_uuid, root_uuid, hypervisor='xen.gz', kernel='linux.vmx', initrd='initrd.vmx', boot_options='')[source]

Create the grub.cfg in memory from a template suitable to boot from a disk image

Parameters:
  • boot_uuid (string) – boot device UUID
  • root_uuid (string) – root device UUID
  • hypervisor (string) – hypervisor name
  • kernel (string) – kernel name
  • initrd (string) – initrd name
  • boot_options (string) – kernel options as string
setup_install_boot_images(mbrid, lookup_path=None)[source]

Create/Provide grub2 boot images and metadata

In order to boot from the ISO grub2 modules, images and theme data needs to be created and provided at the correct place on the iso filesystem

Parameters:
  • mbrid (string) – mbrid file name on boot device
  • lookup_path (string) – custom module lookup path
setup_install_image_config(mbrid, hypervisor='xen.gz', kernel='linux', initrd='initrd')[source]

Create grub2 config file to boot from an ISO install image

Parameters:
  • mbrid (string) – mbrid file name on boot device
  • hypervisor (string) – hypervisor name
  • kernel (string) – kernel name
  • initrd (string) – initrd name
setup_live_boot_images(mbrid, lookup_path=None)[source]

Create/Provide grub2 boot images and metadata

Calls setup_install_boot_images because no different action required

setup_live_image_config(mbrid, hypervisor='xen.gz', kernel='linux', initrd='initrd')[source]

Create grub2 config file to boot a live media ISO image

Parameters:
  • mbrid (string) – mbrid file name on boot device
  • hypervisor (string) – hypervisor name
  • kernel (string) – kernel name
  • initrd (string) – initrd name
setup_sysconfig_bootloader()[source]

Create or update etc/sysconfig/bootloader by the following parameters required according to the grub2 bootloader setup

  • LOADER_TYPE
  • LOADER_LOCATION
  • DEFAULT_APPEND
  • FAILSAFE_APPEND
write()[source]

Write grub.cfg and etc/default/grub file

kiwi.bootloader.config.isolinux Module

class kiwi.bootloader.config.isolinux.BootLoaderConfigIsoLinux(xml_state, root_dir, custom_args=None)[source]

Bases: kiwi.bootloader.config.base.BootLoaderConfigBase

isolinux bootloader configuration.

post_init(custom_args)[source]

isolinux post initialization method

Parameters:custom_args (dict) – custom isolinux config arguments
setup_install_boot_images(mbrid, lookup_path=None)[source]

Provide isolinux boot metadata

The mbrid parameter is not used, because only isolinux loader binary and possible theming files are copied

Parameters:
  • mbrid (string) – unused
  • lookup_path (string) – custom module lookup path
setup_install_image_config(mbrid, hypervisor='xen.gz', kernel='linux', initrd='initrd')[source]

Create isolinux.cfg in memory from a template suitable to boot from an ISO image in BIOS boot mode

Parameters:
  • mbrid (string) – mbrid file name on boot device
  • hypervisor (string) – hypervisor name
  • kernel (string) – kernel name
  • initrd (string) – initrd name
setup_live_boot_images(mbrid, lookup_path=None)[source]

Provide isolinux boot metadata

Calls setup_install_boot_images because no different action required

setup_live_image_config(mbrid, hypervisor='xen.gz', kernel='linux', initrd='initrd')[source]

Create isolinux.cfg in memory from a template suitable to boot a live system from an ISO image in BIOS boot mode

Parameters:
  • mbrid (string) – mbrid file name on boot device
  • hypervisor (string) – hypervisor name
  • kernel (string) – kernel name
  • initrd (string) – initrd name
write()[source]

Write isolinux.cfg and isolinux.msg file

kiwi.bootloader.config.zipl Module

class kiwi.bootloader.config.zipl.BootLoaderConfigZipl(xml_state, root_dir, custom_args=None)[source]

Bases: kiwi.bootloader.config.base.BootLoaderConfigBase

zipl bootloader configuration.

post_init(custom_args)[source]

zipl post initialization method

Parameters:custom_args (dict) –

Contains zipl config arguments

{‘targetbase’: ‘device_name’}
setup_disk_boot_images(boot_uuid, lookup_path=None)[source]

On s390 no bootloader images needs to be created

Thus this method does nothing

Parameters:
  • boot_uuid (string) – boot device UUID
  • lookup_path (string) – custom module lookup path
setup_disk_image_config(boot_uuid=None, root_uuid=None, hypervisor=None, kernel='linux.vmx', initrd='initrd.vmx', boot_options='')[source]

Create the zipl config in memory from a template suitable to boot from a disk image.

Parameters:
  • boot_uuid (string) – unused
  • root_uuid (string) – unused
  • hypervisor (string) – unused
  • kernel (string) – kernel name
  • initrd (string) – initrd name
  • boot_options (string) – kernel options as string
write()[source]

Write zipl config file

Module Contents

class kiwi.bootloader.config.BootLoaderConfig[source]

Bases: object

BootLoaderConfig factory

Parameters:
  • name (string) – bootloader name
  • xml_state (object) – instance of XMLState
  • root_dir (string) – root directory path name
  • custom_args (dict) – custom bootloader config arguments dictionary