| 1 |
|
|---|
| 2 |
LFS LiveCD Makefiles |
|---|
| 3 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 4 |
|
|---|
| 5 |
I. Using the Makefiles |
|---|
| 6 |
A. How These Makefiles Work |
|---|
| 7 |
B. Configuring the Environment |
|---|
| 8 |
C. Obtaining the Sources |
|---|
| 9 |
D. Running the Scripts |
|---|
| 10 |
II. Editing the Makefiles |
|---|
| 11 |
III. End Notes |
|---|
| 12 |
|
|---|
| 13 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 17 |
|
|---|
| 18 |
I. Using the Makefiles |
|---|
| 19 |
|
|---|
| 20 |
A. How These Makefiles Work |
|---|
| 21 |
|
|---|
| 22 |
There is one main Makefile at the top-level of this directory that controls |
|---|
| 23 |
the build. It contains the instructions to control and direct the build, |
|---|
| 24 |
including the order in which the packages are built. It also contains variables |
|---|
| 25 |
that are used throughout the build. Inside the packages directory there is |
|---|
| 26 |
a sub-directory for each package the LiveCD will build and install. Each of |
|---|
| 27 |
those directories contains a Makefile with the specific instructions it needs to |
|---|
| 28 |
compile that package. Any patches which that package needs (and which are not |
|---|
| 29 |
part of the LFS or BLFS books) are included in that directory as well. |
|---|
| 30 |
|
|---|
| 31 |
Part of the build is run as an unprivileged user, 'lfs', and the rest is |
|---|
| 32 |
done after chroot-ing into the $(MP) directory (see the Configuring the |
|---|
| 33 |
Environment section for information about $(MP) and other variables). In order |
|---|
| 34 |
to make that happen, the Makefile approximately runs "su - lfs -c '[commands]'" |
|---|
| 35 |
or "chroot $(MP) /bin/bash -c '[commands]'" where [commands] is the |
|---|
| 36 |
instructions necessary to cd into the proper directory and re-run 'make' with |
|---|
| 37 |
the proper target. So the Makefile is essentially re-calling itself as a |
|---|
| 38 |
different user or in a different environment. |
|---|
| 39 |
|
|---|
| 40 |
In the correct order, and in the proper environment, each package's Makefile |
|---|
| 41 |
is called and run. These download the source files needed, verify the SHA1 sums, |
|---|
| 42 |
unpack the tarball(s) into its own directory, run the build instructions, and |
|---|
| 43 |
send the output into a log-file. |
|---|
| 44 |
|
|---|
| 45 |
B. Configuring the Environment |
|---|
| 46 |
|
|---|
| 47 |
You should visually inspect the main Makefile, the one in the same directory |
|---|
| 48 |
as this README before attempting to run the scripts. There are a few variables |
|---|
| 49 |
that you may want to customize to meet the needs of your own particular setup |
|---|
| 50 |
and for the type of CD you are hoping to produce. Here is a list of the main |
|---|
| 51 |
variables to look for: |
|---|
| 52 |
|
|---|
| 53 |
* VERSION |
|---|
| 54 |
This variable will be used in various places throughout the build and |
|---|
| 55 |
should equal the version of the CD you intend to build. If you are building |
|---|
| 56 |
this CD for personal use, you can enter anything here. LFS LiveCD editors will |
|---|
| 57 |
follow a specific versioning scheme. |
|---|
| 58 |
|
|---|
| 59 |
* MPBASE |
|---|
| 60 |
This is the Mount Point, the directory that you will be using to house the |
|---|
| 61 |
build as it runs. These scripts (this entire directory and its sub-directories) |
|---|
| 62 |
should be placed inside the $MPBASE directory and run from there. Default is |
|---|
| 63 |
/mnt/lfs. |
|---|
| 64 |
|
|---|
| 65 |
* ROOT |
|---|
| 66 |
This signifies the root-point of the build scripts. In other words, this is |
|---|
| 67 |
the name of the directory containing the build scripts. A symlink will be made |
|---|
| 68 |
from this directory to the root of the host filesystem. The default name of this |
|---|
| 69 |
directory is lfs-livecd. If you accept the defaults for both this variable and |
|---|
| 70 |
$MPBASE, then this directory will exist as /mnt/lfs/lfs-livecd. A symlink will |
|---|
| 71 |
be made to /lfs-livecd on the host system. It is important that this variable |
|---|
| 72 |
have a leading '/' as it is referenced by the scripts in both the host |
|---|
| 73 |
environment and the chroot environment. |
|---|
| 74 |
|
|---|
| 75 |
All of the above variables (and others) can be edited directly in the |
|---|
| 76 |
top-level Makefile (the one in the same directory as this README). However, if |
|---|
| 77 |
you are tracking SVN, then each 'svn up' will overwrite your custom changes. To |
|---|
| 78 |
overcome that, you can create a file called 'Makefile.personal' and add the |
|---|
| 79 |
desired changes there. The original Makefile will source that file. 'svn up' |
|---|
| 80 |
will not affect 'Makefile.personal'. |
|---|
| 81 |
|
|---|
| 82 |
C. Obtaining the Sources |
|---|
| 83 |
|
|---|
| 84 |
The scripts will attempt to download the sources and book patches as it needs |
|---|
| 85 |
them. If you want to gather the sources and book patches beforehand, create a |
|---|
| 86 |
directory called 'sources' in the $(MPBASE) directory and place the sources and |
|---|
| 87 |
book patches there. You should ensure that you download the *exact* same sources |
|---|
| 88 |
and book patches the scripts use and then verify the SHA1 sums. This will |
|---|
| 89 |
prevent the build from failing unexpectedly on a bad checksum during the build. |
|---|
| 90 |
|
|---|
| 91 |
D. Running the Scripts |
|---|
| 92 |
|
|---|
| 93 |
Building the CD could be as simple as the following: |
|---|
| 94 |
|
|---|
| 95 |
mkdir /mnt/lfs |
|---|
| 96 |
cd /mnt/lfs |
|---|
| 97 |
svn co svn://svn.linuxfromscratch.org/livecd/[path of repo] lfs-livecd |
|---|
| 98 |
(or, 'tar -xjf [path to tarball]'if you have downloaded a tarball of these |
|---|
| 99 |
scripts) |
|---|
| 100 |
cd /mnt/lfs/lfs-livecd |
|---|
| 101 |
make |
|---|
| 102 |
|
|---|
| 103 |
The above example makes use of the default variables for $(MPBASE) and |
|---|
| 104 |
$(ROOT). |
|---|
| 105 |
|
|---|
| 106 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 107 |
|
|---|
| 108 |
II. Editing the Makefiles |
|---|
| 109 |
|
|---|
| 110 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 111 |
|
|---|
| 112 |
III. End Notes |
|---|