*********************************************************** ************************* The following steps have a lot of primary commands or explains, because even Linux newbie, * Walking a lot of detours during the compilation process I spent a lot of time to find a variety of solutions, so I wrote the corresponding commands, I hope that the same will soon introduce and think about the newcomer to compile the kernel! ** Kilvon 05-Mar- 2003 *********************************************************** ********************
Basic compilation Description: Even the current version is: Redhat Linux 8.0 (the machine has dual operating system: Linux and Windows 2000) The kernel version is 2.4.18-14, hardware is a model of notebook Compaq, the downloaded kernel version is 2.4 .20 (can be found on www.kernel.org), use high versions when compiling kernels, rather than compile on previous versions, see the description of step 7.1
Before the start of the compilation, it is recommended to make a detailed statistics on the hardware in Windows, including hardware types, manufacturers, chip versions, etc., especially notebooks, and brands, because many parts are OEM other manufacturers, And print it out for use by the kernel. (LINUX can also be used: System Tools -> Hardware Browser to view)
In addition, it is recommended to prepare a few sheets of paper and pen, and you can always think about important information, and of course, including error messages, to help determine and solve problems later.
1. Put the kernel source package Linux-2.4.20.tar.bz2 copy to / usr / src directory: #CP Linux-2.4.20.tar.bz2 / usr / src # CD / USR / SRC
2. Remove the Symbol Link to the previous kernel version #RM -F Linux-2.4
3. Using the following command unto the compressed package # bzip2 -d linux-2.4.20.tar.bz2 # tar -xvf Linux-2.4.20.tar
4. Create a new Symbol Link to link to the directory of the original source code #LN -S Linux-2.4.20 Linux-2.4
5. Enter the working directory shrimp when compiled later: #CD /USR/SRC/LINUX-2.4
6. This command guarantees that there is no incorrect .o file in the source code directory (ie the object file, which is generated when compiling C language, the purpose is to use the use of the LINK when compiled into an executable code) and the mutual relying on the file. A primitive package that is compiled just downloaded without this command, but if you use these source code multiple times, you must first run this command. # Make MrProper
7. In order not to affect the available kernel (such as the kernel that is loaded when installing Linux), it is now necessary to save the previously available kernel (so that the compilation failed can still "makes" start Linux), and we have to compile this The kernel identifies an easy identification mark, and the following steps are not related to compilation.
7.1 Even GRUB is used as Boot Manager, so you want to modify the grub.conf file, # cp /boot/grub/grub.conf /boot/grub/grub.conf.bck (recommended to print a primitive grub.conf file, Cause See Section 7.4) #EMACS /BOOT /GRUB/grub.conf (Emacs Tips: Ctrl X S is the saved result, Ctrl X C is turned off Emacs, delete N line words: first put the cursor first Delete the start of the text Ctrl U, then knock into the number of rows you want to delete, such as 4, last Ctrl K)
The following is an even GRUB.CONF content: default = 1timeout = 10splashImage = (hd0, 6) /grub/splash.xpm.gztitle psyche (2.4.18-14 standard) root (HD0, 6) kernel /VMLinuz-2.4.18 -14.Standard Ro root = / dev / hda8 initrd /initrd-2.4.18-14.standard.imgtitle Windows 2000 rootnoverified (HD0, 0) ChainLoader 1 Note Kernel ... and Initrd ... two statements, because To correspond to the following changes: #RM -F /BOOT/System.map#RM -F / boot / vmlinuz # cp /boot/system.map-2.4.18-14 /boot/system.map-2.4.18.standard #LN -S /Boot/system.map-2.4.18.standard /boot/system.map#cp /boot/vmlinuz-2.4.18-14 /boot/vmlinuz-2.4.18-14.standard#ln -s /BOOT/VMLINUZ-2.4.18-14.Standard / boot / vmlinuz # cp /boot/initrd-2.4.18-14.img /boot/initrd-2.4.18-14.standard.img (Initrd only uses COPY Because even if it is compiled a high version of the kernel, not the same version kernel recompilation, the benefit of compiling high versions is that the system will establish another directory without coverage with the newly compiled (probably wrong) version. Version, look at the / lib / modules directory.)
7.2 How to know your root directory "/" on which partition? Command is: #df The following is part of the even machine: FileSystem 1K-block Used available use% MOUNTED ON / DEV / HDA8 4137264 2136592 1790508 55% / .. .
Look at where your system root is very important, because later you will see the system installation compiled kernel inserted in the command = label = / hdc = IDE-SCSI can trigger system boot The following error: vfs: cannot open root device "" or 00Please append a corrend "root =" boot optionkernel PANIC: VFS: Unable to mount root fs on 00:00 So in GRUB.CONF to modify its commands : root = / dev / hda8
7.3 Ok, after doing these preparations, we want to restart the machine, :) Don't worry, you should first confirm the correctness of the work of the 7.1 step, so as not to bring the 7.1 error to the following steps. (Compile The kernel must be very careful, not impatient, otherwise, 嘿 ...)
7.4 If there is a problem during the restart, you can temporarily change the GRUB boot parameters on the GRUB's boot interface. The relevant commands are: E - Edit Boot Command ESC key - Back to the upper class directory O - Insert a line command B - Start boot system D - Delete a row, actually you can delete the commands on the GRUB console (only affect this start), then follow the commands in /boot/grub/grub.conf to manually knock in the GRUB console, and the same effect .
7.5 If you can use the reconfigured grub command to start the system correctly, let's start the real compilation work !!!!
7.6 First, we guarantee that we are in the compiled working directory: #CD /usr/src/linux-2.4 then edit the makefile (this file is used to control the compilation), find this line: extraversion = Modified to (with even this compilation For example, it can be any legal string, such as "-SEMA-V.4") extraversion = -kilvon.0018. Even is compiled under X WINDOW: #make xconfig
8.1 If you are in text mode, use #make menuconfig
8.2 In fact, the most difficult thing in compilation step is the configuration of the kernel parameters. I spent a lot of time here, and even more miserable, I didn't realize this, thinking is the use of those orders ... So, then look:
8.3 The principle of choice is to compile the partial function code that is far from other partial relationships of the kernel and is not often used as a loadable module (which is far away. It is also the understanding of people's understanding of Linux and operating system concept. Help of the configuration item, facilitates the reduction of the length of the kernel, reduce the memory consumption of kernel consumption, simplifies the impact of the kernel during the corresponding environment changes; no need to choose; close and frequently used Some functional code is directly compiled into the kernel. The following is a complimentary options for common options: / 1. Code Mature Level Options code mats. There is only one item here: prompt for development and / or ibPlete code / drivers If you want to test the functionality that is still in the experimental phase, such as khttpd, IPv6, etc., you must choose to Yes; otherwise you can choose it as N. / 2. Loadable Module Support support for module. There are three items: Enable loadable module support: This item should be required unless you are ready to compile all the required content. Set Version Information On All Module Symbols: You can don't choose it. KERNEL MODULE Loader: Let the kernel have the ability to load the required module during startup, and suggest it. / 3. Processor Type and featureScpu type, many options, not introduced, related to the following: Processor Family: Select the CPU type according to your own situation. High Memory Support: Support for large capacity memory. You can support 4G, 64G, usually not available. Math Emulation: Coprocessor simulation, coprocessor is the pet in the 386 era, and now it is no longer available. MTTR Support: MTTR support. Optional. Symmetric Multi-Processing Support: Symmetric multi-process support. Unless you are rich in multiple CPUs, you don't have to choose. / 4. General Setup is set for some of the most ordinary properties. This part of the content is very large, usually using the default settings. Here are some options that are often used: Networking support: Network support, must be selected, no NIC is also recommended. PCI Support: PCI support, must-choose .pci access mode: PCI access mode. Alternative to BIOS, Direct and Any, choose ANY. Support for Hot-Pluggabel Devices: Hot-swappable device support, optional .pcmcia / cardbus support: PCMCIA / Cardbus support, PCMCIA will be selected. System V ipcbsd process acceptingsysctl support: The above three is related to process processing / IPC calls, mainly in both SYSTEM V and BSD style. If you are not using BSD, follow the default. Power Management Support: Power Management Support, Optional, especially notebook .advanced Power Management BIOS Support: Advanced Power Management BIOD support. / 5. MEMORY TECHNOLOGY DEVICE (MTD) MTD device support is not available. / 6. Parallel Port Support serial port support. If you don't plan to use the serial port, don't choose. / 7. Plug and play configuration Plug and Play support.
Select it, you can experience the feeling of plugging and playing under Linux. / 8. Block Devices block equipment support, you need to choose the specific situation of everyone: Normal PC Floppy Disk Support: Ordinary PC floppy support, generally choose, I don't have, I don't choose XT HARD DISK Support: Compaq Smart2 Support: MULEX DAC960 / DAC1100 PCI RAID Controller Support: RAID mirroring. Loopback Device Support: Network BLOCK Device Support: Network block device support. If you want to access something on the online neighbors, you choose. Logical Volume Manager (LVM) Support: Logical Volume Management Support. Multiple Devices Driver Support: Multi-device Drive Support. RAM Disk Support: RAM disk support. / 9. Networking options network options. The network protocol is configured here. Look at yourself. In addition to being sure to select TCP / IP Networking, you can do it / 10. Telephony Supportlinux can support phone card so you can use ordinary phones on IP. Details can look at HELP Content. / 11. ATA / IDE / MFM / RLL Support This is the hard disk / optical drive / tape / floppy disk support for various interfaces, and the content is too much, and the default option is used. The situation is different. / 12. SCSI SupportSCSI device support, if you use SCSI's hard drive / optical drive / tape, you can find it. / 13. IEEE 1394 (firewire) Support is gray, don't worry , :)) / 14. I2O Device Support is used in the Smart Input / Output (I2O) system interface, not, use defaults. / 15. Network Device Support network device support. The above is selected, and now the device is now available. In order to avoid trouble, compile it into the kernel, do not choose M, choose Y. Patience, usually you can find your own network card. If you don't, you have to go to the vendor to be drove it, or go to www.mydrivers.com to see / 16. Amateur Radio Support is not, no. / 17. Irda (Infrared) Support This is going to support, I have If you use ISDN Internet access, this will not be less / 19. Old CD-ROM Drivers (Not Scsi, Not IDE) is specifically made of non-SCSI / IDE, but who is still using So old Dongdong, choose it yourself. /20.input core support This option is important, except for the Joystick (Game Remote Rod), "M" is selected. Remember! / 21. Character Devices Character device. This content is too much, first use the default settings, you will modify it. If you want to choose the following Video for Linux, this must be selected. Mice: mouse. If it is a notebook, it is recommended to select "Y" in Bus Mouse Support: Handle.
Even in linux, the handle is not very much Watchdog Cards: Although it is called Cards, this can be implemented with pure soft, of course, has hardware. If you choose this, you will create a file called WatchDog under your / dev, which can record your system's operation, until the system restarts for about 1 minute. With this file, you can recover the status before the system is restarted. Video for Linux: Supports audio / video cards. FTAPE, The Floppy Tape Device Driver: PCMCIA Character Device Support: /22.multimedia Devices To capture Audio / Video, if you are interested in see the Help / 23. File Systems file system. There are too many content, it is recommended to make changes on the basis of the default option. Describe the following: Quota Support: Quota can limit the upper limit of the hard disk space that each user can use, which is very valid in the case of multi-user uses a host. DOS FAT FS Support: Support for DOS FAT file format, you can support FAT16, FAT32. ISO 9660 CD-ROM FILE SYSTEM Support: The disc is used by the ISO 9660 file format. NTFS File System Support: NTFS is the file format used by NT, you have to select it in the Mount NTFS partition under Linux. Remember that when you mount, only IoCharset = CP936 can be added, codepage = 936 cannot be added. / proc file system support: / proc file system is a channel that Linux is provided to users and systems, and suggests, otherwise some features cannot be executed correctly. There are also three major categories to regulate it here: Network file systems, Partition Types, Native Language Support (Local Language Support). It is worth mentioning that both of the NETWORK File Systems: NFS and SMBs are Linux and Windows to access the file system used by each other in the form of network neighbors, and select as needed.
/ 24 Console Drivers What sound cards do you use with a default / 25 Sound? Select. / 26 USB Support is important, at least the following options Support for USBuchi Alternate Deriver (JE) Supportochi (Compaq, iMacs ... USB Audio. ..Usb Midi ... USB HUMAN Interface Device (Full Hid) Supporthid Input Layer Support / dev / hiddev Raw Hid ... USB LCD Device Support Because the iSb Hid support is required because the even hardware is required, there is a lot of * If some options are not allowed, you can refer to: /usr/src/linux-2.4/Documentation/configure.help You can also see the entire system and see which files appear in the entire system: #find / usr -name " *. * "-print -exec grep -q -s mousededev {} /; -print This long command is useless 8.4 Don't forget to save your configuration to a file, otherwise you have to re-seal when compiling! Configuration from file, such as saving to /Home/kilvon/kernel-kilvon.001 8.5 Read the following command to make it effective: #make dep # make Clean 9. Start compile the kernel and module # Make Bzimage # make MODULES # make MODULES_INSTALL 10. Move the compiled file to / boot; if it is wrong above, most of the situation is due to the configuration of the kernel option to compile some current versions to modules to compile into the kernel, I have encountered this situation several times. I should release a stable kernel for since www.kernel.org, (even without Down Alpha, Beta) 90% can successfully compile. # Move / usr / src / linux- 2.4 / system.map /boot/system.map-2.4.20-kilvon.001#move /usr/src/linux-2.4/Arch/i386/boot/bzimage /boot/vmlinuz-2.4.20-kilvon.001# Rm -f system.map # rm -f VMLinuz # ln -s /boot/system.map-2.4.20-kilvon.001 /boot/system.map#ln -s /boot/vmlinuz-2.4.20-kilvon.001 / boot / vmlinuz 11. Work: # new-kernel-pkg --install - Depmod - Mkinitrd 2.4.20-kilvon.001 - mkinitrd made INITIAL RAMDISK, you can directly knock a mkinitrd -h look - DEPMOD Check the kernel no Analysis Symbol - INSTALL Installs a boot option 12 in GRUB. Take a look at the relevant explanation of step 7.2, now modify the /boot/grub/grub.conf file, the following is the modified grub.conf: default = 2timeout = 10SPLASHIMAGE = (HD0, 6) /grub/splash.xpm.gztitle psyche (2.4.20-kilvon.001) root (hd0, 6) kernel /Vmlinuz-2.4.20-kilvon.001 Ro root = / dev / hda8 initrd /initrd-2.4.20-kilvon.001.imgtitle psyche (2.4.18-14 standard) root (HD0, 6) kernel /Vmlinuz-2.4.18-14.standard Ro root = label = / hdc =
IDE-SCSI INITRD /INITRD-2.4.18-14.Standard.Imgtitle Windows 2000 Rootnoverify (HD0, 0) ChainLoader 1 13. That then check if the file name under / boot is tapped (there are many MVs in front, CP action) [root @ localhost boot] # lltotal 8880 5824 September 6 04:53 Boot.b 612 September 6 04:53 Chain.b 42150 September 5 01:47 Config-2.4.18-14 1024 March 5 21:32 GRUB 130983 March 5 03:49 INITRD-2.4.18-14.Img 130983 March 4 20:21 Initrd-2.4.18-14.standard.img 65499 March 5 21:31 Initrd-2.4.20 -kilvon.001.img 473 March 5 03:49 KERNEL.H 12288 March 5 03:44 Lost Found 23108 Sep 6 22:05 Message 21282 Sep 622:05 Message.ja 21 March 5 03: 49 MODULE-INFO -> Module-Info-2.4.18-14 15436 September 5 01:47 Module-Info-2.4.18-14 15436 March 4 20:21 Module-Info-2.4.18.standard 16834 March 5 21:17 mykernelsetup-kilvon.001 640 September 6 04:53 OS2_D.B 28 March 5 19:32 System.map -> System.map-2.4.20-Kilvon.001 507814 September 5 01:47 SYSTEM . map-2.4.18-14 507814 March 4 20:20 system.map-2.4.18-14.standard 588175 March 5 21:24 System.map-2.4.20-kilvon.0013236438 September 5 01:47 VMLi NUX-2.4.18-14 31 March 5 12:51 VMLinuz -> /Boot/vmlinuz-2.4.20-kilvon.0011125194 September 5 01:47 VMLinuz-2.4.18-141125194 March 4 20:19 vmlinuz- 2.4.18-14.Standard1458790 March 5 21:24 VMLinuz-2.4.20-kilvon.001 14. Ok, come on: #Reboot 15. If there is any fault can't start, this is back to the GRUB console and then used former Nuclear start, remember? The "additional" work in the previous step 7 will save you a lot of time ... 16. If the system can start to the login interface and can be logged in, but there is a failed item during the startup process, View: /var/log/boot.log or this directory search, see what is the problem, even if you encounter similar problems, then solve these annoying red characters by changing the compilation of the kernel, good Writing here, it is already 1 o'clock in the morning of March 6, I have to sleep, I have to go to work tomorrow.