【A10】Nand Flash空间新增一个共享分区方法



首先,这里说的共享分区指的是可以Share到PC,也就是Android平台接到PC时,可以在Nand分区和PC相互拷贝资料。

需要指出的是,在目前全志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="http://schemas.android.com/apk/res/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空间新增一个共享分区方法就讲完了!
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
提供的源码资源涵盖了安卓应用、小程序、Python应用和Java应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值