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