This section is written by Al Dev (alavoor[AT]yahoo.com) (The latest version of this document is at http://www.milkywaygalaxy.freeservers.com. You may want to check there for changes). Mirror sites are at - angelfire, geocities. These sites have lot of linux goodies and tips.
Kernel re-compile is required in order to make the kernel very lean and which will result in FASTER operating system . It is also required to support any new devices.
Before you build kernel, it is a good idea to do a backup of the system. If you had not backed up your system recently then you can do it now. You can use commercial backup tools like BRS Backup-Recovery-Software (also in this page you can find open-source/freeware backup tools listed under 'Backup and Restore Utility'). Backup is just a suggestion and it is not mandatory to do backup before building the Linux kernel.
If you had already built the kernel and you want to upgrade to next patch release, then you can simply copy the existing config file and reuse it. (For example you have built kernel 2.4.19 and want to upgrade to 2.4.20).
For minor upgrades : This step may save you time, if you want to reuse the old settings. Whenever you install the kernel, generally you put the config file in /boot. So, you can use the existing version of config file:
bash# mv /usr/src/linux/.config /usr/src/linux/.config.save bash# cp /boot/config-2.4.18-19.8.0 /usr/src/linux/.config
bash# ls -l /usr/src/lin* # You can see that /usr/src/linux is a soft link bash# cd /usr/src/linux bash# cp ../linux-old-tree/.config . # Example cp ../linux-2.4.19/.config .
or one other method is - you can use "make oldconfig" which default all questions based on the contents of your existing ./.config file.
NOTE: If you do not have lot of disk space in /usr/src then you can unpack the kernel source package on any partition where you have free disk space (like /home). Because kernel compile needs lot of disk space for object files like *.o. For this reason the /usr/src/linux MUST be a soft link pointing to your source directory.
After this, look in the next section to do make and install.
See details of above steps in the following sections....
Details of the steps mentioned in the previous section:
Note: Below 'bash#' denotes the bash prompt, you should type the commands that appear after the 'bash#' prompt. Below are commands tested on Redhat Linux Kernel 2.4.7-10, but it should work for other distributions with very minor changes. It should also work for older kernel versions like 2.2, 2.0 and 1.3. It should also work for future or newer versions of kernel (with little changes - let me know).
bash$ su - root bash# cd /mnt/cdrom/RedHat/RPMS bash# rpm -i kernel-headers*.rpm bash# rpm -i kernel-source*.rpm bash# rpm -i dev86*.rpm bash# rpm -i bin86*.rpm
bash# cd /usr/src bash# ls -l # You should see that /usr/src/linux is soft link pointing to source lrwxrwxrwx 1 root root 19 Jan 26 11:01 linux -> linux-2.4.18-19.8.0 drwxr-xr-x 17 root root 4096 Jan 25 21:08 linux-2.4.18-14 drwxr-xr-x 17 root root 4096 Mar 26 12:50 linux-2.4.18-19.8.0 drwxr-xr-x 7 root root 4096 Jan 14 16:32 redhat
NOTE: If you do not have lot of disk space in /usr/src then you can unpack the kernel source package on any partition where you have free disk space (like /home). Because kernel compile needs lot of disk space for object files like *.o. For this reason the /usr/src/linux MUST be a soft link pointing to your source directory.
bash# mv /usr/src/linux/.config /usr/src/linux/.config.save bash# cp /boot/config-2.4.18-19.8.0 /usr/src/linux/.config
bash# ls -l /usr/src/lin* # You can see that /usr/src/linux is a soft link bash# cd /usr/src/linux bash# cp ../linux-old-tree/.config . # Example cp ../linux-2.4.19/.config .
bash# cd /usr/src/linux bash# cp .config .config.save bash# make clean bash# make mrproper # Must do this if want to start clean slate or if you face lot of problems
bash# man startx bash# startx bash# cd /usr/src/linux bash# make xconfig
bash# export TERM=xterm bash# make menuconfig If you find scrambled display, then use different terminal emulators like vt100, vt102, vt220 or ansi. The display will be scrambled and will have garbage characters in cases where you use telnet to login to remote linux. In such cases you should use the terminal emulators like vt100, vt220. For example: bash# export TERM=vt220 bash# export TERM=ansi At a lower level of VT, use: bash# export TERM=vt100 bash# make menuconfig If the menuconfig command fails then try - bash# make config
Within 'make xconfig' you must do these (to avoid problems) -
Save and Exit "make xconfig". All the options which you selected is now saved into configuration file at /usr/src/linux/.config (dot config file).
bash# make dep
bash# cd /usr/src/linux bash# vi Makefile
bash# gvim -R /usr/src/linux/arch/i386/config.in bash# man less bash# less /usr/src/linux/arch/i386/config.in Type 'h' for help and to navigate press i, j, k, l, h or arrow, page up/down keys.
Now, give the make command -
bash# cd /usr/src/linux bash# man nohup bash# nohup make bzImage & bash# man tail bash# tail -f nohup.out (.... to monitor the progress) This will put the kernel in /usr/src/linux/arch/i386/boot/bzImage
# Bring up a new Xterm shell window and ... bash# cd /usr/src/linux # Redirect outputs such that you do not overwrite the nohup.out which is still running... bash# nohup make modules 1> modules.out 2> modules.err & bash# make modules_install # Do this, only after the above make command is successful
bash# cd /usr/src/linux bash# less nohup.out bash# less modules.err bash# less modules.out If no errors then do: bash# make modules_install
bash# cp /usr/src/linux/arch/i386/boot/bzImage /boot/bzImage.myker.26mar2001 # You MUST copy the config file to reflect the corresponding kernel image, for documentation purpose. bash# cp /usr/src/linux/.config /boot/config-<your_kernelversion_date> # Example: cp /usr/src/linux/.config /boot/config-2.4.18-19.8.0-26mar2001
Configure GRUB: GRUB is recent and much better tool than LILO and it is my first preference to use GRUB. LILO is an older technology. GRUB differs from bootloaders such as LILO in that "it can lie to MS Windows and make MS Windows believe that it's installed on the first partition even if it's not!!". So you can keep your current Linux system where it is and install Windows on the side. See the Appendix C - GRUB details and sample grub.conf file.
Configure LILO: LILO is older tool and see the Appendix B - Sample lilo.conf to configure LILO. (see also http://www.linuxdoc.org/HOWTO/LILO-crash-rescue-HOWTO.html)
bash# cd /usr/src/linux bash# make bzdisk See also mkbootdisk - bash# rpm -i mkbootdisk*.rpm bash# man mkbootdisk
Optional - You can also build RPM packages of kernel, in case you want to install the new image on several machines.
make rpm # To build rpm packages
Having any problems? See the troubleshooting chapter.
See the Appendix D - Post Kernel Building.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |