How to Make 3 Partition SD Card 中文手册
2012-09-14 16:32
323 查看
How to Make 3 Partition SD Card
/******************************************************************* author: 卢浩
* time: 2012.09.12
* environment: ubuntu10.04LTS +TI AM3359
* kernel version: linux-3.2
* QQ Group For Technology Exchange:122879839
******************************************************************/
首先在linux主机上建立一个文件,命名为mk3PartSDCard,把下面段代码复制进去并保存
#! /bin/sh
# mk3PartSDCard.sh v0.3
# Licensed under terms of GPLv2
DRIVE=$1
dd if=/dev/zero of=$DRIVE bs=1024 count=1024
SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'`
echo DISK SIZE - $SIZE bytes
CYLINDERS=`echo $SIZE/255/63/512 | bc`
sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE << EOF
,9,0x0C,*
10,115,,-
126,,,-
EOF
mkfs.vfat -F 32 -n "boot" ${DRIVE}1
umount ${DRIVE}1
mkfs.ext3 -L "rootfs" ${DRIVE}2
umount ${DRIVE}2
mkfs.ext3 -L "START_HERE" ${DRIVE}3
插上你的SD卡,并且让linux主机识别到改变文件的可执行属性
user@UbuntuVbox1004:~$chmod 755 mk3PartSDCard
在命令终端输入df -hT来显示挂载分区情况
![](http://img.my.csdn.net/uploads/201209/13/1347504696_6457.jpg)
执行这个脚本之前请umount你的SD卡
user@Ubuntu1004:~$umount /dev/sdb1然后执行这个脚本
user@Ubuntu1004:~$sudo ./mk3PartSDCard /dev/sdb然后你会看到
user@UbuntuVbox1004:~$ sudo ./mk3PartSD /dev/sdb
[sudo] password for user:
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB) copied, 1.53109 s, 685 kB/s
Disk /dev/sdb doesn't contain a valid partition table
DISK SIZE - 1977614336 bytes
Checking that no-one is using this disk right now ...
OK
Disk /dev/sdb: 240 cylinders, 255 heads, 63 sectors/track
sfdisk: ERROR: sector 0 does not have an msdos signature
/dev/sdb: unrecognized partition table type
Old situation:
No partitions found
New situation:
Units = cylinders of 8225280 bytes, blocks of 1024 bytes,counting from 0
Device
Boot Start End #cyls #blocks Id System
/dev/sdb1 * 0+ 8 9- 72261 cW95 FAT32 (LBA)
/dev/sdb2 10 124 115 923737+ 83 Linux
/dev/sdb3 126 239 114 915705 83 Linux
/dev/sdb4 0 - 0 0 0 Empty
Successfully wrote the new partition table
Re-reading the partition table ...
If you created or changed a DOS partition, /dev/foo7, say,then use dd(1)
to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7bs=512 count=1
(See fdisk(8).)
mkfs.vfat 3.0.7 (24 Dec 2009)
umount: /dev/sdb1: not mounted
mke2fs 1.41.11 (14-Mar-2010)
Filesystem label=rootfs
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
57856 inodes, 230934 blocks
11546 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=239075328
8 block groups
32768 blocks per group, 32768 fragments per group
7232 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information:done
This filesystem will be automatically checked every 20 mountsor
180 days, whichever comes first. Use tune2fs -c or -i tooverride.
umount: /dev/sdb2: not mounted
mke2fs 1.41.11 (14-Mar-2010)
Filesystem label=START_HERE
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
57232 inodes, 228926 blocks
11446 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=234881024
7 block groups
32768 blocks per group, 32768 fragments per group
8176 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information:done
This filesystem will be automatically checked every 27 mountsor
180 days, whichever comes first. Use tune2fs -c or -i tooverride.
然后输入这些
user@Ubuntu1004:~$ umount /dev/sdb1
user@Ubuntu1004:~$ umount /dev/sdb2
user@Ubuntu1004:~$ umount /dev/sdb3
再输入df -hT查看分区情况
![](http://img.my.csdn.net/uploads/201209/13/1347504709_9537.jpg)
记住第一个分区/media/boot用来存放MLO uboot.bin uImage
第二个分区/media/rootfs用来存放你的文件系统
相关文章推荐
- How to Make 3 Partition SD Card
- How to make SD Card world wide writable
- [GUIDE] How to make a nandroid backup directly to your computer without using sdcard
- How to make SD Card world wide writable
- Dig HOWTO 中文手册--dig命令使用大全
- raspi-config Expand root partition to fill SD card 原理
- For image 20130513, how to backup NAND to SD, and make SD bootable?
- How to create and use SDCard image for Android emulator
- How to Flash an SD Card for Raspberry Pi
- How to burn raspberry pi image to SD card on ubuntu
- How to Recover an SD Card With Linux
- Dig HOWTO 中文手册--dig命令使用大全
- How to Recover an SD Card With Linux
- EvenBus3.0 中文翻译(-)How to get started with EventBus in 3 steps
- Construct2—How to make a Platform game
- [LINUX LIVE USB]How to Make a bootable USB Drive to Install Fedora instead of using a physical DVD
- How to Make a VR Game With Unity and Google Cardboard
- How to Make a Bochs Disk Image
- raywenderlich-Rotating Turrets: How To Make A Simple iPhone Game with Cocos2D Part 2
- How to make Captcha in unigui?