root/current/host/trunk/emdebian-tools/trunk/pbuilder/README

Revision 1307, 6.1 kB (checked in by codehelp, 19 months ago)

fixing bootstrap package lists

Line 
1                        Emdebian Bootstrapping
2                        ======================
3
4Cross-building can get very confusing at times. The confusion only increases
5when dealing with a chroot. This document tries to cover some of the reasons,
6some of the problems and tries to provide some clarity, at least as far as how
7chroots can be used in Emdebian.
8
9There are multiple ways that Emdebian can relate to bootstrapping and chroots.
10The most common method of using a chroot within Debian is pbuilder and the
11pdebuild wrapper and this is the primary inspiration for using chroots in
12Emdebian. Other methods revolve around QEMU or scratchbox and whilst this code
13may be able to support such uses later, there are key differences in how and
14why this method is separate.
15
16EMDEBIAN PBUILDER CHROOT MODEL
17==============================
18
19The Debian pbuilder package exists to ensure package dependencies are complete
20and to provide an environment to automate package building on all supported
21Debian architectures without cluttering the build machine with every library
22and dev package in the entire archive. This is particularly useful when
23building GUI packages that can have two dozen dependencies or more. In
24Emdebian, this separation between the build system packages and the chroot
25packages becomes even more useful because cross-building often involves not
26only installing the library and -dev package for the build architecture (e.g.
27i386/amd64) but also building and installing the same library and -dev package
28(with dependencies) in the TARGET architecture, e.g. arm, with apt-cross and
29dpkg-cross. The chaos that could result from trying to upgrade the packages on
30an Emdebian buildd system with a duplicate set of cross dependencies is truly
31scary.
32
33In the pbuilder model, an Emdebian chroot is the SAME architecture as the
34buildd - i386 on i386 etc. This mimics how emdebian-tools normally work.
35Packages are then downloaded, patched and cross-built for the target
36architecture, just as outside the chroot. This model, the pbuilder model of an
37emdebian chroot, concentrates on dependencies rather than the actual
38cross-building process. Inside such a chroot, cache files are used as normal to
39avoid having to run the cross-compiled code during the build.
40
41The Emdebian chroot is similar in size to a normal Debian pbuilder chroot,
42mainly because it is a full build environment, not an installation environment.
43
44This directory contains my experiments with debootstrap, using this pbuilder
45model, trying to make a complete Emdebian cross-building environment that can
46be compressed to a base.tgz. Changes to the chroot can be discarded, just as
47with pbuilder, allowing dependencies to be tested. The main benefit is that
48packages can be built without having to install long chains of cross
49dependencies via apt-cross or dpkg-cross on the main system. To me, it's the
50only way to cross-build GUI suites like GPE against a background of changing
51dependencies.
52
53In the pbuilder model, Emdebian builds a chroot for the build architecture
54(amd64/i386 etc.) - except that it will run emdebian-tools instead of pbuilder
55to create the arm binaries (or whichever architecture is the dpkg-cross
56default). I expect the same code to work for arm chroots on amd64 etc, but
57mechanisms already exist for those so it's not the priority.
58
59In order to make best use of the existing pbuilder code, these are shell scripts
60whereas the rest of emdebian-tools uses perl.
61
62DEPENDENCIES
63------------
64
65To emdebianise and cross-build packages, the chroot needs to install
66emdebian-tools. This brings in the majority of dependencies to support building
67Debian and Emdebian packages. This (current sample) code uses part of the
68pbuilder source so that the eventual chroots behave as similarly as possible to
69pbuilder and pdebuild in Debian. Therefore, the emdebian pbuilder chroot is NOT
70designed or intended to be installed on any embedded device - it is intended for
71cross-building packages for Emdebian only. See the SLIND installer for more
72information or the emsandbox script in emdebian-tools.
73
74empdebuild depends on pbuilder and installing emdebian-tools within a chroot
75causes pbuilder to be installed inside the chroot. Whilst empdebuild and emsandbox
76could be split out into a separate package to prevent pbuilder being needed inside
77the chroot, there are corner cases where this can be useful providing sufficient
78care is taken.
79
80DIFFERENCES TO PBUILDER
81-----------------------
82
831. emdebian-tools handles the 'installaptlines' subroutine.
842. emdebian-tools dependencies handle the installation of build-essential dpkg-dev
85        and apt that pbuilder normally does separately.
863. emdebian-tools handles the BUILDPLACE via debconf.
874. Other embootstrap options are hardcoded - BUILDRESULT is placed in BUILDPLACE,
88        APTCACHE also and APTCACHEHARDLINK is set to yes.
895. emdebian-tools provides the emdebianised source package and patches.
90
91EMDEBIAN NATIVE CHROOT MODEL
92============================
93
94The same code should also be able to create a native chroot so that the
95cross-built packages can be installed alongside each other for more testing.
96These chroots have already been tested and instructions exist in the Wiki:
97http://wiki.debian.org/EmDebian/CrossDebootstrap
98
99Trying to cross-build inside scratchbox limits you to where scratchbox will
100install which is only certain architectures. emdebian-tools is about
101cross-building Debian packages using normal Debian tools on a normal Debian
102system. Emdebian and emdebian-tools are designed to make building inside
103scratchbox redundant because it simply isn't sufficiently flexible. A
104scratchbox2 has been mooted but nothing has happened yet.
105
106Cross-build using normal tools (maybe using the chroot as above) and then test
107either on a native device or via scratchbox if you really have to.
108
109An Emdebian native chroot would be an arm chroot running on an amd64 system -
110indeed it would need to support creation of a chroot *for* any supported Debian
111architecture and be able to create and run that chroot *on* any supported
112Debian architecture.
113
114This is only the first draft - if there are areas that need further clarification
115or updating, please email the debian-embedded mailing list.
Note: See TracBrowser for help on using the browser.