Using a git driver development tree

From LinuxTVWiki
Revision as of 04:34, 25 April 2010 by Hock (talk | contribs) (→‎Installing the new drivers on your kernel)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Compiling a Git repository

The git driver repositories contain the full Linux kernel tree. So, before working with a driver, a full kernel compilation should be done. The easiest way is to run:

 $ make oldconfig

This will use your kernel old configuration, asking you only about the new features that have added (or moved), when compared with your original kernel version.

The first build will take some time. In order to do it, just run:

 $ make

After having the kernel built (and tested), subsequent compilations can be done by running:

 make M=drivers/media/

or, if the driver is currently at staging, by running:

 make M=drivers/staging/

With the above commands, only the media (or staging) drivers will be recompiled, if they got changed, saving you some time on testing the new driver features.

 NOTE: if you added new files or changed the files dependencies, you may need to do a full make. In this case, just run:
   $ make

Installing the new kernel

If this is the first time you're compiling the drivers, or if kernel version changed from your previous build, you should run a full drivers installation with:

 # make modules_install install

Be sure to be root when installing the drivers.

Installing the new drivers on your kernel

After the first installation, you may just copy the new drivers with this small script:

 for i in `find drivers/media -name *.ko`; do
         if [ $i -nt /lib/modules/`uname -r`/kernel/$i ]; then
                 sudo install -m 644 -c -D $i /lib/modules/`uname -r`/kernel/$i || exit -1
         fi
 done

Use this for staging driver:

 for i in `find drivers/staging/$1 -name *.ko`; do
         if [ $i -nt /lib/modules/`uname -r`/kernel/$i ]; then
                 sudo install -m 644 -c -D $i /lib/modules/`uname -r`/kernel/$i || exit -1
         fi
 done


 NOTE:
     If your kernel version changed, you'll need to re-build the kernel again, with
       $ make olconfig
       $ make
     In this case, you'll also need to re-install the drivers ans the kernel with:
       # make modules_install install

Removing the already loaded modules

This is probably the trickiest part. You can, of course, just reboot the machine, but this may take some time, so Mauro Carvalho Chehab wrote a script that unloads all kernel modules from the memory. This script were integrated with the mercurial trees.

There's an updated rmmod.pl version that works with git and with all kernels that put the media drivers at the right location.

In order to remove all V4L/DVB drivers from the memory, all that it is needed is to run. as root:

 # ./rmmod.pl unload
  PS.: The other options of the script should be working as well, but they weren't really tested, since the only one that 
       is really useful outside Mecurial tree is the capability of removing the drivers from the memory.