[Help] linux Device Driver-general Linux technology-Linux programming and kernel information. The following is a detailed description. Is the hello. c example in the book.
Edit the. C file and find a Makefile online. The content is as follows:
Ifneq ($ (KERNELRELEASE ),)
Obj-m: = hello. o
Else
KDIR =/lib/modules/$ (shell uname-r)/build
PWD: = $ (shell pwd)
Default:
$ (MAKE)-C $ (KDIR) M = $ (PWD) modules
Endif
Then make.
# Make
Make-C/lib/modules/2.6.18-6-686/bulid M =/usr/src/hello modules
Make [1]: Entering direcotry '/usr/src/linux-headers-2.6.18-6-686'
Building modules. stage 2.
MODPOST
Can't open file
Make [2]: ***** [_ modpost] Error 1
The key is that the can't open file after MODPOST does not generate a. o file. Take this
The output is indeed the same as the output in the book, with one missing:
Make [1]: Entering direcotry '/usr/src/linux-headers-2.6.18-6-686'
There should be a line of CC later
CC [M]/home/ldd3/src/misc-modules/hello. o (the directory is different from mine)
So there is no compilation at all. So I think there is a problem with Makefile. I found N or more files online.
Makefile has the same content, and no additional CC commands are added. What is the problem? Someone familiar with this
I have provided a correct Makefile. Thank you.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service