Welcome to BYO Linux Portal  
Home · Contact · Discussion · Links · Sponsors 
 
 


 
 
BYO Linux



 
 


 
 
Making a New Kernel
Text VersionPrinter Friendly Version

Mount Linux1.

The first thing you should do is copy the /etc/lilo.conf file from linux1 over to linux2.

If you want to patch your kernel to update it to a new version, copy the patch(es) to the /usr/src directory. Type gzip -cd patchXX.gz | patch -p0 where XX is the rest of the name of the patch file. You must patch in the proper order. For example, if you are currently using kernel 2.2.14 and you notice that 2.2.16 is available, download 2 patches, number 15 and number 16 and apply them in the proper order. If you haven't guessed, this saves a whole lot of download time. If you already have the latest kernel, you can ignore this entire paragraph.

Now, goto the /usr/src/linux directory.

First, type make mrproper (This will remove any stale .o files and dependencies that are laying around)

Next, type make menuconfig

Choose the options you want setup. Pressing the space bar cycles through weather you want the feature compiled into the kernel, not used, or used as a module independent of the kernel. If you don't know what to do, use a ? for an explanation of the feature.

After you have finished and saved and are back at the prompt, do a make dep followed by a make clean followed by a make bzImage (and yes, that is a capital 'I' in bzImage)

After the kernel is finished compiling, remove or rename the old modules directory (un-necessary if this is your first kernel install). For example, if you have kernel 2.2.16 and just recompiled the kernel for your needs, remove or rename the /lib/modules/2.2.16 directory.

Next, do a make modules followed by a make modules_install

Next, go into the /usr/src/linux/arch/i386/boot directory and copy the bzImage file to the /boot directory. If you are using something other than the i386 architecture like a sparc, you substitute the proper directory for i386. Next, rename this bzImage file to whatever your kernel name is in /etc/lilo.conf (usually vmlinuz).

Next, go into the /usr/src/linux directory and copy the System.map file over to the /boot directory. Rename it to map if that is what you called it in your /etc/lilo.conf file.

Finally, type lilo -v at the prompt to update the bootloader.

Upon reboot, if linux should complain that the /etc/modules.conf file is newer than the /lib/modules/X.X.XX/modules.dep file, use vi to edit the modules.dep and add a space or a blank line and then save the file. This will cure the problem.

Lastly, let's install the sysklogd package. It's optional. This package logs all your systems kernel messages. I put it here because it won't install until the kernel has been compiled and lilo ran. Unpack it and type the following:
make
make install

Copy the syslog.conf from the packages directory to your /etc directory. Edit this file. Find a line in there that reads:

mail.=info /dev/tty12 and change it to read *.* /dev/tty12

This will enable you to see all system logs by pressing alt-F12 in a console

Next, create these two directories: /var/adm and /usr/adm

Use vi to create the /etc/init.d/syslog script. Add the following 2 lines to enable system logging:
syslogd -m 0
klogd

Save this file.

Next, type ln -s /etc/init.d/syslog /etc/rc2.d/S20syslog to make it start on bootup.
Finally, do a chmod 755 /etc/init.d/syslog to set the files permissions to make it exececutable.

Backups from this point on are at your option.