Tuesday, February 5, 2008

Freebsd ndis driver - import windows driver to freebsd ....

Step 1: Install NDIS code

cd /sys/modules/ndis && make && make install

Step 2: Figure out what hardware you have to support

This can be annoying . . . vendors ship different components in their machines, along with driver disks with all the possible variants of drivers, so you have to find the right driver. Unless you're a big hardware weenie, you're not sure, and pulling the right driver from the vendor can be hard.

If yours is a PCI device, you can ask pciconf to list what is on the system, and collate it with a vendor/device information database:

pciconf -lv

And here I see:

none6@pci2:4:0: class=0x028000 card=0x00031028 chip=0x432014e4 rev=0x03 hdr=0x00
vendor = 'Broadcom Corporation'
device = 'BCM4306 802.11b/g Wireless LAN Controller'
class = network

Step 3: Go Get the Win2K/XP Driver

You have to pull this off the CDROM or a web site yourself. Bonus points when the driver is packaged in a self-extracting archive, then you have to borrow a Windows machine to get the .sys and .inf files. Joy!

In this case, Dell re-brands the Broadcom driver as a Dell driver, so I download the "Dell _Wireless (US) WLAN Network Adapter Card" from their web site, extract the files on my Windows box, and select the bcmwl5.inf and bcmwl5.sys

Step 4: Copy those Drivers to /sys/modules/if_ndis

# ls *.inf *.sys
bcmwl5.inf bcmwl5.sys bcmwl5a.inf bcmwlntp.sys
# cp bcmwl5.* /sys/modules/if_ndis
# ls /sys/modules/if_ndis
Makefile bcmwl5.inf bcmwl5.sys
# cd /sys/modules/if_ndis

Step 5: Magic

Take a deep breath, stretch your arms, think a happy though, and:

# ndiscvt -i bcmwl5.inf -s bcmwl5.sys -o ndis_driver_data.h
ndiscvt: line 13: e: syntax error.
ÿþ[#

Okay, don't panic! I have seen this before. The ndiscvt works on ASCII files, but many a crafty driver has been distributing stuff in Unicode. If I look at bcmwl5.inf, I see:

# hd bcmwl5.inf | head -3
00000000 ff fe 3b 00 3b 00 0d 00 0a 00 3b 00 3b 00 20 00 |..;.;.....;.;. .|
00000010 62 00 63 00 6d 00 77 00 6c 00 35 00 2e 00 69 00 |b.c.m.w.l.5...i.|
00000020 6e 00 66 00 0d 00 0a 00 3b 00 3b 00 0d 00 0a 00 |n.f.....;.;.....|

For your edification, if a file looks like null-padded ASCII characters, then it is probably UTF-16.

# iconv -c -f utf-16 -t ascii bcmwl5.inf > bcmwl5.inf.ascii
# head -3 bcmwl5.inf.ascii
;;
;; bcmwl5.inf
;;
# ndiscvt -i bcmwl5.inf.ascii -s bcmwl5.sys -o ndis_driver_data.h

Well, that was easy.

Step 6: Compile, Install

Basically:

make && make install

Load the module:

kldload ndis
kldload if_ndis

And, see if you have an Ethernet device:

# ifconfig ndis0
ndis0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
ether ff:ff:ff:ff:ff:ff
media: IEEE 802.11 Wireless Ethernet autoselect
status: no carrier
ssid ""
channel -1 authmode OPEN powersavemode OFF powersavesleep 100
rtsthreshold 2312 protmode CTS
wepmode OFF weptxkey 1

(You shouldn't ever have that as a MAC address, unless you're blogging sensitive data to the Internet. ;)

Loading NDIS at Boot

Once you are happy with your NDIS, add a line like this to /boot/loader.conf, which will cause the kernel to load your new module at boot time:

if_ndis_load="YES"

At this point, you're ready to get back to your FreeBSD Handbook if you need further information.

Sunday, February 3, 2008

Reset security code / unlock code for the motorola Phone (v3i)

I just bought a Motorola v3i from a phone shop for RM250. But the only problem is the previous  owner has change the default unlock and security code which is 1234/000000 respectively. I googling around and found some info that the code are stored in the phone in seem.
This are the tools ... just convert the seems ou get to text  then you will get the code directly ....

download the following seems from phone by p2k tools and see the code
0074_0001 - Stores Phone Lock Code
0076_0001 - Stores Phone Security Code

Any Question can ask me ...

Centos 7 reset root/ any user lost password / lockout due to cant remember password

1. Need to be in front of the terminal. (Physically if not vm). 2. Reboot the server 3. Press 'e' in the GRUB2 boot screen. 3. bunch...