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