WO2015154385A1 - 一种实现ota升级的方法和终端 - Google Patents

一种实现ota升级的方法和终端 Download PDF

Info

Publication number
WO2015154385A1
WO2015154385A1 PCT/CN2014/086870 CN2014086870W WO2015154385A1 WO 2015154385 A1 WO2015154385 A1 WO 2015154385A1 CN 2014086870 W CN2014086870 W CN 2014086870W WO 2015154385 A1 WO2015154385 A1 WO 2015154385A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
upgrade
data block
differential
system image
Prior art date
Application number
PCT/CN2014/086870
Other languages
English (en)
French (fr)
Inventor
宋沈阳
双丹
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Priority to US15/501,925 priority Critical patent/US10203951B2/en
Priority to EP14889157.5A priority patent/EP3179366A4/en
Publication of WO2015154385A1 publication Critical patent/WO2015154385A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/658Incremental updates; Differential updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • G06F3/0619Improving the reliability of storage systems in relation to data integrity, e.g. data losses, bit errors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0659Command handling arrangements, e.g. command buffers, queues, command scheduling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/067Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11CSTATIC STORES
    • G11C16/00Erasable programmable read-only memories
    • G11C16/02Erasable programmable read-only memories electrically programmable
    • G11C16/06Auxiliary circuits, e.g. for writing into memory
    • G11C16/10Programming or data input circuits
    • G11C16/102External programming circuits, e.g. EPROM programmers; In-circuit programming or reprogramming; EPROM emulators
    • G11C16/105Circuits or methods for updating contents of nonvolatile memory, especially with 'security' features to ensure reliable replacement, i.e. preventing that old data is lost before new data is reliably written

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a method and a terminal for implementing an over-the-air (OTA) upgrade.
  • OTA over-the-air
  • the upgrade method is to compare the difference of the corresponding files in the system in the production process, calculate corresponding differential data, and package the package into an OTA upgrade package; On the mobile phone side, upgrade the corresponding files in the system to the new version through the upgrade package to achieve the purpose of the entire system upgrade.
  • the problem with this mechanism is that although the content of the system file after the upgrade remains the same as the new version, the modification method is different due to the modification order of each specific file in the upgrade process, so that from a system level perspective, the file The system's metadata has been modified, so when this method works with Android's system integrity check, it will cause the system image verification to fail after the upgrade. Therefore, how to achieve both OTA upgrade and system image verification mechanism becomes a technical problem that needs to be solved.
  • the embodiment of the invention provides a method and a terminal for implementing an OTA upgrade, so as to at least solve the problem that the OTA upgrade technology in the related art cannot be compatible with the system image verification mechanism.
  • a method for implementing an OTA upgrade in which a system image file of a terminal to be upgraded is stored in the form of a data block; specifically, the method includes:
  • the data block corresponding to each differential upgrade file is read from the system image file, and the corresponding data block is upgraded to implement the upgrade of the system image file.
  • the file header of the differential upgrade file includes an offset field indicating that the data block corresponding to the differential upgrade file is in the system image file, and is used to indicate the data block size. Size field;
  • the data block corresponding to each differential upgrade file is read from the system image file, and specifically includes:
  • Data blocks corresponding to the differential upgrade files are read in the system image file according to the offset field and the Size field in each differential upgrade file header.
  • the file header of the differential upgrade file further includes a magic string field for determining whether the differential upgrade file is valid
  • the method further includes: when obtaining each differential upgrade file facing the system image file, detecting the validity of each differential upgrade file according to the magic string field of each differential upgrade file, and triggering when each differential upgrade file is valid. Read the operation of the corresponding data block.
  • the upgrading the corresponding data block to implement the upgrade of the system image file includes:
  • the upgraded data block is written to the terminal device to be upgraded to upgrade the system image file.
  • the data block corresponding to each differential upgrade file is read from the system image file, and the corresponding data block is upgraded, which specifically includes:
  • each processing process retrieves the corresponding differential upgrade file, and reads the data block corresponding to the differential upgrade file from the system image file to perform the upgrade operation, A concurrent upgrade of each data block to be upgraded is implemented.
  • a terminal for implementing an OAT upgrade is provided.
  • the system image file in the terminal is stored in the form of a data block.
  • the terminal specifically includes:
  • the information acquisition module is configured to acquire and parse the OTA upgrade package, and obtain each differential upgrade file for the system image file;
  • the upgrade module is configured to read the data block corresponding to each differential upgrade file from the system image file, and perform an upgrade operation on the corresponding data block to implement the upgrade of the system image file.
  • the file header of the differential upgrade file includes an offset field indicating that the data block corresponding to the differential upgrade file is in the system image file, and is used to indicate the data block size. Size field;
  • the upgrade module is configured to read, according to the offset field and the Size field in each differential upgrade file header, a data block corresponding to each differential upgrade file in the system image file.
  • the file header of the differential upgrade file further includes a magic string field for determining whether the differential upgrade file is valid
  • the information acquiring module is further configured to: when the information obtaining module obtains each differential upgrade file facing the system image file, check the validity of each differential upgrade file according to the magic string field of each differential upgrade file, and The upgrade module is triggered when each differential upgrade file is valid.
  • the upgrade module is configured to read a data block corresponding to each differential upgrade file into a memory, and apply each differential upgrade file patch to a corresponding one for each data block in the memory.
  • the upgraded data block is written to the terminal device to upgrade the system image file.
  • the upgrade module is further configured to invoke a system function, and respectively create a processing process for each differential upgrade file, and use each processing process to retrieve a corresponding differential upgrade file, and
  • the data block corresponding to the corresponding differential upgrade file is read and upgraded in the system image file to implement concurrent upgrade of each data block to be upgraded.
  • the present invention uses the split system image file as the differential comparison data instead of the file system file, so that the file system metadata is also included in the differential data package, and the upgrade process does not modify the file system element.
  • the data in the terminal is completely consistent with the image in the production process, and does not conflict with the system verification mechanism.
  • the effective combination of the OTA upgrade mechanism and the system image verification mechanism is implemented.
  • the OTA upgrade used in the present invention can implement concurrent upgrade of the system image, which greatly improves the upgrade efficiency.
  • FIG. 1 is a schematic diagram of an OTA upgrade mechanism of an Android platform in the prior art
  • FIG. 2 is a flowchart of a method for implementing an OTA upgrade according to an embodiment of the present invention
  • FIG. 3 is a structural diagram of a differential upgrade file in an OTA upgrade package according to an embodiment of the present invention.
  • FIG. 4 is still another flowchart of a method for implementing an OTA upgrade according to an embodiment of the present invention
  • FIG. 5 is a schematic diagram of an OTA upgrade mechanism according to an embodiment of the present invention.
  • FIG. 6 is a structural block diagram of a terminal for implementing an OTA upgrade according to an embodiment of the present invention.
  • the present invention provides a method and a terminal for implementing an OTA upgrade, which is an effective and feasible Android platform OTA upgrade mode for a block device. It can effectively combine the OTA upgrade mechanism of the Android system with the system check mechanism.
  • An embodiment of the present invention provides a method for implementing an OTA upgrade, in which a system image file of a terminal to be upgraded is stored in the form of a data block. Specifically, as shown in FIG. 2, the method includes:
  • Step S201 obtaining and parsing an OTA upgrade package, and obtaining each differential upgrade file facing the system image file;
  • the file header of the differential upgrade file includes at least an offset field indicating that the data block corresponding to the differential upgrade file is in the system image file, and a Size field indicating the data block size.
  • the file header of the differential upgrade file further includes a magic string field used to determine whether the differential upgrade file is valid;
  • step S202 the data block corresponding to each differential upgrade file is read from the system image file, and the corresponding data block is upgraded to implement the upgrade of the system image file.
  • the data block corresponding to each differential upgrade file is read from the system image file, and specifically includes:
  • Data blocks corresponding to the differential upgrade files are read in the system image file according to the offset field and the Size field in each differential upgrade file header.
  • upgrading operation on the corresponding data block is preferably implemented as follows:
  • the data block is read into the memory for upgrade.
  • the unfinished upgrade operation in the memory can be completed, ensuring the continuity of the upgrade.
  • the method in the embodiment of the present invention may further perform concurrent upgrade for the entire system image by using a multi-thread mode, and the specific performance is as follows:
  • each processing process retrieves the corresponding differential upgrade file, and reads the data block corresponding to the differential upgrade file from the system image file to perform the upgrade operation, A concurrent upgrade of each data block to be upgraded is implemented.
  • the method in this embodiment uses the split system image file as the differential comparison data instead of using the files in the file system, so that the metadata of the file system is also included in the differential data package, and the upgrade is performed.
  • the process does not modify the metadata of the file system.
  • the image in the terminal is the same as that in the production process. It does not conflict with the system verification mechanism.
  • the OTA upgrade mechanism and the system image verification mechanism are effectively combined.
  • differential upgrade files for the system image are included in the OTA upgrade package.
  • These differential upgrade files are block-oriented devices in units of fixed-size data blocks.
  • the OTA upgrade package includes a patch/system/ directory, which contains differential upgrade files of all system images, and each differential upgrade file corresponds to a separate data block under the system image.
  • the upgrade program running in the terminal system first parses each individual differential upgrade file in the upgrade package.
  • the offset of the differential upgrade file corresponding to the original data in the system image and the size of the data block are recorded in the file header of each differential upgrade file. As shown in FIG. 3, the structure of the differential upgrade file header is shown.
  • IMGDIFF1 field This field is a magic string defined by the Android system to determine the validity of the differential upgrade file.
  • Offset field is a newly added field of the present invention, and this field records the offset of the original data block corresponding to the differential upgrade file in the system image;
  • the starting offset of the Nth data block is 8M*(N-1);
  • Size field is a newly added field by the present invention, this field records the size of the original data block. The value of this field is added during the OTA upgrade package creation process.
  • Chunk count Defined by the Android system to determine the number of specific differential data chunks.
  • Step 1 The OTA upgrade program running on the terminal first reads each differential upgrade file in the upgrade package first.
  • Step 2 For each differential upgrade file, the OTA upgrade program will first check its validity.
  • Step 3 If the differential upgrade file is valid, the OTA upgrade program creates a process using the fork system call under linux, sets the process to process the differential upgrade file, and then attempts to read the next differential upgrade file.
  • Step 4 For each differential upgrade file processing process, it first parses the differential upgrade file header, and parses the offset and size fields of the data block corresponding to the differential upgrade file.
  • Step 5 Read the corresponding data block from the system image to the memory according to the offset and size fields in step 4.
  • Step 6 Apply a differential patch to the data block for the data block in the memory.
  • Step 7 After the updated data block is written to the physical device of the terminal, the process exits.
  • the upgrade of the above mechanism is to apply all the differential upgrade files to the corresponding data blocks of the old system image to achieve the effect of upgrading the entire system image, as shown in Figure 5.
  • the entire system upgrade process is a concurrent operation for the system image. After all the upgrade processes are completed, the entire system will be upgraded to the new target state.
  • the embodiment of the invention provides a terminal for implementing OAT upgrade, and the system image file in the terminal is stored in the form of a data block.
  • the terminal specifically includes:
  • the information obtaining module 610 is configured to obtain and parse the OTA upgrade package, and obtain each differential upgrade file that is oriented to the system image file.
  • the upgrade module 620 is configured to read the data block corresponding to each differential upgrade file from the system image file, and perform an upgrade operation on the corresponding data block to implement the upgrade of the system image file.
  • the file header of the differential upgrade file includes an offset field for indicating a data block corresponding to the differential upgrade file in the system image file, and a Size field for indicating a data block size.
  • the upgrade module 620 is configured to read, according to an offset field and a Size field in each differential upgrade file header, a data block corresponding to each differential upgrade file in the system image file.
  • the file header of the differential upgrade file further includes a magic string field for determining whether the differential upgrade file is valid
  • the information acquiring module 610 is further configured to: when each differential upgrade file facing the system image file is obtained, detect the validity of each differential upgrade file according to the magic string field of each differential upgrade file, and When the differential upgrade file is valid, the upgrade module 620 is triggered.
  • the present invention also provides an upgrade optimization scheme, specifically:
  • the upgrade module 620 is configured to read the data blocks corresponding to the differential upgrade files into the memory, apply the differential upgrade file patches to the corresponding data blocks, and write the upgraded data blocks to each data block in the memory.
  • the terminal device implements the upgrade of the system image file.
  • the preferred solution reads the data block into the memory for upgrade. In this mode, even if the terminal suddenly loses power or crashes, the unfinished upgrade operation in the memory can be completed as long as the terminal is restarted, thereby ensuring the continuity of the upgrade.
  • the embodiment of the present invention can also perform concurrent upgrade for the entire system image by using the multi-thread mode, and the specific performance is as follows:
  • the upgrade module 620 is configured to invoke a system function, and respectively create a processing process for each differential upgrade file, and use each processing process to retrieve a corresponding differential upgrade file, and read corresponding to the corresponding differential upgrade file from the system image file.
  • the data block is upgraded to implement concurrent upgrade of each data block to be upgraded.
  • the terminal in this embodiment uses the split system image file as the differential comparison data instead of using the files in the file system, so that the metadata of the file system is also included in the differential data package, and the upgrade process is performed.
  • the metadata of the file system is not modified.
  • the image in the terminal is the same as that in the production process. It does not conflict with the system verification mechanism.
  • the OTA upgrade mechanism and the system image verification mechanism are effectively combined.
  • a method and a terminal for implementing an OTA upgrade provided by an embodiment of the present invention have the following beneficial effects: using a split system image file as differential comparison data instead of using a file system file, such a file system Metadata is also included in the differential data package.
  • the upgrade process does not modify the metadata of the file system.
  • the image in the terminal after the upgrade is identical to the image in the production process. It does not conflict with the system verification mechanism and implements the OTA upgrade.
  • the effective combination of the mechanism and the system image verification mechanism; in addition, the OTA upgrade can achieve concurrent upgrade of the system image, greatly improving the upgrade efficiency.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明公开了一种实现OTA升级的方法和终端,所述方法中,待升级终端的系统镜像文件以数据块的形式存储;具体地,所述方法包括:获取并解析OTA升级包,得到面向于系统镜像文件的各差分升级文件;从系统镜像文件中读取与各差分升级文件对应的数据块,对相应的数据块进行升级操作,以实现对系统镜像文件的升级。本发明使用拆分后的系统镜像文件作为差分比较的数据而不是使用文件系统中的文件,这样文件系统的元数据也被包含在差分数据包中,升级过程不会修改文件系统的元数据,升级后终端中的镜像与生产过程中的镜像完全一致,不会与系统校验机制冲突,实现了OTA升级机制与系统镜像校验机制的有效结合。

Description

一种实现OTA升级的方法和终端 技术领域
本发明涉及通信技术领域,尤其涉及一种实现空中下载技术(Over The Air,简称为OTA)升级的方法和终端。
背景技术
随着智能手机愈来愈广泛的普及,人们对智能手机的要求也越来越高,尤其是手机的信息安全更是备受重视。系统开发者以及设备制造商也在从各个方面尝试加强手机的安全性。安卓(Android)智能手机系统开发商谷歌(Google)在最新版本中推出了系统镜像完整性校验功能,该功能通过每次开机对系统镜像进行完整性校验的方法确保其没有被攻击者进行恶意篡改,但是这一机制不能与目前Android系统广泛应用的OTA升级机制兼容工作。具体地,Android智能平台目前广泛应用OTA升级机制原理如图1所示,该升级方法是通过在生产过程中比较系统中对应文件的差别,计算出相应的差分数据,打包成OTA升级包;然后在手机侧通过该升级包将系统中对应文件升级至新版本,达到整个系统升级的目的。
然后,该机制的问题是,虽然升级后系统文件的内容保持与新版本一致,但是由于升级过程中每个具体文件的修改顺序,修改方法都不同,所以导致从系统层面的角度上看,文件系统的元数据被修改了,所以当这种方式与Android的系统完整性校验一起工作的时候,就会导致升级后系统镜像校验失败。所以,如何既可以实现OTA升级,又可以兼容系统镜像校验机制,成为目前亟待解决的技术问题。
发明内容
本发明实施例提供了一种实现OTA升级的方法和终端,以至少解决相关技术中的OTA升级技术无法兼容系统镜像校验机制的问题。
依据本发明的一个方面,提供一种实现OTA升级的方法,所述方法中,待升级终端的系统镜像文件以数据块的形式存储;具体地,所述方法包括:
获取并解析OTA升级包,得到面向于系统镜像文件的各差分升级文件;
从系统镜像文件中读取与各差分升级文件对应的数据块,对相应的数据块进行升级操作,以实现对系统镜像文件的升级。
可选地,本发明所述方法中,所述差分升级文件的文件头中包含有用以指示该差分升级文件对应的数据块在系统镜像文件中的偏移量字段、以及用以指示数据块大小的Size字段;
所述从系统镜像文件中读取与各差分升级文件对应的数据块,具体包括:
根据各差分升级文件头中的偏移量字段和Size字段,在所述系统镜像文件中读取与各差分升级文件对应的数据块。
可选地,本发明所述方法中,所述差分升级文件的文件头中还包括用以判定差分升级文件是否有效的魔术字符串字段;
所述方法还包括:当得到面向于系统镜像文件的各差分升级文件时,根据各差分升级文件的魔术字符串字段,检测各差分升级文件的有效性,并在各差分升级文件有效时,触发读取对应数据块的操作。
可选地,本发明所述方法中,所述对相应的数据块进行升级操作,以实现对系统镜像文件的升级,具体包括:
将与各差分升级文件对应的数据块读入内存;
针对内存中的各数据块,将各差分升级文件补丁应用到对应的数据块中;
将升级后的数据块写入待升级终端设备,实现对系统镜像文件的升级。
可选地,本发明所述方法中,所述从系统镜像文件中读取与各差分升级文件对应的数据块,对相应的数据块进行升级操作,具体包括:
调用系统函数,为每个差分升级文件分别创建一个处理进程,每个处理进程调取对应的差分升级文件,并从系统镜像文件中读取与该差分升级文件对应的数据块进行升级操作,以实现对各待升级数据块的并发升级。
依据本发明的另一个方面,提供一种实现OAT升级的终端,所述终端中的系统镜像文件以数据块的形式存储;所述终端具体包括:
信息获取模块,设置为获取并解析OTA升级包,得到面向于系统镜像文件的各差分升级文件;
升级模块,设置为从系统镜像文件中读取与各差分升级文件对应的数据块,对相应的数据块进行升级操作,以实现对系统镜像文件的升级。
可选地,本发明所述终端中,所述差分升级文件的文件头中包含有用以指示该差分升级文件对应的数据块在系统镜像文件中的偏移量字段、以及用以指示数据块大小的Size字段;
所述升级模块,设置为根据各差分升级文件头中的偏移量字段和Size字段,在所述系统镜像文件中读取与各差分升级文件对应的数据块。
可选地,本发明所述终端中,所述差分升级文件的文件头中还包括用以判定差分升级文件是否有效的魔术字符串字段;
所述信息获取模块,还设置为当所述信息获取模块得到面向于系统镜像文件的各差分升级文件时,根据各差分升级文件的魔术字符串字段,检测各差分升级文件的有效性,并在各差分升级文件有效时,触发所述升级模块。
可选地,本发明所述终端中,所述升级模块,设置为将与各差分升级文件对应的数据块读入内存,针对内存中的各数据块,将各差分升级文件补丁应用到对应的数据块中,将升级后的数据块写入终端设备,实现对系统镜像文件的升级。
可选地,本发明所述终端中,所述升级模块,进一步设置为调用系统函数,为每个差分升级文件分别创建一个处理进程,利用每个处理进程调取对应的差分升级文件,并从系统镜像文件中读取与对应差分升级文件对应的数据块进行升级操作,以实现对各待升级数据块的并发升级。
本发明有益效果如下:
首先,本发明使用拆分后的系统镜像文件作为差分比较的数据而不是使用文件系统中的文件,这样文件系统的元数据也被包含在差分数据包中,升级过程不会修改文件系统的元数据,升级后终端中的镜像与生产过程中的镜像完全一致,不会与系统校验机制冲突,实现了OTA升级机制与系统镜像校验机制的有效结合;
其次,本发明所使用的OTA升级可以实现对系统镜像的并发升级,极大的提高了升级效率。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为现有技术中Android平台OTA升级机制的示意图;
图2为本发明实施例提供的一种实现OTA升级的方法的流程图;
图3为本发明实施例中OTA升级包中差分升级文件的结构图;
图4为本发明实施例中提供的实现OTA升级的方法的又一流程图;
图5为本发明实施例中OTA升级机制的示意图;
图6为本发明实施例提供的一种实现OTA升级的终端的结构框图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
为了解决现有技术中OTA升级技术无法兼容系统镜像校验机制的问题,本发明提供一种实现OTA升级的方法和终端,该方法是一种有效可行的面向块设备的Android平台OTA升级方式,其能够使Android系统的OTA升级机制与系统校验机制有效的结合工作。下面就通过几个具体实施例对本发明的详细实施过程进行阐述。
实施例一
本发明实施例提供一种实现OTA升级的方法,所述方法中,待升级终端的系统镜像文件以数据块的形式存储。具体的,如图2所示,所述方法包括:
步骤S201,获取并解析OTA升级包,得到面向于系统镜像文件的各差分升级文件;
其中,差分升级文件的文件头中至少包含有用以指示该差分升级文件对应的数据块在系统镜像文件中的偏移量字段、以及用以指示数据块大小的Size字段。
可选地,差分升级文件的文件头中还包括用以判定差分升级文件是否有效的魔术字符串字段;
此时,当得到面向于系统镜像文件的各差分升级文件时,还需要根据各差分升级文件的魔术字符串字段,检测各差分升级文件的有效性,并在各差分升级文件有效时,触发步骤S202。
步骤S202,从系统镜像文件中读取与各差分升级文件对应的数据块,对相应的数据块进行升级操作,以实现对系统镜像文件的升级。
其中,从系统镜像文件中读取与各差分升级文件对应的数据块,具体包括:
根据各差分升级文件头中的偏移量字段和Size字段,在所述系统镜像文件中读取与各差分升级文件对应的数据块。
进一步地,对相应的数据块进行升级操作优选地通过如下方式实现:
(1)将与各差分升级文件对应的数据块读入内存;
(2)针对内存中的各数据块,将各差分升级文件补丁应用到对应的数据块中;
(3)将升级后的数据块写入待升级终端设备,实现对系统镜像文件的升级。
该方式将数据块读入内存进行升级,在该方式下,即使终端突然掉电或死机,只要终端重启后,均可以将内存内未完成的升级操作继续完成,保证了升级的连续性。
进一步地,本发明实施例所述方法还可以使用多线程模式针对整个系统镜像完成并发升级,具体表现为:
调用系统函数,为每个差分升级文件分别创建一个处理进程,每个处理进程调取对应的差分升级文件,并从系统镜像文件中读取与该差分升级文件对应的数据块进行升级操作,以实现对各待升级数据块的并发升级。
综上所述,本实施例所述方法使用拆分后的系统镜像文件作为差分比较的数据而不是使用文件系统中的文件,这样文件系统的元数据也被包含在差分数据包中,升级 过程不会修改文件系统的元数据,升级后终端中的镜像与生产过程中的镜像完全一致,不会与系统校验机制冲突,实现了OTA升级机制与系统镜像校验机制的有效结合。
为了更清楚的阐述本发明,下面根据图3~图5给出本发明一个较佳的实施例,并结合对实施例的描述,进一步给出本发明的技术细节,使其能够更好地说明本发明的提供的方法的具体实现过程。
本发明实施例中,OTA升级包中包含了所有针对系统镜像的差分升级文件。这些差分升级文件是面向块设备,以固定大小的数据块为单位。
具体的,OTA升级包中包含一patch/system/目录,该目录下包含了所有系统镜像的差分升级文件,每个差分升级文件对应于系统镜像下的一段独立的数据块。在升级过程中,运行在终端系统中的升级程序会首先解析出升级包中每个独立的差分升级文件。
每个差分升级文件的文件头中记录了该差分升级文件对应原始数据在系统镜像中的偏移量和数据块的大小。如图3所示,示出了差分升级文件头的结构。
对于差分升级文件头的每个字段具体解释如下:
IMGDIFF1字段:该字段是由Android系统定义的魔术字符串,用来确定该差分升级文件的有效性。
offset字段:是由本发明新增加的字段,这个字段记录该差分升级文件对应的原始数据块在系统镜像中的偏移量;
举例来说,假设每个数据块大小为8M,那么:
第一块数据块的起始偏移量为8M*0=0M;
第二块数据块的起始偏移量为8M*(2-1)=8M;
第三块数据块的起始偏移量为8M*(3-1)=16M;
第N块数据块的起始偏移量为8M*(N-1);
Size字段:是由本发明新增加的字段,这个字段记录原始数据块的大小。这个字段的数值在OTA升级包制作过程中被填加。
Chunk count:由Android系统定义,用来确定具体差分数据chunk的数目。
基于上述OTA升级包的阐述,下面给出本发明实施例实现OTA升级的具体流程进行说明,如图4所示,包括如下步骤:
步骤1,运行在终端上的OTA升级程序首先依次读取升级包中的每个差分升级文件
步骤2,针对每个差分升级文件OTA升级程序会先检测其有效性。
步骤3,如果该差分升级文件是有效的,OTA升级程序会使用linux下fork系统调用创建一个进程,设置为处理该差分升级文件,然后尝试读取下一个差分升级文件。
步骤4,对于每个差分升级文件处理进程,其首先会解析差分升级文件头,从中解析出该差分升级文件对应的数据块的offset和size字段。
步骤5,根据步骤4中的offset和size字段从系统镜像中读取相应的数据块到内存。
步骤6,针对内存中的数据块,将差分补丁应用到该数据块中
步骤7,将更新后的数据块写入终端物理设备后,该进程退出。
上述机制的升级,就是将所有差分升级文件应于到旧的系统镜像相应的数据块上,以达到对整个系统镜像进行升级的效果,如图5所示。另外,整个系统升级流程是针对系统镜像的并发操作,待所有升级进程完成后,整个系统就会被升级至新的目标状态。
实施例二
本发明实施例提供一种实现OAT升级的终端,所述终端中的系统镜像文件以数据块的形式存储。如图6所示,所述终端具体包括:
信息获取模块610,设置为获取并解析OTA升级包,得到面向于系统镜像文件的各差分升级文件;
升级模块620,设置为从系统镜像文件中读取与各差分升级文件对应的数据块,对相应的数据块进行升级操作,以实现对系统镜像文件的升级。
其中,所述差分升级文件的文件头中包含用以指示该差分升级文件对应的数据块在系统镜像文件中的偏移量字段、以及用以指示数据块大小的Size字段。
所述升级模块620,根设置为据各差分升级文件头中的偏移量字段和Size字段,在所述系统镜像文件中读取与各差分升级文件对应的数据块。
进一步地,所述差分升级文件的文件头中还包括用以判定差分升级文件是否有效的魔术字符串字段;
此时,所述信息获取模块610,还设置为当得到面向于系统镜像文件的各差分升级文件时,根据各差分升级文件的魔术字符串字段,检测各差分升级文件的有效性,并在各差分升级文件有效时,触发升级模块620。
进一步地,本发明还提供一种升级优选方案,具体地:
升级模块620,设置为将与各差分升级文件对应的数据块读入内存,针对内存中的各数据块,将各差分升级文件补丁应用到对应的数据块中,将升级后的数据块写入终端设备,实现对系统镜像文件的升级。
该优选方案将数据块读入内存进行升级,在该方式下,即使终端突然掉电或死机,只要终端重启后,均可以将内存内未完成的升级操作继续完成,保证了升级的连续性。
进一步地,本发明实施例还可以使用多线程模式针对整个系统镜像完成并发升级,具体表现为:
升级模块620,设置为调用系统函数,为每个差分升级文件分别创建一个处理进程,利用每个处理进程调取对应的差分升级文件,并从系统镜像文件中读取与对应差分升级文件对应的数据块进行升级操作,以实现对各待升级数据块的并发升级。
综上所述,本实施例所述终端使用拆分后的系统镜像文件作为差分比较的数据而不是使用文件系统中的文件,这样文件系统的元数据也被包含在差分数据包中,升级过程不会修改文件系统的元数据,升级后终端中的镜像与生产过程中的镜像完全一致,不会与系统校验机制冲突,实现了OTA升级机制与系统镜像校验机制的有效结合。
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。
工业实用性
如上所述,本发明实施例提供的一种实现OTA升级的方法和终端具有以下有益效果:使用拆分后的系统镜像文件作为差分比较的数据而不是使用文件系统中的文件,这样文件系统的元数据也被包含在差分数据包中,升级过程不会修改文件系统的元数据,升级后终端中的镜像与生产过程中的镜像完全一致,不会与系统校验机制冲突,实现了OTA升级机制与系统镜像校验机制的有效结合;此外,使用OTA升级可以实现对系统镜像的并发升级,极大的提高了升级效率。

Claims (10)

  1. 一种实现OTA升级的方法,所述方法中,待升级终端的系统镜像文件以数据块的形式存储;所述方法包括:
    获取并解析OTA升级包,得到面向于系统镜像文件的各差分升级文件;
    从系统镜像文件中读取与各差分升级文件对应的数据块,对相应的数据块进行升级操作,以实现对系统镜像文件的升级。
  2. 如权利要求1所述的方法,其中,所述差分升级文件的文件头中包含有用以指示该差分升级文件对应的数据块在系统镜像文件中的偏移量字段、以及用以指示数据块大小的Size字段;
    所述从系统镜像文件中读取与各差分升级文件对应的数据块,具体包括:
    根据各差分升级文件头中的偏移量字段和Size字段,在所述系统镜像文件中读取与各差分升级文件对应的数据块。
  3. 如权利要求2所述的方法,其中,所述差分升级文件的文件头中还包括用以判定差分升级文件是否有效的魔术字符串字段;
    所述方法还包括:当得到面向于系统镜像文件的各差分升级文件时,根据各差分升级文件的魔术字符串字段,检测各差分升级文件的有效性,并在各差分升级文件有效时,触发读取对应数据块的操作。
  4. 如权利要求1所述的方法,其中,所述对相应的数据块进行升级操作,以实现对系统镜像文件的升级包括:
    将与各差分升级文件对应的数据块读入内存;
    针对内存中的各数据块,将各差分升级文件补丁应用到对应的数据块中;
    将升级后的数据块写入待升级终端设备,实现对系统镜像文件的升级。
  5. 如权利要求1至4中任一项所述的方法,其中,所述从系统镜像文件中读取与各差分升级文件对应的数据块,对相应的数据块进行升级操作包括:
    调用系统函数,为每个差分升级文件分别创建一个处理进程,每个处理进程调取对应的差分升级文件,并从系统镜像文件中读取与该差分升级文件对应的数据块进行升级操作,以实现对各待升级数据块的并发升级。
  6. 一种实现OTA升级的终端,终端中的系统镜像文件以数据块的形式存储;所述终端包括:
    信息获取模块,设置为获取并解析OTA升级包,得到面向于系统镜像文件的各差分升级文件;
    升级模块,设置为从系统镜像文件中读取与各差分升级文件对应的数据块,对相应的数据块进行升级操作,以实现对系统镜像文件的升级。
  7. 如权利要求6所述的终端,其中,所述差分升级文件的文件头中包含有用以指示该差分升级文件对应的数据块在系统镜像文件中的偏移量字段、以及用以指示数据块大小的Size字段;
    所述升级模块,设置为根据各差分升级文件头中的偏移量字段和Size字段,在所述系统镜像文件中读取与各差分升级文件对应的数据块。
  8. 如权利要求7所述的终端,其中,所述差分升级文件的文件头中还包括用以判定差分升级文件是否有效的魔术字符串字段;
    所述信息获取模块,还设置为当得到面向于系统镜像文件的各差分升级文件时,根据各差分升级文件的魔术字符串字段,检测各差分升级文件的有效性,并在各差分升级文件有效时,触发所述升级模块。
  9. 如权利要求6所述的终端,其中,所述升级模块,设置为将与各差分升级文件对应的数据块读入内存,针对内存中的各数据块,将各差分升级文件补丁应用到对应的数据块中,将升级后的数据块写入终端设备,实现对系统镜像文件的升级。
  10. 如权利要求6至9中任一项所述的终端,其中,所述升级模块,进一步设置为调用系统函数,为每个差分升级文件分别创建一个处理进程,利用每个处理进程调取对应的差分升级文件,并从系统镜像文件中读取与对应差分升级文件对应的数据块进行升级操作,以实现对各待升级数据块的并发升级。
PCT/CN2014/086870 2014-08-06 2014-09-18 一种实现ota升级的方法和终端 WO2015154385A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US15/501,925 US10203951B2 (en) 2014-08-06 2014-09-18 Method and terminal for OTA updating
EP14889157.5A EP3179366A4 (en) 2014-08-06 2014-09-18 Method and terminal for ota updating

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410382256.3 2014-08-06
CN201410382256.3A CN105335181A (zh) 2014-08-06 2014-08-06 一种实现ota升级的方法和终端

Publications (1)

Publication Number Publication Date
WO2015154385A1 true WO2015154385A1 (zh) 2015-10-15

Family

ID=54287166

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/086870 WO2015154385A1 (zh) 2014-08-06 2014-09-18 一种实现ota升级的方法和终端

Country Status (4)

Country Link
US (1) US10203951B2 (zh)
EP (1) EP3179366A4 (zh)
CN (1) CN105335181A (zh)
WO (1) WO2015154385A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113254051A (zh) * 2021-07-12 2021-08-13 浙江华网俊业科技有限公司 多终端点对点推送方法
CN113760774A (zh) * 2021-09-28 2021-12-07 中汽创智科技有限公司 一种ota仿真测试方法、平台及系统

Families Citing this family (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9946533B2 (en) * 2015-09-30 2018-04-17 Apple Inc. Software updating
CN105872106A (zh) * 2016-06-14 2016-08-17 青岛海信移动通信技术股份有限公司 空中下载升级方法、空中下载服务器及终端
US10503703B1 (en) * 2016-06-23 2019-12-10 EMC IP Holding Company LLC Method for parallel file system upgrade in virtual storage environment
CN106250188B (zh) * 2016-07-29 2019-08-23 捷开通讯(深圳)有限公司 一种系统固件映像文件的生成方法及系统
CN107301070B (zh) * 2017-06-20 2020-09-29 福州汇思博信息技术有限公司 一种升级方法及终端
CN107688463B (zh) * 2017-09-21 2020-08-18 杭州全维技术股份有限公司 一种嵌入式设备版本文件打包的方法
CN107577563A (zh) * 2017-09-26 2018-01-12 晶晨半导体(上海)股份有限公司 一种系统升级异常断电的保护方法及终端设备
US10782904B2 (en) * 2017-09-28 2020-09-22 Intel Corporation Host computing arrangement, remote server arrangement, storage system and methods thereof
CN109672655A (zh) * 2017-10-16 2019-04-23 华为终端(东莞)有限公司 一种差分升级的方法、装置及系统
CN108170460B (zh) * 2017-12-15 2020-12-11 杭州中天微系统有限公司 一种嵌入式系统增量升级的方法及装置
CN108228215B (zh) * 2018-01-02 2021-06-01 青岛海信移动通信技术股份有限公司 终端设备的ota升级包的推送方法及装置
CN112311576B (zh) * 2019-07-31 2023-11-24 中兴通讯股份有限公司 Ota升级诊断方法、装置、无线路由设备及终端设备
CN113225729B (zh) * 2020-01-21 2022-07-12 荣耀终端有限公司 空中下载技术ota升级的方法、设备及可读存储介质
CN112217796A (zh) * 2020-09-07 2021-01-12 西安通软软件科技有限公司 一种基于加密技术的物联网模组软件升级方法
CN112286564A (zh) * 2020-10-22 2021-01-29 上海艾拉比智能科技有限公司 一种针对iot设备二进制系统文件的差分升级算法
CN112822199B (zh) * 2021-01-18 2023-04-18 吾征智能技术(北京)有限公司 一种基于协议转换的ota升级方法及系统
CN113568636A (zh) * 2021-07-08 2021-10-29 深圳市骁巨智能科技有限公司 一种智能手表ota升级系统及方法
CN113590157B (zh) * 2021-07-31 2024-04-30 重庆长安汽车股份有限公司 一种车载嵌入式ota刷写文件、刷写装置及刷写方法
CN113703821A (zh) * 2021-08-26 2021-11-26 北京百度网讯科技有限公司 云手机更新方法、装置、设备以及存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101695162A (zh) * 2009-10-22 2010-04-14 中兴通讯股份有限公司 一种移动终端空中固件升级方法及装置
CN102163155A (zh) * 2011-03-09 2011-08-24 深圳创维数字技术股份有限公司 存储设备的升级方法及升级控制装置
CN102346673A (zh) * 2010-07-27 2012-02-08 比亚迪股份有限公司 一种手机系统升级的方法及装置

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6233589B1 (en) * 1998-07-31 2001-05-15 Novell, Inc. Method and system for reflecting differences between two files
US6775423B2 (en) 2000-05-03 2004-08-10 Microsoft Corporation Systems and methods for incrementally updating an image in flash memory
US6832373B2 (en) * 2000-11-17 2004-12-14 Bitfone Corporation System and method for updating and distributing information
AU2003279086A1 (en) * 2002-09-30 2004-04-23 Insignia Solutions Plc Efficient system and method for updating a memory device
US7480907B1 (en) * 2003-01-09 2009-01-20 Hewlett-Packard Development Company, L.P. Mobile services network for update of firmware/software in mobile handsets
WO2006052946A2 (en) 2004-11-08 2006-05-18 Innopath Software, Inc. Static file system differencing and updating
JP4891902B2 (ja) * 2005-06-01 2012-03-07 パナソニック株式会社 電子機器、更新サーバ装置、鍵更新装置
CN101356519B (zh) * 2006-06-19 2011-11-09 三星电子株式会社 用于可利用空中机制的便携式设备的程序升级系统及方法
TW201102924A (en) * 2009-07-03 2011-01-16 Inventec Appliances Corp Embedded electronic device and method for updating firmware thereof
CN103207866B (zh) * 2012-01-16 2016-06-22 中国科学院声学研究所 一种基于分块策略的文件存储方法及系统
CN102693145B (zh) 2012-05-31 2015-02-25 红石阳光(北京)科技有限公司 用于嵌入式系统的差分升级方法
US9369867B2 (en) * 2012-06-29 2016-06-14 Intel Corporation Mobile platform software update with secure authentication
US9116774B2 (en) * 2013-05-14 2015-08-25 Sandisk Technologies Inc. Firmware updates for multiple product configurations

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101695162A (zh) * 2009-10-22 2010-04-14 中兴通讯股份有限公司 一种移动终端空中固件升级方法及装置
CN102346673A (zh) * 2010-07-27 2012-02-08 比亚迪股份有限公司 一种手机系统升级的方法及装置
CN102163155A (zh) * 2011-03-09 2011-08-24 深圳创维数字技术股份有限公司 存储设备的升级方法及升级控制装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3179366A4 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113254051A (zh) * 2021-07-12 2021-08-13 浙江华网俊业科技有限公司 多终端点对点推送方法
CN113760774A (zh) * 2021-09-28 2021-12-07 中汽创智科技有限公司 一种ota仿真测试方法、平台及系统
CN113760774B (zh) * 2021-09-28 2023-10-27 中汽创智科技有限公司 一种ota仿真测试方法、平台及系统

Also Published As

Publication number Publication date
US20170315800A1 (en) 2017-11-02
EP3179366A4 (en) 2017-08-16
US10203951B2 (en) 2019-02-12
EP3179366A1 (en) 2017-06-14
CN105335181A (zh) 2016-02-17

Similar Documents

Publication Publication Date Title
WO2015154385A1 (zh) 一种实现ota升级的方法和终端
CN105094903B (zh) 对固件进行升级的方法及装置
CN110058873B (zh) 应用页面更新方法、装置、设备和存储介质
US9804933B2 (en) System differential upgrade method, apparatus, and mobile terminal
CN104885055B (zh) 一种应用数据同步的方法及装置
WO2016183951A1 (zh) 一种系统升级方法及终端
US20160232374A1 (en) Permission control method and apparatus
US10176327B2 (en) Method and device for preventing application in an operating system from being uninstalled
WO2019019668A1 (zh) 应用程序启动方法、装置、计算机设备和存储介质
CN109375937A (zh) 系统升级方法、装置、终端设备及存储介质
US10757087B2 (en) Secure client authentication based on conditional provisioning of code signature
WO2016078263A1 (zh) 升级控制设备、终端、终端升级方法及系统、存储介质
WO2017076051A1 (zh) 一种获取超级用户权限的方法及装置
CN105684027A (zh) 一种房产网的房源验证方法及系统
CN108984339B (zh) 数据恢复方法及相关产品
CN113595788A (zh) 一种基于插件的api网关管理方法及装置
WO2016082450A1 (zh) 一种用户终端的升级方法和用户终端
CN105468420B (zh) 操作系统升级方法和装置
CN106293790B (zh) 基于Firefox操作系统的应用程序升级方法和装置
CN112181467B (zh) 终端的存储器固件升级方法、装置、终端和存储介质
CN108196975B (zh) 基于多校验和的数据验证方法、装置及存储介质
US10503430B2 (en) Method and device for clearing data and electronic device
CN112162783B (zh) 音乐播放应用保活处理方法、系统、存储介质及电子设备
CN104298618A (zh) 一种智能终端的命令处理方法及装置
CN105975567B (zh) 一种应用程序的内部文件的处理方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14889157

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

REEP Request for entry into the european phase

Ref document number: 2014889157

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 2014889157

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 15501925

Country of ref document: US