Skip to contentSkip to conversation

how to transplant a driver from 2.4 to 2.6?

DISCUSSION hacklu 3 participants 3 messages Aug 9, 2010

lore
Share & tools
lore

hacklu

author
#0 lore raw

I have a driver project programmed under the 2.4 kernel.
but now ,I want to transplant it to 2.6.
the driver has some directions;
like 1/1.c 2/2.c 3/3_1.c 3_2.c
in this case ,how can I imtate the template Makefile of 2.6's driver

I only kown this:
------------------------------------------
ifneq ($(KERNELRELEASE),)

# call from kernel build system
scull-objs := demo1.o demo2.o
obj-m := demo.o

else
CROSS_COMPILE ?=powerpc
KERNELLIBDIR=/lib
KERNELDIR ?= /linux-2.6.25_minifo
PWD := $(shell pwd)

all:

        $(MAKE) CROSS_COMPILE=$(CROSS_COMPILE) ARCH=powerpc -C $(KERNELDIR) M=$(PWD) modules
clean:
        rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
endif
depend .depend dep:
        $(CC) $(CFLAGS) -M *.c > .depend

ifeq (.depend,$(wildcard .depend))
include .depend
endif
-----------------------------------------

thanks so much

--------------
hacklu
2010-08-09

#1 lore raw
Quoted 7 lines · hacklu

 I have a driver project programmed under the 2.4 kernel. but now ,I want to transplant it to 2.6.
the driver has some directions;
like 1/1.c  2/2.c  3/3_1.c 3_2.c
in this case ,how can I imtate the   template Makefile   of 2.6's driver

[...]

Fortunately for me, I've not been unlucky enough to need to port 2.4 drivers myself, so I can't tell you the exact steps. However there are many articles and guides on the 'net that can: a google search for "linux kernel porting driver 2.4 2.6" will suffice; just look at the first few hits. If you need more help on Kconfig this may also help
you: http://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt
.

Valeo

#2 lore raw
In reply to hacklu
Quoted 7 lines · hacklu

I have a driver project programmed under the 2.4 kernel. but now ,I want to transplant it to 2.6.
the driver has some directions;
like 1/1.c 2/2.c 3/3_1.c 3_2.c
in this case ,how can I imtate the template Makefile of 2.6's driver

I use the following 2.6 Makefile template for an out of kernel drive I am forced to use:
----

alex@berk:~$ cat /usr/src/wag54g/sangam-atm/Makefile 
ifneq ($(KERNELRELEASE),)
include Kbuild
else
        KERNELDIR      := /usr/src/wag54g/linux/
all::
        $(MAKE) -C $(KERNELDIR) M=`pwd` tiatm.ko
endif
alex@berk:~$ cat /usr/src/wag54g/sangam-atm/Kbuild 
obj-m                   := tiatm.o
tiatm-y                 := cpsar.o aal5sar.o tn7sar.o tn7atm.o tn7dsl.o dsl_hal_api.o dsl_hal_support.o dsl_hal_advcfg.o

ccflags-y += -I$(PWD) -DPOST_SILICON -DCOMMON_NSP -D__NO__VOICE_PATCH__ -DEL -DCPATM_TASKLET_MODE
#ccflags-$(DEBUG) += -D....
----

It's not great, but it works.

Cheers

Signature · 3 lines
Alexander Clouter
.sigmonster says: Never eat more than you can lift.
                  		-- Miss Piggy