分类: LINUX
2009-05-31 10:06:11
$ [dmesg | tail]
...
[ 6854.215650] sd 7:0:0:0: [sdc] Mode Sense: 0b 00 00 08
[ 6854.215653] sd 7:0:0:0: [sdc] Assuming drive cache: write through
[ 6854.215659] sdc: sdc1
[ 6854.218079] sd 7:0:0:0: [sdc] Attached SCSI removable disk
[ 6854.218135] sd 7:0:0:0: Attached scsi generic sg2 type 0
...
In this case, it shows up as /dev/sdc (note sdc inside the square brackets above).
$ [df -h]
Filesystem Size Used Avail Use% Mounted on
...
/dev/sdc1 400M 94M 307M 24% /media/disk
...
Be sure to choose the whole device (/dev/sdc), not a single partition (/dev/sdc1).
$ [sudo fdisk /dev/sdc]
Command (m for help): [p]
Disk /dev/sdc: 2021 MB, 2021654528 bytes
255 heads, 63 sectors/track, 245 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 * 1 246 1974240+ c W95 FAT32 (LBA)
Partition 1 has different physical/logical endings:
phys=(244, 254, 63) logical=(245, 200, 19)
Expert Command (m for help): [c]
Number of cylinders (1-256, default xxx): [enter the number you calculated]
Command (m for help): [p]
Disk /dev/sdc: 2021 MB, 2021654528 bytes
255 heads, 63 sectors/track, 245 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Command (m for help): [p]
Disk /dev/sdc: 2021 MB, 2021654528 bytes
255 heads, 63 sectors/track, 245 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 * 1 51 409626 c W95 FAT32 (LBA)
/dev/sdc2 52 245 1558305 83 Linux
$ [sudo mkfs.msdos -F 32 /dev/sdc1 -n LABEL1]
mkfs.msdos 2.11 (12 Mar 2005)
$ [sudo mkfs.ext3 -L LABEL2 /dev/sdc2]
mke2fs 1.40-WIP (14-Nov-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
195072 inodes, 389576 blocks
19478 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=402653184
12 block groups
32768 blocks per group, 32768 fragments per group
16256 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information:
console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootdelay=1
When I used the FAT32 partition and it worked fine for me.
when I followed the above procedure, sometimes I can have two partitions when I plug the SD card again. sometime only the first partition appears, what about the problem?
Be careful not to type 't' '1' 'c' - if you follow the above to the letter, you don't need to specify the partition number to change the type for. You know you have done it wrong if the partition type for partition 1 is now set to 'FAT12'. The spurious 'c' will then toggle some compatibility flags that may affect your system.
Typical usage with uImage in 1st partition and rootfs in 2nd partition:
setenv bootargs 'console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootdelay=1' setenv bootcmd 'mmcinit;fatload mmc 0 80300000 uImage;bootm 80300000'