Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1306949
  • 博文数量: 478
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 4833
  • 用 户 组: 普通用户
  • 注册时间: 2014-06-28 11:12
文章分类

全部博文(478)

文章存档

2019年(1)

2018年(27)

2017年(21)

2016年(171)

2015年(258)

我的朋友

分类: Android平台

2015-12-10 12:56:34

写在前面:若能直译,不会意译,意译不成,为了选择不误导他人也会漏译无伤大雅的部分,英语是硬伤,如果有误译,请路过的朋友帮忙指正,以免误导更多的朋友。


    Recovery系统包含了很多钩子程序,因此OAT更新除了可以更新Android系统也可以更新设备的其他部分。(如基带、无线电处理器)。

分区映射

   从Android2.3起,平台开始支持eMMC存储设备和ext4文件系统。它同样支持MTD设备和yaffs2文件系统。

    分区映射文件TARGET_RECOVERY_FSTAB一般会被recovery二进制程序和打包工具所使用,我们可以在BoardConfig.mk文件中配置映射文件的文件名为TARGET_RECOVERY_FSTAB

下面是一个简单的分区映射文件结构。

device/yoyodyne/tardis/recovery.fstab

# mount point       fstype       device                                [device2]                                                         [options (3.0+ only)]
/sdcard                  vfat            /dev/block/mmcblk0p1   /dev/block/mmcblk0
/cache                   yaffs2        cache
/misc                     m td           misc
/boot                      mtd            boot
/recovery               emmc        /dev/block/platform/s3c-sdhci.0/by-name/recovery
/system                 ext4            /dev/block/platform/s3c-sdhci.0/by-name/system length=-4096
/data                      ext4            /dev/block/platform/s3c-sdhci.0/by-name/userdata

    在上面的分区映射文件中,/sdcard是个例外,因为在这里它是可选的。除了/sdcard,例子中所有的挂载点必须被定义。这例子中我们看到有五种文件系统类型,如下:

yaffs2

    YAFFSYet Another Flash File System)是由Aleph One公司所发展出来的NAND flash 嵌入式文件系统。 因此yaffs2文件系统只能使用在MTD存储设备上。 "device" 必须是MTD分区的名字。而且必须在/proc/mtd中配置。

mtd

    一个原始的mtd分区常被用于bootale分区,如boot分区和recovery分区。mtd不一定被挂载,但是挂载点常被用于一个key来查找分区。 "device" 必须是mtd分区的名字。而且必须在/proc/mtd中配置。

ext4

    ext4文件系统常备用于emmc存储设备。“device”必须是块设备的路径。

emmc

    一个原始的eMMC块设备,常常被用于bootable分区如boot分区和recovery分区,因此比较与mtd类型比较类似。eMMC从来没有被挂载,但是挂载点eMMc 习惯被用来在分区表中查找设备。

vfat

    Vfat是一个FAT文件系统,被用于块设备中。这里通常指外设存储设备如SD卡。Device是块设备,device2是第二个块设备。如果第一个块设备挂在失败的情况下,会选择挂在第二个块设备。

所有的分区必须被挂载在根目录下。(例如挂载点的值必须是以斜线开始,而不能再有多余的斜线。这条原则仅仅应用于recovery中。主系统可以自由挂载在任何地方。 /boot, /recovery, /misc 目录必须是原始类型,(如:mtdemmc),  /system, /data, /cache, /sdcard (如果可用应该是文件系统类型 如(yaffs2, ext4, 或 vfat).

Android3.0版本开始recovery.fastb文件增加了一个扩展项。一般仅仅用来指定分区的长度。


原文如下:


The recovery system includes several hooks for inserting device-specific code so that OTA updates can also update parts of the device other than the Android system (e.g., the baseband or radio processor).

The following sections and examples customize the tardis device produced by the yoyodyne vendor.

Partition map


As of Android 2.3, the platform supports eMMC flash devices and the ext4 filesystem that runs on those devices. It also supports Memory Technology Device (MTD) flash devices and the yaffs2 filesystem from older releases.

The partition map file is specified by TARGET_RECOVERY_FSTAB; this file is used by both the recovery binary and the package-building tools. You can specify the name of the map file in TARGET_RECOVERY_FSTAB in BoardConfig.mk.

A sample partition map file might look like this:

device/yoyodyne/tardis/recovery.fstab

# mount point       fstype  device       [device2]        [options (3.0+ only)] /sdcard     vfat    /dev/block/mmcblk0p1 /dev/block/mmcblk0 /cache      yaffs2  cache /misc       mtd misc /boot       mtd boot /recovery   emmc    /dev/block/platform/s3c-sdhci.0/by-name/recovery /system     ext4    /dev/block/platform/s3c-sdhci.0/by-name/system length=-4096 /data       ext4    /dev/block/platform/s3c-sdhci.0/by-name/userdata

With the exception of /sdcard, which is optional, all mount points in this example must be defined (devices may also add extra partitions). There are five supported filesystem types:

yaffs2 A yaffs2 filesystem atop an MTD flash device. "device" must be the name of the MTD partition and must appear in /proc/mtd. mtd A raw MTD partition, used for bootable partitions such as boot and recovery. MTD is not actually mounted, but the mount point is used as a key to locate the partition. "device" must be the name of the MTD partition in/proc/mtd. ext4 An ext4 filesystem atop an eMMC flash device. "device" must be the path of the block device. emmc A raw eMMC block device, used for bootable partitions such as boot and recovery. Similar to the mtd type, eMMc is never actually mounted, but the mount point string is used to locate the device in the table. vfat A FAT filesystem atop a block device, typically for external storage such as an SD card. The device is the block device; device2 is a second block device the system attempts to mount if mounting the primary device fails (for compatibility with SD cards which may or may not be formatted with a partition table).

All partitions must be mounted in the root directory (i.e. the mount point value must begin with a slash and have no other slashes). This restriction applies only to mounting filesystems in recovery; the main system is free to mount them anywhere. The directories /boot, /recovery, and /misc should be raw types (mtd or emmc), while the directories /system, /data, /cache, and /sdcard (if available) should be filesystem types (yaffs2, ext4, or vfat).

Starting in Android 3.0, the recovery.fstab file gains an additional optional field, options. Currently the only defined option is length , which lets you explicitly specify the length of the partition. This length is used when reformatting the partition (e.g., for the userdata partition during a data wipe/factory reset operation, or for the system partition during installation of a full OTA package). If the length value is negative, then the size to format is taken by adding the length value to the true partition size. For instance, setting "length=-16384" means the last 16k of that partition will not be overwritten when that partition is reformatted. This supports features such as encryption of the userdata partition (where encryption metadata is stored at the end of the partition that should not be overwritten).

Note: The device2 and options fields are optional, creating ambiguity in parsing. If the entry in the fourth field on the line begins with a ‘/' character, it is considered a device2 entry; if the entry does not begin with a ‘/' character, it is considered an options field.


阅读(992) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~