> I'm using the crosscompiler provided by TS. I have tried this on my PC
> using Cygwin and I have also tried it on an Ubuntu box.
>
> Same results, the 'hello world' is fine but the other file is the issue.
So, user-space 'hello world' works, but the kernel module appears
to be wrong ... let me reboot into Linux for a second ...
Here's the output of building the kernel module included inline
below ...
driver]$ export ARCH=arm
driver]$ export
PATH=/opt/crosstool/gcc-3.3.4-glibc-2.3.2/arm-unknown-linux-gnu/bin/:$PATH
driver]$ export CROSS_COMPILE=arm-unknown-linux-gnu-
driver]$ make
arm-unknown-linux-gnu-gcc -DDEBUG -D__KERNEL__ -DMODULE -O2 -Wall
-I../include
-I/home/dwh/ts7300/linux24-modules/lib/modules/2.4.26-ts11/build/include
-c fake_module.c
driver]$ file fake_module.o
fake_module.o: ELF 32-bit LSB relocatable, ARM, version 1 (ARM), not
stripped
So the file type of a kernel module is not the same as that of a
user-space app. This is expected, as the kernel does not use
shared libraries.
To build the kernel module, I unzipped the ts11 kernel, then
built it as per the TS instructions, and then installed the
modules into linux24-modules (as you can see in the Makefile).
You may get a depmod.old error when you install the modules,
however, things work ok for building modules.
Cheers
Dave
# Makefile
#
# Set ARCH, CROSS_COMPILE, and PATH before calling this
CC=$(CROSS_COMPILE)gcc
MODCFLAGS = -DDEBUG -D__KERNEL__ -DMODULE -O2 -Wall
#MODCFLAGS = -D__KERNEL__ -DMODULE -O2 -Wall
SHELL=sh
KERNEL_VERSION=2.4.26-ts11
TS7300_MODULES=/home/dwh/ts7300/linux24-modules
INCLUDES=-I../include
-I$(TS7300_MODULES)/lib/modules/$(KERNEL_VERSION)/build/include
all: fake_module.o
fake_module.o: fake_module.c
$(CC) $(MODCFLAGS) $(INCLUDES) -c fake_module.c
clean:
-rm -f *.o *~
/*---------------------------------------------------------------------------
* Filename: fake_module.c
* Author: D.W. Hawkins
* Date: July-2002
* Platform: Linux
* Purpose: Device driver development
*---------------------------------------------------------------------------
*
* This is a template driver for use while developing driver code.
*
* This template implements module load and unload and parameter
* interrogation.
*
* See fake_driver.c for a more complete driver template.
*
*---------------------------------------------------------------------------
*/
/*---------------------------------------------------------------------------
* Includes
*---------------------------------------------------------------------------
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/fs.h> /* file and device operations */
#include <linux/sched.h> /* ISR structure definitions */
#include <linux/interrupt.h> /* IRQ handling - ISRs */
#include <linux/slab.h> /* used to resolve kmalloc/kfree */
#include <linux/pci.h> /* PCI related macros and functions */
#include <asm/uaccess.h> /* get/put_user, copy_to/from_user */
#include <asm/io.h> /* ioremap, iounmap, memcpy_to/fromio */
/*---------------------------------------------------------------------------
* Global parameters
*---------------------------------------------------------------------------
*/
static char debug = 1;
/*---------------------------------------------------------------------------
* Information extractable via `modinfo' command
*---------------------------------------------------------------------------
*
* Use /sbin/modinfo -p fake_module.o (i.e., on the driver file)
* to see the parameters.
*
*/
MODULE_DESCRIPTION("Fake device driver module");
MODULE_AUTHOR("David Hawkins");
MODULE_LICENSE("GPL");
MODULE_PARM(debug, "1b");
MODULE_PARM_DESC(debug, "Enable/disable debugging messages");
/*---------------------------------------------------------------------------
* Debug message macro
*---------------------------------------------------------------------------
*
* This macro is used to generate debug information in the module. A module
* compiled with the symbol DEBUG defined can turn message generation on or
* off using an IOCTL call. A module compiled without DEBUG defined will
* not generate messages. (See the schar example in Ch. 21 [Mat99]).
*
*/
#ifdef DEBUG
#define MSG(string, args...) if (debug) printk("fake: " string, ##args)
#else
#define MSG(string, args...)
#endif
/*---------------------------------------------------------------------------
* Module load/unload declaration and definition
*---------------------------------------------------------------------------
*/
int fake_init()
{
MSG("Module 'fake' loaded.\n");
return 0;
}
void fake_exit()
{
MSG("Module 'fake' unloaded\n");
}
module_init(fake_init);
module_exit(fake_exit);
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/
|