[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
To make insmod work requires some work
I've been trying to compile insmod and to make it work.
Since the elf file format is architechture dependent,
and there is no supported architechture that is quite equal
to Etrax, I've given up because I don't have
enought time for it.
The modutil compiles and works, except that it can't load
CRIS elf files correctly.
I've come abit on the way, and in this mail I write down
what I've found out, if someone wants to continue on the work.
First flags for build modutils package:
export "CC=$AXIS_DIR/tools/gcc_cris -mlinux -DCRISMMU
export "CFLAGS= -O2 -Wall"
export "LDFLAGS=-s -static"
(Maybe you have to compile a program named makecrc32 in directory
genksyms with "gcc makecrc32.c -o makecrc32")
Also you have to make a link from /usr/include/elf.h to
include/elf.h. It is needed to compile.
And configure switch:
In the directory include/ you have the
architechture depend header files. I've found
out the architechture of the CRIS elf header file.
Some parts came from asm-cris/elf.h, and the last
two lines are assumed to be correct from using
some "Elf Kicker tools" for ELF analysing.
(Also modinfo tell you that, if you have compiled it with
Here comes: include/elf_cris.h
/* Machine-specific elf macros for CRIS */
#define EM_CRIS 76 /* from asm/elf.h */
#define ELFCLASSM ELFCLASS32
#define ELFDATAM ELFDATA2LSB
#define MATCH_MACHINE(x) (x= EM_CRIS)
#define SHT_RELM SHT_RELA
#define Elf32_RelM Elf32_Rela
There is no archtechture supported by modutils that has the
same variants of "ELFCLASSM", "ELFDATAM", "SHT_RELM" and "Elf32_RelM"
(Look in the include/ directory)
To compile a module for Etrax you do like this:
(Thanks to Lars Viklund at Axis for help!)
gcc_cris -fno-leading-underscore -O2 -Wall -c -I/opt/Etrax/linux/include
-DMODULE -D__KERNEL__ -DCRISMMU -D__linux__ foo.c
Left is to write a file named "obj/obj_cris.c" that can load cris
Jonas Aaberg Email: email@example.com
Supercomputing Systems AG Web: http://www.scs.ch
Technoparkstrasse 1 Phone: +41 (0) 1 445 16 00
CH-8005 Zuerich Fax: +41 (0) 1 445 16 10