Home:ALL Converter>Linux kernel module makefile issues

Linux kernel module makefile issues

Ask Time:2014-08-08T15:51:25         Author:MrMalt

Json Formatter

I am trying to learn a little about Linux kernel programming, and after trying a tutorial i am completely stuck. My makefile is complaining about some sort of "Command not found" error (error 127), so it won't compile it. I tried searching for a solution, but nothing came up. So I thought I'd try to ask here. Sorry if this is a duplicate.

Here is the error output from the shell:

malt@ubuntu:~/Documents/C$ make
C /usr/src/linux SUBDIRS=/home/malt/Documents/C; modules
/bin/sh: 1: C: not found
/bin/sh: 1: modules: not found
make: [default] Error 127 (ignored)

And here is my makefile:

# Makefile of My First Driver

# if KERNELRELEASE is defined, we've been invoked from the kernel build system
# and can use it's language
ifneq (${KERNELRELEASE},)
    obj-m := mfd.o

# otherwise we've been called directly from the commandline.
# invoke the kernel build system.
else
    KERNEL_SOURCE := /usr/src/linux
    PWD := ${shell pwd};

default:
    ${make} -C ${KERNEL_SOURCE} SUBDIRS=${PWD} modules

clean:
    ${make} -C ${KERNEL_SOURCE} SUBDIRS=${PWD} clean

endif

Does anyone have any idea as to what is wrong?

Thanks in advance!

Author:MrMalt,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/25198483/linux-kernel-module-makefile-issues
Sagar Sakre :

Adding to Santosh A's Changes\n\n\nThere shouldn't be ; in PWD := ${shell pwd};. remove it which will solve /bin/sh: 1: modules: not found error. \n",
2014-08-08T09:13:15
yy