<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://t2bwiki.iihe.ac.be/index.php?action=history&amp;feed=atom&amp;title=PatchKernel</id>
	<title>PatchKernel - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://t2bwiki.iihe.ac.be/index.php?action=history&amp;feed=atom&amp;title=PatchKernel"/>
	<link rel="alternate" type="text/html" href="https://t2bwiki.iihe.ac.be/index.php?title=PatchKernel&amp;action=history"/>
	<updated>2026-05-16T11:26:36Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://t2bwiki.iihe.ac.be/index.php?title=PatchKernel&amp;diff=207&amp;oldid=prev</id>
		<title>Maintenance script: Created page with &quot; === Info === *http://wiki.centos.org/HowTos/Custom_Kernel  === Patch the kernel === *Mainly to include new hardware drivers (eg 3ware controller) *prepare **download ke...&quot;</title>
		<link rel="alternate" type="text/html" href="https://t2bwiki.iihe.ac.be/index.php?title=PatchKernel&amp;diff=207&amp;oldid=prev"/>
		<updated>2015-08-26T12:28:55Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot; === Info === *http://wiki.centos.org/HowTos/Custom_Kernel  === Patch the kernel === *Mainly to include new hardware drivers (eg 3ware controller) *prepare **download ke...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
=== Info ===&lt;br /&gt;
*http://wiki.centos.org/HowTos/Custom_Kernel&lt;br /&gt;
&lt;br /&gt;
=== Patch the kernel ===&lt;br /&gt;
*Mainly to include new hardware drivers (eg 3ware controller)&lt;br /&gt;
*prepare&lt;br /&gt;
**download kernel source rpms and install them &lt;br /&gt;
**then (maybe check also if there are no different versions of the kernel source on the machine, so you are sure this spec file is the one you need!)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /usr/src/redhat/SPECS&lt;br /&gt;
cp kernel-2.6.spec kernel-2.6.spec-orig&lt;br /&gt;
rpmbuild -bp kernel-2.6.spec&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
**now you have the OS patched kernel in &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/src/redhat/BUILD/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*patch&lt;br /&gt;
**3ware&lt;br /&gt;
**get the drivers you need for your kernel release&lt;br /&gt;
**untar files&lt;br /&gt;
**make a copy of the kernel tree&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /usr/src/redhat/BUILD/kernel-&amp;lt;version&amp;gt;&lt;br /&gt;
cp -R linux-&amp;lt;version&amp;gt; linux2-&amp;lt;version&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
**copy the new &amp;lt;tt&amp;gt;3w-9xxx.c&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;3w-9xxx.h&amp;lt;/tt&amp;gt; files to &amp;lt;tt&amp;gt;/usr/src/redhat/BUILD/kernel-&amp;lt;version&amp;gt;/linux2-&amp;lt;version&amp;gt;/drivers/scsi&amp;lt;/tt&amp;gt;&lt;br /&gt;
**goto &amp;lt;tt&amp;gt;/usr/src/redhat/BUILD/kernel-&amp;lt;version&amp;gt;&amp;lt;/tt&amp;gt; and make the patch with (the order is &amp;lt;tt&amp;gt;diff old new&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -ur linux-&amp;lt;version&amp;gt; linux2-&amp;lt;version&amp;gt; &amp;gt; 3w-&amp;lt;driver version&amp;gt;-&amp;lt;kernel version&amp;gt;.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
**copy the 3ware patch file to &amp;lt;tt&amp;gt;/usr/src/redhat/SOURCES&amp;lt;/tt&amp;gt;&lt;br /&gt;
**goto &amp;lt;tt&amp;gt;/usr/src/redhat/SPECS&amp;lt;/tt&amp;gt; and open the &amp;lt;tt&amp;gt;kernel-2.6.spec&amp;lt;/tt&amp;gt; file&lt;br /&gt;
**you need to change the name of the kernel by modifying some version number&lt;br /&gt;
***for centos plus kernels, you can add your own identfer to the &amp;lt;tt&amp;gt;%define dist&amp;lt;/tt&amp;gt; field.&lt;br /&gt;
***locate the last patch in the spec file. Look for the last line which starts with &amp;lt;tt&amp;gt;Patch&amp;lt;digits&amp;gt;: &amp;lt;some filename&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
***create a new Patch entry pointing to the 3w patch file you made. the path is relative to &amp;lt;tt&amp;gt;/usr/src/redhat/SOURCE&amp;lt;/tt&amp;gt;&lt;br /&gt;
****don&amp;#039;t use any of the Patch999XX ranges, use something lower.&lt;br /&gt;
***locate the equivalent last &amp;lt;tt&amp;gt;%patch&amp;lt;digits&amp;gt;&amp;lt;/tt&amp;gt; entry and insert your new patch &amp;lt;tt&amp;gt;%patch&amp;lt;the patchnumber you choose&amp;gt; -p1&amp;lt;/tt&amp;gt;&lt;br /&gt;
**as an example, for centos 5.1 x86_64, the changes were&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[root@fireman SPECS]# diff -u kernel-2.6.spec-orig kernel-2.6.spec&lt;br /&gt;
--- kernel-2.6.spec-orig        2008-01-17 12:20:42.000000000 +0100&lt;br /&gt;
+++ kernel-2.6.spec     2008-01-17 12:48:06.000000000 +0100&lt;br /&gt;
@@ -49,7 +49,7 @@&lt;br /&gt;
 # After branching, please hardcode these values as the&lt;br /&gt;
 # %dist and %rhel tags are not reliable yet&lt;br /&gt;
 # For example dist -&amp;gt; .el5 and rhel -&amp;gt; 5&lt;br /&gt;
-%define dist .el5.centos.plus&lt;br /&gt;
+%define dist .el5.centos.plus.iihe&lt;br /&gt;
 %define rhel 5&lt;br /&gt;
 &lt;br /&gt;
 # Values used for RHEL version info in version.h&lt;br /&gt;
@@ -1601,6 +1601,8 @@&lt;br /&gt;
 Patch21841: linux-2.6-ppc-system-cpus-stuck-in-h_join-after-migrating.patch&lt;br /&gt;
 Patch21842: linux-2.6-fs-missing-dput-in-do_lookup-error-leaks-dentries.patch&lt;br /&gt;
 Patch21843: linux-2.6-net-tg3-fix-performance-regression-on-5705.patch&lt;br /&gt;
+&lt;br /&gt;
+Patch30000: 3w-9.5.0-2.6.18.patch&lt;br /&gt;
 # adds rhel version info to version.h&lt;br /&gt;
 Patch99990: linux-2.6-rhel-version-h.patch&lt;br /&gt;
 # empty final patch file to facilitate testing of kernel patches&lt;br /&gt;
@@ -3191,6 +3193,8 @@&lt;br /&gt;
 %patch21841 -p1&lt;br /&gt;
 %patch21842 -p1&lt;br /&gt;
 %patch21843 -p1&lt;br /&gt;
+%patch30000 -p1&lt;br /&gt;
+&lt;br /&gt;
 # correction of SUBLEVEL/EXTRAVERSION in top-level source tree Makefile&lt;br /&gt;
 # patch the Makefile to include rhel version info&lt;br /&gt;
 %patch99990 -p1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*you are now ready to rebuild the kernel rpms&lt;br /&gt;
**to build all releases, run&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 rpmbuild -bb kernel-2.6.spec &amp;gt;&amp;amp; out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
**this might take a while, you can later check the output file if your patch didn&amp;#039;t cause any issues during the build.&lt;br /&gt;
***you can follow the state with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tail -f out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
***be aware of the following message (it can stop/delay the process).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Not enough random bytes available.  Please do some other work to give&lt;br /&gt;
the OS a chance to collect more entropy!&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Post config ====&lt;br /&gt;
*since you build a new kernel release, it might be necessary to rebuild depending kernel modules, like XFS&lt;br /&gt;
**install the devel-rpms from your new kernel&lt;br /&gt;
**use &amp;lt;tt&amp;gt;rpm -i&amp;lt;/tt&amp;gt; to keep the current kernel rpms on the box. &lt;br /&gt;
**get and install the source rpms for your modules&lt;br /&gt;
**goto &amp;lt;tt&amp;gt;/usr/src/redhat/SPECS&amp;lt;/tt&amp;gt; and run&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpmbuild --define &amp;quot;kversion &amp;lt;the complete new kernel version&amp;gt;&amp;quot; module.spec&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
**eg for centos 5.1 example above with the XFS module&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpmbuild -bb --define &amp;quot;kversion 2.6.18-53.1.4.el5.centos.plus.iihe&amp;quot; kmod-xfs.spec&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{TracNotice|{{PAGENAME}}}}&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>