LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-08-2011, 06:58 PM   #1
Equinn
LQ Newbie
 
Registered: Feb 2008
Location: California
Distribution: Slackware 13.1
Posts: 24

Rep: Reputation: 0
How does one apply a kernel patch?


Hi All,

This is a newbie question because I have no clue how to do this. It may belong in the Slackware section, but I'll see how this goes.

I just want to upgrade my Slackware 13.1 kernel (2.6.33.4) to the latest stable kernel from kernel.org (2.6.38.2). I have never done anything like this and I am a Linux newbie, so I would appreciate a "Kernel Patching for Dummies" version if possible.

I did do a search on this forum and most of what I read was over my head.

I found an FAQ on kernelnewbies.org on "How To Apply A Patch" but when I attempted what they suggested, it said it couldn't find the file to patch at line 5 and asked me which file to patch. So I CTRL-Z'd out of there and came here.

Here's what I tried:

Code:
cd usr/src/linux
bzip2 -dc /usr/src/patch-2.6.38.2.bz2 | patch -p1 --dry-run
If you can point me in the right direction, that would be great.

Thanks,
Equinn
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 04-08-2011, 07:36 PM   #2
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
I'd suppose that the patch you downloaded will only update the kernel-sources from 2.6.38.1 to 2.6.38.2.
If you want to update from 2.6.33 to 2.6.38, you'll have to download the full kernelsources.
I'd recommend to unpack it in the /tmp directory as a normal user, then copy your .config (of the old kernel) file into the kerneldirectory (/tmp/linux-2.6.38.2/) and apply the
Code:
make oldconfig
command. this will copy the configuration of the old to the new kernel and ask you for the additional features (which are not yet present in 2.6.33).
Afterwards you may run make and then (as root) copy the whole kernelsource to /usr/src.
Then apply (as root) make modules_install and copy the kernelimage (arch/x86/boot/bzimage) into your /boot directory. Don't forget to edit lilo.conf and run lilo.

Markus

Last edited by markush; 04-08-2011 at 07:38 PM.
 
1 members found this post helpful.
Old 04-08-2011, 09:01 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,839

Rep: Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822
There is a README in the top level of your source tree - read it.
In the Documentation directory there is a "applying-patches.txt" - it has more specific/expansive info. Reading that would also be a good use of your time.

What (extra) patches Pat has incorporated I have no idea. That would preclude directly applying the intervening consolidated patch levels to upgrade the kernel you now have.

Have fun ...
 
2 members found this post helpful.
Old 04-09-2011, 01:04 AM   #4
blink182
LQ Newbie
 
Registered: Oct 2010
Posts: 29

Rep: Reputation: 0
You will need to compile the kernel by yourself in order to upgrade your kernel . Have a look at this page : http://www.howtoforge.com/kernel_com...debian_etch_p2 and your patch has to be patched inside the kernel sources . Good luck !

Regards ,
Blink
 
Old 04-09-2011, 05:35 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,383

Rep: Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199
If you are going to all the trouble of compiling a custom kernel then look at gentoo and LFS for how to select more options to be exact for your use and system.
 
Old 04-11-2011, 08:00 PM   #6
Equinn
LQ Newbie
 
Registered: Feb 2008
Location: California
Distribution: Slackware 13.1
Posts: 24

Original Poster
Rep: Reputation: 0
Hi Markus:

Thank you for your help. I was able to follow you (sort of) up until the part about 'make modules_install'. I tried it from the source directory and the root and it didn't work on either. I looked in the src directory and found three modules.* files.

Code:
Module.sysvers
modules.builtin
modules.order
I don't know what they mean or if I'm supposed to do anything with them.

BTW - when I did the 'make oldconfig', I thought I was going to be there all day answering questions. Also, I had no idea what to answer. It seemed to be giving me the suggested answer by capitalizing the letter. So I just went with the captial letter as my answers. It seems to have worked. Was that the right thing to do?

Quote:
Originally Posted by markush View Post
Then apply (as root) make modules_install and copy the kernelimage (arch/x86/boot/bzimage) into your /boot directory. Don't forget to edit lilo.conf and run lilo.

Markus

Thanks,
Equinn
 
Old 04-12-2011, 03:04 AM   #7
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Well, what I meant was to build the kernel in /tmp, then copy the sourcetree to /usr/src and install the kernel
Code:
cp -r /tmp/linux-2.6.38.2 /usr/src
cd /usr/src/linux-2.6.38.2
make modules_install
cp arch/x86/boot/bzimage /boot/vmlinuz-2.6.38.2
cp .config /boot/config-2.6.38.2
cp System.map /boot/System.map-2.6.38.2
afterwards you'll have to edit the lilo.conf file and run lilo.

If "make modules_install" does nothing, either you forgot to build the kernel with make or you didn't configure any modules. Check /lib/modules if there is a directory for the 2.6.38.2 kernel.

Markus
 
2 members found this post helpful.
Old 04-12-2011, 03:20 AM   #8
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,838

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Are you are part of sources group?

These are the permissions that I had to use to build cs-46xx driver. Maybe someone can help you with setting the right permissions as I'm not sure thee are exactly the ones you need, but you do need some.
$ sudo chgrp -R src /usr/src
$ sudo chmod -R g+w /usr/src
 
Old 04-12-2011, 03:26 AM   #9
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Hello EDDY1,

I recommended to build the kernel in the /tmp directory as a normal user and afterwards as root copy the complete sources with the new built kernel into the /usr/src directory.

Of course the installation is done as root.

Markus
 
2 members found this post helpful.
Old 04-12-2011, 03:57 AM   #10
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,838

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
How are you Markush?
Thank you for the information, I'm glad you pointed that out, as it gives me a better understanding of purpose or use of tmp.
Also it appears to be safer and tmp can be removed.

Is this what I've been reading about as far as out-of-tree kernel?

Last edited by EDDY1; 04-12-2011 at 04:01 AM.
 
Old 04-12-2011, 04:00 AM   #11
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Well, there is one additional point to consider. Here we have Slackware, it is no problem to build the kernel in the /tmp directory. But there are other distributions which whipe the whole /tmp directory when the systems starts. In such a case it would be better to build the kernel within the /home directory of the user.

Markus
 
1 members found this post helpful.
Old 04-12-2011, 02:17 PM   #12
Equinn
LQ Newbie
 
Registered: Feb 2008
Location: California
Distribution: Slackware 13.1
Posts: 24

Original Poster
Rep: Reputation: 0
Do I have to do the build in /tmp as a normal user? I have been logged in as 'root' all this time. And I just installed the system and there are no other users configured.
 
Old 04-12-2011, 02:32 PM   #13
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Hi,

as far as I remember "the Slackware way" is to build the kernel in /tmp as a normal user. I'd strongly recommend to add a normal useraccount for your computer. You may use the command "adduser".

Quote:
Originally Posted by Equinn
...I have been logged in as 'root' all this time...
Installation can only be done by root, but the first thing I do on a new installed System is adding a user and log in as the new user. Beeing always root is very dangerous.

Markus
 
1 members found this post helpful.
Old 04-12-2011, 05:24 PM   #14
Equinn
LQ Newbie
 
Registered: Feb 2008
Location: California
Distribution: Slackware 13.1
Posts: 24

Original Poster
Rep: Reputation: 0
Markus,

OK - I have been trying this all day (as root). I will try again with adding a user. At this point, I have royally messed things up. Now the system won't boot at all. I'm getting the error:

Code:
No filesystem could mount root, tried: romfs
Kernel panic - not syncing: VFS: unable to mount root fs on unknown-block(8,1)
Pid: 1, comm: swapper Not tainted 2.6.38.2-smp #1
Call Trace:
  [######] blah blah blah
  [######] and so on and so forth
So anyway, I will be starting over with reinstalling Slackware 13.1 from the CD and trying again.

BTW - when I ran 'make modules', I got some messages like the below. Can you tell me if this is a problem or not? Judging from the fact I can't boot, I'm guessing yes. So what do I do about it?
Code:
   CHK include/linus/version.h
   CHK include/generated/utsrelease.h
   CALL scripts/checksyscalls.sh
   Building modules, stage 2.
   MODPOST 2468 modules
WARNING: modpost: Found 19 section mismatch(es).
To see full details build your kernel with
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
After that, I ran 'make modules_install', which seems to have completed without error. Then I copied all the files you suggested and edited lilo.conf. I wasn't sure what I should do there. I just changed the line that said 'image = /boot/vmlinuz' to 'image = /boot/vmlinuz-2.6.38.2'. Is that what you meant?

And then I just typed 'lilo' from the command prompt to run it.

Thanks,
Equinn
 
Old 04-12-2011, 05:47 PM   #15
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
You've forgotten to configure the SATA-driver in the kernel, so the kernel cannot recognize the harddrive. You should boot with the original-Slackware-kernel. You must not build the SATA-driver as a module. Also be sure to configure the kernel for the filesystems you have on your computer.

The command "make modules" is not yet needed, this is a command from the old times with the 2.4-kernel.

Markus
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
canīt apply kernel-patch syntax85 Linux - Newbie 4 08-27-2009 09:03 AM
Apply a kernel patch android6011 Ubuntu 2 12-05-2007 06:57 PM
How to apply kernel patch and customise? subaruwrx Linux - Software 7 12-30-2004 10:40 PM
Kernel Patch will not Apply. mudelf Linux - General 10 10-08-2003 06:22 AM
How To Apply Patch To Kernel WILLIAMATHOMAS Linux - Software 2 02-12-2003 01:57 PM


All times are GMT -5. The time now is 03:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration