Home > Mobile >  Trying to make new driver gives "No rule to make target" for the .o file
Trying to make new driver gives "No rule to make target" for the .o file

Time:11-13

I am trying to modify a driver for an LCD display. My Makefile contains:

obj-m  = dft0928.o

all:
    make -C /usr/lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
    make -C /usr/lib/modules/$(shell uname -r)/build M=$(PWD) clean

When I run "make" in the folder containing my source file (dft0928.c), I get this output:

make -C /usr/lib/modules/5.15.74-v7 /build M=/home/pi/software/driver modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.74-v7 '
make[2]: *** No rule to make target '/home/pi/software/driver/dft0928.o', needed by '/home/pi/software/driver/dft0928.mod'.  Stop.
make[1]: *** [Makefile:1898: /home/pi/software/driver] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.74-v7 '
make: *** [Makefile:4: all] Error 2

Where am I going wrong? All the existing guides that I can find suggest my Makefile should be sufficient.

Any help appreciated.

CodePudding user response:

Found the problem - fat finger when writing Makefile. So stupid, just missed it every time I looked at it.

CodePudding user response:

Tsyvarev didn't like my previous answer so just to make it very clear. The root of filename "dft0928.o" in the Makefile did not match the name of the source file, which is "dfr0928.c". Once I corrected that, it compiled no problem.

I then hit other problems, but that's another story.

  • Related