SD/MMC format for OMAP3 boot
From Texas Instruments Wiki
In order to create a bootable SD/MMC card under Linux compatible with OMAP3 boot ROM, you'd have to set a special geometry in the partition table, which is done through the fdisk "Expert mode". For Windows tooling see Procedure to boot with MMC/SD page.
First, lets clear the partition table:
# fdisk /dev/sdb Command (m for help): o Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Print card info:
Command (m for help): p Disk /dev/sdb: 128 MB, 128450560 bytes ....
Note card size in bytes. Needed later below.
Then go into "Expert mode":
Command (m for help): x
Now we want to set the geometry to 255 heads, 63 sectors and calculate the number of cylinders required for the particular SD/MMC card:
Expert command (m for help): h Number of heads (1-256, default 4): 255 Expert command (m for help): s Number of sectors (1-63, default 62): 63 Warning: setting sector offset for DOS compatiblity Expert command (m for help): c Number of cylinders (1-1048576, default 1011): 15
In this case 128MB card is used (reported as 128450560 bytes by fdisk above), thus 128450560 / 255 / 63 / 512 = 15.6 rounded down to 15 cylinders. Numbers there are 255 heads, 63 sectors, 512 bytes per sector.
Now, return to main mode and create a new partition:
Expert command (m for help): r Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-15, default 1): 1 Last cylinder or +size or +sizeM or +sizeK (1-15, default 15): 15
Mark it bootable:
Command (m for help): a Partition number (1-4): 1
And change its type to FAT32:
Command (m for help): t Selected partition 1 Hex code (type L to list codes): c Changed system type of partition 1 to c (W95 FAT32 (LBA))
The result is:
Command (m for help): p Disk /dev/sdb: 128 MB, 128450560 bytes 255 heads, 63 sectors/track, 15 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 * 1 15 120456 c W95 FAT32 (LBA)
Now, really write configuration to card (until here, card is not changed):
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.
Done! What's left is to format our partition as FAT32 to be mounted and populated:
# mkfs.vfat -F 32 /dev/sdb1 mkfs.vfat 2.11 (12 Mar 2005)
Note: before running mkfs.vfat (included in the dosfstools package in Debian) make sure /dev/sdb is not mounted.
# mount /dev/sdb1 /mnt/tmp
Note: If you use additional mkfs.vfat parameter -n you can give the card a name, e.g. for easier identification (i.e. mkfs.vfat -n omap3 -F 32 /dev/sdb1)
The SD/MMC card is now ready to be used to boot OMAP3 boards.
In order to format same card using sfdisk, one needs to do the following:
# sfdisk -H 255 -S 63 -C 15 /dev/sdb << EOF > ,,b,* > EOF
And follow with the mkfs.vfat commands above.
Comments on SD/MMC format for OMAP3 boot