Pandaboard的啓動SD卡製作流程
目的:把4G的SD卡分成boot(格式fat) 和rootfs(格式ext3)兩部分
1.插入4G的SD卡,然後 fdisk -ls 查看SD卡掛載信息(主要還是看設備號的名稱)
例如我的是:
設備 啓動 起點 終點 塊數 ID 系統
/dev/sdf 63 125837144 62918541 7 HPES/NTFS/exFAT
2.建立mkcard.sh腳本
#! /bin/sh# mkcard.sh v0.5
# (c) Copyright 2009 Graeme Gregory
<[email protected]># Licensed under terms of GPLv2## Parts of the procudure base on the work of Denys Dmytriyenko#
http://wiki.omap.com/index.php/MMC_Boot_Format
export LC_ALL=C
if [ $# -ne 1 ]; then
echo "Usage: $0 <drive>"
exit 1;fi
DRIVE=$1
dd if=/dev/zero of=$DRIVE bs=1024 count=1024
SIZE=`fdisk -l $DRIVE | grep Disk | grep bytes | awk '{print $5}'`
echo DISK SIZE - $SIZE bytes
CYLINDERS=`echo $SIZE/255/63/512 | bc`
echo CYLINDERS - $CYLINDERS
{echo ,9,0x0C,*echo ,,,-} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
sleep 1
if [ -b ${DRIVE}1 ]; then
umount ${DRIVE}1
mkfs.vfat -F 32 -n "boot" ${DRIVE}1else
if [ -b ${DRIVE}p1 ]; then
umount ${DRIVE}p1
mkfs.vfat -F 32 -n "boot" ${DRIVE}p1
else
echo "Cant find boot partition in /dev"
fifi
if [ -b ${DRIVE}2 ]; then
umount ${DRIVE}2
mke2fs -j -L "rootfs" ${DRIVE}2else
if [ -b ${DRIVE}p2 ]; then
umount ${DRIVE}p2
mke2fs -j -L "rootfs" ${DRIVE}p2
else
echo "Cant find rootfs partition in /dev"
Fi
fi
3.執行命令 sudo ./mkcard.sh /dev/sdf
4.定義SD卡內容
4.1
Command (m for help): x
Expert command (m for help): h
Number of heads (1-256, default 30): 255
Expert command (m for help): s
Number of sectors (1-63, default 29): 63
Warning: setting sector offset for DOS compatiblity
Expert command (m for help): c
Number of cylinders (1-1048576, default 2286): <new_cylinders calculated from above>
4.2定義SD卡的分區
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-123, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-123, default 123): +64M (see note above)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (10-123, default 10):
Using default value 10
Last cylinder or +size or +sizeM or +sizeK (10-123, default 123):
Using default value 123
4.3 FAT 32 分區定義
Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))
* You have to format 1st partitions with vfat32 filesystem.
Command (m for help): a
Partition number (1-4): 1
4.4檢查分區的列表信息
Command (m for help): p
Disk /dev/sdf: 993 MB, 993001472 bytes
255 heads, 63 sectors/track, 120 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdc1 * 1 9 72261 c W95 FAT32 (LBA)
/dev/sdc2 10 120 891607+ 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.
4.5格式化分區爲boot 和rootfs兩部分
# sudo mkfs.vfat -F 32 -n boot /dev/sdf1
# sudo mkfs.ext3 -L rootfs /dev/sdf2
5更詳細的步驟可見:http://omappedia.org/wiki/Minimal-FS_SD_Configuration