Hi, I'm student and I don't have experience in embedded systems. I'm working with a
M-501 SoM board with ARM-Linux version 2.6.14-M5. I would like to compile this kernel's
module example code for my board. The kernel's module example code is:
===============================================================================
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <asm/current.h>
#include <linux/sched.h>
static int hola(void)
{
printk(KERN_INFO "Hi! the module had been load\n");
printk(KERN_INFO "The user space process is %s\n", current->comm);
printk(KERN_INFO "The PID is %i \n", current->pid);
return 0;
}
static void adios(void)
{
printk(KERN_INFO "Bye, the module kernel has been unload.\n");
}
module_init(hola);
module_exit(adios);
MODULE_AUTHOR("author's name");
MODULE_LICENSE("Licence's type");
MODULE_DESCRIPTION("Module Description");
===============================================================================
I used this makefile:
===============================================================================
ifeq ($(KERNELRELEASE),)
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
.PHONY: build clean
build:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules #$(CC)
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c Mod* mod*
else
$(It is created with = ${KERNELRELEASE})
obj-m := hola.o
endif
===============================================================================
When I used this makefile, I can create and load in my Linux's PC the "hola.ok" file
without problems.
I downloaded the ARM-linux kernel's code from this site:
ftp://ftp.artila.com/Matrix5xx/Sources/kernel/m501_som/I modified the makefile file for adapted it to ARM-Linux.
===============================================================================
ifeq ($(KERNELRELEASE),)
KERNELDIR ?=/home/jyrios/Documentos/Kernels-arm-linux/linux-2.6.x # (path to ARM-linux kernel's code in my PC)
PWD :=$(shell pwd)
.PHONY: build clean
build:
$(MAKE) -C $(KERNELDIR) ARCH=arm CROSS_COMPILE=arm-linux- STRIP=arm-linux-strip -W -Wall M=$(PWD) modules #$(CC)
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c Mod* mod*
else
$(It is created with = ${KERNELRELEASE})
obj-m := hola.o
endif
===============================================================================
But, When I try to compile for the ARM-Linux, I got 2 errors compilation:
1. "the Module.symvers file is missing". What's the function for this file?
I looking for the "Module.symvers" file in /home/jyrios/Documentos/Kernels-arm-linux/linux-2.6.x
path and I don't find it!
2. Thousands and thousands of errors and warnings like:
a) include/linux/elf.h:19: warning: type defaults to `int' in declaration of `Elf32_Sword'
b) include/linux/elf.h:19: warning: data definition has no type or storage class
c) include/linux/elf.h:20: error: parse error before "Elf32_Word"
What is it I made wrong? I would appreciate a tutorial or a link to teach me about this.
Thanks!
P.D. I'm sorry for my english!!