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
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
|
.\" $NetBSD: mklivecd.8,v 1.13 2006/10/08 19:08:38 xtraeme Exp $
.\"
.\" mklivecd - Make your own NetBSD/i386 Live CD-ROM/DVD-ROM
.\"
.\" Copyright (c) 2004-2006 Juan Romero Pardines <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 October 8, 2006
.Dt MKLIVECD 8
.Os
.Sh NAME
.Nm mklivecd
.Nd Make your own
.Nx
/ i386 Live CD-ROM/DVD-ROM
.Sh SYNOPSIS
.Nm
.Fl v
.Fl c Ar conf_file
.Fl k Ar kernel
.Ar target
.Sh DESCRIPTION
.Nm
allows you to build your own
.Nx
Live CD/DVD, so you don't need to install
.Nx
to any disk, because it will run directly from the CD-ROM/DVD-ROM.
.Pp
To choose different kernels when booting from the CD-ROM/DVD-ROM,
two options for the bootloader are provided since version
.Pa 0.12.0 :
.Pa the GNU Grub bootloader
or the
.Nx
cdboot bootloader (since
.Nx
4.0). By default it will use the first option:
.Pa the GNU Grub bootloader .
You may want to change this by changing the option
.Pa USE_GNU_GRUB
to
.Sy no .
.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 XkXkernel
.It Fl k Ar kernel
Overrides the
.Ar BOOTKERN
value specified in the configuration file,
.Ar KERNEL_NAME
will be modified automatically too.
.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 BASEDIR
Primary directory used to store the main directories and the final ISO image.
Defaults to
.Pa $HOME/livecd .
.It BASE_SETS_DIR
The base sets directory.
Defaults to
.Pa $HOME/release/binary/sets .
.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 CHROOT_SHELL
Default shell to use with the chroot target.
Defaults to
.Sy /bin/ksh .
.It ISODIR
Directory used to store the main
.Nx
base distribution.
Defaults to
.Pa $BASEDIR/iso .
.It PKGSRCDIR
The
.Nx
pkgsrc 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 PACKAGESDIR
The
.Nx
packages pkgsrc directory.
When the
.Ar chroot
target is invoked, the packages directory will be mounted via
.Xr mount_null 8 .
Defaults to
.Pa /usr/pkgsrc/packages .
.It SHAREDIR
The main directory used to store the Makefiles, kernel, example configuration
files, etc.
Defaults to
.Pa @PREFIX@/share/mklivecd/ .
.It SOURCEDIR
The
.Nx
source directory.
Defaults to
.Pa /usr/src .
.It WORKDIR
Directory used to store the object files and kernel built by the target
.Ql kernel .
Defaults to
.Pa $BASEDIR/work .
.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 X11_SETS_DIR
The X11 sets directory.
Defaults to
.Pa $BASE_SETS_DIR .
.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 MULTIPLE_KERNELS
If set to
.Sy other thing than ``no'' ,
it will compile and install the kernels specified into
.Pa $ISODIR/boot/grub ,
and it will update automatically the
.Pa menu.lst
file for
.Pa the GNU Grub bootloader .
See below for details.
.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 CDRECORD_ARGS
Arguments passed to
.Xr cdrecord 1
when burning the
.Nx
Live CD ISO image.
Defaults to
.Sy -v .
.It CDRECORD_BIN
Name of the cdrecord binary used by
.Nm
to burn the image.
Defaults to
.Sy @PREFIX@/bin/cdrecord .
.It CDROM_DEVICE
Used in the target
.Ar burn
to specify the CD-ROM device.
Defaults to
.Sy 15,1,0 .
.It ENABLE_X11
If set to
.Sy yes
then X11 sets and configuration files will be unpacked automatically.
Defaults to
.Sy no .
.It GRUB_FILES_DIR
Directory where the grub files are stored.
Defaults to
.Sy @LOCALBASE@/lib/grub/@MACHINE_ARCH@-/ .
.It HOSTNAME
Hostname of the live CD-ROM/DVD-ROM, it's assigned when running the
.Sy base
target. Defaults to
.Sy MKLIVECD_0x00 .
.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 MKISOFS_ARGS
Arguments passed to
.Xr mkisofs 1
when creating the
.Nx
ISO image.
Defaults to
.Sy -nobak -J -R -v .
.It MKISOFS_BIN
Name of the mkisofs binary used by
.Nm
to build the image.
Defaults to
.Sy @PREFIX@/bin/mkisofs .
.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 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 USE_GNU_GRUB
Used to select the bootloader for the Live CD.
When it's disabled the
.Nx
CDBootloader will be used.
Defaults to
.Sy yes .
.It VND_COMPRESSION
Enable this to mount
.Pa /usr ,
and
.Pa /var/db/pkg
via
.Xr vnconfig 8
with compression enabled.
Note you'll need to have
.Sy options VND_COMPRESSION
in your kernel config, at the moment
this option is only available on
.Nx
>=4.0. Defaults to
.Sy no .
.It MNT_RAMFS_ARGS
This specifies the arguments passed to the
.Xr mount 8
command used in the
.Pa livecd
script, when the
.Nx
Live CD is booted.
By default it will contain
.Sy -s 128m swap
to be used by
.Xr mount_mfs 8 .
If you want to use
.Xr mount_tmpfs 8
change it just to
.Sy tmpfs .
.It MNT_RAMFS_CMD
This specifies the
.Xr mount 8
command used by
.Nm
in the boot configuration stage. Defaults to
.Pa mount_mfs .
Can be changed to
.Pa mount_tmpfs
too.
.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 mfs directories located in
.Pa /stand
and the
.Nx
kernels.
.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 .
.Ss How to use the MULTIPLE_KERNELS option?
An example is provided below, we have two kernels:
.Ar ACPIKERN
and
.Ar APMKERN ,
both are kernel configuration files, you'll need
to define the variables named
.Ar BOOTKERN_${foo}
and
.Ar KERNEL_NAME_${foo}
for every kernel specified on the
.Pa MULTIPLE_KERNELS
option. The following example shows that:
.Bd -literal -offset indent
MULTIPLE_KERNELS="ACPIKERN APMKERN"
BOOTKERN_ACPIKERN="LIVECD_ACPI"
BOOTKERN_APMKERN="LIVECD_APM"
KERNEL_NAME_ACPIKERN="KERN_ACPI_LIVECD"
KERNEL_NAME_APMKERN="KERN_APM_LIVECD"
.Ed
.Pp
Note that when using this option, the
.Pa BOOTKERN
and
.Pa KERNEL_NAME
variables, will don't have any effect. After building the specified
kernels, it will update the
.Pa menu.lst
file automatically for the
.Ar GNU Grub bootloader .
.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 2.0 branch.
You should copy your own kernel config file into
.Ar $HOME/.mklivecd .
The
.Sy BOOTKERN
variable should point at it, if you're not using
.Sy MULTIPLE_KERNELS .
The important thing about the kernel is the line:
.Bd -literal -offset indent
config netbsd root on cd0a type cd9660 dumps on none
.Ed
.Pp
This line is required in the kernel config file for
the Live CD-ROM/DVD-ROM to boot correctly and without
human interactivity, otherwise you'll have to enter
the parameters manually when booting.
.Sh EXAMPLES
Below are the minimal steps to create your own Live CD-ROM/DVD-ROM:
.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 BUGS
It is not perfect but at least it does its task correctly.
.Sh SEE ALSO
.Xr packages 7 ,
.Xr mount_mfs 8 ,
.Xr mount_null 8,
.Xr mount_tmpfs 8
.Sh AUTHORS
The
.Nm
utility was written by
.An Juan Romero Pardines Aq xtraeme@NetBSD.org .
|