需要指出的是,在目前全志A10软件中,对于Nand Flash的分区总数是9个分区。
è参见文件lichee\tools\pack\chips\sun4i\configs\crane\3g\sys_config.fex
[part_num]
num = 8
;------------------------------>nanda, known as bootfs before, includes boot.axf u-boot.bin etc...
[partition0]
class_name = DISK
name = bootloader
size_hi = 0
size_lo = 16384
user_type = 0
ro = 0
;------------------------------>nandb, enviroment for u-boot
[partition1]
class_name = DISK
name = env
size_hi = 0
size_lo = 16384
user_type = 0
ro = 0
;------------------------------>nandc, kernel and ramdisk
[partition2]
class_name = DISK
name = boot
size_hi = 0
size_lo = 32768
user_type = 0
ro = 0
;------------------------------>nandd, android real rootfs
[partition3]
class_name = DISK
name = system
size_hi = 0
size_lo = 524288
user_type = 0
ro = 0
;------------------------------>nande, user data
[partition4]
class_name = DISK
name = data
size_hi = 0
size_lo = 262144
user_type = 1
ro = 0
;------------------------------>nandf, misc
[partition5]
class_name = DISK
name = misc
size_hi = 0
size_lo = 16384
user_type = 0
ro = 0
;------------------------------>nandg, for recovery
[partition6]
class_name = DISK
name = recovery
size_hi = 0
size_lo = 262144
user_type = 0
ro = 0
;------------------------------>nandh, android app cache
[partition7]
class_name = DISK
name = cache
size_hi = 0
size_lo = 131072
user_type = 0
ro = 0
为什么我们看到part_num 指定的是8,而分区总数却是9呢?
因为在上面分区划分完后,剩余空间将被分区成第9个分区UDISK(nandi),最终会被挂载到/mnt/sdcard。
那么怎么在Nand Flash空间新增一个共享分区呢?
1. 修改lichee\tools\pack\chips\sun4i\configs\crane\3g\sys_config.fex
<1>. part_num 字段(加1),num = 9
[part_num]
num = 9
<2>. 增加分区描述[patitionXX] ,其中size_lo为分区大小低32位, size_hi为分区大小高32位,分区大小以KB为单位,name为分区名,下面的描述,定义了一个大小为512MB的test分区
;------------------------------>nandi, for test (caihua.zhao)
[partition8]
class_name = DISK
name = test
size_hi = 0
size_lo = 524288
user_type = 0
ro = 0
<3>. down_num 字段(加1), down_num = 7
[down_num]
down_num = 7
<4>. 增加download描述[downloadXX]
;------------------------------>for test (caihua.zhao)
[download5]
part_name = test
pkt_name = TEST_000000000
encrypt = 0
这样的话,我们就在UDISK分区前增加了一个test分区。
如果增加test分区之前,UDISK大小是2.5GB(我平台是4GB的Nand Flash),那么,
增加test分区后,UDISK大小 = 2.5GB - 512MB = 2GB
2. 修改lichee\tools\pack\chips\sun4i\configs\crane\default\image.cfg
增加上一步download描述里pkt_name(TEST_000000000)的定义
;-->下载的分区文件
{filename = "bootloader.fex", maintype = ITEM_ROOTFSFAT16, subtype = "BOOTLOADER_00000",},
{filename = "env.fex", maintype = ITEM_ROOTFSFAT16, subtype = "ENVIROMENT_00000",},
{filename = "boot.fex", maintype = ITEM_ROOTFSFAT16, subtype = "BOOT_00000000000",},
{filename = "system.fex", maintype = ITEM_ROOTFSFAT16, subtype = "SYSTEM_000000000",},
{filename = "recovery.fex", maintype = ITEM_ROOTFSFAT16, subtype = "RECOVERY_0000000",},
;caihua.zhao add here for test partion
{filename = "diskfs.fex", maintype = ITEM_ROOTFSFAT16, subtype = "TEST_000000000",},
{filename = "diskfs.fex", maintype = ITEM_ROOTFSFAT16, subtype = "DISKFS_000000000",},
3. 修改lichee\tools\pack\chips\sun4i\configs\crane\3g\sys_config1.fex
调整usb mass storage 可以挂载的总数
;caihua.zhao modify here luns = 2 --> luns = 4
[msc_feature]
vendor_name ="USB 2.0"
product_name ="USB Flash Driver"
release = 100
luns = 4
调整之前luns = 2 , 也就是说,当设备连接PC,点击“打开USB存储设备”,系统挂载的分区需要当成USB MASS STORAGE(ums)时,最多能share两个分区。
因为A10(crane-3g)软件本身就至支持2个分区share,分别是/mnt/sdcard和/mnt/extsd。
所以,如果想将刚划分的那个test分区也能share到PC,这个luns就要加大。
4. 修改android4.0\device\softwinner\crane-3g\init.sun4i.rc
<1>. 创建挂载目录 /mnt/test
#caihua.zhao add here for test nand partition
mkdir /mnt/test 0000 system system
<2>. 格式化分区
#caihua.zhao add here for test nand partition
format_userdata /dev/block/nandi huazi
其中 huazi 为分区卷名
注意:
之前的format_userdata /dev/block/nandi crane-3g
分区序号要改成nandj,也即format_userdata /dev/block/nandj crane-3g
5. 修改android4.0\device\softwinner\crane-3g\vold.fstab
增加自动挂载
#caihua.zhao add here for partition
dev_mount test /mnt/test auto /devices/virtual/block/nandi
注意:
之前的dev_mount sdcard /mnt/sdcard auto /devices/virtual/block/nandi
分区序号要改成nandj,也即
dev_mount sdcard /mnt/sdcard auto /devices/virtual/block/nandj
6. 修改android4.0\device\softwinner\crane-3g\overlay\frameworks\base\core\res\res\xml\
storage_list.xml
增加test分区的storage属性
<StorageList xmlns:android="
<storage android:mountPoint="/mnt/sdcard"
android:storageDescription="@string/storage_internal"
android:primary="true"
android:removable="false"
android:emulated="false"
android:mtpReserve="100"
android:allowMassStorage="true"
android:maxFileSize="0"/>
<!--
caihua.zhao add here for partition test 20121120
-->
<storage android:mountPoint="/mnt/test"
android:storageDescription="@string/storage_internal"
android:primary="false"
android:removable="false"
android:emulated="false"
android:mtpReserve="0"
android:allowMassStorage="true"
android:maxFileSize="0"/>
<storage android:mountPoint="/mnt/extsd"
android:storageDescription="extsd"
android:primary="false"
android:removable="true"
android:emulated="false"
android:mtpReserve="0"
android:allowMassStorage="true"
android:maxFileSize="0"/>
<storage android:mountPoint="/mnt/usbhost1"
android:storageDescription="usbhost1"
android:primary="false"
android:removable="true"
android:emulated="false"
android:mtpReserve="0"
android:maxFileSize="0"/>
</StorageList>
如果分区要share到PC,android:allowMassStorage属性一定要设置成"true"。
以上步骤完成后,重新编译打包固件,刷机后,在uboot启动时,会发现partition信息中多了一个test分区,而且大小为0x20000000 Byte = 512M Byte
--------fastboot partitions--------
-total partitions:10-
-name- -start- -size-
bootloader : 1000000 1000000
env : 2000000 1000000
boot : 3000000 2000000
system : 5000000 20000000
data : 25000000 10000000
misc : 35000000 1000000
recovery : 36000000 10000000
cache : 46000000 8000000
test : 4e000000 20000000
UDISK : 6e000000 7f800000
-----------------------------------
起机后,进入adb控制命令行,输入命令: busybox df –h
可以看到,有一个512M的分区挂载到了/mnt/test ,当然,这就是刚划分的那个test分区
选择通知栏中的“USB 已连接 选择将文件复制到计算机或从计算机复制到存储设备”,在弹出界面里选择“打开USB存储设备”,这样的话,在storagelist.xml里,分区属性设置为
android:allowMassStorage="true"的几个分区(sdcard/test/extsd)都会share到PC。
其中,CRANE-3G (J:)是/mnt/sdcard , HUAZI (L:)是/mnt/test,可移动磁盘 (M:)为/mnt/extsd,经测试,可以在三个分区和PC间拷贝资料。
当然,根据storagelist.xml,第四个可移动磁盘将不会被用到。
因此,可以将第3步的usb mass storage挂载总数调整为3,也能满足应用!
到此的话,A10 平台Nand Flash空间新增一个共享分区方法就讲完了!