source: README.BLFS@ e7f93a0

new_features
Last change on this file since e7f93a0 was 654a56a, checked in by Pierre Labastie <pierre@…>, 8 years ago

Merge trunk r3945 (refactor two README files)

  • Property mode set to 100644
File size: 16.4 KB
Line 
1$Id$
2
31. INTRODUCTION::
4
5 To automate package builds from the BLFS book instructions is a huge
6 task. Some of the issues are: the BLFS book isn't linear; some package
7 pages use a custom layout; there are circular dependencies; several
8 packages can be installed on a non-default prefix; build commands can
9 change based on what dependencies will be used, etc.
10
11 That being said, the goal of the blfs-tool is to help you solve package
12 dependencies, create build scripts and a Makefile. Not all the auto-generated
13 build scripts and Makefile will work "as is", thus, as a general rule,
14 you will need to review and edit the scripts while reading the book.
15
16
172. PREREQUISITES::
18
19 In addition to a full LFS system, the following packages and their
20 dependencies are needed by this tool:
21 - required: libxml2, libxslt, DocBook XML DTD
22 - recommended: wget (to download the package tarballs) and sudo (to build
23 as a user)
24 - optional: lynx (allows to read the generated linearized book), GPM (to
25 cut and paste commands from the book), subversion (to update the book
26 sources), openssl (used by wget for all https:// sites)
27 Note that the optional dependencies are recommended for ease of use of the
28 tool.
29
30 You should also have the following personal skills:
31 - Ability to write and debug shell scripts: as said in the introduction,
32 not all the generated scripts can be used directly. They need to be
33 edited to produce an error free build.
34 - Ability to debug build failures, like missing dependencies or
35 installation directories not known to the system (when you install in
36 /opt for example).
37 - Ability to choose the tools you need to configure and administrate
38 your system: in the BLFS book, nothing is mandatory, nothing is
39 useless. You are on your own in choosing what to build, but wrong
40 decisions may lead to a non functional system...
41
423. INSTALL::
43
44 There are two ways to install the BLFS tools on an LFS system, described
45 in paragraphs 3.1 and 3.2, respectively:
46
47 3.1 INSTALLATION ON A RUNNING SYSTEM
48
49 Select "Use Book --> Beyond Linux From Scratch" in the jhalfs menu:
50 The tools are installed in $HOME$BLFS_ROOT (the default for $BLFS_ROOT
51 is /blfs_root). The BLFS book is downloaded or copied to its directory.
52 The tracking directory (see below) is initialized but not created: before
53 the installation, you should ensure the tracking directory (default location
54 /var/lib/jhalfs/BLFS) exists and is writable by the user. After the
55 intallation, you should perform the following additional steps:
56
57 - Configure sudo, adding the needed privileges for the user. For
58 newer sudo version, do not forget to add a line `Defaults secure_path='
59 containing /sbin and /usr/sbin (in /etc/sudoers), otherwise some
60 executables are not found.
61
62 - Although it is not strictly necessary, it is recommended to install
63 the bash shell startup files (as per `3.After LFS Configuration
64 Issues' of the BLFS book), as some instructions in BLFS rely on
65 their being present.
66
67 3.2 INSTALLATION ON A JUST BUILT xLFS SYSTEM
68
69 For books that support it (only LFS for jhalfs version 2.4),
70 there is an option to install the BLFS tools right after building
71 the xLFS system: just tick `BOOK Settings/Add blfs-tool support' in
72 jhalfs configuration menu. The tools are installed in $BLFS_ROOT
73 (default /blfs_root) on the xLFS system, and the dependencies are built
74 at the end of the jhalfs run, before the custom tools.
75
76 (TODO: blfs-tools have not been tested with current (version 3.0) of CLFS,
77 and certainly need some adaptation to run)
78
79 After booting the new xLFS system some steps are needed to finish
80 the installation of the automated tools:
81
82 - A user account must be created. You must be logged on that user
83 account to use blfs-tool. This is not strictly necessary,
84 since the packages can be built as root, too, but it is
85 never a good idea to build packages as root.
86
87 - Move /blfs-root to that user's home and change ownership of the
88 directory and files to the user.
89
90 - Give the user read and write privileges over the $TRACKING_DIR
91 directory and the files that it contains.
92
93 - Configure sudo and add the bash shell startup files, as described
94 above
95
96 We assume that the BLFS tools will be used on a booted xLFS system.
97 Using them to build BLFS packages in a chroot jail is also possible,
98 but not supported.
99
100 3.3 DIRECTORY LAYOUT IN THE $BLFS_ROOT DIRECTORY
101
102 blfs-xml/* SVN tree of the selected BLFS book version
103 lib/constants.inc functions libraries
104 /func_dependencies for building the dependency tree
105 menu/* lxdialog and menuconfig source code
106 xsl/gen_pkg_list.xsl XSL stylesheet to generate the package database
107 /gen_config.xsl XSL stylesheet to generate the Config.in file
108 for use in the menuconfig system
109 /dependencies.xsl XSL stylesheet to generate the dependency list
110 of a package
111 /make_book.xsl XSL stylesheet to generate the linear book.xml
112 /scripts.xsl XSL stylesheet to generate the scriptlets from
113 book.xml
114 /bump.xsl XSL stylesheet to update the tracking file
115 README.BLFS this file
116 TODO developers notes (well, not updated often)
117 gen_pkg_book.sh resolves dependencies and generates linear BLFS
118 books and build scripts
119 gen-makefile.sh generates the target Makefile
120 progress_bar.sh the target Makefile progress bar
121 gen-special.sh Helper script for generating the package database
122 Makefile Used by make to update the package database from
123 the SVN tree, then launch the menuconfig interface,
124 and run gen_pkg_book.sh based on configuration
125 settings
126 packdesc.dtd a simple DTD describing the format of the package
127 database and the tracking file.
128 envars.conf envars needed when running the target build scripts
129
130 Working files: several files are generated when first running the tool
131
132 packages.xml auto-generated packages database
133 Config.in input file for the menu driven choices
134 configuration file generated by the menuconfig process
135 dependencies/* files recording the dependency tree
136 book.xml the linearized book
137 book-html/* the linearized book rendered in html
138 scripts/* the scriptlets
139
140 3.4 INSTALLED PACKAGES TRACKING SYSTEM:
141
142 This tool includes a very simple tracking system to log which packages
143 have been installed using the tool. It is used to skip installed packages
144 from target selection menu and to test if an installed package has been
145 updated in the BLFS book. Do not rely on this feature as a package
146 management tool.
147
148 The tracking system itself is an XML file: instpkg.xml. It is
149 initialized when <make> is first run in blfs_root. It resides in a
150 directory, which is created when needed during the process of building
151 custom tools or blfs dependencies, right after xLFS. You can specify
152 that directory location in the blfs-tools sub-menu of jhalfs. You may
153 need to update permissions and/or ownership of this directory before
154 using the blfs tool (see README in jhalfs).
155
156 The default location of the tracking directory is /var/lib/jhalfs/BLFS.
157 NB : after the initial build, that directory is only used to contain
158 instpkg.xml, unless custom tools have been built. In the latter case,
159 it also contains empty files whose name are "$PKG-$VERSION" for each
160 versionned package built. The information about those packages is
161 included into instpkg.xml the next time the tool is run.
162
1634. USAGE::
164
165 From now on, all the work must be done from inside the installation
166 root directory.
167
168 Due to the complexity of the BLFS book, the scripts and Makefile
169 generation is done in several steps:
170
171 4.1 UPDATING BOOK SOURCES::
172
173 If you are using the development book version and you want to update
174 installed packages to the latest version found in that book, you need to
175 update the XML sources and packages database. This is not necessary if
176 you just built xLFS, and you can skip to step 3.4.
177
178 To do that, run "make update". It may happen that the subversion
179 version of your building host is older than the version you just
180 built. This may generate weird errors like "'.' omitted". The easiest
181 thing to do in that case, is to completely remove the blfs-xml directory
182 and run "make update". With recent versions of subversion, you can also
183 run "svn upgrade" from inside the blfs-xml directory.
184
185 On the next configuration run, packages already installed but listed
186 with a new version in the book will be available for target selection
187 and used to solve dependencies.
188
189 4.2 CONFIGURING AND PARSING THE BOOK::
190
191 The next step is to create a book and build scripts in dependency
192 build order for one or several packages.
193
194 Run <make> to launch the configuration interface. The main menu contains
195 two blocks: individual package selection, and build options.
196
197 In the build options section, the dependencies level and default packages
198 used to solve alternatives are set (currently, only for the MTA). You can
199 also select whether the build will be made as a normal user or as root.
200 Those settings are saved to be reused in future configuration runs.
201
202 Note that you may select as many targets as you want, not just one
203 as in the previous version of this tool. But we suggest to not select
204 too many at a time to be able to sort issues!
205
206 When you are done with the menu, a few checks occur, and the dependency
207 chain is generated. Each dependency appears with its priority (required,
208 recommended, optional, or external), and it's level. There is a root level
209 1. The selected packages have level 2. The dependencies of selected packages
210 have level 3, the dependencies of the dependencies have level 4, and so on.
211 When circular dependencies are found, they appear with a priority of
212 "circular". This means that two (or more) dependency chains arrive at the
213 same package. The algorithm chooses the chain with the highest priority and
214 reorders dependencies to remove the other chain(s). This is not always the
215 solution an user would prefer, but we have found no way to do it better.
216
217 You end up with a book.xml file which contains the linearized book,
218 and a rendered HTML, in the directory book-html, which you can browse with
219 "lynx book-html/index.html" (or with any other browser).
220
221 Furthermore, there is a directory "scripts", which contains the generated
222 scriptlets.
223
224 There is also another directory, "dependencies" that contains files
225 generated while resolving dependencies.
226
227 4.3 EDITING BUILD SCRIPTS::
228
229 Now it is time to review the generated book and scripts, making any
230 changes to the scripts necessary to fix generation bugs or to suit your
231 needs.
232
233 Scripts for additional packages (i.e., for non-BLFS packages) can be
234 easily inserted. For example, if you want to install the external dependency
235 "bar" before "foo" package and the "foo" script is named "064-z-foo", you
236 just need to create a "064-y-bar" build script.
237
238 Remember, the package tracking system isn't a package management tool
239 and knows nothing about packages not in the BLFS book.
240
241 Also, review and edit envars.conf. This file is used to set global envars
242 needed by the build scripts.
243
244 4.4 CREATING THE MAKEFILE::
245
246 When the build scripts are ready to be run, the Makefile can be
247 created. Create an empty directory (for example "mkdir work") and cd
248 to that directory. Then run ../gen-makefile.sh
249
250 Review the Makefile, and, if all looks sane, start the build by running
251 "make".
252
2535. GENERATED BUILD SCRIPTS ISSUES::
254
255 In this section, known issues with the generated build scripts are
256 discussed. They are due to build procedures and/or BLFS layout
257 particularities that we can't handle. In several cases, editing the
258 build scripts is mandatory.
259 You may also need to insert some build scripts created by you to resolve
260 unhandled dependencies and/or to remove some script installing an unneeded
261 package (unneeded packages may be pulled in the dependency chain, if
262 they occur as an "or" with another package).
263 When there are circular dependencies (only one known in BLFS 8.0 for
264 recommended dependencies), you may need to move around scripts so that they
265 run in the order script-A script-B script-A. This involves copying script-A
266 to another name (using the xxx-a- fields), and possibly renaming the xxx-a-
267 fields of each involved script.
268
269 5.1 BLFS BOOTSCRIPTS::
270
271 Normally, bootscript installation should work. On the other hand, the
272 book does not give instruction for running them, so you might have to
273 manually insert "/etc/init.d/rc.d/<initscript> start" at some place during
274 the build.
275
276 5.2 PACKAGE CONFIGURATION::
277
278 For those packages that have a "Configuration" section, you should
279 edit the build script to fit the needs of your system. Sometimes, the
280 bash startup files are modified. The shipped 'envars.conf' contains a
281 line 'source /etc/profile', which ensures that the proper environment
282 variables are used.
283
284 5.3 PAGES WITH TWO OR MORE PACKAGES::
285
286 For example: sane, poppler, audacious, freetts, which, etc.
287
288 On the pages for those packages, the BLFS book actually has instructions
289 to download and install two or more packages. You must edit the scripts to
290 fix this. A common pitfall is that the variable PACKAGE may be used for
291 several tarballs. Be sure to save the PACKAGE variable to some other
292 name (for example PKG1, PKG2, etc) after each download. The unpacking
293 instructions may need to be repeated for each tarball in turn.
294
295 5.4 XORG7
296
297 The book has special page layouts for the Xorg7 packages. The tool
298 breaks those pages into individual pages for each packages in the linear
299 book. Also, the menu gives the choice to select each package individually.
300
301 To build the whole Xorg7 chapter, select twm. The (recommended)
302 dependency chain brings in the whole set of Xorg packages.
303
304 5.5 PATCHES
305
306 Please, make sure that all scripts have the commands to download/apply
307 the required patches. Due to book layout issues, some patches may be
308 missing (as of BLFS 8.0, all the patches seem to be downloaded).
309
310 5.6 ROOT COMMANDS
311
312 If building as a normal user (the default setting), be sure that all
313 commands that require root privileges are run using sudo. Also make sure
314 necessary root privilege commands are visible in your PATH. Or use
315 the `Defaults secure_path=' in /etc/sudoers.
316
317 For commands necessitating root privileges, the generated scripts wrap
318 them with the construct:
319 sudo -E sh << ROOT_EOF
320 <commands to be executed as root with `$', ``', and `\' escaped>
321 ROOT_EOF
322 The -E switch ensures the whole environment is passed to the
323 commands to be run with root privileges. It is effective only if the
324 /etc/sudoers file contains `Defaults setenv', or SETENV in the user
325 attributes. If you think it is a security issue, you may forbid this
326 flag in /etc/sudoers, but then, you have to un-escape `$' for variables
327 coming from the environment in the instructions.
328 Although this construct is rather strong, it can fail in some corner
329 cases, so carefully review those instructions.
330
331 WARNING: One variable from the environment is not passed through the
332 -E switch, namely PATH. This is because "sudo" always reset the PATH to
333 the default "secure_path". If you need to have the same PATH as the user
334 "root" would have, you may want to add "source /etc/profile" at the
335 beginning of the commands to be executed as root.
336
337 Due to book layout issues, some sudo commands may be missing.
338
339 5.7 OTHERS
340
341 There may be other issues that we are not aware of. If you find
342 any, please report it to <alfs-discuss@linuxfromscratch.org>.
343
Note: See TracBrowser for help on using the repository browser.