|
|
发表于 2005-4-28 22:59:52
|
显示全部楼层
emerge genkernel是第二种方法.
handhook上说:
7.d. Alternative: Using genkernel
If you are reading this section, you have chosen to use our genkernel script to configure your kernel for you.
Now that your kernel source tree is installed, it's now time to compile your kernel by using our genkernel script to automatically build a kernel for you. genkernel works by configuring a kernel nearly identically to the way our Installation CD kernel is configured. This means that when you use genkernel to build your kernel, your system will generally detect all your hardware at boot-time, just like our Installation CD does. Because genkernel doesn't require any manual kernel configuration, it is an ideal solution for those users who may not be comfortable compiling their own kernels.
Now, let's see how to use genkernel. First, emerge the genkernel ebuild:
Code listing 15: Emerging genkernel
# emerge genkernel
Next, copy over the kernel configuration used by the Installation CD to the location where genkernel looks for the default kernel configuration:
Code listing 16: Copying over the Installation CD kernel config
# zcat /proc/config.gz > /usr/share/genkernel/x86/kernel-2.6
Now, compile your kernel sources by running genkernel --udev all. Be aware though, as genkernel compiles a kernel that supports almost all hardware, this compilation will take quite a while to finish!
Note that, if your boot partition doesn't use ext2 or ext3 as filesystem you might need to manually configure your kernel using genkernel --menuconfig all and add support for your filesystem in the kernel (i.e. not as a module). Users of EVMS2 or LVM2 will probably want to add --evms2 or --lvm2 as argument as well.
Code listing 17: Running genkernel
# genkernel --udev all
Once genkernel completes, a kernel, full set of modules and initial root disk (initrd) will be created. We will use the kernel and initrd when configuring a boot loader later in this document. Write down the names of the kernel and initrd as you will need it when writing the bootloader configuration file. The initrd will be started immediately after booting to perform hardware autodetection (just like on the Installation CD) before your "real" system starts up.
Code listing 18: Checking the created kernel image name and initrd
# ls /boot/kernel* /boot/initrd*
Now, let's perform one more step to get our system to be more like the Installation CD -- let's emerge coldplug. While the initrd autodetects hardware that is needed to boot your system, coldplug autodetects everything else. To emerge and enable coldplug, type the following:
Code listing 19: Emerging and enabling coldplug
# emerge coldplug
# rc-update add coldplug boot
If you want your system to react to hotplugging events, you will need to install and setup hotplug as well:
Code listing 20: Emerging and enabling hotplug
# emerge hotplug
# rc-update add hotplug default
Now continue with Configuring your System.
-------------------------------------------------------------------------------- |
|