1 |
swift |
1.1 |
<?xml version='1.0' encoding="UTF-8"?> |
2 |
|
|
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
3 |
|
|
|
4 |
|
|
<guide link="/doc/en/xml-guide.xml"> |
5 |
|
|
<title>Gentoo Linux Genkernel Guide</title> |
6 |
|
|
|
7 |
|
|
<author title="Author"> |
8 |
|
|
<mail link="plasmaroo@gentoo.org">Tim Yamin</mail> |
9 |
|
|
</author> |
10 |
|
|
|
11 |
|
|
<abstract> |
12 |
|
|
This guide intends to provide a reference of all the functions |
13 |
|
|
provided by Genkernel. |
14 |
|
|
</abstract> |
15 |
|
|
|
16 |
|
|
<version>1.0</version> |
17 |
|
|
<date>February 15, 2003</date> |
18 |
|
|
|
19 |
|
|
<chapter> |
20 |
|
|
<title>Introduction</title> |
21 |
|
|
<section> |
22 |
|
|
<title>Introduction</title> |
23 |
|
|
<body> |
24 |
|
|
|
25 |
|
|
<p> |
26 |
|
|
Genkernel is designed to allow users who are not previously used to |
27 |
|
|
compiling a kernel to use a similar setup to that one that is used on |
28 |
|
|
the Gentoo LiveCDs which auto-detects your hardware. |
29 |
|
|
</p> |
30 |
|
|
|
31 |
|
|
<p> |
32 |
|
|
Some users may also be interested in using genkernel for hardware |
33 |
|
|
which requires initialization and a working kernel before it can be |
34 |
|
|
booted. Because genkernel also automatically compiles your kernel modules, |
35 |
|
|
thus allowing hardware which needs to be loaded with module parameters |
36 |
|
|
to be used. |
37 |
|
|
</p> |
38 |
|
|
|
39 |
|
|
</body> |
40 |
|
|
</section> |
41 |
|
|
<section> |
42 |
|
|
<title>Is genkernel for me?</title> |
43 |
|
|
<body> |
44 |
|
|
|
45 |
|
|
<p> |
46 |
|
|
Genkernel is often a good choice to those who are unused to compiling |
47 |
|
|
their own kernel or those who are not certain about their hardware |
48 |
|
|
configurations. |
49 |
|
|
</p> |
50 |
|
|
|
51 |
|
|
<p> |
52 |
|
|
Because genkernel is designed to use a generic configuration, it |
53 |
|
|
should be able to support all of your hardware - however, because all |
54 |
|
|
the drivers and modules have to be compiled as well, compiling a |
55 |
|
|
kernel by yourself is often much faster provided you know what you need. |
56 |
|
|
</p> |
57 |
|
|
|
58 |
|
|
<p> |
59 |
|
|
Genkernel does not however, currently support booting the sytem from |
60 |
|
|
LVM2/EVMS2 partitions. Users are recommended to use a manually compiled |
61 |
|
|
kernel for the time being. |
62 |
|
|
</p> |
63 |
|
|
|
64 |
|
|
</body> |
65 |
|
|
</section> |
66 |
|
|
<section> |
67 |
|
|
<title>Getting genkernel</title> |
68 |
|
|
<body> |
69 |
|
|
|
70 |
|
|
<p> |
71 |
|
|
You can obtain genkernel by simply running <c>emerge genkernel</c>. Don't |
72 |
|
|
forget to use the <c>-k</c> flag for emerge if you are using binary packages, |
73 |
|
|
i.e. GRP. Due to the GRP packages having an older version of genkernel, the |
74 |
|
|
flags are different. As a result, you should consult the <uri |
75 |
|
|
link="http://www.gentoo.org/doc/en/handbook/handbook.xml?part=1&chap=9"> |
76 |
|
|
Gentoo Handbook</uri> and <path>genkernel --help</path>. |
77 |
|
|
</p> |
78 |
|
|
|
79 |
|
|
</body> |
80 |
|
|
</section> |
81 |
|
|
<section> |
82 |
|
|
<title>Supported platforms</title> |
83 |
|
|
<body> |
84 |
|
|
|
85 |
|
|
<p> |
86 |
|
|
As of genkernel 3.0.1_beta12; the following platforms should be |
87 |
|
|
supported: alpha, amd64, parisc, parisc64, ppc, sparc, sparc64, and x86. If |
88 |
|
|
you believe that there is a bug with the support code, and not with |
89 |
|
|
genkernel, please file a bug at the <uri |
90 |
|
|
link="http://bugs.gentoo.org">Gentoo Bugzilla.</uri> |
91 |
|
|
</p> |
92 |
|
|
|
93 |
|
|
</body> |
94 |
|
|
</section> |
95 |
|
|
</chapter> |
96 |
|
|
|
97 |
|
|
<chapter> |
98 |
|
|
<title>Genkernel usage</title> |
99 |
|
|
<section> |
100 |
|
|
<title>Introduction</title> |
101 |
|
|
<body> |
102 |
|
|
|
103 |
|
|
<p> |
104 |
|
|
Genkernel 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> |
114 |
|
|
Most users will only want the "all" mode, which runs the "kernel" mode |
115 |
|
|
and the "initrd" mode for you. <b>Note</b> that the "kernel" and "initrd" |
116 |
|
|
modes are currently just aliases for the "all" mode, so they will |
117 |
|
|
currently give you no special effect. |
118 |
|
|
</p> |
119 |
|
|
|
120 |
|
|
<p> |
121 |
|
|
Although genkernel is mainly a command to make your life easier when |
122 |
|
|
you need to compile a kernel, genkernel is also packed full of |
123 |
|
|
different flags which allow you to customize how your kernel is |
124 |
|
|
compiled or configured. |
125 |
|
|
</p> |
126 |
|
|
|
127 |
|
|
</body> |
128 |
|
|
</section> |
129 |
|
|
<section> |
130 |
|
|
<title>Genkernel compiler flags</title> |
131 |
|
|
<body> |
132 |
|
|
|
133 |
|
|
<p> |
134 |
|
|
Genkernel supports the following flags which are passed to the |
135 |
|
|
relevant 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> |
185 |
|
|
<section> |
186 |
|
|
<title>Genkernel kernel flags</title> |
187 |
|
|
<body> |
188 |
|
|
|
189 |
|
|
<p> |
190 |
|
|
Genkernel supports the following flags, some of which have |
191 |
|
|
<c>--<b>no-</b>option</c> equivalents that influence |
192 |
|
|
kernel compilation: |
193 |
|
|
</p> |
194 |
|
|
|
195 |
|
|
<ul> |
196 |
|
|
<li> |
197 |
|
|
<b>--clean</b>: This runs a <c>make clean</c> before compiling your |
198 |
|
|
kernel. This causes all object files and dependencies to be removed. |
199 |
|
|
</li> |
200 |
|
|
<li> |
201 |
|
|
<b>--mrproper</b>: This runs a <c>make mrproper</c> before compiling your |
202 |
|
|
kernel. This causes all object files, dependencies <e>and your |
203 |
|
|
configuration</e> to be removed. |
204 |
|
|
</li> |
205 |
|
|
</ul> |
206 |
|
|
|
207 |
|
|
<ul> |
208 |
|
|
<li> |
209 |
|
|
<b>--kerneldir=<path>/path/to/sources</path></b>: This specifies an |
210 |
|
|
alternative kernel source location, instead of the default location of |
211 |
|
|
<path>/usr/src/linux</path>. |
212 |
|
|
</li> |
213 |
|
|
<li> |
214 |
|
|
<b>--kernel-config=<path>/path/to/config-file</path></b>: This specifies an |
215 |
|
|
alternative kernel configuration which would be used; rather than the |
216 |
|
|
inpersistant <path>/path/to/sources/.config</path> which is used by |
217 |
|
|
default. |
218 |
|
|
</li> |
219 |
|
|
</ul> |
220 |
|
|
|
221 |
|
|
<ul> |
222 |
|
|
<li> |
223 |
|
|
<b>--<c>no-</c>bootsplash</b>: This adds <e>or does not add</e> bootsplash |
224 |
|
|
support in the initrd which genkernel builds. Not all architectures |
225 |
|
|
currently support bootsplash, and a kernel that supports bootsplash is |
226 |
|
|
also required. |
227 |
|
|
</li> |
228 |
|
|
<li> |
229 |
|
|
<b>--<c>no-</c>menuconfig</b>: This runs <e>or does not run</e> the kernel |
230 |
|
|
menu-based configurator before building your kernel, after <c>make |
231 |
|
|
oldconfig</c> has ran. |
232 |
|
|
</li> |
233 |
|
|
</ul> |
234 |
|
|
|
235 |
|
|
<ul> |
236 |
|
|
<li> |
237 |
|
|
<b>--no-initrdmodules</b>: This doesn't copy any modules to the initrd |
238 |
|
|
which genkernel creates. |
239 |
|
|
</li> |
240 |
|
|
<li> |
241 |
|
|
<b>--<i>no-</i>install</b>: This installs <e>or does not install</e> your |
242 |
|
|
kernel, modules, and initrd one the compilation has finished. |
243 |
|
|
</li> |
244 |
|
|
</ul> |
245 |
|
|
|
246 |
|
|
</body> |
247 |
|
|
</section> |
248 |
|
|
<section> |
249 |
|
|
<title>Genkernel miscellaenous flags</title> |
250 |
|
|
<body> |
251 |
|
|
|
252 |
|
|
<p> |
253 |
|
|
Genkernel also supports some miscellaneous flags which do not fit into |
254 |
|
|
the other two categories: |
255 |
|
|
</p> |
256 |
|
|
|
257 |
|
|
<ul> |
258 |
|
|
<li> |
259 |
|
|
<b>--arch-override=<c>someArch</c></b>: This flag can be used to override |
260 |
|
|
what architecture genkernel thinks you're on, if the auto-detection |
261 |
|
|
mechanism fails (please file a bug if it does!) or if you wish to |
262 |
|
|
cross-compile a kernel. |
263 |
|
|
</li> |
264 |
|
|
</ul> |
265 |
|
|
|
266 |
|
|
<ul> |
267 |
|
|
<li> |
268 |
|
|
<b>--busybox-config=<path>/path/to/busybox-config</path></b>: This |
269 |
|
|
overrides the default busybox configuration with the specifid file |
270 |
|
|
</li> |
271 |
|
|
<li> |
272 |
|
|
<b>--busybox-bin=<path>/path/to/busybox-binary.tar.bz2</path></b>: Using |
273 |
|
|
this option means that a busybox binary would not be compiled, and the |
274 |
|
|
specified tarball would be used. Note that busybox <e>must</e> be compiled |
275 |
|
|
statically! |
276 |
|
|
</li> |
277 |
|
|
</ul> |
278 |
|
|
|
279 |
|
|
<ul> |
280 |
|
|
<li> |
281 |
|
|
<b>--minkernpackage=<path>/output/to/yourkernel.tar.bz2</path></b>: This |
282 |
|
|
flag outputs a tarball of the kernel, named as <path>kernel</path> and the |
283 |
|
|
initrd named as <path>initrd</path> to the specified file. No path |
284 |
|
|
information or modules will be includes in the tarball. |
285 |
|
|
</li> |
286 |
|
|
</ul> |
287 |
|
|
|
288 |
|
|
</body> |
289 |
|
|
</section> |
290 |
|
|
<section> |
291 |
|
|
<title>Running genkernel</title> |
292 |
|
|
<body> |
293 |
|
|
|
294 |
|
|
<p> |
295 |
|
|
All that is needed to run genkernel is just genkernel with the |
296 |
|
|
necessary flags as root. For example: |
297 |
|
|
</p> |
298 |
|
|
|
299 |
|
|
<pre caption="Running genkernel"> |
300 |
|
|
# genkernel --menuconfig --no-clean --no-install --bootsplash |
301 |
|
|
<comment>(Would produce a kernel, asking you what how to configure it |
302 |
|
|
to your desire, leaving alone any compiled object files, enabling |
303 |
|
|
bootsplash support but not installing anything.)</comment> |
304 |
|
|
</pre> |
305 |
|
|
|
306 |
|
|
<p> |
307 |
|
|
If you want genkernel to install your kernel as well, you must ensure |
308 |
|
|
that your <path>/boot</path> partition is mounted: |
309 |
|
|
</p> |
310 |
|
|
|
311 |
|
|
<pre caption="Mounting your /boot"> |
312 |
|
|
<comment>(If /boot is a valid entry in /etc/fstab:)</comment> |
313 |
|
|
# mount /boot |
314 |
|
|
<comment>(... otherwise for IDE disks:)</comment> |
315 |
|
|
# mount /dev/hda1 /boot |
316 |
|
|
<comment>(... and for SCSI disks:)</comment> |
317 |
|
|
# mount /dev/sda1 /boot |
318 |
|
|
</pre> |
319 |
|
|
|
320 |
|
|
</body> |
321 |
|
|
</section> |
322 |
|
|
<section> |
323 |
|
|
<title>Setting up genkernel to work with your bootloader</title> |
324 |
|
|
<body> |
325 |
|
|
|
326 |
|
|
<p> |
327 |
|
|
To set up genkernel to work with your bootloader, three or four changes are |
328 |
|
|
required to your bootloader configuration. |
329 |
|
|
</p> |
330 |
|
|
|
331 |
|
|
<ol> |
332 |
|
|
<li> |
333 |
|
|
Add <c>root=/dev/ram0</c> and <c>init=/linuxrc</c> to the |
334 |
|
|
kernel parameters passed to the kernel image. |
335 |
|
|
</li> |
336 |
|
|
<li> |
337 |
|
|
Add <c>real_root=/dev/hda3</c>, for example, to the kernel parameters |
338 |
|
|
passed to the kernel image if <path>/dev/hda3</path> contains your root |
339 |
|
|
partition. |
340 |
|
|
</li> |
341 |
|
|
<li> |
342 |
|
|
If you are using bootsplash, add a suitable modeline such as |
343 |
|
|
<c>vga=0x317</c> to the parameters passed to the kernel and also add |
344 |
|
|
<c>splash=verbose</c> or <c>splash=silent</c> depending on the verboseness |
345 |
|
|
you require from your bootsplash. |
346 |
|
|
</li> |
347 |
|
|
<li> |
348 |
|
|
Add the initrd according to how your bootloader requires it: see the <uri |
349 |
|
|
link="http://www.gentoo.org/doc/en/handbook/handbook.xml?part=1&chap=9">Gentoo |
350 |
|
|
Handbook</uri> for details on how you would do it for your bootloader. |
351 |
|
|
</li> |
352 |
|
|
</ol> |
353 |
|
|
|
354 |
|
|
</body> |
355 |
|
|
</section> |
356 |
|
|
</chapter> |
357 |
|
|
|
358 |
|
|
<chapter> |
359 |
|
|
<title>Porting genkernel</title> |
360 |
|
|
<section> |
361 |
|
|
<title>Introduction</title> |
362 |
|
|
<body> |
363 |
|
|
|
364 |
|
|
<p> |
365 |
|
|
Provided your architecture has all the required libraries and utilties |
366 |
|
|
which genkernel requires, which includes but it not limited to a |
367 |
|
|
working kernel for your architecture, working compiler suite, GNU |
368 |
|
|
Make, and a working busybox distribution, you're all set to go! |
369 |
|
|
</p> |
370 |
|
|
|
371 |
|
|
<p> |
372 |
|
|
For each architecture, genkernel uses |
373 |
|
|
<path>/usr/share/genkernel/archName</path> for configuration files for |
374 |
|
|
that architecture. |
375 |
|
|
</p> |
376 |
|
|
|
377 |
|
|
</body> |
378 |
|
|
</section> |
379 |
|
|
<section> |
380 |
|
|
<title>How the system bootstrapping works</title> |
381 |
|
|
<body> |
382 |
|
|
|
383 |
|
|
<ol> |
384 |
|
|
<li> |
385 |
|
|
The bootloader loads the genkernel image, built to the specification of the |
386 |
|
|
configuration files in the genkernel directories as well as the initrd |
387 |
|
|
which is prepared by genkernel. |
388 |
|
|
</li> |
389 |
|
|
<li> |
390 |
|
|
The kernel boots up, allocates a small amount of RAM in which busybox is |
391 |
|
|
initialized, which probes the system with the modules in the modules_load |
392 |
|
|
list for the architecture. |
393 |
|
|
</li> |
394 |
|
|
<li> |
395 |
|
|
Once done, and providing that the <c>real_root</c> parameter which is the |
396 |
|
|
root boot device as busybox sees things is found, the system is booted from |
397 |
|
|
the device. |
398 |
|
|
</li> |
399 |
|
|
</ol> |
400 |
|
|
|
401 |
|
|
</body> |
402 |
|
|
</section> |
403 |
|
|
<section> |
404 |
|
|
<title>The configuration files</title> |
405 |
|
|
<body> |
406 |
|
|
|
407 |
|
|
<ul> |
408 |
|
|
<li> |
409 |
|
|
<path>busy-config</path>: This is the configuration which is used to build |
410 |
|
|
busybox for your architecture. |
411 |
|
|
</li> |
412 |
|
|
<li> |
413 |
|
|
<path>config.sh</path>: This is a shell script which sets various internal |
414 |
|
|
genkernel variables. See one of the <path>config.sh</path> files for an |
415 |
|
|
example. |
416 |
|
|
</li> |
417 |
|
|
<li> |
418 |
|
|
<path>modules_load</path>: This is a file containing a space-delimited list |
419 |
|
|
of modules which are loaded for SCSI, FireWire, ATARAID and PCMCIA support. |
420 |
|
|
If none are available for your platform, leave the fields blank. See one of |
421 |
|
|
the <path>modules_load</path> files for an example. |
422 |
|
|
</li> |
423 |
|
|
</ul> |
424 |
|
|
|
425 |
|
|
<ul> |
426 |
|
|
<li> |
427 |
|
|
<path>kernel-config</path>: A default kernel configuration used for any |
428 |
|
|
kernel version. |
429 |
|
|
</li> |
430 |
|
|
<li> |
431 |
|
|
<path>kernel-config-2.4</path>: A default kernel configuration used for 2.4 |
432 |
|
|
series kernels. |
433 |
|
|
</li> |
434 |
|
|
<li> |
435 |
|
|
<path>kernel-config-2.6</path>: A default kernel configuration used for 2.6 |
436 |
|
|
series kernels. |
437 |
|
|
</li> |
438 |
|
|
</ul> |
439 |
|
|
|
440 |
|
|
</body> |
441 |
|
|
</section> |
442 |
|
|
</chapter> |
443 |
|
|
</guide> |