symlinks -r -cds /
(as root) Check and fix the symbolic links on my system. Start from / and progress through all the subdirectories (option -r="recurse") and change absolute/messy links to relative, delete dangling links, and shorten lengthy links (options -cds). If my filesystem spreads over different hard drive partitions, I need to re-run this command for each of them (e.g., symlinks -r -cds /usr).
cd /usr/src/linux-2.4.7-10
make xconfig
(as root in X terminal). A nice GUI front-end for configuration of the kernel options in preparation for compilation of your customized kernel. (The directory name in the example contains the version of my Linux kernel so you may need to modify the directory name if your Linux kernel version is different than 2.4.7-10 used in this example. You need the "Tk" interpreter to run “make xconfig”, and the kernel source code installed.) The alternatives to "make xconfig" are: "make config" (runs a scripts that asks you questions in the text mode) and "make menuconfig" (runs a text-based menu-driven configuration utility).
Try: less /usr/share/doc/HOWTO/Kernel-HOWTO for more information.
After configurating the options for the new kernel with "make xconfig", I may proceed with compilation of the new kernel by issuing the following commands:
- make clean (this is optional; it cleans the old object files, may lengthen compilation, may prevent problems in some situations)
- make dep
- make bzImage
The last command will take some time to complete (maybe 10 min or 2 h, depending on your hardware). It produces the file arch/386/boot/bzImage, which is your new Linux kernel. Next:
- make modules
- make modules_install
Now you have the new modules installed in /lib/modules/KernelName.
Don't rename the module directory if you want to run multiple kernels--the kernel must be able to find its "matching" modules. If I want to change the kernel name, I have to edit the main kernel makefile (e.g., /usr/src/linux-2.2.14/Makefile) and change the lines right at the top. Mine (default RH7.2) are:
VERSION = 2
PATCHLEVEL = 4
SUBLEVEL = 7
EXTRAVERSION = -10custom
The kernel name for the currently running kernel can be displayed using uname -r . Mine (default RH7.2) is "2.4.7-10custom".
The configuration for my "original" RedHat kernel is in the file /boot/config-2.4.18-14 (RedHat 8.0), while some additional "custom" kernel configurations are in the directory /usr/src/linux-x.x.x/configs. I can load any of those from a dialog box in available from "make xconfig".
Now I can install the new kernel. The installation involves copying the new kernel (while renaming it) into the /boot directory:
cp arch/386/boot/bzImage /boot/vmlinuz-2.4.7-10custom
cp System.map /boot/System.map-2.4.7-10custom
and making changes to /etc/lilo.conf or /boot/grub/grub.conf so I can select at the boot time which kernel (the old or the new) to boot. It is strongly advised that you preserve the old kernel as a boot option (in case the new kernel refuses to boot).
If you use initrd (initial ram disk) for two-stage booting, you may also need to create an image with modules used by the kernel during startup:
mkinitrd /boot/initrd-2.4.7-10custom.img 2.4.7-custom
See this for details on kernel patching. Quick reference:
cd /usr/src/linux-2.4.7-10
patch -E -p1 < /home/download/the_patch_to_apply
It may also be helpful to read: /usr/doc/HOWTO/Kernel-HOWTO and perhaps man depmod. Configuration, compilation and installation of a new kernel is quite simple but it CAN lead to problems. Compilation of a kernel is also a good way to test your hardware, because it involves considerable amount of computing. If your hardware is "flaky", you may receive the "signal 11" error (then read the /usr/doc/FAQ/txt/GCC-SIG11-FAQ).
ldconfig
(as root) Re-create the bindings and the cache for the loader of dynamic libraries ("ld"). You may want to run ldconfig after an installation of new dynamically linked libraries on your system. (It is also re-run every time you boot the computer, so if you reboot you don't have to run it manually.)
mknod /dev/fd0 b 2 0
(=make node, as root) Manually create a device file. This example shows how to create a device file associated with your first floppy drive and could be useful if you happened to accidentally erase it. The options are: b=block mode device, c=character mode device, p=FIFO device, u=unbuffered character mode device. The two integers specify the major and the minor device number. I normally wouldn't know the parameters which mknod requires. So to make devices, I first read man MAKEDEV to figure the name of the device and then run the script /dev/MAKEDEV which knows about Linux devices by their names--see the next command. If the mentioned manual page does not help, I may refer to the ultimate documentation included with the kernel source code:
less /usr/src/linux/Documentation/devices.txt
cd /dev
./MAKEDEV audio
(as root). Restore the "audio" device that I just somehow screwed up. Also see the previous command.
Related Terms:linux, Linux administration commands, administration commands, administration, commands
