source: README@ 0e2c6bc

trunk
Last change on this file since 0e2c6bc was 35094ed, checked in by Pierre Labastie <pierre.labastie@…>, 12 months ago

Major refactoring of README

Describe each item in the menu, fix layout, and try to follow
the order of tasks to do to run jhalfs.

  • Property mode set to 100644
File size: 18.0 KB
RevLine 
[877cc6a]11. INTRODUCTION::
[4457252]2
[35094ed]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 list of supported books can be found at
10 http://wiki.linuxfromscratch.org/alfs/wiki/SupportedBooks (maybe outdated,
11 current develoment books and latest version are always supported).
12
13 The documentation is split among various README.* files. Here is a list
14 of what is in which:
15 - README (this file): instructions to use the LFS book. This should be
16 enough if you just want to build a base system as per the LFS book. It
17 is also a required reading for all the other projects.
18 - README.BLFS: instructions to install an automated build infrastructure
19 for the BLFS book. There are two ways to do so: (i) install the
20 tools at the end of an LFS build, or
21 (ii) install the tools on an already running system. Both methods are
22 described in that file.
23 - README.CUSTOM: instructions to run custom commands either during the LFS
24 build, or at the end of a LFS build. Note that you will not find
25 instructions on how to write those commands, but some examples are
26 available.
27 - README.PACKAGE_MANAGEMENT: instructions to use package management during
28 the build (Note: the only package manager that is regularly tested is
29 porg)
30
31 Other sources of information are the context help in the menu interface,
32 and the LFS books themselves (both required readings of course!).
[3e7ceed]33
[f4ed135]342. PREREQUISITES::
35
[35094ed]36 It is strongly advised that you first build manually a complete system
37 before attempting to automate the build.
[f4ed135]38
[35094ed]39 Of course the "Host System Requirements" should be fulfilled. Some
40 supplementary packages are needed for using jhalfs. They are detailed
41 at the bottom of the page:
42 https://www.linuxfromscratch.org/alfs/download.html. In short, you need
43 wget, sudo, libxml2, libxslt, docbook-4.5-xml, and docbook-xsl-nons.
[f4ed135]44
453. INSTALLATION::
[597d802]46
[35094ed]47 No installation is required. You may want to move the files in this
48 directory to a convenient location, and then follow the instructions below.
[877cc6a]49
[50b1fb7]504. CONFIGURATION::
[877cc6a]51
[35094ed]52 4.1. CONFIGURATION OF THE TOOLS:
53 There is no configuration of the tools themselves. The various
54 parameters for the build are set through a menu driven interface. See
55 the section RUNNING below for details.
56
57 4.2. PRELIMINARY TASKS:
58 This tool has no support at all for creating a partition and a mount
59 point for the built system. You should follow the book up to the section
60 "Mounting the new partition". Note that the default name for the
61 partition mount point is "/mnt/build_dir", instead of /mnt/lfs.
62 You can change that default to anything you'd like in the menu, so you
63 may name it /mnt/lfs if you prefer . We'll use the name /mnt/build_dir
64 in the sequel.
65
66 For downloading packages, you can use the tool or download them
67 yourself. Even if using the tool, it is recommended to set up a source
68 repository where you store already downloaded packages. The tool will
69 automatically search a package in this repository before downloading it
70 if it is not found there. This repository cannot be the same as
71 /mnt/build_dir/sources. As an example, we'll use /usr/src. You should
72 arrange for the user running the tool to have write access to this
73 directory.
74
75 If you want to build the kernel as part of the automated build,
76 a configuration file must be provided. In order to do so, it is
77 recommended to download the kernel tarball, unpack it, run
78 <make menuconfig> (or any other *config), configure the kernel as per
79 the book, and save the resulting .config file to a location where it can
80 be retrieved later on. It is suggested to put it into the source
81 repository, with a versioned name, e.g.
82 /usr/src/config-<arch>-<kernel version>-<config details>.
83
84 Another file you may provide is the fstab file. As for the kernel
85 configuration, this file has to be prepared before running the menu.
86 You can copy-paste the file from the "Creating the /etc/fstab File"
87 page, then edit to suit the future lfs system layout, then save the
88 file. A convenient location and name is /usr/src/fstablfs.
89
90 At a more advanced level, you may want to supply custom commands
91 to be run at the end of LFS build. Scripts containing those commands
92 are located in the ./custom/config directory. Examples are given in
93 ./custom/examples. A template is provided as ./custom/template. See
94 README.CUSTOM for more details.
[a705708]95
[f4ed135]965. RUNNING::
[7785f91]97
[35094ed]98 IMPORTANT::
99 You must be logged as a normal user with sudo privileges to run
[b7583ec]100 the Makefile. Furthermore, you are supposed to have enough privilege
101 to become any user. If you are not bothered about security issues,
[35094ed]102 the entry for the user running the tool in /etc/sudoers could be
103 <user> ALL=(ALL) NOPASSWD:ALL
104
105 The command <make> will launch a menu based configuration program,
106 similar to the kernel "menuconfig" configuration tool.
107
108 Help on parameter function is available from the on-line help (type the
109 character `?' after highlighting the parameter). Please do use the help:
110 it may contain additional information not duplicated in this file.
111
112 MENU "BOOK Settings"
113
114 Use BOOK: You have three choices: LFS System V, LFS systemd, BLFS.
115 The BLFS part is described in README.BLFS
116
117 Book version: You have two choices: "Branch" or "Working Copy"
118 Branch will have the tool clone the book's git repository. The
119 choice of the branch (actually any git commit) or of the file
120 location for the working copy is done in the next menu entry.
121
122 Multilib: Four choices: Normal LFS, Multilib with i686 libraries,
123 multilib with x32 libraries, multilib with all libraries.
124 It is recommended to use "Normal LFS" unless you know what you
125 are doing
126
127 Build method: two choices: chroot (as in book), boot
128 Presently, the "boot" method is not implemented, so keep the default.
129
130 Add blfs-tools support (see README.BLFS)
131 This will install the blfs tools onto the newly built system. It
132 is not the same thing as choosing the BLFS book in the menu, which
133 will install the blfs tools on the currently running system.
134
135 Add custom tools support (see README.CUSTOM)
136
137 MENU "General Settings"
138
139 Build Directory: the name of the root of the LFS system
140 This is the equivalent of the LFS variable in the book. Set it
141 to "/mnt/lfs" if you have followed the book for creating the LFS
142 partition and mount point.
143
144 Retrieve source files: Say y to have jhalfs download the packages
145 If you say no, you must download the packages yourself and put
146 them into the /mnt/build_dir/sources directory. Follow book's
147 chapter 3 instructions.
148 If you say yes, you'll be asked several other questions:
149 - Package Archive Directory: Repository of downloaded packages
150 This directory, which is on the host and should be writable
151 by the user running the tool, is for storing downloaded packages.
152 If you keep the default "$SRC_ARCHIVE", you can set this variable
153 to the absolute path of the repository and export it. Or if the
154 variable is not set, jhalfs downloads the sources directly to
155 /mnt/build_dir/sources.
156 Instead of using the SRC_ARCHIVE envar, you can also enter the
157 path of the repository directory into this field.
158 - Retry on 'connection refused' failure: self explanatory
159 - Number of retry attempts on download failures: self explanatory
160 - Download timeout (in seconds): self explanatory
161
162 Run the makefile: start the build immediately after running the tool
163 This is not the preferred method: it is recommended to rather
164 run "make -C /mnt/build_dir/jhalfs" after the tool has finished
165 setting up the build. But this may be handy if you are sure everything
166 is well, and want to leave the tool and the build run without
167 supervision.
168
169 Rebuild files: clean up the /mnt/build_dir directory
170 Say n if you want to rerun the tool (to update generated scripts
171 for example) without removing what has already been done. Otherwise,
172 say y. Note that there are some guards against removing a directory
173 containing useful things, but double check that the /mnt/build_dir
174 directory is really what you want to erase.
175
176 MENU "Build Settings"
177
178 MENU Parallelism settings
179 - Use all cores:
180 If you say y, MAKEFLAGS will be set to "-j$(nproc)" at the
181 beginning of each script. Other envars are supposed to be passed
182 from the environment, as done in new books. Note that for old books,
183 this means the scripts using make or ninja will be run with all
184 cores, but not when this needs to set special envars like
185 TESTSUITEFLAGS. You can still define the number of cores used
186 in next field.
187 If you say n, you'll be asked for a static number of threads
188 to use.
189 - set of cpus to use, or 'all' for all cpus (only if using all cores):
190 You can define here the cores you want to use. See help for
191 details. This is the preferred way of reducing the number of cores
192 rather than using a static thread number.
193 - Number of parallel `make' jobs (only if not using all cores):
194 Every occurrence of $(nproc) in new books will be replaced with
195 the number entered here. Also MAKEFLAGS will be set to "-jN" (where
196 N is the number entered) at the beginning of each scripts. Furthermore
197 NINJAJOBS will be set to N in the environment. This allows to run all
198 books with N threads, except for paarts that need other envars to be
199 set
200 - Build Binutils pass1 without parallelism (Real SBU)
201 The standard SBU is defined as the time to run the binutils-pass1
202 build with only one thread. Saying y here allows to get a value for
203 it. If you say n, the value is not meaningful for SBU measurements.
204
205 Run testsuites: say y to run the test suites
206 You'll have the choice between running all the test suites, or only
207 those deemed critical (binutils, gmp, mpfr, mpc, and gcc).
208
209 Package management: see README.PACKAGE_MANAGEMENT
210
211 Create a log of installed files for each package: self explanatory
212
213 Strip Installed Binaries/Libraries: use the book instructions for
214 stripping
215
216 DO NOT use/display progress_bar (self explanatory)
217
218 MENU System configuration
219
220 Use a custom fstab file:
221 If you say y, you'll have to provide a file containing the fstab
222 for the LFS system. See above "preliminary tasks".
223
224 Build the kernel:
225 If you say y, you'll be asked for a file containing the kernel
226 configuration. See above "preliminary tasks".
227
228 Install non-wide-character ncurses (rarely used nowadays):
229 If you say y, the system will use instructions in the note on the
230 ncurses page to install those libraries.
231
232 TimeZone: set to the result of "tzselect"
233
234 Language: set to the result of the instructions on "The Bash Shell
235 Startup Files" page.
236
237 Install the full set of locales: installs all the locales known to
238 glibc.
239
240 Groff page size: choice between "A4" and "Letter".
241
242 Hostname: self explanatory
243
244 Network configuration: various fields for setting network. Look at
245 chapter 9 for background.
246
247 Console configuration: various fields for setting console, as described
248 in chapter 9.
249
250 MENU Advanced features:
251
252 Optimization: Optimization settings are done by editing files in the
253 "optimize" directory. The menu just allows you to choose between applying
254 optimizations only to the final chapter or to all the book. Say n for
255 a normal build
256
257 Create SBU and disk usage report: self explanatory
258
259 Save temporary system work: self explanatory (see help)
260
261 Run comparison analysis on final stage: build the system several times
262 using the preceding one, to test whether it is able to rebuild itself
263 identically. Don't use normally...
264
265 Internal Settings (WARNING: for jhalfs developers only): says it all
[c7c32a3]266
267 Once you have set the parameters and saved the configuration, the script
[cc8dba9]268 is launched. Its aim is to extract instructions from the selected book
269 to generate scripts, and to generate a Makefile, which allows running
270 the scripts in the right order. The script verifies first that the host
271 can run itself and build the xLFS system, then validates the configuration
272 and lists the parameters. At this point, you may choose to quit or to
273 continue with the listed parameters. The script will then proceed to
274 generate the Makefile and the build scripts, optionally download
275 packages, and eventually verify the host prerequisite. If you have
276 selected "Run the makefile", the command <make> is launched in the
277 adequate directory, and the build begins. If not, you'll have to run
278 "make" manually, for example: "make -C /mnt/build_dir/jhalfs", if you
279 have used the default parameters (see the layout under $BUILDDIR in the
280 Q&A below).
281
282 NOTE::
283 If you run the jhalfs script directly the only function you can select
284 is to display the version number by running <./jhalfs -v>
285
2866. LAYOUT::
[877cc6a]287
[0fa52f2]288 /BLFS/* (see README.BLFS)
[d517356]289
[50b1fb7]290 /LFS/master.sh
291 /lfs.xsl
[b240ee6]292
[0fa52f2]293 /common/chroot.xsl
294 /common_functions
295 /create-sbu_du-report.sh
296 /hostreqs.xsl
297 /kernfs.xsl
[b240ee6]298 /makefile_functions
[50b1fb7]299 /packages.xsl
300 /progress_bar.sh
[0fa52f2]301 /urls.xsl
[fe30c61]302 /libs/func_*
[b240ee6]303
[0fa52f2]304 /custom/examples/*
305 /config/* (needs to be created after cloning since it is an
306 empty directory initially)
307 /template
[b240ee6]308
[50b1fb7]309 /extras/do_copy_files
[b240ee6]310 /do_ica_prep
311 /do_ica_work
312
[0fa52f2]313 /menu/*
314
[50b1fb7]315 /optimize/opt_config
316 /opt_override
317 /optimize_functions
318 /opt_config.d/noOpt
319 /noSymbols
[0fa52f2]320 /O2pipe
[50b1fb7]321 /O3pipe
322 /O3pipe_march
323 /defOpt_fPIC
324
[0fa52f2]325 /pkgmngt/packageManager.xml.dpkg
326 /packageManager.xml.pacman
327 /packageManager.xml.porg
328 /packageManager.xml.template
329 /packInstall.sh.dpkg
330 /packInstall.sh.pacman
331 /packInstall.sh.porg
332 /packInstall.sh.template
333
334 CHEATSHEET
335 FUNCTION_LIST
336 LICENSE
[597d802]337 README
[50b1fb7]338 README.BLFS
[daa489d]339 README.CUSTOM
[0fa52f2]340 README.PACKAGE_MANAGEMENT
[50b1fb7]341 TODO
[d3b8635]342
[50b1fb7]343 Config.in
344 jhalfs
[0fa52f2]345 Makefile
[d3b8635]346
[cc8dba9]3477. FAQ::
348 Q. "It doesn't work"
349 A. There are several reasons why it may be so. One possibility is the
[b15261a]350 following: jhalfs was designed to work against the development versions
351 of the LFS series of books. Consequently changes in a book sometimes
352 break older versions of jhalfs. Before you start pulling out your hair,
[cc8dba9]353 download the latest version of jhalfs to see if that solves your
354 problem. Note that it may be the other way around. If you want to build
[b15261a]355 an old version of the book, you may have to downgrade your jhalfs
[cc8dba9]356 version.
[d3b8635]357
[e51d4db]358 Q. "How do I specify the build location?"
[fbdd1a8]359 A. The original LFS document worked against the well known location
360 /mnt/lfs. This script automates the build of all of the LFS series of
361 books and uses a generic location $BUILDDIR with a default value of
362 /mnt/build_dir. You may change this value to suit your needs.
[d3b8635]363
[511923a]364 The layout below $BUILDDIR is as follows.
365 $BUILDDIR/
[50b1fb7]366 jhalfs (Makefile, cmd scripts, logs, etc..)
367 sources (where packages reside)
[0fa52f2]368 tools (temporary cross compiler)
[50b1fb7]369 ...
370 FHS dir structure
371 ...
372 blfs_root (files to use blfs-tool if selected to install it)
[d3b8635]373
[e51d4db]374 Q. "What is the function of the SRC_ARCHIVE variable?"
[50b1fb7]375 A. When jhalfs runs and packages download was selected, it creates a local
[b15261a]376 copy of the necessary packages in $BUILDDIR/sources by downloading the
[50b1fb7]377 files. If the variable SRC_ARCHIVE is defined the software will first
378 look in this location for the file and, if found, will copy it to
[b15261a]379 $BUILDDIR/sources.
[73e5448]380 If the files are not found in SRC_ARCHIVE _and_ you have write priv to
[f4b3d20]381 the directory any downloaded files will be mirrored there.
[d3b8635]382
[e51d4db]383 Q. "How do I set the SRC_ARCHIVE location?"
[511923a]384 A. The best way to set the value of SRC_ARCHIVE is
[50b1fb7]385
[511923a]386 export SRC_ARCHIVE=/wherever/you/store/downloaded/packages
[50b1fb7]387
388 or you can set the full path in the proper menu entry.
[d3b8635]389
[e51d4db]390 Q. "Why have 2 copies of the files?"
[73e5448]391 A. The package files must be visible during the chroot phase and this is a
[fbdd1a8]392 simple and reliable method of doing so. This method also handles the
[0fa52f2]393 boot build method where the final build may be done on a separate
[fbdd1a8]394 machine.
395
[dbcdfd7]396 Q. "How could I stop the build at a predefined chosen point?"
397 A. Launch the Makefile manually passing the last numbered target to be build
398 as the break point. For example:
399
400 make BREAKPOINT=84-bash
401
402 The build can be stopped also at the end of a top-level build phase by
403 calling directly the appropriate mk_* target. For example:
404
405 make mk_LUSER
406
407 See the Makefile to know the proper target names for that book build.
408
[877cc6a]409Authors:
410 George Boudreau
411 Manuel Canales Esparcia
[fbdd1a8]412 Pierre Labastie
Note: See TracBrowser for help on using the repository browser.