制作SD卡启动文件系统
【1】对SD卡分区
按飞思卡尔文档列出的分区表用fdisk分区:
Partition Type/Index | Name | Start Offset | Size | File System | Content |
N/A | BOOT | 0 | 10MB | N/A | bootloader/kernel/uramdisk images |
Primary 1 | MEDIA | 10MB | User Defined | VFAT. Mount as /sdcards | Media file storage |
Primary 2 | SYSTEM | follow MEDIA | >= 200MB | EXT4. Mount as /system (with read only) | Android system bin/libs (system.img) |
Logic 5 (Extended 3) | DATA | follow SYSTEM | > 200MB | EXT4. Mount as /data | Android data (e.g. installed app) |
Logic 6 (Extended 3) | CACHE | follow DATA | > 10MB | EXT4. Mount as /cache | Android cache |
Primary 4 | RECOVERY | follow CACHE | > 20MB | EXT4. Mount as / in recovery mode | Root file system for recovery mode (recovery.img) |
To create these partitions, you can simply use MFG tool described in next section, or use fdisk utility on Linux PC.
After creating the partitions by fdisk, please format each file systems by the following commands:
hui@ubuntu:~$ sudo fdisk /dev/sdb
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
#先查看分区
Command (m for help): p
#显示有一个分区sdb1
Device Boot Start End Blocks Id System
/dev/sdb1 1 1937 15554048 c W95 FAT32 (LBA)
#删除分区
Command (m for help): d
Selected partition 1
Command (m for help): p #查看分区
.....
Device Boot Start End Blocks Id System
#可见,已经无分区存在
#开始分区
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p #选择主分区
Partition number (1-4): 1 #分第一个分区
First cylinder (1-1936, default 1): +10M #预留10兆空间
Last cylinder, +cylinders or +size{K,M,G} (1-1936, default 1936): +14000M #主分区1占14000兆空间
#分第二个主分区
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p #选择p分主分区
Partition number (1-4): 2 #分区2
First cylinder (1787-1936, default 1787):
Using default value 1787
Last cylinder, +cylinders or +size{K,M,G} (1787-1936, default 1936): +200M #主分区2占200兆空间
#分第三个分区
Command (m for help): n
Command action
e extended
p primary partition (1-4)
e #选择e分扩展分区
Partition number (1-4): 3 #分区3
First cylinder (1813-1936, default 1813):
Using default value 1813
Last cylinder, +cylinders or +size{K,M,G} (1813-1936, default 1936): +320M #分配320兆空间
#分第四个分区(主分区)
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
p #主分区类型
Selected partition 4
First cylinder (1855-1936, default 1855):
Using default value 1855
Last cylinder, +cylinders or +size{K,M,G} (1855-1936, default 1936):
Using default value 1936
#分第五个分区(扩展分区)
Command (m for help): n
First cylinder (1813-1854, default 1813):
Using default value 1813
Last cylinder, +cylinders or +size{K,M,G} (1813-1854, default 1854): +300M
#分第六个分区(扩展分区)
Command (m for help): n
First cylinder (1852-1854, default 1852):
Using default value 1852
Last cylinder, +cylinders or +size{K,M,G} (1852-1854, default 1854):
Using default value 1854
Command (m for help): p #查看分区
Disk /dev/sdb: 15.9 GB, 15931539456 bytes
255 heads, 63 sectors/track, 1936 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdb1 1 1786 14346013+ 83 Linux
/dev/sdb2 1787 1812 208845 83 Linux
/dev/sdb3 1813 1854 337365 5 Extended
/dev/sdb4 1855 1936 658665 83 Linux
/dev/sdb5 1813 1851 313236 83 Linux
/dev/sdb6 1852 1854 24066 83 Linux
Command (m for help): w #保存分区信息,退出
The partition table has been altered!
【2】分区完成后,下一步格式化:
【3】把uboot,kernel,ramdisk,system文件同步到SD卡里: