file: linux_cardread-789.html
16 Jul 2003
Linux FLASH Card Reading Instructions for RedHat 9
Setup:
Note 1: You should NOT need to be root to do this stuff! 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:
Either do these steps the first time:
- Put the PCMCIA card into the top slot and boot to Linux.
- Hopefully you heard a couple of "happy" (higher pitch) beeps
as the PCMCIA cardmgr messages went by on the screen.
- Login and do a:
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
- If Linux is already running, put the PCMCIA card into the slot
(use this same slot consistently) and listen for a couple of beeps.
If you just get an error message and no beeps, try:
- /sbin/cardctl status
or
- /sbin/cardctl ident
- If still nothing:
- Did you plug the card in???
- Did you set up RedHat 9 for reading PCMCIA memory cards per
Setting up RedHat 9 for PCMCIA memory card reading ?
- If you did, and it's not recognized, try rebooting as above
- 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 memory_cs 0 mem0 126 0
1 ftl ftl_cs 0 ftl0c0 127 0
or:
Socket 0: 3Com 3c589D Ethernet
0 network 3c589_cs 0 eth0
Socket 1: Memory Card
1 memory memory_cs 0 mem0 126 0
To read a PCMCIA memory card
- just insert it into a PCMCIA slot; (and there had better be 2 happy beeps after that insert...)
- continue with instructions below...
To remove a PCMCIA memory card
- just eject it from the slot (there should be a single beep as the card is removed)
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/mem0c0c 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/mem0c0c 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:
geek note:
For completeness, here's how to get at the CIS in attribute
memory (I'll assume a 4k CIS - probably way too big):
- dd bs=1024 count=4 if=/dev/mem0a of=your_CIS_filename