I am running Ubuntu:
#lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.4 LTS
Release: 12.04
Codename: precise
Kernel info:
3.8.0-38-generic #56~precise1-Ubuntu SMP Thu Mar 13 16:23:47 UTC 2014 i686 i686 i386 GNU/Linux
The source that I am having is : linux-lts-raring-3.8.0
When I am trying to make my first driver I get the following errors:
make -C /usr/linux-lts-raring-3.8.0 SUBDIRS=/home/drdr/Documents/drivers/first_driver modules
make[1]: Entering directory `/usr/linux-lts-raring-3.8.0'
WARNING: Symbol version dump /usr/linux-lts-raring-3.8.0/Module.symvers
is missing; modules will have no dependencies and modversions.
Building modules, stage 2.
MODPOST 1 modules
/bin/sh: 1: scripts/mod/modpost: not found
make[2]: *** [__modpost] Error 127
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/usr/linux-lts-raring-3.8.0'
make: *** [default] Error 2
Then I went to scripts/mod/ in my source directory I typed make:
root@drdr:/usr/linux-lts-raring-3.8.0/scripts/mod# make modpost
cc modpost.c -o modpost
In file included from modpost.c:18:0:
modpost.h:12:23: fatal error: elfconfig.h: No such file or directory
compilation terminated.
make: *** [modpost] Error 1
Update I found a related file mk_elfconfig.c. Is there a way to generate elfconfig.h from this;
root@drdr:/usr/linux-lts-raring-3.8.0/scripts/mod# ls -ld mk_elfconfig.c
-rw-r--r-- 1 root root 1234 Feb 19 2013 mk_elfconfig.c
Why I am getting this error? I believe the version of the source code and what is running are the same.
The Makefile and source code for the driver is given here
Update after copying config- from /boot to my source code as .config: I did
root@drdr:/home/drdr/Documents/drivers/linux-lts-raring-3.8.0#make oldconfig
scripts/kconfig/conf --oldconfig Kconfig
#
# configuration written to .config
#
root@drdr:/home/drdr/Documents/drivers/linux-lts-raring-3.8.0# make prepare
scripts/kconfig/conf --silentoldconfig Kconfig
SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h
SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_64.h
SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_x32.h
SYSTBL arch/x86/syscalls/../include/generated/asm/syscalls_32.h
HOSTCC arch/x86/tools/relocs
WRAP arch/x86/include/generated/asm/clkdev.h
CHK include/generated/uapi/linux/version.h
UPD include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
UPD include/generated/utsrelease.h
CC kernel/bounds.s
GEN include/generated/bounds.h
CC arch/x86/kernel/asm-offsets.s
GEN include/generated/asm-offsets.h
CALL scripts/checksyscalls.sh
root@drdr:/home/drd/Documents/drivers/linux-lts-raring-3.8.0#
But still same error in driver compilation:
root@drdr:/home/drdr/Documents/drivers/first_driver# make
make -C /usr/linux-lts-raring-3.8.0 SUBDIRS=/home/drdr/Documents/drivers/first_driver modules
make[1]: Entering directory `/usr/linux-lts-raring-3.8.0'
WARNING: Symbol version dump /usr/linux-lts-raring-3.8.0/Module.symvers
is missing; modules will have no dependencies and modversions.
Building modules, stage 2.
MODPOST 1 modules
/bin/sh: 1: scripts/mod/modpost: not found
make[2]: *** [__modpost] Error 127
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/usr/linux-lts-raring-3.8.0'
make: *** [default] Error 2
make configandmake prepareinside the kernel source tree?/proc/config.gzor/boot/config-<kernelversion>) to.configin the kernel source and domake oldconfig.