-2

I'm trying to write a basic kernel module for my Raspberry Pi V4 Model B.

I tried to follow the steps at puddleofcode.com and How compile a loadable kernel module without recompiling kernel.

obj-m := pix_mod.o

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

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

However, regardless of which version of the Makefile I'm using, I'm always getting this error:

Makefile:4: *** missing separator.  Stop.

I'm not a make user, so I have no idea what this error message means.

The only thing I'm suspecting is that the error is somewhere on line 4.

13
  • what research have you done? ... duckduckgo.com/?q=makefile+missing+separator&ia=qa
    – jsotola
    Commented Oct 15, 2022 at 17:51
  • your question does not belong here ... it is a Linux question, not a Raspberry Pi specific question
    – jsotola
    Commented Oct 15, 2022 at 17:52
  • @jsotola Actually, it belongs here. Because I'm trying to get a kernel module working for the raspberry pi. It's not a Linux question.
    – Marco
    Commented Oct 15, 2022 at 20:21
  • And @jsotola I'm not going to ''make'' research on an error message that is so obscure like this one Makefile:4: *** missing separator. Stop.. The issue was that the indentation was wrong (spaces instead of tabs).
    – Marco
    Commented Oct 15, 2022 at 20:26
  • The error message is unhelpful and obscure. I was hoping someone with actual knowledge about make could answer my question.
    – Marco
    Commented Oct 15, 2022 at 20:27

1 Answer 1

-1

Turned out make isn't happy with 4 spaces as indentation (duh, I just copied the Makefile from these sites).

Anyway, replacing the 4 spaces with 1 tab fixed the issue.

(I can't post the correct Makefile syntax here, because it will get replaced with spaces)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.