1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438
|
The files in this directory are used to build the Debian installer.
Basically it consists of downloading udebs, unpacking them, applying some
magic (library reduction etc.) and building an image.
Warning: The build system for the installer is often tightly bound to the
version of Debian for which it is targeted. If you are using stable, use
"apt-get source debian-installer" to get a version of the installer that
will build on your system. If you are using testing or unstable, check out
a copy of the installer using the command
"svn co svn://svn.d-i.alioth.debian.org/svn/d-i/trunk/installer"
Recipe:
- Install the build-dependencies on the host system
(run dpkg-checkbuilddeps in the parent installer/ directory).
- Create your own sources.list.udeb.local, otherwise the build host's
sources.list is taken as a template for sources.list.udeb.
- Run "make" to get a list of available targets.
- Build an image using one of the build_ targets (build_netboot,
all_build, etc).
- Look in dest/ for the completed images.
Note that this does not create full debian ISO images; that is left to the
debian-cd package. As a shortcut, you can create a mini-ISO image, with
only the netboot initrd on it. make build_netboot will create a
dest/netboot/mini.iso, using isolinux. Any size initrd can be placed on
this ISO, which may be useful for testing.
A more detailed overview of how the installer is built:
* 'sources.list.udeb' is used to configure apt to download udebs from a
mirror. It is autogenerated based on '/etc/apt/sources.list', by the
Makefile's 'sources.list.udeb' target. Or you can provide your own
locally modified 'sources.list.udeb.local'.
* The Makefile is configured via the make fragments in the config
directory. These are organized in a subarch/medium/flavour hierarchy and
get included by the main Makefile.
* config/local can be added to override anything set in other fragments
which are local to your system which you want to avoid accidentially
committing.
* 'pkg-lists' has subdirectories for the different image types that list
udebs that are put on each image. The pkg-lists/*/common files list
udebs common to all architectures, and the files named by architecture
(<arch>.cfg) list udebs specific to an architecture. It is also possible
to include udebs only on a specific subarchitecture by creating a
directory for the architecture and putting config files for the
subarchitecture there (<arch>/<subarch>.cfg). All of these files can
have #include lines to include files from pkg-lists. Also,
${kernel:Version} in these files is replaced with the kernel version,
as set in the KERNELIMAGEVERSION variable (plus the KERNEL_FLAVOUR
variable).
* Anything listed in pkg-lists/local and pkg-lists/*/local is included in
the image that is built. This is to provide an easy way to add extra
udebs to a test image.
* All dependencies of packages in pkg-lists are automatically included
in an image by default. If you know that some of the dependencies are
wrong, or do not apply to an image, you can remove dependencies from the
pkg-lists by listing them and putting a space and minus sign after them.
* If you need to include a package for one major version of a kernel, but
not for another, put the kernel major version(s) that should have the
package in brackets at the end of the line.
For example: discover1 [2.2 2.4]
* Similarly, if you need to include a package for only one type of kernel,
put the name of the kernel(s) that should have the package in brackets at
the end of the line.
For example: gnumach-udeb [hurd]
* If you'd like to include a given package only if it's available, and not
fail otherwise, put a question mark at the end of the line.
For example: pcmcia-modules-${kernel:Version} ?
It's recommended to use this option seldom and with care as it can make the
build less robust if packages can be dropped from it without warning.
* Apt is used to download the required udebs. This does *not* include
libraries; libraries used by udebs must be installed on the build system,
and so are build-depended on.
* If you have some udebs that are not available on your mirror yet,
you can drop them in 'localudebs/' and they will be used.
* dpkg is used to unpack the udebs into the build directory.
* A customized set of reduced libraries is generated to correspond to the
udebs that were installed.
* Some boot images have associated "driver" disks. These disks just get
udebs put on them.
* The final images are put in the dest/ directory.
------------
The debian-installer build system
---------------------------------
The build system is designed to allow the addition of configurations
with minimal effort. It achieves this by evaluating some magic
variables from the configuration snippet and feeding some generic
rules you hopefully never need to know about. The configuration
snippets live in the config/ directory and are organized in a
hierarchical tree structure, the directory names therein have also a
specific meaning. It follows a config/$ARCH/$SUBARCH/$MEDIUM/$FLAVOUR
scheme, where $ARCH is mandatorily the debian architecture name. For
the other three, the requirement is you need to use at least one.
$SUBARCH is supposed to be the subarchitecture. For e.g. m68k this
would be something like "amiga" or "atari", i386 doesn't use it.
$MEDIUM is the boot medium, like "cdrom", "floppy", "netboot".
$FLAVOUR distinguishes between other differences, like 2.4 vs. 2.6
kernels, or several floppy images.
Note: You don't have to follow this usage strictly, the variable naming
is merely a hint. It could also have been named as $LEVEL1/$LEVEL2/LEVEL3.
Note2: The resulting file tree in the dest/ directory has a similiar
$SUBARCH/$MEDIUM/$FLAVOUR layout. It can be slightly adapted with the
EXTRANAME and DEST_SOME variables.
A example tree layout looks like this:
config
|-- i386
| |-- cdrom
| | |-- el-torito-2.6.cfg
| | |-- el-torito.cfg
| | |-- isolinux-2.6.cfg
| | `-- isolinux.cfg
| |-- cdrom.cfg
| |-- floppy
| | |-- boot.cfg
| | |-- cd-drivers.cfg
| | `-- root.cfg
| |-- floppy.cfg
| |-- hd-media
| | `-- 2.6.cfg
| |-- hd-media.cfg
| |-- monolithic
| | `-- 2.6.cfg
| |-- monolithic.cfg
| |-- netboot
| | `-- 2.6.cfg
| `-- netboot.cfg
`-- i386.cfg
In the first level, you have an $ARCH directory, and an $ARCH.cfg
configuration snippet, which needs to define what to use from the tree
below, and can also define commonly used variables for all
configurations of this architecture. An example $ARCH.cfg would look
like this:
SUBARCH_SUPPORTED = r4k-ip22 r5k-ip22 sb1-bcm91250a miniiso
KERNELMAJOR = 2.4
KERNELMINOR = 25
KERNEL_FLAVOUR = di
KERNELIMAGEVERSION = $(KERNELVERSION)
KERNELNAME = $(foreach ver,$(KERNELVERSION),vmlinux-$(ver))
VERSIONED_SYSTEM_MAP = t
arch_boot_screens:
The SUBARCH_SUPPORTED line defines what to look up in the next
directory level. In this case, these are the configuration snippets
r4k-ip22.cfg, r5k-ip22.cfg, sb1-bcm91250a.cfg and miniiso.cfg. Each of
those snippets can define a MEDIUM_SUPPORTED variable, which
opens the next subdirectory level. Those subdirectories have to have
the name of their subarchitecture, for the example above e.g. r4k-ip22
or sb1-bcm91250a.
The various KERNEL* variables are common for all configurations of this
architecture, so they were moved upwards from the leaf configuration
snippets. The same can be done for make rules.
Caveats:
- You can re-/undefine variables defined in a higher level, but you
can't do that for rules. Make will complain about it.
- Use always recursively expanded variables (that is '=', not ':=').
Make works though the tree by recursively calling itself. If you
use simply expanded variables, the variables of higher levels (like
*_SUPPORTED) won't get re-evaluated, and things will break.
Interesting Variables in configuration snippets
-----------------------------------------------
First, mandatory variables:
SUBARCH_SUPPORTED
MEDIUM_SUPPORTED
FLAVOUR_SUPPORTED
As already explained, they define what configurations the build
system should look for. They cause the definition of SUBARCH,
MEDIUM and FLAVOUR for every snippet they invoke that way.
At least one of them must be defined.
KERNELMAJOR
The high part of the kernel version, like "2.6". Unluckily, this is
what the kernel people call MAJOR.MINOR.
KERNELVERSION
The version of the kernel .udeb package, like "2.4.26-r4k-ip22"
KERNEL_FLAVOUR
The flavour of the kernel .udeb package. This has nothing to do with
FLAVOUR. It has always a value of "di" these days.
KERNELIMAGEVERSION
The version part of the kernel image's name.
KERNELNAME
The full name of the kernel image. If you build an EXTRA target (e.g.
for a driver floppy), this variable has to be empty.
TYPE
This variable points to the subdirectory in pkg-lists/ which should
be used for this config. E.g. $TYPE=cdrom means that
pkg-lists/cdrom/local, pkg-lists/cdrom/common and
pkg-lists/cdrom/<arch> are used. Defaults to $(MEDIUM)/.
Targets:
TARGET
Define this variable in the leaf configuration snippet to one or more
of the following generic targets, and any local target you want to
run.
INITRD
Create an gzipped initrd.gz.
KERNEL
Create the kernel image.
BOOT
Create an optinally gzipped bootable image. This creates kernel,
initrd and boot screens, and depends on the arch_boot rule, where the
image creation is handled.
ROOT
Create an optionally gzipped root image. This creates an initrd and
depends on the arch_root rule, where the image creation is handled.
EXTRA
This creates a file system image with driver .udebs in it.
MINIISO
This creates a mini ISO image, by creating the boot screens and
depending on arch_miniiso rule, where the image creation is handled.
DEBIAN_CD_INFO
This provides the boot screens in a gzipped tarball.
MISC
This copies files to the destination directory of your configuration.
MANIFEST-INITRD
MANIFEST-KERNEL
MANIFEST-BOOT
MANIFEST-ROOT
MANIFEST-EXTRA
MANIFEST-MINIISO
MANIFEST-DEBIAN_CD_INFO
MANIFEST-MISC
These variables correspond to the generic targets and hold their
description which is added to the MANIFEST file in the dest/
directory.
TEMP_INITRD
TEMP_UDEB_LIST
TEMP_KERNEL
TEMP_BOOT
TEMP_ROOT
TEMP_MINIISO
TEMP_EXTRA
TEMP_BOOT_SCREENS
TEMP_CD_TREE
TEMP_POWERPC_INITRD
Those are intermediate targets. Everything is built for them, the
generic targets copy the stuff they are interested in over to the
dest/ and add the MANIFEST entry. They are useful as dependencies for
things which needs to be built but shouldn't show up in the
destination directory. You should never need to redefine them.
Other useful variables for configuration snippets:
EXTRANAME
This allows to vary the name of the dest/ target a bit. Example:
EXTRANAME = $(MEDIUM)/ leads to: floppy/netboot.img
EXTRANAME = $(MEDIUM)- leads to: floppy-netboot.img
Nice to avoid subdirectories with only a single file in it.
DEST
The destination directory of your configuration.
Caveat: Always use $(DEST), not ./dest/foo/... The latter will only
work for one specific location, and fails if you relocate the
configuration snippet in the tree. DEST changes its definition for
every leaf configuration appropriately.
SOME_DEST
Like DEST, but with the last path element removed. Mostly useful in
combination with EXTRANAME.
TEMP
The intermediate directory, where everything is built.
Caveat: Always build stuff in TEMP, and then install to DEST from
there. Doing this differently tends to turn into a mess.
Caveat2: Always use $(TEMP), not ./tmp/foo/... The latter will only
work for one specific leaf configuration. TEMP changes its definition
for every leaf configuration appropriately.
DROP_LANG
Purge unwanted locales. Mostly useful for space constrained media.
VERSIONED_SYSTEM_MAP
If set, the kernel's System.map is expected to have an unique
filename for each kernel of this architecture.
FLOPPY_SIZE
The size of a floppy image, in kilobytes.
IMAGE_SIZE
The size of a an image, in kilobytes. Only needed and supported for
some types of images.
DISK_LABEL
Disk label to use when formating disk images. Allowed content varies
by disk type.
MEDIA_TYPE
The type of media produced, currently used to make qemu boot the image
properly. Suggested values: "CD-ROM", "netboot image", "floppy", etc.
DEBIAN_VERSION
The debian version descriptive name.
DOS_VOLUME_ID
DOS_VOLUME_LABEL
Volume ID and label for DOS filesystems.
GZIPPED
Create gzipped images. This works only for the BOOT, ROOT and EXTRA
targets.
EXTRADRIVERS
This variable points to the directories where additional driver
.udebs reside. This causes these .udebs to be considered in the font
and library reduction steps, so the characters and library symbols needed
for them are kept.
EXTRATARGETS
Additional targets which are run before the ones in TARGET. This is
e.g. useful to build the additional driver images first, and then
use their intermediate tree for EXTRADRIVERS.
EXTRAUDEBS
This variable points to additional udebs that should be considered by the
library reduction step. cdebconf plugins should be listed here so the
symbols they will need are available on the initrd (since cdebconf runs
using the initrd libc, its plugins do too)
DRIVER_FOR
The variable indicates that the image is just a driver image for some
other image. The value points to the directory in pkg-lists for the image
that it's a driver for.
UPX
If this variable is set, it should point to a usable UPX compressor.
This is then used to create UPX compressed kernels.
SYSLINUX_OPTS
Additional syslinux options.
SPLASH_RLE
The syslinux splash screen file.
INITRD_FS
The filesystem to use for initrds, needs to be built into the kernel.
ext2, cramfs, initramfs, or jffs2.
MKFS_JFFS2
If using jffs2 for the INITRD_FS, you will need to set this variable to
a command to use to create the image.
For example: MKFS_JFFS2 = mkfs.jffs2 -f -p -b -e 0x20000
WRITE_MEDIA
Add you configuration's name if it can be written to a raw device.
Mostly useful for floppies.
UDEB_LISTS
List of files listing udebs that were used to build the image.
Variables useful for testing:
FLOPPYDEV
The device name to use for writing a image to a raw device.
QEMU
The name of the qemu emulator binary.
EXTRAS
Add additional .udebs to the target image.
EXTRAFILES
Add additional files to the target image.
MIRROR
The mirror to get .deb and .udeb packages from. Defaults to the same
as the host machine uses.
SUITE
The suite to use for the build. Defaults to unstable.
UDEB_COMPONENTS
Archive components from which to fetch .udeb packages. Defaults to
main/debian-installer.
PRESEED
An initrd preseed file to put in the initrd.
PRESEED_SUITE
An initrd preseed file to append to any other preseed file put in the
initrd by PRESEED; used to preseed the suite for daily builds.
Rules invoked from the various targets:
arch_boot:
The bootable image TEMP_BOOT is created in this rule, usually from
TEMP_KERNEL and TEMP_INITRD, and probably from TEMP_BOOT_SCREENS and
other files.
arch_root:
The root image TEMP_ROOT is created in this rule, usually from
TEMP_INITRD, and probably some other files.
arch_boot_screens:
The boot screens in TEMP_BOOT_SCREENS are created here.
arch_miniiso:
The mini ISO image TEMP_MINIISO is built here, from whatever the
particular (sub-)architecture needs for it.
|