Estou executando o 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
A fonte que estou tendo é:
linux-lts-raring-3.8.0
Quando estou tentando fazer meu primeiro driver, recebo os seguintes erros:
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
Depois fui para scripts / mod / no meu diretório fonte que eu digitei 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
Atualizar
Eu encontrei um arquivo relacionado mk_elfconfig.c. Existe uma maneira de gerar o elfconfig.h a partir disso;
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
Por que estou recebendo esse erro? Eu acredito que a versão do código fonte e o que está sendo executado são os mesmos.
O Makefile e o código-fonte do driver são fornecidos aqui
Atualizar
depois de copiar o config-from / boot para o meu código-fonte como .config:
Eu fiz
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#
Mas ainda o mesmo erro na compilação do driver:
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