printk is not my friend

Chase Douglas chase.douglas at canonical.com
Mon Apr 5 18:57:40 UTC 2010


On Mon, Apr 5, 2010 at 2:46 PM, Charles Brown <charles.brown at sensis.com> wrote:
> my problem seems to be a Makefile issue.  Following LDD3, i had started
> a char driver file (cdev.c), which i planned to add to hello.c, and i'd
> done this in the makefile;
>
> ifneq ($(KERNELRELEASE),)
>     obj-m := hello.o
>     hello-objs := cdev.o
>
> if i take out that 'cdev.o' it works.  I re-read that section of LDD3,
> "If, instead, you have a module called module.ko that is generated from
> two source files (called, say, file1.c and file2.c), the correct
> incantation would be:
>
> obj-m := module.o
> module-objs := file1.o file2.o
>
> So, i tried this;
>
> ifneq ($(KERNELRELEASE),)
>     obj-m := module.o
>     hello-objs := hello.o cdev.o
>
> but make says, "No rule to make diver.c".

You don't have diver.c in your Makefile. Did you mean "No rule to make cdev.c"?

What files are you actually trying to compile into a module? If you
want your module to be called hello.ko and you only have hello.c, then
you should only need this in your Makefile:

obj-m := hello.o

Then you would build it by running this in the same directory as your sources:

make -C /lib/modules/`uname -r`/build M=`pwd`

-- Chase




More information about the kernel-team mailing list