ts-7000
[Top] [All Lists]

Re: [ts-7000] Re: programming tools for TS-Linux

To:
Subject: Re: [ts-7000] Re: programming tools for TS-Linux
From: Seano <>
Date: Wed, 16 May 2007 14:39:06 -0500
I think I know what you are saying, but building the kernel never worked for me under Cygwin or a linux box. Linux box complains the compiler can't create output files, the Cygwin box can't find 'asm/unistd.h' when I run the 'make' command for modutils when I follow the instructions.

there must be some fundamental things about developing for this that they assume you know and therefore they don't mention them in the documentation.

On 5/16/07, David Hawkins <> wrote:


> 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);


__._,_.___


SPONSORED LINKS
Single board computer Hardware Computer running slow
Linux os

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: =Email Delivery: Digest | m("yahoogroups.com?subject","ts-7000-fullfeatured");=Change Delivery Format: Fully Featured">Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | =Unsubscribe

__,_._,___
<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU