pandaboard的SD卡分区步骤

Pandaboard的启动SD卡制作流程

 目的:把4GSD卡分成boot(格式fat) 和rootfs(格式ext3)两部分

 1.插入4GSD卡,然后 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

 <dp@xora.org.uk># 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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值