Saturday, November 05, 2005

My patches to kernel 2.6.12-1.1381_FC3

That is a patch to allow:

SiS SATA 0182 support at the startup (I do not have an IDE hard drive to boot my Linux)
SiS Ethernet 0190 module driver
SiS 5513 IDE DMA support

Problem:
On original Fedora kernel there is no support on [sata_sis] module to the model 182 and it is not loaded at boot time.
There is no module to the SiS Ethernet controller model 190/191.
And there is no support to DMA on the SiS IDE controller model 5513.

Approach:
Apply all patches that I published, and apply to that situation, and modify the spec file to cope with the rpm kernel generation.

Remarks:
You should read and apply the partial patches already published, as follows:
sata_sis
sis190
sis5513

1. Get and install the kernel source that applies:
2.6.12-1.1381_FC3

2. Apply the above mentioned patches on the Remarks:

3. Script to pre-change all [.config] files:

Approach:
I prefer this script rather to create patches. I think it is more clear to understand what is going on here.
Basically I instruct the kernel to:

3.1. Add the SCSI support as a kernel internal instead of a loadable module:
CONFIG_SCSI=y
3.2. Add the SATA SCSI support for SiS as an internal:
CONFIG_SCSI_SATA_SIS=y
3.3. Add a NEW line to include the new driver, as a loadable module, for SiS Ethernet controller model 190/191 (that has no conterparter on this kernel).
CONFIG_SIS190=m

3.4. The script:

### /usr/src/redhat/SOURCES/make-config.sh ###
cat > /usr/src/redhat/SOURCES/make-config.sh << __END__
#!/bin/bash
# Please note that this script do NOT check if the [.config] was already patched
#
find /usr/src/redhat/SOURCES/ -name "*.config" -print | while read FILE
do
mv \${FILE} \${FILE}.orig
cat \${FILE}.orig | sed -e "s/\(CONFIG_SCSI=\)./\1y/" -e "s/\(CONFIG_SCSI_SATA_SIS=\).*/\1y/" -e "s/\(CONFIG_SIS900=m\)/\1\nCONFIG_SIS190=m/" > \${FILE}
done
__END__
chmod 700 /usr/src/redhat/SOURCES/make-config.sh
### /usr/src/redhat/SOURCES/make-config.sh ###

Note: Note that this script do NOT check if the files were already patched.

3.5. Executing the scritp, JUST ONCE:

/usr/src/redhat/SOURCES/make-config.sh

4. Patch the kernel spec file:

4.1. Patch file:

### /usr/src/redhat/SPECS/kernel-2.6.spec.patch ###
cat > /usr/src/redhat/SPECS/kernel-2.6.spec.patch << __END__
--- a/kernel-2.6.spec 2005-10-21 09:41:01.000000000 +0200
+++ b/kernel-2.6.spec 2005-11-05 16:31:20.000000000 +0100
@@ -19,7 +19,11 @@
%define sublevel 12
%define kversion 2.6.%{sublevel}
%define rpmversion 2.6.%{sublevel}
-%define rhbsys %([ -r /etc/beehive-root -o -n "%{?__beehive_build}" ] && echo || echo .`whoami`)
+#
+# I just do no like Fedora standard names for self-made kernels, so I call it just [sis]
+#
+#%define rhbsys %([ -r /etc/beehive-root -o -n "%{?__beehive_build}" ] && echo || echo .`whoami`)
+%define rhbsys sis
%define release %(R="$Revision: 1.1381 $"; RR="${R##: }"; echo ${RR%%?})_FC3%{rhbsys}
%define signmodules 0
%define make_target bzImage
@@ -162,6 +166,7 @@


Source0: ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-%{kversion}.tar.bz2
+Source1: linux-2.6.12-sis190.tar.bz2

Source10: COPYING.modules
Source11: genkey
@@ -201,6 +206,8 @@
Patch301: linux-2.6.12-serial-of.patch
Patch302: linux-2.6.10-ppc-headerabuse.patch
Patch303: linux-2.6-windtunnel-printk.patch
+Patch304: linux-2.6.12-sis190-Kconfig.patch
+Patch305: linux-2.6.12-sis190-Makefile.patch

# 400 - 499 ia64
Patch400: linux-2.6.3-ia64-build.patch
@@ -248,6 +255,8 @@
Patch1060: linux-2.6.3-crash-driver.patch
Patch1070: linux-2.6.0-sleepon.patch

+Patch1080: linux-2.6.12-sis5513.patch
+
# SCSI bits.
Patch1101: linux-2.6.9-scsi-advansys-enabler.patch
Patch1102: linux-2.6.9-scsi-megaraid-legacy.patch
@@ -255,6 +264,8 @@
Patch1104: linux-2.6.12-scsicam-geom-fix.patch
Patch1105: linux-2.6-scsi-sym2-alloc_lcb_tags-atomic.patch
Patch1106: linux-2.6-scsi-aic-dma39bit.patch
+Patch1107: linux-2.6.12-sata_sis182-light.patch
+Patch1108: linux-2.6.12-sata_sis182.patch

# NFS bits.
Patch1200: linux-2.6.9-NFSD-non-null-getxattr.patch
@@ -418,6 +429,10 @@
rm -rf linux-%{kversion}
cp -rl vanilla linux-%{kversion}

+#
+# Here I'm ashamed, I really do not known how to do that with more elegancy
+#
+tar -xjf %{SOURCE1}
cd linux-%{kversion}

#
@@ -451,6 +466,9 @@
%patch301 -p1
%patch302 -p1
%patch303 -p1
+# Patch for sis190 NIC
+%patch304 -p1
+%patch305 -p1

#
# ia64
@@ -554,6 +572,11 @@
%patch1070 -p1

#
+# SiS 5513 DMA support
+#
+%patch1080 -p1
+
+#
# SCSI Bits.
#
# Enable Advansys driver
@@ -568,6 +591,11 @@
%patch1105 -p1
# Fix aic7xxx >4GB
%patch1106 -p1
+# Fix sata_sis suport to sis182
+# light version, just an ID tag added
+%patch1107 -p1
+# complete version from SiS, but does not boot
+#%patch1108 -p1

#
# Various upstream NFS/NFSD fixes.
__END__
### /usr/src/redhat/SPECS/kernel-2.6.spec.patch ###

4.2. Applying the patch:

cd /usr/src/redhat/SPECS/
patch -p1 < kernel-2.6.spec.patch

5. Making the RPMs from spec:

cd /usr/src/redhat/SPECS/

5.1. Clean previous build (do NOT forget this):

rpmbuild --clean kernel-2.6.spec ### clean all

5.2. Build all for your platform, it may be one of them so please take the one that applies to you:

# rpmbuild -ba --target=i586 kernel-2.6.spec ### to install from a CD
# rpmbuild -ba --target=i686 kernel-2.6.spec ### I use this one
# rpmbuild -ba --target=x86_64 kernel-2.6.spec ### AMD64

Note: Of course there are more options, but for a regular user these ones above must cover most of the cases.

5.3. Take time to see a film, read a book or something else, because it will take long (from 2 to 3 hours).

6. Install the new kernel, that will be written at: [/usr/src/redhat/RPMS/], in my case:

rpm -Uvhi /usr/src/redhat/RPMS/i686/kernel-2.6.12-1.1381_FC3sis.i686.rpm
rpm -Uvhi /usr/src/redhat/RPMS/i686/kernel-smp-2.6.12-1.1381_FC3sis.i686.rpm

7. Test it and adjust the GRUB configuration to boot with the new kernel (if it wasn't already done), it is at: [/etc/grub.conf]

8. Say thanks if it works or what goes wrong :-).

Please always address to my hardware, os and kernel patching general procedures before posting a question.

No comments: