Driver Development Books?

2005-10-12 Thread Pete

Hello,
   I have what may seem to be a silly question, but I cannot find any 
other decent resources on the web. . The problem that I am having 
right now is
that I have a fairly nice graphics card which, for the moment is only 
supported on Windows Operating systems, and old 2.4 Linux kernels. So 
far there has
not been much positive outlook in porting the drivers to *BSD or any of 
the 2.6 kernels that I know of, let alone 64-bit drivers for non-Win OSes.


So I guess that makes my question fairly simple then; I know that driver 
code is written in C (which I am learning currently) but thats about all 
I know. I'm probably
not far off when I say that I need more to go on. Yet, from looking at 
Amazon.com I have not been able to find any books on writing driver 
code, which is really

frustrating.

One of my security related books, Rootkits, tells me about how to write 
drivers for a completely different reason so I know a bit more about how 
they work but again
the code involved does not interface hardware to the OS, just injects a 
custom application. The other tool that I will probably use is Jungo, 
which is a nice-looking
application which automates a skeletal version of the driver you need, 
but again, I would not know how to fill it out.


Any help is appreciated.

-Pete

Rootkits Book Homepage -- http://www.rootkit.com/
Jungo WinDriver -- http://www.jungo.com/windriver.html
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Driver Development Books?

2005-10-12 Thread Sergey Babkin
From: Pete [EMAIL PROTECTED]
Date: Tue Oct 11 11:47:28 CDT 2005
To: freebsd-hackers@freebsd.org
Subject: Driver Development Books?

Hello,
I have what may seem to be a silly question, but I cannot find any 
other decent resources on the web. . The problem that I am having 
right now is
that I have a fairly nice graphics card which, for the moment is only 
supported on Windows Operating systems, and old 2.4 Linux kernels. So 
far there has
not been much positive outlook in porting the drivers to *BSD or any of 
the 2.6 kernels that I know of, let alone 64-bit drivers for non-Win OSes.

The video cards usually have nothing to do
with the kernel itself. Their drivers are in the
X Window system. Probably the easiest fix is
to just install an older version (3.x probably)
of XFree86 on your machine.

So I guess that makes my question fairly simple then; I know that driver 
code is written in C (which I am learning currently) but thats about all 

Well, you usually need a bit more expertise
than learning currently to write drivers.

I know. I'm probably
not far off when I say that I need more to go on. Yet, from looking at 
Amazon.com I have not been able to find any books on writing driver 
code, which is really
frustrating.

Searching for device driver turns up
a lot of books on Amazon. For the system-specific
details look in the online FreeBSD Device Driver
Writer's guide (part of the Handbook if I
remember correctly).

Anyway, for the graphical cards it's not what 
you need. The graphical drivers are running
in user space as a part of X server. Writing
them is a completely different story and I
don't think there are any manuals. Just look
at the code of the other drivers and do the
same.

-SB
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Driver Development Books?

2005-10-12 Thread Joao Barros
On 10/11/05, Pete [EMAIL PROTECTED] wrote:
 Hello,
 I have what may seem to be a silly question, but I cannot find any
 other decent resources on the web. . The problem that I am having
 right now is
 that I have a fairly nice graphics card which, for the moment is only
 supported on Windows Operating systems, and old 2.4 Linux kernels. So
 far there has
 not been much positive outlook in porting the drivers to *BSD or any of
 the 2.6 kernels that I know of, let alone 64-bit drivers for non-Win OSes.

 So I guess that makes my question fairly simple then; I know that driver
 code is written in C (which I am learning currently) but thats about all
 I know. I'm probably
 not far off when I say that I need more to go on. Yet, from looking at
 Amazon.com I have not been able to find any books on writing driver
 code, which is really
 frustrating.

 One of my security related books, Rootkits, tells me about how to write
 drivers for a completely different reason so I know a bit more about how
 they work but again
 the code involved does not interface hardware to the OS, just injects a
 custom application. The other tool that I will probably use is Jungo,
 which is a nice-looking
 application which automates a skeletal version of the driver you need,
 but again, I would not know how to fill it out.

 Any help is appreciated.

 -Pete

I started porting a pseudo driver from OpenBSD and had the same issues.

You could find more info here:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/arch-handbook/index.html
http://www.freebsd.org/doc/en_US.ISO8859-1/books/arch-handbook/newbus-api.html
http://www.freebsd.org/doc/en_US.ISO8859-1/books/arch-handbook/driverbasics-char.html#AEN8703

And this come in very handy:
FreeBSD Source Code Tour: http://snapshots.jp.freebsd.org/tour/
A nice website provided by Robert Watson (Thanks!!!): http://fxr.watson.org/

Looking at existing code is also good, like the simple led driver by phk@
There was also a thread where John Baldwin described the parts of a
driver but I can't seem to find it.

--
Joao Barros
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Driver Development Books?

2005-10-12 Thread Scott Long

Pete wrote:

Hello,
   I have what may seem to be a silly question, but I cannot find any 
other decent resources on the web. . The problem that I am having 
right now is
that I have a fairly nice graphics card which, for the moment is only 
supported on Windows Operating systems, and old 2.4 Linux kernels. So 
far there has
not been much positive outlook in porting the drivers to *BSD or any of 
the 2.6 kernels that I know of, let alone 64-bit drivers for non-Win OSes.


So I guess that makes my question fairly simple then; I know that driver 
code is written in C (which I am learning currently) but thats about all 
I know. I'm probably
not far off when I say that I need more to go on. Yet, from looking at 
Amazon.com I have not been able to find any books on writing driver 
code, which is really

frustrating.

One of my security related books, Rootkits, tells me about how to write 
drivers for a completely different reason so I know a bit more about how 
they work but again
the code involved does not interface hardware to the OS, just injects a 
custom application. The other tool that I will probably use is Jungo, 
which is a nice-looking
application which automates a skeletal version of the driver you need, 
but again, I would not know how to fill it out.


Any help is appreciated.

-Pete



There are indeed no books that I know of on the subject of writing
drivers for any *BSD, let alone FreeBSD.  For the last year I've wanted
to sit down and write such a book, but the amount of time needed to do
this is daunting.   Anyways, there were a couple of articles published
back around 2000 on DeamonNews that covered some basic information on
writing kernel modules, and they are likely still available via the
various web search engines.  For more detailed information, you'll need
to dig into the kernel source code, look for appropriate manual pages,
and ask questions.  There are a number of really good people on this
list that try to answer most questions like this, so don't be afraid to
ask.

Scott
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Driver Development Books?

2005-10-12 Thread M. Warner Losh
In message: [EMAIL PROTECTED]
Scott Long [EMAIL PROTECTED] writes:
: For more detailed information, you'll need
: to dig into the kernel source code, look for appropriate manual pages,
: and ask questions.  There are a number of really good people on this
: list that try to answer most questions like this, so don't be afraid to
: ask.

There's also a [EMAIL PROTECTED] which is specifically for questions
about writing drivers.

Warner
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Driver Development Books?

2005-10-12 Thread Scott Long

Sangwoo Shim wrote:


2005/10/12, Scott Long [EMAIL PROTECTED]:


Pete wrote:


Hello,
  I have what may seem to be a silly question, but I cannot find any
other decent resources on the web. . The problem that I am having
right now is
that I have a fairly nice graphics card which, for the moment is only
supported on Windows Operating systems, and old 2.4 Linux kernels. So
far there has
not been much positive outlook in porting the drivers to *BSD or any of
the 2.6 kernels that I know of, let alone 64-bit drivers for non-Win OSes.

So I guess that makes my question fairly simple then; I know that driver
code is written in C (which I am learning currently) but thats about all
I know. I'm probably
not far off when I say that I need more to go on. Yet, from looking at
Amazon.com I have not been able to find any books on writing driver
code, which is really
frustrating.

One of my security related books, Rootkits, tells me about how to write
drivers for a completely different reason so I know a bit more about how
they work but again
the code involved does not interface hardware to the OS, just injects a
custom application. The other tool that I will probably use is Jungo,
which is a nice-looking
application which automates a skeletal version of the driver you need,
but again, I would not know how to fill it out.

Any help is appreciated.

-Pete



There are indeed no books that I know of on the subject of writing
drivers for any *BSD, let alone FreeBSD.


[snip]


For me, following book was quite helpful:
Embedded FreeBSD cookbook, by Paul Cevoli
ISBN: 1589950046

It tells about basic kernel data structure for driver writing. One of
the best aspect of this book is that it shows you real code for real
device (a simple PCI device). Moreover, it was quite easy to read.
Although it focuses on FreeBSD 4.X. For those who want some
_introduction_ for the FreeBSD driver
writing, I would like to recommend this.

Regard,
Sangwoo Shim


Ah, didn't know about that book.  Yes, that sounds like a good
foundation, though some aspects of drivers in 5.x and beyond are
vastly different than in 4.x and prior, particularly concerning
synchronization and interrupt behaviour.  The next step is to talk about
the different driver APIs and infrastructure, as well as debugging
guides.

Scott
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Driver Development Books?

2005-10-12 Thread Sangwoo Shim
2005/10/12, Scott Long [EMAIL PROTECTED]:
 Pete wrote:
  Hello,
 I have what may seem to be a silly question, but I cannot find any
  other decent resources on the web. . The problem that I am having
  right now is
  that I have a fairly nice graphics card which, for the moment is only
  supported on Windows Operating systems, and old 2.4 Linux kernels. So
  far there has
  not been much positive outlook in porting the drivers to *BSD or any of
  the 2.6 kernels that I know of, let alone 64-bit drivers for non-Win OSes.
 
  So I guess that makes my question fairly simple then; I know that driver
  code is written in C (which I am learning currently) but thats about all
  I know. I'm probably
  not far off when I say that I need more to go on. Yet, from looking at
  Amazon.com I have not been able to find any books on writing driver
  code, which is really
  frustrating.
 
  One of my security related books, Rootkits, tells me about how to write
  drivers for a completely different reason so I know a bit more about how
  they work but again
  the code involved does not interface hardware to the OS, just injects a
  custom application. The other tool that I will probably use is Jungo,
  which is a nice-looking
  application which automates a skeletal version of the driver you need,
  but again, I would not know how to fill it out.
 
  Any help is appreciated.
 
  -Pete
 

 There are indeed no books that I know of on the subject of writing
 drivers for any *BSD, let alone FreeBSD.
[snip]


For me, following book was quite helpful:
Embedded FreeBSD cookbook, by Paul Cevoli
ISBN: 1589950046

It tells about basic kernel data structure for driver writing. One of
the best aspect of this book is that it shows you real code for real
device (a simple PCI device). Moreover, it was quite easy to read.
Although it focuses on FreeBSD 4.X. For those who want some
_introduction_ for the FreeBSD driver
writing, I would like to recommend this.

Regard,
Sangwoo Shim
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Driver Development Books?

2005-10-12 Thread Bruce R. Montague

 Hi, re:

  The problem that I am having
  right now is
  that I have a fairly nice graphics card which, for the moment is only
  supported on Windows Operating systems, and old 2.4 Linux kernels.
 

Someone mentioned X drivers; current X drivers are
dynamically loaded into the X server, which runs
in user-space, not in the FreeBSD kernel. The X
server has its own ELF loader to load modules and 
drivers. This approach allows X drivers to be 
independent of OS.
 
There is some documentation on writing X drivers at:
 
 http://cvsweb.xfree86.org/cvsweb/xc/programs/Xserver/hw/xfree86/doc/DESIGN
 
 (Click on the (download) link at the top of the page)
 
 For a walk through writing a driver, see Section 20 at the end,
Some notes about writing a driver.
 
 
 Alternatively, access
 
   http://cvs.freedesktop.org/xorg/xc/programs/Xserver/hw/xfree86/doc/
 
 and select DESIGN, etc..
 
 
FreeBSD currently uses x.org (cvs.freedesktop.org), 
but the DESIGN doc is probably similar.

The design doc has a lot of good background and conceptual
material, enough to enable reading of real X drivers,
which are the real definition of how things work. Although
the mechanics of writting (or modifying) an X driver are
very easy (almost trivial), if you have never worked with
C or drivers before, expect a steep learing curve... 
probably starting by rebuilding X from source would be
a good first step.


 - bruce
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]