Linux on XV6600 – Formatting SD Card

Rick Wargo

Earlier, I gave a quick overview of putting Linux on my XV6600. This and the following posts will describe in more detail how to put Linux on an XV6600 (U Verizon version).

Assuming that your linux box can see the card, the tool to format the card is fdisk.
For me, my linux box saw the card as /dev/sdc. You’ll need to figure out which device to use. You can find out by looking at /var/log/messages.

First, you need to delete any existing partitions. Then you’ll need to create two new partitions, the first one being 30MB and FAT16, the second the remainder of the card and a Linux partition (I recommend at least a 64MB SD card). After you create the partitions, and write it out to the card, you create the file systems and the you are good to go.

Here is a transcript of me doing this to a 128MB SD Card – the card is plugged into a USB-HUB Combo Card Reader. I’ve bolded my input. Comments are italicized and should not be entered. Note the following is done as root – be very careful!

to exit tail -f command>

[root@chocolate ~]# tail -f /var/log/messages
Feb 23 18:22:43 chocolate kernel: SCSI device sdc: 246016 512-byte hdwr sectors (126 MB)
Feb 23 18:22:43 chocolate kernel: sdc: Write Protect is off
Feb 23 18:22:43 chocolate kernel: sdc: assuming drive cache: write through
Feb 23 18:22:43 chocolate kernel: SCSI device sdc: 246016 512-byte hdwr sectors (126 MB)
Feb 23 18:22:43 chocolate kernel: sdc: Write Protect is off
Feb 23 18:22:43 chocolate kernel: sdc: assuming drive cache: write through
Feb 23 18:22:43 chocolate kernel: sdc: sdc1
Feb 23 18:22:44 chocolate fstab-sync[18371]: added mount point /media/CANON_DV for /dev/sdc1
^C[root@chocolate ~]# fdisk /dev/sdc

Command (m for help): p (print partition table for sanity check)

Disk /dev/sdc: 125 MB, 125960192 bytes
8 heads, 32 sectors/track, 961 cylinders
Units = cylinders of 256 * 512 = 131072 bytes

Device Boot Start End Blocks Id System
/dev/sdc1 1 961 122959+ 6 FAT16

Command (m for help): d (make sure to delete all partitions)
Selected partition 1

Command (m for help): n (create first primary partition)
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-961, default 1): (use default value)
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-961, default 961): +30M [/i](first partition is 30 MB)[/i]

Command (m for help): p (sanity check)

Disk /dev/sdc: 125 MB, 125960192 bytes
8 heads, 32 sectors/track, 961 cylinders
Units = cylinders of 256 * 512 = 131072 bytes

Device Boot Start End Blocks Id System
/dev/sdc1 1 230 29424 83 Linux (need to change to FAT16)

Command (m for help): t (change partition type)
Selected partition 1
Hex code (type L to list codes): 6 (6 is FAT16)
Changed system type of partition 1 to 6 (FAT16)

Command (m for help): p

Disk /dev/sdc: 125 MB, 125960192 bytes
8 heads, 32 sectors/track, 961 cylinders
Units = cylinders of 256 * 512 = 131072 bytes

Device Boot Start End Blocks Id System
/dev/sdc1 1 230 29424 6 FAT16

Command (m for help): n (second partition is linux, remainder of card)
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (231-961, default 231): (use default value)
Using default value 231
Last cylinder or +size or +sizeM or +sizeK (231-961, default 961): (use default value)
Using default value 961

Command (m for help): p (check out our work)

Disk /dev/sdc: 125 MB, 125960192 bytes
8 heads, 32 sectors/track, 961 cylinders
Units = cylinders of 256 * 512 = 131072 bytes

Device Boot Start End Blocks Id System
/dev/sdc1 1 230 29424 6 FAT16
/dev/sdc2 231 961 93568 83 Linux

Command (m for help): w (write it out, use q if uncertain. w will destroy whatever is on the card)
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
[root@chocolate ~]# mkfs.vfat /dev/sdc1 ## Format the first partition – you can then plug this into a Windows box and see a 30MB drive.
mkfs.vfat 2.10 (22 Sep 2003)
[root@chocolate ~]# mkfs.ext3 /dev/sdc2 ## Be patient, this may take a while
mke2fs 1.38 (30-Jun-2005)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
23424 inodes, 93568 blocks
4678 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
12 block groups
8192 blocks per group, 8192 fragments per group
1952 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@chocolate ~]#

That should be it.
Good luck.

Share and Enjoy:
  • Facebook
  • Twitter
  • LinkedIn
  • StumbleUpon
  • del.icio.us
  • Google Buzz
  • Yahoo! Buzz
  • Digg
  • email

Leave a Reply

stop spam with honeypot!