|
Creating and Mounting a Filesystem on a CompactFlash Card
-
Boot the OSK from the JFFS2 filesystem stored on the flash. If you have previously changed your kernel parameters to boot from your Linux Host machine, you can revert back to booting from the flash by issuing the following command to U-Boot:
setenv bootargs console=ttyS0,115200n8 noinitrd rw ip=off
root=/dev/mtdblock4 mem=30M
-
Insert a CompactFlash memory storage card (for example, Sandisk) into the CompactFlash slot on the OSK.
-
Change to the directory where the IDE drivers reside. Enter the following command:
cd /lib/modules//kernel/drivers/ide
-
Install the loadable kernel modules. Enter the following commands:
insmod ide-mod.o
insmod ide-probe-mod.o
insmod ide-disk.o
insmod ide-cs.o
-
Start the PCMCIA services. Enter the following command:
/etc/init.d/pcmcia start
-
The CF card will now be detected. Information similar to the following appears:
hda: SanDisk SDCFB-128, ATA DISK driver
ide0 at 0x000-007,0x00e in irq 222
hda: 250880 sectors (128MB) w/1KiB Cache, CHS=980/8/32
Partition check:
/dev/ide/host0/bus0/target0/lun0: p1
ide_cs: hda: Vcc = 5.0, Vpp = 0.0
Note: Steps 6 and 7 use the fdisk and mkfs.ext2 commands stored on the JFFS2
flash filesystem on the OSK to partition and create a filesystem on the CF card.
These utilities are not included with the Montavista Preview Kit, and are only
available on the flash filesystem. If the CompactFlash card being used has already
been set up with a partition and filesystem, please skip to step 9.
- Use the fdisk command to create a partition on the card:
fdisk /dev/ide/host0/bus0/target0/lun0/disc
Enter 'n' to create new partition. (answer the questions)
Enter 'w' to write the partition table.
-
Here is an example of using fdisk to create a partition:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-490, default 1): 1
Last cylinder or +size or +sizeM or +sizeK
(1-490, default 490): 490
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
/dev/ide/host0/bus0/target0/lun0: p1
WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
-
Use the mkfs.ext2 command to create a partition on the card:
mkfs.ext2 /dev/ide/host0/bus0/target0/lun0/part1
mke2fs 1.27 (8-Mar-2002)
/dev/ide/host0/bus0/target0/lun0: p1
/dev/ide/host0/bus0/target0/lun0: p1
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
7840 inodes, 31344 blocks
1567 blocks (5.00%) reserved for the super user
First data block=1
4 block groups
8192 blocks per group, 8192 fragments per group
1960 inodes per group
Superblock backups stored on blocks:
8193, 24577
Writing inode tables: done
Writing superblocks and filesystem accounting
information: done
This filesystem will be automatically checked
every 30 mounts or 180 days, whichever comes first.
Use tune2fs -c or -i to override.
-
Finally, to mount one of the partitions on the card, enter the following command
mount /dev/ide/host0/bus0/target0/lun0/part1 /mount_point
-
That's it! Now cd into the directory you mounted the card to, and copy files
back and forth as you normally would with a hard disk.
|
|