分享
 
 
 

官方文档:redhat9上编译内核

王朝other·作者佚名  2008-05-18
窄屏简体版  字體: |||超大  

Search Docs:

Red Hat Docs > Manuals > Red Hat Linux Manuals > Red Hat Linux 9 >

Red Hat Linux 9: Red Hat Linux Customization Guide

PrevAppendix A. Building a Custom KernelNext

A.2. Building the Kernel

The instructions in this section apply to building a custom modularized kernel. To build a monolithic kernel instead, see Section A.3 Building a Monolithic Kernel for an explanation of the different aspects of building and installing a monolithic kernel.

Note

This example uses 2.4.20-2.47.1 as the kernel version (the kernel version might differ). To determine the kernel version, type the command uname -r and replace 2.4.20-2.47.1 with the kernel version that is returned.

To build a custom kernel for the x86 architecture (perform all these steps as root):

1.

Open a shell prompt and change to the directory /usr/src/linux-2.4/. All commands from this point forward must be executed from this directory.

2.

It is important that kernel build starts with the source tree in a known condition. Therefore, it is recommended that the command make mrproper is issued first to remove any configuration files along with the remains of any previous builds that may be scattered around the source tree. If an existing configuration file already exists as the file /usr/src/linux-2.4/.config, back it up to a different directory before running this command and copy it back afterward.

3.

It is recommended that the configuration of the default Red Hat Linux kernel be used as a starting point. To do this, copy the configuration file for the system's architecture from the /usr/src/linux-2.4/configs/ directory to /usr/src/linux-2.4/.config. If the system has more than four gigabytes of memory, copy the file that contains the keyword bigmem.

4.

Next, customize the settings. If the X Window System is available, the recommended method is to use the command make xconfig to run the Linux Kernel Configuration.

Note

To use the graphical tool started with the make xconfig command, the tk package, which provides the wish command, must be installed. For more information on installing RPM packages, refer to Part V Package Management.

Figure A-1. Configuring Kernel Component Categories

As shown in Figure A-1, select a category to configure by clicking on it. Within each category are components. Select y (yes), m (module), or n (no) beside the component to compile it into the kernel, compile it as a kernel module, or not compile it. To learn more about the component, click the Help button beside it.

Click Main Menu to return to the categories list.

After finishing the configuration, click the Save and Exit button in the main menu window to create the configuration file /usr/src/linux-2.4/.config and exit the Linux Kernel Configuration program.

Even if no changes were made to any of the settings, running the make xconfig command (or one of the other methods for kernel configuration) is required before continuing.

Other available methods for kernel configuration include:

*

make config — An interactive text program. Components are presented in a linear format and answered one at a time. This method does not require the X Window System and does not allow answers to be changed for previous questions.

*

make menuconfig — A text mode, menu driven program. Components are presented in a menu of categories; select the desired components in the same manner used in the text mode Red Hat Linux installation program. Toggle the tag corresponding to the item to be included: [*] (built-in), [ ] (exclude), <M> (module), or < > (module capable). This method does not require the X Window System.

*

make oldconfig — This is a non-interactive script that sets up the configuration file to contain the default settings. If the system is using the default Red Hat Linux kernel, it creates a configuration file for the kernel that shipped with Red Hat Linux for the architecture. This is useful for setting up the kernel to known working defaults and then turning off features not wanted.

Note

To use kmod and kernel modules answer Yes to kmod support and module version (CONFIG_MODVERSIONS) support during the configuration.

5.

After creating a /usr/src/linux-2.4/.config file, use the command make dep to set up the dependencies correctly.

6.

Use the command make clean to prepare the source tree for the build.

7.

It is recommended that the custom kernel have a modified version number so that the existing kernel is not overwritten. The method described here is the easiest to recover from in the event of a mishap. For other possibilities, details can be found at http://www.redhat.com/mirrors/LDP/HOWTO/Kernel-HOWTO.html or in the Makefile in /usr/src/linux-2.4.

By default, /usr/src/linux-2.4/Makefile includes the word custom at the end of the line beginning with EXTRAVERSION. Appending the string allows the system to have the old working kernel and the new kernel (version 2.4.20-2.47.1custom) on the system at the same time.

If the system contains more than one custom kernel, a good method is to append the date at the end (or another identifier).

8.

Build the kernel with make bzImage.

9.

Build any modules configured with make modules.

10.

Use the command make modules_install to install the kernel modules (even if nothing was actually built). Notice the underscore (_) in the command. This installs the kernel modules into the directory path /lib/modules/<KERNELVERSION>/kernel/drivers (where KERNELVERSION is the version specified in the Makefile). In this example it would be /lib/modules/2.4.20-2.47.1custom/kernel/drivers/.

11.

Use make install to copy the new kernel and its associated files to the proper directories.

In addition to installing the kernel files in the /boot directory, this command also executes the /sbin/new-kernel-pkg script that builds a new initrd image and adds new entries to the boot loader configuration file.

If the system has a SCSI adapter and the SCSI driver was compiled as a module or if the kernel was built with ext3 support as a module (the default in Red Hat Linux), the initrd image is required.

12.

Even though the initrd image and boot loader modifications are made, verify that they were done correctly and be sure to use the custom kernel version instead of 2.4.20-2.47.1. Refer to Section 30.5 Verifying the Initial RAM Disk Image and Section 30.6 Verifying the Boot Loader for instructions on verifying these modifications.

PrevHomeNext

Building a Custom KernelUpBuilding a Monolithic Kernel

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有