Just a warning

This is the most difficult step of the whole process, that is of identifying how your card reader will enumerate the SD card. Most of the USB mass storage devices should be compatible with Linux, however, these are sold with the Windows O/S in mind. With some people, it seems that if you cannot write towards a specification, simply write a Windows device driver! :-/

The partitioning of the card is somewhat dangerous as you are doing this as root. Familiarize yourself with what drives are already attached to your system by examining /etc/fstab. Your SD card will NOT be one of those listed in the fstab.

If you are not sure of what you are doing, or what those lines in /etc/fstab (file system table) mean, go ask someone! It is far better to ask a question than to bork your system.

My fstab looks like this:
/dev/md0    /              ext3     defaults 1 1 
/dev/md6    /DataStore     ext3     defaults 1 2 
/dev/md1    /boot          ext3     defaults 1 2 
/dev/md5    /home          ext3     defaults 1 2 
/dev/md2    /tmp           ext3     defaults 1 2 
/dev/md4    /usr           ext3     defaults 1 2 
/dev/md3    /var           ext3     defaults 1 2 
/dev/sda6   swap           swap     defaults 0 0 
/dev/sdb6   swap           swap     defaults 0 0 
/dev/sde1   /mnt/removable msdos    noauto,users 0 0 
none        /proc          proc     defaults 0 0 
I use a raid array on that machine (/dev/mdX) with SATA drives (/dev/sda and /dev/sdb). Note that there already is an entry in the fstab for my card reader? This machine has an integrated card reader built into it (/dev/sde) and I added that entry, once I discovered where the card reader resides.


TopLocate your card reader

On one of my systems the SD card shows up as /dev/sdc, on another, it shows up as /dev/sde. You can check to see what device your card reader puts it at by looking at /var/log/messages. Here, on this system, it shows up as /dev/sdh. When I insert the SD card into my reader, I get this in the message log:
[tom@jtag ~]$ su 
Password: 
[root@jtag tom]# tail /var/log/messages 
Aug  5 15:58:21 jtag kernel: sdh: Write Protect is off 
Aug  5 15:58:21 jtag kernel: sdh: assuming drive cache: write through 
Aug  5 15:58:21 jtag kernel:  sdh: sdh1 
Aug  5 15:59:39 jtag kernel: SCSI device sdh: 990976 512-byte hdwr sectors (507 MB) 
Aug  5 15:59:39 jtag kernel: sdh: Write Protect is off 
Aug  5 15:59:39 jtag kernel: sdh: assuming drive cache: write through 
Aug  5 15:59:39 jtag kernel: SCSI device sdh: 990976 512-byte hdwr sectors (507 MB) 
Aug  5 15:59:39 jtag kernel: sdh: Write Protect is off 
Aug  5 15:59:39 jtag kernel: sdh: assuming drive cache: write through 
Aug  5 15:59:39 jtag kernel:  sdh: sdh1 

TopRun fdisk and change your parition type

In order to create the EXT3 filesystem, we need to re-partition the SD card. Run fdisk /dev/ (in my case fdisk /dev/sdh), change the default partition type to '83' (linux). Here are the steps:
[root@jtag tom]# fdisk /dev/sdh 
Command (m for help): p
Disk /dev/sdh: 507 MB, 507379712 bytes 16 heads, 61 sectors/track, 1015 cylinders Units = cylinders of 976 * 512 = 499712 bytes
Device Boot Start End Blocks Id System /dev/sdh1 1 1015 495289+ 6 FAT16
Command (m for help): t Selected partition 1 Hex code (type L to list codes): 83 Changed system type of partition 1 to 83 (Linux)
Command (m for help): p
Disk /dev/sdh: 507 MB, 507379712 bytes 16 heads, 61 sectors/track, 1015 cylinders Units = cylinders of 976 * 512 = 499712 bytes
Device Boot Start End Blocks Id System /dev/sdh1 1 1015 495289+ 83 Linux
Command (m for help): w 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@jtag tom]#
We should now check to ensure that we did everything correctly while in fdisk. To check, do:
[root@jtag tom]# fdisk -l /dev/sdh 
Disk /dev/sdh: 507 MB, 507379712 bytes 16 heads, 61 sectors/track, 1015 cylinders Units = cylinders of 976 * 512 = 499712 bytes
Device Boot Start End Blocks Id System /dev/sdh1 1 1015 495289+ 83 Linux [root@jtag tom]#
Look at the report for the size of the current partition (507 MB), it should be close to what your card is. A 512Meg SD card will be reported as being smaller than what it was sold as. This is due to marketing hype. Note that the current partition type is FAT16, this is the filesystem of the majority of the memory cards sold today (no royalties).


TopCreate the filesystem on the SD card

This is the simplest part of the task. We simply run (as root) the following command 'mke2fs -j /dev/<your linux partition>. In my case, /dev/sdh now has a /dev/sdh1 (partition #1 on /dev/sdh). Here is how it is done:
[root@jtag tom]# mke2fs -j /dev/sdh1 
mke2fs 1.39 (29-May-2006) 
Filesystem label= 
OS type: Linux 
Block size=1024 (log=0) 
Fragment size=1024 (log=0) 
123952 inodes, 495288 blocks 
24764 blocks (5.00%) reserved for the super user 
First data block=1 
Maximum filesystem blocks=67633152 
61 block groups 
8192 blocks per group, 8192 fragments per group 
2032 inodes per group 
Superblock backups stored on blocks: 
        8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409 
Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 23 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@jtag tom]#
You should see something like the above after the filesystem has been sucessfully built. This now completes the partitioning of the MMC card and the creation of an ext3 file system on that card. Now, go back to the section about how to put the OpenZipitDistro files onto the card .