-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.

Marco
  • 121
  • 4
  • what research have you done? ... https://duckduckgo.com/?q=makefile+missing+separator&ia=qa – jsotola Oct 15 '22 at 17:51
  • your question does not belong here ... it is a Linux question, not a Raspberry Pi specific question – jsotola Oct 15 '22 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 Oct 15 '22 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 Oct 15 '22 at 20:26
  • The error message is unhelpful and obscure. I was hoping someone with actual knowledge about make could answer my question. – Marco Oct 15 '22 at 20:27
  • why is it that the first hit in the link I posted in a comment literally describes the solution that you posted? – jsotola Oct 15 '22 at 20:51
  • I'm trying to get a kernel module working for the raspberry pi ... no ... you are trying to compile a kernel module for Linux – jsotola Oct 15 '22 at 20:53
  • You haven't read correctly. I said I'm not going to ''make'' research on an error message [...] – Marco Oct 15 '22 at 20:53
  • why should anyone spend time answering a question that you are unwilling to answer yourself? – jsotola Oct 15 '22 at 20:55
  • You are an idiot. If I knew the answer, I wouldn't ask oh my god. – Marco Oct 15 '22 at 20:56
  • please correct me if I am wrong... my understanding is that you do not wish to spend time researching the error on the internet ... my comment comes from that understanding – jsotola Oct 15 '22 at 21:58
  • Yes, because that error isn't saying anything particularly useful. I'm not familiar with the syntax of Makefile files. Also, you never know what kind of crooked version of a tool you might have installed on your system. I don't trust the software installed on my pi, not to the level I would on a "normal" machine ; let me give you an example (even though this is totally out of scope): if you login into your raspi for the first time, you have to wait a couple seconds before it even accepts the valid default credentials. – Marco Oct 15 '22 at 22:40
  • On another (raspberry pi) system I got Makefile:4: *** missing separator (did you mean TAB instead of 8 spaces?). Stop. this is a much more useful error message, and it would have stopped me from asking that question here - but make decided to bail out with a cryptic error message instead.. – Marco Oct 15 '22 at 22:42

1 Answers1

-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)

Marco
  • 121
  • 4