Subject: Re: Ndis on hpcmips
To: None <tom@tommiller.us>
From: Alan Ritter <ritter.alan@gmail.com>
List: port-hpcmips
Date: 04/25/2006 18:48:50
--Boundary-00=_DGtTErhtiQX/sDV
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Tuesday 25 April 2006 04:50 pm, tom@tommiller.us wrote:
> Hey,
>
> Has anybody tried the ndisulator (recently added to
> -current) on hpcmips?  There seem to be hpcmips builds
> on releng.netbsd.org subsequent to the addition of the
> ndisulator, so apparently the ndisulator builds on
> hpcmips.

So far I've only used on i386, but it's worth a try if you have the .inf 
and .sys files for the card.

> I've got a Gigafast WF721-AEX wifi card with an R in
> the serial number, so I understand it has a Realtek
> chip.  Has anybody tested this card with the ndisulator
> on any platform?

The only cards I've gotten working so far are a Dell (broadcom) wireless card, 
and Intel Etherexpress Pro/100 (fxp).  If it doesn't work for that card, 
presumably it shouldn't take too much work to make it work.  I'm not sure 
exactly what would need to be done to make everything work on hpcmips 
though...

> I don't seem to find the readme mentioned here:
>
>   http://mail-index.netbsd.org/current-users/2006/04/18/0010.html

I decided to put that information in ndis(4) instead, so if you have a current 
distribution installed you should just be able to do "man ndis".  Just in 
case I attached the manpage, along with some documentation I eventually want 
to put on the website too.

> The ndisulator is majorly cool.  :-)

Thanks, like I said it's still only tested on two cards, and I'm pretty sure 
it will take some work to get it working on other architectures, how much I'm 
not sure.

Anyway if you find the .inf and .sys let me know what happens when you try 
running ndiscvt.


--Boundary-00=_DGtTErhtiQX/sDV
Content-Type: text/html;
  charset="iso-8859-1";
  name="ndis.html"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="ndis.html"

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DISO-8859-=
1">
<meta name=3D"generator" content=3D"Website XSL Stylesheet V2.6.0">
<link rel=3D"stylesheet" href=3D"/NetBSD.css" type=3D"text/css">

<title>NetBSD NDIS Information</title>
</head>
<body class=3D"website"><div class=3D"webpage">
<a name=3D"Documentation-network-ndis"></a><h1>NetBSD NDIS Information</h1>
<p>
The NetBSD NDIS-Wrapper allows a binary Windows network driver to run on
NetBSD, and think it's still talking to Windows.  This is useful because
many hardware manufacturers don't publish the detailed schematics necessary
to write a device driver, instead providing a binary driver for the device,
typically only for Windows.
</p>
<p>
The NetBSD NDIS-Wrapper is a port of
<a href=3D"http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/networ=
k-wireless.html" target=3D"_top">FreeBSD's NDISulator</a>.
It was ported to NetBSD by Alan Ritter (student) with help from=20
Phil Nelson (mentor) as part of Google's=20
<a href=3D"http://code.google.com/summerofcode.html" target=3D"_top">Summer=
 of code</a>
2005.  The main difference in using NDIS on NetBSD vs. FreeBSD is that a=20
custom kernel must be compiled, as there is not yet loadable kernel module=
=20
support.
</p>
<h3 class=3D"title"><a name=3D"overview">Information</a></h3>
<ul>
<li><a href=3D"#availability">Availability</a></li>
<li><a href=3D"#tested%20cards">Tested Cards</a></li>
<li><a href=3D"#requirements">Requirements</a></li>
<li><a href=3D"#overview">Overview</a></li>
<li><a href=3D"#ndiscvt">Using ndiscvt to make the ndis_driver_data.h file<=
/a></li>
<li><a href=3D"#kernel">Building an NDIS Kernel</a></li>
<li><a href=3D"#misclinks">Miscellaneous links</a></li>
</ul>
<hr>
<h3 class=3D"title">Information</h3>
<h4 class=3D"title">
<a name=3D"availability"></a>Availability (<a href=3D"#overview">top</a>)
  </h4>
<p>
NDIS is currently available in=20
<a href=3D"ndis.html#requirements" target=3D"_top">NetBSD-current, and will=
 be included in the NetBSD 4.0 release</a>. =20
Also note that NDIS is only currently working for the PCI bus on i386=20
architectures.  Hopefully support will soon be added for amd64 and=20
PCMCIA/CardBus.  In addition NDIS has not yet been tested on SMP machines.
</p>

<p>
Currently only one ndis device per system is possible, but this should
should change once Loadable Kernel Module support is added for
<code class=3D"filename">if_ndis</code>.
</p>

<h4 class=3D"title">
<a name=3D"tested%20cards"></a>Tested Cards (<a href=3D"#overview">top</a>)
  </h4>
<p>
</p>
<div class=3D"itemizedlist"><ul type=3D"disc">
<li>
  Intel EtherExpress Pro/100
</li>
<li>
  Dell (Broadcom) TrueMobile 1400 Dual Band WLAN Mini-PCI
</li>
</ul></div>
<p>
Note that NetBSD already includes a driver for the Intel card (<a href=3D"h=
ttp://netbsd.gw.com/cgi-bin/man-cgi?fxp+4+NetBSD-current">fxp(4)</a>). =20
This card is mainly useful for NDIS development purposes, as the Windows
DDK (Driver Development Kit) includes source code for its driver.
</p>

<h4 class=3D"title">
<a name=3D"requirements"></a>Requirements (<a href=3D"#overview">top</a>)
  </h4>
<p>
  In order to use NDIS on NetBSD you need:
  </p>
<div class=3D"itemizedlist"><ul type=3D"disc">
<li>
      A system updated to <a href=3D"http://www.netbsd.org/Documentation/cu=
rrent/" target=3D"_top">netbsd-current</a> (working as of 4/12/06) or NetBS=
D 4.0.
    </li>
<li>
      The Windows device driver for your network card=20
      (<code class=3D"filename">.inf</code> and <code class=3D"filename">.s=
ys</code> files). =20
      These are usually available from the manufacturer's website.
    </li>
</ul></div>
<p>
</p>

<h4 class=3D"title">
<a name=3D"overview"></a>Overview (<a href=3D"#overview">top</a>)
  </h4>
<p>
The first step is to make the <code class=3D"filename">ndis_driver_data.h</=
code> file
from the Windows driver's <code class=3D"filename">.inf</code> and=20
<code class=3D"filename">.sys</code> files using the <code class=3D"code">n=
discvt</code> utility.
Next build a custom kernel with NDIS compatibility and the <code class=3D"f=
ilename">if_ndis</code>=20
device driver with your <code class=3D"filename">ndis_driver_data.h</code>=
=20
file.
</p>

<h4 class=3D"title">
<a name=3D"ndiscvt"></a>Using <code class=3D"code">ndiscvt</code> to make t=
he <code class=3D"filename">ndis_driver_data.h</code> file (<a href=3D"#ove=
rview">top</a>)
  </h4>
<p>
The <code class=3D"code">ndiscvt</code> utility is not currently built by d=
efault.  Go to
<code class=3D"filename">usr.sbin/ndiscvt/</code> in the NetBSD-current sou=
rce tree and
make it:
</p>
<table class=3D"programlisting"><tr><td><pre>
# cd /usr/src/usr.sbin/ndiscvt
# make
</pre></td></tr></table>
<p>

Note that you may run into problems with a missing toolchain.  You can eith=
er
build a new one, or set the environment variable USETOOLS=3DNO:
</p>
<table class=3D"programlisting"><tr><td><pre>
# cd /usr/src
# ./build.sh tools
# cd usr.sbin/ndiscvt
# make
</pre></td></tr></table>
<p>
or
</p>
<table class=3D"programlisting"><tr><td><pre>
# USETOOLS=3DNO make
</pre></td></tr></table>
<p>

Make the <code class=3D"filename">ndis_driver_data.h</code> header file fro=
m the Windows
<code class=3D"filename">.inf</code> and <code class=3D"filename">.sys</cod=
e> files from your=20
driver using the <code class=3D"code">ndiscvt</code> utility as follows:
</p>
<table class=3D"programlisting"><tr><td><pre>
# ./ndiscvt -i /path/to/yourDriver.inf -s /path/to/yourDriver.sys -o ndis_d=
river_data.h
</pre></td></tr></table>
<p>
</p>

<h4 class=3D"title">
<a name=3D"kernel"></a>Building an NDIS Kernel (<a href=3D"#overview">top</=
a>)
  </h4>
<p>
In order to use NDIS you will have to build a custom kernel, see the=20
<a href=3D"http://netbsd.org/Documentation/kernel/#how_to_build_a_kernel" t=
arget=3D"_top">NetBSD Kernel Documentation</a>=20
for more details.
</p>

<p>
You will need to uncomment the following lines from=20
<code class=3D"filename">sys/arch/i386/conf/GENERIC</code>
</p>
<table class=3D"programlisting"><tr><td><pre>
options      	COMPAT_NDIS	# NDIS network driver
=2E
=2E
=2E
ndis* 	at pci? dev ? function ?	# Experimental - NDIS Network Driver
</pre></td></tr></table>
<p>

Now configure your kernel:
</p>
<table class=3D"programlisting"><tr><td><pre>
# cd src/sys/arch/i386/conf/
# config GENERIC
</pre></td></tr></table>
<p>

Copy the <code class=3D"filename">ndis_driver_data.h</code> file into the k=
ernel build
directory, and then build the new kernel
</p>
<table class=3D"programlisting"><tr><td><pre>
# cd ../compile/GENERIC/
# cp /usr/src/usr.sbin/ndiscvt/ndis_driver_data.h ./
# make depend
# make
</pre></td></tr></table>
<p>

Make a backup of your old kernel (just in case), and copy the new one into =
the
appropriate location.  Reboot into your new NDIS kernel.
</p>
<table class=3D"programlisting"><tr><td><pre>
# mv /netbsd /netbsd.old
# cp ./netbsd /netbsd
# reboot
</pre></td></tr></table>
<p>

Now you should have a working NDIS driver for your network card.  Assuming
you are using DHCP on a wireless network, the following should get you an IP
(of course you will need to use the appropriate WEP key):
</p>
<table class=3D"programlisting"><tr><td><pre>
# ifconfig ndis0 inet up nwid yourSSID nwkey 0xFFFFFFFFFF
# dhclient ndis0
</pre></td></tr></table>
<p>

</p>


<h4 class=3D"title">
<a name=3D"misclinks"></a>Miscellaneous links (<a href=3D"#overview">top</a=
>)
  </h4>
<div class=3D"itemizedlist"><ul type=3D"disc"><li>
    <a href=3D"http://netbsd-soc.sourceforge.net/projects/ndis/" target=3D"=
_top">Summer of Code NetBSD-ndis website on SourceForge</a>
  </li></ul></div>
<hr>Back to =A0<em><a href=3D"./">Networking documentation</a></em><div cla=
ss=3D"navfoot">
<hr>
<table border=3D"0" summary=3D"Footer navigation"><tr>
<td class=3D"foothome"><span class=3D"foothome"><a href=3D"."><img src=3D"/=
images/NetBSD-flag.png" alt=3D"[NetBSD flag]" border=3D"0" width=3D"90" hei=
ght=3D"90"></a></span></td>
<td class=3D"foothome">
<span class=3D"foothome"><a href=3D".">Home page</a></span><br>
</td>
</tr></table>
<hr>
</div>
<p></p>
<span class=3D"footfeed"><a href=3D"http://www.NetBSD.org/cgi-bin/feedback.=
cgi">(contact us)</a></span>

  =A0
  <span class=3D"foottag">Generated from <em>%NetBSD: ndis.xml,v 1.3 2006/0=
2/14 17:02:54 peter Exp %</em></span><br><span class=3D"footcopy"><a href=
=3D"/Misc/disclaimer.html"><span class=3D"copyright">Copyright =A9 1994-200=
6 The NetBSD Foundation, Inc. </span>ALL RIGHTS RESERVED.<br>NetBSD<sup>=AE=
</sup> is a registered trademark of The NetBSD
	Foundation, Inc.</a></span>
</div></body>
</html>

--Boundary-00=_DGtTErhtiQX/sDV
Content-Type: text/html;
  charset="iso-8859-1";
  name="ndis.html"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="ndis.html"

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DISO-8859-=
1">
<meta name=3D"generator" content=3D"Website XSL Stylesheet V2.6.0">
<link rel=3D"stylesheet" href=3D"/NetBSD.css" type=3D"text/css">

<title>NetBSD NDIS Information</title>
</head>
<body class=3D"website"><div class=3D"webpage">
<a name=3D"Documentation-network-ndis"></a><h1>NetBSD NDIS Information</h1>
<p>
The NetBSD NDIS-Wrapper allows a binary Windows network driver to run on
NetBSD, and think it's still talking to Windows.  This is useful because
many hardware manufacturers don't publish the detailed schematics necessary
to write a device driver, instead providing a binary driver for the device,
typically only for Windows.
</p>
<p>
The NetBSD NDIS-Wrapper is a port of
<a href=3D"http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/networ=
k-wireless.html" target=3D"_top">FreeBSD's NDISulator</a>.
It was ported to NetBSD by Alan Ritter (student) with help from=20
Phil Nelson (mentor) as part of Google's=20
<a href=3D"http://code.google.com/summerofcode.html" target=3D"_top">Summer=
 of code</a>
2005.  The main difference in using NDIS on NetBSD vs. FreeBSD is that a=20
custom kernel must be compiled, as there is not yet loadable kernel module=
=20
support.
</p>
<h3 class=3D"title"><a name=3D"overview">Information</a></h3>
<ul>
<li><a href=3D"#availability">Availability</a></li>
<li><a href=3D"#tested%20cards">Tested Cards</a></li>
<li><a href=3D"#requirements">Requirements</a></li>
<li><a href=3D"#overview">Overview</a></li>
<li><a href=3D"#ndiscvt">Using ndiscvt to make the ndis_driver_data.h file<=
/a></li>
<li><a href=3D"#kernel">Building an NDIS Kernel</a></li>
<li><a href=3D"#misclinks">Miscellaneous links</a></li>
</ul>
<hr>
<h3 class=3D"title">Information</h3>
<h4 class=3D"title">
<a name=3D"availability"></a>Availability (<a href=3D"#overview">top</a>)
  </h4>
<p>
NDIS is currently available in=20
<a href=3D"ndis.html#requirements" target=3D"_top">NetBSD-current, and will=
 be included in the NetBSD 4.0 release</a>. =20
Also note that NDIS is only currently working for the PCI bus on i386=20
architectures.  Hopefully support will soon be added for amd64 and=20
PCMCIA/CardBus.  In addition NDIS has not yet been tested on SMP machines.
</p>

<p>
Currently only one ndis device per system is possible, but this should
should change once Loadable Kernel Module support is added for
<code class=3D"filename">if_ndis</code>.
</p>

<h4 class=3D"title">
<a name=3D"tested%20cards"></a>Tested Cards (<a href=3D"#overview">top</a>)
  </h4>
<p>
</p>
<div class=3D"itemizedlist"><ul type=3D"disc">
<li>
  Intel EtherExpress Pro/100
</li>
<li>
  Dell (Broadcom) TrueMobile 1400 Dual Band WLAN Mini-PCI
</li>
</ul></div>
<p>
Note that NetBSD already includes a driver for the Intel card (<a href=3D"h=
ttp://netbsd.gw.com/cgi-bin/man-cgi?fxp+4+NetBSD-current">fxp(4)</a>). =20
This card is mainly useful for NDIS development purposes, as the Windows
DDK (Driver Development Kit) includes source code for its driver.
</p>

<h4 class=3D"title">
<a name=3D"requirements"></a>Requirements (<a href=3D"#overview">top</a>)
  </h4>
<p>
  In order to use NDIS on NetBSD you need:
  </p>
<div class=3D"itemizedlist"><ul type=3D"disc">
<li>
      A system updated to <a href=3D"http://www.netbsd.org/Documentation/cu=
rrent/" target=3D"_top">netbsd-current</a> (working as of 4/12/06) or NetBS=
D 4.0.
    </li>
<li>
      The Windows device driver for your network card=20
      (<code class=3D"filename">.inf</code> and <code class=3D"filename">.s=
ys</code> files). =20
      These are usually available from the manufacturer's website.
    </li>
</ul></div>
<p>
</p>

<h4 class=3D"title">
<a name=3D"overview"></a>Overview (<a href=3D"#overview">top</a>)
  </h4>
<p>
The first step is to make the <code class=3D"filename">ndis_driver_data.h</=
code> file
from the Windows driver's <code class=3D"filename">.inf</code> and=20
<code class=3D"filename">.sys</code> files using the <code class=3D"code">n=
discvt</code> utility.
Next build a custom kernel with NDIS compatibility and the <code class=3D"f=
ilename">if_ndis</code>=20
device driver with your <code class=3D"filename">ndis_driver_data.h</code>=
=20
file.
</p>

<h4 class=3D"title">
<a name=3D"ndiscvt"></a>Using <code class=3D"code">ndiscvt</code> to make t=
he <code class=3D"filename">ndis_driver_data.h</code> file (<a href=3D"#ove=
rview">top</a>)
  </h4>
<p>
The <code class=3D"code">ndiscvt</code> utility is not currently built by d=
efault.  Go to
<code class=3D"filename">usr.sbin/ndiscvt/</code> in the NetBSD-current sou=
rce tree and
make it:
</p>
<table class=3D"programlisting"><tr><td><pre>
# cd /usr/src/usr.sbin/ndiscvt
# make
</pre></td></tr></table>
<p>

Note that you may run into problems with a missing toolchain.  You can eith=
er
build a new one, or set the environment variable USETOOLS=3DNO:
</p>
<table class=3D"programlisting"><tr><td><pre>
# cd /usr/src
# ./build.sh tools
# cd usr.sbin/ndiscvt
# make
</pre></td></tr></table>
<p>
or
</p>
<table class=3D"programlisting"><tr><td><pre>
# USETOOLS=3DNO make
</pre></td></tr></table>
<p>

Make the <code class=3D"filename">ndis_driver_data.h</code> header file fro=
m the Windows
<code class=3D"filename">.inf</code> and <code class=3D"filename">.sys</cod=
e> files from your=20
driver using the <code class=3D"code">ndiscvt</code> utility as follows:
</p>
<table class=3D"programlisting"><tr><td><pre>
# ./ndiscvt -i /path/to/yourDriver.inf -s /path/to/yourDriver.sys -o ndis_d=
river_data.h
</pre></td></tr></table>
<p>
</p>

<h4 class=3D"title">
<a name=3D"kernel"></a>Building an NDIS Kernel (<a href=3D"#overview">top</=
a>)
  </h4>
<p>
In order to use NDIS you will have to build a custom kernel, see the=20
<a href=3D"http://netbsd.org/Documentation/kernel/#how_to_build_a_kernel" t=
arget=3D"_top">NetBSD Kernel Documentation</a>=20
for more details.
</p>

<p>
You will need to uncomment the following lines from=20
<code class=3D"filename">sys/arch/i386/conf/GENERIC</code>
</p>
<table class=3D"programlisting"><tr><td><pre>
options      	COMPAT_NDIS	# NDIS network driver
=2E
=2E
=2E
ndis* 	at pci? dev ? function ?	# Experimental - NDIS Network Driver
</pre></td></tr></table>
<p>

Now configure your kernel:
</p>
<table class=3D"programlisting"><tr><td><pre>
# cd src/sys/arch/i386/conf/
# config GENERIC
</pre></td></tr></table>
<p>

Copy the <code class=3D"filename">ndis_driver_data.h</code> file into the k=
ernel build
directory, and then build the new kernel
</p>
<table class=3D"programlisting"><tr><td><pre>
# cd ../compile/GENERIC/
# cp /usr/src/usr.sbin/ndiscvt/ndis_driver_data.h ./
# make depend
# make
</pre></td></tr></table>
<p>

Make a backup of your old kernel (just in case), and copy the new one into =
the
appropriate location.  Reboot into your new NDIS kernel.
</p>
<table class=3D"programlisting"><tr><td><pre>
# mv /netbsd /netbsd.old
# cp ./netbsd /netbsd
# reboot
</pre></td></tr></table>
<p>

Now you should have a working NDIS driver for your network card.  Assuming
you are using DHCP on a wireless network, the following should get you an IP
(of course you will need to use the appropriate WEP key):
</p>
<table class=3D"programlisting"><tr><td><pre>
# ifconfig ndis0 inet up nwid yourSSID nwkey 0xFFFFFFFFFF
# dhclient ndis0
</pre></td></tr></table>
<p>

</p>


<h4 class=3D"title">
<a name=3D"misclinks"></a>Miscellaneous links (<a href=3D"#overview">top</a=
>)
  </h4>
<div class=3D"itemizedlist"><ul type=3D"disc"><li>
    <a href=3D"http://netbsd-soc.sourceforge.net/projects/ndis/" target=3D"=
_top">Summer of Code NetBSD-ndis website on SourceForge</a>
  </li></ul></div>
<hr>Back to =A0<em><a href=3D"./">Networking documentation</a></em><div cla=
ss=3D"navfoot">
<hr>
<table border=3D"0" summary=3D"Footer navigation"><tr>
<td class=3D"foothome"><span class=3D"foothome"><a href=3D"."><img src=3D"/=
images/NetBSD-flag.png" alt=3D"[NetBSD flag]" border=3D"0" width=3D"90" hei=
ght=3D"90"></a></span></td>
<td class=3D"foothome">
<span class=3D"foothome"><a href=3D".">Home page</a></span><br>
</td>
</tr></table>
<hr>
</div>
<p></p>
<span class=3D"footfeed"><a href=3D"http://www.NetBSD.org/cgi-bin/feedback.=
cgi">(contact us)</a></span>

  =A0
  <span class=3D"foottag">Generated from <em>%NetBSD: ndis.xml,v 1.3 2006/0=
2/14 17:02:54 peter Exp %</em></span><br><span class=3D"footcopy"><a href=
=3D"/Misc/disclaimer.html"><span class=3D"copyright">Copyright =A9 1994-200=
6 The NetBSD Foundation, Inc. </span>ALL RIGHTS RESERVED.<br>NetBSD<sup>=AE=
</sup> is a registered trademark of The NetBSD
	Foundation, Inc.</a></span>
</div></body>
</html>

--Boundary-00=_DGtTErhtiQX/sDV--