Using a git driver development tree

From LinuxTVWiki
Revision as of 23:02, 22 April 2010 by Mauro Carvalho Chehab (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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
 NOTE: if your kernel version changed, you'll need to re-build the kernel again, with
   $ make olconfig
   $ make