Chapter 6.
Installing and Booting From a Kernel
Previous chapters showed you how to download and build your
kernel. Now that you have an executable file -- along with any
modules you built -- it is time to install the kernel and
attempt to boot it. In this chapter, unlike earlier ones, all of the
commands need to be run as the root user. This can be done by
prefixing each command with
sudo
, by using the
su
command to become
root
, or actually by logging
in as
root
.
To see if you have
sudo
installed and the proper access
set up, do the following:
$
sudo ls ~/linux/linux-2.6.17.11/Makefile
Password:
Makefile
Enter either your own password at the password prompt, or the password of
the system administrator (root). The choice depends on how the
sudo
command is set up. If
this is successful, and you see the line containing:
Makefile
then you can skip to the next section.
If
sudo
is not installed or giving you the proper
rights, then try using the
su
command:
$
su
Password:
#
exit
exit
$
At the password prompt, enter the password of the system administrator
(
root
). When the
su
program successfully accepts the
password, you are transferred to running everything with full root
privileges. Be very careful while as
root
, and do only the minimum needed; then exit the program to continue back as your normal user account.
Using a Distribution's Installation Scripts
Almost all distributions come with a script called
installkernel
that can be used by the kernel build
system to automatically install a built kernel into the proper location and
modify the bootloader so that nothing extra needs to be done by the
developer.
[6]
Note
Distributions that offer
installkernel
usually put it in a
package called mkinitrd, so try install that package if you
cannot find the script on your machine.
If you have built any modules and want to use use this method to install a kernel, first enter:
#
make modules_install
This will install all the modules that you have built and place them in
the proper location in the filesystem for the new kernel to properly find.
Modules are placed in the /lib/modules/
KERNEL_VERSION
directory, where
KERNEL_VERSION
is the kernel version of
the new kernel you have just built.
After the modules have been successfully installed, the main kernel image
must be installed:
#
make install
This will kick off the following process:
-
The kernel build system will verify that the kernel has been successfully
built properly.
-
The build system will install the static kernel portion into the /boot
directory and name this executable file based on the kernel version of the built kernel.
-
Any needed initial ramdisk images will be automatically created, using the
modules that have just been installed during the
modules_install phase.
-
The bootloader program will be properly notified that a new kernel is
present, and it will be added to the appropriate menu so the user can
select it the
next the machine is booted.
After this is finished, the kernel is successfully installed, and you can
safely reboot and try out your new kernel image. Note that this
installation does not overwrite any older kernel images, so if there is a
problem with your new kernel image, the old kernel can be selected at boot
time.