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