Compiling a kernel module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

i'm trying to add a new kernel module to my ubuntu. I want to insert a new executable interpreter in order to create a new executable format. I have changed the magic number of an elf executable and I have used the /fs/binfmt_elf.c. to generate the new interpreter modifying this file to recognize my executable's magic number. When I try to compile my module with this make file:

MOD=binfmt_elfOS
KMOD=$(MOD).ko
obj-m += $(MOD).o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean


the displayed message is

>> make
make -C /lib/modules/2.6.20-15-386/build M=/home/zeta/phd/loader modules
make[1]: se ingresa al directorio `/usr/src/linux-headers-2.6.20-15-386'
CC [M] /home/loader/binfmt_elfOS.o
/home/loader/binfmt_elfOS.c: En la función 'load_elf_binary':
/home//loader/binfmt_elfOS.c:525: aviso: ISO C90 prohíbe las declaraciones mezcladas y código
/home/loader/binfmt_elfOS.c:757: aviso: declaración implícita de la función 'sprint'
/home/loader/binfmt_elfOS.c:774: aviso: declaración implícita de la función 'steal_locks'
/home/loader/binfmt_elfOS.c:1188:1: aviso: se redefinió "roundup"
En el fichero incluído de include/asm/system.h:4,
de include/asm/processor.h:18,
de include/asm/thread_info.h:16,
de include/linux/thread_info.h:21,
de include/linux/preempt.h:9,
de include/linux/spinlock.h:49,
de include/linux/module.h:9,
de /home/loader/binfmt_elfOS.c:12:
include/linux/kernel.h:41:1: aviso: esta es la ubicación de la definición previa
/home/loader/binfmt_elfOS.c: En la función 'fill_prstatus':
/home/loader/binfmt_elfOS.c:1303: aviso: 'session' es obsoleto (declarado en include/linux/sched.h:442)
/home/loader/binfmt_elfOS.c: En la función 'fill_psinfo':
/home/loader/binfmt_elfOS.c:1349: aviso: 'session' es obsoleto (declarado en include/linux/sched.h:442)
Building modules, stage 2.
MODPOST 1 modules
WARNING: "__kernel_vsyscall" [/home/loader/binfmt_elfOS.ko] undefined!
WARNING: "arch_align_stack" [/home/loader/binfmt_elfOS.ko] undefined!
WARNING: "arch_setup_additional_pages" [/home/loader/binfmt_elfOS.ko] undefined!
WARNING: "get_random_int" [/home/loader/binfmt_elfOS.ko] undefined!
WARNING: "arch_pick_mmap_layout" [/home/loader/binfmt_elfOS.ko] undefined!
WARNING: "randomize_va_space" [/home/loader/binfmt_elfOS.ko] undefined!
WARNING: "steal_locks" [/home/loader/binfmt_elfOS.ko] undefined!
WARNING: "sprint" [/home/loader/binfmt_elfOS.ko] undefined!
WARNING: "empty_zero_page" [/home/loader/binfmt_elfOS.ko] undefined!
WARNING: "dump_task_fpu" [/home/loader/binfmt_elfOS.ko] undefined!
WARNING: "dump_task_regs" [/home/loader/binfmt_elfOS.ko] undefined!
WARNING: "dump_task_extended_fpu" [/home/loader/binfmt_elfOS.ko] undefined!
CC /home/loader/binfmt_elfOS.mod.o
LD [M] /home/loader/binfmt_elfOS.ko
make[1]: se sale del directorio `/usr/src/linux-headers-2.6.20-15-386'

The kernel module is generated but if I try to insert:

>> insmod binfmt_elfOS.ko
insmod: error inserting 'binfmt_elfOS.ko': -1 Unknown symbol in module

And dmesg:
[21345.904000] binfmt_elfOS: Unknown symbol __kernel_vsyscall
[21345.904000] binfmt_elfOS: Unknown symbol randomize_va_space
[21345.904000] binfmt_elfOS: Unknown symbol empty_zero_page
[21345.904000] binfmt_elfOS: Unknown symbol sprint
[21345.904000] binfmt_elfOS: Unknown symbol steal_locks
[21345.904000] binfmt_elfOS: Unknown symbol dump_task_fpu
[21345.904000] binfmt_elfOS: Unknown symbol arch_align_stack
[21345.904000] binfmt_elfOS: Unknown symbol get_random_int
[21345.904000] binfmt_elfOS: Unknown symbol dump_task_extended_fpu
[21345.904000] binfmt_elfOS: Unknown symbol arch_setup_additional_pages
[21345.904000] binfmt_elfOS: Unknown symbol arch_pick_mmap_layout
[21345.908000] binfmt_elfOS: Unknown symbol dump_task_regs

Could anyone help me?

Thanks!

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux