LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 3196|回复: 2

RedHat-7.2 i386 + pcmcia-cs + shmoo orinoco monitor patch mini-howto(转贴)

[复制链接]
发表于 2002-12-10 15:34:21 | 显示全部楼层 |阅读模式
RedHat-7.2 i386 + pcmcia-cs + shmoo orinoco monitor patch mini-howto

Introduction
This is a quick howto on how to get RedHat 7.2 to work with orinoco gold card
in monitor mode, which is useful for sniffing 802.11b packets.
The following instructions worked for me on a Dell Inspiron 7000 with a
Compaq WL110 pcmcia wireless card. But they should be generic enough to apply
to other versions and distributions (with minor corrections).
Assumption was that the reader is a linux novice.
In many cases you can directly use provided config, binary, and object files.
There is no guarantee that these instructions will work for you.
All comments, corrections, and suggestions are gladly accepted via e-mail
at the bottom of the document.

Prerequisites
Linux kernel source tree (i used 2.4.18);
Linux pcmcia-cs (i used pcmcia-cs-3.1.34);
Shmoo orinoco patch;
Graduate standing in Rocket Science major (optional).

Installation
Uninstall all previous versions of pcmcia-cs (rpm or whatever).
To check if you have rpm installed run:

        $ rpm -qa | grep pcmcia

if it does not return anything you are ok, if it does return something
similar to pcmcia-cs-3.1.27.i386.rpm, then remove it:

        $ rpm -e pcmcia-cs

if you had a previous version of pcmcia-cs installed you will need to
move the /etc/pcmcia directory to avoid conflicts:

        $ mv /etc/pcmcia /etc/pcmcia.orig

create a file /etc/sysconfig/pcmcia with the following contents:

PCMCIA=yes
PCIC=i82365
PCIC_OPTS=
CORE_OPTS=
CARDMGR_OPTS=

configure your kernel without pcmcia support and run at least a "make dep".
in short, you need to place linux-2.4.18.tar.bz2 to /usr/src:

# mkdir /usr/src/linux-2.4.18
# rm -f /usr/src/linux
# ln -s /usr/src/linux-2.4.18 /usr/src/linux
# cd /usr/src
# tar -jxvf linux-2.4.18.tar.bz2
# cd /usr/src/linux
# make menuconfig

select what you need and save your new kernel configuration.
note again: do _not_ select "CMCIA/CardBus support" under "General setup",
otherwise compilation of pcmcia-cs package will complain.

# make dep

if you'd like to build your own kernel, then

# make modules

if you had an old /lib/modules/2.4.18 directory, rename it:

# mv /lib/modules/2.4.18 /lib/modules/2.4.18.orig

otherwise just continue with module installation:

# make modules_install
# make bzImage
# cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-2.4.18-mon

assuming you use grub as your boot manager modify /boot/grub/menu.lst
by appending these lines:

title Red Hat Linux with monitor support (2.4.18-mon)
        root (hd0,1)
        kernel /boot/vmlinuz-2.4.18-mon ro root=/dev/hda2

Of course your root device may be different. To find out what it is:

# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/hda2              3564280   3083600    299620  92% /
none                     95824         0     95824   0% /dev/shm

As you can see in my case the root filesystem ( / ) is mounted on /dev/hda2
therefore i have "root (hd0,1)" (they start counting from 0,
meaning disk 1 partition 2) and "root=/dev/hda2".

I use a console frame buffer so my kernel line looks like this:

        kernel /boot/vmlinuz-2.4.18-mon ro root=/dev/hda2 vga=791

This gives me a 1024x768 color console -- very handy.

if you feel adventureous you can use my .config file (place it in /usr/src/linux,
run "make menuconfig", choose "exit" and say yes to "save your new kernel configuration",
then run "make dep") or even the compiled kernel -- just place it in /boot and modify
the /boot/grub/menu.lst.

Reboot with the new kernel (choose it from the grub boot menu).

Then if you still did not download pcmcia-cs-3.1.34 package do it now:

[root@laptop root]# cd /usr/src
[root@laptop src]# wget http://pcmcia-cs.sourceforge.net/ftp/pcmcia-cs-3.1.34.tar.gz
[root@laptop src]# wget http://airsnort.shmoo.com/pcmcia-cs-3.1.34-orinoco-patch.diff
[root@laptop src]# ls -F
linux@                        pcmcia-cs-3.1.34.tar.gz
linux-2.4.18/                pcmcia-cs-3.1.34-orinoco-patch.diff

Untar it:

[root@laptop src]# tar -zxvf pcmcia-cs-3.1.34.tar.gz
[root@laptop src]# cd pcmcia-cs-3.1.34

Patch it:

[root@laptop pcmcia-cs-3.1.34]# patch -p1 < ../pcmcia-cs-3.1.34-orinoco-patch.diff

Configure it. Here is my transcript:
>
[root@laptop pcmcia-cs-3.1.34]# make config

    -------- Linux PCMCIA Configuration Script --------

The default responses for each question are correct for most users.
Consult the PCMCIA-HOWTO for additional info about each option.

Linux kernel source directory [/usr/src/linux]:

The kernel source tree is version 2.4.18.
The current kernel build date is Mon Jul 8 21:19:36 2002.

Build 'trusting' versions of card utilities (y/n) [n]:
Include 32-bit (CardBus) card support (y/n) [y]:
Include PnP BIOS resource checking (y/n) [n]: y
Module install directory [/lib/modules/2.4.18]:

Kernel configuration options:
    Kernel-tree PCMCIA support is disabled.
    Symmetric multiprocessing support is disabled.
    PCI BIOS support is enabled.
    Power management (APM) support is enabled.
    SCSI support is disabled.
    IEEE 1394 (FireWire) support is disabled.
    Networking support is enabled.
     Radio network interface support is enabled.
     Token Ring device support is disabled.
     Fast switching is disabled.
     Frame Diverter is disabled.
    Module version checking is enabled.
    Kernel debugging support is enabled.
     Memory leak detection support is disabled.
     Spinlock debugging is disabled.
    Preemptive kernel patch is disabled.
    /proc filesystem support is enabled.

It doesn't look like you are using 'lilo'.
It looks like you have a System V init file setup.

X Window System include files found.
Forms library not installed.
    If you wish to build the 'cardinfo' control panel, you need the Forms
    library and the X Window System include files.  See the HOWTO for details.

Configuration successful.

Again, for those who want a shortcut, here is my config.mk.
Just replace your pcmcia-cs-3.1.24/config.mk file with it and continue.

Before you "make all", i recommend that you comment out two lines in the
pcmcia-3.1.34/wireless/orinoco.c file on line 1372. You can open that file
in vi and then type :1372 and press enter -- should take you to that line.
Add /* and */ like below:

        /* printk(KERN_WARNING "%s: Undersized frame received (%d bytes)\n",
                       dev->name, length); */

The reason behind it is that this line produces and enormous amount of
warning messages in /var/log/messages and in some cases on the console.

After that compile the package, run

[root@laptop pcmcia-cs-3.1.34]# make all

when it completes, install binaries and modules:

[root@laptop pcmcia-cs-3.1.34]# make install

maybe it was me or my system but the files from pcmcia-cs-3.1.34/etc and
pcmcia-3.1.34/wireless directories did not make it to their destinations.
so i copied them by hand:

[root@laptop pcmcia-cs-3.1.34]# cd /usr/src/pcmcia-cs-3.1.34/etc
[root@laptop etc]# mkdir -p /etc/pcmcia
[root@laptop etc]# cp -r * /etc/pcmcia
[root@laptop etc]# cd /usr/src/pcmcia-cs-3.1.34/wireless
[root@laptop wireless]# cp hermes.o orinoco.o orinoco_cs.o /lib/modules/2.4.18/pcmcia

just in case you (or maybe me) have a wierd setup, create these synlinks:

# ln -s /lib/modules/2.4.18/pcmcia/hermes.o /lib/modules/2.4.18/kernel/drivers/net/wireless/hermes.o
# ln -s /lib/modules/2.4.18/pcmcia/orinoco.o /lib/modules/2.4.18/kernel/drivers/net/wireless/orinoco.o
# ln -s /lib/modules/2.4.18/pcmcia/orinoco.o /lib/modules/2.4.18/kernel/drivers/net/wireless/orinoco_cs.o

also, copy pcmcia-cs-3.1.34/etc/rc.pcmcia to /etc/rc.d/init.d/pcmcia

# cp /usr/src/pcmcia-cs-3.1.34/etc/rc.pcmcia /etc/rc.d/init.d/pcmcia

you can get my /etc/pcmcia files here.

now start the pcmcia services:

# service pcmcia start

if this gives you a wierd error message, then try running:

# /etc/rc.d/init.d/pcmcia start

you should be in business. If this is the only network card it is assigned
a name of eth0, otherwise eth1. Assuming it is eth1:

# iwconfig eth1
eth1      IEEE 802.11-DS  ESSID:""  Nickname:"HERMES I"
          Mode:Managed  Frequency:2.457GHz  Access Point: 44:44:44:44:44:44
          Bit Rate:2Mb/s   Tx-Power=15 dBm   Sensitivity:1/3
          Retry limit:4   RTS thrff   Fragment thrff
          Encryption keyff
          Power Managementff
          Link Quality:0/92  Signal level:134/153  Noise level:134/153
          Rx invalid nwid:0  invalid crypt:0  invalid misc:0

I still do not know why the Bit Rate is 2Mb/s, and not 11 (older 802.11 not 802.11b?)

# ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 00:02:A5:2D:70:AD
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:10 Base address:0x100

Check if your card can go into the monitor mode:

# iwpriv eth1 monitor 2 1

The above command should not give you error messages.
Check that you got a long MAC address:

# ifconfig eth1
eth1      Link encap:UNSPEC  HWaddr 00-02-A5-2D-70-AD-00-00-00-00-00-00-00-00-00-00
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:10 Base address:0x100

For Kismet users
Assuming latest development kismet installed with the usual /usr/local prefix.
run:
# ifconfig eth1 up
# kismet_hopper -t orinoco &
# kismet

Troubleshooting
If it does not go as smoothly as i described, here are few things to check.
First, check if your modules loaded correctly. You should at least see these:

# lsmod
Module                  Size  Used by
orinoco_cs              4752   2
orinoco                30640   0  [orinoco_cs]
hermes                  5888   0  [orinoco_cs orinoco]
ds                      6576   2  [orinoco_cs 3c589_cs]
i82365                 21904   2
pcmcia_core            46816   0  [orinoco_cs 3c589_cs ds i82365]

If not, a good place to look for a reason is in /var/log/messages.
In my case a "good" cardmgr startup and module insertion looks like this:

Jul 10 14:51:56 laptop cardmgr[1192]: socket 1: Orinoco or Intersil Prism 2 Wireless
Jul 10 14:51:57 laptop cardmgr[1192]: executing: 'modprobe hermes'
Jul 10 14:51:57 laptop cardmgr[1192]: executing: 'modprobe orinoco'
Jul 10 14:51:57 laptop cardmgr[1192]: executing: 'modprobe orinoco_cs'
Jul 10 14:51:57 laptop cardmgr[1192]: executing: './network start eth1'

Problematic startup may have a similar output in /var/log/messages:

Jul  6 15:48:13 laptop cardmgr[2243]: socket 1: Orinoco or Intersil Prism 2 Wireless
Jul  6 15:48:13 laptop cardmgr[2243]: + /lib/modules/2.4.18/pcmcia/orinoco.o: unresolved symbol BUG_ON
Jul  6 15:48:13 laptop cardmgr[2243]: insmod exited with status 1

Usually messages are informative enough to pinpoint the problem.

Files
All mentioned files can be found here.


Conclusions
none.
if you can draw any, let me know.

Thanks
thanks to pcmcia-cs development crew for the pcmcia-cs package;
thanks to shmoo guys for the orinoco monitor patch and valuable input (snax);
thanks to wireless [at] kismetwireless [dot] net list for kismet (mike k.);
thanks to southwest texas state university for hosting this site;
thanks to swt cs dept dr. tom mccabe for providing ipaqs and wl110 wireless cards;
 楼主| 发表于 2002-12-10 16:15:10 | 显示全部楼层

说明

 楼主| 发表于 2002-12-10 16:51:10 | 显示全部楼层

兄弟们,如果谁还在为pcmcia发愁,就看这个吧

按照这个上面的步骤,一切轻松搞定!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表