Determining Linux Dependencies
*How to compile the Linux kernel
- Backup the present kernel which is in "/boot" for most systems. You can tell where it is by looking at "/etc/lilo.conf" . sometimes lilo.conf will point to a link file. Trace the link file and backup the file being pointed to.
- Have an alternate way to boot such as another linux system on your computer or an emergency boot disk that you can access your filesystem from in case your new kernel crashes.
- Back up your kernel modules in the directory "/modules". There is probably a directory full of modules so you should be able to back it up using "cp –dpr dir1 dir2" where dir1 is the name of the directory where your modules are and dir2 is where you want to put them.
- Go to "/usr/src/linux". There is a "/usr/src/linux/.config" file used to do the compile. It is modified by typing "make config" and the values in it are used to determine defaults while doing the "make config". Back this file up to keep your original settings if you want.
- Type "make config" and answer the hundreds of questions asked. On another terminal, open the file "/usr/src/linux/Documentation/Configure.help" to determine what each configuration is. Also you can type "make menuconfig" or from an X session "make xconfig".
- Type "make dep"
- Type "make clean"
- Type "make bzImage" or "make zImage" if the kernel is small.
- Type "make modules"
- Type "make modules_install"
- Copy the file "/usr/src/linux/arch/i386/boot/bzImage" to "/boot/vmlinuz".
- Copy the file "System.map" from "/usr/src/linux" to the "/boot" directory. Rename it "System.map=w.x.y" and make sure there is a link file called "System.map" pointing to it. This step will keep you from getting warning messages when you boot. It seems to be a step they forgot to include in the kernel-howto.
- cp /usr/src/System.map /boot/System.map-2.2.14
- cd /boot
- rm System.map
- ln –s System.map-2.2.14 System.map
- Run rdev on the new kernel image to verify the root filesystem device. "rdev /boot/vmlinuz /dev/hda2". Please note that this step may be optional dependent on whether you want to use the boot loader, lilo, to point to the root device.
- Make sure the /etc/lilo.conf file is correct (image=/boot/vmlinuz), and run lilo by typing "lilo". If you didn't set the root device in step 12, you will need a line like "root=/dev/hda2" in /etc/lilo.conf in the group of commands for your kernel. This will tell the kernel where your root filesystem is.
- If your kernel has a feature supported by a module that is required to boot, you will need to make a RAM disk boot image or your system won't boot.
- Run lilo by typing "lilo". If you didn't set the root device in step 12, you will need a line like "root=/dev/hda2" in /etc/lilo.conf in the group of commands for your kernel. This will tell the kernel where your root filesystem is.
This step may be necessary if you are using a kernel previous to the 2.2 series. In the directory "/usr/include" may be several link files such as "asm", "linux", and "scsi". These are normally softlinks through "/usr/src/linux". If they are, you can direct the softlink file "usr/src/linux" to your new kernel file which may be in the form "linux-2.2.14". If you don't have the "linux" softlink file and don't want to create it, you will need to remove and redirect the softlink files in "/usr/include" to the proper location of your new kernel source.
How to determine what library a binary needs
Using the "ldd" command, type "ldd /bin/ls" to see the shared libraries used by the "ls" command. Do the same for any other binary you are interested in. This way if a binary (newly created, downloaded, etc) requires a library you can check your "lib" directory to see if it is there. If it is not, you will need to create and install it.
How to tell if a library is a.out or ELF type
Type "file library.so.x", substituting the name of your library for "library.so.x". If ELF is used the loader library "ld-linux.so" is required, and if a.out is used, "ld.so" is required.
How to find Kernel Modules
Modules can be found in "lib/modules/2.2.12-20" for kernel version 2.2.12-20. They are loadable modules ending in "*.o" that are used to support the kernel.