Machine variants
emsandbox supports a set of customisation routines for each
combination of machine and variant, allowing the rootfs to be
customised to specific variants of a specific machine. Configuration
data is stored in the machine subdirectory of your Emdebian work
directory. Using the -m option to emsandbox loads
packages.conf from the $WORK/machine/$MACHINE/default
subdirectory prior to starting debootstrap. Once the first stage install
is complete, emsandbox calls setup.sh from the same
directory, passing the location and architecture of the tarball, so
that other fine tuning can take place prior to creating the tarball.
At this stage, any operations inside the rootfs must not try to execute
any binaries within the rootfs. Immediately before creating the tarball,
config.sh is copied into the /machine/$MACHINE/default/
directory of the rootfs, ready to be called when emsecondstage has
completed the second stage of the debootstrap process.
Skeleton versions of packages.conf, setup.sh and
config.sh are available in /usr/share/emdebian-tools/machine/.
packages.conf is intended to be the principal place for adjusting
the emsandbox tarball to suit the needs of specific machine
variants. setup.sh and config.sh can fine tune the
results but in order to avoid reinventing the wheel, if more than a
few machines need similar adjustments to the same files, future
versions of packages.conf will collate those into a single
configuration parameter available to all.
packages.conf supports:
- INCLUDE
Add a comma separated list of package names to the list of
packages added to the tarball and installed in the second stage.
Currently, debootstrap has problems with multiple repositories so
either upload this package to the same repository as your other
packages or create an apt-proxy that can serve as a local repository,
set it in PROXY and specify a usable mirror for the device in MIRROR.
debootstrap can sometimes fail to pick up deeper dependencies
of included packages. Check the output of debootstrap during the
emsandbox logs and ensure that all the dependencies needed by your
included packages are actually downloaded. It may be easier to customise
/usr/lib/emdebian-tools/emdebian.crossd and
pass that to the SCRIPT parameter in this file. If there are a lot of extra packages
it is probably best to use a new script anyway so that the script can produce
useful output instead of appearing to stall.
DEFAULT: empty
- SCRIPT
Overrides the default emsandbox suite-script that debootstrap uses
to determine the base and required packages and the all important
sequence in which the packages can be installed. SCRIPT can be
overridden on the emsandbox command line.
DEFAULT: /usr/lib/emdebian-tools/emdebian.crossd
- MIRROR
Overrides the default emsandbox mirror. This repository will be
set in /etc/apt/sources.list and will also be used by
debootstrap to obtain all packages for the tarball unless PROXY
is also set.
DEFAULT: http://buildd.emdebian.org/emdebian/
- PROXY
Specifies a separate repository to pass to debootstrap that may be
local or otherwise not intended for use once the tarball is installed.
Use MIRROR to set the same value in debootstrap and
/etc/apt/sources.list. If PROXY is specified
without MIRROR, the default emsandbox
MIRROR (http://buildd.emdebian.org/emdebian/) will be written
into /etc/apt/sources.list.
DEFAULT: empty
- TARBALL_NAME
Overrides the default name (emdebian-$ARCH) of the tarball. Do
not specify a path here, just a filename with the .tgz suffix.
DEFAULT: emdebian-$ARCH.tgz where $ARCH is specified to emsandbox
or as the dpkg-cross default architecture.
- SUITE
Not recommended to be changed.
DEFAULT: unstable
Due to limitations in the current debootstrap support, the only way
of adding packages to the first stage is by providing a customised
suite script. Even if emsandbox migrates to using a tool from Stag
to overcome shortcomings in debootstrap, support for
packages.conf, setup.sh and config.sh will remain.
Automating rootfs builds
This snippet demonstrates a possible method of automating the
builds of rootfs packages - what is lacking is any ability to detect
which packages do not need a rebuild. This functionality is available
in the emtargetcmp script in emdebian-tools (>= 0.4.3)
so it should be possible to merge this perl code with the snippet and
then merge into an autobuilding mechanism such as wanna-build.
try_autobuild()
{
. /usr/lib/debootstrap/functions
SCRIPT=/usr/lib/emdebian-tools/emdebian.crossd
. $SCRIPT
work_out_debs
requiredX=$(echo $(echo $required | tr ' ' '\n' | sort | uniq))
baseX=$(echo $(echo $base | tr ' ' '\n' | sort | uniq))
echo "Trying to automate rebuilds of rootfs packages:"
echo $requiredX $baseX | fold -s
if [ -z $sources ]; then
echo "$PROG: no source list found in $SCRIPT"
fi
sourcesX=$(echo $(echo $sources | tr ' ' '\n' | sort | uniq))
for pkg in $sourcesX; do
src=`apt-cache showsrc $pkg | grep Package`
emsource -b $pkg
done
}
SHELL variables
Note that the Debian chroot program from coreutils expects you to
want the same shell outside the chroot as you want to use inside the
chroot. The typical Debian default shell in /etc/passwd is
bash which is not present in the Emdebian rootfs so chroot needs
the /bin/sh option.
|