Chapter 6. Adding and removing packages

Charles Steinkuehler

Revision History
Revision 0.12003-08-17kp
Initial version
Revision 0.22004-05-11kp
Notes about new linuxrc and leaf.cfg in Bering-uClibc 2.2
Revision 0.32004-07-14kp
warning about CR/LF handling - thx to freeman_groups
Revision 0.42006-08-19kp
rewrote for 3.0

Table of Contents

Introduction
Changes in syslinux.cfg
Configuring leaf.cfg
Additional capabilities of leaf.cfg

Introduction

The configuration is divided into two files, syslinux.cfg defines the place where leaf.cfg can be found during boot process. The packages to load and the devices to load from are defined in leaf.cfg.

Warning

Because leaf.cfg is sourced by linuxrc it is necessary to be aware of linefeed handling.That means you can break leaf.cfg, if you edit it with a Windows editor like notepad. A possible solution is to use a decent editor like e3 or to run the DOS2UNIX utility, which strips the <CR> chars. It works under pure DOS as well as a DOS box under XP (and I would expect 9x, ME, 2K, NT as well). It can be downloaded from: http://gatekeeper.dec.com/pub/micro/pc/simtelnet/msdos/txtutl/dos2unix.zip

Changes in syslinux.cfg

Opposed to all previous versions there must be neither packages nor devices defined in syslinux.cfg. You will have to configure the LEAFCFG variable instead.

The variable has the following syntax: LEAFCFG=/dev/device[:filesystem]

Any specified filesystem is tried first. If no filesystem is specified, or a mount using the specified filesystem fails for any reason, all filesystems currently enabled in the kernel (entries in /proc/filesystems that do not start with 'nodev') will be used to try to mount the configuration device.

For a floppy it could be LEAFCFG=/dev/fd0u1680:msdos; for a harddisk something like LEAFCFG=/dev/hda1:msdos, for a CD-Rom it could be LEAFCFG=/dev/cdrom:iso9660.

Configuring leaf.cfg

Variables that may be set in leaf.cfg include:

VERBOSE - (if non-null enables additional output from linuxrc

LRP - Packages to load

PKGPATH - Device(s) to load packages from

syst_size - Size of root ramdisk

tmp_size - Size of /tmp ramdisk

log_size - Size of /var/log ramdisk

CONFIGDB - name of the config database (Default: configdb.lrp)

MODDB - name of the modules database (Default: moddb.lrp)

Note that spaces, tabs, newlines, or commas may be used to separate entries in the LRP and PKGPATH variables.

Below an example from the base image:

LRP="root config etc local modules iptables dhcpcd keyboard shorwall ulogd dnscache dropbear weblet"
PKGPATH="/dev/fd0u1680:msdos"
syst_size=6M
log_size=2M

Additional capabilities of leaf.cfg

It's still possible to use "LRP" and "PKGPATH" in syslinux.cfg, they can be extended in leaf.cfg by doing: LRP="$KCMD_LRP extrapackage" and PKGPATH="$KCMD_PKGPATH,/dev/mydev:newfs".

Variables available for use in the leaf.cfg script include any kernel command line parameters (prefixed by KCMD_), the mount point of the LEAFCFG device (MNT), and available filesystems (FILESYSTEMS). See the linuxrc script for full details. Note that the leaf.cfg file is processed *BEFORE* any packages are loaded (in fact, before the package path and package list are finalized), so it would be possible, for example, to load any kernel modules or other software directly off the LEAFCFG= device required to read package files off of attached devices. It is only necessary to have support for the LEAFCFG= device either compiled into the kernel, or included in the /boot directory of the initial ramdisk.

In addition, the leaf.cfg file is sourced as a shell script, allowing the potential for extention of the leafcfg scripts without requiring a modification of the physical boot media (ie: anything from:

echo "Hi Mom!"

to:

insmod $MNT/MyWierdDevice.o --with-parameters

insmod $MNT/NewFileSystem.o

mknod /dev/mydevice -b 123 231

PKGPATH="$KCMD_PKGPATH,/dev/mydev:newfs"