Skip to contentSkip to conversation

Linux 2.6 Build System and Binary Modules

DISCUSSION Robbert Haarman 5 participants 7 messages Feb 29, 2004 – Mar 1, 2004

lore
Share & tools
lore
#0 lore raw

Hello list,

Excuse me for not finding this if it has been asked before. Please Cc any answers, as I am not subscribed to this list.

I am trying to port a driver for the Realtek 8180 wireless ehternet controller from 2.4 to 2.6. The module comes as a binary-only object file with some sources that can be adapted to fit the specific kernel. My problem is that I can't figure out how to get the 2.6 kernel to include the binary part (it's in a .o file). The new build system does a little too much magic - compiling the module from source to .ko without giving me a chance to sneak in the binary code. How do I get it to link in the .o file, without making it look for the like-named .c file?

Cheers,

Robbert Haarman

---
"UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things."
--Doug Gwyn

#1 lore raw
Quoted 9 lines · Robbert Haarman

Hello list,

Excuse me for not finding this if it has been asked before. Please Cc any answers, as I am not subscribed to this list.

I am trying to port a driver for the Realtek 8180 wireless ehternet controller from 2.4 to 2.6. The module comes as a binary-only object file with some sources that can be adapted to fit the specific kernel. My problem is that I can't figure out how to get the 2.6 kernel to include the binary part (it's in a .o file). The new build system does a little too much magic - compiling the module from source to .ko without giving me a chance to sneak in the binary code. How do I get it to link in the .o file, without making it look for the like-named .c file?

Cheers,

Robbert Haarman

I do not know if it will help You, but take a look at how makefile of new nvidia driver is built... (patches from minion.de or newest driver from nvidia.com)

Grzegorz Kulewski

#2 lore raw
Quoted 5 lines · Grzegorz Kulewski
Quoted 1 line

How do I get it to link in the .o file, without making it look for the like-named .c file?

I do not know if it will help You, but take a look at how makefile of new nvidia driver is built... (patches from minion.de or newest driver from nvidia.com)

Thanks, I got it now. Now just to see what I can do about missing __generic_copy_to_user and ..._from_user. :-)

---
"One of the common denominators I have found is that expectations rise above that which is expected."
-- George W. Bush

#3 lore raw

That's were I'm stuck too...

Quoted 12 lines · Robbert Haarman
Quoted 5 lines · Grzegorz Kulewski
Quoted 1 line

How do I get it to link in the .o file, without making it look for the like-named .c file?

I do not know if it will help You, but take a look at how makefile of new nvidia driver is built... (patches from minion.de or newest driver from nvidia.com)

Thanks, I got it now. Now just to see what I can do about missing __generic_copy_to_user and ..._from_user. :-)

---
"One of the common denominators I have found is that expectations rise above that which is expected."
-- George W. Bush

Signature · 1 line
Larry Reaves <[email protected]>
#4 lore raw
In reply to Robbert Haarman

I am trying to do exactly the same thing... unfortunately I have not had much success getting it to work. I have, however, solved your problem. What I did was 'touch -B 9999999 priv_part.c' which creates an empty file with a timestamp of the current time minus 9999999 seconds. Because make will only recompile if the source is newer than the .o, it will assume it is already compiled and it will just link it in. I am new to kernel development, so I haven't made much progress beyond getting the module to compile without errors. If you are able to get it to work, please let me know.

Quoted 14 lines · Robbert Haarman

Hello list,

Excuse me for not finding this if it has been asked before. Please Cc any answers, as I am not subscribed to this list.

I am trying to port a driver for the Realtek 8180 wireless ehternet controller from 2.4 to 2.6. The module comes as a binary-only object file with some sources that can be adapted to fit the specific kernel. My problem is that I can't figure out how to get the 2.6 kernel to include the binary part (it's in a .o file). The new build system does a little too much magic - compiling the module from source to .ko without giving me a chance to sneak in the binary code. How do I get it to link in the .o file, without making it look for the like-named .c file?

Cheers,

Robbert Haarman

---
"UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things."
--Doug Gwyn

Signature · 1 line
Larry Reaves <[email protected]>
#5 lore raw
In reply to Robbert Haarman
Quoted 5 lines · Robbert Haarman

Hello list,

Excuse me for not finding this if it has been asked before. Please Cc any answers, as I am not subscribed to this list.

I am trying to port a driver for the Realtek 8180 wireless ehternet controller from 2.4 to 2.6. The module comes as a binary-only object file with some sources that can be adapted to fit the specific kernel. My problem is that I can't figure out how to get the 2.6 kernel to include the binary part (it's in a .o file). The new build system does a little too much magic - compiling the module from source to .ko without giving me a chance to sneak in the binary code. How do I get it to link in the .o file, without making it look for the like-named .c file?

There is no good nor documented way to do it today. But you can use:

$(obj)/module.o: ld_flags += binary.o
Assuming you are building a module, and 'module' is the name of the resulting module.

For built-in you shall use:
$(obj)/built-in.o: ld_flags += binary.o

Sam

#6 lore raw

Progress on RTL8180 Driver for Linux 2.6

For all who have asked about my efforts to make the RTL8180 driver work on 2.6, and others who are interested, here's an update.

I've gotten the driver to build against the 2.6 kernel. The closed source part references __generic_copy_{from,to}_user, which seem to have been replaced by __copy_{to,from}_user_ll (see arch/i386/lib/usercopy.c from the kernel sources). I have written a compatibility file that wraps the new functions inside the old names. With that, the module loads, but then causes a kernel oops due to a null pointer dereference in the initialization code.

The sources I use can be obtained from my computer; point your browser at http://hal.shire.sytes.net:5800/~inglorion/software/#rtl_8180_driver and download the tarball from there.

Happy hacking,

Robbert Haarman

---
"For every complex problem there is an answer that is clear, simple, and wrong."

	-- H.L. Mencken