Re: Compiling new kernels4newbies. Consolidating different info from www

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 29, 2003 at 07:56:16PM +0100, dballester@kernpharma.com wrote:
> Hello:
>      I'had recomplied some kernels but I know that the internals of this
> proceses are very cryptic for me. I'm trying to read all I can in the www
> about kernel recompilation, but info available differs from site to site.
> Some people usually compiles with make <config-mode>, make dep, make
> bzImage, make modules, make modules_install and copy bzImage to boot. Some
> others seems to be more accurate and make mrproper first of all, make
> clean, depmod -a, etc...
>      With this info is not easy for me to learn the 'perfect' steps to
> recompile and install a new kernel. I've made a list with a merge from this
> sites to see  what's the best way. Your suggestions will be very, very,
> very, appreciated.
> 
>      1 Decompress linux sources tarball under /usr/src

Decompress linux sources wherever you like!
(I used to have linux source in my home directory)

>      2 Make a soft link /usr/src/linux that points to the decompressed tree.

No! It used to be done that way in ancient times and /usr/include/linux
was a link to /usr/src/linux/include/linux. But it turned out, that it
does not work! /usr/include/linux must include the headers libc was
compiled against and NOT those of current kernel. Thus they shell be
a copy and linux sources may be placed wherever you want

>      3 If any patch will be installed use patch -p1

Right.

>      4 make mrproper ( clean )

BEWARE HERE! When you patch a kernel from previous version, you usualy
want to keep the config and just check new options. Unfortunately make
mrproper removes .config, so your configuration would be lost. So you
have to backup your .config file using a name not matching .config*

Btw: make clean usualy works. If it does not, then do make mrproper.
(sometimes removing .depend and .hdepend files helps too)

>      5 Configure the kernel using make config, menuconfig or xconfig

For 2.5 there is kconfig instead of xconfig and it requires libQt :-(.

>      6 ( mine ) backup .config to another name ;)

Actualy you don't have to do this---until you want to make mrproper.

>      7 make dep ( to resolve dependencies )
>      8 make clean

You have done make mrproper above. You don't need to clean! You only
need to clean if you didn't do it before. And of course you don't need 

>      9 make bzImage

Right.

>      10 make modules ( here seems to be people saying that's good to rm -rf
> /lib/modules/<kernel-version> if we are recompiling )

Removing is not needed... modules compiled are replaced, not recompiled
modules remain, but noone should matter.

Before this step you need to become root. I got used to do everything up
to this point as normal user. It reduces the probability of disasterous
typo (note: I either have /usr/src writeable by adm group or compile in
my home).

>      11 make modules_install

Right.

>      12 depmod -a

Done by make modules_install

>      13 backup /boot original image, System.map an /etc/modules.conf or
> change  names and modify lilo or grub properly. ( Me : What happens with
> module-info ? )
>      14  Copy bzImage , System.map to /boot and modules.conf to /etc

IIRC there is no modules.conf in kernel sources! And: DON'T copy it if
you value your config! It's a config file for modprobe to be written by
the admin!

>      15 Modify lilo or grub to use new kernel

There is a target make install, that takes care of these three steps.
Actualy, it first looks for a script installkernel (/sbin/installkernel
by default) which is expected to take four arguments: <version> <zImage>
<System.map> <directory>. Linux distributions provide such a script.
There should be a default one in kernel sources. It will:

copy <directory>/vmlinuz and System.map to *.old
copy the new ones in <directory>/vmlinuz (bzImage) and System.map
run lilo if it is installed
do nothing if grub is installed as grub looks up the image in filesystem
ask you if you want to make a boot floppy if none of the above
tells you you need to set up a bootloader         -||-

>      16 Try to restart.

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@ucw.cz>
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux