kiwi.boot.image Package

Submodules

kiwi.boot.image.base Module

class kiwi.boot.image.base.BootImageBase(xml_state: XMLState, target_dir: str, root_dir: str | None = None, signing_keys: List[str] | None = None, target_arch: str | None = None)[source]

Bases: object

Base class for boot image(initrd) task

cleanup() None[source]

Cleanup temporary boot image data if any

create_initrd(mbrid: SystemIdentifier | None = None, basename: str | None = None, install_initrd: bool = False) None[source]

Implements creation of the initrd

Parameters:
  • mbrid (SystemIdentifier) – instance of SystemIdentifier

  • basename (str) – base initrd file name

  • install_initrd (bool) – installation media initrd

Implementation in specialized boot image class

get_boot_description_directory() str | None[source]

Provide path to the boot image XML description

Returns:

path name

Return type:

str

get_boot_names() boot_names_type[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',
    kernel_version='KERNEL_VERSION',
    kernel_filename='KERNEL_FILE_NAME'
)

Return type:

boot_names_type

static has_initrd_support() bool[source]

Indicates if this instance supports actual creation of an initrd

The method needs to be overwritten by the subclass implementing preparation and creation of an initrd

import_system_description_elements() None[source]

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

include_file(filename: str, install_media: bool = False) None[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 (str) – file path name

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

include_module(module: str, install_media: bool = False) None[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 (str) – module to include

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

is_prepared() bool[source]

Check if initrd system is prepared.

Returns:

True or False

Return type:

bool

load_boot_xml_description() None[source]

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

omit_module(module: str, install_media: bool = False) None[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 (str) – module to omit

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

post_init() None[source]

Post initialization method

Implementation in specialized boot image class

prepare() None[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

set_static_modules(modules: List[str], install_media: bool = False) None[source]

Set static modules list for boot image

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

Parameters:
  • modules (list) – list of modules to include

  • install_media (bool) – lists the modules for install initrds

write_system_config_file(config: Dict, config_file: str | None = None) 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 (str) – configuration file to write

class kiwi.boot.image.base.boot_names_type(kernel_name, initrd_name, kernel_version, kernel_filename)

Bases: tuple

initrd_name: str

Alias for field number 1

kernel_filename: str

Alias for field number 3

kernel_name: str

Alias for field number 0

kernel_version: str

Alias for field number 2

kiwi.boot.image.dracut Module

class kiwi.boot.image.dracut.BootImageDracut(xml_state: XMLState, target_dir: str, root_dir: str | None = None, signing_keys: List[str] | None = None, target_arch: str | None = None)[source]

Bases: BootImageBase

Implements creation of dracut boot(initrd) images.

create_initrd(mbrid: SystemIdentifier | None = None, basename: str | None = None, install_initrd: bool = False) None[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 (SystemIdentifier) – unused

  • basename (str) – base initrd file name

  • install_initrd (bool) – unused

static has_initrd_support() bool[source]

This instance supports initrd preparation and creation

include_file(filename: str, install_media: bool = False) None[source]

Include file to dracut boot image

Parameters:
  • filename (str) – file path name

  • install_media (bool) – unused

include_module(module: str, install_media: bool = False) None[source]

Include module to dracut boot image

Parameters:
  • module (str) – module to include

  • install_media (bool) – unused

omit_module(module: str, install_media: bool = False) None[source]

Omit module to dracut boot image

Parameters:
  • module (str) – module to omit

  • install_media (bool) – unused

post_init() None[source]

Post initialization method

Initialize empty list of dracut caller options

prepare() None[source]

Prepare dracut caller environment

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

set_static_modules(modules: List[str], install_media: bool = False) None[source]

Set static dracut modules list for boot image

Parameters:
  • modules (list) – list of the modules to include

  • install_media (bool) – unused

write_system_config_file(config: Dict, config_file: str | None = None) None[source]

Writes modules configuration into a dracut configuration file.

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

  • conf_file (str) – configuration file to write

kiwi.boot.image.builtin_kiwi Module

class kiwi.boot.image.builtin_kiwi.BootImageKiwi(xml_state: XMLState, target_dir: str, root_dir: str | None = None, signing_keys: List[str] | None = None, target_arch: str | None = None)[source]

Bases: 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() None[source]

Cleanup temporary boot image data if any

create_initrd(mbrid: SystemIdentifier | None = None, basename: str | None = None, install_initrd: bool = False) None[source]

Create initrd from prepared boot system tree and compress the result

Parameters:
  • mbrid (SystemIdentifier) – instance of ImageIdentifier

  • basename (str) – base initrd file name

  • install_initrd (bool) – installation media initrd

static has_initrd_support() bool[source]

This instance supports initrd preparation and creation

post_init() None[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() None[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: XMLState, target_dir: str, root_dir: str | None = None, signing_keys: List | None = None)[source]