2010-08-09 08:03:50

by hacklu

[permalink] [raw]
Subject: how to transplant a driver from 2.4 to 2.6?

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


2010-08-09 08:59:21

by Valeo de Vries

[permalink] [raw]
Subject: Re: how to transplant a driver from 2.4 to 2.6?

On 9 August 2010 09:03, hacklu <[email protected]> wrote:
> ?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

2010-08-09 09:10:09

by Alexander Clouter

[permalink] [raw]
Subject: Re: how to transplant a driver from 2.4 to 2.6?

hacklu <[email protected]> wrote:
>
> 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

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