1 | 1. INTRODUCTION::
|
---|
2 |
|
---|
3 | The scripts in this directory implement an automation of the building
|
---|
4 | of a GNU/LInux system, as described in the Linux From Scratch book series.
|
---|
5 | The name of the project is jhalfs: in that name, "alfs" stands for
|
---|
6 | "automated linux from scratch", and the initials "jh" have been kept since
|
---|
7 | the original "jhalfs-0.2" code developed by Jeremy Huntwork.
|
---|
8 |
|
---|
9 | The files in this branch are the last to allow building the CLFS book.
|
---|
10 | The CLFS project (https://trac.clfs.org/) has been dead for almost five
|
---|
11 | years now (written in February 2022), and it does not make sense to keep
|
---|
12 | compativbility with it in further developments of the jhalfs project.
|
---|
13 | The main project will only support the various branches (including a
|
---|
14 | clfs-ng one and one dedicated to building on arm CPUs) of LFS and BLFS.
|
---|
15 |
|
---|
16 | The documentation is split among various README.* files. Here is a list
|
---|
17 | of what is in which:
|
---|
18 | - README (this file): instructions to use the LFS book. This should be
|
---|
19 | enough if you just want to build a base system as per the LFS book. It is
|
---|
20 | also a required reading for all the other projects.
|
---|
21 | - README.CLFS: supplementary instructions to use the CLFS book series.
|
---|
22 | - README.BLFS: instructions to install an automated build infrastructure
|
---|
23 | for the BLFS book. There are two ways to do so: (i) install the
|
---|
24 | tools at the end of an LFS build (CLFS is not supported in that case), or
|
---|
25 | (ii) install the tools on an already running system. Both methods are
|
---|
26 | described in that file.
|
---|
27 | - README.CUSTOM: instructions to run custom commands either during the xLFS
|
---|
28 | build, at the end of a xLFS build. Note that you will not find
|
---|
29 | instructions on how to write those commands, but some examples are
|
---|
30 | available.
|
---|
31 | - README.PACKAGE_MANAGEMENT: instructions to use package management during
|
---|
32 | the build (only for LFS, patches welcome for CLFS...)
|
---|
33 | - README.HLFS: very short file explaining why you cannot use HLFS with the
|
---|
34 | present tool version.
|
---|
35 |
|
---|
36 | Other sources of information are the context help in the menu interface,
|
---|
37 | and the xLFS books themselves.
|
---|
38 |
|
---|
39 | 2. PREREQUISITES::
|
---|
40 |
|
---|
41 | As said elsewhere, it is strongly advised that you first build manually
|
---|
42 | a complete system before attempting to automate the build.
|
---|
43 |
|
---|
44 | Of course the "Host System Requirements" should be fulfilled. The needed
|
---|
45 | supplementary packages are detailed at the bottom of the page:
|
---|
46 | https://www.linuxfromscratch.org/alfs/download.html. In short, you need
|
---|
47 | wget, sudo, libxml2, libxslt, docbook-4.5-xml, and docbook-xsl-nons.
|
---|
48 |
|
---|
49 | 3. INSTALLATION::
|
---|
50 |
|
---|
51 | No installation is required. You may want to move the files in this
|
---|
52 | directory to a convenient location, and then follow the instructions below.
|
---|
53 |
|
---|
54 | 4. CONFIGURATION::
|
---|
55 |
|
---|
56 | 4.1. CONFIGURATION OF THE TOOLS:
|
---|
57 | There is no configuration of the tools themselves. The various
|
---|
58 | parameters for the build are set through a menu driven interface. See
|
---|
59 | the section RUNNING below for details.
|
---|
60 |
|
---|
61 | 4.2. PRELIMINARY TASKS:
|
---|
62 | This tool has no support at all for creating a partition and a mount
|
---|
63 | point for the built system. You should follow the book up to the section
|
---|
64 | "Mounting the new partition". Note that the default name for the
|
---|
65 | partition mount point is "/mnt/build_dir", instead of /mnt/{c,}lfs.
|
---|
66 | You can change that default to anything you'd like in the menu, so you
|
---|
67 | may name it /mnt/lfs, or whatever you like. We'll use the name
|
---|
68 | /mnt/build_dir in the sequel.
|
---|
69 |
|
---|
70 | The tool can download the needed packages for you, or you may download
|
---|
71 | them yourself. The tool may optionally use a package archive directory
|
---|
72 | where the downloaded packages are stored. That directory name may be made
|
---|
73 | available to the tool in two ways: (i) export the SRC_ARCHIVE variable,
|
---|
74 | for example SRC_ARCHIVE=/usr/src, (ii) enter the name at the "Package
|
---|
75 | Archive Directory" menu prompt. Note that the user should have write
|
---|
76 | permission to that directory. If a needed package is found in that
|
---|
77 | directory, it is copied to /mnt/build_dir/sources, if not, it is
|
---|
78 | downloaded to that directory and copied to /mnt/build_dir/sources,
|
---|
79 | except if found in /mnt/build_dir/sources, in which case, it is just
|
---|
80 | copied to $SRC_ARCHIVE. If you want the tool to download packages and you
|
---|
81 | do not want to archive them, just unset SRC_ARCHIVE, and keep the
|
---|
82 | default entry for "Package Archive Directory". If you choose to download
|
---|
83 | the packages by yourself, you should download (or copy) them to
|
---|
84 | /mnt/build_dir/sources directly.
|
---|
85 |
|
---|
86 | If you want to build the kernel as part of the automated build, select
|
---|
87 | "Build the kernel" in the menu. Then, a configuration file must be
|
---|
88 | provided. In order to do so, it is recommended to download the kernel
|
---|
89 | tarball, unpack it, run <make menuconfig> (or any other *config),
|
---|
90 | configure the kernel as per
|
---|
91 | the book, and save the resulting .config file to a location where it can
|
---|
92 | be retrieved later on (a convenient location and name is
|
---|
93 | $SRC_ARCHIVE/config-<arch>-<kernel version>-<config details>).
|
---|
94 |
|
---|
95 | Another file you may provide is the fstab file. To use it, select
|
---|
96 | "Use a custom fstab file" in the menu interface, and enter the name of
|
---|
97 | the file where asked. As for the kernel configuration, this file has to
|
---|
98 | be prepared before running the menu. A convenient location and name is
|
---|
99 | $SRC_ARCHIVE/fstablfs.
|
---|
100 |
|
---|
101 | At a more advanced level, you may want to supply custom commands
|
---|
102 | to be run at the end of (C)LFS build. Scripts containing those commands
|
---|
103 | are located in the ./custom/config directory. Examples are given in
|
---|
104 | ./custom/examples. A template is provided as ./custom/template. See
|
---|
105 | README.CUSTOM for more details.
|
---|
106 |
|
---|
107 | 5. RUNNING::
|
---|
108 |
|
---|
109 | IMPORTANT::
|
---|
110 | You must be logged as a normal user with sudo privileges to run
|
---|
111 | the Makefile. Furthermore, you are supposed to have enough privilege
|
---|
112 | to become any user. If you are not bothered about security issues,
|
---|
113 | the entry for the user "jhalfs_user" in /etc/sudoers could be
|
---|
114 | jhalfs_user ALL=(ALL) NOPASSWD:ALL
|
---|
115 |
|
---|
116 | The command <make> will launch a menu based configuration program. The
|
---|
117 | underlying menu code was borrowed from BusyBox and slightly modified for
|
---|
118 | our use.
|
---|
119 |
|
---|
120 | Help on parameter function is available from the on-line help. Please
|
---|
121 | make use of that feature: it may contain additional information not
|
---|
122 | duplicated in this file.
|
---|
123 |
|
---|
124 | You should first choose which book and flavour you want to build. Note
|
---|
125 | that when you choose the BLFS book, the tool will just install the BLFS
|
---|
126 | tool to your system. You'll have to run that installed tool to build
|
---|
127 | packages in BLFS. See README.BLFS to know how. If you choose any other
|
---|
128 | book, you'll have to configure the settings and the build parameters
|
---|
129 | from the menu. Note that you may choose to install the blfs tools onto
|
---|
130 | the newly built system. It is not the same thing as choosing
|
---|
131 | the BLFS book in the menu, which will install the blfs tools on the
|
---|
132 | currently running system.
|
---|
133 |
|
---|
134 | The "General Settings" menu is where the "Build Directory" name is to be
|
---|
135 | entered. Other entries in that menu select what the tool should do. The
|
---|
136 | "Run the Makefile" entry selects whether the tool will start the build
|
---|
137 | automatically after generating the needed files. The "Rebuild files" selects
|
---|
138 | whether to clean the build directory before doing anything else. To protect
|
---|
139 | against removing important files, this can only be done in an empty directory,
|
---|
140 | or a directory previously populated by the tool.
|
---|
141 |
|
---|
142 | The "Build Settings" menu is where various options for the build can be
|
---|
143 | selected. Two options, "Use a custom fstab file" and "Build the kernel",
|
---|
144 | have been described above. "Do not use/display progress_bar", if set, will
|
---|
145 | prevent a progress bar to be displayed during the build. That may be useful
|
---|
146 | on slow machine. The other options should be self explanatory, using either
|
---|
147 | the online help or book reading.
|
---|
148 |
|
---|
149 | The "Advanced Features" menu is for various maintenance tasks, like
|
---|
150 | testing the build instructions or reporting build statistics. One useful
|
---|
151 | option is "Optimization and parallelisation". It is not recommended to use
|
---|
152 | it for setting compiler optimization flags, although it is possible, but
|
---|
153 | if you select it, you'll be able to select the number of parallel `make'
|
---|
154 | jobs, which allows much faster builds on modern multicore CPUs.
|
---|
155 |
|
---|
156 | Once you have set the parameters and saved the configuration, the script
|
---|
157 | is launched. Its aim is to extract instructions from the selected book
|
---|
158 | to generate scripts, and to generate a Makefile, which allows running
|
---|
159 | the scripts in the right order. The script verifies first that the host
|
---|
160 | can run itself and build the xLFS system, then validates the configuration
|
---|
161 | and lists the parameters. At this point, you may choose to quit or to
|
---|
162 | continue with the listed parameters. The script will then proceed to
|
---|
163 | generate the Makefile and the build scripts, optionally download
|
---|
164 | packages, and eventually verify the host prerequisite. If you have
|
---|
165 | selected "Run the makefile", the command <make> is launched in the
|
---|
166 | adequate directory, and the build begins. If not, you'll have to run
|
---|
167 | "make" manually, for example: "make -C /mnt/build_dir/jhalfs", if you
|
---|
168 | have used the default parameters (see the layout under $BUILDDIR in the
|
---|
169 | Q&A below).
|
---|
170 |
|
---|
171 | NOTE::
|
---|
172 | If you run the jhalfs script directly the only function you can select
|
---|
173 | is to display the version number by running <./jhalfs -v>
|
---|
174 |
|
---|
175 | 6. LAYOUT::
|
---|
176 |
|
---|
177 | /BLFS (see README.BLFS)
|
---|
178 |
|
---|
179 | /CLFS/master.sh
|
---|
180 | /clfs.xsl
|
---|
181 |
|
---|
182 | /CLFS2/master.sh
|
---|
183 | /clfs2.xsl
|
---|
184 |
|
---|
185 | /CLFS3/master.sh
|
---|
186 | /clfs3.xsl
|
---|
187 |
|
---|
188 | /HLFS/master.sh
|
---|
189 | /hlfs.xsl
|
---|
190 |
|
---|
191 | /LFS/master.sh
|
---|
192 | /lfs.xsl
|
---|
193 |
|
---|
194 | /common/common_functions
|
---|
195 | /makefile_functions
|
---|
196 | /packages.xsl
|
---|
197 | /urls.xsl
|
---|
198 | /create-sbu_du-report.sh
|
---|
199 | /progress_bar.sh
|
---|
200 | /blfs-tool-deps/9xx-*
|
---|
201 | /libs/func_*
|
---|
202 |
|
---|
203 | /custom/template
|
---|
204 | /config/
|
---|
205 | /examples/*
|
---|
206 | /examples_CLFS-E/*
|
---|
207 |
|
---|
208 | /extras/do_copy_files
|
---|
209 | /do_ica_prep
|
---|
210 | /do_ica_work
|
---|
211 |
|
---|
212 | /optimize/opt_config
|
---|
213 | /opt_override
|
---|
214 | /optimize_functions
|
---|
215 | /opt_config.d/noOpt
|
---|
216 | /noSymbols
|
---|
217 | /O3pipe
|
---|
218 | /O3pipe_march
|
---|
219 | /defOpt_fPIC
|
---|
220 |
|
---|
221 | /menu/*
|
---|
222 |
|
---|
223 | README
|
---|
224 | README.BLFS
|
---|
225 | README.CLFS
|
---|
226 | README.HLFS
|
---|
227 | README.CUSTOM
|
---|
228 | TODO
|
---|
229 | LICENSE
|
---|
230 |
|
---|
231 | Config.in
|
---|
232 | Makefile
|
---|
233 | jhalfs
|
---|
234 | blfs-tool
|
---|
235 |
|
---|
236 | 7. FAQ::
|
---|
237 | Q. "It doesn't work"
|
---|
238 | A. There are several reasons why it may be so. One possibility is the
|
---|
239 | following: jhalfs was designed to work against the development versions
|
---|
240 | of the LFS series of books. Consequently changes in a book sometimes
|
---|
241 | break older versions of jhalfs. Before you start pulling out your hair,
|
---|
242 | download the latest version of jhalfs to see if that solves your
|
---|
243 | problem. Note that it may be the other way around. If you want to build
|
---|
244 | an old version of the book, you may have to downgrade your jhalfs
|
---|
245 | version.
|
---|
246 |
|
---|
247 | Q. "How do I specify the build location?"
|
---|
248 | A. The original LFS document worked against the well known location
|
---|
249 | /mnt/lfs. This script automates the build of all of the LFS series of
|
---|
250 | books and uses a generic location $BUILDDIR with a default value of
|
---|
251 | /mnt/build_dir. You may change this value to suit your needs.
|
---|
252 |
|
---|
253 | The layout below $BUILDDIR is as follows.
|
---|
254 | $BUILDDIR/
|
---|
255 | jhalfs (Makefile, cmd scripts, logs, etc..)
|
---|
256 | sources (where packages reside)
|
---|
257 | tools (temporary bootstrap system)
|
---|
258 | cross-tools (temporary CLFS only)
|
---|
259 | ...
|
---|
260 | FHS dir structure
|
---|
261 | ...
|
---|
262 | blfs_root (files to use blfs-tool if selected to install it)
|
---|
263 |
|
---|
264 | Q. "What is the function of the SRC_ARCHIVE variable?"
|
---|
265 | A. When jhalfs runs and packages download was selected, it creates a local
|
---|
266 | copy of the necessary packages in $BUILDDIR/sources by downloading the
|
---|
267 | files. If the variable SRC_ARCHIVE is defined the software will first
|
---|
268 | look in this location for the file and, if found, will copy it to
|
---|
269 | $BUILDDIR/sources.
|
---|
270 | If the files are not found in SRC_ARCHIVE _and_ you have write priv to
|
---|
271 | the directory any downloaded files will be mirrored there.
|
---|
272 |
|
---|
273 | Q. "How do I set the SRC_ARCHIVE location?"
|
---|
274 | A. The best way to set the value of SRC_ARCHIVE is
|
---|
275 |
|
---|
276 | export SRC_ARCHIVE=/wherever/you/store/downloaded/packages
|
---|
277 |
|
---|
278 | or you can set the full path in the proper menu entry.
|
---|
279 |
|
---|
280 | Q. "Why have 2 copies of the files?"
|
---|
281 | A. The package files must be visible during the chroot phase and this is a
|
---|
282 | simple and reliable method of doing so. This method also handles the
|
---|
283 | CLFS boot build method where the final build may be done on a separate
|
---|
284 | machine.
|
---|
285 |
|
---|
286 | Q. "What is the function of "User account" and "Group account" menu
|
---|
287 | settings?"
|
---|
288 | A. If you are running jhalfs from a low or non-privileged account you may
|
---|
289 | not have the priv to create/delete the user needed to build temporary
|
---|
290 | tools.
|
---|
291 | These settings allow you to use your own user and group name to do those
|
---|
292 | build steps.
|
---|
293 |
|
---|
294 | These variables are adjustable also when invoking make:
|
---|
295 |
|
---|
296 | cd $BUILDDIR; make LUSER=myaccount LGROUP=mygroup
|
---|
297 |
|
---|
298 | The only changes to your account will be the creation of a NEW .bashrc
|
---|
299 | after saving your original to .bashrc.XXX
|
---|
300 |
|
---|
301 | Q. "When I try to build CLFS the Makefile fails at mid-point"
|
---|
302 | A. There could be numerous reasons for the failure but the most likely
|
---|
303 | reason is you are doing a cross-build using the 'chroot' method and the
|
---|
304 | target is not compatible with the host. If you choose to build using
|
---|
305 | the chroot method a test is performed at the end of the temptools
|
---|
306 | phase. If the test succeeds the build continues inside a chroot jail.
|
---|
307 | However if the test fails, it means the host and target are not
|
---|
308 | compatible an you should use the 'boot' method to create your target
|
---|
309 | code.
|
---|
310 | As an extreme example: You can build a sparc target on a x86 platform but
|
---|
311 | only the temptools phase. You must select the 'boot' method and not the
|
---|
312 | 'chroot.' You must transfer the toolchain to a sparc platform, reboot the
|
---|
313 | sparc box and continue the build.
|
---|
314 | Of all the LFS series of books Cross-LFS requires the greatest
|
---|
315 | understanding of host/target hardware combination. Please read the book
|
---|
316 | carefully and don't skip the easy parts (there are none...)
|
---|
317 |
|
---|
318 | Q. "How could I stop the build at a predefined chosen point?"
|
---|
319 | A. Launch the Makefile manually passing the last numbered target to be build
|
---|
320 | as the break point. For example:
|
---|
321 |
|
---|
322 | make BREAKPOINT=84-bash
|
---|
323 |
|
---|
324 | The build can be stopped also at the end of a top-level build phase by
|
---|
325 | calling directly the appropriate mk_* target. For example:
|
---|
326 |
|
---|
327 | make mk_LUSER
|
---|
328 |
|
---|
329 | See the Makefile to know the proper target names for that book build.
|
---|
330 |
|
---|
331 | Authors:
|
---|
332 | George Boudreau
|
---|
333 | Manuel Canales Esparcia
|
---|
334 | Pierre Labastie
|
---|