/[gentoo]/xml/htdocs/doc/en/genkernel.xml
Gentoo

Diff of /xml/htdocs/doc/en/genkernel.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.14 Revision 1.36
1<?xml version='1.0' encoding="UTF-8"?> 1<?xml version="1.0" encoding="UTF-8"?>
2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/genkernel.xml,v 1.14 2005/06/11 10:41:31 plasmaroo Exp $ --> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/genkernel.xml,v 1.36 2011/01/21 06:24:57 nightmorph Exp $ -->
3<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 3<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
4 4
5<guide link="/doc/en/genkernel.xml"> 5<guide>
6<title>Gentoo Linux Genkernel Guide</title> 6<title>Gentoo Linux Genkernel Guide</title>
7 7
8<author title="Author"> 8<author title="Author">
9 <mail link="plasmaroo@gentoo.org">Tim Yamin</mail> 9 <mail link="plasmaroo@gentoo.org">Tim Yamin</mail>
10</author> 10</author>
11<!-- folajimi@speakeasy.net -->
12<author title="Contributor">
13 Jimi Ayodele
14</author>
15<!-- thseiler@gmail.com -->
16<author title="NFS Support">
17 Thomas Seiler
18</author>
19<author title="Editor">
20 <mail link="nightmorph"/>
21</author>
22<author title="Contributor">
23 <mail link="sping"/>
24</author>
11 25
12<abstract> 26<abstract>
13This guide intends to provide a reference of all the functions 27This guide intends to provide a reference of all the functions provided by
14provided by genkernel. 28genkernel.
15</abstract> 29</abstract>
16 30
31<!-- The content of this document is licensed under the CC-BY-SA license -->
32<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
17<license/> 33<license/>
18 34
19<version>1.1.2.1</version> 35<version>6</version>
20<date>June 11, 2005</date> 36<date>2011-01-20</date>
21 37
22<chapter> 38<chapter>
23<title>Introduction</title> 39<title>Introduction</title>
24<section> 40<section>
25<title>Introduction</title> 41<title>Rationale</title>
26<body>
27
28<p>
29Genkernel is designed to allow users who are not previously used to
30compiling a kernel to use a similar setup to that one that is used on
31the Gentoo LiveCDs which auto-detects your hardware.
32</p>
33
34<p>
35Some users may also be interested in using genkernel for hardware
36which requires initialization and a working kernel before it can be
37booted. Because genkernel also automatically compiles your kernel modules,
38thus allowing hardware which needs to be loaded with module parameters
39to be used.
40</p>
41
42</body> 42<body>
43</section> 43
44<p>
45For users who don't want to manually compile their kernels, genkernel is a tool
46to automate this process. It can help you create a kernel image akin to those
47available on Gentoo Installation CDs, which are designed to auto-detect the
48hardware configuration of your system. Some users may also be interested in
49using genkernel for hardware requiring initialization and a working kernel
50before the system starts up.
51</p>
52
53</body>
44<section> 54</section>
45<title>Is genkernel for me?</title>
46<body>
47
48<p>
49Genkernel is often a good choice to those who are unused to compiling
50their own kernel or those who are not certain about their hardware
51configurations.
52</p>
53
54<p>
55Because genkernel is designed to use a generic configuration, it
56should be able to support all of your hardware - however, because all
57the drivers and modules have to be compiled as well, compiling a
58kernel by yourself is often much faster provided you know what you need.
59</p>
60
61<p>
62Genkernel does not however, currently support booting the sytem from
63LVM2/EVMS2 partitions. Users are recommended to use a manually compiled
64kernel for the time being.
65</p>
66
67</body>
68</section> 55<section>
56<title>Target Audience</title>
57<body>
58
59<p>
60If you are either uncertain about how to compile a kernel, or are just
61unfamiliar with your hardware configuration, genkernel is a very handy tool.
62It is designed to take the pain out of the kernel compiling process, and
63supports most hardware by default.
64</p>
65
66<p>
67However, if you know what drivers are required by your system, you may be able
68to further reduce the time taken to compile the kernel. This is possible since
69you can direct genkernel to only build drivers relevant to your hardware.
70Oftentimes, the number of drivers required by your system will be fewer
71(implying a shorter kernel compilation time) than the default configuration
72provides.
73</p>
74
75</body>
69<section> 76</section>
70<title>Getting genkernel</title>
71<body>
72
73<p>
74You can obtain genkernel by simply running <c>emerge genkernel</c>. Don't
75forget to use the <c>-k</c> flag for emerge if you are using binary packages,
76i.e. GRP. Due to the GRP packages having an older version of genkernel, the
77flags are different. As a result, you should consult the <uri
78link="/doc/en/handbook/handbook-x86.xml?part=1&amp;chap=10">
79Gentoo Handbook</uri> and <path>genkernel --help</path>.
80</p>
81
82</body>
83</section> 77<section>
84<section> 78<title>Installing genkernel</title>
85<title>Supported platforms</title>
86<body> 79<body>
87 80
88<p> 81<p>
89As of genkernel 3.0.2, the following platforms should be 82To obtain genkernel, run <c>emerge genkernel</c> from the command line. Consult
90supported: alpha, amd64, parisc, parisc64, ppc, ppc64, sparc, sparc64, and x86. 83<c>genkernel --help</c> for help on how to use the version of genkernel
84installed on your system.
91</p> 85</p>
92 86
93</body> 87</body>
94</section> 88</section>
95</chapter> 89</chapter>
96 90
97<chapter> 91<chapter>
98<title>Genkernel usage</title> 92<title>Working with genkernel</title>
99<section>
100<title>Introduction</title>
101<body>
102
103<p>
104Genkernel is designed to work in three modes:
105</p>
106
107<ul>
108 <li>"all" mode: this builds the kernel and the initrd</li>
109 <li>"kernel" mode: this only builds the kernel image</li>
110 <li>"initrd" mode: this only builds the initrd</li>
111</ul>
112
113<p>
114Most users will only want the "all" mode, which runs the "kernel" mode
115and the "initrd" mode for you. <b>Note</b> that the "kernel" and "initrd"
116modes are currently just aliases for the "all" mode, so they will
117currently give you no special effect.
118</p>
119
120<p>
121Although genkernel is mainly a command to make your life easier when
122you need to compile a kernel, genkernel is also packed full of
123different flags which allow you to customize how your kernel is
124compiled or configured.
125</p>
126
127</body>
128</section> 93<section>
94<title>How to use genkernel</title>
95<body>
96
97<p>
98Although there are several ways to run genkernel, the least-intrusive approach
99is provided by <c>genkernel all</c>. Here, a generic configuration which works
100well for most systems is used. As was mentioned earlier, this approach is not
101without drawbacks; most of the modules created are useless to the average user
102and may increase compile time. Below is an illustration of a more efficient
103approach, achieved by passing certain flags to genkernel as root:
104</p>
105
106<pre caption="Running genkernel (with flags)">
107# <i>genkernel --splash --no-install --no-clean --menuconfig all</i>
108</pre>
109
110<p>
111The above operation causes genkernel to create a framebuffer splash-enabled
112kernel (<c>--splash</c>) that will have to be manually installed
113(<c>--no-install</c>). While preparing the kernel source tree, genkernel will
114refrain from cleaning out any preexisting object files present in the source
115tree (<c>--no-clean</c>). A menu-driven kernel configuration utility will be
116displayed that allows the user to select which modules will be built for the
117system (<c>--menuconfig</c>).
118</p>
119
120<p>
121There are other flags which alter the result provided by genkernel. For
122instance, replacing <c>--no-install</c> with the <c>--install</c> flag allows
123genkernel to automatically install the new kernel in the <path>/boot</path>
124directory, and will create symlinks for you if <c>--symlink</c> is specified.
125Using the <c>--mountboot</c> flag allows genkernel to mount your
126<path>/boot</path> partition automatically, if necessary.
127</p>
128
129<p>
130Remember, genkernel is designed to make kernel compilation easy and
131stress-free. For this reason, genkernel features several flags to ease the
132kernel compilation effort. For example, there are flags to help with kernel
133configuration, while others affect the actual compilation. Some flags even help
134debug the compilation process. For those interested in further optimization,
135there are flags that affect kernel assembling, packaging and even kernel
136initialization.
137</p>
138
139<p>
140The rest of this chapter examines the functionality of various flags,
141configuration variables, and actions available for genkernel. For a more
142complete list, please refer to <c>man genkernel</c> and the comments in
143<path>/etc/genkernel.conf</path>. Some of the flags have variants which
144perform a converse operation. The converse variants carry the <b><c>no-</c></b>
145prefix, and their effects are enclosed within the square brackets, [].
146</p>
147
148</body>
129<section> 149</section>
130<title>Genkernel compiler flags</title>
131<body>
132
133<p>
134Genkernel supports the following flags which are passed to the
135relevant applications when your kernel is assembled:
136</p>
137
138<ul>
139 <li>
140 <b>--kernel-as=<c>someAssembler</c></b>: This specifies an assembler which
141 would be used for compiling your kernel.
142 </li>
143 <li>
144 <b>--kernel-cc=<c>someCompiler</c></b>: This specifies a compiler which
145 would be used for compiling your kernel.
146 </li>
147 <li>
148 <b>--kernel-ld=<c>someLinker</c></b>: This specifies a linker which would
149 be used for compiling your kernel.
150 </li>
151 <li>
152 <b>--kernel-make=<c>someMake</c></b>: This specifies an alternate GNU make
153 which would be used for compiling your kernel.
154 </li>
155</ul>
156
157<ul>
158 <li>
159 <b>--utils-as=<c>someAssembler</c></b>: This specifies an assembler which
160 would be used for compiling the support utilities.
161 </li>
162 <li>
163 <b>--utils-cc=<c>someCompiler</c></b>: This specifies a compiler which
164 would be used for compiling the support utilities.
165 </li>
166 <li>
167 <b>--utils-ld=<c>someLinker</c></b>: This specifies a linker which would be
168 used for compiling the support utilities.
169 </li>
170 <li>
171 <b>--utils-make=<c>someMake</c></b>: This specifies an alternate GNU make
172 which would be used for compiling the support utilities.
173 </li>
174</ul>
175
176<ul>
177 <li>
178 <b>--makeopts=<c>-jJobs</c></b>: This specifies the flags which would be
179 passed to GNU make when the kernel and utilities are being compiled.
180 </li>
181</ul>
182
183</body>
184</section> 150<section>
151<title>Configuration Flags</title>
152<body>
153
154<p>
155The configuration flags listed below exist to help you decide what features
156should be enabled or disabled in the kernel prior to compilation. You can even
157choose whether or not the configuration file created in the process should be
158saved. The following are the primary configuration flags:
159</p>
160
161<ul>
162 <li>
163 <b>--<c>no-</c>menuconfig</b>: Activates <e>[or deactivates]</e> the
164 <c>make menuconfig</c> command (which invokes an interactive, menu-based
165 kernel configuration utility), before building the kernel.
166 </li>
167 <li>
168 <b>--gconfig</b>: Provides a kernel configuration utility which depends on
169 the GTK+ libraries. The advantage of this option is that most users find it
170 easier and clearer to configure the kernel using this tool, since it relies
171 on the X-windowing system. The disadvantage of this option is that you
172 <b>need</b> the X-windowing system to use it, so it will not work on the
173 command line.
174 </li>
175 <li>
176 <b>--xconfig</b>: Provides a kernel configuration utility which depends on
177 the QT libraries. The advantage of this option is that most users find it
178 easier and clearer to configure the kernel using this tool, since it relies
179 on the X-windowing system. The disadvantage of this option is that you
180 <b>need</b> the X-windowing system to use it, so it will not work on the
181 command line.
182 </li>
183 <li>
184 <b>--<c>no-</c>save-config</b>: Saves <e>[or does not save]</e> the kernel
185 configuration to a file in the <path>/etc/kernels/</path> directory for
186 later use.
187 </li>
188</ul>
189
190</body>
185<section> 191</section>
186<title>Genkernel kernel flags</title>
187<body>
188
189<p>
190Genkernel supports the following flags, some of which have
191<c>--<b>no-</b>option</c> equivalents that influence
192kernel compilation:
193</p>
194
195<ul>
196 <li>
197 <b>--callback="echo Hello"</b>: This routine calls the specified
198 arguments after the kernel and the relevant modules have been built; but
199 before the initrd has been built. This is useful where you might want
200 external modules installed to the initrd by emerging the relevant item
201 using the callback and then redefinining a genkernel module group.
202 </li>
203 <li>
204 <b>--<c>no-</c>clean</b>: This runs <e>or does not
205 run</e> <c>make clean</c> before compiling your kernel. This
206 causes all object files and dependencies to be removed.
207 </li>
208 <li>
209 <b>--<c>no-</c>mrproper</b>: This runs <e>or does not
210 run</e> <c>make mrproper</c> before compiling your kernel. This
211 causes all object files, dependencies <b>and your
212 configuration</b> to be removed.
213 </li>
214</ul>
215
216<ul>
217 <li>
218 <b>--kerneldir=<path>/path/to/sources</path></b>: This specifies an
219 alternative kernel source location, instead of the default location of
220 <path>/usr/src/linux</path>.
221 </li>
222 <li>
223 <b>--kernel-config=<path>/path/to/config-file</path></b>: This specifies an
224 alternative kernel configuration which would be used; rather than the
225 inpersistant <path>/path/to/sources/.config</path> which is used by
226 default.
227 </li>
228</ul>
229
230<ul>
231 <li>
232 <b>--<c>no-</c>bootsplash</b>: This adds <e>or does not add</e> bootsplash
233 support in the initrd which genkernel builds. Not all architectures
234 currently support bootsplash, and a kernel that supports bootsplash is
235 also required.
236 </li>
237 <li>
238 <b>--<c>no-</c>menuconfig</b>: This runs <e>or does not run</e> the kernel
239 menu-based configurator before building your kernel, after <c>make
240 oldconfig</c> has run.
241 </li>
242</ul>
243
244<ul>
245 <li>
246 <b>--no-initrdmodules</b>: This doesn't copy any modules to the initrd
247 which genkernel creates.
248 </li>
249 <li>
250 <b>--<c>no-</c>install</b>: This installs <e>or does not install</e> your
251 kernel, modules, and initrd once the compilation has finished.
252 </li>
253</ul>
254
255</body>
256</section> 192<section>
193<title>Compilation Flags</title>
194<body>
195
196<p>
197The following flags usually take effect during the actual compilation:
198</p>
199
200<ul>
201 <li>
202 <b>--kerneldir=<path>/path/to/sources/</path></b>: Specifies an alternative
203 kernel source location, rather than the default
204 <path>/usr/src/linux/</path> location.
205 </li>
206 <li>
207 <b>--kernel-config=<path>/path/to/config-file</path></b>: Specifies what
208 alternative kernel configuration will be used, rather than the default
209 <path>/path/to/sources/.config</path> file.
210 </li>
211 <li>
212 <b>--module-prefix=<path>/path/to/prefix-directory/</path></b>: Specifies a
213 prefix to the directory where kernel modules will be installed (default
214 path is the <path>/lib/modules/</path> directory.)
215 </li>
216</ul>
217
218<ul>
219 <li>
220 <b>--<c>no-</c>clean</b>: Activates <e>[or deactivates]</e> the <c>make
221 clean</c> command before compiling your kernel. The <c>make clean</c>
222 command removes all object files and dependencies from the kernel's source
223 tree.
224 </li>
225 <li>
226 <b>--<c>no-</c>mrproper</b>: Activates <e>[or deactivates]</e> the <c>make
227 mrproper</c> command before kernel compilation. Like the <c>make clean</c>
228 command, <c>make mrproper</c> removes all object files and dependencies
229 from the kernel's source tree. However, any previous configuration files
230 (in <path>/path/to/sources/.config</path> or
231 <path>/path/to/sources/.config.old</path>) will <b>also</b> be purged from
232 the kernel's source tree.
233 </li>
234 <li>
235 <b>--oldconfig</b>: Issues the <c>make oldconfig</c> command, which
236 attempts to collect configuration information for the system's architecture
237 from a generic script in <path>/usr/share/genkernel/</path>. This is a
238 non-interactive process; no user input is entertained. Also, if
239 <c>--oldconfig</c> is used in conjunction with <c>--clean</c>, the latter
240 flag is negated, resulting in the activation of the <c>--no-clean</c> flag.
241 </li>
242</ul>
243
244<ul>
245 <li>
246 <b>--callback="<c>echo hello</c>"</b>: Calls the specified arguments
247 (<c>echo hello</c>, in this case) after the kernel and the relevant modules
248 have been built, but before building the initrd image. This may be useful
249 if you want to install external modules in the initrd image by emerging the
250 relevant item(s) with the callback feature, and then redefining a genkernel
251 module group.
252 </li>
253</ul>
254
255<ul>
256 <li>
257 <b>--<c>no-</c>install</b>: Activates <e>[or deactivates]</e> the <c>make
258 install</c> command, which installs your new kernel image, configuration
259 file, initrd image and system map onto your mounted boot partition. Any
260 compiled modules will be installed as well.
261 </li>
262 <li>
263 <b>--no-ramdisk-modules</b>: Refrains from copying any modules to the
264 genkernel-created initrd image. This flag is an exception to the rule about
265 the <c>no-</c> prefix; omission of this prefix creates an invalid genkernel
266 flag.
267 </li>
268 <li>
269 <b>--all-ramdisk-modules</b>: Copies all available modules to the
270 genkernel-created initrd image.
271 </li>
272 <li>
273 <b>--genzimage</b>: Creates the initrd image, prior to the kernel image.
274 (This hack currently applies only to PPC Pegasos systems.)
275 </li>
276</ul>
277
278</body>
257<section> 279</section>
258<title>Genkernel miscellaneous flags</title>
259<body>
260
261<p>
262Genkernel also supports some miscellaneous flags which do not fit into
263the other two categories:
264</p>
265
266<ul>
267 <li>
268 <b>--arch-override=<c>someArch</c></b>: This flag can be used to override
269 what architecture genkernel thinks you're on, if the auto-detection
270 mechanism fails (please file a bug if it does!) or if you wish to
271 cross-compile a kernel.
272 </li>
273</ul>
274
275<ul>
276 <li>
277 <b>--busybox-config=<path>/path/to/busybox-config</path></b>: This
278 overrides the default busybox configuration with the specifid file
279 </li>
280 <li>
281 <b>--busybox-bin=<path>/path/to/busybox-binary.tar.bz2</path></b>: Using
282 this option means that a busybox binary would not be compiled, and the
283 specified tarball would be used. Note that busybox <e>must</e> be compiled
284 statically!
285 </li>
286</ul>
287
288<ul>
289 <li>
290 <b>--minkernpackage=<path>/output/to/yourkernel.tar.bz2</path></b>: This
291 flag outputs a tarball of the kernel, named as <path>kernel</path> and the
292 initrd named as <path>initrd</path> to the specified file. No path
293 information or modules will be included in the tarball.
294 </li>
295</ul>
296
297</body>
298</section> 280<section>
281<title>Compiler Flags</title>
282<body>
283
284<p>
285The following flags are supported by genkernel, and are passed to the relevant
286applications while the kernel is being assembled. These flags affect the
287<e>compiler</e> used for the kernel compilation process, albeit at a much lower
288level.
289</p>
290
291<ul>
292 <li>
293 <b>--kernel-cc=<c>someCompiler</c></b>: Specifies the compiler employed
294 during the kernel compilation process.
295 </li>
296 <li>
297 <b>--kernel-ld=<c>someLinker</c></b>: Specifies the linker employed during
298 the kernel compilation process.
299 </li>
300 <li>
301 <b>--kernel-as=<c>someAssembler</c></b>: Specifies the assembler employed
302 during the kernel compilation process.
303 </li>
304 <li>
305 <b>--kernel-make=<c>someMake</c></b>: Specifies an alternative to the
306 <e>GNU make</e> utility employed during the kernel compilation process.
307 </li>
308</ul>
309
310<ul>
311 <li>
312 <b>--utils-cc=<c>someCompiler</c></b>: Specifies the compiler employed
313 during the compilation of support utilities.
314 </li>
315 <li>
316 <b>--utils-ld=<c>someLinker</c></b>: Specifies the linker employed during
317 the compilation of support utilities.
318 </li>
319 <li>
320 <b>--utils-as=<c>someAssembler</c></b>: Specifies the assembler employed
321 during the compilation of support utilities.
322 </li>
323 <li>
324 <b>--utils-make=<c>someMake</c></b>: Specifies an alternative to the <e>GNU
325 make</e> utility employed during the compilation of support utilities.
326 </li>
327</ul>
328
329<ul>
330 <li>
331 <b>--makeopts=<c>-jX</c></b>: Specifies the number of concurrent threads
332 that the make utility can implement while the kernel (and utilities) are
333 being compiled. The variable <b>'X'</b> is a number obtained by adding one
334 (1) to the number of CPUs used by the system. So, for a system with one
335 CPU, the appropriate flag is <c>-j2</c>; a system with two CPUs will use
336 the <c>-j3</c> flag, and so on. <e>(A system with one processor that
337 supports Hyper-Threading&trade; (HT) Technology can use the
338 </e><c>-j3</c><e> flag, provided Symmetric Multi-Processing (SMP) support is
339 enabled in the kernel.)</e>
340 </li>
341</ul>
342
343</body>
299<section> 344</section>
300<title>Running genkernel</title>
301<body>
302
303<p>
304All that is needed to run genkernel is just genkernel with the
305necessary flags as root. For example:
306</p>
307
308<pre caption="Running genkernel">
309# genkernel --menuconfig --no-clean --no-install --bootsplash all
310<comment>(Would produce a kernel, asking you how to configure it
311to your desire, leaving alone any compiled object files, enabling
312bootsplash support but not installing anything.)</comment>
313</pre>
314
315<p>
316If you want genkernel to install your kernel as well, you must ensure
317that your <path>/boot</path> partition is mounted - recent genkernels
318would automatically attempt to do this for you if MOUNTBOOT is set to
319"yes" in <path>/etc/genkernel.conf</path>.
320</p>
321
322<pre caption="Mounting your /boot manually">
323<comment>(If /boot is a valid entry in /etc/fstab:)</comment>
324# mount /boot
325<comment>(... otherwise for IDE disks:)</comment>
326# mount /dev/hda1 /boot
327<comment>(... and for SCSI disks:)</comment>
328# mount /dev/sda1 /boot
329</pre>
330
331</body>
332</section> 345<section>
346<title>Debugging Flags</title>
347<body>
348
349<p>
350The use of debugging flags during the kernel compilation process controls the
351amount of information reported, as well as the presentation of said data.
352</p>
353
354<ul>
355 <li>
356 <b>--loglevel=<c>verblevel</c></b>: Controls the level of verbosity for
357 information provided by genkernel. The variable <c>verblevel</c> is an
358 integer between 0 and 5. The level '0' represents minimal output, while '5'
359 provides as much information as possible about genkernel's activities
360 during the kernel compilation process.
361 </li>
362 <li>
363 <b>--logfile=<path>/path/to/outputfile</path></b>: Ignores the value set
364 by the <c>--loglevel</c> argument, and sends <b>all</b> debugging data
365 produced by genkernel to the specified output file, which is located at
366 <path>/var/log/genkernel.log</path> by default.
367 </li>
368 <li>
369 <b>--no-color</b>: Activates <e>[or deactivates]</e> colored output of
370 debugging information (reported by genkernel) using escape sequences.
371 </li>
372</ul>
373
374</body>
333<section> 375</section>
334<title>Setting up genkernel to work with your bootloader</title> 376
377<section>
378<title>Initialization Flags</title>
379<body>
380
381<p>
382The flags here are used to create certain effects during system startup. Some
383of these flags are primarily for aesthetics, while others may be essential for
384enabling certain features on the system.
385</p>
386
387<ul>
388 <li>
389 <b>--<c>no-</c>splash</b>: Activates <e>[or deactivates]</e> support for
390 <uri link="http://fbsplash.berlios.de/wiki/doku.php">framebuffer
391 splash</uri> support in the genkernel-built initrd image. To override the
392 default theme used by fbsplash, use <b>--splash=<c>PreferredTheme</c></b>
393 (where <c>PreferredTheme</c> is the title of one of the directories inside
394 the <path>/etc/splash/</path> directory.
395 </li>
396 <li>
397 <b>--splash-res=<c>PreferredResolution</c></b>: This flag allows you to
398 select which splash screen resolutions will be supported in the initrd
399 during the start-up of the system. This is useful for two reasons: First,
400 you are able to select only the splash screen resolution(s) relevant to your
401 system. Second, you avoid the unnecessary increase in the disk space
402 required by initrd (since the initrd does not have to support resolutions
403 that are irrelevant for your system configuration.) However, you may want to
404 omit this flag if the kernel is being compiled for an Installation CD; this
405 allows splash support for all possible resolutions.
406 </li>
407 <li>
408 <b>--do-keymap-auto</b>: Force keymap selection during the boot sequence.
409 </li>
410 <li>
411 <b>--lvm</b>: Includes support for storage using via <uri
412 link="http://sources.redhat.com/lvm2/">Logical Volume Management</uri>
413 (LVM2) from <e>static</e> binaries, if available to the system. Relevant
414 (static) LVM2 binaries are compiled if they are unavailable. Be sure to
415 install the lvm2 package on your system with <c>emerge lvm2</c> before
416 enabling this flag, and review the <uri link="/doc/en/lvm2.xml">Gentoo LVM2
417 Installation</uri> guide.
418 </li>
419 <li>
420 <b>--evms</b>: Includes support for storage using the <uri
421 link="http://evms.sourceforge.net/">Enterprise Volume Management
422 System</uri> (EVMS2), if available. Be sure to install the evms package on
423 your system with <c>emerge evms</c> before using this (genkernel)
424 flag.
425 </li>
426 <li>
427 <b>--dmraid</b>: Includes support for <uri
428 link="http://people.redhat.com/~heinzm/sw/dmraid/readme">DMRAID</uri>; the
429 utility which creates RAID mappings using the kernel device-mapper
430 subsystem. DMRAID discovers, activates, deactivates and displays properties
431 of software RAID sets (ATARAID, for example) and contained DOS partitions.
432 </li>
433 <li>
434 <b>--luks</b>: Includes support for <uri
435 link="http://luks.endorphin.org/">Linux Unified Key Setup</uri> or LUKS.
436 This will allow you to use a device encrypted by LUKS which contains the
437 root filesystem. On the bootloader, you then set that encrypted device as
438 the value of crypt_root (and real_root shall be the unencrypted device LUKS
439 creates).
440 </li>
441 <li>
442 <b>--disklabel</b>: Adds support for disk label and UUID support to your
443 initrd.
444 </li>
445 <li>
446 <b>--iscsi</b>: Adds support for iSCSI to your initrd.
447 </li>
448 <li>
449 <b>--multipath</b>: Adds support for <uri
450 link="/doc/en/multipath.xml">Multipath</uri> to your initrd.
451 </li>
452 <li>
453 <b>--linuxrc=/path/to/your/linuxrc</b>: Specifies a user-created
454 <e>linuxrc</e> &mdash; a script that is initialized during the start-up
455 stage of the kernel, prior to the actual boot process. (A default linuxrc
456 script should be in the <path>/usr/share/genkernel/</path> directory.) This
457 script allows you to boot into a small, modularized kernel and load the
458 drivers that are needed (as modules) by the system.
459 </li>
460 <li>
461 <b>--cachedir=/path/to/alt/dir/</b>: Overrides the default cache location
462 used while compiling the kernel.
463 </li>
464 <li>
465 <b>--tempdir=/path/to/new/tempdir/</b>: Specifies the location of the
466 temporary directory used by genkernel while compiling the kernel.
467 </li>
468 <li>
469 <b>--unionfs</b>: Includes support for the <uri
470 link="http://www.fsl.cs.sunysb.edu/project-unionfs.html">Unification File
471 System</uri> in the initrd image.
472 </li>
473</ul>
474
335<body> 475</body>
476</section>
477<section>
478<title>Miscellaneous Flags</title>
479<body>
336 480
481<p>
482The assortment of flags listed below are supported by genkernel, but do not fit
483neatly into any of the other categories:
337<p> 484</p>
485
486<ul>
487 <li>
488 <b>--mountboot</b>: Detects whether or not the <path>/boot/</path>
489 directory needs to be mounted on a separate partition. It will check
490 <path>/etc/fstab</path> script for instructions on how to mount the boot
491 partition on a file system (if needed).
492 </li>
493 <li>
494 <b>--kernname=<c>NickName</c></b>: Allows you to modify the name of the
495 kernel and initrd images in the <path>/boot/</path> directory, so that the
496 images produced are kernel-<c>NickName</c>-version and
497 initramfs-<c>NickName</c>-version.
498 </li>
499</ul>
500
501</body>
502</section>
503<section>
504<title>Possible Actions</title>
505<body>
506
507<p>
508An action tells genkernel what to build. Currently, the following actions are
509supported:
510</p>
511
512<ul>
513 <li>
514 <c>all</c>: Builds all stages &mdash; the initrd, kernel image and modules.
515 </li>
516 <li><c>bzImage</c>: Only builds the kernel image</li>
517 <li><c>kernel</c>: Only builds the kernel image and modules</li>
518 <li><c>initramfs</c>: Only builds the initramfs/ramdisk image</li>
519 <li><c>ramdisk</c>: Only builds the initramfs/ramdisk image</li>
520</ul>
521
522<p>
523The first action, <c>all</c>, is recommended for most users since it builds the
524stages required for a functional kernel. Remember, an <e>action</e> simply
525tells genkernel what to <e>build</e>, not <e>install</e>.
526</p>
527
528</body>
529</section>
530<section>
531<title>Bootloader Configuration</title>
532<body>
533
534<p>
338To set up genkernel to work with your bootloader, three or four changes are 535To set up genkernel to work with your bootloader, three or four changes should
339required to your bootloader configuration. 536be applied to the bootloader's configuration file:
340</p> 537</p>
341 538
342<ol> 539<ol>
343 <li> 540 <li>
344 Add <c>root=/dev/ram0</c> and <c>init=/linuxrc</c> to the
345 kernel parameters passed to the kernel image.
346 </li>
347 <li>
348 Add <c>real_root=/dev/hda3</c>, for example, to the kernel parameters 541 Add <c>real_root=/dev/sda3</c>, for example, to the kernel parameters
349 passed to the kernel image, if <path>/dev/hda3</path> contains your root 542 passed to the kernel image, if <path>/dev/sda3</path> contains your root
350 partition. 543 partition.
351 </li> 544 </li>
352 <li> 545 <li>
353 If you are using bootsplash, add a suitable modeline such as 546 If you are using splash, add a suitable mode line such as <c>vga=0x317</c>
354 <c>vga=0x317</c> to the parameters passed to the kernel and also add 547 to the parameters passed to the kernel and also add <c>splash=verbose</c> or
355 <c>splash=verbose</c> or <c>splash=silent</c> depending on the verboseness 548 <c>splash=silent</c> depending on the verboseness you require from your
356 you require from your bootsplash. 549 bootloader.
357 </li>
358 <li> 550 </li>
359 Add the initrd according to how your bootloader requires it: see the <uri 551 <li>
552 Add the initrd information as required by the bootloader. Consult the <uri
360 link="/doc/en/handbook/handbook-x86.xml?part=1&amp;chap=10">Gentoo 553 link="/doc/en/handbook/handbook-x86.xml?part=1&amp;chap=10">Bootloader
361 Handbook</uri> for details on how you would do it for your bootloader. 554 Configuration Chapter</uri> of the Gentoo Handbook for details on how to
555 make your bootloader initrd-aware.
362 </li> 556 </li>
363</ol> 557</ol>
364 558
365</body> 559</body>
366</section> 560</section>
367<section>
368<title>Kernel Configuration Files</title>
369<body>
370
371<p>
372Genkernel will save your kernel config in <path>/etc/kernels</path> and use that
373config whenever you issue <c>genkernel</c> again. If you want to start off again
374with the defaults, rename the file in <path>/etc/kernels</path>. Genkernel will
375then use the kernel config located in
376<path>/usr/share/genkernel/&lt;arch&gt;</path> instead.
377</p>
378
379</body>
380</section>
381</chapter> 561</chapter>
382 562
383<chapter> 563<chapter>
384<title>Porting genkernel</title> 564<title>Configuration Options</title>
385<section>
386<title>Introduction</title>
387<body>
388
389<p>
390Provided your architecture has all the required libraries and utilties
391which genkernel requires, which includes but it is not limited to a
392working kernel for your architecture, working compiler suite, GNU
393make, and a working busybox distribution, you're all set to go!
394</p>
395
396<p>
397For each architecture, genkernel uses
398<path>/usr/share/genkernel/$archName</path> for configuration files for
399that architecture.
400</p>
401
402</body>
403</section> 565<section>
566<title>Editing /etc/genkernel.conf</title>
567<body>
568
569<p>
570Passing flags to genkernel from the command line can be cumbersome, especially
571if you have about a dozen flags:
572</p>
573
574<pre caption="Running genkernel (overloaded with flags)">
575# <i>genkernel --loglevel=5 --no-color --no-mrproper --clean --splash \
576--kerneldir=/path/to/alternate/kernel/sources --install --menuconfig \
577--kernel-config=/path/to/preferred/configfile --save-config --mountboot all</i>
578</pre>
579
580<p>
581Fortunately, there is a configuration file where most of the basic options can
582be set (or changed) as necessary: <path>/etc/genkernel.conf</path>. What follows
583is a rundown of the more relevant options:
584</p>
585
586<ul>
587 <li>
588 <b>MENUCONFIG=<c>[yes|no]</c></b>: This option is equivalent to the
589 <c>--menuconfig</c> flag used by genkernel, which in turn uses the <c>make
590 menuconfig</c> command to invoke a command-line based kernel configuration
591 utility. To invoke the utility automatically during kernel configuration
592 via this script, set this option to 'yes' here; otherwise, choose 'no'.
593 </li>
594 <li>
595 <b>CLEAN=<c>[yes|no]</c></b>: Setting this option to 'yes' is equivalent to
596 the <c>--clean</c> flag used by genkernel, and invokes the <c>make
597 clean</c> command to remove all object files and dependencies from the
598 kernel's source tree. Setting this option to 'no' creates a cascade effect
599 &#8212; it is equivalent to genkernel's <c>--no-clean</c> flag, which
600 disables the <c>make clean</c> command and implies genkernel's
601 <c>--no-mrproper</c> flag &mdash; essentially nullifying the <c>make
602 mrproper</c> command.
603 </li>
604 <li>
605 <b>MRPROPER=<c>[yes|no]</c></b>: Setting this option to 'yes' is equivalent
606 to <c>--mrproper</c> flag used by genkernel, and invokes the <c>make
607 mrproper</c> command, which purges the kernel source tree of any
608 configuration files. Selecting 'no' here is equivalent to genkernel's
609 <c>--no-mrproper</c> flag, which disables the <c>make mrproper</c> command.
610 </li>
611 <li>
612 <b>MOUNTBOOT=<c>[yes|no]</c></b>: Setting this option to 'yes' is
613 equivalent to the <c>--mountboot</c> flag, and automatically mounts the
614 <path>/boot/</path> directory (if needed) at compile time. If the
615 <path>/boot/</path> directory is on a separate partition, consider enabling
616 this option; it will make for one less (essential) step to remember later.
617 </li>
618 <li>
619 <b>SAVE_CONFIG=<c>[yes|no]</c></b>: After configuring the kernel, the
620 selected options are stored as <path>.config</path> in the kernel source
621 tree. This script may be overwritten during the next kernel compilation, or
622 even purged from the kernel source tree. Choosing 'yes' here is equivalent
623 to the <c>--save-config</c> flag, and stores all options selected during
624 kernel configuration as a script in the <path>/etc/kernels/</path>
625 directory. Choosing 'no' preserves the <e>status quo</e>.
626 </li>
627 <li>
628 <b>USECOLOR=<c>[yes|no]</c></b>: Setting this option to 'yes' is equivalent
629 to the <c>--color</c> flag, which colors genkernel's output to ease
630 debugging (when needed.)
631 </li>
632 <li>
633 <b>LOGLEVEL=<c>[0|1|2|3|4|5]</c></b>: This option is for adjusting the
634 verbosity of the output produced by genkernel &mdash; setting this option to
635 '0' with <c>--loglevel=0</c> will suppress all output produced by
636 genkernel; setting this option to '5' with <c>--loglevel=5</c> provides
637 the user with all output produced by genkernel.
638 </li>
639</ul>
640
641<note>
642More options are described in <path>/etc/genkernel.conf</path>.
643</note>
644
645<p>
646By choosing the appropriate options in <path>/etc/genkernel.conf</path>, you
647can halve the number of flags passed to genkernel from the command line:
648</p>
649
650<pre caption="Running genkernel (with flags), after employing genkernel.conf">
651# <i>genkernel --splash --kerneldir=/path/to/alternate/kernel/sources \
652--kernel-config=/path/to/preferred/configfile --install all</i>
653</pre>
654
655<p>
656Identical results are obtained from both approaches, but the latter has most of
657the options stored in a script that can be modified at a later date.
658</p>
659
660</body>
404<section> 661</section>
405<title>How the system bootstrapping works</title> 662</chapter>
406<body>
407 663
408<ol> 664<chapter>
409 <li> 665<title>Network-Booting with genkernel</title>
410 The bootloader loads the genkernel image, built to the specification of the
411 configuration files in the genkernel directories as well as the initrd
412 which is prepared by genkernel.
413 </li>
414 <li>
415 The kernel boots up, allocates a small amount of RAM in which busybox is
416 initialized, which probes the system with the modules in the modules_load
417 list for the architecture.
418 </li>
419 <li>
420 Once done, and providing that the <c>real_root</c> parameter which is the
421 root boot device as busybox sees things is found, the system is booted from
422 the device.
423 </li>
424</ol>
425
426</body>
427</section> 666<section>
667<title>Network Booting from an Installation CD</title>
668<body>
669
670<p>
671The genkernel utility can build kernel and initrd images that provide support
672for network booting, or <e>netboot</e>ing. With any luck, you should be able
673to netboot any recent computer into the environment provided by the
674Installation CD.
675</p>
676
677<p>
678The magic lies in genkernel's linuxrc script: it will try to <e>netmount</e>
679the Installation CD using NFS. From there, <e>the init scripts</e> of the
680Installation CD can take over, as if the CD was present locally.
681</p>
682
683</body>
428<section> 684</section>
429<title>The configuration files</title> 685<section>
686<title>Building Kernel and Initrd Images with Support for Netbooting</title>
687<body>
688
689<p>
690To enable support for netbooting, include the following options while
691configuring the kernel:
692</p>
693
694<warn>
695Support for netbooting with genkernel is experimental and may contain bugs.
696</warn>
697
698<p>
699First, the kernel image must include the drivers for your Network Interface
700Cards (NIC). Normally, drivers for such devices will be compiled as modules.
701However, it is essential (for netbooting) that you have such drivers compiled
702directly into the kernel image and <b>not</b> as modules.
703</p>
704
705<pre caption="Configuring a 2.6.x series kernel to support your NIC driver">
706Device Drivers --->
707 Networking Support --->
708 Ethernet (10 or 100Mbit) --->
709 [*] Ethernet (10 or 100Mbit)
710 &lt;*&gt; the driver for your network card
711<comment>(Be sure to select &lt;*&gt; and not &lt;M&gt;)</comment>
712</pre>
713
714<p>
715Secondly, we suggest that you enable <c>IP: kernel level autoconfiguration</c>
716and the <c>IP: DHCP support</c> options. This avoids an unnecessary layer of
717complexity since the IP address and the NFS path to the Installation CD can be
718configured on a DHCP server. Of course, this means the kernel command line
719will remain constant for any machine &mdash; which is very important for
720<e>etherbooting</e>.
721</p>
722
723<pre caption="Configuring a 2.6.x series kernel to support DHCP">
724Device Drivers --->
725 Networking Support --->
726 Networking options
727 [*] TCP/IP networking--->
728 [*] IP: kernel level autoconfiguration
729 [*] IP: DHCP support
730<comment>(These options tell the kernel to send a DHCP request at bootup.)</comment>
731</pre>
732
733<p>
734Additionally, you should enable SquashFS because most modern Gentoo
735Installation CDs require it. Support for SquashFS is not included with the
736generic kernel source tree. To enable SquashFS, apply the necessary patches to
737the generic kernel source or install <c>gentoo-sources</c>.
738</p>
739
740<pre caption="Configuring the kernel to support SquashFS">
741File systems--->
742 Miscellaneous filesystems --->
743 [*] SquashFS 2.X - Squashed file system support
744</pre>
745
746<p>
747Once the compilation process is completed, create a compressed <e>tarball</e>
748(tar.gz) that contains the kernel's modules. This step is only necessary if
749your kernel version does not match the kernel image version on the Installation
750CD.
751</p>
752
753<pre caption="Creating a compressed tarball containing the kernel modules">
754<comment>(Create a tar.gz containing all the modules)</comment>
755# <i>cd /</i>
756# <i>tar -cf /tmp/modules-X.Y.Z.tar.gz /lib/modules/X.Y.Z/</i>
757</pre>
758
759<p>
760Depending on your network boot mechanism, you will need to do some of the
761following steps:
762</p>
763
764<pre caption="Creating a boot image">
765<comment>(Create an etherboot image)</comment>
766# <i>emerge mknbi</i>
767# <i>cd /boot</i>
768# <i>mkelf-linux -params="root=/dev/ram0 init=/linuxrc ip=dhcp" kernel... initrd... > etherboot.img</i>
769
770<comment>(Create a OpenBoot / SPARC64 TFTP image)</comment>
771# <i>emerge sparc-utils</i>
772# <i>cd /boot</i>
773# <i>elftoaout kernel... -o kernel.aout</i>
774# <i>piggyback64 kernel.aout System.map-... initrd-...</i>
775# <i>mv kernel.aout openboot.img</i> <comment>(This is the boot image)</comment>
776
777<comment>(PXE does not need any more steps, the kernel and initrd can be used as is)</comment>
778</pre>
779
780<p>
781Finally, copy this kernel to your TFTP server. The details are
782architecture-dependent and are beyond the scope of this guide. Please refer to
783the documentation for your platform.
784</p>
785
430<body> 786</body>
787</section>
788<section>
789<title>NFS Setup</title>
790<body>
431 791
432<ul> 792<p>
433 <li> 793To setup a NFS share that contains the Installation CD, use the loop device to
434 <path>busy-config</path>: This is the configuration which is used to build 794mount the ISO image and then copy the contents of the CD into the NFS share. As
435 busybox for your architecture. 795a nice extra, genkernel's initrd scripts will extract all tar.gz files located
436 </li> 796in the <path>/nfs/livecd/add/</path> directory. All you have to do here is copy
437 <li> 797the <c>modules-X.Y.Z.tar.gz</c> archive to the <path>/nfs/livecd/add/</path>
438 <path>config.sh</path>: This is a shell script which sets various internal 798directory.
439 genkernel variables. See one of the <path>config.sh</path> files for an 799</p>
440 example.
441 </li>
442 <li>
443 <path>modules_load</path>: This is a file containing a space-delimited list
444 of modules which are loaded for SCSI, FireWire, ATARAID and PCMCIA support.
445 If none are available for your platform, leave the fields blank. See one of
446 the <path>modules_load</path> files for an example.
447 </li>
448</ul>
449 800
450<ul> 801<pre caption="Preparing the NFS share">
451 <li> 802<comment>(This assumes that /nfs/livecd is an exported NFS share)</comment>
452 <path>kernel-config</path>: A default kernel configuration used for any 803# <i>mount /tmp/gentoo-livecd.iso /mnt/cdrom -o loop</i>
453 kernel version. 804# <i>cp -p /mnt/cdrom /nfs/livecd</i>
454 </li> 805# <i>umount /mnt/cdrom</i>
455 <li> 806
456 <path>kernel-config-2.4</path>: A default kernel configuration used for 2.4 807<comment>(Copy the modules.tar.gz into /add)</comment>
457 series kernels. 808# <i>mkdir /nfs/livecd/add</i>
458 </li> 809# <i>cp /tmp/modules-X.Y.Z.tar.gz /nfs/livecd/add</i>
459 <li> 810</pre>
460 <path>kernel-config-2.6</path>: A default kernel configuration used for 2.6 811
461 series kernels. 812</body>
462 </li> 813</section>
463</ul> 814<section>
815<title>DHCP Setup</title>
816<body>
817
818<p>
819The netboot images will ask your DHCP server for an IP as well as a root-path
820parameter. Both can be specified per host using a MAC address to identify
821machines:
822</p>
823
824<pre caption="Sample client dhcpd.conf setup">
825...
826
827host netbootableMachine {
828 hardware ethernet 11:22:33:44:55:66;
829 fixed-address 192.168.1.10;
830 option root-path "192.168.1.2:/nfs/livecd";
831}
832<comment># Here, 192.168.1.2 is the NFS server
833# While 192.168.1.10 will be the IP address of the netbooted machine</comment>
834...
835</pre>
836
837</body>
838</section>
839<section>
840<title>Netbooting Instructions</title>
841<body>
842
843<p>
844Netbooting itself is again very platform-specific. The important part is to
845specify the <c>ip=dhcp</c> and <c>init=/linuxrc</c> parameters on the kernel
846command line, as this will bring up the network interface and tell the initrd
847scripts to mount the Installation CD via NFS. Here are some platform-specific
848tips:
849</p>
850
851<pre caption="Netbooting Instructions">
852<comment># Etherboot - insert the etherboot disk into the drive and reboot
853# The kernel command line was specified when the image was constructed</comment>
854
855<comment># Sparc64 - Hit Stop-A at the boot prompt</comment>
856ok boot net ip=dhcp init=/linuxrc
857
858<comment># PXE - Setup pxelinux (part of syslinux),
859then create a pxelinux.cfg/default along the lines of:</comment>
860
861DEFAULT gentoo
862TIMEOUT 40
863PROMPT 1
864
865LABEL gentoo
866 KERNEL kernel-X.Y.Z
867 APPEND initrd=initrd-X.Y.Z root=/dev/ram0 init=/linuxrc ip=dhcp
868</pre>
869
870</body>
871</section>
872</chapter>
873
874<chapter>
875<title>Conclusion</title>
876<section>
877<title>To Automate or not to Automate?</title>
878<body>
879
880<p>
881The purpose of genkernel is to provide an (easier) alternative to the
882time-tested approach to kernel compilation. As always, you are free to decide
883on whether or not you want to automate the kernel compilation process.
884</p>
464 885
465</body> 886</body>
466</section> 887</section>
467</chapter> 888</chapter>
468</guide> 889</guide>

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.36

  ViewVC Help
Powered by ViewVC 1.1.20