I'm trying to get the examples from Linux Device Drivers, ed 3 (ldd3) working before I start working with the book so that I can have a set of working examples that I can use.... I'm getting the following errors (seeing error in Debian squeeze and also Crunchbang Linux):
inp.c:33:20: error: [u]asm/io.h:[/u] No such file or directory
when I looked at the makefile I found this (which I think is the problem):
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
INCLUDEDIR = $(KERNELDIR)/include
contents of /lib/modules/uname -r
/build which is a link to /usr/src/linux-headers-2.6.39-bpo.2-486/
$ uname -r
2.6.39-bpo.2-486
$ ls /lib/modules/`uname -r`/build
arch include Makefile Module.symvers scripts
$ ls /lib/modules/`uname -r`/build/include
config generated linux
The directory that make is looking does not have the required files. I found the files required under /usr/src/linux-headers-2.6.39-bpo.2-common/ and the missing asm/io.h file @ /usr/src/linux-headers-2.6.39-bpo.2-common/include/asm-generic/
$ ls /usr/src/linux-headers-2.6.39-bpo.2-common/
arch include Kbuild Makefile scripts
$ ls /usr/src/linux-headers-2.6.39-bpo.2-common/include/
acpi crypto Kbuild linux media net rdma scsi staging trace xen
asm-generic drm keys math-emu mtd pcmcia rxrpc sound target video
Do I have to install any package to get the files in that directory... I've already installed linux-headers-uname -r
package (in both Debian and Crunchbang)... In gnewsense I found the files in /lib/modules/$(shell uname -r)/build... but it was a older kernel... so not sure if the directory structure under linux change... or is it distro specific... please let me know how do I get the compilation going.... I'm not very good with Makefiles so how can I change the makefile so that it will look for the header files in the other directories....
Thanks, asp5
/lib/modules/$(uname -r)/build/
directory is populated correctly. Are you sure you've got the right packages installed?ls /lib/modules/$(uname -r)/build | wc -l
on my system shows "27"..../include/
has 24 items, including.../include/asm
(symlink toasm-x86
). – sarnolduname -r
package which I think should install all the required headers (in Debian and derivatives)... can you tell me which distro are you using and the kernel version... I can see many items in that directory when I usegnewsense
distro... but unfortunately am not able to get it work on my new laptop... anyways I seem to have the right packages installed but the compilation does go smoothly... Thanks. – asp5