Debian Codegraph @

doc/source/commands/system_boxbuild.rst

raw
1 .. _kiwi_system_boxbuild:
2
3 kiwi-ng system boxbuild
4 =======================
5
6 .. _db_kiwi_system_boxbuild_synopsis:
7
8 SYNOPSIS
9 --------
10
11 .. code:: bash
12
13 kiwi-ng [global options] service <command> [<args>]
14
15 kiwi-ng system boxbuild --help
16 kiwi-ng system boxbuild --box=<name>
17 [--box-memory=<vmgb>]
18 [--box-console=<ttyname>]
19 [--box-smp-cpus=<number>]
20 [--box-debug]
21 [--container]
22 [--kiwi-version=<version>]
23 [--shared-path=<path>]
24 [--no-update-check]
25 [--no-snapshot]
26 [--no-accel]
27 [--9p-sharing | --virtiofs-sharing | --sshfs-sharing]
28 [--ssh-key=<name>]
29 [--ssh-port=<port>]
30 [--x86_64 | --aarch64]
31 [--machine=<qemu_machine>]
32 [--cpu=<qemu_cpu>]
33 kiwi <kiwi_build_command_args>...
34 kiwi-ng system boxbuild --list-boxes
35
36 .. _db_kiwi_system_boxbuild_desc:
37
38 DESCRIPTION
39 -----------
40
41 Build an image in a self-contained environment. The `boxbuild`
42 command uses KVM to start a virtual machine and run the kiwi
43 build command inside of that virtual machine. The provided
44 `--description` and `--target-dir` options are set up as shared
45 folders between the host and the guest. No other data will be
46 shared with the host, which also allows for cross distribution
47 builds. The boxbuild command provides the following additional
48 features over the standard build command:
49
50 * Build images independent of the host.
51 * Build images as normal user not as root.
52 * Build cross distribution images on one host.
53 * Build in predefined build VMs called boxes which includes
54 all components needed to build appliances.
55
56 For running the build process in a virtual machine, it's required
57 to provide VM images that are suitable to perform this job. We
58 call the VM images `boxes`, and they contain kiwi itself as well
59 as all other components needed to build appliances. Those boxes
60 are hosted in the Open Build Service and are publicly available
61 on the `Subprojects` tab at:
62 https://build.opensuse.org/project/show/Virtualization:Appliances:SelfContained
63
64 As a user, you don't need to work with the boxes because this
65 is all done by the `boxbuild` command. It knows where to
66 fetch the box and also cares for an update of the box when it
67 has changed.
68
69 For a detailed introduction, see :ref:`self_contained`.
70
71 .. _db_kiwi_system_boxbuild_opts:
72
73 OPTIONS
74 -------
75
76 --box=<name>
77
78 Name of the virtual machine that should be used for
79 the build process.
80
81 --list-boxes
82
83 Show available build boxes.
84
85 --box-memory=<vmgb>
86
87 Amount of main memory to reserve for the virtual machine.
88 The value is passed as is to the QEMU `-m` option, so add a
89 unit suffix, e.g. `8G`. By default, the memory setting of the
90 selected box is used, which is 8096M for the boxes provided
91 with {kiwi}.
92
93 --box-console=<ttyname>
94
95 Name of console in the kernel settings for the virtual
96 machine. By default, set to hvc0.
97
98 --box-smp-cpus=<number>
99
100 Number of CPUs to use in the SMP setup. By default,
101 4 CPUs will be used.
102
103 --box-debug
104
105 In debug mode, the started virtual machine will be kept open.
106
107 --container
108
109 Build in container instead of a VM. Options related to
110 building in a VM will have no effect.
111
112 --kiwi-version=<version>
113
114 Specify a KIWI version to use for the build. The referenced
115 KIWI will be fetched from pip and replaces the box installed
116 KIWI version. Note: If --no-snapshot is used in combination
117 with this option, the change of the KIWI version will be
118 permanently stored in the used box.
119
120 --shared-path=<path>
121
122 Optional host path to share with the box. The same path
123 as it is present on the host will also be available inside
124 of the box during build time.
125
126 --no-update-check
127
128 Skip check for available box update. The option has no
129 effect if the selected box does not yet exist on the host.
130
131 --no-snapshot
132
133 Run box with snapshot mode switched off. This causes the
134 box disk file to be modified by the build process and allows
135 to keep a persistent package cache as part of the box.
136 The option can be used to increase the build performance
137 due to data stored in the box which doesn't have to be
138 reloaded from the network. On the contrary, this option
139 invalidates the immutable box attribute and should be
140 used with care. On update of the box, all data stored
141 will be wiped. To prevent this, combine the option with
142 the --no-update-check option.
143
144 --no-accel
145
146 Run box without hardware acceleration. By default, KVM
147 acceleration is activated.
148
149 --9p-sharing|--virtiofs-sharing|--sshfs-sharing
150
151 Select sharing backend to use for sharing data between the
152 host and the box. This can be either 9p, virtiofs or sshfs.
153 By default, 9p is used.
154
155 --ssh-key=<name>
156
157 Name of ssh key to authorize for connection.
158 By default, 'id_rsa' is used.
159
160 --ssh-port=<port>
161
162 Port number to use to forward the guest's SSH port to the host.
163 By default, '10022' is used.
164
165 --x86_64|--aarch64
166
167 Select box for the given architecture. If no architecture
168 is selected, the host architecture is used for selecting
169 the box. The selected box architecture also specifies the
170 target architecture for the image build with that box.
171
172 --machine=<qemu_machine>
173
174 Optional machine name used by QEMU. By default, no specific
175 value is used here and QEMU selects its default machine type.
176 For cross arch builds or for system architectures for which
177 QEMU defines no default like for Arm, it's required to specify
178 a machine name.
179
180 If you don't care about reproducing the idiosyncrasies of
181 a particular bit of hardware, the best option is to use
182 the 'virt' machine type.
183
184 --cpu=<qemu_cpu>
185
186 Optional CPU type used by QEMU. By default, the host CPU
187 type is used, which is only a good selection if the host
188 and the selected box are from the same architecture. On
189 cross arch builds, it's required to specify the CPU
190 emulation the box should use.
191
192 kiwi <kiwi_build_command_args>...
193
194 List of command parameters as supported by the kiwi-ng
195 system build command. The information given here is passed
196 along to the kiwi-ng system build command running in
197 the virtual machine or container. The `--description` and
198 `--target-dir` options are mandatory. Global options like
199 `--type` or `--profile` must be passed as global options to
200 the `boxbuild` call and are forwarded to the build command.
201 See the example below how to provide options to the
202 build command correctly.
203
204 For compatibility with the former kiwi-boxed-plugin, the
205 `--` separator is accepted as an alias for `kiwi`.
206
207 .. _db_kiwi_system_boxbuild_env:
208
209 ENVIRONMENT
210 -----------
211
212 KIWI_BOXED_CACHE_DIR
213 By default, VM disk images used as build environment are
214 stored in the $HOME/.kiwi_boxes directory. To override this
215 location, set the KIWI_BOXED_CACHE_DIR environment variable
216 to a different absolute path.
217
218 KIWI_BOXED_PLUGIN_CFG
219 Path to a custom boxes configuration file. If not set, the
220 configuration is searched in the following order:
221 $PWD/kiwi_boxed_plugin.yml,
222 $HOME/.config/kiwi/kiwi_boxed_plugin.yml,
223 /etc/kiwi_boxed_plugin.yml and the default configuration
224 provided with {kiwi}.
225
226 .. _db_kiwi_system_boxbuild_example:
227
228 EXAMPLE
229 -------
230
231 .. code:: bash
232
233 $ git clone https://github.com/OSInside/kiwi-descriptions
234
235 $ kiwi-ng --profile Virtual system boxbuild --box leap kiwi \
236 --description kiwi-descriptions/suse/x86_64/suse-leap-15.6 \
237 --target-dir /tmp/myimage