LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 08-27-2003, 04:33 PM   #1
sb73542
Member
 
Registered: Jul 2003
Distribution: Ubuntu, SUSE
Posts: 79

Rep: Reputation: 15
How to install preemptive kernel patch?


Hi, I have RH9 with a recompiled kernel, named 2.4.20-mykernel . I downloaded preempt-kernel-rml-2.4.20-3.patch and put it in /usr/src. How do I install it? I tried "patch -p0 --verbose <preempt-kernel-rml-2.4.20-3.patch" but it said "Hmm... Looks like a unified diff to me...
can't find file to patch at input line 101
Perhaps you used the wrong -p or --strip option?" Once I get through patching, do I have to recompile the kernel again? Do I have to enable preempting in the kernel options? Should I bother with the low-latency patch while I'm at it? Thanks a lot!!
 
Old 08-28-2003, 01:02 AM   #2
chazmati
LQ Newbie
 
Registered: Aug 2003
Posts: 4

Rep: Reputation: 0
To get that patch to work, you need to

$ cd /usr/src/linux-2.4
$ patch -p0 < ../preempt-kernel-rml-2.4.20-3.patch

You were trying to run it from one level higher up in the directory hierarcy than intended. (If you're interested, try "$ less patchfile" to see what it looks like, you'll see that the filenames listed are similar to the files in /usr/src/linux-2.4.

If the patch file contents looked like this:
usr/src/linux-2.4/CREDITS
usr/src/linux-2.4/Documentation/Configure.help
usr/src/linux-2.4/Documentation/preempt-locking.txt
usr/src/linux-2.4/MAINTAINERS
usr/src/linux-2.4/arch/alpha/kernel/process.c
usr/src/linux-2.4/arch/arm/config.in
usr/src/linux-2.4/arch/arm/kernel/entry-armv.S
usr/src/linux-2.4/arch/arm/tools/getconstants.c

Then you'd want to run the patch from the / level. Or better yet, still do a "$ cd /usr/src/linux-2.4" and the "$ patch -p3 < patchfile" to strip off the first three directory levels from the patchfile. You can't trust everybody, and if you run a patchfile from / some nefarious soul might try to patch your /etc/passwd or something.

Anyway, you will need to recompile your kernel, follow instructions in /usr/src/linux-2.4/README or see the RedHat guides for instructions on compiling a custom kernel. Not sure if RedHat already has applied this patch to their distribution's kernel, you'll probably know if the patch fails.
 
Old 08-28-2003, 02:03 PM   #3
sb73542
Member
 
Registered: Jul 2003
Distribution: Ubuntu, SUSE
Posts: 79

Original Poster
Rep: Reputation: 15
Here's the output:

[root@localhost linux-2.4]# patch -p0 < ../preempt-kernel-rml-2.4.20-3.patch
can't find file to patch at input line 101
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|
| CREDITS | 2
| Documentation/Configure.help | 11 ++++
| Documentation/preempt-locking.txt | 104 ++++++++++++++++++++++++++++++++++++++
| MAINTAINERS | 8 ++
| arch/alpha/kernel/process.c | 1
| arch/arm/config.in | 2
| arch/arm/kernel/entry-armv.S | 40 ++++++++++++++
| arch/arm/tools/getconstants.c | 6 ++
| arch/i386/config.in | 8 ++
| arch/i386/kernel/cpuid.c | 4 +
| arch/i386/kernel/entry.S | 49 +++++++++++++++++
| arch/i386/kernel/i387.c | 3 +
| arch/i386/kernel/ioport.c | 5 +
| arch/i386/kernel/irq.c | 15 ++++-
| arch/i386/kernel/ldt.c | 2
| arch/i386/kernel/microcode.c | 3 +
| arch/i386/kernel/msr.c | 15 +++--
| arch/i386/kernel/mtrr.c | 6 ++
| arch/i386/kernel/smp.c | 29 ++++++++--
| arch/i386/kernel/traps.c | 2
| arch/i386/lib/dec_and_lock.c | 1
| arch/i386/mm/init.c | 2
| arch/mips/config-shared.in | 1
| arch/mips/kernel/i8259.c | 1
| arch/mips/kernel/irq.c | 29 ++++++++++
| arch/mips/mm/extable.c | 1
| arch/ppc/config.in | 2
| arch/ppc/kernel/entry.S | 40 ++++++++++++++
| arch/ppc/kernel/irq.c | 52 ++++++++++++++++---
| arch/ppc/kernel/mk_defs.c | 3 +
| arch/ppc/kernel/open_pic.c | 9 ++-
| arch/ppc/kernel/setup.c | 14 +++++
| arch/ppc/kernel/temp.c | 8 ++
| arch/ppc/lib/dec_and_lock.c | 1
| arch/ppc/mm/tlb.c | 16 +++++
| arch/sh/config.in | 1
| arch/sh/kernel/entry.S | 104 +++++++++++++++++++++++++++++++++++---
| arch/sh/kernel/irq.c | 17 ++++++
| drivers/ieee1394/csr.c | 1
| drivers/sound/sound_core.c | 1
| fs/adfs/map.c | 1
| fs/exec.c | 2
| fs/fat/cache.c | 1
| fs/nls/nls_base.c | 1
| include/asm-arm/dma.h | 1
| include/asm-arm/hardirq.h | 1
| include/asm-arm/pgalloc.h | 8 ++
| include/asm-arm/smplock.h | 11 ++++
| include/asm-arm/softirq.h | 8 +-
| include/asm-arm/system.h | 7 ++
| include/asm-i386/desc.h | 5 +
| include/asm-i386/hardirq.h | 14 +++--
| include/asm-i386/highmem.h | 7 ++
| include/asm-i386/hw_irq.h | 19 +++++-
| include/asm-i386/i387.h | 3 -
| include/asm-i386/pgalloc.h | 12 ++++
| include/asm-i386/smplock.h | 14 +++++
| include/asm-i386/softirq.h | 11 ++--
| include/asm-i386/spinlock.h | 18 +++---
| include/asm-i386/system.h | 7 ++
| include/asm-mips/smplock.h | 15 +++++
| include/asm-mips/softirq.h | 3 +
| include/asm-mips/system.h | 14 +++++
| include/asm-ppc/dma.h | 1
| include/asm-ppc/hardirq.h | 9 ++-
| include/asm-ppc/highmem.h | 6 +-
| include/asm-ppc/hw_irq.h | 6 ++
| include/asm-ppc/mmu_context.h | 4 +
| include/asm-ppc/pgalloc.h | 9 +++
| include/asm-ppc/smplock.h | 14 +++++
| include/asm-ppc/softirq.h | 13 ++++
| include/asm-sh/hardirq.h | 2
| include/asm-sh/smplock.h | 85 ++++++++++++++++++++++++++++---
| include/asm-sh/softirq.h | 3 +
| include/asm-sh/system.h | 13 ++++
| include/linux/brlock.h | 10 +--
| include/linux/dcache.h | 56 +++++++++++---------
| include/linux/fs_struct.h | 13 +++-
| include/linux/sched.h | 12 ++++
| include/linux/smp_lock.h | 2
| include/linux/spinlock.h | 82 +++++++++++++++++++++++++++--
| include/linux/tqueue.h | 31 ++++++-----
| kernel/exit.c | 9 ++-
| kernel/fork.c | 7 ++
| kernel/ksyms.c | 3 +
| kernel/sched.c | 48 ++++++++++++++++-
| kernel/softirq.c | 13 +++-
| lib/dec_and_lock.c | 1
| mm/slab.c | 5 +
| net/core/dev.c | 11 +++-
| net/core/skbuff.c | 30 ++++++----
| net/socket.c | 2
| net/sunrpc/pmap_clnt.c | 1
| 93 files changed, 1138 insertions(+), 165 deletions(-)
|
|
|diff -urN linux-2.4.20/arch/alpha/kernel/process.c linux/arch/alpha/kernel/process.c
|--- linux-2.4.20/arch/alpha/kernel/process.c 2001-09-30 15:26:08.000000000 -0400
|+++ linux/arch/alpha/kernel/process.c 2003-04-11 17:03:05.182081640 -0400
--------------------------
File to patch:

It looks like it partially worked, but didn't finish? Is there something strange about Redhat's kernel in the /net section? I've had the kernel recompile process segfault and produce errors ("error 2") before, when working in the /net directory. Thanks, sorry for my slowness.
 
Old 08-28-2003, 04:24 PM   #4
chazmati
LQ Newbie
 
Registered: Aug 2003
Posts: 4

Rep: Reputation: 0
Oops. Sorry, that should have been "$ patch -p1 < ../preempt-kernel-rml-2.4.20-3.patch" because the guts of the patch
Code:
diff -urN linux-2.4.20/arch/alpha/kernel/process.c linux/arch/alpha/kernel/process.c
--- linux-2.4.20/arch/alpha/kernel/process.c    2001-09-30 15:26:08.000000000 -0400
+++ linux/arch/alpha/kernel/process.c   2003-04-11 17:03:05.182081640 -0400
@@ -186,6 +186,7 @@
        args.mode = mode;
        args.restart_cmd = restart_cmd;
 #ifdef CONFIG_SMP
+       preempt_disable();
        smp_call_function(common_shutdown_1, &args, 1, 0);
 #endif
        common_shutdown_1(&args);
specify the top directories from which the patch was generated: linux-2.4.20 and linux. You need the -p1 option to strip off this top level.

I just downloaded linux-2.4.20.tar.bz2 and preempt-kernel-rml-2.4.20-3.patch and did the following:
Code:
$ tar -xjf linux-2.4.20.tar.bz2
$ cd linux-2.4.20
$ patch -p1 < ../preempt-kernel-rml-2.4.20-3.patch
patching file arch/alpha/kernel/process.c
patching file arch/arm/config.in
patching file arch/arm/kernel/entry-armv.S
patching file arch/arm/tools/getconstants.c
----many more patches snipped----
patching file net/sunrpc/pmap_clnt.c
$
 
Old 08-28-2003, 09:09 PM   #5
Nevion
Member
 
Registered: Aug 2003
Distribution: Slackware 9.0
Posts: 31

Rep: Reputation: 15
try the wolk version of kernel 2.4.20, it works great and has about 8 patches that make it the most kick ass kernel around (its got low latency and a ton of other crap (including preemptile) in it and they all have bugfixes) ps, just do cat (or zcat or bzcat depending on what compression the patches are in) like this: bzcat blah-2.4.20-2.4.21.bz2 | patch -p1 from inside the kernel source directory with the patches in there too
 
Old 08-30-2003, 03:15 PM   #6
sb73542
Member
 
Registered: Jul 2003
Distribution: Ubuntu, SUSE
Posts: 79

Original Poster
Rep: Reputation: 15
The WOLK project looks neat. I'm looking at the files in http://sourceforge.net/project/showf...ease_id=127402 . I'm confused about whether this is a patch or a kernel? Can I get all the good stuff by just downloading linux-2.4.20-wolk4.0s-to-4.1s.patch.bz2 ? Or do I need an entire WOLK kernel? I can really only download patches, as I have EXTREMELY slow dialup. Please let me know. Thanks!
 
Old 08-30-2003, 06:11 PM   #7
Nevion
Member
 
Registered: Aug 2003
Distribution: Slackware 9.0
Posts: 31

Rep: Reputation: 15
if you have the original 2.4.20 kernel source untouched by anything at all, then all you must do is download the biggest patch that says 2.4.20-2.4.20wolk4.0s. But most likely you'll probabbly want to (and have to) start out with wolks "full kernel" hm, they now offer a 4.9 full kernel though so you could also download that instead of all those patches with the exception of the patch after that file.

Last edited by Nevion; 08-30-2003 at 06:14 PM.
 
  


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
how to install a kernel patch? irfanhab Linux - General 1 03-16-2005 07:40 AM
Patch in newer kernel during install? epperson Fedora - Installation 2 01-19-2005 01:18 PM
gentoo preemptive kernel lyx0m Linux - General 4 10-27-2003 12:10 AM
preemptive patch + nvidia kernel compilation neenee Slackware 11 08-26-2003 06:45 PM
install kernel patch niton Linux - Newbie 2 07-16-2002 10:51 AM


All times are GMT -5. The time now is 09:53 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration