|
|
Log in / Subscribe / Register

How to compile an external driver using a non-default makefile name?

How to compile an external driver using a non-default makefile name?

Posted Jan 9, 2007 0:27 UTC (Tue) by Linux_v (guest, #42654)
Parent article: Driver porting: compiling external modules

Hi,

I used to be able to compile an external device driver using the command in 2.4 kernel:

make -f mymakefile

But in 2.6 kernel, the command doesn't work.

1) With this command
$(MAKE) -C $(KDIR) M=$(PWD) modules

I saw the following error:

[root@pgenlx11 platypus]# make -f mymakefile
make -C /lib/modules/2.6.11.1/build M=/my-correct-ldd-dir modules
make[1]: Entering directory `/usr/src/kernels/linux-2.6.11.1'
scripts/Makefile.build:13: /my-correct-ldd-dir/Makefile: No such file or directory
make[2]: *** No rule to make target `/my-correct-ldd-dir/Makefile'. Stop.
make[1]: *** [_module_/my-correct-ldd-dir] Error 2
make[1]: Leaving directory `/usr/src/kernels/linux-2.6.11.1'
make: *** [all] Error 2

From reading the porting article, I've learnt that the 2.6 kernel build process goes through two passes for building an external device driver. The second pass is where it does the building job. But it looks like it was looking for a default makefile, named Makefile, even though, "-f mymakefile" is given at the make command.

2) with this command
$(MAKE) -C $(KDIR) M=$(PWD) -f mymakefile modules

I saw this the following error: basically, the build process try to look for mymakefile in the linux source tree, instead of the the dir defined by M=$(PWD).

[root@pgenlx11 platypus]# make -f mymakefile
make -C /lib/modules/2.6.11.1/build M=/my-correct-ldd-path modules -f mymakefile
make[1]: Entering directory `/usr/src/kernels/linux-2.6.11.1'
make[1]: mymakefile: No such file or directory
make[1]: *** No rule to make target `mymakefile'. Stop.
make[1]: Leaving directory `/usr/src/kernels/linux-2.6.11.1'
make: *** [all] Error 2

3) case 1, "make -f mymakefile", will work fine if I add the following symbolic link:
ln -s mymakefile Makefile

I tried this just to test if there is other problem for the make. It's not a solution for me.

I saw the linux build script uses "make -f " in some case. it look like it should work in 2.6 as well. What have I missed?

Thanks in advance!


to post comments


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds