1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
|
.\" $NetBSD: mklivecd.8,v 1.9 2004/11/04 17:01:11 wiz Exp $
.\"
.\" mklivecd - Build a NetBSD Live CD for i386 machines
.\" Copyright (c) 2004 Juan RP <xtraeme@NetBSD.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\" 3. Neither the name of author nor the names of its contributors may
.\" be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd November 4, 2004
.Dt MKLIVECD 8
.Os
.Sh NAME
.Nm mklivecd
.Nd build a
.Nx
Live CD for i386 machines
.Sh SYNOPSIS
.Nm
.Fl v
.Fl c Ar conf_file
.Ar target
.Sh DESCRIPTION
.Nm
allows you to build your own
.Nx
Live CD, so you don't need to install
.Nx
to any disk, because it will run directly from the CD-ROM.
.Pp
The following options are recognized:
.Bl -tag -width XcXconf_file
.It Fl c Ar conf_file
Use
.Ar conf_file
as configuration file (full name expected).
Example:
.Fl c Ar foo.conf .
.El
.Bl -tag -width XvX
.It Fl v
Show more useful messages.
.El
.Sh CONFIGURATION
.Nm
reads the parameters of the main configuration file
stored inside
.Pa $HOME/.mklivecd/mklivecd.conf ,
so be sure you have modified it with your
preferences before starting any target.
.Pp
Configuration files are simple shell scripts that define
variables.
The default values shown here are those written in the template when
issuing the
.Ar config
target.
.Bl -tag -width 15n -offset indent
.It SOURCEDIR
The
.Nx
source directory.
Defaults to
.Pa /usr/src .
.It PKGSRCDIR
The
.Nx
packages collection directory.
When the
.Ar chroot
target is invoked, the pkgsrc directory will be mounted via
.Xr mount_null 8 ,
and you could install any package.
Defaults to
.Pa /usr/pkgsrc .
.It PKGSRCDISTDIR
The
.Nx
distfiles pkgsrc directory.
When the
.Ar chroot
target is invoked, the distfiles directory will be mounted via
.Xr mount_null 8 .
Defaults to
.Pa /usr/pkgsrc/distfiles .
.It SHAREDIR
The main directory used to store the Makefiles, kernel, example configuration
files, etc.
Defaults to
.Pa $PREFIX/share/mklivecd/ .
.It BASEDIR
Primary directory used to store the main directories and the final ISO image.
Defaults to
.Pa $HOME/livecd .
.It WORKDIR
Directory used to store the object files and kernel built by the target
.Ql kernel .
Defaults to
.Pa $BASEDIR/work .
.It ISODIR
Directory used to store the main
.Nx
base distribution.
Defaults to
.Pa $BASEDIR/iso .
.It BASE_SETS_DIR
The base sets directory.
Defaults to
.Pa $HOME/release/binary/sets .
.It X11_SETS_DIR
The X11 sets directory.
Defaults to
.Pa $BASE_SETS_DIR .
.It BASE_SETS
Base sets which will be unpacked into
.Pa $ISODIR .
Sets used by default are:
.Pa etc.tgz base.tgz comp.tgz text.tgz .
.It X11_SETS
X11 sets which will be unpacked into
.Pa $ISODIR .
Sets used by default are:
.Pa xbase.tgz xcomp.tgz xfont.tgz xserver.tgz .
.It CHROOT_SHELL
Default shell to use with the chroot target.
Defaults to
.Sy /bin/ksh
.It ENABLE_X11
If set to
.Sy yes
then X11 sets and configuration files will be unpacked automatically.
Defaults to
.Sy no .
.It MKISOFS_ARGS
Arguments passed to
.Xr mkisofs 1
when creating the
.Nx
ISO image.
Defaults to
.Sy -nobak -J -R -v .
.It CDRECORD_ARGS
Arguments passed to
.Xr cdrecord 1
when burning the
.Nx
Live CD ISO image.
Defaults to
.Sy -v .
.It BLANK_BEFORE_BURN
Used in the
.Ar burn
target to blank a CD-RW before burning the
.Nx
Live CD ISO image.
Useful if you use CD-RW.
Defaults to
.Sy no .
.It CDROM_DEVICE
Used in the target
.Ar burn
to specify the CD-ROM device.
Defaults to
.Sy 15,1,0 .
.It PERSONAL_CONFIG
If set to
.Sy yes ,
then
.Pa personal_config
file will be used.
See below for details.
Defaults to
.Sy no .
.It BOOTKERN
Name of the
.Nx
kernel used for the boot image.
Defaults to
.Sy KERN-LIVECD .
.It KERNEL_NAME
Name of the built
.Nx
kernel.
Useful if you want to change the default behaviour of the build process.
Defaults to
.Sy MKLIVECD .
.It IMAGE_NAME
Name of the final ISO image, e.g.:
.Pa My_NetBSD_Live_CD_ISO_Image.iso .
Defaults to
.Sy NetBSD-LiveCD .
.It PKG_SYSCONFDIR
Directory where the pkgsrc settings are stored, by default
.Nm
preserves this behaviour and uses
.Pa usr/pkg/etc .
.It REMOVE_DIRS
Take care with this option, because it will remove all directories when
the target
.Ar iso
is invoked.
It could be useful if you don't want to include some directories
on the CD, or your free space is small.
Defaults to
.Pa altroot rescue usr/share/info .
.It MNT_{MOUNT_POINT}_ARGS
This specifies the arguments passed to the
.Xr mount 8
command used in the
.Pa mfs_rcd
script, when the
.Nx
Live CD is booted.
You shouldn't add
.Sy swap
at the end, because it will be added automatically by
the script.
.El
.Sh TARGETS
A target specifies what
.Nm
should do (as in make).
The following list describes all supported targets,
in the logical order in which you should call them.
.Bl -tag -width 15n -offset indent
.It Ar config
Create a sample
.Pa mklivecd.conf
file.
You should edit it after the creation as you will probably want to
change the default configuration, especially paths.
.It Ar kernel
Builds the specified kernel
.Pa $BOOTKERN
into the
.Pa $ISODIR
directory.
.It Ar base
Install the
.Pa $BASE_SETS
and
.Pa $X11_SETS
into the
.Pa $ISODIR
directory and prepare the base system for the next target,
which is the most important:
.Ar chroot .
.It Ar chroot
Enters the chroot environment.
Uses
.Xr ksh 1
as default shell.
.It Ar iso
Builds the ISO image
.Pa $IMAGE_NAME
into
.Pa $BASEDIR
and removes all directories specified in
.Pa $REMOVE_DIRS
before it, to save some space.
.It Ar burn
Burns the ISO image
.Pa $IMAGE_NAME
on the CD-ROM with
.Xr cdrecord 1 .
Use the
.Pa $CDROM_DEVICE
variable to specify the default device.
.It Ar clean
Cleans the
.Pa $WORKDIR
directory and the base
.Nx
tree in
.Pa $ISODIR ,
except the CD-ROM boot image
.Pa /stand/cdlive-boot.fs
and the
.Nx
kernel
.Pa /netbsd .
.El
.Ss What should I do in the chroot jail?
While working in the chroot environment, you can
add users, install binary packages, modify
.Pa /etc/ttys ,
etc.
You can enter the chroot as often as you want,
.Nm
will create the tarballs automatically when you leave
the chroot.
.Ss How can I use the PERSONAL_CONFIG option?
When
.Ar PERSONAL_CONFIG
is set to
.Sy yes ,
.Pa $HOME/.mklivecd/personal_config
will be used.
For example, you can copy some configuration directories
from
.Ar $HOME
to the
.Ar $ISODIR/$HOME
directory.
Please take a look at the example file located in
.Ar ${PREFIX}/share/mklivecd .
.Sh NOTES
.Pa PKG_SYSCONFDIR
defaults to
.Ar usr/pkg/etc
without a starting slash.
This shouldn't be added because
.Nm
adds this automatically in the script, otherwise your real PKG_SYSCONFDIR
directory will be copied instead of the one located in
.Pa $ISODIR .
.Pp
An example kernel config file,
.Pa KERN-LIVECD ,
has been installed into
.Ar ${PREFIX}/share/mklivecd ,
based on the -current branch.
You should copy your own kernel config file into
.Ar $HOME/.mklivecd .
The
.Sy BOOTKERN
variable should point at it.
.Sh EXAMPLES
Below are the minimal steps to create your own Live CD:
.Bd -literal -offset indent
$ mklivecd config
[edit the config file]
$ mklivecd kernel
$ mklivecd base
$ mklivecd chroot
[edit what you like in there, e.g. config files]
$ mklivecd iso
$ mklivecd burn
.Ed
.Sh SEE ALSO
.Xr packages 7 ,
.Xr mount_null 8
.Sh AUTHORS
The
.Nm
utility was written by
.An Juan RP Aq xtraeme@NetBSD.org .
|