[OpenBSD-BR] teste de LKM
alicornio
alicornio em ig.com.br
Quinta Junho 21 03:36:57 BRT 2007
Ae povo da lista
Ainda continuo quebrando a cara com um simples LKM. :)
Resolvi o problema da compilação (meu último e-mail).
O novo problema é que não consigo carregar nenhum módulo, nem
mesmo aquele que vem de exemplo (/usr/share/lkm).
Já procurei em tudo que foi lugar sobre o erro mas nenhuma
das minhas tentativas funcionou, tentei tudo que foi flag no gcc
e ld mas nada adiantou. Eu acho, puro chute, que é por causa da
arquiterura do meu processador (AMD64).
As mensagens de erro são as seguintes:
root:modteste # cc -D_KERNEL -I/sys -c modulo_teste.c
root:modteste # modload -o modulo_teste_info.o -etestemodulo
modulo_teste.o
modulo_teste.o(.text+0x16): In function `manipulador':
: relocation truncated to fit: R_X86_64_32 .rodata
modulo_teste.o(.text+0x20): In function `manipulador':
: relocation truncated to fit: R_X86_64_PC32 printf
modulo_teste.o(.text+0x2d): In function `manipulador':
: relocation truncated to fit: R_X86_64_32 .rodata
modulo_teste.o(.text+0x37): In function `manipulador':
: relocation truncated to fit: R_X86_64_PC32 printf
modulo_teste.o(.text+0x90): In function `testemodulo':
: relocation truncated to fit: R_X86_64_32S .data
modulo_teste.o(.text+0xd6): In function `testemodulo':
: relocation truncated to fit: R_X86_64_PC32 lkm_nofunc
modulo_teste.o(.text+0xf3): In function `testemodulo':
: relocation truncated to fit: R_X86_64_PC32 lkmdispatch
modload: can't link `modulo_teste.o' creating `modulo_teste_info.o' bound
to 0xffff80003e63b000
root:modteste #
Alguém já passou por tal tipo de problema? Tem como dar uma luz?
Ficaria muito contente se alguém testasse em um 32bits e me
desse uma resposta sobre o danado.
É preciso ser root, e rodar em securelevel=-1 ( editar o
/etc/rc.securelevel passar o valor para -1, Rebootar [SIM!] )
Salve o código com o nome de: modulo_teste.c
Compile: cc -D_KERNEL -I/sys -c modulo_teste.c
Carregue: modload -o modulo_teste_info.o -etestemodulo
modulo_teste.o
Pode tentar carregar assim tbm: modload -etestemodulo
modulo_teste.o
==============================================================
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/exec.h>
#include <sys/conf.h>
#include <sys/lkm.h>
#include <sys/errno.h>
MOD_MISC("testemodulo")
int
manipulador( struct lkm_table *lkmtp, int cmd)
{
if (cmd == LKM_E_LOAD)
printf("Hello World!\n");
else if (cmd == LKM_E_UNLOAD)
printf("Bye Bye!\n");
return (0);
}
int
testemodulo( struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, manipulador, manipulador, lkm_nofunc)
}
============================================================
Aguardo pelas respostas de quem puder ajudar :)
Thiago
Mais detalhes sobre a lista de discussão Openbsd