after installed linux header in ubuntu 11, still have error linux/module.h no such fi
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i am newbie, how to configure the build system to locate the kernel headers ?
i follow oreilly 's book linux device driver to use the makefile, when type make, it said nothing to do
# If KERNELRELEASE is defined, we've been invoked from the
# kernel build system and can use its language.
ifneq ($(KERNELRELEASE),)
obj-m := cli.o
# Otherwise we were called directly from the command
# line; invoke the kernel build system.
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
endif
Distribution: Debian Wheezy, Jessie, Sid/Experimental, playing with LFS.
Posts: 2,900
Rep:
As has already been pointed out Ubuntu 11 (there is nos such thing but anyway) is unsupported. Download Ubuntu 12.04 or 14.04 and install that. They both have 5 years of support so you can play around with them for may years to come.
i search for the error, then find a makefile below
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
however after make, return nothing to be done for 'all'
then i change to
obj-m += hello.o
hello.o:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
it result in another error
wonder@wonder-VirtualBox:~/layer$ make cc -c -o hello.o hello.c
In file included from hello.c:3:0:
/usr/src/linux-headers-3.8.0-29-generic/include/linux/module.h:9:24: fatal error: linux/list.h: No such file or directory
compilation terminated.
make: *** [hello.o] Error 1
i use the make file in old version of oreilly book linux device driver
it can make to run, however got error
it use cc, but not gcc, is it modules programming can only use cc, not gcc?
make: *** No rule to make target `cli_init.o', needed by `cli.o'. Stop.
wonder@wonder-VirtualBox:~/layer$ make
cc -D__KERNEL__ -DMODULE -O -Wall -I/usr/src/linux-headers-3.8.0-29-generic/include -c -o cli.o cli.c
cli.c:1:0: warning: "MODULE" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
In file included from /usr/src/linux-headers-3.8.0-29-generic/include/linux/kernel.h:6:0,
from /usr/src/linux-headers-3.8.0-29-generic/include/linux/cache.h:4,
from /usr/src/linux-headers-3.8.0-29-generic/include/linux/time.h:4,
from /usr/src/linux-headers-3.8.0-29-generic/include/linux/stat.h:18,
from /usr/src/linux-headers-3.8.0-29-generic/include/linux/module.h:10,
from cli.c:2:
/usr/src/linux-headers-3.8.0-29-generic/include/linux/linkage.h:5:25: fatal error: asm/linkage.h: No such file or directory
compilation terminated.
make: *** [cli.o] Error 1
wonder@wonder-VirtualBox:~/layer$
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.