Feeds:
Posts
Comments

Posts Tagged ‘‘New Kernel’’

If you are in a situation that require -for example- install a Linux System like a server or install it in a small device, you may need to modify the kernel and recompile it with the objective of take out some capabilities and reduce its size of it or give the priority of some services and avoid to install things that just would make use of resources unnecessarily.

For this practice Fedora 9 system was installed in a second hard drive and worked with it.

I will describe in the next lines the steps that I followed to build a new Kernel, this is a general view about the whole process.

After install Fedora 9 in the second drive, restart the computer (make the cd come out before the starting process begin)…

When the screen shows a descending counting, press the space bar and when a list be shown just type the letter ā€œcā€, doing that will let us go to the command line, specifically to the “grub” menu.

So, in the grub menu, select first the disc and partition and fill the next lines as follows:
grub> root (hd1,0)
grub> kernel /vmlinuz…
(tab for auto complete)
grub> initrd /initrd-2… (tab for auto complete)
grub> boot (enter)

After rebooting, go trough the wizard…

Next thing is download the latest version of the kernel (I did it from the Kernel.org site.)

Is coming in a compressed file, so, it should be unzipped (example: # tar xvjf linux-2.6.27.7.tar.bz2).

Install by the command line kernel-devel (source code, c programs), kernel-headers (kernel headers files, from c libraries) and Development Tools (Compilers, makefiles, interpreters):
# yum install kernel-devel
# yum install kernel-headers
# yum groupinstall ‘Development Tools’

Go inside to the directory which was previously unzipped, there is a makefile in there, but we need create a new one with a correct “.config” file (that file gathers the modules information).

Should be in /usr/src/kernels/2.6.27… (something like this), is a hidden file so, list the directory using the -a option to the ls command (ls -a).

Now in the command line type this command (we should do this like regular user):
# make oldconfig (enter)
in my case this error came up:
/bin/sh: gcc: command not found

that means I needed to install gcc (GNU C compiler), that is done by running this:
# yum install gcc

again run the command “make oldconfig”

Some information from man about make command:
“To prepare to use make, you must write a file called the makefile that
describes the relationships among files in your program, and the states
the commands for updating each file. In a program, typically the exe-
cutable file is updated from object files, which are in turn made by
compiling source files.

Once a suitable makefile exists, each time you change some source
files, this simple shell command:

make

suffices to perform all necessary recompilations. The make program
uses the makefile data base and the last-modification times of the
files to decide which of the files need to be updated. For each of
those files, it issues the commands recorded in the data base.”

As says in man, just run:
# make

After that, is necessary to find and copy the Kernel Image file (bzImage) and the System.map file in /boot (the bzImage should be in a path like this: /home/HomeUser/linux-2.6.27.7/arch/x86_64)

In the directory which the makefile is, run the command:
# make modules_install

It will install all the modules (or should be) in: /lib/modules/’kernel version’, in the screen you just will see something like this:make-modules_install-screen

To finalize we need to run this command:
# mkinitrd initrd-2.6.27.7 2.6.27.7 (you can choose another name I just used the number of release and version).

Reboot the machine and trough the Grub menu, try to boot with the new kernel (the one that has the name just 2.6.27.7).

Advertisements

Read Full Post »