Using Linux:Managing the Kernel
-->
Previous
Table of Contents
Next
Building and Installing the Kernel
No matter which configuration tool you used to configure your kernel, now you must compile all the source files and produce the kernel itself. After building the kernel, and the modules for it, you need to create an initial ramdisk if your system is booting from a SCSI disk, and then re-run LILO, if youre using LILO to boot the system. If youre using LOADLIN, you must copy the kernel and the ramdisk file to a location from which LOADLIN can load the kernel.
Compiling the kernel and modules
1. Make sure youre in the Linux kernel directory. (Youre probably already there.)
2. Issue the make dep command. This command causes the make system to generate dependency files to facilitate the correct building of the kernel.
3. Issue the make clean command. make dep leaves a lot of files lying around that can prevent the make program from compiling some files, and this can cause problems.
4. Issue the make zImage command. Note that this command is case sensitive. make zImage builds the kernel file. If the build process stops with an error message, run make clean, make dep, and then make zImage again. Any remaining error is likely to be an error in the configuration from the make config or equivalent script. Rerun that script, and perhaps take out some of the experimental stuff.
5. If all went well, run the make modules command to compile the module files.
6. If the version of the kernel youre compiling is different from the kernel youre currently running, run the make modules_install command. (Note the underscore in this command.) make modules_install copies the modules into the correct tree in the /lib/modules directory tree. If you want to make backups of the modules you currently have, you can make a quick backup by issuing the following command:
tar czvf /root/modules-`uname -r`.tar.gz
b/modules/`uname -r`
This command assumes that youre going to install modules of the same kernel version that youre currently running.
Youre now ready to make your initial ramdisk. You must perform this step only if you are booting from a non-IDE block device (such as a SCSI hard disk or RAID array), are using modules for your SCSI block device driver, and have switched kernel versions.
Initial ramdisks and static (non-modular) device drivers
The default installation of Red Hat Linux does use modular device drivers for SCSI hard disks, and if you have compiled drivers specific to your SCSI hardware into your kernel you must make sure that you have either disabled initial ramdisk support in the kernel as well, or edited your /etc/lilo.conf file to remove the initial ramdisk entry; otherwise, your system attempts to load the drivers for your SCSI card twice. Because your system will not find a SCSI device the second time the driver is initialized, the boot system will stopthis is not what you want!
Creating an initial ramdisk with mkinitrd
1. Ensure that the /etc/conf.modules file on your system is set up correctly. (Chances are it is, especially if your SCSI system booted from your hard disk successfully.)
2. Make a backup of your current ramdisk. The file is located in the /boot directory, usually called either initrd or initrd-<kernel-version>, where <kernel-version> is the version number of the kernel it is compiled for. Since its probably a good idea to set up your system so that you can still boot the old kernel, rename the file to initrd.old.
3. Determine whether your system needs to preload the generic SCSI system support modules. Execute the command /sbin/lsmod to obtain a listing of the modules that your system currently has loaded. The generic SCSI modules are called sd_mod and scsi_mod. If these appear in the output listing, chances are your system needs them.
4. Issue the following command:
/sbin/mkinitrd <--needs-scsi-modules> /boot/initrd <ker-
nel-version>
The option --needs-scsi-modules should be used if you have configured your kernel so that the generic SCSI disk support is modular. <kernel-version> is the version of the kernel for which you need to make the ramdisk.
If you have problems with this command, make sure that your system has support for a loopback block device, either as a module (recommendedkerneld will automatically load the module), or as a static device. It would also be worthwhile to check for updates for mkinitrd at the Red Hat Web site.
Installing the Kernel
This assumes that you have configured and compiled your kernel, installed your modules, and configured initrd. You should also have configured LILO (refer to Chapter 24, Using LILO and LOADLIN) to perhaps include the old boot image and ramdisk so that you can boot those if things go wrong with your new kernel.
The following steps will save you the most typing if you are in the /boot directory because you can leave the /boot directory path out of every command.
1. Copy the kernel image, /usr/src/linux/arch/i386/boot/vmlinuz, to the /boot directory as file zImage-<kernel-version>. Of course, replace <kernel-version> with the version number of your kernel. If you have customized LILO to look for a different filename as the kernel image, make sure you use that instead.
2. Delete the symbolic link /boot/zImage. Create a new symbolic link using the command ln -s /boot/zImage-<kernel-version> /boot/zImage.
3. Type the command lilo. You should see output something like this:
[root@jansmachine /root]# lilo
Added linux *
Added old
The * character after the linux image is the image that LILO will boot by default. If you want to boot another image (for instance, the image old that was listed above), just type the image at the lilo: prompt that the system presents you with before it boots.
You may also want to test to see if LILO will install your configuration successfully. To do this, type lilo -t instead of lilo. This does everything but actually modify your disk to install LILO.
Previous
Table of Contents
Next
Wyszukiwarka
Podobne podstrony:
613 616613,17,artykul613 (2)613 PRAWDz U 2010 nr 65 poz 613demo cgi 616609 613613!616 (2)613 614616 617606 613613 617Nuestro Circulo 613 67o CAMPEONATO FEMENINO ARGENTINO 2014więcej podobnych podstron