From: Brian (bwang@mltc.com.tw)
Date: Wed Sep 04 2002 - 04:27:15 EDT
Hi Greg,
Thanks for the reply.
(I do not know if I can attach files to the email in this mailing list
or not... I'll just copy and paste the whole thing below...)
Here is the complete code for the hello world module:
======================================
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
static int __init hello_init(void)
{
printk("Hello world from ML-I0101...\n");
return 0;
}
static void __exit hello_exit(void)
{
printk("Byebye from ML-I0101...\n");
}
module_init(hello_init);
module_exit(hello_exit);
EXPORT_NO_SYMBOLS;
======================================
Here is the related output of "make modules". I did a "make
modules_install" afterwards.
=======================================================
[snip...]
make[3]: Entering directory
`/data/develop/uClinux/uClinux-dist/linux-2.4.x/drivers/char'
make[3]: Circular
/data/develop/uClinux/uClinux-dist/linux-2.4.x/include/asm/arch/hardwa
re.h <-
/data/develop/uClinux/uClinux-dist/linux-2.4.x/include/asm/io.h
dependency dropped.
arm-elf-gcc -D__KERNEL__ -I/data/develop/uClinux/uClinux-dist/linux-2.
4.x/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-
aliasing -fno-common -fno-common -pipe -fno-builtin -D__linux__ -DNO_M
M -mapcs-32 -march=armv4 -mtune=arm7tdmi -mshort-load-bytes -msoft-flo
at -DMODULE -c -o hello.o hello.c
make[3]: Leaving directory
`/data/develop/uClinux/uClinux-dist/linux-2.4.x/drivers/char'
[snip...]
=======================================================
Here is the output when I tried to install the module:
=======================================================
/> insmod hello.o
Using /lib/modules/2.4.17-uc0/kernel/drivers/char/hello.o
/> lsmod
Module Size Used by
hello 240 1 (initializing)
/> rmmod hello
rmmod: hello: Device or resource busy
pid 22: failed 256
=======================================================
Please let me know if you want more information.
Thanks. : -)
Brian
----- Original Message -----
From: "Greg Ungerer" <gerg@snapgear.com>
To: <uclinux-dev@uclinux.org>
Sent: Wednesday, September 04, 2002 3:32 PM
Subject: Re: [uClinux-dev] Module Loading Problem - Simple Hello World
Module...
> Hi Brian,
>
> Can you send the code and the output of the make when
> building it?
>
> Regards
> Greg
>
>
>
> Brian wrote:
> > Hello all,
> >
> > I have written and run some simple device driver modules before
> > without any
> > problem. However, a simple hello world module (like the one in
the
> > device
> > driver book), which simply prints out some greeting message, gives
me
> > trouble... I tried the same code on my native Linux box and it
worked
> > fine.
> >
> > I can "insmod" the module correctly but the console does not print
out
> > the message.
> > When I did a "lsmod", the console showed the module was
> > "initializing". I could not
> > "rmmod" it, which gave "Unknown error".
> >
> > I put the module in "linux-2.4.x/drivers/char/" and also modified
the
> > corresponding
> > Config.in and Makefile to include it in the kernel
configuration/build
> > process just
> > like what I did for other drivers. The module stays in the
> > "initializing" stage.
> >
> > I could not find related messages about this problem. I tried it
with
> > both uClibc and
> > uC-libc but the results were the same.
> >
> > I am using ARM uClinux 2.4.x in uClinux-dist-20020502.
> >
> > Any idea?
> >
> >
> > Brian
> >
> >
> >
> >
> >
> > This message resent by the uclinux-dev@uclinux.org list server
http://www.uClinux.org/
> >
>
> --
> --------------------------------------------------------------------
----
> Greg Ungerer -- Chief Software Wizard EMAIL:
gerg@snapgear.com
> SnapGear Pty Ltd PHONE: +61 7 3435
2888
> 825 Stanley St, FAX: +61 7 3891
3630
> Woolloongabba, QLD, 4102, Australia WEB:
www.SnapGear.com
>
> This message resent by the uclinux-dev@uclinux.org list server
http://www.uClinux.org/
This message resent by the uclinux-dev@uclinux.org list server http://www.uClinux.org/
This archive was generated by hypermail 2.1.4 : Thu Sep 19 2002 - 13:21:48 EDT