Linux kernel modification

Source: Internet
Author: User
Linux kernel configuration modification is cumbersome, but the proper configuration is directly related to linux running in the future. it is necessary to understand some of the main and frequently used options. You can use one of the following commands to configure the kernel as needed and as a hobby: # makeconfig (base... linux kernel configuration modification is cumbersome, but the proper configuration is directly related to linux running in the future. it is necessary to understand some of the main and frequently used options. You can use one of the following commands to configure the kernel based on your needs and hobbies: # make config (the most traditional text-based configuration interface is not recommended) # make menuconfig (text menu-based configuration interface, recommended for character terminals) # make xconfig (configuration interface based on graphic window mode, recommended for Xwindow) # make oldconfig (if you only want to modify some small points on the basis of the original kernel configuration, it will save a lot of trouble) among the three commands, the make xconfig interface is the most friendly. if you can use Xwindow, we recommend that you use this command. if you cannot use Xwindow, use make menuconfig. Although the interface is worse than the previous one, it is better than make config to select the corresponding configuration, there are three options, they represent the following meanings: Y -- compile the function into kernel N -- do not compile the function into kernel M -- compile the function into a module that can be dynamically inserted to the kernel as needed. if make xconfig is used, with the mouse, you can select the corresponding options. If you are using make menuconfig, you need to use the space key to select. You will find that there is a bracket before each option, but there are brackets, angle brackets, and parentheses. When using the space key, you can find that the brackets are either empty or "*", while the angle brackets can be empty, "*" and "M ". This indicates that the items corresponding to the former are either not or compiled into the kernel. The latter selects the same item and can be compiled into modules. The content of the parentheses is to select one of the options provided. In the process of compiling the kernel, the most annoying thing is the configuration work in this step. many new users do not know how to choose these options. In fact, the default value can be used for most options during configuration. only a small part of options need to be selected based on different user needs. The selection principle is to compile some functional code that is far away from other parts of the kernel and is not frequently used into a loadable module, which helps reduce the length of the kernel and reduce the memory consumption of the kernel, the impact on the kernel when the corresponding environment change of this function is simplified; do not select a function that is not required; compile some function code that is closely related to and frequently used by the kernel directly into the kernel. As for the options, it is complicated, just a brief introduction. you should select the options based on the actual situation and the help content. 1. Code maturity level options Code maturity level. There is only one item: prompt for development and/or incomplete code/drivers. if you want to test functions that are still in the experimental stage, such as khttpd and IPv6, you must select Y. Otherwise, you can select N. 2. Loadable module support for modules. There are three items: Enable loadable module support: unless you want to compile all the required content into the kernel, this item should be required. Set version inFORMation on all module symbols: Optional. Kernel module loader: enables the Kernel to load required modules at startup. we recommend that you select this module. 3. Processor type and features CPU type. There are a lot of content. I will not introduce them one by one. The following are some of the relevant items: Processor family: Select the CPU type based on your own situation. High Memory Support: supports large Memory capacity. It can be 4 GB or 64 GB. Math emulation: coprocessor simulation. Coprocessor is the darling of the 386 age and is no longer needed. MTTR support: supported by MTTR. Optional. Hierarchical Ric multi-processing support: supports Symmetric multi-processing. Unless you are rich enough to have multiple CPUs, you do not need to choose. 4. General setup here is to set the most common attributes. This part contains a lot of content. Generally, you can use the default settings. The following describes some frequently used options: Networking support: network support. Required. we recommend that you select this option if no network adapter is available. PCI support: supports PCI. If the PCI card is used, it is required. PCI access mode: PCI access mode. Options include BIOS, Direct, and Any. select Any. Support for hot-pluggabel devices: supports hot swapping devices. It is not very good to support. PCMCIA/carw.support: PCMCIA/carw.support. PCMCIA is required. System v ipc bsd Process Accounting Sysctl support: the above three items are related to Process processing/IPC calls, mainly System V and BSD. If you are not using BSD, follow the default setting. Power Management support: Power Management support. Advanced Power Management BIOS support: Advanced Power Management BIOS support. 5. support for Memory Technology Device (MTD) MTD devices. Optional. 6. Parallel port support and port support. If you do not want to use the serial port, do not select it. 7. Plug and Play configuration Plug-and-Play support. Although plug-and-play in linux is not as good as that in Windows currently, you can choose it. in this way, you can unplug the mouse and try plug-and-play in Linux. 8. Block devices are supported. This should be selected based on your own situation. a brief description: Normal PC floppy disk support: General PC floppy disk support. This should be required. XT hard disk support: Compaq SMART2 support: Mulex DAC960/DAC1100 pci raid Controller support: For RAID images. Loopback device support: Network block device support. If you want to access the Internet neighbors, choose. Logical volume manager (LVM) support: Logical volume management support. Multiple devices driver support: supports Multiple device drivers. RAM disk support: ramdisk support. 9. Networking options network options. The network protocol is configured here. There is too much content. I will not introduce it one by one. let's take a look at it. if you have some knowledge about network protocols, you should be able to understand it. If you are too lazy to check the network, use the default option (you must select the TCP/IP networking option. Let's take a look at TCP/IP, ATM, IPX, DECnet, Appletalk ...... Many protocols are supported, IPv6 is also supported, Qos and/or fair queueing is also supported, and kHTTPd is also supported, but these are still in the experimental phase. 10. Telephony Support. Linux supports phone cards, so that you can use a common phone on an IP address to provide voice services. Remember, the phone card has nothing to do with modem. 11. ATA/IDE/MFM/RLL support This is supported by hard drives/optical drives/tapes/floppy disks related to various interfaces. there is too much content. use the default options, if you use special devices, such as PCMCIA, find the corresponding options. 12. support for SCSI devices. I don't have a SCSI device, so I don't need to select it. if you use a SCSI hard drive, optical drive, tape, and other devices, you can find them yourself. 13. Fusion MPT device support requires Fusion MPT compatibility with PCI adapters. 14. I2O device support must be supported by the I2O Interface Adapter and used in the intelligent Input/Output (I2O) system interface. 15. Network device support. I have selected the protocol above. now I have to select a device. as you can imagine, the content must be much more. Fortunately, it is probably classified into ARCnet devices, Ethernet (10 or 100 Mbit), Ethernet (1000 Mbit), and Wireless LAN (non-hamradio), Token Ring device, Wan interfaces, and PCMCIA network device support. I use 10/100 M ethernet. it seems that I only need to select this one. Or 10/100 M Ethernet device familiar, although the content is much, at a glance can see my RealTeck RTL-8139 PCI Fast Ethernet Adapter support, in order to avoid trouble, compiled into the kernel is good, if M is not selected, select Y. Be patient. Generally, you can find your own network card. If not, you have to go to the vendor to get the driver. 16. Amateur Radio support configures Amateur wireless broadcast. 17. IrDA (infrared) support infrared support. 18. if you use ISDN to access the internet, this is essential. 19. old CD-ROM drivers (not SCSI, not IDE) do really thoughtful, the original those non SCSI/IDE ports who are still using the drive AH, choose it, do not select a CD-ROM with IDE. 20. Character devices Character device. This content is too much. use the default settings first, and modify the content as needed. Let's take a look at the major categories: I2C support: I2C is the low-speed serial bus protocol used by Philips in micro-control applications. This option is required if you want to select the following Video For linux. Mice: Mouse. Now you can select bus, serial port, PS/2, C & T 82C710 mouse port, and PC110 digitizer pad as needed. Joysticks: handle. Even if you drive the handle in linux, it doesn't make much sense, and there are too few games. Watchdog Cards: Although it is called Cards, it can be implemented with pure software, and of course there are hardware. If you select this option, a file named watchdog will be created under your/dev, which can record the running status of your system, it takes about 1 minute to restart the system. With this file, you can restore the system to the state before restart. Video For linux: audio/Video cards are supported. Ftape, the floppy tape device driver: PCMCIA character device support: 21. File systems File system. There are too many contents. the old method is to modify the content based on the default options. This article describes the following items: Quota support: Quota can limit the maximum disk space available to each user, which is very effective when multiple users use a single host together. Dos fat fs support: Supports the format of dos fat files, including FAT16 and FAT32. ISO 9660 CD-ROM file system support: the disc uses the ISO 9660 file format. NTFS file system support: ntfs is the file format used by NT. /Proc file system support:/proc file system is a channel provided by linux for users to interact with the system. it is recommended that you select it. otherwise, some functions cannot be correctly executed. The other three categories are here: Network File Systems (Network File System), Partition Types (Partition type), and Native Language Support (local Language Support ). It is worth mentioning that there are two types of Network File Systems: NFS and SMB, respectively, linux and Windows, access each other's File Systems in the form of Network neighbors, and select as needed. 22. Console drivers Console driver. Generally, you can use the VGA text console, the standard 80*25 text console. 23. Sound card driver. If you can find the sound card driver in the list, it is naturally best, otherwise you will try OSS. 24. USB supprot USB support. Many USB devices, such as the mouse, modem, printer, and scanner, can be supported in linux and can be selected as needed. 25. Kernel hacking configures this. you can do some work even when the system crashes. Common users do not need this function. After the configuration, save the disk and exit. of course, you can save the current configuration file so that the next configuration will save effort. Next, compile and enter the following command. # Make dep # make clean # make bzImage or make zImage # make modules # make modules_install # depmod-a first command make dep actually reads the configuration file generated during the configuration process, to create the dependency tree corresponding to the configuration, so as to determine which files need to be compiled and those do not need it. the second command is make clean to delete the files left in the previous step to avoid some errors; make zImage and make bzImage fully compile the kernel. the kernel generated by both are compressed by gzip. you only need to use one. The difference between them is that make bzImage can generate a larger kernel. We recommend that you use the make bzImage command. The following three commands are necessary only when you answer Enable loadable module support (CONFIG_MODULES) in the configuration process, make modules and make modules_install generate the corresponding modules and copy the modules to the required directories. Strictly speaking, the depmod-a command has nothing to do with the compilation process. it is used to generate dependencies between modules. after you start the new kernel, the module can be correctly located when the module is loaded using the modprobe command. After the above steps, we finally get the new kernel version. To be able to use the new kernel version, we also need to make some changes: # cp/usr/src/linux/System. map/boot/System. map-2.4.18 # cp/usr/src/linux/arch/i386/bzImage/boot/vmlinuz-2.4.18 the above two files are newly generated at the time of compilation. Modify the two links under/boot as follows. map and vmlinuz to point to the new kernel file: # cd/boot; rm-f System. map vmlinuz # ln-s vmlinuz-2.4.18 vmlinuz # ln-s System. map-2.4.18 System. map 7. modify the startup manager. If LILO is used, modify/etc/lilo. conf, add the following items: image =/boot/vmlinuz-2.4.18label = linux240read-onlyroot =/dev/hda2 where the root =/dev/hda2 line needs to be modified as needed. Run: #/sbin/lilo-v to confirm/etc/lilo. the conf file is correctly edited. restart the system now: # shutdown-r now. if you use Grub to start the manager, add the following items. Title Red Hat linux (2.4.18) root (hd0, 0) kernel/vmlinuz-2.4.18 ro root =/dev/hda2Grub automatically takes effect without calling the command again. After the restart, you can use the new kernel.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.