Kernel-Module: Unterschied zwischen den Versionen

Aus Shea Wiki
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
 
Keine Bearbeitungszusammenfassung
Zeile 1: Zeile 1:
__NOTOC__
__NOTOC__
= Kernel-Module für Fedora erzeugen =
= Kernel-Module für Fedora erzeugen =
=== Erzeugen einer Buildumgebung mit aktuellem Kernel ===
== Erzeugen einer Buildumgebung mit aktuellem Kernel ==


<pre><nowiki>
<pre><nowiki>
Zeile 21: Zeile 21:
+++ linux-3.7.1/drivers/media/dvb-core/dvbdev.c
+++ linux-3.7.1/drivers/media/dvb-core/dvbdev.c
@@ -83,8 +83,11 @@ static int dvb_device_open(struct inode *inode, struct file *file)
@@ -83,8 +83,11 @@ static int dvb_device_open(struct inode *inode, struct file *file)
file->f_op = old_fops;
                        file->f_op = old_fops;
goto fail;
                        goto fail;
}
                }
- if(file->f_op->open)
-               if(file->f_op->open)
+ if(file->f_op->open) {
+               if(file->f_op->open) {
+ mutex_unlock(&dvbdev_mutex);
+                       mutex_unlock(&dvbdev_mutex);
err = file->f_op->open(inode,file);
                        err = file->f_op->open(inode,file);
+ mutex_lock(&dvbdev_mutex);
+                       mutex_lock(&dvbdev_mutex);
+ }
+               }
if (err) {
                if (err) {
fops_put(file->f_op);
                        fops_put(file->f_op);
file->f_op = fops_get(old_fops);
                        file->f_op = fops_get(old_fops);
--
--
</nowiki></pre>
</nowiki></pre>
Zeile 39: Zeile 39:


<pre><nowiki>
<pre><nowiki>
KERNELDIR=$(echo $KERNEL | perl -e '<> =~ /(\d+)\.(\d+)\..*(fc\d+)/; print "kernel-$1.$2.$3\n"')
KERNELDIR=$(uname -r | perl -e '<> =~ /(\d+)\.(\d+)\..*(fc\d+)/; print "kernel-$1.$2.$3\n"')
cd ~/rpmbuild/BUILD/$KERNELDIR
cd ~/rpmbuild/BUILD/$KERNELDIR/linux*
patch -p1 < ~/linux-3.7.1-dvb-mutex.patch
patch -p1 < ~/linux-3.7.1-dvb-mutex.patch
cd drivers/media/dvb-core
cd drivers/media/dvb-core
</nowiki></pre>
make -C /lib/modules/`uname -r`/build M=`pwd` modules
 
su -c mv /usr/lib/modules/`uname -r`/kernel/drivers/media/dvb-core/dvb-core.ko /usr/lib/modules/`uname -r`/kernel/drivers/media/dvb-core/dvb-core.ko.orig
 
make -C /lib/modules/`uname -r`/build M=`pwd` modules_install
<pre><nowiki>
</nowiki></pre>
</nowiki></pre>





Version vom 1. Januar 1970, 01:00 Uhr

Kernel-Module für Fedora erzeugen

Erzeugen einer Buildumgebung mit aktuellem Kernel

rpmdev-setuptree
yumdownloader --source kernel
KERNEL=$(ls kernel-*.src.rpm|tail -1)
su -c "yum-builddep $KERNEL"
rpm -Uvh $KERNEL
cd ~/rpmbuild/SPECS
rpmbuild -bp --target=$(uname -m) kernel.spec

Patch für dvbdev

Patchdatei (~/linux-3.7.1-dvb-mutex.patch)

diff -Nur linux-3.7.1/drivers/media/dvb-core/dvbdev.c linux-3.7.1/drivers/media/dvb-core/dvbdev.c
--- linux-3.7.1/drivers/media/dvb-core/dvbdev.c
+++ linux-3.7.1/drivers/media/dvb-core/dvbdev.c
@@ -83,8 +83,11 @@ static int dvb_device_open(struct inode *inode, struct file *file)
                        file->f_op = old_fops;
                        goto fail;
                }
-               if(file->f_op->open)
+               if(file->f_op->open) {
+                       mutex_unlock(&dvbdev_mutex);
                        err = file->f_op->open(inode,file);
+                       mutex_lock(&dvbdev_mutex);
+               }
                if (err) {
                        fops_put(file->f_op);
                        file->f_op = fops_get(old_fops);
--

Patch Einspielen

KERNELDIR=$(uname -r | perl -e '<> =~ /(\d+)\.(\d+)\..*(fc\d+)/; print "kernel-$1.$2.$3\n"')
cd ~/rpmbuild/BUILD/$KERNELDIR/linux*
patch -p1 < ~/linux-3.7.1-dvb-mutex.patch
cd drivers/media/dvb-core
make -C /lib/modules/`uname -r`/build M=`pwd` modules
su -c mv /usr/lib/modules/`uname -r`/kernel/drivers/media/dvb-core/dvb-core.ko /usr/lib/modules/`uname -r`/kernel/drivers/media/dvb-core/dvb-core.ko.orig
make -C /lib/modules/`uname -r`/build M=`pwd` modules_install