CentOS Icon CentOS Logo
CentOS Text
   
  
www.centos.org Forum Index
   CentOS 5 - General Support
  Please help on patching & compiling Kernel...

 

 Bottom   Previous Topic   Next Topic
  •  Rate Thread
      Rate this Thread
      Excellent
      Good
      Average
      Bad
      Terrible
Poster Thread Rated:  2 Votes
  •  Farnsworth
      Farnsworth
Please help on patching & compiling Kernel...
#1
Newbie
Joined: 2009/12/5
From
Posts: 3
Hi everyone, I have been trying for few days on patching and compiling a Kernel, but got no success. I have been searching the web for pointers, but those I have found are very confusing. I did try them, yet same result.

I am trying to patch and compile with the following:
--------------------------
Kernel: linux-2.6.31.6.tar.gz
(http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.31.6.tar.gz)

Patch: patch-2.6.31.6-rt19.gz
(http://www.kernel.org/pub/linux/kernel/projects/rt/patch-2.6.31.6-rt19.gz)
--------------------------

After modifying the Kernel options, I compile it by doing:
--------------------------
make clean
make bzImage
make modules
make modules_install
make install
--------------------------

And when booting with the Kernel, I get this issue:
--------------------------
insmod: error inserting '/lib/dm-region-hash.ko' : -1 File exists
mount: could not find filesystem '/dev'root' x83
setuproot: moving /dev failed: No such file or directory
setuproot: error mounting /proc: No such file or directory
setuproot: error mounting /sys: No such file or directory
switchroot: mount failed: No such file or directory
Kernel panic - not syncing: Attempted to kill init!
--------------------------

Any help would be appreciated.
Posted on: 2009/12/5 13:22
Create PDF from Post Print
Top
  •  AlanBartlett
      AlanBartlett
Re: Please help on patching & compiling Kernel...
#2
Moderator
Joined: 2007/10/22
From ~/Earth/UK/England/Suffolk
Posts: 6110
Have you read the introduction to the CentOS wiki Custom Kernel article?

I should really say that you are on your own, as there is no support for kernels not built from the CentOS sources. However . . .

Please try the following:

(1) Set up your own rpm build environment / tree using your own ID. Do not use the /usr/src/ directory structure or root's ID. See: Setup an RPM Build Environment.
(2) Extract the sources from the tarball in an appropriate location.
(3) Extract the patches from the tarball in an appropriate location.
(4) Patch the sources.
(5) Copy the configuration file of the CentOS kernel that you are currently running to the top directory of the source tree. i.e. cd ~/linux-2.6.31.6; cp /boot/config-$(uname -r) .config
(6) Execute "make oldconfig" and accept the defaults to all the new questions.
(7) Execute "make menuconfig" and configure as you wish.
(8) Change directory to ~/linux-2.6.31.6/scripts/package/ and append the following lines to the mkspec file --

echo "%post"
echo "if [ \`uname -i\` == \"x86_64\" -o \`uname -i\` == \"i386\" ]; then"
echo "  if [ -f /etc/sysconfig/kernel ]; then"
echo "    /bin/sed -i -e 's/^DEFAULTKERNEL=kernel-smp$/DEFAULTKERNEL=kernel/' /etc/sysconfig/kernel || exit \$?"
echo "  fi"
echo "fi"
echo "/sbin/new-kernel-pkg --package kernel --mkinitrd --depmod --install "$KERNELRELEASE" || exit \$?"
echo ""

echo "%preun"
echo "/sbin/new-kernel-pkg --rminitrd --rmmoddep --remove "$KERNELRELEASE" || exit \$?"
echo ""

(9) Change directory to ~/linux-2.6.31.6/ and build the kernel as an rpm package --

make CONFIG_DEBUG_SECTION_MISMATCH=y binrpm-pkg 2> make-err.log | tee make-out.log

(10) Assuming a successful build (check the log files), you will then find your new kernel-2.6.31.6-1.*.rpm package in your ~/rpmbuild/RPMS/{i386|x86_64}/ directory.
(11) (Optionally) Sign the package. (i.e. rpm --addsign kernel-2.6.31.6-1.*.rpm).
(12) Install the package -- rpm -ivh kernel-2.6.31.6-1.*.rpm
(13) Reboot, specifying the new kernel -- to single user mode, for the initial test.
(14) If the initial test proves to be satisfactory . . . . . . just exit the single-user shell to go to your normal multi-user run-level and continue to test. If the initial test fails . . . . . . you're on your own.
_________________
Alan.

100% Unix & Linux. Co-founder of the ELRepo Project.
Posted on: 2009/12/5 14:38
Create PDF from Post Print
Top
  •  Farnsworth
      Farnsworth
Re: Please help on patching & compiling Kernel...
#3
Newbie
Joined: 2009/12/5
From
Posts: 3
Hi Alan,

Thank you so much for your kind reply. It is very informative. I really appreciate it.

I tried both your approach, and the one from the CentOS wiki. Unfortunately I didn't have any success.

Before coming back to this thread, I spent some time playing around with it and doing some more Google search, but still no luck. I then tried doing it on Debian and Ubuntu and I was able to compile my custom kernel, and it has been running fine for the past two weeks.

Yet I would like to learn how to use CentOS and I will post a more detailed info regarding the issues that I encountered with CentOS.

I hope you would give me some pointers when you have time.


Happy Holidays!!
Posted on: 2009/12/18 23:21
Create PDF from Post Print
Top
  •  AlanBartlett
      AlanBartlett
Re: Please help on patching & compiling Kernel...
#4
Moderator
Joined: 2007/10/22
From ~/Earth/UK/England/Suffolk
Posts: 6110
Quote:

Happy Holidays!!

Thank you.

Please be aware that everything I wrote in post #2, above, is not CentOS. I suspect your problem originates in applying steps (3) & (4) because I have recently performed steps (1), (2) & (5) to (14) with a perfectly satisfactory result for the mainline kernel-2.6.32.1 sources.

However I must stress, once again, that no support is available for self-built kernels using the mainline kernel sources and that there is only limited support available for self-built kernels using the latest CentOS kernel sources, as detailed in the Custom Kernel article. (Kernel 2.6.18-164.9.1.el5 as of the date of this posting.)
_________________
Alan.

100% Unix & Linux. Co-founder of the ELRepo Project.
Posted on: 2009/12/19 14:03
Create PDF from Post Print
Top
  •  helikaon
      helikaon
Re: Please help on patching & compiling Kernel...
#5
Jr Board Member
Joined: 2008/12/10
From
Posts: 37
Hi there guys,
i'm in exactly same boat - same problem during boot as in the first post.
Trying to compile 2.6.32.2 kernel for my centos 5.4.
reason: laptop installation, would like to get support for my wifi card.

i went along this howto:
http://www.howtoforge.com/kernel_compilation_centos

I already used this howto couple of times successfully (basicly same steps like the post alan described) in post above. My last success was 2.6.31 kernel on x86 (old P4 machine) with root fs on lvm.
However, I can't get it working on my laptop. Somehow i simply doesn't read the / (root) on lvm.
I suspect (wild guess) perhaps version mkinitrd could be involved - or even the lvm (like placement of lvm binaries)?? Damn i spent last 4 days on it, no success so far...

Just letting you know, you're not alone in this ...
Posted on: 2010/1/10 14:40
Create PDF from Post Print
Top
  •  AlanBartlett
      AlanBartlett
Re: Please help on patching & compiling Kernel...
#6
Moderator
Joined: 2007/10/22
From ~/Earth/UK/England/Suffolk
Posts: 6110
Quote:

reason: laptop installation, would like to get support for my wifi card.

Please start a new thread for your WiFi card support and post the output returned by the following --

for BUSID in $(/sbin/lspci | awk '{ IGNORECASE=1 } /net/ { print $1 }'); do /sbin/lspci -s $BUSID -m; /sbin/lspci -s $BUSID -n; done

To go to the trouble of building your own kernel just to provide a driver module is somewhat analogous to using a sledgehammer to crack a peanut (using an English analogy).

The failure to build a working version the current stable mainline kernel (2.6.32.3, as of the date of this posting) seems to be rather common. A certain NedSlider can also attest to the disk driver / not finding the root partition issue. Although there is no support for custom kernels built from the mainline sources and only limited support for custom kernels built from the latest CentOS sources (2.6.18-164.10.1.el5, as of the date of this posting), I can confirm that I am unable to reproduce the failure.

Invoking rpm -qa kernel\* | sort and uname -a on my workstation results in the following output --

$ rpm -qa kernel\* | sort
kernel-2.6.18-128.el5
kernel-2.6.18-164.el5
kernel-2.6.18-53.el5
kernel-2.6.18-8.el5
kernel-2.6.18-92.el5
kernel-2.6.32.3-1
kernel-devel-2.6.18-164.el5
kernel-devel-2.6.18-8.el5
kernel-headers-2.6.32.3-1
kernel-PAE-devel-2.6.18-164.el5
kernel-PAE-devel-2.6.18-8.el5
kernel-xen-devel-2.6.18-164.el5
kernel-xen-devel-2.6.18-8.el5
$ uname -a
Linux stxsl 2.6.32.3 #1 PREEMPT Thu Jan 7 17:17:12 GMT 2010 i686 i686 i386 GNU/Linux
_________________
Alan.

100% Unix & Linux. Co-founder of the ELRepo Project.
Posted on: 2010/1/10 15:17
Create PDF from Post Print
Top
  •  adamos
      adamos
Re: Please help on patching & compiling Kernel...
#7
Jr Board Member
Joined: 2008/6/4
From nj
Posts: 47
I haven't been able to compile the latest kernel either. I get the same errors - cannot find /. I tried it in a vm, in my workstation and on my laptop but it was a no go.

If anyone has any details how to work around this issue I would really appreciate it.

-Adam
Posted on: 2010/1/22 23:40
Create PDF from Post Print
Top
  •  michaelnel
      michaelnel
Re: Please help on patching & compiling Kernel...
#8
Professional Board Member
Joined: 2006/5/29
From San Francisco, CA
Posts: 1483
Quote:

AlanBartlett wrote:
To go to the trouble of building your own kernel just to provide a driver module is somewhat analogous to using a sledgehammer to crack a peanut (using an English analogy).


The analogy I prefer is "swatting flies with a grand piano", but either one makes the point.
Posted on: 2010/1/23 0:51
Create PDF from Post Print
Top
  •  vanecka
      vanecka
Re: Please help on patching & compiling Kernel...
#9
Newbie
Joined: 2010/1/28
From University of the Free State - South Africa
Posts: 2
Had the same problem with CentOS 5.4 and Kernel 2.6.32.5.
Seemed that the SAS or SCSI hard drive modules weren't initializing.

Fix:
Enable CONFIG_SYSFS_DEPRECATED_V2 in the kernel source configuration.
If you run "make menuconfig", browse to:
General Setup ---> enable deprecated sysfs features which may confuse old usersp, and enable this option.
Exit the menu configurator and save your changes.
Continue with kernel compiling as per usual eg:
make && make modules && make modules_install && make install
---OR---
Edit your .config file with a text editor and add/modify entry:
CONFIG_SYSFS_DEPRECATED_V2=y

Save the .config file
Continue with kernel compiling as per usual eg:
make && make modules && make modules_install && make install


Hope this helps
Posted on: 2010/1/28 22:16
Create PDF from Post Print
Top
  •  toracat
      toracat
Re: Please help on patching & compiling Kernel...
#10
Moderator
Joined: 2006/9/3
From California, US
Posts: 5172
Quote:

vanecka wrote:

Edit your .config file with a text editor and add/modify entry:
CONFIG_SYSFS_DEPRECATED_V2=y

Thank you. You are a genius. It immensely helped.

I was able to build and boot kernel 2.6.32-4 with that change applied.
_________________
Useful links: Search Forums; Forum FAQ; CentOS Wiki
Posted on: 2010/1/28 23:52
Create PDF from Post Print
Top
  •  AlanBartlett
      AlanBartlett
Re: Please help on patching & compiling Kernel...
#11
Moderator
Joined: 2007/10/22
From ~/Earth/UK/England/Suffolk
Posts: 6110
vanecka,

You are due a gold star for that observation.

As I mentioned to toracat in a private communication, you posted at just the right time -- as I was just about to have a concerted effort in resolving the issue this afternoon. It was a case of "not seeing the wood for the trees" --

$ grep CONFIG_SYSFS_DEPRECATED_V2=y /usr/local/kernels/2.6.*/config* /boot/config*
/usr/local/kernels/2.6.30.9/config-2.6.30.9:CONFIG_SYSFS_DEPRECATED_V2=y
/usr/local/kernels/2.6.32.4/config-2.6.32.4:CONFIG_SYSFS_DEPRECATED_V2=y
/usr/local/kernels/2.6.32.6/config-2.6.32.6:CONFIG_SYSFS_DEPRECATED_V2=y
/boot/config-2.6.32.6:CONFIG_SYSFS_DEPRECATED_V2=y


I just could not understand why I have (highly modified from the CentOS configuration) kernels that boot but others failed when maintaining the EL5 configuration.
_________________
Alan.

100% Unix & Linux. Co-founder of the ELRepo Project.
Posted on: 2010/1/29 14:39
Create PDF from Post Print
Top
  •  helikaon
      helikaon
Re: Please help on patching & compiling Kernel...
#12
Jr Board Member
Joined: 2008/12/10
From
Posts: 37
Good job well done!!!
Thank You vanecka, thanks to you all helpful people, you saved my gnass
While being totally frustrated i found relief in reading linux haters blog here: http://linuxhaters.blogspot.com/ which is really funny stuff )
I also found, through the pain and suffering, i love centos (and of course my wife)
Posted on: 2010/1/29 18:43
Create PDF from Post Print
Top
  •  mwisse
      mwisse
Re: Please help on patching & compiling Kernel...
#13
Newbie
Joined: 2010/3/9
From
Posts: 3
Hi,

I had the same problem with CentOS 5.4 and standard kernel 2.6.32.7, which I need for realtime extensions.
With the solution from vanecka I could boot the new standard kernel ., thanks.

There are still two error messages during the boot process:

"insmod: error inserting /lib/dm-region-hash.ko -1 fikle exists"

and a problem with ip-tables "could not restore ip-tables line 20" or so

Has someone an idea how to solve these error messages?

thanks
Michael
Posted on: 2010/3/9 11:13
Create PDF from Post Print
Top
 Top   Previous Topic   Next Topic

 


 You cannot start a new topic.
 You can view topic.
 You cannot reply to posts.
 You cannot edit your posts.
 You cannot delete your posts.
 You cannot add new polls.
 You cannot vote in polls.
 You cannot attach files to posts.
 You cannot post without approval.




"Linux" is a registered trademark of Linus Torvalds. | All other trademarks are property of their respective owners. | All other content is Copyright @ 2004-2009 by the CentOS Project or "each individual contributor (forums, comments, etc.) unless otherwise assigned".| Theme based on a theme by 7dana.com