[93d32cf] | 1 | #
|
---|
| 2 | # $Id$
|
---|
| 3 | #
|
---|
[9a536f7] | 4 | HOW TO ADD CUSTOM SCRIPTS TO THE JHALFS MAKEFILE
|
---|
[93d32cf] | 5 |
|
---|
[9a536f7] | 6 |
|
---|
| 7 | Normally JHALFS creates a Makefile containing only those scripts found in
|
---|
[c7c32a3] | 8 | the {,B,C,H}LFS books. An automated construction tool cannot predict the
|
---|
[9a536f7] | 9 | needs of every individual and requests are made "Can you add xxxx package".
|
---|
| 10 | Rather than adding numerous package scripts and switches for each request it
|
---|
| 11 | was easier to add a tool for the user(s) to code their own package needs.
|
---|
| 12 |
|
---|
[c7c32a3] | 13 | There are two areas that can be customized: how the base system is built
|
---|
| 14 | and what additional configurations and packages your hardware requires to be
|
---|
| 15 | able to boot and run. Each of those areas are handled in a different way.
|
---|
[f222bb8] | 16 |
|
---|
| 17 |
|
---|
| 18 |
|
---|
[7b6ecc5] | 19 | BASE SYSTEM CUSTOMIZATION
|
---|
| 20 |
|
---|
[c7c32a3] | 21 | There are two ways to alter how the base system will be built:
|
---|
[7b6ecc5] | 22 |
|
---|
| 23 | - Using a working copy of the book sources and editing the XML files.
|
---|
| 24 | This is the way used by book editors to test packages upgrades,
|
---|
| 25 | command changes, build order changes. etc.
|
---|
| 26 |
|
---|
| 27 | This method requires you know very well the book sources and what
|
---|
| 28 | files need be edited. It will not be discussed here.
|
---|
| 29 |
|
---|
[c7c32a3] | 30 | - Editing the generated build scripts to make any change you want.
|
---|
[7b6ecc5] | 31 | This is the method discussed below.
|
---|
| 32 |
|
---|
[f222bb8] | 33 |
|
---|
| 34 | EDITING THE BASE SCRIPTS
|
---|
| 35 |
|
---|
[c7c32a3] | 36 | To begin with, the build scripts should be generated with book defaults. To
|
---|
| 37 | do that, configure jhalfs activating any option you want included, but do not
|
---|
| 38 | select "Run the Makefile" option.
|
---|
[f222bb8] | 39 |
|
---|
| 40 | Under the ${BUILD_DIR}/${SCRIPT_ROOT}/${PROGNAME}-commands directory
|
---|
| 41 | (using the defaults values to do an LFS build, that directory name is
|
---|
| 42 | /mnt/build_dir/jhalfs/lfs-commands) you will find the default build scripts.
|
---|
| 43 |
|
---|
| 44 | If all you want is modify, add, or remove some command from a package
|
---|
[c7c32a3] | 45 | installation, for example to change its ./configure line, just edit the related
|
---|
[f222bb8] | 46 | script. If changing or adding a patch, be sure to copy the new patch to the
|
---|
| 47 | ${BUILD_DIR}/sources directory. When done, run 'make' from inside the
|
---|
| 48 | ${BUILD_DIR}/${SCRIPT_ROOT} directory.
|
---|
| 49 |
|
---|
| 50 |
|
---|
| 51 | REPLACING OR INSERTING PACKAGES AND CHANGING BUILD ORDER
|
---|
| 52 |
|
---|
| 53 | To remove a package from the system, just remove its script(s).
|
---|
| 54 |
|
---|
[c7c32a3] | 55 | To change the version of some package, or to build a newer or older version
|
---|
| 56 | than that in the book, edit ${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list to
|
---|
| 57 | change its tarball name and place the new tarball in the ${BUILD_DIR}/sources
|
---|
| 58 | directory.
|
---|
[f222bb8] | 59 |
|
---|
| 60 | To replace a package by an equivalent one, rename the replaced package script
|
---|
| 61 | to reflect the new package name (for example, 102-man-db -> 102-man), edit the
|
---|
| 62 | script to made the required commands changes, place the new tarball in the
|
---|
| 63 | ${BUILD_DIR}/sources directory, and edit ${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list
|
---|
[c7c32a3] | 64 | file to replace the removed package tarball name by the new package tarball
|
---|
| 65 | name.
|
---|
[f222bb8] | 66 |
|
---|
| 67 | To change the build order, rename the scripts changing the first 3-digits
|
---|
[c7c32a3] | 68 | string until they are sorted in the way you want.
|
---|
| 69 |
|
---|
| 70 | To insert a new package, for example to build Cracklib in order to build
|
---|
| 71 | Shadow with Cracklib support, you should first decide before what package it
|
---|
| 72 | needs to be installed, in this example 107-shadow. Then create a new script
|
---|
| 73 | containing the needed commands, using an existing one as template, and name it
|
---|
| 74 | with the same 3-digits string used for that mentioned default package, but
|
---|
| 75 | adding another 1-digit string. In our example, the new script to build Cracklib
|
---|
| 76 | before Shadow will be named 107-1-cracklib. This naming scheme allows inserting
|
---|
| 77 | up to 10 scripts before each of the existing scripts. Place the tarball for
|
---|
| 78 | the new package and required patches, if any, in ${BUILD_DIR}/sources and edit
|
---|
[f222bb8] | 79 | ${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list to add the tarball name for that
|
---|
| 80 | package.
|
---|
| 81 |
|
---|
[c7c32a3] | 82 | When ready, launch again the jhalfs configuration interface. Make sure that
|
---|
| 83 | exactly the same options are selected as when generating the default build
|
---|
| 84 | scripts. Be sure that "Rebuild files" is unselected and select "Run the
|
---|
| 85 | Makefile" if you want. Then select "Rebuild the Makefile". This will create a
|
---|
| 86 | new Makefile based on the changes you made to the build scripts.
|
---|
[7b6ecc5] | 87 |
|
---|
| 88 |
|
---|
| 89 | ADDING POST-SYSTEM BUILD CONFIGURATION FILES AND EXTRA PACKAGES
|
---|
| 90 |
|
---|
| 91 | The installation of BLFS packages is handled via blfs-tool and activated
|
---|
[6acdc9c] | 92 | when you select the appropriate menu option. See README and README.BLFS for
|
---|
[7b6ecc5] | 93 | more info.
|
---|
| 94 |
|
---|
[6acdc9c] | 95 | The feature described below was added so users could install remaining
|
---|
| 96 | configuration files, build the packages necessary to access the Internet
|
---|
[c7c32a3] | 97 | or to support specific hardware, or to install basic utilities that are
|
---|
| 98 | needed from the beginning, and was not intended to replace the BLFS
|
---|
[7b6ecc5] | 99 | install system.
|
---|
| 100 |
|
---|
[b7ea8ff] | 101 | :::NOTICE:::
|
---|
| 102 | The following examples are for use with LFS and are not applicable to any
|
---|
| 103 | of the CLFS-sysroot or CLFS-Embedded books. The directory examples_CLFS-E
|
---|
[d933ab2] | 104 | contains code extracted from Beyond CLFS-embedded. Any packages you chose to
|
---|
| 105 | add should honour the DESTDIR=${CLFS} switch or equivalent.
|
---|
[b7ea8ff] | 106 |
|
---|
[9a536f7] | 107 |
|
---|
| 108 | LAYOUT
|
---|
[c7c32a3] | 109 | A new directory has been added to JHALFS tree which contains the
|
---|
[9a536f7] | 110 | configuration scripts and a few examples. A switch has been added to the
|
---|
[c7c32a3] | 111 | configuration file which enables/disables the inclusion of custom scripts.
|
---|
[9a536f7] | 112 |
|
---|
| 113 | custom
|
---|
[b7ea8ff] | 114 | /config <-- where to put your scripts.
|
---|
| 115 | /examples <-- a few example scripts
|
---|
| 116 | /examples_CLFS-E <-- example scripts for CLFS-Embedded
|
---|
| 117 | template <-- ALL scripts MUST look like this
|
---|
[9a536f7] | 118 |
|
---|
| 119 |
|
---|
| 120 |
|
---|
| 121 | NOTE::: You are responsible for including all dependencies and ensuring they
|
---|
[c7c32a3] | 122 | are built in the right order.
|
---|
[9a536f7] | 123 |
|
---|
| 124 | 1. To add a package to the final JHALFS Makefile you must first create a file
|
---|
| 125 | in the custom/config directory.
|
---|
| 126 | **All config files MUST follow the naming convention, xxx-PKG, where xxx
|
---|
| 127 | is the order number and PKG is the name of the package. The file naming
|
---|
| 128 | format is important as it defines the build order. The example shown
|
---|
| 129 | below has an order number 950 and log files will list in alphabetical
|
---|
| 130 | order in the /logs directory after blfs-tools scripts.
|
---|
| 131 | The simplest method is to copy the template file into the config directory
|
---|
| 132 | and rename it.
|
---|
| 133 |
|
---|
| 134 | 2. Populate the variables with the necessary values.
|
---|
[6acdc9c] | 135 | Variable function is self explanatory except for the inclusion of the
|
---|
[9a536f7] | 136 | build cmds. If the package you want to include is found in the BLFS
|
---|
| 137 | book then you only need to copy/paste the cmd strings between the xEOFx
|
---|
| 138 | pairs, otherwise you will need to define the build cmds yourself.
|
---|
| 139 | NOTE::: This script you just created is not usable directly but contains
|
---|
| 140 | all the information necessary for jhalfs to create a build script
|
---|
| 141 | and an entry in the jhalfs Makefile.
|
---|
| 142 |
|
---|
| 143 | 3. As mentioned previously the build order is dictated by the 3 digit number
|
---|
| 144 | in the file name. If a package has dependencies it must be numerically
|
---|
| 145 | larger than the dependency files.
|
---|
[6acdc9c] | 146 | i.e. The package mc has glib as a dependency and build order is
|
---|
[9a536f7] | 147 | 950-glib
|
---|
| 148 | 951-mc
|
---|
| 149 |
|
---|
| 150 | 4. A config file for BLFS-bootscripts is already created as 999-blfs_bootscripts.
|
---|
| 151 | If a package requires a bootscript to be installed add the cmd to this
|
---|
| 152 | file and NOT in the package script. The gpm script is included as an
|
---|
| 153 | example of multiple patch files and the need for a blfs bootscript.
|
---|
[93d32cf] | 154 |
|
---|
[9a536f7] | 155 |
|
---|
| 156 | #--------- GLIB example -----------
|
---|
| 157 |
|
---|
| 158 | #
|
---|
| 159 | # Filename syntax xxx-PKG ie. 950-glibc
|
---|
| 160 | # Create a file in the custom/config directory
|
---|
| 161 | # Populate the file using the following script as an example
|
---|
| 162 | #
|
---|
[93d32cf] | 163 |
|
---|
[9a536f7] | 164 | PKG="glib"
|
---|
| 165 | PKG_VERSION="1.2.10"
|
---|
| 166 | PKG_FILE="glib-1.2.10.tar.gz"
|
---|
| 167 | URL="http://gd.tuwien.ac.at/graphics/gimp/gtk/v1.2/${PKG_FILE}"
|
---|
| 168 | MD5="6fe30dad87c77b91b632def29dd69ef9"
|
---|
| 169 |
|
---|
[b7ea8ff] | 170 | # The following code removes previously defined PATCHx variables
|
---|
| 171 | for i in PATCH{1..10}; do
|
---|
| 172 | unset $i
|
---|
| 173 | done
|
---|
[9a536f7] | 174 | # Patches are named PATCH[1..10]
|
---|
| 175 | # This information is used to download the patch only
|
---|
| 176 | # If you do not have the MD5SUM the download will proceed with a warning.
|
---|
| 177 | PATCH1="http://www.linuxfromscratch.org/patches/blfs/svn/glib-1.2.10-gcc34-1.patch 0077a1cce5e8a2231ac5a9b08c6263ba"
|
---|
| 178 |
|
---|
| 179 |
|
---|
| 180 | # NOTE::
|
---|
| 181 | # The convoluted scheme used to write out a temporary file is
|
---|
| 182 | # a work-around for embedded single and double quotes.
|
---|
| 183 |
|
---|
| 184 | ( cat << "xEOFx"
|
---|
| 185 |
|
---|
| 186 | patch -Np1 -i ../glib-1.2.10-gcc34-1.patch &&
|
---|
| 187 | ./configure --prefix=/usr &&
|
---|
| 188 | make
|
---|
| 189 | make install &&
|
---|
| 190 | chmod -v 755 /usr/lib/libgmodule-1.2.so.0.0.10
|
---|
| 191 |
|
---|
| 192 | xEOFx
|
---|
| 193 | ) > tmp
|
---|
| 194 |
|
---|
| 195 |
|
---|
| 196 | #--------- GPM example -----------
|
---|
| 197 |
|
---|
| 198 |
|
---|
| 199 | PKG="gpm"
|
---|
| 200 | PKG_VERSION="1.20.1"
|
---|
[f37d08b] | 201 | PKG_FILE="gpm-1.20.1.tar.bz2"
|
---|
[9a536f7] | 202 | URL="ftp://arcana.linux.it/pub/gpm/gpm-1.20.1.tar.bz2"
|
---|
| 203 | MD5="2c63e827d755527950d9d13fe3d87692"
|
---|
[b7ea8ff] | 204 | for i in PATCH{1..10}; do
|
---|
| 205 | unset $i
|
---|
| 206 | done
|
---|
[7b6ecc5] | 207 | # MD5SUM is not absolutely necessary but JHALFS whines and complains
|
---|
[e7655b2] | 208 | # Add the MD5SUM if you can
|
---|
[9a536f7] | 209 | PATCH1=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-segfault-1.patch"
|
---|
| 210 | PATCH2=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-silent-1.patch"
|
---|
| 211 |
|
---|
| 212 |
|
---|
| 213 | ( cat << "xEOFx"
|
---|
| 214 |
|
---|
| 215 | patch -Np1 -i ../gpm-1.20.1-segfault-1.patch &&
|
---|
| 216 | patch -Np1 -i ../gpm-1.20.1-silent-1.patch &&
|
---|
| 217 | ./configure --prefix=/usr --sysconfdir=/etc &&
|
---|
| 218 | LDFLAGS="-lm" make
|
---|
| 219 |
|
---|
| 220 | make install &&
|
---|
| 221 | cp -v conf/gpm-root.conf /etc &&
|
---|
| 222 | ldconfig
|
---|
| 223 |
|
---|
| 224 | # The normal cmd to install the boot script for gpm
|
---|
| 225 | # --- PUT THIS CMD INSIDE 999-blfs_bootscripts
|
---|
| 226 | #make install-gpm
|
---|
| 227 |
|
---|
| 228 | cat > /etc/sysconfig/mouse << "EOF"
|
---|
| 229 | # Begin /etc/sysconfig/mouse
|
---|
| 230 |
|
---|
| 231 | MDEVICE="/dev/psaux"
|
---|
| 232 | PROTOCOL="imps2"
|
---|
| 233 | GPMOPTS=""
|
---|
| 234 |
|
---|
| 235 | # End /etc/sysconfig/mouse
|
---|
| 236 | EOF
|
---|
| 237 |
|
---|
| 238 | xEOFx
|
---|
| 239 | ) > tmp
|
---|
| 240 |
|
---|
[e7655b2] | 241 |
|
---|
| 242 | #--------- CMDS ONLY example -----------
|
---|
| 243 | # This is an example of a self contained cmd script
|
---|
| 244 | # There are no referenced to a package or package dir.
|
---|
| 245 | # This method is useful for creating user files/profiles/etc
|
---|
| 246 | # at build time.
|
---|
[7b6ecc5] | 247 |
|
---|
[e7655b2] | 248 |
|
---|
| 249 | PKG=""
|
---|
| 250 | PKG_VERSION=""
|
---|
| 251 | PKG_FILE=""
|
---|
| 252 | URL=""
|
---|
| 253 | MD5=""
|
---|
[b7ea8ff] | 254 | for i in PATCH{1..10}; do
|
---|
| 255 | unset $i
|
---|
| 256 | done
|
---|
[e7655b2] | 257 | PATCH1=""
|
---|
| 258 |
|
---|
| 259 |
|
---|
| 260 | ( cat << "xEOFx"
|
---|
| 261 |
|
---|
| 262 | echo "JUST A USELESS TRACE"
|
---|
| 263 |
|
---|
| 264 | xEOFx
|
---|
| 265 | ) > tmp
|
---|
| 266 |
|
---|