WO2018036166A1 - 一种读取升级包的方法及装置 - Google Patents

一种读取升级包的方法及装置 Download PDF

Info

Publication number
WO2018036166A1
WO2018036166A1 PCT/CN2017/079607 CN2017079607W WO2018036166A1 WO 2018036166 A1 WO2018036166 A1 WO 2018036166A1 CN 2017079607 W CN2017079607 W CN 2017079607W WO 2018036166 A1 WO2018036166 A1 WO 2018036166A1
Authority
WO
WIPO (PCT)
Prior art keywords
physical address
upgrade package
user data
upgrade
terminal
Prior art date
Application number
PCT/CN2017/079607
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 中兴通讯股份有限公司
Publication of WO2018036166A1 publication Critical patent/WO2018036166A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Definitions

  • This document relates to, but is not limited to, the field of mobile terminals, and in particular, to a method and apparatus for reading an upgrade package.
  • Android mobile devices have an application software that is upgraded in the air.
  • This application software interacts with the corresponding server, searches for the upgrade package stored in the server, downloads the upgrade package and passes the recovery mode of the mobile terminal (Recovery mode refers to a kind of You can upgrade to a new version by modifying the data or system inside the Android machine to update the system version.
  • Google's upgrade plan is to put the upgrade package through the GOTA (Google's server) server into the cache partition of the mobile terminal. Now Google's L and M platforms are based on block devices to generate upgrade packages, which are generated.
  • the upgrade package is large, especially for cross-platform upgrades. For example, Android upgrades from L to M, and the generated upgrade packages all reach 1 gigabyte (GB), plus the need to interrupt the power protection during the upgrade process. Generally, it needs more than 1.3GB. For some low-end devices (for example, the total storage is only 8GB), the cache occupies too much space. Because the user data area of the device is too small to meet the normal use of the user, You need to consider downloading the user data area from the upgrade package. After the upgrade, the upgrade package will be deleted, which will expand the capacity of the user data area.
  • GB gigabyte
  • Embodiments of the present invention provide a method and apparatus for reading an upgrade package, which can read an upgrade package from an encrypted user data area in a recovery mode.
  • a method for reading an upgrade package includes: obtaining a storage path and a physical address of an application software upgrade package in a user data partition of the terminal;
  • Determining whether the user data partition is encrypted if the user data partition is encrypted, reading the data in the upgrade package according to the storage path and decrypting the read data;
  • the decrypted data is stored to the acquired physical address.
  • the method further includes: if the upgrade package is parsed, controlling the terminal to restart, and entering the system to restore the recovery mode;
  • the method further includes:
  • the left closed interval indicates that the physical address is included in the current interval
  • the right open interval indicates that the physical address is not included in the current interval
  • the method before the acquiring the application software upgrade package in the user data partition of the terminal and the physical address, the method further includes:
  • the Fota server is upgraded from the over-the-air software of the terminal to download the upgrade package to the user data partition of the terminal.
  • the obtaining the physical address of the upgrade package in the user data partition of the terminal includes:
  • an apparatus for reading an upgrade package includes: an obtaining module configured to acquire a storage path and a physical address of an application software upgrade package in a user data partition of the terminal;
  • a determining module configured to determine whether the user data partition is encrypted, and if the user data partition is encrypted, reading data in the upgrade package according to the storage path and decrypting the read data
  • a storage module configured to store the decrypted data to the obtained physical address.
  • the foregoing apparatus further includes:
  • the control module is configured to: after the decrypted data is stored to the acquired physical address, if the upgrade package is parsed, control the terminal to restart, and enter the system to restore the recovery mode;
  • the upgrade module is configured to read the data of the upgrade package from the obtained physical address, and use the read data to perform an application software upgrade.
  • the device further includes a recording module:
  • the left closed interval indicates that the physical address is included in the current interval
  • the right open interval indicates that the physical address is not included in the current interval
  • the foregoing apparatus further includes: a downloading module, configured to: before the obtaining the storage path and the physical address of the application software upgrade package in the user data partition of the terminal, upgrading the Fota server from the over-the-air software of the terminal to download the upgrade package User data partition to the terminal.
  • a downloading module configured to: before the obtaining the storage path and the physical address of the application software upgrade package in the user data partition of the terminal, upgrading the Fota server from the over-the-air software of the terminal to download the upgrade package User data partition to the terminal.
  • the obtaining module is configured to:
  • the physical address of each data in the upgrade packet in the user data partition is sequentially obtained using an ioctl command.
  • the technical solution provided by the embodiment of the present invention includes: obtaining a storage path and a physical address of an application software upgrade package in a user data partition of the terminal; determining whether the user data partition is encrypted, if the user data partition is encrypted. , read out the upgrade package according to the storage path The data decrypts the read data; stores the decrypted data to the acquired physical address; and implements reading the upgrade package from the encrypted user data area.
  • the solution provided by the embodiment of the present invention solves the problem that the upgrade package is read from the encrypted user data area in the recovery mode, so that the upgrade can be stored in the encrypted user data area, and the related technology is used to store the upgrade package to no encryption.
  • the cache partition or data partition causes the need to increase the cache partition as much as possible, or the user data area is not encrypted, making the user data relatively small and insecure.
  • FIG. 1 is a flowchart of a method for reading an upgrade package provided in a first embodiment of the present invention
  • FIG. 2 is a flowchart of a method for upgrading a read upgrade package provided in a second embodiment of the present invention
  • FIG. 3 is a block diagram showing the structure of an apparatus for reading an upgrade package provided in a third embodiment of the present invention.
  • FIG. 1 is a flowchart of the method. As shown in FIG. 1, the method includes:
  • Step 101 Obtain a storage path and a physical address of an application software upgrade package in a user data partition of the terminal.
  • the encryption algorithm of the user data area in the Android mobile terminal is one-to-one mapping. Therefore, after the mobile terminal is powered on and decrypted, the ioct1 (eg, fd, FIBMAP, & block) command can be used to learn the extended file system (ext). The actual physical address of the data stored in the storage device.
  • the ioct1 eg, fd, FIBMAP, & block
  • the method of the embodiment of the present invention further includes: recording the obtained physical address;
  • Recording the obtained physical address may include: recording physical addresses using two or more sets of left closed right open intervals; wherein the left closed interval indicates that the physical address is included in the current interval, and the right open interval indicates that the physical address is not Is included in the current interval. Because the terminal is in use for a while After that, the upgrade package is distributed at different addresses of the file system. After recording the physical addresses of the upgrade package data in several intervals using the left closed right opening, several groups of left closed right open intervals are recorded from top to bottom. When the terminal is in the recovery mode, directly use the physical block device where the user data partition is opened, read the entire upgrade package to the memory through the physical block device recorded, and then upgrade the application software according to the differential package upgrade.
  • Step 102 Determine whether the user data partition is encrypted. If the user data partition is encrypted, read the data in the upgrade package according to the storage path and decrypt the read data.
  • the process ends.
  • Step 103 Store the decrypted data to the acquired physical address.
  • the method provided by this embodiment may further include: after the decrypted data is stored to the acquired physical address, the step of upgrading the application software based on the upgrade package, optionally, if the upgrade package is parsed, the control terminal restarts. Enter the system recovery recovery mode; read the upgrade package data according to the physical address recorded before the terminal restarts, and use the read data to perform the application software upgrade.
  • the terminal Before obtaining the storage path and the physical address of the application software upgrade package in the user data partition of the terminal, the terminal downloads the upgrade package from the Fota server to the user data partition of the terminal.
  • the upgrade package is uploaded to the Fota server.
  • the upgraded user device detects the upgrade package through the Fota module and prompts the user to download the upgrade package. If the capacity of the user data area is insufficient, the user will be prompted to delete some data first.
  • the upgrade will also detect the upgrade package, prompting the user to download the upgrade package until the upgrade package is completely downloaded to the fixed path in the encrypted user data area.
  • the upper layer of Fota will call the system to reboot into the recovery mode for upgrade, and will see a small
  • the robot keeps turning, the progress bar will show an upgrade from 0% to 100%, and the upgrade package of the user data area will be upgraded. It is deleted and does not affect the user to make the data area again.
  • FIG. 2 is a schematic flowchart of a method provided by the embodiment. As shown in Figure 2, the method includes:
  • Step 201 The upgrade package is upgraded to the Fota server, and the mobile terminal completely downloads the upgrade package to the user data area.
  • the method may include: converting the upgrade package to the upc format and uploading to the Fota server, and then adding the international mobile device identifier (IMEI) for upgrading the mobile terminal. , International Mobile Equipment Identity), the mobile terminal completely downloads the upgrade package to the user data area;
  • IMEI international mobile device identifier
  • Step 202 The upper layer writes the command to the corresponding file, enters the shutdown process, and parses the command text.
  • the method may include: the Fota upper layer module writes the command to the corresponding file, the mobile terminal enters the shutdown process, and the uncrypt service is called to start parsing the command text (
  • the uncrypt process of the embodiment of the present invention is a service (service) registered in init.rc;
  • Step 203 Open a command file to determine whether to upgrade from the user data (/data) partition; if not upgrade from the user data (/data) partition, directly restart the mobile terminal to enter the recovery mode (there is generally no upgrade from the user data partition) : 1. Restore the factory settings 2. Upgrade the upgrade package to the external T card, the path is /sdcard/ at the beginning of the command 3. Upgrade the upgrade package to the /cache partition, the command starts with /cache),
  • step 205 If upgrading from the user data (/data) partition, proceed to step 205;
  • Step 204 Directly restart the mobile terminal to enter recovery mode.
  • Step 205 Obtain an absolute path in the user data partition of the upgrade package and obtain a physical partition address corresponding to the user data partition; obtain the path of the upgrade package in order to correctly open the upgrade package, and find the physical address of the /data (user data partition) Is to write the contents of the upgrade package to the corresponding physical address;
  • Step 206 Acquire the physical address of the file sequentially by using the ioctl (fd, FIBMAP, & block) command, and record the data of the address into the left closed right opening interval; wherein the left closed address is included therein, and the right open address is not Including, the right side minus the left side is the length of the interval;
  • Step 207 Determine whether the user data partition is encrypted; the content of the file in the encrypted data partition is different from the content of the actual physical layer, and needs to be restarted as in step 205.
  • the content is exactly the same, no need to write again, only need to record the physical address data of the file exists, so if the /data partition is encrypted, perform step 208, /data partition If it is not encrypted, go to step 209.
  • Step 208 Read the content of the upgrade package from the file system level and write it to the corresponding address of the physical partition corresponding to the user data partition.
  • Step 209 parsing the entire upgrade package, determining whether the parsing is completed; if the parsing is completed, executing step 213, if no parsing is completed, executing step 210;
  • Step 210 Determine whether the address before and after the record is continuous, if the record before and after the address is continuous, step 211 is performed, if not, step 212 is performed;
  • Step 211 The previous packet is connected to continue to add the address data, and the total length is increased by one; after step 211 in the embodiment of the present invention, the process may return to step 209;
  • Step 212 Re-create a new packet and start recording physical address data.
  • the embodiment of the present invention starts with the address data, which is equivalent to the left closed of the partition, and returns to step 209 to continue parsing the entire upgrade package.
  • Step 213 After completing the complete table, enter the recovery mode for upgrading; entering the recovery mode for upgrading includes: entering the recovery mode to perform the normal mode upgrade, including: creating a new upper layer passed command, the command is different from the beginning of @ Other commands, after forming a complete table, enter the recovery mode and upgrade to the normal mode. After entering the recovery mode, if you find that starting with @, you will read the data from the interval array to the memory, and then start the upgrade. Then you can install the normal upgrade process. .
  • the embodiment of the invention further provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the method for reading the upgrade package.
  • the embodiment of the invention further provides an apparatus for reading an upgrade package, comprising: a memory and a processor; wherein
  • the processor is configured to execute program instructions in the memory
  • the decrypted data is stored to the acquired physical address.
  • FIG. 3 is a structural block diagram of the device, as shown in FIG. 30 includes:
  • the obtaining module 31 is configured to obtain a storage path and a physical address of the application software upgrade package in the user data partition of the terminal;
  • the determining module 32 is configured to determine whether the user data partition is encrypted. If the user data partition is encrypted, the data in the upgrade package is read according to the storage path and the read data is decrypted;
  • the storage module 33 is configured to store the decrypted data to the acquired physical address.
  • the foregoing apparatus 30 may further include: a control module, configured to: after storing the decrypted data to the acquired physical address, if the upgrade package is parsed, the control terminal restarts, and enters the system recovery recovery mode; the upgrade module , set to read the data of the upgrade package according to the physical address recorded before the terminal restarts, and use the read data to perform the application software upgrade.
  • a control module configured to: after storing the decrypted data to the acquired physical address, if the upgrade package is parsed, the control terminal restarts, and enters the system recovery recovery mode; the upgrade module , set to read the data of the upgrade package according to the physical address recorded before the terminal restarts, and use the read data to perform the application software upgrade.
  • the embodiment of the present invention may further include: the recording module 34 is configured to: record the physical address by using two or more sets of left closed right opening intervals; wherein the left closed interval indicates that the physical address is included in the current interval. Inside, the right-open interval indicates that the physical address is not included in the current interval.
  • the foregoing apparatus 30 may further include: a downloading module, configured to download the upgrade package from the Fota server to the user data partition of the terminal before acquiring the storage path and the physical address in the user data partition of the terminal of the application software upgrade package. .
  • a downloading module configured to download the upgrade package from the Fota server to the user data partition of the terminal before acquiring the storage path and the physical address in the user data partition of the terminal of the application software upgrade package.
  • the obtaining module 31 is configured to:
  • the solution provided by the present invention solves the problem of reading the upgrade package from the encrypted user data area in the recovery mode, so that the upgrade can be stored in the encrypted user data area, overcoming the prior art to store the upgrade package to the unencrypted.
  • the cache partition or the data partition causes the cache partition to be increased as much as possible, or the user data area is not encrypted, making the user data relatively small and insecure.
  • each module/unit in the foregoing embodiment may be implemented in the form of hardware, for example, by implementing an integrated circuit to implement its corresponding function, or may be implemented in the form of a software function module, for example, being executed by a processor and stored in a memory. Programs/instructions to implement their respective functions.
  • the invention is not limited to any specific form of combination of hardware and software.
  • the above technical solution realizes reading the upgrade package from the encrypted user data area.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • Stored Programmes (AREA)
  • Storage Device Security (AREA)

Abstract

一种读取升级包的方法及装置,包括:获取应用软件升级包在终端的用户数据分区中的存储路径以及物理地址;判断用户数据分区是否被加密,如果用户数据分区被加密,根据存储路径读取出升级包中的数据并解密读取出的数据;将解密后的数据存储至获取的物理地址;实现了从加密的用户数据区读取升级包。

Description

一种读取升级包的方法及装置 技术领域
本文涉及但不限于移动终端领域,尤其涉及一种读取升级包的方法及装置。
背景技术
随着安卓(Android)版本不断的更新,移动终端的软件版本一般也需要随之更新,这样能够满足用户的使用需求,提高用户体验等。一般Android移动设备都有空中升级的应用软件,这个应用软件会与对应的服务器交互,搜索到服务器中存放的升级包,下载此升级包并且通过移动终端的recovery模式(Recovery模式指的是一种可以对安卓机内部的数据或系统进行修改的模式)升级到新的版本,从而达到更新系统版本的目的。谷歌(Google)的升级方案是把升级包通过GOTA(Google的服务器)服务器放到移动终端的缓存(cache)分区中,现在Google的L和M平台都是基于块设备来生成升级包,其生成的的升级包较大,尤其是跨平台的升级,比如,Android由L升级到M,生成的升级包都达到1吉(GB)左右,再加上升级过程中断电保护等需要,cache分区一般需要1.3GB以上,对于一些低端的设备来说(例如,本身总存储只有8GB)而言,cache占据的空间太大,由于设备的用户数据区太小不能满足用户的正常使用,所以就需要考虑将升级包下载用户数据区,升级完后升级包将被删除掉,这样就可以扩大用户数据区的容量。
目前,大多数Android设备都可以通过移动终端的空中下载软件升级(Fota,Firmware Over-The-Air)(每个原始设备制造商(OEM,Original Equipment Manufacturer)自己的服务器)或者GOTA进行版本之间的升级,其中升级包的制作大多是使用Google提供的做包脚本,下载的升级包放到不加密的cache分区或数据(data)分区。基于此,为了能升级成功,要求尽量增大cache分区,或者用户数据区不加密,这样用户数据比较小,或者不安全,从Android M开始,要求用户数据区必须加密,在M之前的系统版也会因为安全需求而手动加密用户数据区,此时就需要解决在recovery模式如何从加密的用户数据区读取升级包的问题。对于该问题,相关技术中尚 未提出有效解决方案。
发明概述
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。
本发明实施例提供一种读取升级包的方法及装置,能够在recovery模式下从加密的用户数据区读取升级包。
根据本发明实施例的一个方面,提供了一种读取升级包的方法,包括:获取应用软件升级包在终端的用户数据分区中的存储路径以及物理地址;
判断用户数据分区是否被加密,如果所述用户数据分区被加密,则根据存储路径读取出升级包中的数据并解密读取出的数据;
将解密后的数据存储至获取的物理地址。
可选的,所述将解密后的数据存储至获取的所述物理地址之后,上述方法还包括:如果所述升级包解析完成,则控制所述终端重新启动,进入系统恢复recovery模式;
从获取的所述物理地址读取所述升级包的数据,使用读取到的所述数据进行应用软件升级。
可选的,所述方法还包括:
使用两组或两组以上左闭右开的区间记录获取的物理地址;
其中,左闭的区间表明物理地址被包含在当前区间内,右开的区间表明物理地址不被包含在当前区间内。
可选的,所述获取应用软件升级包在终端的用户数据分区中的存储路径以及物理地址之前,所述方法还包括:
从终端的空中下载软件升级Fota服务器将所述升级包下载至所述终端的用户数据分区。
其中,其中,所述获取所述升级包在终端的用户数据分区中的物理地址,包括:
使用ioctl命令依次获取所述升级包中每一个数据在所述用户数据分区 中的物理地址。
根据本发明实施例的另一个方面,提供了一种读取升级包的装置,包括:获取模块,设置为获取应用软件升级包在终端的用户数据分区中的存储路径以及物理地址;
判断模块,设置为判断所述用户数据分区是否被加密,如果所述用户数据分区被加密,则根据所述存储路径读取出所述升级包中的数据并解密读取出的所述数据;
存储模块,设置为将解密后的数据存储至获取的所述物理地址。
可选的,上述装置还包括:
控制模块,设置为在将解密后的数据存储至获取的物理地址之后,如果所述升级包解析完成,则控制所述终端重新启动,进入系统恢复recovery模式;
升级模块,设置为从获取的所述物理地址读取所述升级包的数据,使用读取到的所述数据进行应用软件升级。
可选的,所述装置还包括记录模块:
使用两组或两组以上左闭右开的区间记录所述物理地址;
其中,左闭的区间表明所述物理地址被包含在当前区间内,右开的区间表明所述物理地址不被包含在当前区间内。
可选的,上述装置还包括:下载模块,设置为在获取应用软件升级包在终端的用户数据分区中的存储路径以及物理地址之前,从终端的空中下载软件升级Fota服务器将所述升级包下载至所述终端的用户数据分区。
可选的,所述获取模块是设置为:
使用ioctl命令依次获取所述升级包中每一个数据在所述用户数据分区中的物理地址。
与相关技术相比,本发明实施例提供的技术方案,包括:获取应用软件升级包在终端的用户数据分区中的存储路径以及物理地址;判断用户数据分区是否被加密,如果用户数据分区被加密,根据存储路径读取出升级包中的 数据并解密读取出的数据;将解密后的数据存储至获取的物理地址;实现了从加密的用户数据区读取升级包。本发明实施例提供的方案,解决了在recovery模式从加密的用户数据区读取升级包的问题,使得升级得以被存储在加密的用户数据区,克服了相关技术中将升级包存储至不加密的cache分区或data分区,导致需要尽量增大cache分区,或者用户数据区不加密,使得用户数据比较小且不安全的问题。
在阅读并理解了附图和详细描述后,可以明白其他方面。
附图概述
图1是本发明第一实施例中提供的读取升级包的方法的流程图;
图2是本发明第二实施例中提供的读取升级包的升级方法的流程图;
图3是本发明第三实施例中提供的读取升级包的装置的结构框图。
详述
下文中将结合附图对本申请的实施例进行详细说明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。
第一实施例
本实施例提供了一种读取升级包的方法,图1是该方法的流程图,如图1所示,该方法包括:
步骤101:获取应用软件升级包在终端的用户数据分区中的存储路径以及物理地址;
安卓(Android)移动终端中的用户数据区的加密算法是一一映射的,故,在移动终端开机并解密后,可以使用ioct1(例如、fd,FIBMAP,&block)这个命令获知扩展文件系统(ext)4的数据在存储设备中存放的实际物理地址。
可选的,本发明实施例方法还包括:记录获取到的物理地址;
记录获取到的物理地址可以包括:使用两组或两组以上左闭右开的区间记录物理地址;其中,左闭的区间表明物理地址被包含在当前区间内,右开的区间表明物理地址不被包含在当前区间内。由于终端在使用一段时间之 后,升级包被分布在文件系统的不同地址,在使用左闭右开的若干个区间记录升级包数据连续存放的物理地址后,自上而下记录了若干组左闭右开的区间,使终端处于recovery模式升级过程中,直接使用打开用户数据分区所在的物理块设备,通过那些记录的物理块设备读取整个升级包到内存中,然后即可按照差分包升级的方式进行应用软件的升级,升级后,从文件系统层面来看,虽然记录的文件的大小与之前一样,但是文件的内容发生了变化,已经不是最初下载的升级包内容了,所以升级后,需要在一开机后即删除升级包,还原用户数据分区的容量。
步骤102:判断用户数据分区是否被加密,如果用户数据分区被加密,则根据存储路径读取出升级包中的数据并解密读取出的数据;
可选的,本发明实施例,如果用户数据分区未被加密,则该流程结束。
步骤103:将解密后的数据存储至获取的物理地址。
本实施例提供的方法还可以包括:在将解密后的数据存储至获取的物理地址之后,基于升级包对应用软件进行升级的步骤,可选地,如果升级包解析完成,则控制终端重新启动,进入系统恢复recovery模式;根据终端重新启动之前记录的物理地址读取升级包的数据,使用读取到的数据进行应用软件升级。
本实施例提供的方法还可以包括:
在获取应用软件升级包在终端的用户数据分区中的存储路径以及物理地址之前,终端从Fota服务器将升级包下载至终端的用户数据分区。
第二实施例
本实施例提供的方法可以应用于如下应用场景:
升级包被上传到Fota服务器中,需要升级的用户设备会通过Fota模块检测到此升级包,提示用户下载此升级包,如果用户数据区的容量不足,会提示用户先删除一些数据,移动终端下次开机还会检测到该升级包,提示用户下载该升级包,直到升级包被完整下载到加密的用户数据区中固定的路径,Fota上层会调用系统重启进入recovery模式进行升级,会看到小机器人不断转动,进度条会显示从0%升级到100%,升级后用户数据区的升级包会 被删除掉,不影响用户再次使数据区。
基于上述应用场景,本实施用例提供了一种基于Android设备从加密分区读取升级包的Fota升级方法,图2为本实施例提供的方法的流程示意图。如图2所示,该方法包括:
步骤201:上升升级包到Fota服务器,移动终端完整下载升级包到用户数据区;可以包括:将此升级包转换为upc格式上传到Fota服务器,然后添加需要升级移动终端的国际移动设备标识(IMEI,International Mobile Equipment Identity)号,移动终端完整下载此升级包到用户数据区;
步骤202:上层写入命令到对应的文件中,进入关机流程,解析命令文本;可以包括:Fota上层模块写入命令到对应的文件中,移动终端进入关机流程,调用uncrypt服务开始解析命令文本(本发明实施例uncrypt进程是在init.rc中注册的一个服务(service));
步骤203:打开命令文件判断是否从用户数据(/data)分区升级;若不从用户数据(/data)分区升级,则直接重启移动终端进入recovery模式(不从用户数据分区升级的情况一般有三种:1.恢复出厂设置2.升级包放到外置T卡上面的升级,路径为/sdcard/开头的命令3.升级包放到/cache分区的升级方式,命令的开头是/cache),
若从用户数据(/data)分区升级,继续步骤205;
步骤204:直接重启移动终端进入recovery模式;
步骤205:获取升级包存在用户数据分区中的绝对路径以及获取用户数据分区对应的物理分区地址;获取升级包的路径是为了能够正确打开升级包,而找到/data的物理地址(用户数据分区)是为了把升级包的内容写入到对应的物理地址中;
步骤206:通过ioctl(fd,FIBMAP,&block)命令依次获取文件的物理地址,并记录地址的数据到左闭右开的区间中;其中,左闭的地址是包含其中,右开的地址不被包含,右面减去左面就是这段区间的长度;
步骤207:判断用户数据分区是否被加密;加密的data分区中文件内容与实际的物理层面的内容是不一样的,需要如步骤205中的方法,需要重新 写入,而对于非加密的文件系统,内容是完全一样,不需要再次写入,只需要记录文件存在的物理地址数据即可,所以如果/data分区是加密的,执行步骤208,/data分区不加密则执行步骤209。
步骤208:从文件系统层面读出升级包的内容再依次写入用户数据分区对应物理分区相应的地址中去;
步骤209:解析整个升级包,判断是否解析完成;若解析完成,执行步骤213,若没有解析完成,执行步骤210;
步骤210:判断记录的前后地址是否连续,若记录的前后地址连续,执行步骤211,若不连续,执行步骤212;
步骤211:连接前一个分组继续添加地址数据,总长度加一;本发明实施例步骤211后,可以回到步骤209;
步骤212:重新创建一个新的分组,开始记录物理地址数据;本发明实施例以该地址数据为开头,相当于分区的左闭开头,回到步骤209,继续解析整个升级包。
步骤213:形成完整的表后进入recovery模式进行升级;进入recovery模式进行升级包括:进入recovery模式进行正常模式的升级,包括:创建一个新的上层传下来的命令,这个命令是@开头的区别于其它命令,形成完整的表后进入recovery模式正常模式升级,进入recovery模式后,要是发现以@开头就会从区间数组中依次读取数据到内存,再开始升级,后面安装正常的升级流程即可。
本发明实施例还提供一种计算机存储介质,计算机存储介质中存储有计算机可执行指令,计算机可执行指令用于执行上述读取升级包的方法。
本发明实施例还提供一种读取升级包的装置,包括:存储器和处理器;其中,
处理器被配置为执行存储器中的程序指令;
程序指令在处理器读取执行以下操作:
获取应用软件升级包在终端的用户数据分区中的存储路径以及物理地址;
判断用户数据分区是否被加密,如果用户数据分区被加密,则根据存储路径读取出升级包中的数据并解密读取出的数据;
将解密后的数据存储至获取的物理地址。
第三实施例
本实施例提供了一种读取升级包的装置,该装置用于实现上述第一实施例以及第二实施例提供的方法,图3是该装置的结构框图,如图3所示,该装置30包括:
获取模块31,设置为获取应用软件升级包在终端的用户数据分区中的存储路径以及物理地址;
判断模块32,设置为判断用户数据分区是否被加密,如果用户数据分区被加密,则根据存储路径读取出升级包中的数据并解密读取出的数据;
存储模块33,设置为将解密后的数据存储至获取的物理地址。
可选的,上述装置30还可以包括:控制模块,设置为在将解密后的数据存储至获取的物理地址之后,如果升级包解析完成,则控制终端重新启动,进入系统恢复recovery模式;升级模块,设置为根据终端重新启动之前记录的物理地址读取升级包的数据,使用读取到的数据进行应用软件升级。
可选的,本发明实施例还可以包括:记录模块34是设置为:使用两组或两组以上左闭右开的区间记录物理地址;其中,左闭的区间表明物理地址被包含在当前区间内,右开的区间表明物理地址不被包含在当前区间内。
可选的,上述装置30还可以包括:下载模块,设置为在获取应用软件升级包在终端的用户数据分区中的存储路径以及物理地址之前,从Fota服务器将升级包下载至终端的用户数据分区。
可选的,上述获取模块31是设置为:
使用ioctl命令依次获取升级包中每一个数据在用户数据分区中的物理 地址。
本发明提供的方案,解决了在recovery模式从加密的用户数据区读取升级包的问题,使得升级得以被存储在加密的用户数据区,克服了现有技术中将升级包存储至不加密的cache分区或data分区,导致需要尽量增大cache分区,或者用户数据区不加密,使得用户数据比较小且不安全的问题。
尽管为示例目的,已经公开了本发明的可选实施例,本领域的技术人员将意识到的改进、增加和取代也是可能的,因此,本发明的范围应当不限于上述实施例。
本领域普通技术人员可以理解上述方法中的全部或部分步骤可通过程序来指令相关硬件(例如处理器)完成,所述程序可以存储于计算机可读存储介质中,如只读存储器、磁盘或光盘等。可选地,上述实施例的全部或部分步骤也可以使用一个或多个集成电路来实现。相应地,上述实施例中的每个模块/单元可以采用硬件的形式实现,例如通过集成电路来实现其相应功能,也可以采用软件功能模块的形式实现,例如通过处理器执行存储于存储器中的程序/指令来实现其相应功能。本发明不限制于任何特定形式的硬件和软件的结合。
虽然本申请所揭露的实施方式如上,但所述的内容仅为便于理解本申请而采用的实施方式,并非用以限定本申请,如本发明实施方式中的具体的实现方法。任何本申请所属领域内的技术人员,在不脱离本申请所揭露的精神和范围的前提下,可以在实施的形式及细节上进行任何的修改与变化,但本申请的专利保护范围,仍须以所附的权利要求书所界定的范围为准。
工业实用性
上述技术方案实现了从加密的用户数据区读取升级包。

Claims (10)

  1. 一种读取升级包的方法,包括:
    获取应用软件升级包在终端的用户数据分区中的存储路径以及物理地址;
    判断所述用户数据分区是否被加密,如果所述用户数据分区被加密,则根据所述存储路径读取出所述升级包中的数据并解密读取出的所述数据;
    将解密后的数据存储至获取的所述物理地址。
  2. 根据权利要求1所述的方法,所述将解密后的数据存储至获取的所述物理地址之后,所述方法还包括:
    如果所述升级包解析完成,则控制所述终端重新启动,进入系统恢复recovery模式;
    从获取的所述物理地址读取所述升级包的数据,使用读取到的所述数据进行应用软件升级。
  3. 根据权利要求1所述的方法,所述方法还包括:
    使用两组或两组以上左闭右开的区间记录获取的所述物理地址;
    其中,左闭的区间表明所述物理地址被包含在当前区间内,右开的区间表明所述物理地址不被包含在当前区间内。
  4. 根据权利要求1所述的方法,所述获取应用软件升级包在终端的用户数据分区中的存储路径以及物理地址之前,所述方法还包括:
    从终端的空中下载软件升级Fota服务器将所述升级包下载至所述终端的用户数据分区。
  5. 根据权利要求1至4任意一项所述的方法,其中,所述获取所述升级包在终端的用户数据分区中的物理地址,包括:
    使用ioctl命令依次获取所述升级包中每一个数据在所述用户数据分区中的物理地址。
  6. 一种读取升级包的装置,包括:
    获取模块,设置为获取应用软件升级包在终端的用户数据分区中的存储路径以及物理地址;
    判断模块,设置为判断所述用户数据分区是否被加密,如果所述用户数据分区被加密,则根据所述存储路径读取出所述升级包中的数据并解密读取出的所述数据;
    存储模块,设置为将解密后的数据存储至获取的所述物理地址。
  7. 根据权利要求6所述的装置,所述装置还包括:
    控制模块,设置为在将解密后的数据存储至获取的物理地址之后,如果所述升级包解析完成,则控制所述终端重新启动,进入系统恢复recovery模式;
    升级模块,设置为从获取的所述物理地址读取所述升级包的数据,使用读取到的所述数据进行应用软件升级。
  8. 根据权利要求6所述的装置,所述装置还包括记录模块:
    使用两组或两组以上左闭右开的区间记录所述物理地址;
    其中,左闭的区间表明所述物理地址被包含在当前区间内,右开的区间表明所述物理地址不被包含在当前区间内。
  9. 根据权利要求6所述的装置,所述装置还包括:
    下载模块,设置为在获取应用软件升级包在终端的用户数据分区中的存储路径以及物理地址之前,从终端的空中下载软件升级Fota服务器将所述升级包下载至所述终端的用户数据分区。
  10. 根据权利要求6至9任意一项所述的装置,其中,所述获取模块是设置为:
    使用ioctl命令依次获取所述升级包中每一个数据在所述用户数据分区中的物理地址。
PCT/CN2017/079607 2016-08-25 2017-04-06 一种读取升级包的方法及装置 WO2018036166A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610722929.4 2016-08-25
CN201610722929.4A CN107784233B (zh) 2016-08-25 2016-08-25 一种从加密用户数据分区中读取升级包的方法及装置

Publications (1)

Publication Number Publication Date
WO2018036166A1 true WO2018036166A1 (zh) 2018-03-01

Family

ID=61245353

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/079607 WO2018036166A1 (zh) 2016-08-25 2017-04-06 一种读取升级包的方法及装置

Country Status (2)

Country Link
CN (1) CN107784233B (zh)
WO (1) WO2018036166A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109947450A (zh) * 2019-03-19 2019-06-28 深圳创维-Rgb电子有限公司 系统文件升级方法、装置、移动终端及可读存储介质

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110389862B (zh) * 2019-07-24 2023-06-30 上海联影医疗科技股份有限公司 一种数据保存方法、装置、设备及存储介质
CN113791811B (zh) * 2021-08-02 2024-06-21 瑞芯微电子股份有限公司 固件升级方法和存储设备
CN115357295B (zh) * 2022-10-21 2023-03-31 荣耀终端有限公司 系统回退方法、设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102436388A (zh) * 2011-12-22 2012-05-02 华为技术有限公司 嵌入式系统软件升级方法和装置
US20130132936A1 (en) * 2010-08-11 2013-05-23 Zte Corporation Apparatus and method for packing a software package of version upgrade
CN104021018A (zh) * 2014-06-06 2014-09-03 上海卓悠网络科技有限公司 终端、生成升级包的方法及识别升级包的方法
CN104135531A (zh) * 2014-08-07 2014-11-05 武汉益模软件科技有限公司 一种Web软件的升级方法及装置

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5208855A (en) * 1991-09-20 1993-05-04 Marian Michael B Method and apparatus for irrigation control using evapotranspiration
CN100447765C (zh) * 2005-05-20 2008-12-31 联想(北京)有限公司 一种移动存储设备的映射方法
CN100502462C (zh) * 2006-12-01 2009-06-17 北京东方广视科技有限责任公司 智能卡在线升级的方法
CN101615161B (zh) * 2009-07-28 2012-07-18 成都市华为赛门铁克科技有限公司 一种硬盘的加密及解密方法、硬盘驱动装置以及硬盘
US8977865B2 (en) * 2010-05-25 2015-03-10 Microsoft Technology Licensing, Llc Data encryption conversion for independent agents
CN105740717B (zh) * 2016-01-29 2018-11-13 四川效率源信息安全技术股份有限公司 一种基于加密分区进行电子数据文件保护的方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130132936A1 (en) * 2010-08-11 2013-05-23 Zte Corporation Apparatus and method for packing a software package of version upgrade
CN102436388A (zh) * 2011-12-22 2012-05-02 华为技术有限公司 嵌入式系统软件升级方法和装置
CN104021018A (zh) * 2014-06-06 2014-09-03 上海卓悠网络科技有限公司 终端、生成升级包的方法及识别升级包的方法
CN104135531A (zh) * 2014-08-07 2014-11-05 武汉益模软件科技有限公司 一种Web软件的升级方法及装置

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109947450A (zh) * 2019-03-19 2019-06-28 深圳创维-Rgb电子有限公司 系统文件升级方法、装置、移动终端及可读存储介质
CN109947450B (zh) * 2019-03-19 2023-03-17 深圳创维-Rgb电子有限公司 系统文件升级方法、装置、移动终端及可读存储介质

Also Published As

Publication number Publication date
CN107784233B (zh) 2021-09-03
CN107784233A (zh) 2018-03-09

Similar Documents

Publication Publication Date Title
WO2018036166A1 (zh) 一种读取升级包的方法及装置
WO2016000493A1 (zh) 一种安全终端的双芯片方案的固件更新方法
KR102358470B1 (ko) 부트 로더 업데이트 펌웨어, 및 부트 로더 업데이트 방법
CN110597542B (zh) 软件自动ota升级方法及装置、电子设备
CN105573780A (zh) 一种基于容器的移动终端操作系统升级方法和装置
CA2928930C (en) Systems and methods for updating system-level services within read-only system images
CN107526608B (zh) 一种ota升级包升级方法及设备
WO2017185954A1 (zh) 一种实现usb设备管理的方法、主机和系统
US9891862B2 (en) Forensic data acquisition apparatus and method for guaranteeing integrity of flash memory in smart device
US20160170735A1 (en) Operating system updating method by using a checklist
CN108509215B (zh) 一种系统软件的更换方法、装置、终端设备及存储介质
CN111201553B (zh) 一种安全元件及相关设备
US20130167148A1 (en) Computing device and virtual machine operation control method
WO2018014798A1 (zh) 机顶盒动态配置多ca的方法及系统
WO2017076051A1 (zh) 一种获取超级用户权限的方法及装置
CN104182257A (zh) 应用软件的安装方法和应用软件的安装装置
US9146748B1 (en) Systems and methods for injecting drivers into computing systems during restore operations
WO2016082450A1 (zh) 一种用户终端的升级方法和用户终端
WO2018049798A1 (zh) 一种缓存分区重构的方法和装置
CN109271181A (zh) 应用兼容性修复方法、终端设备及计算机可读存储介质
US9940461B2 (en) Enabling an external operating system to access encrypted data units of a data storage system
WO2019183806A1 (zh) 资源权限处理方法、装置、存储介质及芯片
WO2017173924A1 (zh) 切换文件系统的方法及装置
WO2020113382A1 (zh) 硬件升级方法、装置、设备和存储介质
TWI533214B (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: 17842591

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17842591

Country of ref document: EP

Kind code of ref document: A1