Documentation
User How-To's
Booting from microSD/SD/MMC Overview
The following procedure will allow you to place both the linux boot image as well as the root file system on mmc or microSD. The process consists of 4 steps, the first 3 carried out on your build machine:
It does not require you to change your existing U-boot, rootfs, or kernel images in the on-board flash. It is completely safe to try. You can go back to your previous environment simply by removing the card before booting.
Use either fdisk or your favorite GUI partitioning tool to create 2 partitions on your memory card:
After completing the partitioning process, use mkfs.vfat and mkfs.ext2 to format the 2 new partitions. If you used a GUI partitioning tool in the previous step it will likely have given you the option to format the 2 partitions as part of the repartitioning process.
Eventually you will want to build your own kernel and rootfs images, but until the process is documented you can use pre-built images. Download and extract the following tarball to the fat partition:
www.sakoman.net/oe/mmc-boot/kernel-mmc.tar.gz
Then download and extract the following tarball to the ext2 partition:
www.sakoman.net/oe/mmc-boot/rootfs-mmc.tar.gz
Now unmount the two file systems (don't skip this step or your flash card data will be corrupted).
Transfer the flash card to your gumstix and power it up. You should see a message like this:
Hit any key to stop autoboot: 0
Instruction Cache is ON
Found gumstix-factory.script on MMC...
## Executing script at a2000000
Booting from mmc/microSD...
Detected: 1985024 blocks of 1024 bytes (1938MB) SD card.
Vendor: Man 03 OEM SD "SU02G" Date 04/2007
Product: 812341556
Revision: 8.0
reading uimage
998064 bytes read
## Booting image at a2000000 ...
Image Name: Angstrom/2.6.21/gumstix-custom-v
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 998000 Bytes = 974.6 kB
Load Address: a0008000
Entry Point: a0008000
OK
After this you will see normal boot messages and you will be running with the root file system on your flash card.
Some Linux distros seem to make the above process far more difficult than it should be. If yours fall in that category you can do the partitioning, formatting, and un-tarring on your gumstix.
This step will create 2 partitions on your memory card:
All existing data on your flash card will be lost!
Note: recent builds include support for the ext2 file system. If you have an older build, or if you disabled ext2 support you can install it by typing "ipkg install task-base-gumstix-ext2"
Note: recent builds include support for the fat file system. If you have an older build, or if you disabled fat support you can install it by typing "ipkg install task-base-gumstix-fat"
The first step in this process is to partition your memory card. You can do this with the fdisk command:
$ fdisk /dev/mmcblk0
The number of cylinders for this disk is set to 2420.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help):
Now we'll delete the existing partition using the d 1 command:
Command (m for help): d 1
Selected partition 1
Now we'll create a 40MB fat partition. The n command specifies a new partition, we then respond to the prompts to specify primary partition #1, starting at the first cylinder, for a size of 40MB.
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2420, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2420, default 2420): +40M
Command (m for help):
Next we will create a second partition. Once again we use the n command, and respond to the prompts to specify primary partition #2, starting with the default cylinder and using the rest of the available space on the flash card:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (50-2420, default 50):
Using default value 50
Last cylinder or +size or +sizeM or +sizeK (50-2420, default 2420):
Using default value 2420
Command (m for help):
The above partitions have been created as linux partitions by default, so we will now specify that we would like primary partition #1 to be fat using the t command:
Command (m for help): t 1
Partition number (1-4): 1
Hex code (type L to list codes): 6
Changed system type of partition 1 to 6 (FAT16)
Command (m for help):
Let's check our work with the p command:
Command (m for help): p
Disk /dev/mmcblk0: 2032 MB, 2032664576 bytes
41 heads, 40 sectors/track, 2420 cylinders
Units = cylinders of 1640 * 512 = 839680 bytes
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 1 49 40160 6 FAT16
/dev/mmcblk0p2 50 2420 1944220 83 Linux
Command (m for help):
And finally, we'll commit our changes using the w command:
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
mmcblk0: p1 p2
mmcblk0: p1 p2
WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
$
Now that the partitioning is complete we'll format the 2 filesystems. First the fat partition:
$ mkfs.vfat /dev/mmcblk0p1
mkfs.vfat 2.11 (12 Mar 2005)
$
And then the ext2 partition:
$ mkfs.vfat /dev/mmcblk0p1
mkfs.vfat 2.11 (12 Mar 2005)
root@gumstix-custom-verdex:~$ mkfs.ext2 /dev/mmcblk0p2
mke2fs 1.38 (30-Jun-2005)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
243360 inodes, 486055 blocks
24302 blocks (5.00%) reserved for the super user
First data block=0
15 block groups
32768 blocks per group, 32768 fragments per group
16224 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
$