'2014/10'에 해당하는 글 1건

From : http://linuxplayer.org/2011/05/build-vanilla-linux-kernel-on-centos-5



Build vanilla linux kernel on CentOS 5


Building a Linux kernel itself is not complicated. In normal case, we just download the latest Linux kernel from http://www.kernel.org, extract the tarball, cd to the kernel source tree, then run a series of command:

wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.6.tar.bz2
tar -xjf linux-2.6.38.6.tar.bz2
cd linux-2.6.38.6
make mrproper
make menuconfig
make -j2 > /dev/null
sudo make modules_install
sudo make install

In order for the newly built kernel to be able to boot successfully, we need to configure it with required driver modules, this includes, but not limited to, filesystem drivers, block device drivers, network device drivers, …etc.

However, when it comes to CentOS/RHEL 5, our normal kernel building procedure may not be able to produce a bootable kernel. We may get this error message followed by the famous kernel panic when we are using LVM on the root filesystem.

Scanning and configuring dmraid supported devices
Scanning logical volumes
  Reading all physical volumes.  This may take a while...
  No volume groups found
Activating logical volumes
  Volume group "VolGroup00" not found
Trying to resume from /dev/VolGroup00/LogVol01
Unable to access resume device (/dev/VolGroup00/LogVol01)
Creating root device.
Mounting root filesystem.
mount: could not find filesystem '/dev/root'

The initrd generated by CentOS makes use of some old sysfs features, and the newly built kernel may have that feature disabled. we can reconfigure the kernel to enable it:

General setup->
 [*] enable deprecated sysfs features to support old userspace tools
  │ │    [*]   enabled deprecated sysfs features by default     

Or , manually edit the .config file, add these lines:

CONFIG_SYSFS_DEPRECATED=y
CONFIG_SYSFS_DEPRECATED_V2=y

then run

make oldconfig

Make and install the kernel again, it should boot successfully.



WRITTEN BY
RootFriend
개인적으로... 나쁜 기억력에 도움되라고 만들게되었습니다.

,