View previous topic :: View next topic |
Author |
Message |
gnychis Veteran
Joined: 23 Mar 2005 Posts: 1004 Location: Pittsburgh, PA
|
Posted: Mon Apr 03, 2006 6:27 am Post subject: need help installing a kernel patch |
|
|
Hi,
I have a patch which has a readme "It is designed for and fully tested under Linux kernel 2.4.20" ... therefore I went to ftp.kernel.org and downloaded linux-2.4.20.tar.gz
I extracted the kernel, did a "make mrproper", copied the patch to /usr/src/linux (a new created symlink to kernel-2.4.20)
Then i tried installing the patch:
Code: |
patch -p0 < endhost-2.4.patch
|
Code: |
radon-ini linux # patch -p0 < endhost-2.4.patch
patching file include/net/sock.h
Hunk #1 succeeded at 418 with fuzz 1 (offset -11 lines).
patching file include/net/tcp.h
Hunk #1 succeeded at 405 (offset -1 lines).
Hunk #2 succeeded at 416 (offset -1 lines).
Hunk #3 succeeded at 1443 (offset -9 lines).
patching file include/linux/tcp.h
patching file net/ipv4/tcp.c
Hunk #1 succeeded at 2391 (offset -2 lines).
patching file net/ipv4/tcp_input.c
Hunk #1 succeeded at 108 (offset -2 lines).
Hunk #2 succeeded at 254 (offset -2 lines).
Hunk #3 succeeded at 483 (offset -2 lines).
Hunk #4 succeeded at 703 (offset -2 lines).
Hunk #5 FAILED at 1064.
Hunk #6 succeeded at 1025 (offset -85 lines).
Hunk #7 succeeded at 1326 (offset -85 lines).
Hunk #8 succeeded at 1343 (offset -85 lines).
Hunk #9 succeeded at 1385 (offset -85 lines).
Hunk #10 succeeded at 1486 (offset -85 lines).
Hunk #11 succeeded at 1625 (offset -86 lines).
Hunk #12 succeeded at 1677 (offset -86 lines).
Hunk #13 succeeded at 1764 (offset -86 lines).
Hunk #14 FAILED at 1963.
Hunk #15 FAILED at 2037.
Hunk #16 succeeded at 2053 (offset -124 lines).
Hunk #17 succeeded at 2159 (offset -124 lines).
Hunk #18 succeeded at 3088 (offset -124 lines).
3 out of 18 hunks FAILED -- saving rejects to file net/ipv4/tcp_input.c.rej
patching file net/ipv4/tcp_output.c
patching file net/ipv4/fp16.c
|
I am not sure how, if this patch was made for 2.4.20, and i downloaded a clean kernel, how hunks could be failing? Am i doing anything wrong?
Thanks!
George _________________ <---- me and Richard Stallman |
|
Back to top |
|
|
frostschutz Advocate
Joined: 22 Feb 2005 Posts: 2977 Location: Germany
|
Posted: Mon Apr 03, 2006 12:20 pm Post subject: Re: need help installing a kernel patch |
|
|
gnychis wrote: | I have a patch which has a readme "It is designed for and fully tested under Linux kernel 2.4.20" ... therefore I went to ftp.kernel.org and downloaded linux-2.4.20.tar.gz |
This is, like, a really really old kernel. Not a very good idea to use it.
gnychis wrote: | I am not sure how, if this patch was made for 2.4.20, and i downloaded a clean kernel, how hunks could be failing? Am i doing anything wrong? |
Well, have a look at the patch.rej file, and you'll see what failed. Before fixing that patch for 2.4.20, you should check wether whatever functionality the patch provided is already included with newer kernels, or wether there are newer patches for more recent kernels available. If there is none, modify the patch so that it will work with the up-to-date kernel. Doing the same work for an old kernel is hadly worth the effort. |
|
Back to top |
|
|
gnychis Veteran
Joined: 23 Mar 2005 Posts: 1004 Location: Pittsburgh, PA
|
Posted: Tue Apr 04, 2006 4:27 pm Post subject: |
|
|
ok i'm trying to install it in the 2.4.32 kernel, its definately not a feature built into the kernel
I'm going to show my output, but I can't show the code its trying to insert because its not in the GPL and its not my code :\
I get the following output trying to apply the patch:
Code: |
monster linux # patch -p0 < endhost-2.4.patch
patching file include/net/sock.h
Hunk #1 FAILED at 429.
1 out of 1 hunk FAILED -- saving rejects to file include/net/sock.h.rej
patching file include/net/tcp.h
Hunk #1 succeeded at 424 (offset 18 lines).
Hunk #2 succeeded at 435 (offset 18 lines).
Hunk #3 succeeded at 1560 (offset 108 lines).
patching file include/linux/tcp.h
patching file net/ipv4/tcp.c
Hunk #1 succeeded at 2401 (offset 8 lines).
patching file net/ipv4/tcp_input.c
Hunk #1 succeeded at 130 (offset 20 lines).
Hunk #2 succeeded at 276 (offset 20 lines).
Hunk #3 succeeded at 391 with fuzz 2 (offset -94 lines).
Hunk #4 succeeded at 909 (offset 204 lines).
Hunk #5 succeeded at 1270 (offset 204 lines).
Hunk #6 succeeded at 1318 (offset 208 lines).
Hunk #7 succeeded at 1619 (offset 208 lines).
Hunk #8 succeeded at 1649 (offset 221 lines).
Hunk #9 succeeded at 1694 (offset 224 lines).
Hunk #10 succeeded at 1796 with fuzz 2 (offset 225 lines).
Hunk #11 succeeded at 1936 (offset 225 lines).
Hunk #12 succeeded at 1988 (offset 225 lines).
Hunk #13 succeeded at 2138 with fuzz 1 (offset 288 lines).
Hunk #14 succeeded at 2572 (offset 523 lines).
Hunk #15 succeeded at 2875 with fuzz 2 (offset 752 lines).
Hunk #16 succeeded at 2931 (offset 754 lines).
Hunk #17 succeeded at 3037 (offset 754 lines).
Hunk #18 succeeded at 3966 (offset 754 lines).
patching file net/ipv4/tcp_output.c
Hunk #1 succeeded at 116 (offset 3 lines).
Hunk #2 FAILED at 227.
Hunk #3 succeeded at 574 (offset 16 lines).
1 out of 3 hunks FAILED -- saving rejects to file net/ipv4/tcp_output.c.rej
patching file net/ipv4/fp16.c
|
socket.h reject file:
Code: |
monster linux # cat include/net/sock.h.rej
***************
*** 429,434 ****
__u32 frto_highmark; /* snd_nxt when RTO occurred */
unsigned long last_synq_overflow;
};
--- 429,452 ----
__u32 frto_highmark; /* snd_nxt when RTO occurred */
unsigned long last_synq_overflow;
+
+ #ifdef SOME_DEFINE
+ int blahblah;
+ struct a_structure {
+ int a_declaration;
+ ...........
+ .............
+
+ #define ANOTHER_DEFINE (0x7fff)
+ int some_more_declarations;
+ ................
+ ...............
+
+ ..........
+ .............
+ } a_struct;
+ #endif
+
};
|
net/ipv4/tcp_output.c reject file:
Code: |
monster linux # cat net/ipv4/tcp_output.c.rej
***************
*** 226,231 ****
tcp_header_size += (TCPOLEN_SACK_BASE_ALIGNED +
(tp->eff_sacks * TCPOLEN_SACK_PERBLOCK));
}
th = (struct tcphdr *) skb_push(skb, tcp_header_size);
skb->h.th = th;
skb_set_owner_w(skb, sk);
--- 227,264 ----
tcp_header_size += (TCPOLEN_SACK_BASE_ALIGNED +
(tp->eff_sacks * TCPOLEN_SACK_PERBLOCK));
}
+ #ifdef A_DEFINE
+ if ((tp->blah_blah) && !(tcb->flags &
+ (TCPCB_FLAG_SYN | TCPCB_FLAG_FIN | TCPCB_FLAG_RST))) {
+ ......
+ ............
+ ............
+ ............
+ ............
+ ............
+ ............
+ ............
+ ............
+ }
+
+ /*
+ *............
+ * ............
+ * ............
+ * ............
+ *............
+ */
+ if (something_is_true &&
+ (more_is_true)) {
+ ............
+ ............
+ }
+ /* ............
+ * ............
+ * ............
+ */
+ }
+ #endif
th = (struct tcphdr *) skb_push(skb, tcp_header_size);
skb->h.th = th;
skb_set_owner_w(skb, sk);
|
Sorry, that really sucked, bless the GPL _________________ <---- me and Richard Stallman |
|
Back to top |
|
|
frostschutz Advocate
Joined: 22 Feb 2005 Posts: 2977 Location: Germany
|
Posted: Tue Apr 04, 2006 5:39 pm Post subject: |
|
|
Not GPL? Well, too bad then.
Anyway, it looks trivial to fix, as the patch does not seem to be modifying any code, just adding some. And it failed to do so on 2 occassions due to changes around the area where the code was added. So in the end, all you should have to do, is add the stuff behind the + lines of the reject files manually somewhere near the designated position.
If you're lucky and there were no other changes (to some API or such), which is likely since the 2.4 series pretty much got a feature freeze on since it's stable, you'll be able to compile 2.4.32 with your patch. |
|
Back to top |
|
|
gnychis Veteran
Joined: 23 Mar 2005 Posts: 1004 Location: Pittsburgh, PA
|
Posted: Tue Apr 04, 2006 6:04 pm Post subject: |
|
|
thanks a bunch frosts
one last question... i need to apply this patch on about 10 different computers, and instead of me manually making the changes... after i manually make the changes on 1 computer, how can i update the patch file so i don't get hunk failures applying to the other computers?
Thanks!
George _________________ <---- me and Richard Stallman |
|
Back to top |
|
|
vipernicus Veteran
Joined: 17 Jan 2005 Posts: 1462 Location: Your College IT Dept.
|
Posted: Tue Apr 04, 2006 6:46 pm Post subject: |
|
|
gnychis wrote: | thanks a bunch frosts
one last question... i need to apply this patch on about 10 different computers, and instead of me manually making the changes... after i manually make the changes on 1 computer, how can i update the patch file so i don't get hunk failures applying to the other computers?
Thanks!
George |
Once you get it working on one, re-diff the image with a clean image. 'diff -Nurp' _________________ Viper-Sources Maintainer || nesl247 Projects || vipernicus.org blog |
|
Back to top |
|
|
gnychis Veteran
Joined: 23 Mar 2005 Posts: 1004 Location: Pittsburgh, PA
|
Posted: Wed Apr 05, 2006 5:13 am Post subject: |
|
|
i was wondering if someone could double check that I am inserting the code in the correct place...
scroll up and take a look at my tcp_output.c reject file...
here is the new related hunk of code for tcp_output.c in the 2.4.32 kernel:
Code: |
tcp_header_size += (TCPOLEN_SACK_BASE_ALIGNED + // LINE 1476
(tp->eff_sacks * TCPOLEN_SACK_PERBLOCK));
}
// MARK 1
/*
* If the connection is idle and we are restarting,
* then we don't want to do any Vegas calculations
* until we get fresh RTT samples. So when we
* restart, we reset our Vegas state to a clean
* slate. After we get acks for this flight of
* packets, _then_ we can make Vegas calculations
* again.
*/
if (tcp_is_vegas(tp) && tcp_packets_in_flight(tp) == 0)
tcp_vegas_enable(tp);
// MARK 2
th = (struct tcphdr *) skb_push(skb, tcp_header_size);
skb->h.th = th;
skb_set_owner_w(skb, sk);
// MARK 3
/* Build TCP header and checksum it. */
|
according to the reject file, should i enter the code at mark 1 2 or 3 ? _________________ <---- me and Richard Stallman |
|
Back to top |
|
|
gnychis Veteran
Joined: 23 Mar 2005 Posts: 1004 Location: Pittsburgh, PA
|
Posted: Thu Apr 06, 2006 1:02 am Post subject: |
|
|
if you go to my original post, shouldn't i worry about the offset of like 85 lines and such? thats a huge offset... and i found out after trying to compile that the original "patch -p0" command i used put some code in the completely wrong function :\ _________________ <---- me and Richard Stallman |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|