Hello , 
        you have to write 
int init_module(void) 
        instead  of main(). Also you have to create only object
file instead of executable file . Then using

 $insmod module.o 

you have to insert your .o file in the kernel . when you will insert it in
the kernel init_module () will automatically execute .

 

********************************************************************
                TALK SLOW BUT THINK QUICK
********************************************************************
VIJAY PATEL                             VMAIL:(91) (02712) 69001 
ENGINEER -SC                            EMAIL:[EMAIL PROTECTED]
B.E ( COMPUTER )
INSTITUTE FOR PLASMA RESEARCH
(GOVT. OF INDIA )
BHAT , GANDHINAGAR ,INDIA-382 428

*********************************************************************
LIVE A GOOD HONORABLE LIFE .THEN WHEN YOU GET OLDER AND THINK BACK ,
YOU'LL GET ENJOY IT A SECOND TIME.
*********************************************************************

On Mon, 16 Nov 1998, [ks_c_5601-1987] ���缺 wrote:

> I'm novice at linux low level programming. Would you like to help me..?
> 
> I hope to access my memory-mapped based ISA Card. From several news group articles, 
>I got to know that it is needed to use functions as ioremap(), readb(), writeb()....  
> 
> so , I wrote my sample code for reading&writing the registers of my memory mapped 
>ISA Card.  but.. I always faild to link.
> 
> my code & error message is as follows..
> Can you give me a comment and good solution..?
> 
> #include <asm/io.h>
> 
> void main()
> {
>  unsigned long addr;
>  unsigned long size;
>  unsigned char readbyte;
> 
>  addr = 0xd6000;
>  size = 4095;
>  
>  ioremap(addr,size);
>  readbyte=readb(addr);
> }
> 
> >> gcc -o memiotest memiotest.c
> 
> memiotest.c: In function `main':
> memiotest.c:4: warning: return type of `main' is not `int'
> /tmp/ccrVq7Af.o: In function `main':
> /tmp/ccrVq7Af.o(.text+0x1d): undefined reference to `ioremap'
> /tmp/ccrVq7Af.o(.text+0x29): undefined reference to `readb'
> collect2: ld returned 1 exit status
> 
> 
> >> gcc -D__KERNEL__ -o memiotest memiotest.c
> 
> memiotest.c: In function `main':
> memiotest.c:4: warning: return type of `main' is not `int'
> /tmp/ccHR1coE.o: In function `main':
> /tmp/ccHR1coE.o(.text+0x1d): undefined reference to `ioremap'
> collect2: ld returned 1 exit status
> 
> 
> 

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to