Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] HOWTO: Cross compiling the dvb-kernel driver



Since my VDR machine is not the fastest one, and my
working machine is fast, but not (yet) running kernel 2.6,
I have tried to compile the latest dvb-kernel driver from CVS
on a machine running kernel 2.4.20. Here's how this can be done:

The following assumes the target kernel version is "linux-2.6.5-7.104".
Replace this with your target kernel version if it is different.

This also assumes that the 'msleep' problem has been fixed by the
patch posted to the VDR mailing list by Kenneth Aafloy on Sun, 5 Sep 2004
16:32:37 +0200. Hopefully that fix will go into the CVS soon.

1.) Install the kernel source to some directory, e.g.
    /home/kls/kernel/linux-2.6.5-7.104

2.) mkdir -p /lib/modules/linux-2.6.5-7.104

3.) ln -s /lib/modules/linux-2.6.5-7.104/build /home/kls/kernel/linux-2.6.5-7.104

4.) Install the driver source to some directory and 'cd' into that directory's
    'build-2.6' subdirectory

5.) Make the following changes to the Makefile:

    +++ Makefile    2004-09-06 12:41:24.000000000 +0200
    --- Makefile    2004-09-10 16:29:32.000000000 +0200
    @@ -1,6 +1,6 @@
     ifeq ($(KERNELRELEASE),)

    +KERNELRELEASE := $(shell uname -r)
    -KERNELRELEASE := linux-2.6.5-7.104
     KERNELSRCDIR := /lib/modules/$(KERNELRELEASE)/build
     KERNELBUILDDIR := $(KERNELSRCDIR)
     BUILD_DIR := $(shell pwd)
    @@ -77,7 +77,7 @@
     OSD := -DCONFIG_DVB_AV7110_OSD
     endif

    +export CC := $(CROSS_COMPILE)gcc -I$(DVB_SRC_DIR)/linux/include $(FW) $(OSD)
    -export CC := $(CROSS_COMPILE)gcc -I$(DVB_SRC_DIR)/linux/include $(FW) $(OSD) -DLINUX_VERSION_CODE=0x020605

     #EXTRA_CFLAGS = -Idrivers/media/video

6.) Do a 'make' and the driver should be built.

Note that the compiler will complain about

   include/linux/version.h:2:1: warning: "LINUX_VERSION_CODE" redefined
   <command line>:7:1: warning: this is the location of the previous definition

which you can just ignore (it may well be buried under all the other warnings,
anyway ;-)

If the attached patch is applied to the Makefile, the target kernel
version can be defined by doing

  export TARGET_KERNELRELEASE=linux-2.6.5-7.104
  export TARGET_LINUX_VERSION_CODE=0x020605

Maybe this could be considered to go into the actual CVS Makefile?
Unless I'm the only one with such an "exotic" requirement ;-)

Klaus
--- Makefile	2004-09-06 12:41:24.000000000 +0200
+++ Makefile	2004-09-10 16:41:16.000000000 +0200
@@ -1,6 +1,10 @@
 ifeq ($(KERNELRELEASE),)
 
 KERNELRELEASE := $(shell uname -r)
+ifdef TARGET_KERNELRELEASE
+KERNELRELEASE := $(TARGET_KERNELRELEASE)
+DEFINES += -DLINUX_VERSION_CODE=$(TARGET_LINUX_VERSION_CODE)
+endif
 KERNELSRCDIR := /lib/modules/$(KERNELRELEASE)/build
 KERNELBUILDDIR := $(KERNELSRCDIR)
 BUILD_DIR := $(shell pwd)
@@ -77,7 +81,7 @@
 OSD := -DCONFIG_DVB_AV7110_OSD
 endif
 
-export CC := $(CROSS_COMPILE)gcc -I$(DVB_SRC_DIR)/linux/include $(FW) $(OSD)
+export CC := $(CROSS_COMPILE)gcc -I$(DVB_SRC_DIR)/linux/include $(FW) $(OSD) $(DEFINES)
 
 #EXTRA_CFLAGS = -Idrivers/media/video
 

Home | Main Index | Thread Index