Hi everyone,
I have been trying to compile a module to tun on my TS7260, I am using the
crosscompiler on cygwin, the code is very simple
#define MODULE
#include <linux/module.h>
int init_module(void) { printk("<1>Hello, world\n"); return 0; }
void cleanup_module(void) { printk("<1>Goodbye cruel world\n"); }
I downloaded the crosscompiler, the kernel source code. using the makefile of
the kernel source I wrote a makefile to compile this module:
VERSION = 2
PATCHLEVEL = 4
SUBLEVEL = 26
EXTRAVERSION =-ts11
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
ARCH := arm
KERNELPATH=kernel-$(shell echo $(KERNELRELEASE) | sed -e "s/-//g")
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
else if [ -x /bin/bash ]; then echo /bin/bash; \
else echo sh; fi ; fi)
TOPDIR := $(shell /bin/pwd)
HPATH = $(TOPDIR)/include
FINDHPATH = $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net
$(HPATH)/math-emu
HOSTCC = gcc
HOSTCFLAGS = -Wall -Wstrict-prototypes -Os -fomit-frame-pointer
CROSS_COMPILE = $(shell cd
/opt/crosstool/gcc-3.3.4-glibc-2.3.2/arm-unknown-linux-gnu/bin &&
pwd)/arm-unknown-linux-gnu-
AS = $(CROSS_COMPILE)as
LD = $(CROSS_COMPILE)ld
CC = $(CROSS_COMPILE)gcc
CPP = $(CC) -E
AR = $(CROSS_COMPILE)ar
NM = $(CROSS_COMPILE)nm
STRIP = $(CROSS_COMPILE)strip
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
MAKEFILES = $(TOPDIR)/.config
GENKSYMS = /sbin/genksyms
DEPMOD = /sbin/depmod
MODFLAGS = -DMODULE
CFLAGS_KERNEL =
PERL = perl
AWK = awk
RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
else echo rpm; fi)
export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
CONFIG_SHELL TOPDIR HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS MODFLAGS PERL
AWK
# here is the module I am compiling
all: hello.o
ifeq (.config,$(wildcard .config))
include .config
ifeq (.depend,$(wildcard .depend))
include .depend
do-it-all: Version vmlinux
else
CONFIGURATION = depend
do-it-all: depend
endif
else
CONFIGURATION = config
do-it-all: config
endif
MODLIB := $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
export MODLIB
CPPFLAGS := -D__KERNEL__ -I$(HPATH)
CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
-fno-strict-aliasing -fno-common
ifndef CONFIG_FRAME_POINTER
CFLAGS += -fomit-frame-pointer
endif
AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
export ROOT_DEV = CURRENT
export SVGA_MODE = -DSVGA_MODE=NORMAL_VGA
CORE_FILES =hello.o
clean:
It compiles no problem when I type
file hello.o I got :
hello.o ELF 32-bit LSB relocatable, ARM, version 1, not stripped
I transferred hello.o to the TS7260 and I said:
insmod: kernel-module version mismatch
./hello.o was compile fro kernel version
while this kernel is version 2.4.26-ts11
I read that you have to compile the kernel first so I get the version .h file
but after doing that I got the same problem..
I am missing a configuration step..
Regards
Omar
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|