howto id modem in udev lfs livecd 2.6.12-5 kernel

Howard hlenderk at bcpl.net
Wed Apr 19 13:23:59 EDT 2006


Dominik Brodowski wrote:

>Hi,......2.6.12 is pre-pcmciautils and prior to the
>merging of pcmcia into the driver model (IIRC) so the debugging output in
>/sys/ doesn't say all that much, unfortunately.
>	Dominik
>
    Yes, I'm gettin' the picture now and I now have this problem RESOLVED!  
The pcmcia HowTo's were a bit sketchy in this area and I wasn't finding 
much clarification out there.  Looking at "pcmcia-cs" and seeing things 
like "seriously depleted for 2.6 kernels" was not helpful as I was at 
2.6.12:)  I did finally hazard a post to the lfslivecd list and got some 
help and now have been able to get this working and a successful dialup! 
 udev /sys is now showing information.  I will attempt to describe what 
I did.  
     This ends up going on a bit...sorry, but someone may find it 
helpful, I wish I had seen something just like this, would have saved me 
a week or so:)

     To recap, I start on my k6-2 300 laptop with a boot to the 
 lfslivecd-x86-6.2-pre3  which puts me in a ramfs environment running a 
2.6.12-5 kernel.  This livecd was built to build a system and so is not 
so concerned with support for pcmcia or ppp.  So I start with only these 
modules loaded:
----------
# lsmod
Module                  Size  Used by
yenta_socket           20360  1
rsrc_nonstatic         11648  1 yenta_socket
pcmcia_core            43908  2 yenta_socket,rsrc_nonstatic
----------
     I then mount 2 partitions on my hard drive to use.
  - First a manual command to mount hda5 which is in vfat (so I can view 
my stuff wherever I'm booted(I still use win '98 too)) and run a script.  
mkdir /mnt/d; mount -t vfat /dev/hda5 /mnt/d; /mnt/d/lfs/start.sh
  - That "start.sh" script mounts hda7 on /mnt/f, which is my regular 
RedHat9 main partition in ext3 fs where I can run linux stuff from, and 
from there the script can do other custom setup things like automate 
getting this pcmcia routine and my ppp set up.  
     So now after those hard drive mounts I have these modules in place:
----------
# lsmod
ext3                   98180  1
jbd                    55576  1 ext3
nls_iso8859_1           4864  1
nls_cp437               6528  1
vfat                   11520  1
fat                    46876  1 vfat
yenta_socket           20360  3
rsrc_nonstatic         11648  1 yenta_socket
pcmcia_core            43908  4 serial_cs,pcmcia,yenta_socket,rsrc_nonstatic
-----------
     By comparing with my RedHat9 setup I could see I was missing some 
modules, namely "pcmcia" and "serial_cs"  and I could also not find any 
pcmcia utility files like "/etc/pcmcia" or the commands like "cardctl" 
like I had in RedHat, so I read that that all comes from the pcmcia-cs 
utility package.  So with some lfs help, and some experimentation, we 
found that I needed to have the following things in place:

1)     First I needed the "pcmcia" module loaded, which was already 
built and waiting in lfslivecd's 
/lib/modules/2.6.12.5/kernel/drivers/pcmcia/pcmcia.ko and so this module 
was easily loaded using:
moprobe pcmcia

2)     Next was the "serial_cs module" which I did not have so readily 
available but I was given instructions on how to build it which were, to 
me, suprisingly easy.  This was my first time at doing any module 
building.  Being in the lfslivecd environment made it a snap because 
since it is made to build stuff, all the tools and kernel souce are 
there and ready to go.  I'm not sure if any other "livecd"'s would have 
that capability (or a lot of installed distros, for that matter:)
So, standing in my home directory (~) as su (always root in this cd 
unless you create a user account) I find the kernel source at:
/lfs-sources/linux-2.6.12.5.tar.bz2

     - So the kernel is there all zipped up.  I was shown to get the 
files I needed ou like this:
tar -xf /lfs-sources/linux-2.6.12.5.tar.bz2   
linux-2.6.12.5/drivers/serial/{8250.h,serial_cs.c}
   - and that left me with a kernel souce directory structure in my home 
directory but with ONLY the two files I requested in it, unzipped:
# ls linux-2.6.12.5/drivers/serial
8250.h  serial_cs.c
   - next I moved into that "serial" directory
# cd linux-2.6.12.5/drivers/serial
   - and did this to build the module:
# echo 'obj-m += serial_cs.o' > Makefile
# make -C /lib/modules/2.6.12.5/build SUBDIRS=$PWD modules
   - so that built  this:
----------
# ls -l
total 64
-rw-r--r-- 1 root root  2507 2005-08-14 20:20 8250.h
-rw-r--r-- 1 root root    21 2006-04-12 10:53 Makefile
-rw-r--r-- 1 root root 22220 2005-08-14 20:20 serial_cs.c
-rw-r--r-- 1 root root 10928 2006-04-12 10:57 serial_cs.ko
-rw-r--r-- 1 root root   472 2006-04-12 10:57 serial_cs.mod.c
-rw-r--r-- 1 root root  2604 2006-04-12 10:57 serial_cs.mod.o
-rw-r--r-- 1 root root  8960 2006-04-12 10:57 serial_cs.o
---------
   - so theres the one I need, "serial_cs.ko",  and I load it with:
# ./insmod serial_cs.ko
   - so now I have these modules installed
----------
# lsmod
Module                  Size  Used by
serial_cs               8712  0
pcmcia                 21392  1 serial_cs
ext3                   98180  1
jbd                    55576  1 ext3
nls_iso8859_1           4864  1
nls_cp437               6528  1
vfat                   11520  1
fat                    46876  1 vfat
yenta_socket           20360  3
rsrc_nonstatic         11648  1 yenta_socket
pcmcia_core            43908  4 serial_cs,pcmcia,yenta_socket,rsrc_nonstatic
----------
3)    But with all that in place I still could not see my pcmcia 
modem.... on to the utilities!  I was finally clued in that I should use 
pcmcia-cs and not pcmciautils so I proceeded to build and install that.
  - so first I copied the downloaded "pcmcia-cs-3.2.8.tar.gz" file into 
my home directory:
# cp /mnt/d/dlds/linux/pcmcia-cs-3.2.8.tar.gz ~
   - then I unpack it:
# tar -xzf /mnt/d/dlds/linux/pcmcia-cs-3.2.8.tar.gz
   -  It creates a new directory for itself, "pcmcia-cs-3.2.8" and I 
moved into that:
# cd pcmcia-cs-3.2.8
   - Then I read the HowTo that it comes with and found out info about 
building.  It was then that I also read that IT WILL ALSO BUILD THE 
MODULES if they weren't already present!:) darn...oh well.  So I built 
it with the mods in place already like this:
# make config
   - configure script had this funny thing to say:
Configuration successful.
** Your kernel is configured with PCMCIA driver support.  Therefore,
** 'make all' will compile the PCMCIA utilities but not the drivers.
** See README-2.4 if this is not what you intended!
   - ha ha ha..smarty pants.... ok,  next I did this:
# make all
# make install
   - And those commands first built, and then installed the utilities 
into place.
I looked to find what had been installed and sure enough:
/etc/pcmcia                  (and it's sub-tree)
/etc/rc.d/init.d/pcmcia      (the pcmcia init script)
/sbin/cardctl                (the command)
/sbin/cardmgr                (the daemon)
   - cool! so along with them I also had the previously built
serial_cs.ko
   - OK so with all of these in place, to get things going I just did:
/etc/rc.d/init.d/pcmcia restart
   - and there we were. Pcmcia restarts and I can now see the modem on 
ttyS1 AND DIAL AWAY!

4)     So I have it working , but hey, I'm in a livecd so as soon as I 
reboot, it's vapor!  
So I copied everything I had to build over to a new directory at 
/mnt/f/lfs (my hda7 (ext3fs)) where I could find out what had to be 
redone in order to get it all going again at the next lfslivecd boot.
     I was pleased to find that all I needed to do is this:
 - modpobe pcmcia
 - insmod serial_cs.ko  (from my /mnt/d/lfs storage area)
 - just copy those utility files (just above) into place (from my 
/mnt/d/lfs storage area)
 - and /etc/rc.d/init.d/pcmcia restart

 - I now have that routine included in my startup script as well as my 
ppp setup stuff and I can be back in buisiness with the first "start.sh" 
command I do right after livecd boot!
Pretty Cool!  





More information about the linux-pcmcia mailing list