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

Table of Contents

Bering-uClibc 2.2 and above
Bering-uClibc 2.0 and 2.1


For a long time package loading has been defined in syslinux.cfg. But this approach has it's drawbacks - it's not very flexible and the maximum kernel command line has a 254 characters limit.

One of the first workarounds was the introduction of lrpkg.lrp in the Dachstein CD release by Charles Steinkuehler. Bering-uClibc versions 2.0 and 2.1 moved completly to the usage of lrpkg.lrp to define packages to load, even for floppies.

But even that still isn't as flexible as it should be, especially working with other medias as floppy and CD aren't supported in a proper way.

The latest attempt to overcome these limitations is a rewrite of linuxrc (responsible for accessing media and loading packages during boot process) and the introduction of leaf.cfg by Charles Steinkuehler.

Bering-uClibc versions 2.2 and above use this new approach to configure package loading.

Bering-uClibc 2.2 and above


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.


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:

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

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"

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!"


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

insmod $MNT/NewFileSystem.o

mknod /dev/mydevice -b 123 231


Bering-uClibc 2.0 and 2.1

Bering-uClibc versions 2.0 and 2.1 use lrpkg.cfg also in the standard floppy image to have one place for adding/removing packages, regardless you use a floppy with a few packages, or a large medium and installation with a lot of packages.

To add or remove packages just edit lrpkg.cfg - all entries on one line. It looks like: