OTA Updates official documentation (one, OTA upgrade)

Source: Internet
Author: User

Write in front:

Android devices can accept and install system-and app-based updates. There is a special recovery partition in the device, in which a special recovery system can decompress the downloaded update package and apply it to the system.

This section describes the organizational structure of the update package and outlines how to use the Update Package Packaging tool to make a system Upgrade update package. OTA exists to upgrade a potential system, or to install a read-only (non-unmounted) application on the system partition, so that applications that are already installed on the system will not be affected during the upgrade process.

The content of this section is based primarily on the android5.x version.

First, Androiddesign of equipment layout

Typically, flash in an Android device often contains some of the following partitions:

Boot

The boot partition contains the Linux kernel and a very small root file system (which is loaded into RAM ), used to hang the system and other partitions, and the boot partitions are also used to start The operating environment in the system partition.

System

system partitions include systems-level applications such as calls, audio and video, and some library files. These applications and library files are often open source, and we can See the relevant implementations in AOSP. Under normal circumstances (non- root) These basic applications are read-only and cannot be uninstalled. And only when the OTA is changed.

Vendor

Vendor Partitions also have some applications and library files, but these are provided by third parties, as for the open source or not, not to say, at least in the aosp is not see the source. Of course, non- root is also unable to uninstall, is the factory preset read-only application.

UserData

The UserData partition is the user's paradise, and some of the data generated by the user when using the application are stored here, such as saved contacts, SMS, etc.

Cache

The cache partition is a very small number of applications to access a partition (requires some specific permissions), usually used to save the OTA package, and some of the log files generated during the upgrade process such as Last_log and so on.

Recovery

Recovery is a special partition that has a complete Linux system in the recovery partition , which is used to read the update package and upgrade the other partitions.

Misc

Misc is a very small partition that is often used by recover partitions to hold some OTA -related information.

Second, OTAupgrade Process

The standard OTA upgrade process consists of the following steps:

The 1.Android device interacts with the OTA Server First, and if any updates are pushed to the customer. The information that is pushed often contains the OTA update package and some version information.

The 2.Update program downloads the update package to the cache partition and alerts the user to install the update.

3. The device restarts into recovery mode and starts the operating environment under the recovery partition, and no longer boots boot The operating environment under the partition.

The recovery binary is started when the 4.recovery runtime is initialized and is based on the /cache/recovery/command The next step in the update package is the command in the

The 5.Recovery operating environment verifies the signature of the /res/key in the update package , and if the validation fails, the upgrade is interrupted.

The 6.Recovery binaries decompress the data in the update package while the boot,system, and Vender are based on the extracted data The partitions are updated accordingly. Updates to the system partition also include updates for the new recovery partition.

7. Restart the device

A. Load the new boot partition and execute the binary files in the upgraded system partition.

B. When the system starts, it verifies the recovery partition at the same time, and if the information that is saved under the system partition in recovery and upgrade is inconsistent, the Recovery to update.

8. The system update is complete.

Third, android5.xwith theandroid4.0/3.0/2.3the difference.

There are many function-specific functions that have changed from android2.3/3.0/4.0 to android5.x , mainly some C The function is re-defined in C + + . The following table shows the alternation of some old and new functions.

C function

C + + method

Device_recovery_start ()

Device::recoverystart ()

Device_toggle_display ()
Device_reboot_now ()

Recoveryui::checkkey ()
(also recoveryui::iskeypressed ())

Device_handle_key ()

Device::handlemenukey ()

Device_perform_action ()

Device::invokemenuitem ()

Device_wipe_data ()

Device::wipedata ()

Device_ui_init ()

Screenrecoveryui::init ()


The following is the original: Http://source.android.com/devices/tech/ota/index.html#android-device-layout

android devices in the field can receive and install over-the-air (OTA) updates to the System and application software. Devices has a special recovery partition with the software needed to unpack a downloaded update package and apply it to T He rest of the system.

this section describes the structure of these packages and the tools provided to build them. It's intended for developers who want to make the OTA update system work on new Android devices and those who's is Buildin G update packages for use with released devices. OTA Updates is designed to upgrade the underlying operating system and the Read-only apps installed on the system Partiti On These updates do  not  affect applications installed by the user from Google Play.

This section describes the OTA system as of the Android 5.x release. For help porting ota-related code from older releases, see migrating from previous releases.

Android Device Layout

The flash space on Android device typically contains the following partitions.

Boot
Contains the Linux kernel and a minimal root filesystem (loaded into a RAM disk). It mounts system and other partitions and starts the runtime located on the system partition.
System
Contains system applications and libraries that has source code available on Android Open source Project (AOSP). During normal operation, this partition is mounted read-only; Its contents change is only during an OTA update.
Vendor
Contains system applications and libraries that does not has source code available on Android Open source Project (AOSP). During normal operation, this partition is mounted read-only; Its contents change is only during an OTA update.
UserData
Stores The data saved by applications installed by the user, etc. This partition isn't normally touched by the OTA update process.
Cache
temporary holding area used by a few applications (accessing this partition requires special app permissions) and fo R storage of downloaded OTA update packages. Other programs use this space with the expectation, which files can disappear at any time. Some OTA Package installations could result in this partition being wiped completely.
Recovery
Contains A second complete Linux system, including a kernel and the special recovery binary that reads a package and uses its contents to update the other partitions.
Misc
Tiny partition used by recovery to stash some information away on what it's doing in case the
device is restarted While the OTA package is being applied.
Life of an OTA update

A Typical OTA update contains the following steps:

  1. Device performs regular check in with OTA servers and was notified of the availability of an update, including the URL of T He update package and a description string to show the user.
  2. Update downloads to a cache or data partition, and its cryptographic signature are verified against the certificates in . User is prompted to install the update.
  3. Device reboots to recovery mode, in which the kernel and system in the recovery partition is booted instead of the Kern El in the boot partition.
  4. Recovery binary is started by init. It finds command-line arguments in that point it to the /cache/recovery/command downloaded package.
  5. Recovery verifies the cryptographic signature of the package against the public keys in (part of the /res/keys RAM disk Contai Ned in the recovery partition).
  6. Data is pulled from the package and used to update the boot, system, and/or vendor partitions as necessary. One of the new files left on the system partition contains the contents of the new recovery partition.
  7. device reboots normally.
    1. The Newly updated boot partition is loaded, and it mounts and starts executing binaries in the newly updated system partition .
    2. as part of normal startup, the system checks the contents of the recovery partition The desired contents (which were previously stored as a file In /system ). They was different, so the recovery partition was reflashed with the desired contents. (On subsequent boots, the recovery partition already contains the new contents, so no reflash is necessary.)

The system update is complete!

Migrating from Previous Releases

When migrating from Android 2.3/3.0/4.0 release, the major change was the conversion of all the device-specific Functionali Ty from a set of C functions with predefined names to C + + objects. The following table lists the old functions and the new methods that serve a roughly equivalent purpose:

C function C + + method
Device_recovery_start () Device::recoverystart ()
Device_toggle_display ()
Device_reboot_now ()
Recoveryui::checkkey ()
(also recoveryui::iskeypressed ())
Device_handle_key () Device::handlemenukey ()
Device_perform_action () Device::invokemenuitem ()
Device_wipe_data () Device::wipedata ()
Device_ui_init () Screenrecoveryui::init ()

Conversion of old functions to new methods should be reasonably straightforward. Don ' t forget to add the new make_device() function to create and return an instance of your new Device subclass.


OTA Updates official documentation (one, OTA upgrade)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.