NDIS WiFi Drivers in FreeBSD (Project Evil)

Sooo… if you have a WiFi card that doesn’t have native FreeBSD drivers, you might be able to use ‘Project Evil’ to wrap around the Windows driver for the card.  I had to do this on my new netbook…

First, you should install libiconv if you haven’t already.  The easiest way is to do:

pkg_add -r libiconv

Next, you need to obtain the Windows driver for the network card (I find that windows 2000 drivers are generally the most reliable).  You need the .INF and .SYS files from the driver package.  Place these somewhere on your FreeBSD computer (I put mine into /drv/)

Now we need to convert them into an NDIS kernel module…  In my case, the files are called net8192se.inf and rtl8192se.sys (RealTek 8191SE 802.11n wireless).  To convert them, type (as root):

ndisgen /drv/net8192se.inf /drv/rtl8192se.sys

Press enter until you’re returned to the command prompt, and you will now see a .ko file with the kernel module in.  This is named after the .sys file – so in my case, it is called rtl8192se_sys.ko.  Copy this file to the /boot/modules/ folder like so:

mv rtl8192se_sys.ko /boot/modules/

and you can activate it by adding the following line to /boot/loader.conf:

rtl8192se_sys_load=”YES”

You can also load the driver without rebooting by typing:

kldload rtl8192se_sys

This will give you some output to the console – e.g. on my netbook:

ndis0: <Realtek RTL8191SE Wireless LAN 802.11n PCI-E NIC> port 0×3000-0x30ff mem 0xfa000000-0xfa003fff irq 17 at device 0.0 on pci3
ndis0: [ITHREAD]
ndis0: NDIS API version: 5.1

If you get this far, you should be ready to go.  Check my other posts for how to configure WiFi in FreeBSD.

46 thoughts on “NDIS WiFi Drivers in FreeBSD (Project Evil)

  1. Jingxuan

    Hello, Dan.
    My notebook is Lenovo R400, With FreeBSD 8.0 Release AMD64 installed. I have tried every version of the rtl8192se driver(WinXP, WinX64, Win2000, VistaX86, VistaX64, Win7X86, Win7X64; Lenovo’s and Realtek’s), But none works.
    Can you tell me the environment and the rtl8192se version?

  2. dan Post author

    Hi Jingxuan,
    Can you find the device ids for me and post them here or in a mail to me?
    if you run “pciconf -lv” and find the wifi card and post the entire block here, I can tell you which driver you need.
    If you cant see it there, then your card may be usb based – try “usbconfig list” to get a list of usb devices.

    Thanks,

    Dan.

  3. Jingxuan

    Thank you for youre quick reply.
    This is the wiki card block from pciconf:
    none2@pci0:3:0:0: class=0×028000 card=0xe02010ec chip=0x817210ec rev=0×10 hdr=0×00
    vendor = ‘Realtek Semiconductor’
    class = network
    bar [10] = type I/O Port, range 32, base 0×2000, size 256, enabled
    bar [14] = type Memory, range 32, base 0xf4300000, size 16384, enabled
    cap 01[40] = powerspec 3 supports D0 D1 D2 D3 current D0
    cap 05[50] = MSI supports 1 message, 64 bit
    cap 10[70] = PCI-Express 1 legacy endpoint max data 128(256) link x1(x1)

  4. dan Post author

    Hi Jingxuan,

    I have never managed to get wifi drivers to work under amd64 project evil – only ever i386 release. Under amd64, if I use the 32bit drivers, the driver just doesnt attach. If I use the 64bit drivers, it causes a kernel panic. Google suggests this happens to everyone.

    I would suggest trying it under i386 instead of amd64 and forfeit the extra memory you may lose by doing so :-(

    Thanks,

    Dan.

  5. vwbusguy

    I have also been in the same boat. No way to get r8192se to work in amd64 FreeBSD8. The “Unix” drivers on the Realtek site are Linux only, and all the Windows ones fail in some way.

    In the end, I spent $7 to get a replacement Intel mini PCI-E wifi card on Ebay.

  6. Donald_McCormack

    Im trying to install my wireless card on FreeBSD 8.1

    I installed it on the Lenovo IBM Thinkpad SL510

    I have the Intel(R) WIFI Link 1000 BGN card and cannot install it.

    I ran the pciconf command you suggest on earlier posts and have an out put of multiple pages long.

    Any suggestions?

  7. dan Post author

    The 1000bgn card is supported using the ‘iwn’ driver in FreeBSD – no need for NDIS drivers.
    To enable your system to use the iwn driver for your card, you need to add the following lines to /boot/loader.conf:

    if_iwn_load=”YES”
    iwn1000fw_load=”YES”

    And after a reboot, you should see an iwn0 device in ‘ifconfig -l’
    Assuming you do, you can go onto configure your wireless using the instructions at https://www.dan.me.uk/blog/2010/01/25/wifi-configuration-in-freebsd-including-wpawap2/

    If you don’t see an iwn0 device, then you need to check your wireless card in ‘pciconf -lv’ – find the block relating to WIFI Link 1000 and let me know the block. I can check which drivers (if any) work for that card id then.

  8. Donald_McCormack

    Greetings. Thanks for your help so far. I did get stuff working, however, I messed up my rc.conf file and now I can do anything. Is there a way I can correct the syntax error on the file without having to reinstall every thing. As you can se, I am new to FreeBSD/Linux. Trying to learn this stuff.

    Thanks

  9. dan Post author

    from the boot menu, select single user mode, wait for it to boot and offer a shell prompt, press enter to accept the default shell.
    use “mount -o rw -a” to mount all filesystems in read/write mode, then you can edit /etc/rc.conf and fix your problem. When you’re done, do “reboot” to reboot normally.

  10. Donald_McCormack

    Hey Dan, Been asking a lot of questions and I do appreciate your help so far. I am still having trouble with my wifi. I followed the steps to the point but still cant connect. I can now see the wifi card iwn0, but it cannot connect. I am getting the following messages multiple times on the screen.
    >
    wlan0: ieee80211_new_state_locked: pending AUTH -> ASSOC transition lost
    >

    This message is being repeated on the screen over and over again.

  11. Donald_McCormack

    I must also mention that my wireless network is using WPA with TKIP. Does that make a difirence?

  12. dan Post author

    Ah, TKIP requires client certificates etc. Check out ‘man wpa_supplicant.conf’ and go to the examples at the bottom – there is an example for TKIP authentication. I’ve never tried it personally, but i’d imagine it should work fine!

  13. Donald_McCormack

    thanks a lot for you help. I can get my FreeBSD book out and start reading. However I found that the book’s instruction to do stuff does not necessarily work very well.

    How can I prevent FreeBSD from shutting down every time I close my laptop screen. IF I close the screen, I have to boot back up from start because the screen go black and I cannot start it back up.

  14. dan Post author

    The default action is to do nothing. You can check what action it is doing with “sysctl hw.acpi.lid_switch_state” – it should say “NONE”, if it says S1 – S5 then it will suspend or shutdown the laptop. Setting it to “NONE” tells it to do nothing when the lid is closed. See “man 4 acpi” for a list of sysctl’s to do with ACPI management.

  15. Donald_McCormack

    I promise to stop bugging you soon enough. I looked up acpi, i was able to set it where its fine as long as im in the command line, but i still have the same prob on the gnome desktop. The machine sleeps when I close the lid but could not wake when re open. I have to do a complete restart. Im sure I can google some stuff, but you’ve been so helpful and your solutions always work with the first try. And they are simple and straight forward, thats why I kept coming back…

  16. dan Post author

    Ah, i’m not sure how to adjust it within gnome… I generally use FreeBSD for a server-based OS rather than desktop so command line things are more within my area of expertise. I’d imagine there should be a gnome power management panel somewhere, but how well it works i’m unsure.

  17. Donald_McCormack

    Well thanks for your help so far. I will be setting up a web server in the next few days to play with Apache and tom cat for java. Guess I’ll be asking some more questions. Thanks so far. Love the site and I really appreciate the help so far.

  18. Donald_McCormack

    Im reading up on FreeBSD as a server now, is it better to use the FreeBSD jail system for virtual hosting as far as security goes? What would you recommend?

  19. dan Post author

    for security it’s great. if it had some kind of cpu and memory management/limitation it would be awesome. I have several jails running without issue :-)

  20. Donald_McCormack

    Heywhen ever you have time, can you please add steps for install java browers plugin for FreeBSD 8.x as well as flash player plugin. The FreeBSD instructions are not working… SURPRISE

  21. ebros

    Any luck in making RTL8191SE to work with freebsd 8.2 amd64?
    I just bought a new laptop Lenovo T410s and was also surprised that the card is not atheros.

  22. dan Post author

    To use RTL8191SE under Project Evil, you’ll have to use i386 edition – amd64 will just not work :-(

  23. RJ

    Anybody using “CE” instead of a “SE” card?

    My card shows up as RTL8188CE using RTL8192CE driver under Win7/64.
    Under FreeBSD 9/i386, pciconf shows 817610EC and 818110EC.

    Laptop is Toshiba Satellite C655D-S5126

    Have tried 3 versions of RealTek driver, using the files in the WinXP directory.

    Any help, pointers, links, are appreciated.

    PS. Had to manually convert INF file to ASCII using iconv. Then add ascii code 13 to the last line in file. Any comments on iconv parameters appreciated. I believe I used -c and UTF-16… ASCII.

    Thanks,
    RJ

  24. dan Post author

    hmm.. the ndis converter is supposed to auto-detect if it needs to use iconv on the INF automatically for you.

  25. RJ

    When ndisgen tries to convert INF file, it either fails at that point, or at a later point, such as creating the KO.

  26. RJ

    Mainly was hoping somebody would say “I have that card and it works. Use this driver version.” or that I missed something simple.

    I’m used to using ndisgen. My servers all use native drivers, but the laptops always seem to use NDIS. ;-)

    Laptop has 2 USB ports, nothing else, so I sort of need the internal card working.
    I have win7, FBSD9/i386, and FBSD9/amd64 installed on this laptop. (amd64 is just for testing/devel)

  27. mori rámar

    @RJ: I am also using RTL8192CE (Lenovo Thinkpad Edge E31). I cannot have it work, either. The .ko file built from the driver in the WinXP folder always causes a kernel panic. The .ko file built from the driver in the Win2K folder does not lead to a kernel panic, but ifconfig does not show any new network interface.

  28. Chris Dunne

    Hi,

    Has anyone managed to get the Realtek RTL8188CE card working with project evil? I’ve had lack of detections of my card and kernel panics using a variety of different drivers. Am I being stupid of is there any way to use the 32bit drivers on a 64bit system.

    Thanks,

    Chris

  29. dan Post author

    Hi Chris, I’ve never managed to get things working in 64bit… I’ve always had to drop to 32bit to use the realtek project evil drivers :-(

  30. Filipe

    I found the modules for my wifi adapter, but I’m trying to use FreeNAS, and it’s doesn’t have ndis.ko, if_ndis.ko, and wlan.ko module.. I can’t compile it, cuz FreeNAS doesnt have “make” command.. I can’t find ndis ports with those files.. could you help me please?

  31. dan Post author

    FreeNAS is a cut down version… without its kernel sources available to you then you can’t easily build a kernel module for it. Without ‘make’ you definitely can’t.

  32. Filipe

    dan.. at this time, I just need the ndis files (ndis.ko, if_ndis.ko and wlan.ko).. if you still using FreeBSD 7.x, can you send me these files? thank you alot!

  33. dan Post author

    you should only really use .ko files that match your exact kernel. Also, the ndis files are made from your windows driver files… You really need to compile them on the machine you want to use them on.
    (and I don’t have any FreeBSD 7 servers left, I barely have any 8.x servers left – 9.x is the way ahead!)

  34. Filipe

    dan.. thanks anyway.. I use a virtual machine and copy these files, and set it up on my freenas, and now it’s works fine.. thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>