source: README.BLFS@ bcae37d

ablfs-more legacy trunk
Last change on this file since bcae37d was f538085, checked in by Pierre Labastie <pierre.labastie@…>, 4 years ago

Update instructions in README.BLFS

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