| 1 |
|
|---|
| 2 |
LFS LiveCD Makefiles |
|---|
| 3 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 4 |
|
|---|
| 5 |
I. Introduction |
|---|
| 6 |
II. Using the Makefiles |
|---|
| 7 |
A. How These Makefiles Work |
|---|
| 8 |
B. Configuring the Environment |
|---|
| 9 |
C. Obtaining the Sources |
|---|
| 10 |
D. Running the Scripts |
|---|
| 11 |
III. Editing the Makefiles |
|---|
| 12 |
IV. End Notes |
|---|
| 13 |
|
|---|
| 14 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 15 |
|
|---|
| 16 |
I. Introduction |
|---|
| 17 |
|
|---|
| 18 |
There have been many LiveCDs (aka BootCDs) made and used within the LFS |
|---|
| 19 |
community. Of particular note were Chris Lingard's and Jeremy Utley's. By some |
|---|
| 20 |
random freak of chance, and perhaps a bit of persistence on my part, a CD of |
|---|
| 21 |
mine was chosen to be used as the 'Official' LFS CD with the release of |
|---|
| 22 |
LFS 6.0. |
|---|
| 23 |
|
|---|
| 24 |
I based much of my work on the ideas and work of Chris and Jeremy, and from |
|---|
| 25 |
suggestions and comments from various LFS users, but the originalCD had still |
|---|
| 26 |
been largely my work. However, for the idea of an official CD to survive and |
|---|
| 27 |
grow within the community, help and ideas need to continue to come from more |
|---|
| 28 |
than just one source. |
|---|
| 29 |
|
|---|
| 30 |
My intention with the LFS LiveCD project, then, was to devise a framework, a |
|---|
| 31 |
usable setting in which others may contribute and build CDs that live up to the |
|---|
| 32 |
official standard. Originally, the idea was just to keep config files and a |
|---|
| 33 |
list of required packages in a Subversion repository. What actually happened |
|---|
| 34 |
was that a fully automated scripting system was devised specifically for the |
|---|
| 35 |
purpose of building the LiveCD iso. This allows both an easily repeatable way |
|---|
| 36 |
of building the CD and a means to track its configuration and history. |
|---|
| 37 |
|
|---|
| 38 |
Many thanks to all who have contributed to the production of these Makefiles |
|---|
| 39 |
(and the CDs they in turn produce) by either suggestions, ideas, support, or |
|---|
| 40 |
submitted edits. |
|---|
| 41 |
|
|---|
| 42 |
- Jeremy Huntwork |
|---|
| 43 |
|
|---|
| 44 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 45 |
|
|---|
| 46 |
II. Using the Makefiles |
|---|
| 47 |
|
|---|
| 48 |
A. How These Makefiles Work |
|---|
| 49 |
|
|---|
| 50 |
There is one main Makefile at the top-level of this directory that controls |
|---|
| 51 |
the build. It contains the instructions to control and direct the build, |
|---|
| 52 |
including the order in which the packages are built. It also contains variables |
|---|
| 53 |
that are used throughout the build. Inside the packages directory there is |
|---|
| 54 |
a sub-directory for each package the LiveCD will build and install. Each of |
|---|
| 55 |
those directories contains a Makefile specific for that package, with the |
|---|
| 56 |
specific instructions it needs in order to compile. Any patches which that |
|---|
| 57 |
package needs (and which are not part of the LFS or BLFS books) are included |
|---|
| 58 |
in that directory as well. |
|---|
| 59 |
|
|---|
| 60 |
Part of the build is run as an unprivileged user, 'lfs', and the rest is |
|---|
| 61 |
done after chroot-ing into the $(MP) directory (see the Configuring the |
|---|
| 62 |
Environment section for information about $(MP) and other variables). In order |
|---|
| 63 |
to make that happen, the Makefile approximately runs "su - lfs -c '[commands]'" |
|---|
| 64 |
or "chroot $(MP) /bin/bash -c '[commands]'" where [commands] is the |
|---|
| 65 |
instructions necessary to cd into the proper directory and re-run 'make' with |
|---|
| 66 |
the proper target. So the Makefile is essentially re-calling itself as a |
|---|
| 67 |
different user or in a different environment. |
|---|
| 68 |
|
|---|
| 69 |
In the correct order, and in the proper environment, each package's Makefile |
|---|
| 70 |
is called and run. These download the source files it needs, verifies that |
|---|
| 71 |
they are correct via sha1sum, unpacks the tarballs into its own directory, |
|---|
| 72 |
runs the build instructions and sends the output into a log-file. |
|---|
| 73 |
|
|---|
| 74 |
B. Configuring the Environment |
|---|
| 75 |
|
|---|
| 76 |
You should visually inspect the main Makefile, the one in the same directory |
|---|
| 77 |
as this README before attempting to run the scripts. There are a few variables |
|---|
| 78 |
that you may want to customize to meet the needs of your own particular setup |
|---|
| 79 |
and for the type of CD you are hoping to produce. Here's a list of the main |
|---|
| 80 |
variables to look for: |
|---|
| 81 |
|
|---|
| 82 |
* LFS-ARCH |
|---|
| 83 |
This variable sets the architecture of the CD you are attempting to build. |
|---|
| 84 |
The scripts assume that you are building the CD on such a host as well. At |
|---|
| 85 |
this time, possible values are 'x86', 'ppc' or 'sparc'. |
|---|
| 86 |
|
|---|
| 87 |
* VERSION |
|---|
| 88 |
This variable will be used in various places throughout the build and |
|---|
| 89 |
should equal the version of the CD you intend to build. If you are building |
|---|
| 90 |
this CD for personal use, you can enter anything here. LFS LiveCD editors will |
|---|
| 91 |
follow a specific versioning scheme. |
|---|
| 92 |
|
|---|
| 93 |
* KVERS |
|---|
| 94 |
This is the version of the Linux kernel to include on the CD |
|---|
| 95 |
|
|---|
| 96 |
* MP |
|---|
| 97 |
This is the Mount Point, the directory that you will be using to house the |
|---|
| 98 |
build as it runs. These scripts (this entire directory and its sub-directories) |
|---|
| 99 |
should be placed inside the MP directory and run from there. Default is |
|---|
| 100 |
/mnt/lfs. |
|---|
| 101 |
|
|---|
| 102 |
* ROOT |
|---|
| 103 |
This signifies the root-point of the build scripts. In other words, this |
|---|
| 104 |
is the name of the actual directory containing the build scripts. Default is |
|---|
| 105 |
/lfs-livecd. If you accept the defaults for both this variable and MP, then |
|---|
| 106 |
this directory and all its sub-directories should exist as 'lfs-livecd' within |
|---|
| 107 |
the direcotry '/mnt/lfs'. It is important that this variable have a leading |
|---|
| 108 |
'/' as it is referenced by the scripts in both the host environment and the |
|---|
| 109 |
chroot environment. |
|---|
| 110 |
|
|---|
| 111 |
* PM |
|---|
| 112 |
This is the level of parallel building you want make to use for each |
|---|
| 113 |
package. Default is -j3, but you may wish to increase or decrease it slightly |
|---|
| 114 |
as the case may be. |
|---|
| 115 |
|
|---|
| 116 |
Any of the other variables could be changed, but that isn't recommended. Some |
|---|
| 117 |
of them are crucial to the successful building of the CD, especially the ones |
|---|
| 118 |
containing environment variables. |
|---|
| 119 |
|
|---|
| 120 |
C. Obtaining the Sources |
|---|
| 121 |
|
|---|
| 122 |
The scripts will attempt to download the sources as it needs them. Since it |
|---|
| 123 |
is highly unlikely that you will have all the correct sources already |
|---|
| 124 |
downloaded to your system, a working internet connection is almost a |
|---|
| 125 |
necessity when using these scripts. |
|---|
| 126 |
|
|---|
| 127 |
If you want to gather the source packages you'll need beforehand, you will |
|---|
| 128 |
need to create a directory called 'sources' in the $(MP) directory and place |
|---|
| 129 |
your packages there. You should either ensure that you download the *exact* |
|---|
| 130 |
same package from the same URL the scripts use, or you should verify that |
|---|
| 131 |
the SHA1 sum in that package's Makefile matches the tarball you have |
|---|
| 132 |
downloaded. |
|---|
| 133 |
|
|---|
| 134 |
D. Running the Scripts |
|---|
| 135 |
|
|---|
| 136 |
Building the CD could be as simple as the following: |
|---|
| 137 |
|
|---|
| 138 |
mkdir /mnt/lfs |
|---|
| 139 |
cd /mnt/lfs |
|---|
| 140 |
svn co svn://svn.linuxfromscratch.org/livecd/[path of repo] lfs-livecd |
|---|
| 141 |
(or, 'tar -xjf [path to tarball]'if you have downloaded a tarball of these |
|---|
| 142 |
scripts) |
|---|
| 143 |
cd /mnt/lfs/lfs-livecd |
|---|
| 144 |
make |
|---|
| 145 |
|
|---|
| 146 |
The above example makes use of the default variables for $(MP) and $(ROOT). |
|---|
| 147 |
|
|---|
| 148 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 149 |
|
|---|
| 150 |
III. Editing the Makefiles |
|---|
| 151 |
|
|---|
| 152 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 153 |
|
|---|
| 154 |
IV. End Notes |
|---|