Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#244092 - 15/12/2004 16:13 Calling all kernel gurus!
sn00p
addict

Registered: 24/07/2002
Posts: 618
Loc: South London
I've had the most depressing few days at work trying to get an RS485 link (500 kbaud) working. Originally it was using the card mentioned here and was running an app on windows, but the final system runs linux and would run from flash memory.

The card is question has linux drivers available.

However, they've provided a "RedHat9" prebuilt module, except that it's not actually for the kernel that ships with redhat 9, it's for 2.4.25, and they provided no information on what kernel configuration is actually required in kernel to make the driver work.

So I spent this morning figuring out that SMP needed to be enabled to insmod the driver. Eventually, I managed to get the driver installed, but using it would cause a seg fault.

Eventually their technical support got back to me and sent the configuration for the kernel they built the driver with. This confirmed my worst fear, for some very strange reason, they'd decided to build the module for a "Pentium III", this of course is of no use to me as we're using a mini-itx board which doesn't like stuff compiled for "Pentium III".

So, all I need to do is compile the module and I'm away right? They've provided the source code (BbSerial.c) , but they've not provided a makefile for it, and I can't for the life of me figure out how I get it to build. I just get a whole load of messages about needing to use export-objs. Oh, and they're also missing an include file called BbVersion.h, but I think this only contains the version strings which they've commented out of the top of the BbSerial.c.

I'd appreciate it if anybody knows how I can create a Makefile that will build this module, hopefully then I'll be less stressed! Any pointers seriously appreciated.

Top
#244093 - 15/12/2004 16:57 Re: Calling all kernel gurus! [Re: sn00p]
genixia
Carpal Tunnel

Registered: 08/02/2002
Posts: 3411
A _very_ quick look suggests that a Makefile might be overkill.

At the top of the BbSerial.c file are two commented out lines. Try uncommenting them;
Quote:
static char *serial_version = "5.05c";
static char *serial_revdate = "2001-07-08";


The comment out the line that includes the missing header file'

Quote:
##include "BbVersion.h"


and see if you can compile that;

Quote:
gcc BbSerial.c -o BbSerial.o
_________________________
Mk2a 60GB Blue. Serial 030102962 sig.mp3: File Format not Valid.

Top
#244094 - 15/12/2004 17:13 Re: Calling all kernel gurus! [Re: genixia]
sn00p
addict

Registered: 24/07/2002
Posts: 618
Loc: South London
Quote:
A _very_ quick look suggests that a Makefile might be overkill.

At the top of the BbSerial.c file are two commented out lines. Try uncommenting them;
Quote:
static char *serial_version = "5.05c";
static char *serial_revdate = "2001-07-08";


The comment out the line that includes the missing header file'

Quote:
##include "BbVersion.h"


and see if you can compile that;

Quote:
gcc BbSerial.c -o BbSerial.o



I'll slap myself very hard if that works! I'd obviously already changed the source file to eradicate the bbversion header - I guess I really should have tried basic gcc compile first, I've only ever written one module and that was only a test on 2.6.X - which is different. Oh well, I'll try that tomorrow.

Top
#244095 - 15/12/2004 18:48 Re: Calling all kernel gurus! [Re: sn00p]
genixia
Carpal Tunnel

Registered: 08/02/2002
Posts: 3411
That won't work to give you a kernel module though...you'd be missing some paths and flags. Looking at the very bottom of BbSerial.c is instructive...

Code:
/*

Local variables:
compile-command: "gcc -D__KERNEL__ -I../../include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \
-fno-strict-aliasing -pipe -fno-strength-reduce -march=i586 -DMODULE -DMODVERSIONS \
-include ../../include/linux/modversions.h -DEXPORT_SYMTAB -c serial.c"
End:
*/



This matches the code in the bottom of serial.c in a 2.2 series linux kernel (/usr/src/linux/drivers/char/serial.c) and I suspect a 2.4 series version too.
This suggests that BbSerial.c is intended to be compiled in the same fashion as serial.c, ie place the files into the drivers/char subdirectory of your linux source tree, and add BbSerial.o as a target to that directory's Makefile, using serial.c as a template.


Edited by genixia (15/12/2004 22:02)

Top
#244096 - 15/12/2004 19:03 Re: Calling all kernel gurus! [Re: genixia]
sn00p
addict

Registered: 24/07/2002
Posts: 618
Loc: South London
Quote:
That won't work to give you a kernel module though...you'd be missing some paths and flags. Looking at the very bottom of BbSerial.c is instructive...



Good spot. I missed that, don't think I made it to the bottom of the source. At least I've got some stuff to try now.

Many thanks dude! Hopefully I'll have a more constructive day (and less depressing/frustrating) tomorrow.

Top
#244097 - 17/12/2004 05:04 Re: Calling all kernel gurus! [Re: sn00p]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14484
Loc: Canada
What kernel(s) do you want it to work with?

I have a devel environment here for building Redhat driver diskettes for their kernels..

Top
#244098 - 17/12/2004 07:31 Re: Calling all kernel gurus! [Re: mlord]
sn00p
addict

Registered: 24/07/2002
Posts: 618
Loc: South London
Quote:
What kernel(s) do you want it to work with?

I have a devel environment here for building Redhat driver diskettes for their kernels..


Thanks for the offer Mark, but their technical support finally realised that I needed to rebuild the module and they provided me with the information I needed! Only took 2 days of me asking though!

At least the link is up and running at 500 kbaud, the same can't be said however for the application yet!

Adrian

Top