file: linux_cardread-fc2.html
28 Sep 2004
Linux FLASH Card Reading Instructions for Fedora Core 2
Setup:
Note 1: You should NOT need to be root to do read FLASH cards! It's safer to work as a regular user!
Note 2: To avoid any confusion among cards, only install the
PCMCIA FLASH card. Leave the other PCMCIA slot empty.
Procedure:
Do these steps (as root) the first time just to confirm all is working:
- Put the PCMCIA card into the top slot and boot to Linux.
Or
- If Linux is already running, put the PCMCIA card into the slot
now.
- Login as root and do a:
- cat /var/lib/pcmcia/stab
to see which slot the card is in; on my Dell, the top slot
is 1, so I'll use 1 in the rest of this write-up;
or, try
- /sbin/cardctl status
or
- /sbin/cardctl ident
to see which card is in which socket.
- If none of these commands shows you info about the FLASH card and slot:
- Did you plug the card in???
- Did you set up Fedora Core 2 for reading PCMCIA memory cards per
Setting up Fedora Core 2 for PCMCIA memory card reading ?
- If you did, and it's not recognized, try rebooting and go through it all one more time.
- And if that doesn't work, but other PCMCIA cards (modem,
ethernet, SCSI or whatever) do work (you DID try this, right?)
- I'm stuck......
Oh, well.....
All the useful incantations:
Primary assumption: the card is recognized and something appears in
/var/lib/pcmcia/stab, such as:
Socket 0: 3Com 3c589D Ethernet
0 network 3c589_cs 0 eth0
Socket 1: Intel Series 2+ 20MB Flash
1 memory pcmciamtd 0 mtd0
or:
Socket 0: 3Com 3c589D Ethernet
0 network 3c589_cs 0 eth0
Socket 1: Memory Card
1 memory pcmciamtd 0 mtd0
To read a PCMCIA memory card
- insert it into a PCMCIA slot,
- and continue with instructions below...
To remove a PCMCIA memory card
- just eject it from the slot
To see if the card is recognized in the slot:
To see if the cardmgr recognizes the card:
To copy the entire card to a file:
- cp /dev/mtd0c0c your_filename
NOTE: This is the preferred way to read a FLASH card to a file!
To copy part of the card to a file, where blocksize=1024 bytes
and count=number of blocks to copy (in this example, to copy 2 MB of a 20 MB
card) and skip bypasses the first 128K reserved space in the FLASH card:
- dd bs=1024 count=2048 skip=128 if=/dev/mtd0c0c of=your_filename
To view the binary as hex:
- od -t x1 -A x your_filename | less
- - Use arrow keys, page-up/down, 'q' to quit
For more command info, see the man pages for: