Contents
Abstract
KIWI is a system for creating operating system images. An image is a directory with a file containing the operating system, its applications and configurations, the filesystem structure of the OS, possible additional metadata, and (depending on the image type) also disk geometry and partition table data. With KIWI you can create LiveCDs and LiveDVDs, USB sticks, virtual disk to play in full virtual systems like VMware, XEN images for paravirtualization in a hypervisor, and a PXE environment to boot from network.
To build images with KIWI, you need the following preconditions:
Free sufficient disk space for the operation.
KIWI is split into several packages, targeted to different image
types. In any case, you need the base package
kiwi
. Depending on your
target image, you need the following packages:
Image Type |
Package Name |
---|---|
Installation Media |
|
Virtualization |
|
USB Sticks |
|
Network Client |
|
Install the kiwi-doc
package.
You can find some example configurations to get an idea about structure
and content.
Know the KIWI configuration file and its structure. It is based on a
RELAX NG schema and documented in the
kiwi
package under
/usr/share/doc/packages/kiwi/kiwi.html
. You need
this document, if you want to create the configuration file from
scratch or when you want to insert elements or attributes.
The building process of KIWI is separated into three steps:
Physical Extend (Preparation). This stage prepares the content of your new filesystem. During this step the root directory is created, you determine which packages are installed on your image and which user configuration files are included.
Logical Extend (Creation). This stage requires a successful preparation step. The logical extend step creates the operating system image based on the first step.
Deployment. The resulting image type can be deployed with different methods like installed on a hard disk or played by a virtualization system (VMware, Qemu, VirtualBox).
KIWI needs an image description to build an image type. The image
description is a directory which contains at least a file
config.xml
, or alternatively with the extension
*.kiwi
.
The following table contains additional optional information. However, most of this information is mandatory for the later functionality of the operating system:
Table 17.1. Additional Files and Directories For Image Description¶
File/Directory |
Description |
---|---|
|
optional subdirectory. Contains Bash scripts which are executed after the installation of all the image packages. |
|
optional configuration script while creating the physical extend |
|
configuration file for each image description, explained in Section 17.3.2 |
|
archive, only used for ISO images |
|
manipulate extracted data from
|
|
configuration file created by AutoYaST |
|
configuration file for controlling the YaST firstboot service |
|
optional configuration script while creating the preparation step |
|
contains other directories, special files, and scripts which are changed after the installation of all image packages |
config.xml
File¶
All information about an image description is stored in the central
configuration XML file config.xml
. Each time KIWI
is executed, config.xml
is validated against an
RELAX NG schema (see http://www.relaxng.org for more
information about this schema language). Therefore, it is recommended to
use an adequate XML editor with RELAX NG support or to use the
documentation about the schema in the HTML file
/usr/share/doc/packages/kiwi/schema/kiwi.xsd.html
.
The configuration file consists of several parts:
some description about the author, contact information, and a short explanation.
preferences option needed for the logical extent stage.
information about the users, their name, their home directories, and their passwords.
links to repositories.
a list of packages that are used for the definied image type.
and other less important information which can be viewed in the above HTML file of the RELAX NG schema documentation.
A skeleton of the file is shown in the following example:
Example 17.1. KIWI Configuration File¶
<image schemeversion="2.0" name="..."><description type="system">
<author>...</author> <contact>...</contact> <specification>...</specification> </description> <preferences>
<type primary="true" boot="..." flags="...">iso</type> <type boot="..." filesystem="ext3" format="vmdk">vmx</type> <type boot="..." filesystem="ext3">xen</type> <type boot="..." filesystem="squashfs" flags="unified">oem</type> <version>2.7.0</version> <size unit="M">780</size> <packagemanager>zypper</packagemanager> <rpm-check-signatures>False</rpm-check-signatures> <rpm-force>False</rpm-force> <locale>en_US.UTF-8</locale> <oem-swap>no</oem-swap> <oem-boot-title>USB</oem-boot-title> </preferences> <users group="users">
<user name="root" pwd="" home="/root"/> </users> <repository type="rpm-md">
<source path="/home/rpmdir"/> </repository> <packages type="image" patternPackageType="onlyRequired">
<package name="yast2-live-installer"/> <package name="pam"/> <!-- List of packages reduced --> </packages>
The root element of every KIWI configuration file. Each file
requires the version number. An optional
| |
Contains mandatory descriptions with information about the creator of this image descriptions, its contact address and a short explanation. | |
Contains mandatory preferences with information about the version of this image, the used package manager, the supported image types, and other settings. | |
The optional | |
Contains a mandatory list of repositories used by the package manager. | |
Contains a mandatory list of packages which are included into the image. |
More details about the configuration file is shown in the HTML page above.
This section describes how to create appliances with KIWI. An appliance is an especially-designed operating system for a specific task. For example, you can create an appliance with the focus on office programs.
All examples in kiwi-doc
packages need a valid installation source to create an image. Usually
the examples connect to a network resource. The higher the network
bandwith, the faster the image creation. If you do not have a fast
network or you do not want to use it, create a local installation
resource. Proceed as follows:
Collect your installation DVD.
Open a shell and become
root
.
Create the directory for your local installation directory. The
examples use usually the path
/image/CDs/full-
.
Replace the placeholders VERSION
-ARCH
VERSION
and
ARCH
with the respective values.
Mount the medium. Replace the DRIVE
placeholder with the respective device (usually
dvd
, cdrom
, etc.):
mount -o loop /dev/DRIVE
/mnt
Copy all the content of the medium into the installation directory:
cp -a /mnt/* /images/CDs/full-VERSION
-ARCH
To use the local installation source, all you need to do is to enable it
in the repository
element:
<repository type="..."> <!-- Remove the comment markers in the next line --> <!-- <source path="/image/CDs/full-VERSION
-ARCH
" --> <source path="opensuse://openSUSE:11.0/standard"/> </repository>
An image is a virtual disk image containing all partitions, boot loader information, and packages as it resides on a real disk. To create an ISO image, proceed as follows:
Install the packages kiwi
and kiwi-doc
and
resolve any dependencies.
Open a shell and become
root
.
Copy the directory
/usr/share/doc/packages/kiwi/examples/suse-11.0/suse-oem-preload
to your current directory.
Open the file config.xml
and locate the element
repository
. If you want to use a local installation
source, refer to
Section 17.4.1
for more information.
Execute KIWI with the following command to prepare the first stage (“physical extend”):
kiwi --prepare suse-oem-preload --root oem
Build the ISO image:
kiwi --create oem --type iso --destdir /tmp/myoem
To create an image with NFS functionality, proceed as follows:
Open a shell and become
root
.
Copy the directory
/usr/share/doc/packages/kiwi/examples/suse-11.1/suse-oem-preload
to your current directory.
Open the file suse-oem-preload/config.xml
and
locate the packages
element with the attribute
type="image"
.
Insert the following line between <packages
type="image">
and </packages>
and save the file:
<package name="nfs-client"/>
Rebuild the image as described in Step 5.
Find more information about KIWI in the following documents:
http://developer.berlios.de/projects/kiwi—Homepage of KIWI
file:///usr/share/doc/packages/kiwi/kiwi.pdf—Extensive description about the KIWI Image System