Root Generator
The root generator is responsible for generating and conifguring a tarball of the root filesystem. The root generator supports the following parameters:
- config_file: Path to the yaml configuration file of the root filesystem.
- output: Path to the folder where the generated artifacts are placed.
- –no-config: Skip the configuration step. This flag allows a two-step build which first creates the tarball containing all selected packages, and then applies the use configuration.
- –sysroot: The sysroot flag allows to add additional packages only required as part of the sysroot for cross-compiling.
The core part of the root generator is implemented in ebcl/tools/root/root.py. The main function takes care of parsing the command line parameters and then runs create_root of the RootGenerator class, and finally runs finalize to cleanup temporary artifacts.
The build process implemented in create_root executes the following high level steps:
- In case of a sysroot build: Add additional packages to the list of selected packages.
- Create the root tarball using either elbe, kiwi or debootstrap.
- In case of not skipping the configuration: Copy the overlays and run the config scripts.
- Move the resulting tarball to the output folder.
Implementation details
Root tarball generation
TODO: write section
Root configuration
The root filesystem configuration is shared code between the root generator and the root configurator and is implemented in ebcl/tools/root/init.py. For configuring the root tarball the following steps are executed:
- Extract the tarball to a temporary folder.
- Copy the host files to this folder, overwriting existing files if necessary.
- Execute the configuration scripts in the given environment.
- Pack the result as tarball.
Copying of the files and running the scripts is common code for all tools and implemented in the Files class contained in ebcl/common/files.py.
Copy the host files
The host files which shall be overlayed to the root filesystem are defined in the configuration file using the host_files parameters. These configuration is parsed using parse_files of ebcl/common/files.py. For each file or folder a source value is required. This source value is interpreted as relative path to the config file. Optionally a destination, a mode, a uid and a gid can be given. These additional parameters are evaluted by copy_files. If uid and gid is not given, the user id 0, and the group id 0 is used, which means root user and group. If no mode is given the mode is not modified, i.e. the value is kept for the file.
Run the configuration scripts
TODO: write section
Root configurator
The root configurator, which is implemented in ebcl/tools/root/root_config.py, is a stripped down version of the root generator, which only applies the customer specific configruation on top of an existing tarball.