annotate common/README @ 40:ef471ef37665 draft default tip

Yank reliance on ash.
author Rob Landley <rob@landley.net>
date Sat, 18 Jul 2015 01:39:24 -0500
parents bcd2e358d57f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
1 Common infrastructure for natively building packages on target.
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
2
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
3 This contains a top level file run on the host to create a control image:
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
4
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
5 control-image-wrapper.sh - script run on host to create a control image.
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
6
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
7 And several files in the "mnt" subdirectory which are copied to the target:
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
8
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
9 init - First script run in a control image. Copies root filesystem into
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
10 /home/chroot to get a writeable filesystem build can install more
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
11 packages into, and --bind mounts other directories in as appropriate
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
12 so the result actually works. Chroots into the new filesystem
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
13 and runs /mnt/run-build-stages.sh. When chroot exits, cleans up
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
14 bind mounts, tars up the result, and uploads it to the host via ftp.
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
15
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
16 functions.sh - reusable functions like set_titlebar and dotprogress.
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
17
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
18 run-build-stages.sh - Loop through /mnt/package-list calling
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
19 /mnt/build-one-package.sh on each entry, in order. Stop at the first
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
20 failed package.
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
21
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
22 This script also maintains a manifest file listing installed packages,
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
23 skipping already installed packages when re-run unless $FORCE is set.
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
24
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
25 If $FILTER is set, skips listed packages (name|name|name). Packages
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
26 can be annotated with categories (in #comments at the end of each
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
27 line) which $FILTER can also skip.
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
28
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
29 build-one-package.sh - Build a single package listed on the command line.
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
30
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
31 If /mnt/build/$NAME.nosrc exists, this runs it. Otherwise, copy a
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
32 symlink tree from /mnt/packages/$NAME to /home/$NAME (via "cp -s",
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
33 first deleting any old /home/$NAME if it exists), then cd to
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
34 the new directory and run /mnt/build/$NAME.sh. On success, delete
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
35 /home/$NAME on the way out.
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
36
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
37 To use this infrastructure, create a new project subdirectory with
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
38 "make-control-image.sh", "download.sh", "mnt/package-list", and
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
39 "mnt/build/*", I.E.:
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
40
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
41 1) Create a new sources/control-images/MYPROJECT subdirectory.
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
42
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
43 2) Symlink the control image wrapper to make-control-image.sh in your new
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
44 directory, ala:
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
45
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
46 ln -s ../bootstrap-skeleton/control-image-wrapper.sh make-control-image.sh
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
47
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
48 3) Create a download.sh script to fetch/extract/prepare your package source.
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
49
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
50 The control image wrapper script calls this download.sh configured so that
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
51 using the "download" function to grab packages from $URL (with $SHA1, using
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
52 the normal cacheing infrastructure) will automatically extract each
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
53 package into the "packages" subdirectory of the new control image. The
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
54 tarball will wind up in a subdirectory under the top level "packages"
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
55 directory on the host.
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
56
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
57 This script gets run at control image creation time, it is not copied to
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
58 the target. Remember to mark it executable.
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
59
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
60 4) Create a "mnt" subdirectory under your new proect subdirectory, containing
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
61 additional files to be copied verbaim into the control image. You will need
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
62 at least:
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
63
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
64 A) package-list - file listing packages to install, in order, one per line.
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
65
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
66 B) build - directory containing $PACKAGE.sh and $PACKAGE.nosrc build scripts.
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
67
bcd2e358d57f Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff changeset
68 See the gentoo-boostrap and lfs-bootstrap directories for examples.