开发者

device driver missing config.h

开发者 https://www.devze.com 2023-01-30 07:40 出处:网络
So I start reading the book http://lwn.net/Kernel/LDD3/ to write device driver The problem is the book used 2.6.10 while I\'m using 2.6.35.X (on Ubuntu) and \"config.h\" is missing. I googled the pr

So I start reading the book http://lwn.net/Kernel/LDD3/ to write device driver

The problem is the book used 2.6.10 while I'm using 2.6.35.X (on Ubuntu) and "config.h" is missing. I googled the problem and it turned out that config.h is removed.

http://stephane.lesimple.fr/wiki/blog/kernel_2.6.18_linux_config.h_problem suggests 3 solutions and the first 2 don't work 开发者_StackOverflowto me ( I don't have autoconf.h ). The 3rd solution is the one that is over my head. If anyone can explain the 3rd or has other solutions, I'd appreciate.

Thanks


All -imacros file and -include file options are processed after all -D and -U options1.

Each (of the three) option is a way of pointing GCC to a text file with a list of preprocessor defines. To use option 3, -imacros a_file , there is still a need for the file a_file , (ie: autoconf.h), the file with the macros or configuration definitions. On this system it's /usr/src/linux/include/generated/autoconf.h

l /usr/src/linux
lrwxrwxrwx 1 root conman 23 Nov 29 19:37 /usr/src/linux -> linux-2.6.35-gentoo-r12

As you can see, this file can occur in 2.6.35. It seems that maybe configuringi the kernel makes this file; because the content of this file looks tailored to the current kernel. This looks like a file declaring which drivers are compiled-in(as apposed to compiled as modules).

So:

  • First check for the file find /usr/src/linux/. -name autoconf.h If it is not there, then configure the kernel (then check again)
  • Change CFLAGS in the device driver's Makefile to include -imacros /usr/src/linux/include/generated/autoconf.h
    CFLAGS+=-imacros /usr/src/linux/include/generated/autoconf.h
  • Comment out #include <config.h> from the driver sources.

1 "3.11 Options Controlling the Preprocessor," GCC Reference

0

精彩评论

暂无评论...
验证码 换一张
取 消