2003-02-13 20:13:02

by shesha bhushan

[permalink] [raw]
Subject: Exporting Kernel Symbols

Hi,
I have written a new function in linux/fs/read_write.c and I want to make
the function avaliable to other kernel modules loaded using insmod.
He is what I did:
1. Wrore the func my_func() in linux/fs/read_write.c
2. Used the macro EXPORT_SYMBOL(my_func) inside linux/fs/read_write.c
3. Have a signature of my_func in my_func.h
4. Include my_func.h in linux/fs/read_write.c and my_driver.c
5. Recompiled the kernel
6. Compiler my_driver as loadable module.
7. Brought my new kernel Up.
8 . Insmod my_driver.o
Here I get the error "Unresolved symbol my_func"
Can any one clarify this.

Thanking You
Shesha





_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail


2003-02-13 20:19:09

by Randy.Dunlap

[permalink] [raw]
Subject: Re: Exporting Kernel Symbols

On Thu, 13 Feb 2003 20:22:48 +0000
"shesha bhushan" <[email protected]> wrote:

| Hi,
| I have written a new function in linux/fs/read_write.c and I want to make
| the function avaliable to other kernel modules loaded using insmod.
| He is what I did:
| 1. Wrore the func my_func() in linux/fs/read_write.c
| 2. Used the macro EXPORT_SYMBOL(my_func) inside linux/fs/read_write.c
| 3. Have a signature of my_func in my_func.h
| 4. Include my_func.h in linux/fs/read_write.c and my_driver.c
| 5. Recompiled the kernel
| 6. Compiler my_driver as loadable module.
| 7. Brought my new kernel Up.
| 8 . Insmod my_driver.o
| Here I get the error "Unresolved symbol my_func"
| Can any one clarify this.

For what kernel version?

In 2.4.20, e.g., in linux/fs/Makefile, change the following line:

export-objs := filesystems.o open.o dcache.o buffer.o

to include read_write.o

--
~Randy

2003-02-13 20:25:34

by shesha bhushan

[permalink] [raw]
Subject: Re: Exporting Kernel Symbols

Yup I have already appended read_write.o into export-objs list in the
linux/fs/Makefile.
I am working on Hardhat linux kernel version "2.4.18-rmk7-ds3"

Shesha






>From: "Randy.Dunlap" <[email protected]>
>To: "shesha bhushan" <[email protected]>
>CC: [email protected]
>Subject: Re: Exporting Kernel Symbols
>Date: Thu, 13 Feb 2003 12:26:10 -0800
>
>On Thu, 13 Feb 2003 20:22:48 +0000
>"shesha bhushan" <[email protected]> wrote:
>
>| Hi,
>| I have written a new function in linux/fs/read_write.c and I want to
>make
>| the function avaliable to other kernel modules loaded using insmod.
>| He is what I did:
>| 1. Wrore the func my_func() in linux/fs/read_write.c
>| 2. Used the macro EXPORT_SYMBOL(my_func) inside linux/fs/read_write.c
>| 3. Have a signature of my_func in my_func.h
>| 4. Include my_func.h in linux/fs/read_write.c and my_driver.c
>| 5. Recompiled the kernel
>| 6. Compiler my_driver as loadable module.
>| 7. Brought my new kernel Up.
>| 8 . Insmod my_driver.o
>| Here I get the error "Unresolved symbol my_func"
>| Can any one clarify this.
>
>For what kernel version?
>
>In 2.4.20, e.g., in linux/fs/Makefile, change the following line:
>
>export-objs := filesystems.o open.o dcache.o buffer.o
>
>to include read_write.o
>
>--
>~Randy
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to [email protected]
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at http://www.tux.org/lkml/

_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail

2003-02-13 21:00:21

by shesha bhushan

[permalink] [raw]
Subject: Re: Exporting Kernel Symbols

OK I got this working. It was a very silly thing.
linux/fs/read_write.c had not included <linux/module.h> But the kernel
compilation was not complaining about the useage of EXPORT_SYMBOL without
including <linux/module.
Now its working fine.

Thanks
-Shesha


>From: "Randy.Dunlap" <[email protected]>
>To: "shesha bhushan" <[email protected]>
>CC: [email protected]
>Subject: Re: Exporting Kernel Symbols
>Date: Thu, 13 Feb 2003 12:26:10 -0800
>
>On Thu, 13 Feb 2003 20:22:48 +0000
>"shesha bhushan" <[email protected]> wrote:
>
>| Hi,
>| I have written a new function in linux/fs/read_write.c and I want to
>make
>| the function avaliable to other kernel modules loaded using insmod.
>| He is what I did:
>| 1. Wrore the func my_func() in linux/fs/read_write.c
>| 2. Used the macro EXPORT_SYMBOL(my_func) inside linux/fs/read_write.c
>| 3. Have a signature of my_func in my_func.h
>| 4. Include my_func.h in linux/fs/read_write.c and my_driver.c
>| 5. Recompiled the kernel
>| 6. Compiler my_driver as loadable module.
>| 7. Brought my new kernel Up.
>| 8 . Insmod my_driver.o
>| Here I get the error "Unresolved symbol my_func"
>| Can any one clarify this.
>
>For what kernel version?
>
>In 2.4.20, e.g., in linux/fs/Makefile, change the following line:
>
>export-objs := filesystems.o open.o dcache.o buffer.o
>
>to include read_write.o
>
>--
>~Randy
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to [email protected]
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at http://www.tux.org/lkml/

_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail