kiwi.boot.image Package

Submodules

kiwi.boot.image.base Module

class kiwi.boot.image.base.BootImageBase(xml_state, target_dir, root_dir=None, signing_keys=None)[source]

Bases: object

Base class for boot image(initrd) task

Parameters
  • xml_state (object) – Instance of XMLState

  • target_dir (string) – target dir to store the initrd

  • root_dir (string) – system image root directory

  • signing_keys (list) – list of package signing keys

cleanup()[source]

Cleanup temporary boot image data if any

create_initrd(mbrid=None, basename=None, install_initrd=False)[source]

Implements creation of the initrd

Parameters
  • mbrid (object) – instance of ImageIdentifier

  • basename (string) – base initrd file name

  • install_initrd (bool) – installation media initrd

Implementation in specialized boot image class

dump(filename)[source]

Pickle dump this instance to a file. If the object dump is requested the destructor code will also be disabled in order to preserve the generated data

Parameters

filename (string) – file path name

get_boot_description_directory()[source]

Provide path to the boot image XML description

Returns

path name

Return type

str

get_boot_names()[source]

Provides kernel and initrd names for the boot image

Returns

Contains boot_names_type tuple

boot_names_type(
    kernel_name='INSTALLED_KERNEL',
    initrd_name='DRACUT_OUTPUT_NAME'
)

Return type

tuple

import_system_description_elements()[source]

Copy information from the system image relevant to create the boot image to the boot image state XML description

include_file(filename, install_media=False)[source]

Include file to boot image

For kiwi boot images this is done by adding package or archive definitions with the bootinclude attribute. Thus for kiwi boot images the method is a noop

Parameters
  • filename (string) – file path name

  • install_media (bool) – include also for installation media initrd

include_module(module, install_media=False)[source]

Include module to boot image

For kiwi boot no modules configuration is required. Thus in such a case this method is a noop.

Parameters
  • module (string) – module to include

  • install_media (bool) – include the module for install initrds

is_prepared()[source]

Check if initrd system is prepared.

Returns

True or False

Return type

bool

load_boot_xml_description()[source]

Load the boot image description referenced by the system image description boot attribute

omit_module(module, install_media=False)[source]

Omit module to boot image

For kiwi boot no modules configuration is required. Thus in such a case this method is a noop.

Parameters
  • module (string) – module to omit

  • install_media (bool) – omit the module for install initrds

post_init()[source]

Post initialization method

Implementation in specialized boot image class

prepare()[source]

Prepare new root system to create initrd from. Implementation is only needed if there is no other root system available

Implementation in specialized boot image class

write_system_config_file(config, config_file=None)[source]

Writes relevant boot image configuration into configuration file that will be part of the system image.

This is used to configure any further boot image rebuilds after deployment. For instance, initrds recreated on kernel update.

For kiwi boot no specific configuration is required for initrds recreation, thus this method is a noop in that case.

Parameters
  • config (dict) – dictonary including configuration parameters

  • config_file (string) – configuration file to write

kiwi.boot.image.dracut Module

class kiwi.boot.image.dracut.BootImageDracut(xml_state, target_dir, root_dir=None, signing_keys=None)[source]

Bases: kiwi.boot.image.base.BootImageBase

Implements creation of dracut boot(initrd) images.

create_initrd(mbrid=None, basename=None, install_initrd=False)[source]

Create kiwi .profile environment to be included in dracut initrd. Call dracut as chroot operation to create the initrd and move the result into the image build target directory

Parameters
  • mbrid (object) – unused

  • basename (string) – base initrd file name

  • install_initrd (bool) – installation media initrd

include_file(filename, install_media=False)[source]

Include file to dracut boot image

Parameters

filename (string) – file path name

include_module(module, install_media=False)[source]

Include module to dracut boot image

Parameters
  • module (string) – module to include

  • install_media (bool) – include the module for install initrds

omit_module(module, install_media=False)[source]

Omit module to dracut boot image

Parameters
  • module (string) – module to omit

  • install_media (bool) – omit the module for install initrds

post_init()[source]

Post initialization method

Initialize empty list of dracut caller options

prepare()[source]

Prepare dracut caller environment

  • Setup machine_id(s) to be generic and rebuild by dracut on boot

write_system_config_file(config, config_file=None)[source]

Writes modules configuration into a dracut configuration file.

Parameters
  • config (dict) – a dictionary containing the modules to add and omit

  • conf_file (string) – configuration file to write

kiwi.boot.image.builtin_kiwi Module

class kiwi.boot.image.builtin_kiwi.BootImageKiwi(xml_state, target_dir, root_dir=None, signing_keys=None)[source]

Bases: kiwi.boot.image.base.BootImageBase

Implements preparation and creation of kiwi boot(initrd) images

The kiwi initrd is a customized first boot initrd which allows to control the first boot an appliance. The kiwi initrd replaces itself after first boot by the result of dracut.

cleanup()[source]

Cleanup temporary boot image data if any

create_initrd(mbrid=None, basename=None, install_initrd=False)[source]

Create initrd from prepared boot system tree and compress the result

Parameters
  • mbrid (object) – instance of ImageIdentifier

  • basename (string) – base initrd file name

  • install_initrd (bool) – installation media initrd

post_init()[source]

Post initialization method

Creates custom directory to prepare the boot image root filesystem which is a separate image to create the initrd from

prepare()[source]

Prepare new root system suitable to create a kiwi initrd from it

Module Contents

class kiwi.boot.image.BootImage[source]

Bases: object

BootImge Factory

Parameters
  • xml_state (object) – Instance of XMLState

  • target_dir (string) – target dir to store the initrd

  • root_dir (string) – system image root directory

  • signing_keys (list) – list of package signing keys

static new(xml_state: object, target_dir: str, root_dir: str = None, signing_keys: List = None)[source]