No description
Find a file
codehelp 9d49be99c5 tweak
git-svn-id: http://emdebian.org/svn/current@6618 563faec7-e20c-0410-992a-a66f704d0ccd
2009-09-07 21:22:12 +00:00
bash pbuilder/multistrap : remove debootstrap code and do all the work in apt+dpkg. Improve native support and re-enable. 2009-03-22 16:28:09 +00:00
debian generalize the genmanpages code to be more flexible. 2009-09-05 19:38:44 +00:00
doc tweak 2009-09-07 21:22:12 +00:00
examples Examples moved into /usr/share/doc/emdebian-rootfs/examples (Closes: #533236) 2009-06-20 22:12:53 +00:00
po Portuguese manpage translation. (Closes: #544953) 2009-09-04 20:57:59 +00:00
em_multistrap pbuilder/em_multistrap : Allow retention of source packages outside the rootfs for source distribution and allow separate configuration of the apt sources inside the rootfs. 2009-03-29 15:37:34 +00:00
embootstrap Add complaint when workingdir is not set in /etc/emsource.conf (Closes: #521474) 2009-04-25 22:27:43 +00:00
emdebian-rootfs preparing the new emdebian-rootfs source package 2009-03-28 21:55:28 +00:00
emdebian.busybox preparing the new emdebian-rootfs source package 2009-03-28 21:55:28 +00:00
emdebian.coreutils preparing the new emdebian-rootfs source package 2009-03-28 21:55:28 +00:00
emdebian.crossd preparing the new emdebian-rootfs source package 2009-03-28 21:55:28 +00:00
emdebian.gpe preparing the new emdebian-rootfs source package 2009-03-28 21:55:28 +00:00
emdebian.grip preparing the new emdebian-rootfs source package 2009-03-28 21:55:28 +00:00
emdebian.gtk preparing the new emdebian-rootfs source package 2009-03-28 21:55:28 +00:00
empbuilderlib preparing the new emdebian-rootfs source package 2009-03-28 21:55:28 +00:00
emrootfslib emrootfslib : Add for empty scripts to replace adduser 2009-06-13 17:03:01 +00:00
emsandbox preparing the new emdebian-rootfs source package 2009-03-28 21:55:28 +00:00
emsecondstage preparing the new emdebian-rootfs source package 2009-03-28 21:55:28 +00:00
Makefile preparing the new emdebian-rootfs source package 2009-03-28 21:55:28 +00:00
multistrap preparing the new emdebian-rootfs source package 2009-03-28 21:55:28 +00:00
README preparing the new emdebian-rootfs source package 2009-03-28 21:55:28 +00:00
TODO preparing the new emdebian-rootfs source package 2009-03-28 21:55:28 +00:00
update-rc.d Tweak the update-rc.d replacement to avoid using a backslash. (Closes: #530076) 2009-05-25 16:58:42 +00:00

			Emdebian Bootstrapping
			======================

Cross-building can get very confusing at times. The confusion only increases 
when dealing with a chroot. This document tries to cover some of the reasons, 
some of the problems and tries to provide some clarity, at least as far as how 
chroots can be used in Emdebian.

There are multiple ways that Emdebian can relate to bootstrapping and chroots. 
The most common method of using a chroot within Debian is pbuilder and the 
pdebuild wrapper and this is the primary inspiration for using chroots in 
Emdebian. Other methods revolve around QEMU or scratchbox and whilst this code 
may be able to support such uses later, there are key differences in how and 
why this method is separate.

EMDEBIAN PBUILDER CHROOT MODEL
==============================

The Debian pbuilder package exists to ensure package dependencies are complete 
and to provide an environment to automate package building on all supported 
Debian architectures without cluttering the build machine with every library 
and dev package in the entire archive. This is particularly useful when 
building GUI packages that can have two dozen dependencies or more. In 
Emdebian, this separation between the build system packages and the chroot 
packages becomes even more useful because cross-building often involves not 
only installing the library and -dev package for the build architecture (e.g. 
i386/amd64) but also building and installing the same library and -dev package 
(with dependencies) in the TARGET architecture, e.g. arm, with apt-cross and 
dpkg-cross. The chaos that could result from trying to upgrade the packages on 
an Emdebian buildd system with a duplicate set of cross dependencies is truly 
scary.

In the pbuilder model, an Emdebian chroot is the SAME architecture as the 
buildd - i386 on i386 etc. This mimics how emdebian-tools normally work. 
Packages are then downloaded, patched and cross-built for the target 
architecture, just as outside the chroot. This model, the pbuilder model of an 
emdebian chroot, concentrates on dependencies rather than the actual 
cross-building process. Inside such a chroot, cache files are used as normal to 
avoid having to run the cross-compiled code during the build.

The Emdebian chroot is similar in size to a normal Debian pbuilder chroot,
mainly because it is a full build environment, not an installation environment.

This directory contains my experiments with debootstrap, using this pbuilder 
model, trying to make a complete Emdebian cross-building environment that can 
be compressed to a base.tgz. Changes to the chroot can be discarded, just as 
with pbuilder, allowing dependencies to be tested. The main benefit is that 
packages can be built without having to install long chains of cross 
dependencies via apt-cross or dpkg-cross on the main system. To me, it's the 
only way to cross-build GUI suites like GPE against a background of changing 
dependencies.

In the pbuilder model, Emdebian builds a chroot for the build architecture 
(amd64/i386 etc.) - except that it will run emdebian-tools instead of pbuilder 
to create the arm binaries (or whichever architecture is the dpkg-cross 
default). I expect the same code to work for arm chroots on amd64 etc, but 
mechanisms already exist for those so it's not the priority. 

In order to make best use of the existing pbuilder code, these are shell scripts
whereas the rest of emdebian-tools uses perl.

DEPENDENCIES
------------

To emdebianise and cross-build packages, the chroot needs to install 
emdebian-tools. This brings in the majority of dependencies to support building 
Debian and Emdebian packages. This (current sample) code uses part of the
pbuilder source so that the eventual chroots behave as similarly as possible to
pbuilder and pdebuild in Debian. Therefore, the emdebian pbuilder chroot is NOT
designed or intended to be installed on any embedded device - it is intended for
cross-building packages for Emdebian only. See the SLIND installer for more
information or the emsandbox script in emdebian-tools.

empdebuild depends on pbuilder and installing emdebian-tools within a chroot 
causes pbuilder to be installed inside the chroot. Whilst empdebuild and emsandbox
could be split out into a separate package to prevent pbuilder being needed inside
the chroot, there are corner cases where this can be useful providing sufficient
care is taken.

DIFFERENCES TO PBUILDER
-----------------------

1. emdebian-tools handles the 'installaptlines' subroutine.
2. emdebian-tools dependencies handle the installation of build-essential dpkg-dev 
	and apt that pbuilder normally does separately.
3. emdebian-tools handles the BUILDPLACE via debconf.
4. Other embootstrap options are hardcoded - BUILDRESULT is placed in BUILDPLACE,
	APTCACHE also and APTCACHEHARDLINK is set to yes.
5. emdebian-tools provides the emdebianised source package and patches.

EMDEBIAN NATIVE CHROOT MODEL
============================

The same code should also be able to create a native chroot so that the 
cross-built packages can be installed alongside each other for more testing. 
These chroots have already been tested and instructions exist in the Wiki: 
http://wiki.debian.org/EmDebian/CrossDebootstrap

Trying to cross-build inside scratchbox limits you to where scratchbox will 
install which is only certain architectures. emdebian-tools is about 
cross-building Debian packages using normal Debian tools on a normal Debian 
system. Emdebian and emdebian-tools are designed to make building inside 
scratchbox redundant because it simply isn't sufficiently flexible. A 
scratchbox2 has been mooted but nothing has happened yet.

Cross-build using normal tools (maybe using the chroot as above) and then test 
either on a native device or via scratchbox if you really have to.

An Emdebian native chroot would be an arm chroot running on an amd64 system - 
indeed it would need to support creation of a chroot *for* any supported Debian 
architecture and be able to create and run that chroot *on* any supported 
Debian architecture.

This is only the first draft - if there are areas that need further clarification
or updating, please email the debian-embedded mailing list.