Linux Driver Porting Information

All development related issues welcome

Moderator: Moderator Team

Which is better porting drivers from another OS or writing from scratch?

Porting
9
36%
Scratch
16
64%
 
Total votes: 25

disks86
Posts: 35
Joined: Tue Mar 22, 2005 10:17 pm
Location: USA
Contact:

Linux Driver Porting Information

Post by disks86 » Fri Nov 23, 2007 4:29 am

Hello everyone, I'm looking for information on how to port drivers from Linux to React OS. Of course this includes documents intended for windows as they should be the same in terms of interfaces.

Now first off(really second I guess) I have never written a driver before so documents on how windows drivers work in general would also be helpful.

The reason I want to port drivers from Linux to React OS is because Linux has drivers for allot of hardware all of which(in kernel anyhow) are open source.

I realize Linux and windows work differently but the Linux drivers should at least work as examples of how to use a piece of hardware.

Anyway my plan is as follows. I wanted to boot my test box in some version of Linux find out what drivers it uses and port those to React OS then use that box as a test bed for my ported drivers and anything else I develop. I have some random NICs and such that I may also port drivers for if I am able to pull off the first part.

I know this will take quite some time specially considering my inexperience but I'm willing to give it a shot.
Talk is cheap. Show me the code. - Linus Torvalds

tomleem
Posts: 628
Joined: Mon Mar 28, 2005 6:59 pm
Location: New Hampshire of United States of America
Contact:

depends on the driver/software

Post by tomleem » Fri Nov 23, 2007 4:16 pm

With some drivers/software, one might have to rewrite the parts or the whole thing. Would it not be better to start from scratch? :?:
* * * * * * * * * * * * *
Tom Lee M / BigGoofyGuy
* * * * * * * * * * * * *

disks86
Posts: 35
Joined: Tue Mar 22, 2005 10:17 pm
Location: USA
Contact:

possibly

Post by disks86 » Fri Nov 23, 2007 4:28 pm

Possibly like I said this is new ground for me. However hardware manufacturers are not always willing to provide documentation for developing drivers and Linux driver developers have already done the work of figuring out how to make the hardware work. So I have to believe there is some parts of the drivers that can be reused. Even if it is just basic information on how to communicate with the hardware.


I have seen drivers ported from windows to Linux so I don't know why the reverse can't be done.
Talk is cheap. Show me the code. - Linus Torvalds

tomleem
Posts: 628
Joined: Mon Mar 28, 2005 6:59 pm
Location: New Hampshire of United States of America
Contact:

depends on the drive/software

Post by tomleem » Fri Nov 23, 2007 5:24 pm

It would depend on the driver that one is porting or trying to create. If the source code is there to port, one can port it; otherwise, one has to start from scratch. 8)
* * * * * * * * * * * * *
Tom Lee M / BigGoofyGuy
* * * * * * * * * * * * *

Z98
Release Engineer
Posts: 3379
Joined: Tue May 02, 2006 8:16 pm
Contact:

Post by Z98 » Fri Nov 23, 2007 6:53 pm

The last time the developers attempted to port something from Linux, it took something like three years. That was for the USB stack. The kernel interfaces are completely different and often it's better to just write the thing from scratch, possibly using the Linux driver as a reference.

GreatLord
Developer
Posts: 926
Joined: Tue Nov 30, 2004 10:26 am
Location: Sweden

Post by GreatLord » Fri Nov 23, 2007 10:26 pm

Dotnot foregt we did also port bsd tcp/ip stack to reactos it took 2-3 year as well.

Linux arch are completed diffent from windows.

disks86
Posts: 35
Joined: Tue Mar 22, 2005 10:17 pm
Location: USA
Contact:

Point Taken

Post by disks86 » Sat Nov 24, 2007 1:39 am

Ok, point taken this might be harder than it sounds.

But what about article & book recommendations. If writing from scratch and only using the Linux driver as a reference is what I need to do I still need documentation to tell me how to write a driver.

Thank you all for taking the time to reply to my newbie questions.
Talk is cheap. Show me the code. - Linus Torvalds

Z98
Release Engineer
Posts: 3379
Joined: Tue May 02, 2006 8:16 pm
Contact:

Post by Z98 » Sat Nov 24, 2007 1:57 am

http://www.codeproject.com/system/driverdev.asp

Programming the Microsoft Windows Driver Model, Second Edition

Developing Drivers with the Windows Driver Foundation

Enjoy.

FlyingIsFun1217
Posts: 475
Joined: Sun Jun 10, 2007 3:56 am

Post by FlyingIsFun1217 » Sat Nov 24, 2007 5:44 pm

Z98 wrote:Enjoy
Heh...

FlyingIsFun1217

disks86
Posts: 35
Joined: Tue Mar 22, 2005 10:17 pm
Location: USA
Contact:

actually

Post by disks86 » Sat Nov 24, 2007 10:58 pm

Actually I do enjoy this type of thing although I will have to admit this is probably the hardest thing I have ever attempted.

Not only do I have to learn more about how windows works but also how hardware works.

However it is a little easier than I thought. I thought I would be communicating directly with hardware but from what I have read thus far it is more like communicating with the hal & kernel.

I decided to poke around inside one of the current React OS drivers to see if it was starting to make sense yet. But other than a few prints & checks it remains an enigma.

Anyway realistically I think this is going to take me some time to be able to make anything useful. The good news is I now get the Ke/Kernel/Ketchup joke.
Talk is cheap. Show me the code. - Linus Torvalds

FlyingIsFun1217
Posts: 475
Joined: Sun Jun 10, 2007 3:56 am

Post by FlyingIsFun1217 » Sun Nov 25, 2007 5:17 am

Do you yet know assembly?

FlyingIsFun1217

disks86
Posts: 35
Joined: Tue Mar 22, 2005 10:17 pm
Location: USA
Contact:

nope

Post by disks86 » Sun Nov 25, 2007 5:24 am

No, I don't know assembly. I was under the impression that windows didn't support assembly drivers. Is that different in React OS or were you asking for a different reason?
Talk is cheap. Show me the code. - Linus Torvalds

GreatLord
Developer
Posts: 926
Joined: Tue Nov 30, 2004 10:26 am
Location: Sweden

Post by GreatLord » Sun Nov 25, 2007 11:46 am

todo a proper driver in windows u shall avoid asm in the drv for the drv can be compile for another cpu.

even ms ddk/wdf say it is forbien using asm in the drivers it self.

FlyingIsFun1217
Posts: 475
Joined: Sun Jun 10, 2007 3:56 am

Post by FlyingIsFun1217 » Sun Nov 25, 2007 8:52 pm

From what I know, though, most linux drivers are coded using assembly.

FlyingIsFun1217

disks86
Posts: 35
Joined: Tue Mar 22, 2005 10:17 pm
Location: USA
Contact:

odd

Post by disks86 » Sun Nov 25, 2007 9:25 pm

Linux drivers in assembly seems odd though. Because Linux is very portable. I mean they have versions for x86,x86_64,PowerPC, and sparc. I know they also work on many embedded or specialized devices like Xbox & some PDA type systems.

I don't see how that would be possible if they were assembly unless they ported the drivers each time.
Talk is cheap. Show me the code. - Linus Torvalds

Locked

Who is online

Users browsing this forum: No registered users and 0 guests