Typo
[linux_from_scratch_hints.git] / OLD / kernel-2_6-migration.txt
blob374e5e7d1985708fb90310e0b1f399326cd633a6
1 AUTHOR:         Kris van Rens <krisvanrens AT gmail DOT com>
3 DATE:           2005-05-09
5 LICENSE:        GPL
7 SYNOPSIS:       Guideline for migrating from the 2.4.x to the 2.6.x kernel
9 DESCRIPTION:
11 After a series of 11 test versions, the stable release of the linux-2.6 kernel
12 came out (linux-2.6.0), on December the 18th 2003. I was working with the 
13 2.6.0test kernel a few months already for school (for the curious among you; I
14 learned how to design kernel driver modules). I noticed a few people on the
15 mailing-list having trouble installing the kernel, that's what made me write
16 this hint.
18 As I write this, it's the 25th of February 2005, I guess just about every
19 distro around brings kernel-2.6.x as it's default kernel and it seems to be
20 accepted more or less. But, there are still people not convinced of the
21 stability and performance of the 2.6 kernel, or for maximum stability they
22 waited until the kernel was 'mature'.
24 So, if you're one of the people wanting to install the 2.6.x kernel, you
25 should probably take a look at this hint for a few tips to bring it to a
26 successful end. Of course this new kernel does not have to be better for you,
27 but hey, you can always fall back to the 2.4 kernel and wait a while before 
28 you'll try it again. After all, maintainance is still carried out on the 
29 kernel-2.4 branch (at the time being).
31 Note that there is a (way more readable) .html version of this hint
32 available, check the links at the bottom.
35 PREREQUISITES:
37 Before working through this hint, be sure to have the following:
39 *** module-init-tools sources tarball
40 Get this from ftp://ftp.kernel.org/pub/linux/utils/kernel/module-init-tools.
42 *** linux-2.6.x kernel sources tarball
43 Get this from http://www.kernel.org or a mirror.
45 At the time of writing the latest stable version of the module-init-tools
46 is 3.1 and for the kernel it is 2.6.11.5 (they added the build number), I'll
47 use these version names for this hint, if you have a newer version, replace
48 the version in this hint with it.
50 Of course, you should also have Make, GCC and an Assembler, but this hint is
51 meant for the LFS-community so I'll assume you fulfill these requirements.
53 You might also want to fulfill the recommendations of the kernel development
54 team and use GCC-2.95.3 for kernel compilation, you can download it here:
56 ftp://ftp.gnu.org/gnu/gcc/gcc-2.95.3.tar.gz or from a mirror.
58 NOTE:   Since LFS-6.0 you'll need GCC-3.x (for NPTL and others), and GCC-2.95
59                 isn't even on the package list. Only for strict reasons I left
60                 it in this hint. I suggest you to use GCC-3.x.
62 Read the /usr/src/linux-2.6.7/Documentation/Changes document for other programs
63 you'll eventually need to update. For LFS-5.0 you should for example also
64 update procps.
67 HINT:
69 So, you want to migrate from linux-2.4.x to linux-2.6.x? Well no problem!
70 Quite a lot changed since 2.4, both the SMP (Symmetric Multi Processing,
71 multiple processor cores) and the uniprocessor performance increased,
72 compatibility with hardware is better and new security-modules increase
73 the security (...).
75 Being the owner of a LFS system, I'll assume you're familiar with the usual way
76 of installing a source package, and a kernel of course.
78 I cut this hint section in two; installing the new module-init-tools and
79 installing the kernel.
81 NOTE:   If you have a winmodem or you want to be sure that you don't have to
82                 undertake special steps, take a look at the EXCEPTIONS area.
83                 It's always a good idea to take a look there.
85 ***STEP 1: Installing the module-init-tools
87 To migrate from kernel 2.4 to 2.6 you'll need a new module loading system, the
88 system has been worked over completely. 
90 As you like, move the tarball into the directory from where you'll install it,
91 for me that's /usr/src, and cd' into it.
93 Unpack the sources and cd' into the source's directory. 
95 tar xzf module-init-tools-3.1.tar.bz2
96 cd module-init-tools-3.1
98 Then configure the package by:
100 ./configure --prefix=/
102 We use prefix=/ here because in the LFS-Book (prior to LFS-6.0) modutils
103 is installed with the same prefix and the last thing we want is having two
104 different versions of one program in multiple places.
106 If this is the first time you install the module-init-tools, invoke the next
107 command, otherwise, if you're upgrading to a new version of
108 module-init-tools, skip it (LFS versions up to LFS-5.0 come with modutils
109 and do not have module-init-tools, so you'll have to invoke the command).
111 make moveold
113 This renames the modutils such as insmod,rmmod or modprobe to insmod.old,
114 rmmod.old and modprobe.old. The new to be installed module-init-tools do a
115 runtime check of which kernel is running and invoke the right version of
116 the tools, for example if 2.4.x is running the insmod command will use
117 insmod.old instead.
119 Then make the package and install it with:
121 make
122 make install
124 The last thing you'll have to do is to generate a new configuration file for
125 the modules:
127 ./generate-modprobe.conf /etc/modprobe.conf
129 If you're using the device-file system also copy the modprobe.devfs file into
130 /etc.
132 If everything went fine, you have the new module-init-tools and you're ready to
133 install the new kernel!
135 ***STEP 2: Installing the 2.6.x kernel
137 Copy the linux-2.6.11.5 tarball to /usr/src and cd' into this directory.
139 As usual, unpack the sources and cd' into the sources directory:
141 tar xjf linux-2.6.11.5.tar.bz2
142 cd linux-2.6.11.5
144 If you want to install the kernel version tarball without patching, you can
145 skip the tabulated field down here, read it if you want to patch the kernel.
146         
147         If you want to install the kernel with patches, say you have
148         linux-2.6.0test9 and you want to install linux-2.6.0, you'll need the 
149         patches linux-2.6.0test10.patch, linux-2.6.0test11.patch and
150         linux-2.6.0.patch.
151         
152         Now go to the root of the kernel source tree and patch the kernel in the
153         correct order (cumulative patching). Adapt the patch name for your
154         situation:
155         
156         patch -p1 < ../linux-2.6.0test10.patch
157         patch -p1 < ../linux-2.6.0test11.patch
158         patch -p1 < ../linux-2.6.0.patch
159         
160         Read the 'README' file in the root of the kernel source tree for more info
161         on how to patch a kernel.
163 Before we will configure and install the new kernel; we'll clean up the source
164 tree to make sure it's sane. Even if you downloaded the tarball just a minute
165 ago and didn't even touch it all, it's recommended to clean it up before a 
166 build. There are two ways to do it; you can use 'make clean' and
167 'make mrproper'. With the first command all the files produced during
168 compilation time will be removed, and with the latter even the configuration of
169 the kernel will be lost. You can use 'make mrproper' the first time you use a
170 kernel tree and then later on 'make clean'. I personally always use
171 'make mrproper' as I back up my kernel configuration elsewhere.
173 As this will probably be your first compilation of this kernel; invoke the
174 following command:
176 make mrproper
177         
178 Now configure the kernel, this is just like with the 2.4 kernel, you can choose
179 from menuconfig, xconfig and gconfig. Menuconfig is based on Ncurses, xconfig
180 is based on QT and gconfig is based on GTK+, for the last two, you'll need  an
181 X-server running. Do so by:
183 make menuconfig
187 make xconfig
191 make gconfig
193 Personally I (and the majority of linux users) like menuconfig the most.
195 Now comes the most time-consuming and difficult part, the configuration itself.
196 As far as I know, you cannot use the kernel-2.4 configuration file. So you'll
197 have to do it all from the start, which is better anyway, because a lot changed
198 in the structure of the menu and there are loads of new options in it.
200 Be sure to take the right system architecture in >>processor-type and features<<
201 and the right file system. If you don't know whether you should involve a
202 certain option or not, press ? or help; there's info about almost every option.
203 If you still don't know; first search, then ask the community.
205 I strongly recommend to save the kernel-configuration in a place other than the
206 kernel source tree. If you do a 'make mrproper', the .config file (the
207 automatically saved kernel configuration in the source tree) will be deleted and
208 all your settings are gone. Especially in the beginning you'll probably need to
209 recompile the kernel multiple times, so backing up is a good habit. I always
210 save my kernel configuration to /etc/kernel-2.x.config (replace the 'x' with the
211 current minor version of the kernel). Note that you keep the 2.4 and 2.6 kernel
212 configurations separated.
214 If you're done, you are set to compile the kernel.
216 The kernel development team recommends you to build the kernel with GCC-2.95.3
217 it is not a must, but stability is not guaranteed if you deviate from this
218 version. As already stated I kept GCC-2.95 in this hint for strict reasons. I
219 tried both GCC-3.x and GCC-2.95.3, they both worked fine for me, allthough I
220 suggest you using GCC-3.x. You can choose which compiler to use if you change
221 the CC flag for make.
223 To make the kernel with your global GCC version, which is GCC-3.3.1 for
224 LFS-5.0, do:
226 make all
228 To make the kernel with GCC-2.95.3 (situated in /opt/gcc-2.95.3 according to
229 the LFS-book) do:
231 make CC=/opt/gcc-2.95.3/bin/gcc all
233 This can take quite a while, on my Pentium 4 2.0GHz with 256MB RAM, it took
234 about 11 minutes, which is not strange because the kernel code can be around 5
235 million lines of code! You can time your build with >>time make all<<
236 respectively >>time make CC=/bin/gcc-2.95.3/bin/gcc all<< instead.
238 We are now going to install the modules, you don't have to use the CC flag
239 anymore, since the modules were compiled at the end of 'make all', you must
240 install them with:
242 make modules_install
244 This copies the modules (.ko files) with some configuration files into the
245 /lib/modules/<kernel-version> directory where the module loaders can find
246 them.
248 Now copy the kernel to /boot:
250 cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.11.5
252 Or to another filename as you want.
254 Versioning is supported on 'System.map', you'll have to copy this file to
255 your /boot directory. Before you do so, consider keeping the 2.4-System.map;
256 you can rename it to 'System.map-2.4' (for kernel-2.4.x of course) and the
257 new 2.6 one to 'System.map-2.6' so that each kernel version gets it's own.
259 Now modify your lilo.conf (for lilo) or menu.lst (for grub) to be able to load
260 the new kernel, if you have lilo, don't forget to invoke /sbin/lilo and re-
261 write the boot-record.
263 You should look at the EXCEPTIONS field, you might have to do some additional
264 work to get your kernel function properly.
266 If everything is done, you can reboot and start with the new kernel.
268 If there were problems during booting, check the TROUBLESHOOTING section, 
269 otherwise, congratulations with your shiny new 2.6 kernel!
272 TROUBLESHOOTING:
274 If any errors occur during booting, read the error-output carefully and
275 eventually reconfigure the kernel. Here are listed a few common problems and
276 some possible answers. You should also check the EXCEPTIONS section.
278 ---Your screen is black during booting
279 This has probably something to do with the framebuffer device, try vga=normal
280 in your bootloader configuration, and check if 'CONFIG_VT' is set to 'y' in
281 your .config (kernel configuration) file.
283 ---The module loading system complains about wrong module versions
284 You probably forgot to run >>make modules_install<< make sure that the
285 modules on which you run >>make modules_install<< are compiled with the same
286 version of GCC as the kernel itself.
288 If the problem is really stubborn and you can't get it away, google for it,
289 read the mailing-list archives or ask a new question there.
292 EXCEPTIONS:
294 ***WinModem drivers for the 2.6 kernel:
296 Lucent Technologies provides a driver for WinModems, you can get it here:
298 http://linmodems.technion.ac.il/packages/ltmodem/kernel-2.6
301 OTHER DOCUMENTS ABOUT THIS SUBJECT:
303 ---The HTML version of this hint! (much more readable):
304 http://www.stack.nl/~kris
306 ---The post-halloween document from Dave Jones:
307 http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt
309 Or if this doesn't work:
311 http://www.linux.org.uk/~davej/docs/post-halloween-2.6.txt
313 ---The German translation of post-halloween:
314 http://www.kubieziel.de/computer/halloween-german.html
316 ---Another migration hint:
317 http://thomer.com/linux/migrate-to-2.6.html
320 ACKNOWLEDGMENTS:
322 Professor Dr. Juergen Quade from the Niederrhein University for printing me
323         out the preliminary version of the 'Meister-Installateur' article for
324         the Linux Magazin.
326 The BLFS-Support mailing-list and its members, for pointing me at weak spots
327         in the hint. Thanks!
330 CHANGELOG:
332         [2003-12-19]
333                 First version 1.0
334         [2003-12-20]
335                 Version 1.1
336                 *Changed DATE format to intl.
337                 *Structural fixes + some typos; thanks Matthew!
338                 *Added the EXCEPTIONS field; thanks Alexander!
339         [2003-12-20]
340                 Version 1.2
341                 *Added gcc-2.95 into kernel build
342                 *Added new url
343                 *Made the hint idiot proof ;-) thanks to Declan!
344         [2003-12-21]
345                 Version 1.3
346                 *Added new url
347                 *Added kernel patching
348                 *Added System.map stuff
349                 *Added the TROUBLESHOOTING section
350                 *Added/changed several comments in all sections.
351         [2003-12-21]
352                 Version 1.4
353                 *Fixed a few typos
354         [2003-12-22]
355                 Version 1.5
356                 *Changed a few sentences and corrected some typos
357                 *Added a reference to the HTML version on my website
358         [2003-12-28]
359                 Version 1.6
360                 *Fixed a few typos
361         [2004-06-04]
362                 Version 1.7
363                 *Since NVidia now supports Kernel-2.6; I deleted the exceptions
364                         Thanks to Alexander C. Gaber for the tip.
365                 *Few more minor changes
366         [2004-07-16]
367                 Version 1.8
368                 *Upgraded to Linux-2.6.7 and module-init-tools-3.0
369                 *Changed some text
370                 *Added 'make mrproper' and 'make clean' to kernel installing commands
371                 *Added backing up of kernel configuration
372                 *Added note about requirement GCC-3.0 for incoming LFS-6.0
373         [2004-07-22]
374                 Version 1.9
375                 *Fixed a typo - Thanks David!
376         [2005-03-25]
377                 Version 2.0
378                 *Changed the hint to be a 'final' version
379                         +Fixed some typos
380                         +Upgraded versions used
381                         +Changed a few URL's
382         [2005-04-13]
383                 Version 2.1
384                 *Fixed a few typos - Thanks Jorik!
385         [2005-05-08]
386                 Version 2.2
387                 *Changed my website address
388                 *Stopped maintaining the hint