28247
![]() |
|
|
|
|
|||||||
| Mobile Computing This forum discusses issues related to running FreeBSD on notebooks, laptops, and other mobile equipment. |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hello,
I am trying to get my on-board Realtek 8176 wireless adapter working. Code:
none1@pci0:4:0:0: class=0x028000 card=0x819510ec chip=0x817610ec rev=0x01 hdr=0x00
vendor = 'Realtek Semiconductor'
class = network
Apparently this driver is actually the same as for 8192CE, also. (Possible problem here?) Anyway, I installed the 8188CE driver for several of the variants, and nothing happened (no dmesg, no ifconfig, etc; ndis and if_ndis are loaded). Then I tried the WinX64 variant, and this seems to have crashed the system: Code:
no match for IoWMIQueryAllData
no match for IoWMIOpenBlock
ndis0: <1x1 11b/g/n Wireless LAN PCI Express Half Mini Card Adapter> port 0x2000-0x20ff mem 0xf0100000-0xf0103fff irq 17 at device 0.0 on pci4
ndis0: [ITHREAD]
ndis0: NDIS API version: 5.1
Fatal trap 12: page fault while in kernel mode
cpuid = 0; apic id = 00
fault virtual address = 0xffffff8100a00000
fault code = supervisor read data, page not present
instruction pointer = 0x20:0xffffffff806ae172
stack pointer = 0x28:0xffffff81083f6e10
frame pointer = 0x28:0xffffff81083f6f60
code segment = base 0x0, limit 0xfffff, type 0x1b
= DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags = interrupt enabled, resume, IOPL = 0
current process = 56795 (kldload)
trap number = 12
panic: page fault
cpuid = 0
KDB: stack backtrace:
#0 0xffffffff8063dcbe at kdb_backtrace+0x5e
#1 0xffffffff8060aed7 at panic+0x187
#2 0xffffffff80900a10 at trap_fatal+0x290
#3 0xffffffff80900d61 at trap_pfault+0x201
#4 0xffffffff8090121f at trap+0x3df
#5 0xffffffff808e8774 at calltrap+0x8
#6 0xffffffff80640fae at vsnprintf+0x2e
#7 0xffffff0025472b4e at dmapbase+0x25472b4e
If it's relevant, I'm running a largely unpatched 8.3-RELEASE, amd64 edition. Let me know if any other info is needed. |
|
#2
|
|||
|
|||
|
Hi! Try to work with NDISulator project. His maintainers maybe also could help you.
|
|
#3
|
|||
|
|||
|
Cool, I submitted an issue on the Github page. I'll post any positive results here.
|
|
#4
|
|||
|
|||
|
No luck yet. Might someone point me in the direction where I could learn about how to diagnose this issue / send in a patch / add some code to the driver? I'm willing to help but don't know where to start (And I understand that little drivers like this are not exactly top of the priority list)
|
|
#5
|
|||
|
|||
|
I'm sorry for delay with the answer.
Original report gives almost no information about the reason of the problem because backtrack contains no even function names related to ndis. If you are still interested in discovering this problem lets try to do this step by step. First lets use ndisulator from github: 1. Go to https://github.com/NDISulator/ndisulator page 2. Select "stable8" branch 3. Download and extract sources (button with cloud and word "Zip") 4. cd to directory where ndisulator sources have been saved and extracted 5. Run "make attach" 6. Run "make build" 7. Run "make install" Please make sure you got no errors on any of this steps. At this moment you replaced ndis modules and binaries with non-default implementation from github 8. At this step you have to generate miniport module based on windows driver. Windows driver should have the same arch as your freebsd installation (64 bit driver for amd64 case) + it have to be implemented with NDIS 5.X API (most of winXP drivers implemented using NDIS 5.X API) For my test case I run command like this: ndisgen ./windrv/e1G5132e.INF ./windrv/e1G5132e.sys and after answering all questions of ndisgen I have miniport module named "e1G5132e_sys.ko" At this moment it is safe to run "make detach" and start testing. 9. Try kldload ./path/to/miniport_module.so and check if new interface appears, if ndis driver attached to your device in pciconf output Lets try to start from steps above and check how it works or where it fails. Waiting for you feedback PS. I've just tested steps 1 to 7 on 8.3-RELEASE (amd64) - it should work fine for you too. Success of step 8 depends mostly on .inf file. I've seen several .inf files which ndisgen were unable to parse and all this cases were easy to fix. So if it fails on this step please provide us with link to windows driver you are trying to use. Step 9 significantly depends on windows driver. If you see panic on this step it would be nice to see panic message. |
|
#6
|
|||
|
|||
|
temny thank for detailed how-to! Can you tell, for 9-, and current steps identical?
|
|
#7
|
|||
|
|||
|
It took some time to setup test environment on freebsd 9 to check "stable9" branch of ndisulator. I can confirm there was a problem and now it is fixed. I mean now it is possible to use "stable9" on freebsd 9 with steps from above.
What about to freebsd current - I need some time to setup and test. At least for master branch step by step will be different. I'll get back to you as soon as I have more information to share. |
| The Following User Says Thank You to temny For This Useful Post: | ||
G_Nerc (December 27th, 2012) | ||
|
#8
|
|||
|
|||
|
Many thanks to all peoples like you temny, who do his own work for many other peoples!
|
|
#9
|
|||
|
|||
|
G_Nerc, thank you for the kind words.
I've finished testing recent FreeBSD current with ndisulator. Here is what I got: In case of FreeBSD current there are two options: First is to use "stable" branch of ndisulator. In this case it is possible to use step-by-step provided few messages above. Second option is to use "master" branch of ndisulator with the following steps: 1. Go to https://github.com/NDISulator/ndisulator page 2. Select "master" branch (it should be already selected by default) 3. Download and extract sources (Button with cloud and word "Zip"; no need to install git) 4. cd to directory where ndisulator sources have been saved and extracted 5. Run "make" 6. Run "make install" Please make sure you got no errors in ouput of previous two steps 7. Run "kldload ndis" 8. Load windows miniport driver (.sys file) using "ndisload" (there is no need to generate kernel module based on .inf + .sys files like it was necessary with stable, stable8 and stable9 branches) I'm going to use ndisgen for the following device as example: none@pci0:0:3:0: class=0x020000 card=0x11001af4 chip=0x813910ec rev=0x20 hdr=0x00 vendor = 'Realtek Semiconductor Co., Ltd.' device = 'RTL-8139/8139C/8139C+' class = network subclass = ethernet ndisload -p -s /root/rl8139_3/Rtnic64.sys -n test_dev -v 0x10ec -d 0x8139 ndisload flags: -p = PCI device -u = USB device -P = PCMCIA device -s PATH = path to windows miniport driver (.sys file) -n NAME = device name (any name you like) -v NUMBER = vendor id. Last 4 hex digits of "chip" value in pciconf output. Don't forget to use "0x" prefix (like in "0x10ec") if you are just copying this value from pciconf output -d NUMBER = device id. First 4 hex digits of "chip" value in pciconf output. Don't forget to use "0x" prefix (like in "0x8139") if you are just copying this value from pciconf output Same as before windows driver must have the same arch as your freebsd installation (64 bit driver for amd64 case) + it have to be implemented with NDIS 5.X API 9. Check if ndis0 interface appears, if ndis driver attached to your device in pciconf output |
|
#10
|
|||
|
|||
|
Thank for deep investigations and detailed instructions!
I'm do all steps which you provide. From step 1 to 6 all be without any error or warning. But when I'm do: kldload ndis Code:
kldload: can't load ndis: Exec format error kldload /boot/kernel/ndis.ko and it loads without errors, but in /var/log/messages i have such messages: Code:
Jan 5 22:19:36 BSD kernel: KLD if_ndis.ko: depends on ndisapi - not available or version mismatch Jan 5 22:19:36 BSD kernel: linker_load_file: Unsupported file type ndisload -p -s /path/WinX64/rtwlane.sys -n nd_test -v 0x10ec -d 0x8723 and got in /var/log/messages Code:
Jan 5 22:24:48 BSD kernel: NDIS: no match for ExNotifyCallback Jan 5 22:24:48 BSD kernel: NDIS: no match for ExCreateCallback Jan 5 22:24:48 BSD kernel: ndis0: <nd_test> port 0xd000-0xd0ff mem 0xf7900000-0xf7903fff irq 18 at device 0.0 on pci4 pciconf -lv shows that driver attached to device: Code:
ndis0@pci0:4:0:0: class=0x028000 card=0x072610ec chip=0x872310ec rev=0x00 hdr=0x00
vendor = 'Realtek Semiconductor Co., Ltd.'
class = network
Thanks! |
|
#11
|
|||
|
|||
|
I suppose to make ndis0 interface appear in ifconfig output and make it usable we have to find out what is the reason of kldload error.
At this moment I have several ideas: First: please make sure there are no ndis or if_ndis modules loaded after system reboot - I want to make sure there were no other versions of ndis modules loaded before we started playing with github version. (Also please make sure you are not trying to load ndis / if_ndis from /boot/loader.conf) Second: please make sure kernel you are currently running is in sync with the sources in /usr/src Third: please make sure you repeated all steps from the previous message after you reinstalled kernel (if you reinstalled kernel after installed ndisulator from github) Also could you please show output of the following commands: ls -al /boot/*/*ndis* kldstat -v (after you tried to kldload ndis) uname -a |
|
#12
|
|||
|
|||
|
Ok! I will do anything for help you Temny with that deal.
uname -a Code:
FreeBSD BSD 10.0-CURRENT FreeBSD 10.0-CURRENT #0: Wed Jan 2 21:40:45 YEKT 2013 user@BSD:/usr/obj/usr/src/sys/BSD amd64 System rebuilds with standart way from /usr/src/Makefile /etc/src.conf Code:
WITHOUT_ACCT=YES WITHOUT_ASSERT_DEBUG=YES WITHOUT_ATM=YES WITHOUT_AUDIT=YES WITHOUT_AUTHPF=YES WITHOUT_BIND=YES WITHOUT_BSNMP=YES WITHOUT_CLANG=YES WITHOUT_CTM=YES WITHOUT_FDT=YES WITHOUT_FLOPPY=YES WITHOUT_GDB=YES WITHOUT_HTML=YES WITHOUT_INET6=YES WITHOUT_INFO=YES WITHOUT_IPFILTER=YES WITHOUT_IPX=YES WITHOUT_KERNEL_SYMBOLS=YES WITHOUT_KVM=YES WITHOUT_LPR=YES WITHOUT_MAIL=YES WITHOUT_NCP=YES WITHOUT_OFED=YES WITHOUT_PF=YES WITHOUT_PMC=YES WITHOUT_QUOTAS=YES WITHOUT_RCMDS=YES WITHOUT_RCS=YES WITHOUT_SHAREDOCS=YES WITHOUT_ZFS=YES Code:
Id Refs Address Size Name 1 44 0xffffffff80200000 9d38e8 kernel 2 1 0xffffffff80bd4000 6588 cuse4bsd.ko 3 1 0xffffffff80bdb000 15378 fuse.ko 4 1 0xffffffff80e12000 32c5 ng_ubt.ko 5 1 0xffffffff80e16000 8b25 ng_hci.ko 6 3 0xffffffff80e1f000 a5d ng_bluetooth.ko 7 5 0xffffffff80e20000 87da netgraph.ko 8 1 0xffffffff80e29000 b4ca ng_l2cap.ko 9 1 0xffffffff80e35000 1744e ng_btsocket.ko 10 1 0xffffffff80e4d000 1e3d ng_socket.ko 11 1 0xffffffff80e4f000 5fe7d i915kms.ko 12 1 0xffffffff80eaf000 13df iicbb.ko 13 4 0xffffffff80eb1000 135b iicbus.ko 14 1 0xffffffff80eb3000 dc5 iic.ko 15 2 0xffffffff80eb4000 ab68 agp.ko 16 1 0xffffffff80ebf000 2e099 drm2.ko Code:
autoboot_delay="1" cuse4bsd_load="YES" fuse_load="YES" ![]() ls -al /boot/*/*ndis* dl Code:
-r-xr-xr-x 1 root wheel 72432 8 дек 23:38 /boot/kernel.old/if_ndis.ko -r-xr-xr-x 1 root wheel 166832 8 дек 23:38 /boot/kernel.old/ndis.ko -r-xr-xr-x 1 root wheel 72432 2 янв 21:45 /boot/kernel/if_ndis.ko -r-xr-xr-x 1 root wheel 267048 5 янв 22:19 /boot/kernel/ndis.ko Code:
kldload: can't load ndis: Exec format error http://pastebin.com/MPrA9ur2 /var/log/messages (after kldload ndis) Code:
Jan 6 18:01:51 BSD kernel: KLD if_ndis.ko: depends on ndisapi - not available or version mismatch Jan 6 18:01:51 BSD kernel: linker_load_file: Unsupported file type http://pastebin.com/kPgeBtSy /var/log/messages (after kldload /boot/kernel/ndis.ko) Code:
Jan 6 18:03:13 BSD root: Unknown USB device: vendor 0x5986 product 0x0315 bus uhub4 Jan 6 18:03:13 BSD last message repeated 3 times |
|
#13
|
|||
|
|||
|
Also some additional information which maybe can be useful:
kernel config http://pastebin.com/2Kkx3p9T When I do ndisload -p -s /path/WinX64/rtwlane.sys -n nd_test -v 0x10ec -d 0x8723 command not ends and I can't kill it anyhow (not killall ndisload, not kill -9 ${PID}) And info about output in /var/log/messages after kldload /boot/kernel/ndis.ko Code:
Unknown USB device: vendor 0x5986 product 0x0315 bus uhub4 |
|
#14
|
|||
|
|||
|
Thanks for detailed report. I think I found and fixed the reason of
kldload: can't load ndis: Exec format error". Please download fresh version of ndisulator from github and retry. What about to Unknown USB device: vendor 0x5986 product 0x0315 bus uhub4. I think this message could be just ignored. It is about webcam and look like it is caused by re-probe attempt triggered by ndisload.If with the fresh version of ndisulator-master you obtain no progress please give me a link to windows drivers which you are using. Also please let me know if you tried to use stable branch of ndisulator with FreeBSD current and what was the result. |
|
#15
|
|||
|
|||
|
Hi! There is a new info with updated ndisulator
ls -al /boot/*/*ndis* Code:
-r-xr-xr-x 1 root wheel 72432 8 дек 23:38 /boot/kernel.old/if_ndis.ko -r-xr-xr-x 1 root wheel 166832 8 дек 23:38 /boot/kernel.old/ndis.ko -r-xr-xr-x 1 root wheel 267048 7 янв 15:51 /boot/kernel/ndis.ko Code:
Jan 7 20:13:11 BSD root: Unknown USB device: vendor 0x5986 product 0x0315 bus uhub4 http://pastebin.com/A3Wsc80u After ndisload -p -s /path/WinX64/rtwlane.sys -n nd_test -v 0x10ec -d 0x8723 there is a messages in /var/log/messages Code:
Jan 7 20:17:16 BSD kernel: NDIS: no match for ExNotifyCallback Jan 7 20:17:16 BSD kernel: NDIS: no match for ExCreateCallback Jan 7 20:17:16 BSD kernel: ndis0: <nd_test> port 0xd000-0xd0ff mem 0xf7900000-0xf7903fff irq 18 at device 0.0 on pci4 There is a LINK to driver from which I get WinX64 folder: Also there is LINK to archive with .sys and .inf files which I use (for except downloading providing .exe file) ========= Ndisulator-stable with -current sources I'm download ndisulator stable, and do: 1. cd /path/ndisulator-stable/src 2. su root 3. make attach 4. make build 5. make install That steps proceeds without error. After that I'm reboot and 1. cd /path/to/WinX64/driver 2. ndisgen And when I'm choose .inf and .sys driver and on latest step i got the error: Code:
Kernel module generation
The script will now try to generate the kernel driver module.
This is the last step. Once this module is generated, you should
be able to load it just like any other FreeBSD driver module.
Press enter to compile the stub module and generate the driver
module now:
Generating Makefile... done.
Building kernel module... /usr/src/usr.sbin/ndiscvt/windrv_stub.c:136: warning: redundant redeclaration of 'device_probe_desc' [-Wredundant-decls]
./device_if.h:27: warning: previous declaration of 'device_probe_desc' was here
/usr/src/usr.sbin/ndiscvt/windrv_stub.c:137: error: redefinition of typedef 'device_probe_t'
./device_if.h:29: error: previous declaration of 'device_probe_t' was here
build failed. Exiting.
Last edited by ORTO-DOX; January 7th, 2013 at 16:28. Reason: Add ndisulator-stable info |
|
#16
|
|||
|
|||
|
About ndisulator-stable:
Please retry the same but without reboot after step 5. Or (if reboot is necessary) execute following commands as root before running ndisgen: cd /path/ndisulator-stableI've just tested ndisgen step in my test environment and it went smooth with .inf and .sys files you are working with. |
|
#17
|
|||
|
|||
|
You are right!
Without reboot, and follow to your instructions I successfully generate rtwlane_sys.ko, but after tryin to kldload ./rtwlane_sys.ko, system immediately reboots. In /var/log/messages I have not any entries, maybe because HDD not sync on reboots. |
|
#18
|
|||
|
|||
|
I think this reboot is caused by kernel panic and to dig it any deeper it is necessary to rebuild kernel with at least basic debugging support to see panic message and backtrace.
If you are interested - it is necessary to enable following kernel options: options KDBYou mentioned before that is take 3-4 hours to rebuild kernel. I think it can be done several times faster if you add -DNO_CLEAN to make command. Something like this: cd /usr/srcAfter you reinstall kernel it is necessary to repeat ndisulator install procedure (because ndis modules got overwritten during kernel reinstall). |
|
#19
|
|||
|
|||
|
Ok. Many thanks again for your hard work!
I do all what You say, and paste here results. What I will need to do after that procedure and when kernel panic appears? Can you please get steps which I need to do to get something to paste here. |
|
#20
|
|||
|
|||
|
I do that steps:
1. Add to kernel config (Previous kernel config as pasted some messages above: LINK) three lines: Code:
options KDB options KDB_TRACE options DDB 3. My /etc/sysctl.conf Code:
hw.syscons.bell=0 kern.module_path=/boot/kernel;/boot/modules;/usr/local/modules vfs.usermount=1 kern.coredump=0 kern.nodump_coredump=1 kern.sync_on_panic=1 5. All steps (1..5) for ndisulator-stable 6. ndisgen kernel module from windows drivers 7. kldload ./rtwlane_sys.ko System freezes. Not reboots, just freezes, and I don't know how to get any interested information. After reset, in /var/log/messages have not any information related to ndis actions. |
|
#21
|
|||
|
|||
|
Minimum possible information is just a panic message with a stack trace which consists of list of functions which got called before the panic occurs. This kind of information you will get if you just rebuild the kernel with the options mentioned above and try to kldload the module generated with ndisgen. In general it is important to trigger a panic while you are in the console (in text mode) and not in X. If you are in X (in "graphic mode") you see nothing - everything just freezes (because the kernel stopped execution and all kdb/ddb output is sent to the text console and for you there is no way to see it or switch into it).
By default when you see a panic message there is no way to "save it" so you have to take a picture using a camera or copy it by hand, which is annoying. It is possible to define the device which will be used as "temporary storage" or "device for dump" by setting the dumpdev variable in rc.conf: Code:
dumpdev="/dev/ada0s1b" Please make sure you are not pointing dumpdev to a partition which has a valid filesystem and data - everything will be destroyed if ddb tries to write any data to such a device. When you have a dumpdev you can extract and save much more information (including kmem) about the current state of the system when you triggered a panic. This could be done automatically (by altering /etc/ddb.conf and setting sysctl debug.debugger_on_panic to zero) or manually. The list of commands I have in ddb.conf is the following: script kdb.enter.panic=capture on; show allpcpu; bt; ps; alltrace; show alllocks; show locks; show msgbuf; capture off; call doadumpAlso I added the following lines to /etc/sysctl.conf: Code:
#debug.debugger_on_panic=0 debug.ddb.capture.bufsize=5242880 If everything went smoothly then after the reboot it will be possible to find the ddb output in the /var/crash directory. You can try to find more information in the "Kernel Debugging" chapter in "FreeBSD Developers' Handbook" and ddb(4) and ddb(8). Last edited by DutchDaemon; January 7th, 2013 at 21:07. Reason: http://forums.freebsd.org/showthread.php?t=18043#TheArticle |
|
#22
|
|||
|
|||
|
Thank for necessary info about system debugging!
I am until wait for that info, search myself that in internet and there is my results: 1. I am add sysctl variable for buffer increasing 2. Set dumpdev="AUTO" 3. /etc/rc.d/dumpon start 4. exit from X 5. proceed all ndis steps to panic appears 6. In DB console type textdump set; and get dump (forget command) And attach zippped /var/crash/textdump.crash.0 After that I will do your procedure and if my result is incorrect, I will send your results. |
|
#23
|
|||
|
|||
|
Your steps seems to be correct.
Now lets extend amount data you are gathering from ddb. Please trigger panic one more time and type following commands in ddb prompt: textdump setOr do the same via ddb.conf as I mentioned in previous message. |
|
#24
|
|||
|
|||
|
There is a result in attached file.
|
|
#25
|
|||
|
|||
|
As I can see only part of ddb commands output has been saved. I suppose some commands were interrupted with "q" key or in some other way. Please try to repeat same steps, but scroll down every command output with space key (just hold it and ddb will scroll until the end).
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Solved] help using windows NDIS drivers | ian-nai | System Hardware | 4 | September 6th, 2011 20:24 |
| [Solved] BCM4315 and ndis | Ghirai | Mobile Computing | 4 | November 14th, 2009 13:35 |
| NDIS Issues | blstuart | System Hardware | 8 | October 12th, 2009 00:13 |
| ndis and WPA2-PSK | ccc | Mobile Computing | 11 | September 2nd, 2009 15:43 |
| [Solved] NDIS: open file /compat/ndis/rate.bin failed: 2 | ccc | Networking | 1 | August 12th, 2009 15:32 |