Movatterモバイル変換


[0]ホーム

URL:


CN108509215A - System software replacing method and device, terminal equipment and storage medium - Google Patents

System software replacing method and device, terminal equipment and storage medium
Download PDF

Info

Publication number
CN108509215A
CN108509215ACN201810240841.8ACN201810240841ACN108509215ACN 108509215 ACN108509215 ACN 108509215ACN 201810240841 ACN201810240841 ACN 201810240841ACN 108509215 ACN108509215 ACN 108509215A
Authority
CN
China
Prior art keywords
resource file
original
system software
file
original resource
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN201810240841.8A
Other languages
Chinese (zh)
Other versions
CN108509215B (en
Inventor
邱伟波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Shiyuan Electronics Thecnology Co Ltd
Guangzhou Shirui Electronics Co Ltd
Original Assignee
Guangzhou Shiyuan Electronics Thecnology Co Ltd
Guangzhou Shirui Electronics Co Ltd
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 Guangzhou Shiyuan Electronics Thecnology Co Ltd, Guangzhou Shirui Electronics Co LtdfiledCriticalGuangzhou Shiyuan Electronics Thecnology Co Ltd
Priority to CN201810240841.8ApriorityCriticalpatent/CN108509215B/en
Publication of CN108509215ApublicationCriticalpatent/CN108509215A/en
Application grantedgrantedCritical
Publication of CN108509215BpublicationCriticalpatent/CN108509215B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

The invention discloses a method and a device for replacing system software, terminal equipment and a storage medium, wherein the method comprises the following steps: detecting and acquiring an original resource file of system software, and storing the original resource file to a first preset directory; saving the running resource file of the system software in a second preset directory as a backup resource file; the operating resource file is configured according to the requirement of a user on the system; and replacing the operating resource file with an original resource file in a first preset directory. The invention solves the problem that the whole mirror image file of the system software needs to be refreshed, and realizes the effect that the system software customized by a user can be replaced by the original system software without upgrading the system software again.

Description

Translated fromChinese
一种系统软件的更换方法、装置、终端设备及存储介质System software replacement method, device, terminal equipment and storage medium

技术领域technical field

本发明实施例涉及应用软件技术,尤其涉及一种系统软件的更换方法、装置、终端设备及存储介质。Embodiments of the present invention relate to application software technologies, and in particular to a system software replacement method, device, terminal equipment, and storage medium.

背景技术Background technique

随着科技的发展,智能终端的功能越来越多样化。智能终端是指具有独立的移动操作系统,可通过安装应用软件、游戏等程序来扩充终端功能。With the development of science and technology, the functions of smart terminals are becoming more and more diverse. A smart terminal refers to an independent mobile operating system, which can expand terminal functions by installing application software, games and other programs.

目前,Android系统作为一个开源的操作系统,许多厂商都在此基础上进行二次开发,定制一些具有自己特色的功能,但为了满足一些特定的场景需求,需将厂商定制的系统软件更换为原始系统软件。在现有技术中,最常用的刷机方式,是进入终端的系统恢复模式,当用户根据提示选择恢复系统或升级系统时,通过OTA(Over-the-Air Technology,空间下载技术)或线刷(通过数据线把终端连接到电脑上,通过刷机软件进行刷机)的方式,将用户提供的刷机包中的系统软件写入智能终端内置存储器的系统分区,覆盖原有系统。At present, the Android system is an open-source operating system. Many manufacturers conduct secondary development on this basis and customize some functions with their own characteristics. However, in order to meet the needs of some specific scenarios, it is necessary to replace the system software customized by the manufacturer with the original system software. In the prior art, the most commonly used method of flashing is to enter the system recovery mode of the terminal. When the user chooses to restore the system or upgrade the system according to the prompts, the OTA (Over-the-Air Technology, space download technology) or online brush ( Connect the terminal to the computer through the data cable, and use the flashing software to flash) to write the system software in the flashing package provided by the user into the system partition of the built-in memory of the smart terminal to overwrite the original system.

但发明人在实现上述方案的过程中发现,采用目前的OTA或线刷的刷机方式,需要对系统软件的整块镜像文件进行刷写,即需要重新恢复或升级系统软件。However, the inventor found in the process of realizing the above-mentioned solution that the current OTA or online flashing method needs to flash the entire image file of the system software, that is, it is necessary to restore or upgrade the system software.

发明内容Contents of the invention

本发明提供一种系统软件的更换方法、装置、终端设备及存储介质,以实现无需重新升级系统软件,就可以将用户定制的系统软件更换为原始系统软件。The invention provides a system software replacement method, device, terminal equipment and storage medium, so as to realize that the user-customized system software can be replaced with the original system software without re-upgrading the system software.

第一方面,本发明实施例提供了一种系统软件的更换方法,该方法包括:In a first aspect, an embodiment of the present invention provides a method for replacing system software, the method comprising:

检测并获取系统软件的原始资源文件,并将所述原始资源文件保存到第一预设目录;Detecting and obtaining the original resource file of the system software, and saving the original resource file to a first preset directory;

将系统软件的运行资源文件在第二预设目录保存为备份资源文件;其中,所述运行资源文件为根据用户对系统的需求而配置的资源文件;saving the running resource file of the system software as a backup resource file in a second preset directory; wherein, the running resource file is a resource file configured according to the user's requirements for the system;

将所述运行资源文件更换为所述第一预设目录中的原始资源文件。The running resource file is replaced with the original resource file in the first preset directory.

第二方面,本发明实施例还提供了一种系统软件的更换装置,该装置包括:In the second aspect, the embodiment of the present invention also provides a device for replacing system software, the device comprising:

检测获取模块,用于检测并获取系统软件的原始资源文件,并将所述原始资源文件保存到第一预设目录;A detection and acquisition module, configured to detect and acquire the original resource file of the system software, and save the original resource file to the first preset directory;

保存模块,用于将系统软件的运行资源文件在第二预设目录保存为备份资源文件;其中,所述运行资源文件为根据用户对系统的需求而配置的资源文件;The saving module is used to save the running resource file of the system software in the second preset directory as a backup resource file; wherein, the running resource file is a resource file configured according to the user's requirements for the system;

更换模块,用于将所述运行资源文件更换为所述第一预设目录中的原始资源文件。A replacement module, configured to replace the running resource file with the original resource file in the first preset directory.

第三方面,本发明实施例还提供了一种终端设备,所述设备包括:In a third aspect, an embodiment of the present invention further provides a terminal device, the device comprising:

一个或多个处理器;one or more processors;

存储器,用于存储一个或多个程序;memory for storing one or more programs;

当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如上述任一所述的系统软件的更换方法。When the one or more programs are executed by the one or more processors, the one or more processors are made to implement the system software replacement method as described above.

第四方面,本发明实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如上述任一所述的系统软件的更换方法。In a fourth aspect, the embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the method for replacing system software as described above can be implemented.

本发明通过检测并获取系统软件的原始资源文件,并将原始资源文件保存到第一预设目录;将系统软件的运行资源文件在第二预设目录保存为备份资源文件;将运行资源文件替换为第一预设目录中的原始资源文件,解决需对系统软件的整块镜像文件进行刷写的问题,实现了无需重新升级系统软件即可将用户定制的系统软件更换为原始系统软件的效果。The present invention detects and obtains the original resource file of the system software, and saves the original resource file in the first preset directory; saves the running resource file of the system software in the second preset directory as a backup resource file; replaces the running resource file For the original resource files in the first preset directory, it solves the problem of flashing the entire image file of the system software, and realizes the effect that the user-customized system software can be replaced with the original system software without re-upgrading the system software .

附图说明Description of drawings

图1是本发明实施例一中的一种系统软件的更换方法的流程图。FIG. 1 is a flowchart of a method for replacing system software in Embodiment 1 of the present invention.

图2是本发明实施例二中的一种系统软件的更换方法的流程图。FIG. 2 is a flow chart of a method for replacing system software in Embodiment 2 of the present invention.

图3是本发明实施例二中的一种系统软件的另一更换方法的流程图。FIG. 3 is a flow chart of another replacement method for system software in Embodiment 2 of the present invention.

图4是本发明实施例三中的一种系统软件的更换方法的流程图。FIG. 4 is a flowchart of a method for replacing system software in Embodiment 3 of the present invention.

图5是本发明实施例四中的一种系统软件的更换装置的结构示意图。FIG. 5 is a schematic structural diagram of a device for replacing system software in Embodiment 4 of the present invention.

图6是本发明实施例五中的一种终端设备的结构示意图。FIG. 6 is a schematic structural diagram of a terminal device in Embodiment 5 of the present invention.

具体实施方式Detailed ways

下面结合附图和实施例对本发明作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释本发明,而非对本发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与本发明相关的部分而非全部结构。The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, but not to limit the present invention. In addition, it should be noted that, for the convenience of description, only some structures related to the present invention are shown in the drawings but not all structures.

在本发明各实施例中,由于终端设备整机会有MCU(Microcontroller Unit,微控制单元,又称单片机)和主芯片进行搭配工作。其中,在终端设备待机的情况下,只有MCU工作,而主芯片在此刻处于关机状态,即所有整机处于低功耗阶段。在整机开机完成后,MCU会为主芯片分担一部分功能处理。示例性地,MCU处理的功能可包括:电源控制、按键板的组合键功能、红外遥控的编码格式、RS232的协议定制等。而其中按键板的组合键功能、红外遥控的编码格式、RS232的协议定制可根据用户需要进行重新升级或还原。In each embodiment of the present invention, since the terminal device has an MCU (Microcontroller Unit, micro control unit, also known as a single-chip microcomputer) and a main chip to work together. Wherein, when the terminal equipment is in standby, only the MCU is working, while the main chip is in a shutdown state at this moment, that is, all the whole machine is in a low power consumption stage. After the whole machine is turned on, the MCU will share part of the functional processing with the main chip. Exemplarily, the functions processed by the MCU may include: power control, combined key functions of the keypad, coding format of the infrared remote control, RS232 protocol customization, and the like. Among them, the combined key function of the key board, the coding format of the infrared remote control, and the customization of the RS232 protocol can be re-upgraded or restored according to user needs.

实施例一Embodiment one

图1为本发明实施例一提供的一种系统软件的更换方法的流程图,本实施例可适用于对移动终端的系统软件进行更换的情况,该方法可以由本发明实施例提供的系统软件的更换装置来执行,该装置可采用软件和/或硬件的方式实现,并一般可集成在终端设备中。该系统软件的更换方法具体包括如下步骤:Figure 1 is a flow chart of a method for replacing system software provided by Embodiment 1 of the present invention. This embodiment is applicable to the situation where the system software of a mobile terminal is replaced. The device can be implemented by replacing the device, which can be implemented in the form of software and/or hardware, and can generally be integrated into the terminal device. The replacement method of the system software specifically includes the following steps:

S110、检测并获取系统软件的原始资源文件,并将原始资源文件保存到第一预设目录。具体地,系统软件是指控制和协调计算机及外部设备,支持应用软件开发和运行的系统。在本方案中,将系统软件应用到智能终端上,比如,笔记本、平板电脑以及手机等等。当然,本方案中并不对智能终端进行限定,可适用于对安装有Android系统的智能终端设备进行系统软件的更换。S110. Detect and acquire the original resource file of the system software, and save the original resource file to a first preset directory. Specifically, system software refers to a system that controls and coordinates computers and peripheral devices, and supports the development and operation of application software. In this solution, the system software is applied to smart terminals, such as notebooks, tablet computers, and mobile phones. Of course, this solution does not limit the smart terminal, and is applicable to replace the system software of the smart terminal device installed with the Android system.

当然,原始资源文件为用户最终要将智能终端设备的系统软件更换成系统软件的资源文件,可包括:apk文件和bin文件。其中,Android应用程序包文件(apk)是一种Android操作系统上的应用程序安装文件格式,其英文全称为“Application package file”。Of course, the original resource file is the resource file for the user to eventually replace the system software of the smart terminal device with system software, which may include: apk file and bin file. Wherein, the Android application package file (apk) is an application installation file format on the Android operating system, and its English full name is "Application package file".

具体来说,在实际应用中,用户(可为智能终端设备的厂商,也可为自行对智能终端设备的系统软件进行更换的个人)在拿到第三方公司提供的应用程序apk后,先解压这个apk,接着再针对该apk编写Android.mk文件,然后对编好的Android.mk文件进行源码编译。Specifically, in practical applications, the user (either the manufacturer of the smart terminal device or an individual who replaces the system software of the smart terminal device by himself) gets the application program apk provided by the third-party company, and first decompresses it. This apk, then write the Android.mk file for the apk, and then compile the source code of the compiled Android.mk file.

在用户对apk文件进行编写之前,为了对智能终端系统的系统软件进行更换,会将系统软件的原始资源文件,比如apk文件和bin文件等保存到指定目录下,以作备份。当然,系统软件的原始资源文件可为系统软件的出厂设置的系统软件,也可为已经用户进行重新配置的系统软件的版本。在此对系统软件的原始资源文件并不进行限定,可根据用户的选择来进行备份。Before the user writes the apk file, in order to replace the system software of the smart terminal system, the original resource files of the system software, such as the apk file and bin file, will be saved in a designated directory for backup. Certainly, the original resource file of the system software may be the system software that is factory-set by the system software, or may be a version of the system software that has been reconfigured by the user. The original resource files of the system software are not limited here, and can be backed up according to the user's choice.

示例性地,为了对智能终端设备的系统软件进行升级或还原,在本方案中,以智能终端设备为平板电脑为例进行说明,可先将从移动存储设备或系统分区中获取到的系统软件的原始资源文件拷贝到/system/tmp目录下,以防止在升级过程中,由于移动存储设备的插拔或通信异常而导致系统软件的升级失败。Exemplarily, in order to upgrade or restore the system software of the smart terminal device, in this solution, taking the smart terminal device as a tablet computer as an example, the system software obtained from the mobile storage device or the system partition can be first Copy the original resource files to the /system/tmp directory to prevent system software upgrade failures due to plugging and unplugging of removable storage devices or abnormal communication during the upgrade process.

其中,移动存储设备可以为U盘,也可以为移动硬盘,只要是终端设备的外接存储设备即可,并不对此进行限定。Wherein, the mobile storage device may be a USB flash drive or a mobile hard disk, as long as it is an external storage device of the terminal device, and is not limited thereto.

S120、将系统软件的运行资源文件在第二预设目录保存为备份资源文件;其中,运行资源文件为根据用户对系统的需求而配置的资源文件。S120. Save the running resource file of the system software as a backup resource file in a second preset directory; wherein, the running resource file is a resource file configured according to a user's requirement for the system.

在本方案中,可根据用户对系统的需求而对应用程序apk进行重新配置,即所谓的二次开发。为了方便用户重新更换自身定制的系统软件时,将智能终端设备所正在采用的Android系统软件的运行资源文件进行备份,并保存到指定目录下。In this solution, the application program apk can be reconfigured according to the user's requirements for the system, which is the so-called secondary development. In order to facilitate the user to replace the system software customized by himself, the running resource file of the Android system software used by the smart terminal device is backed up and saved in a designated directory.

举例来说,当用户所使用的平板电脑的系统为Android系统,并且Android系统所运行的系统软件为用户根据自身需求进行重新定制的。现用户为了投标使用,需对系统软件进行更换,则为了方便用户再次更换定制的系统软件,需要先将定制的apk文件和bin文件备份到/system/vendor/customer下。For example, when the system of the tablet computer used by the user is the Android system, and the system software run by the Android system is re-customized by the user according to the user's own needs. Now the user needs to replace the system software for bidding, so in order to facilitate the user to replace the customized system software again, the customized apk file and bin file need to be backed up to /system/vendor/customer first.

其中,本方案中涉及到的/system/vendor/customer目录的名称仅仅是基于当前普遍使用的名称,对此并不进行限定,只要文件本身实质和功能与本方案中的原始资源文件和运行资源文件一致,就都属于本发明保护的范围。Among them, the name of the /system/vendor/customer directory involved in this solution is only based on the currently commonly used name, and there is no limitation on this, as long as the essence and function of the file itself are the same as the original resource files and running resources in this solution If the files are consistent, they all belong to the protection scope of the present invention.

S130、将运行资源文件更换为第一预设目录中的原始资源文件。S130. Replace the running resource file with the original resource file in the first preset directory.

在本方案中,在系统内存足够大时,可使用多用户程序独立分区的方法,或者通过配置初始化变量的方法。其中,采用多用户程序独立分区的方法时,假设系统资源由用户A、用户B、用户C和用户D,则将分为boot loader分区、用户A主程序分区、用户B主程序分区、用户C主程序分区以及用户D主程序分区,当在boot loader分区的启动阶段读取用户标识信息,将跳转到对应用户的分区运行主程序,以实现原始资源文件和运行资源文件之间的替换;在通过配置初始化变量的方法进行文件更换时,由于系统存储有所有用户需求的主程序分区,则在触发动态更换系统软件时,由Android系统发送当前更换系统软件的用户信息,并由MCU加载对应用户运行条件的全局变量,终端设备的各个模块将根据运行条件,调用不同的运行机制,以实现系统软件的资源文件的更换。In this solution, when the system memory is large enough, the method of independent partitioning of multi-user programs can be used, or the method of initializing variables through configuration can be used. Among them, when using the method of independent partitioning of multi-user programs, assuming that the system resources are divided into user A, user B, user C and user D, it will be divided into boot loader partition, user A main program partition, user B main program partition, user C The main program partition and the main program partition of user D, when the user identification information is read during the startup phase of the boot loader partition, will jump to the partition corresponding to the user to run the main program, so as to realize the replacement between the original resource file and the running resource file; When file replacement is performed by configuring initialization variables, since the system stores the main program partitions required by all users, when dynamic replacement of system software is triggered, the Android system sends the user information of the current replacement system software, and the MCU loads the corresponding The global variable of the user's operating conditions, each module of the terminal device will call different operating mechanisms according to the operating conditions, so as to realize the replacement of the resource files of the system software.

在此需要说明的是,在通过脚本对系统软件进行更换时,需将对原始资源文件和运行资源文件进行比对分析。具体来说,当原始资源文件和运行资源文件中的apk文件、bin文件以及其他文件有相同资源文件,将不对相同资源文件进行更新,只需对原始资源文件和运行资源文件不同的资源文件进行操作,比如,将原始资源文件中和运行资源文件中都包含有bin文件,但其目录下的资源文件不同,则将原始资源文件的bin文件替换运行资源文件的bin文件,而由于运行资源文件中是客户根据自身需求进行定制的,其包含有更多的文件夹,其在对系统软件进行更换时,需将多余的定制的资源文件进行删除,以实现系统软件的更换。What needs to be explained here is that when replacing the system software through scripts, it is necessary to compare and analyze the original resource file and the running resource file. Specifically, when the apk file, bin file, and other files in the original resource file and the running resource file have the same resource file, the same resource file will not be updated, and only the resource files that are different from the original resource file and the running resource file will be updated. Operation, for example, if both the original resource file and the running resource file contain bin files, but the resource files in their directories are different, replace the bin file of the original resource file with the bin file of the running resource file, and because the running resource file It is customized by the customer according to their own needs, and it contains more folders. When replacing the system software, the redundant customized resource files need to be deleted to realize the replacement of the system software.

其中,脚本可采用shell脚本、Python脚本以及ruby脚本,对此并不进行限定,只要可实现系统软件的更换即可。Wherein, the script may adopt shell script, Python script and ruby script, which is not limited, as long as the system software can be replaced.

具体地,在完成将智能终端设备中的系统软件的运行资源文件替换为原始资源文件后,根据原始资源文件的配置对权限进行重新管理,并清除历史应用相关文件。当然,清除历史应用相关文件,是可选的,因有的ROM(read only memory,只读存储器)软件不需要清除就可以直接更换,但有的ROM软件必须完全清除才可以进行刷机。Specifically, after replacing the operating resource file of the system software in the smart terminal device with the original resource file, the permissions are re-managed according to the configuration of the original resource file, and historical application-related files are cleared. Of course, it is optional to clear historical application related files, because some ROM (read only memory, read-only memory) software can be directly replaced without clearing, but some ROM software must be completely cleared before flashing.

本实施例的技术方案,通过检测并获取系统软件的原始资源文件,并将原始资源文件保存到第一预设目录;将系统软件的运行资源文件在第二预设目录保存为备份资源文件;将运行资源文件替换为第一预设目录中的原始资源文件的技术手段,解决了需对系统软件的整块镜像文件进行刷写的问题,实现了无需重新升级系统软件即可将用户定制的系统软件更换为原始系统软件的效果。In the technical solution of this embodiment, the original resource file of the system software is detected and obtained, and the original resource file is saved in the first preset directory; the running resource file of the system software is saved in the second preset directory as a backup resource file; The technical means of replacing the running resource files with the original resource files in the first preset directory solves the problem of flashing the entire image file of the system software, and realizes the user-customized The effect of replacing the system software with the original system software.

实施例二Embodiment two

图2为本发明实施例二提供的一种系统软件的更换方法的流程图,本实施例可适用于对终端设备的系统软件进行更换的情况。本实施例是在实施例一的基础上,对检测并获取系统软件的原始资源文件,并将原始资源文件保存到第一预设目录,以及将运行资源文件替换为第一预设目录中的原始资源文件,作进一步地优化,具体包括如下步骤:FIG. 2 is a flowchart of a method for replacing system software provided by Embodiment 2 of the present invention. This embodiment is applicable to the case of replacing system software of a terminal device. This embodiment is based on the first embodiment to detect and obtain the original resource file of the system software, save the original resource file to the first preset directory, and replace the running resource file with the The original resource file is further optimized, specifically including the following steps:

S210、将系统软件的原始apk文件和原始bin文件保存到Android系统分区,并对原始apk文件和原始bin文件进行打包,以生成系统软件的原始资源文件。S210. Save the original apk file and the original bin file of the system software to the Android system partition, and package the original apk file and the original bin file to generate the original resource file of the system software.

在本方案中,将系统软件的原始apk文件和原始bin文件保存到指定目录下,并对文件进行打包,生成系统软件的原始资源文件的镜像文件,以在后续对智能终端设备的系统软件进行更换。其中,镜像文件指的是跟光盘等载体原本的内容一模一样,即文件结构以及隐藏文件等,甚至包括光盘的加密信息等都可以完整地复制。In this solution, the original apk file and original bin file of the system software are saved in the specified directory, and the files are packaged to generate a mirror image file of the original resource file of the system software, so that the system software of the smart terminal device can be updated later. replace. Among them, the mirror image file refers to exactly the same as the original content of the CD and other carriers, that is, the file structure and hidden files, etc., and even the encrypted information of the CD can be completely copied.

示例性地,将原始的Setting.apk打包到/system/vendor/general/apk/目录下,而将用户定制的Setting.apk打包到/system/app/目录下。同样地,可将原始的logo.bin文件打包到/system/vendor/general/bin/目录下,而将用户定制的logo.bin文件打包到/system/app/目录下。Exemplarily, the original Setting.apk is packaged in the /system/vendor/general/apk/ directory, and the user-customized Setting.apk is packaged in the /system/app/ directory. Similarly, the original logo.bin file can be packed into the /system/vendor/general/bin/ directory, and the user-customized logo.bin file can be packed into the /system/app/ directory.

具体来说,在对智能终端的系统软件进行更新之前,需先对系统软件的资源文件进行打包,示例性地,将用户定制的apk文件拷贝到/system/app/目录下,以及将用户定制的bin文件拷贝到/system/app/目录下。其中,用户定制的bin文件可以为开机音乐、开机动画等。Specifically, before updating the system software of the smart terminal, the resource files of the system software need to be packaged, for example, the user-customized apk file is copied to the /system/app/ directory, and the user-customized Copy the bin file to the /system/app/ directory. Wherein, the bin file customized by the user may be startup music, startup animation, and the like.

其中,可通过RE管理器将用户定制的apk文件拷贝到/system/app/目录下,具体操作:在操作前,将/system/app/目录挂载为可读写;并且,系统软件名不能有中文、空格及其它特殊字符等;如果无法移动,显示空间不足时,可先移动到data/app下,再移动到/system/app/目录下,也可通过删除当前运行的系统软件不需要的部分资源文件。Among them, the user-customized apk file can be copied to the /system/app/ directory through the RE manager. The specific operation: before the operation, mount the /system/app/ directory as readable and writable; and the system software name cannot be There are Chinese characters, spaces and other special characters, etc.; if it cannot be moved, and the display space is insufficient, it can be moved to the data/app first, and then to the /system/app/ directory, or it can be deleted by deleting the currently running system software. part of the resource file.

S220、对与终端设备相关联的移动存储设备进行检测,并判断移动存储设备中是否复制有系统软件的原始资源文件。S220. Detect the mobile storage device associated with the terminal device, and determine whether the original resource file of the system software is copied in the mobile storage device.

具体来说,若在与终端设备相关联的移动存储设备中检测到原始资源文件,执行步骤S230;若未检测到原始资源文件,执行步骤S240。在本方案中,在对智能终端设备相关联的移动存储设备进行检测之前,需先为更换系统软件做准备,比如,通过指令对权限进行管理和分区的读写进行挂载。示例性地,对操作权限的更改,可通过使用bash shell命令运行“chmod 777file”;对分区的读写进行重新挂载,可使用bash shell命令运行“mount-o-remount,rw/system”。同时,为了在资源文件的更换过程中,防止移动存储设备插拔或通信异常导致更换或升级系统软件失败,会提前将原始资源文件拷贝到指定的目录下,而在判断移动存储设备中是否复制有系统软件的原始资源文件之前,会提前为将原始资源文件拷贝到指定的目录下创建文件夹,比如,使用bash shell命令运行“busybox mkdir-p$TEMP_APK”。Specifically, if the original resource file is detected in the mobile storage device associated with the terminal device, perform step S230; if no original resource file is detected, perform step S240. In this solution, before detecting the mobile storage device associated with the smart terminal device, it is necessary to prepare for replacing the system software, for example, to manage permissions and mount partitions for reading and writing through commands. Exemplarily, to change the operating authority, you can use the bash shell command to run "chmod 777file"; to remount the partition for reading and writing, you can use the bash shell command to run "mount-o-remount, rw/system". At the same time, in order to prevent the replacement or upgrade of system software from failure caused by the plugging and unplugging of mobile storage devices or abnormal communication during the replacement of resource files, the original resource files will be copied to the specified directory in advance, and the Before there are original resource files of the system software, a folder will be created for copying the original resource files to the specified directory in advance, for example, use the bash shell command to run "busybox mkdir-p$TEMP_APK".

其中,优先对移动存储设备进行检测,判断是否保存有原始资源文件的镜像文件,是为了节省Android系统本身eMMC(Embedded Multi Media Card)的空间。在系统分区中保存备份数据,明显是会占用一部分eMMC空间,但既为了节省eMMC空间,又能快速替换用户定制的系统软件,可以将系统软件的原始资源文件保存到移动存储设备中。Among them, the mobile storage device is preferentially detected to determine whether the image file of the original resource file is saved, in order to save the space of the eMMC (Embedded Multi Media Card) of the Android system itself. Saving backup data in the system partition obviously takes up part of the eMMC space, but in order to save eMMC space and quickly replace the user-customized system software, the original resource files of the system software can be saved to the mobile storage device.

示例性地,若需要加入A、B、C和D四个用户定制的系统软件,并且每个用户定制的系统软件的备份数据占用100M,则需要耗掉400M的eMMC存储空间。但若将系统软件的备份数据放在移动存储设备中,则只需移动存储设备存储某个用户(例如A用户)的100M即可,而eMMC节省的400M空间,可以留作用户自行使用。Exemplarily, if it is necessary to add four user-customized system software A, B, C and D, and the backup data of each user-customized system software occupies 100M, then 400M eMMC storage space needs to be consumed. However, if the backup data of the system software is placed in a mobile storage device, the mobile storage device only needs to store 100M of a user (such as user A), and the 400M space saved by eMMC can be reserved for the user's own use.

同时,将原始资源文件放在移动存储设备中,可便捷地更新对应的版本。例如,在系统分区中保存某个用户的系统软件(例如A用户)是旧版本,若按正常流程,则会整个系统升级(包括正常数据和对A、B、C和D用户的数据进行备份),才能确保A客户是新版本。若提供移动存储设备的方式,则优先使用移动存储设备的原始资源文件的备份数据(例如A用户的最新版本)用于更换,并且重启整机后,即可使用最新版本。移动存储设备更换后,判断当前A客户的软件为最新,则重新保存当前最新数据到系统分区中。At the same time, the corresponding version can be easily updated by placing the original resource file in the mobile storage device. For example, if the system software of a certain user (for example, user A) is stored in the system partition, it is an old version. If the normal process is followed, the entire system will be upgraded (including normal data and backup data of users A, B, C, and D) ), to ensure that the A client is the new version. If a mobile storage device is provided, the backup data of the original resource file of the mobile storage device (for example, the latest version of user A) is used for replacement, and the latest version can be used after restarting the whole machine. After the mobile storage device is replaced, if it is judged that the current software of customer A is the latest, then the current latest data will be saved in the system partition again.

同时,将系统软件的原始资源文件保存在移动存储设备和系统分区的资源文件是一样的,只是对于系统而言,存储的路径不一样而已。例如:移动存储设备在系统的路径:/mnt/sda1/...;而存储在系统分区:/system/...。At the same time, saving the original resource files of the system software in the mobile storage device is the same as the resource files in the system partition, but the storage path is different for the system. For example: the path of the mobile storage device in the system: /mnt/sda1/...; and the storage in the system partition: /system/....

S230、将原始资源文件保存到第一预设目录。S230. Save the original resource file to a first preset directory.

在本方案中,为了防止在对系统软件进行升级过程中,由于移动存储设备插拔或通信系统导致升级过程失败,先将系统软件的原始资源文件拷贝到/system/tmp目录下,并在完成拷贝后对资源文件进行校验,即对比/system/tmp目录下的资源文件的校验值与移动存储设备中保存的资源文件的校验值是否一致,若校验失败,就默认该资源文件的数据为无效数据,将不对智能终端设备进行系统软件的升级或还原。In this solution, in order to prevent the failure of the upgrade process due to the plugging and unplugging of the mobile storage device or the communication system during the upgrade process of the system software, first copy the original resource files of the system software to the /system/tmp directory, and Verify the resource file after copying, that is, compare whether the verification value of the resource file in the /system/tmp directory is consistent with the verification value of the resource file saved in the mobile storage device. If the verification fails, the resource file will be defaulted The data is invalid, and the system software of the smart terminal device will not be upgraded or restored.

S240、对Android系统分区进行检测,以获取原始资源文件,并保存到第一预设目录。S240. Detect the Android system partition to obtain the original resource file, and save it to the first preset directory.

具体来说,当未在移动存储设备中检测到系统软件的原始资源文件,将对Android系统分区中进行检测,并将检测到的原始资源文件保存到/system/tmp目录下。其中,/system/tmp目录本身就是内存的映射,与读移动存储设备或者读系统分区,本质一样,都是先把内容拷贝到DDR内存。其中,内存是指DDR(Double Data Rate,双倍速率同步动态随机存储器),而并非eMMC。Specifically, when the original resource file of the system software is not detected in the mobile storage device, the Android system partition will be detected, and the detected original resource file will be saved in the /system/tmp directory. Among them, the /system/tmp directory itself is a memory map, which is essentially the same as reading a mobile storage device or reading a system partition. It first copies the content to the DDR memory. Among them, memory refers to DDR (Double Data Rate, double-rate synchronous dynamic random access memory), not eMMC.

其中,不管是在移动存储设备还是系统分区中检测到原始资源文件,均将保存在/system/tmp目录下,一方面,是为了给移动存储设备和系统分区的原始资源文件提供一个统一出口,即,替换系统软件的原始资源文件的入口,并无需关注S250-S280的处理过程;另一方面,防止移动存储设备通信不稳定,以及在通信过程中被意外拔出,从而导致系统软件的更换失败。Among them, whether the original resource files are detected in the mobile storage device or the system partition, they will be saved in the /system/tmp directory. On the one hand, it is to provide a unified export for the original resource files of the mobile storage device and the system partition. That is, to replace the entry of the original resource file of the system software, there is no need to pay attention to the processing process of S250-S280; on the other hand, to prevent the mobile storage device from being unstable in communication and being accidentally pulled out during the communication process, resulting in the replacement of the system software fail.

S250、将系统软件的运行资源文件在第二预设目录保存为备份资源文件;其中,运行资源文件为根据用户对系统的需求而配置的资源文件。S250. Save the running resource file of the system software as a backup resource file in the second preset directory; wherein, the running resource file is a resource file configured according to the user's requirements for the system.

S260、对运行资源文件与第一预设目录中的原始资源文件进行比较分析,并识别提取相同的资源文件。S260. Compare and analyze the running resource file and the original resource file in the first preset directory, and identify and extract the same resource file.

在本方案中,将/system/tmp目录下的原始资源文件与安装有Android系统的智能终端设备所正在运行的系统软件的资源文件进行比对分析,并将两个资源文件中包含的相同文件识别提取出来,以在S280中替换时,将不再对此相同文件进行替换。In this solution, the original resource files in the /system/tmp directory are compared with the resource files of the system software running on the smart terminal device with the Android system installed, and the same files contained in the two resource files are compared and analyzed. When the recognition is extracted for replacement in the S280, the same file will no longer be replaced.

示例性地,假设用户对智能手机的开机音乐以及开机动画进行自行定制,则在智能手机的运行资源文件中包含有Boot Setting文件夹,并在此文件夹下包含有对智能手机的开机音乐和开机动画的相关指令等。但在需要将智能手机的运行资源文件更换为原始资源文件,而原始资源文件中并不需要Boot Setting文件夹。同时,原始资源文件中设有智能手机的默认铃声的相关资源文件,即为Ring文件夹,而运行资源文件中的铃声的文件夹命名为Custom ring,则会将除Boot Setting文件、Ring文件夹和Custom ring文件夹之外的资源文件提取出来,作为相同的资源文件。Exemplarily, assuming that the user customizes the boot music and boot animation of the smart phone, the running resource file of the smart phone contains a Boot Setting folder, and the boot music and boot animation of the smart phone are included in this folder. Instructions related to boot animation, etc. However, it is necessary to replace the running resource file of the smart phone with the original resource file, and the Boot Setting folder is not required in the original resource file. At the same time, the original resource file is provided with the relevant resource file of the default ringtone of the smart phone, which is the Ring folder, and the folder of the ringtone in the running resource file is named Custom ring, and the file except the Boot Setting file and the Ring folder will be deleted. The resource files outside the Custom ring folder are extracted as the same resource files.

S270、从运行资源文件和原始资源文件中剔除相同的资源文件,以分别获取第一资源文件和第二资源文件。S270. Eliminate the same resource file from the running resource file and the original resource file, so as to obtain the first resource file and the second resource file respectively.

具体来说,将运行资源文件和原始资源文件中的相同资源文件去除后,将分别获取Boot Setting文件、Ring文件夹和Custom ring文件夹,其中,Boot Setting文件夹和Custom ring文件夹作为第一资源文件;而Ring文件夹作为第二资源文件。Specifically, after removing the same resource files in the running resource file and the original resource file, the Boot Setting file, the Ring folder, and the Custom ring folder will be obtained respectively, among which the Boot Setting folder and the Custom ring folder are the first Resource file; and the Ring folder as the second resource file.

S280、将第一资源文件更换为第二资源文件。S280. Replace the first resource file with a second resource file.

示例性地,将Boot Setting文件夹以及其文件夹中的相关内容进行删除,同时用Ring文件夹的相关内容替换Custom ring文件夹中的相关内容,同时将文件夹的命名改为Ring文件夹,从而实现了将智能手机的运行资源文件替换为原始资源文件。Exemplarily, delete the Boot Setting folder and its related content, and replace the related content in the Custom ring folder with the related content of the Ring folder, and change the name of the folder to the Ring folder, Thus, the replacement of the running resource file of the smart phone with the original resource file is realized.

本实施例的技术方案,进一步地通过对与终端设备相关联的移动存储设备和系统分区进行检测,以获取系统软件的原始资源文件,并保存到第一预设目录中;将系统软件的运行资源文件在第二预设目录保存为备份资源文件;其中,运行资源文件为根据用户对系统的需求而配置的资源文件;对运行资源文件与第一预设目录中的原始资源文件进行比较分析,并识别提取相同的资源文件;从运行资源文件和原始资源文件中剔除相同的资源文件,以分别获取第一资源文件和第二资源文件;将第一资源文件替换为第二资源文件的技术手段,解决了在系统软件更换过程中,由于移动存储设备插拔或通信异常导致更换失败的问题,从而达到了方便可靠地更换系统软件的目的。The technical solution of this embodiment further detects the mobile storage device and the system partition associated with the terminal device to obtain the original resource file of the system software and save it in the first preset directory; The resource file is saved as a backup resource file in the second preset directory; wherein, the running resource file is a resource file configured according to the user's requirements for the system; the running resource file is compared and analyzed with the original resource file in the first preset directory , and identify and extract the same resource file; remove the same resource file from the running resource file and the original resource file to obtain the first resource file and the second resource file respectively; replace the first resource file with the second resource file technology The method solves the problem that the replacement fails due to the plugging and unplugging of the mobile storage device or abnormal communication during the replacement of the system software, thereby achieving the purpose of convenient and reliable replacement of the system software.

在上述实施例的基础上,将步骤S260、S270和S280分别用以下步骤S261、S271和S281进行替换,如图3所示,具体步骤如下:On the basis of the above embodiments, steps S260, S270 and S280 are replaced by the following steps S261, S271 and S281 respectively, as shown in Figure 3, the specific steps are as follows:

S261、对第一预设目录中的原始资源文件进行校验,并获取原始资源文件对应的第一校验值。S261. Verify the original resource files in the first preset directory, and acquire a first verification value corresponding to the original resource files.

其中,在对MCU系统软件进行升级之前,会先对MCU系统软件的资源文件进行打包处理,以及将打包文件保存到Android系统,并对Android系统进行更换。具体更换步骤可以包括:首先,在接收到触发动态切换用户系统软件的指令或信号时,开始替换或删除Android系统的应用及资源文件,并重启进入到recovery模式,以及开始格式化/data/和/cache分区,最后重新启动Android系统,用户配置加载完成已更换系统软件的资源文件。在完成用户配置加载系统软件的资源文件时,将对MCU系统软件进行资源文件的替换或删除,以实现MCU系统软件的更换。Wherein, before upgrading the MCU system software, the resource files of the MCU system software will be packaged first, and the packaged files will be saved to the Android system, and the Android system will be replaced. The specific replacement steps may include: first, when receiving an instruction or signal that triggers dynamic switching of the user system software, start to replace or delete the application and resource files of the Android system, and restart to enter the recovery mode, and start to format /data/ and /cache partition, and finally restart the Android system, the user configuration is loaded and the resource files of the replaced system software are completed. When the user configures and loads the resource files of the system software, the resource files of the MCU system software will be replaced or deleted to realize the replacement of the MCU system software.

在本方案中,由于终端设备的MCU采用的是STM32芯片,即终端设备的硬件本身就支持CRC32计算。因此,在本方案中,计算获取原始资源文件的校验值时,直接通过CRC32的运算器就可以得到原始资源文件的CRC32校验值,而不需通过软件实现校验值的计算。In this solution, since the MCU of the terminal device uses an STM32 chip, that is, the hardware of the terminal device itself supports CRC32 calculation. Therefore, in this solution, when calculating and obtaining the check value of the original resource file, the CRC32 check value of the original resource file can be obtained directly through the CRC32 calculator, without using software to realize the calculation of the check value.

当然,也可以计算原始资源文件的CRC16校验值,但为了使校验算法的复杂度和精度更好,以及运算效率更高,且本方案采用STM32芯片,将直接通过硬件对原始资源文件的校验值进行计算,以得到原始资源文件的CRC32校验值。Of course, the CRC16 check value of the original resource file can also be calculated, but in order to make the complexity and precision of the check algorithm better, and the calculation efficiency is higher, and this solution uses the STM32 chip, the original resource file will be directly processed through the hardware. The check value is calculated to obtain the CRC32 check value of the original resource file.

具体是,在本方案中,采用配置初始化变量的方法,对系统软件的资源文件进行更换,即根据Android系统发送的当前用户信息,获取第一预设目录中的客户对应的原始资源文件,将待更换的原始资源文件的二进制文件,读到MCU系统内存里,再调用现成的java现成的CRC32类,以得到原始资源文件的CRC32校验值。Specifically, in this solution, the method of configuring initialization variables is used to replace the resource files of the system software, that is, according to the current user information sent by the Android system, the original resource files corresponding to the customers in the first preset directory are obtained, and the The binary file of the original resource file to be replaced is read into the MCU system memory, and then the ready-made java ready-made CRC32 class is called to obtain the CRC32 check value of the original resource file.

其中,由于原始资源文件是由多个数据包组成的,因此,原始资源文件的CRC32校验值可以为整个原始资源文件的检验值,也可为原始资源文件各个数据包的校验值,比如,用户A需要更换的原始资源文件包含4个数据包,则每个数据包均含有一个对应的CRC32校验值,以便于更换数据包时,只需将检验值不同的对应地数据包进行更换即可,而不需将所有的数据包进行更换。Among them, since the original resource file is composed of multiple data packets, the CRC32 check value of the original resource file can be the check value of the entire original resource file, or the check value of each data packet of the original resource file, such as , the original resource file that user A needs to replace contains 4 data packets, and each data packet contains a corresponding CRC32 check value, so that when replacing a data packet, only the corresponding data packets with different check values need to be replaced That is, without replacing all the data packets.

S271、计算并获取运行资源文件对应的第二校验值。S271. Calculate and acquire a second check value corresponding to the running resource file.

同样地,在对MCU系统当前运行的系统软件的资源文件进行校验计算时,直接通过与MCU进行通信,获取当前MCU运行主程序对应的校验值。同样地,运行资源文件对应的第二校验值也为CRC32校验值。Similarly, when performing verification calculation on the resource file of the system software currently running on the MCU system, the verification value corresponding to the main program currently running on the MCU is directly obtained through communication with the MCU. Similarly, the second check value corresponding to the running resource file is also a CRC32 check value.

S281、对第一校验值和第二校验值进行比对,并在第一校验值和第二校验值不同时,通过升级协议将运行资源文件更换为原始资源文件。S281. Compare the first check value with the second check value, and replace the running resource file with the original resource file through an upgrade protocol when the first check value is different from the second check value.

在此需要说明的是,当原始资源文件的第一校验值与运行资源文件的第二校验值不同时,说明终端设备的MCU当前运行的系统软件并非用户对应的版本,需对应进行更换。进一步地,将对原始资源文件的各个数据包进行校验,并和运行资源文件的各个数据包的校验值进行比对分析,将校验值不同的对应的数据包进行更换,而相同的,不需重新更换。What needs to be explained here is that when the first check value of the original resource file is different from the second check value of the running resource file, it means that the system software currently running on the MCU of the terminal device is not the version corresponding to the user, and needs to be replaced accordingly . Further, each data packet of the original resource file will be verified, and compared with the verification value of each data packet of the running resource file, and the corresponding data packets with different verification values will be replaced, while the same , no need to replace.

示例性地,用户A的终端设备原始资源文件包含有a、b、c、d四个数据包,而运行资源文件包含有a1、b1、c1、d1和e1五个数据包。其中,a和a1对应,b和b1对应,c和c1对应,以及d和d1对应,对应表示的是其数据包要实现的功能、作用或者命名相同。并且,只有a和a1数据包对应的校验值相同,其它数据包的检验值都不对应相同,则将b、c、d三个数据包替换b1、c1、d1数据包,且由于原始资源文件中并没有e数据包,则相应地,将运行资源文件中的e1数据包进行删除,从而实现了无需重新更新系统软件,就可以实现系统软件的升级或还原。Exemplarily, the original resource file of user A's terminal device includes four data packets a, b, c, and d, and the running resource file includes five data packets a1, b1, c1, d1, and e1. Among them, a corresponds to a1, b corresponds to b1, c corresponds to c1, and d corresponds to d1, which means that the functions, functions or names to be realized by the data packets are the same. Moreover, only the check values corresponding to the a and a1 data packets are the same, and the check values of other data packets are not corresponding to the same, then the three data packets b, c, and d are replaced with the b1, c1, and d1 data packets, and due to the original resource If there is no e data packet in the file, correspondingly, the e1 data packet in the running resource file is deleted, so that the system software can be upgraded or restored without re-updating the system software.

其中,在本方案中采用固定长度的升级协议,升级协议各个字节表示的含义如表1所示,Among them, a fixed-length upgrade protocol is adopted in this solution, and the meanings of each byte of the upgrade protocol are shown in Table 1.

表1升级协议各个字节的含义信息表Table 1 The meaning information table of each byte of the upgrade protocol

包头Baotou包序号package serial number包标识Package ID校验和checksum数据dataIDIDNUMNUMCMDcmdCRCCRCDATA[0…59]DATA[0...59]

其中,包头ID:当通信采用USB通信时,此ID即为USB描述符里面的Report ID,例如本协议ID=0xFC;NUM为包序号,从0-255循环计数;CMD:传输命令,每个包的标识;CRC:数据的校验和,即DATA[0]+DATA[1]+...+DATA[59]的总和;数据:为60字节,从0-59,记为DATA[0...59],表示的是数据内容。Among them, header ID: when the communication adopts USB communication, this ID is the Report ID in the USB descriptor, such as this protocol ID=0xFC; NUM is the packet sequence number, counting from 0-255 cycle; CMD: transmission command, each Package identification; CRC: data checksum, that is, the sum of DATA[0]+DATA[1]+...+DATA[59]; data: 60 bytes, from 0-59, recorded as DATA[ 0...59], indicating the data content.

示例性地,升级流程具体可包括四个步骤:首先,主机(Android主系统)向从机(待更换的MCU系统)发出一个CMD=UPDATE_START协议包作为升级流程开始的数据包,当从机接收到数据后,将返回一个CMD=UPDATE_ACK协议包作为正常应答信号到主机;然后,主机根据应答信号,发送CMD=UPDATE_SOL协议包作为升级文件总长度的数据包,从机将继续反馈CMD=UPDATE_ACK协议包作为正常应答信号;然后,主机发送CMD=UPDATE_SOD协议包作为升级文件的内容的数据包,从机同样反馈CMD=UPDATE_ACK协议包作为正常应答信息,主机将传输升级文件内容;最后,主机发送CMD=UPDATE_EOT协议包作为发送升级文件内容的数据包,当从机接收到数据包后,将反馈CMD=UPDATE_NAK协议包作为从机已完成升级的信号。Exemplarily, the upgrade process can specifically include four steps: first, the host (Android main system) sends a CMD=UPDATE_START protocol packet to the slave (the MCU system to be replaced) as the data packet that the upgrade process starts, when the slave receives After receiving the data, it will return a CMD=UPDATE_ACK protocol packet as a normal response signal to the host; then, the host will send a CMD=UPDATE_SOL protocol packet as the data packet of the total length of the upgrade file according to the response signal, and the slave will continue to feedback the CMD=UPDATE_ACK protocol packet as a normal response signal; then, the master sends the CMD=UPDATE_SOD protocol packet as the data packet of the content of the upgrade file, and the slave also feeds back the CMD=UPDATE_ACK protocol packet as a normal response message, and the master will transmit the upgrade file content; finally, the master sends CMD The =UPDATE_EOT protocol packet is used as a data packet to send the content of the upgrade file. When the slave receives the data packet, it will feed back the CMD=UPDATE_NAK protocol packet as a signal that the slave has completed the upgrade.

当在升级过程中,可通过容错机制进行处理。具体是,当原始资源文件的长度超过通过升级协议确认的长度,终止将原始资源文件更换为原始资源文件当原始资源文件传输超过通过升级协议确认的最大时长、传输错误、校验错误和/或缺少数据包时,重新传输原始资源文件的数据。During the upgrade process, it can be processed through the fault tolerance mechanism. Specifically, when the length of the original resource file exceeds the length confirmed by the upgrade agreement, stop replacing the original resource file with the original resource file. Retransmits the data of the original resource file when a packet is missing.

示例性地,当在主机发送CMD=UPDATE_SOL协议包作为升级文件总长度的数据包时,但文件长度出错,将终止升级,并从机将返回CMD=UPDATE_CA协议包作为终止升级的信号。Exemplarily, when the master sends the CMD=UPDATE_SOL protocol packet as the data packet of the total length of the upgrade file, but the file length is wrong, the upgrade will be terminated, and the slave will return the CMD=UPDATE_CA protocol packet as a signal to terminate the upgrade.

同样地,在主机发送CMD=UPDATE_SOD协议包作为升级文件的内容的数据包时,由于主机中保存的原始资源文件内容在传输过程中,其传输时长超过升级协议确认的最大时长时,从机将返回CMD=UPDATE_NAK协议包作为超时返回的信号。同时,在原始资源文件的数据包传输错误、校验错误和/或缺少数据包时,从机将返回CMD=UPDATE_SOD协议包作为反馈信号,主机接收到该协议包时,将重新传输该数据包,并且在CMD=UPDATE_SOD协议包包含有传输错误、检验错误和/或缺少的数据包的序号。即,主机根据数据包的序号对对应序号的数据包进行重新传输,并非原始资源文件所有的数据包进行重新传输。Similarly, when the host sends the CMD=UPDATE_SOD protocol packet as the data packet of the content of the upgrade file, because the original resource file content stored in the host is in the process of transmission, when its transmission time exceeds the maximum duration confirmed by the upgrade protocol, the slave will Return the CMD=UPDATE_NAK protocol packet as a signal of timeout return. At the same time, when the data packet transmission error, verification error and/or missing data packet of the original resource file, the slave will return the CMD=UPDATE_SOD protocol packet as a feedback signal, and the master will retransmit the data packet when receiving the protocol packet , and the CMD=UPDATE_SOD protocol packet contains the sequence numbers of transmission errors, verification errors and/or missing data packets. That is, the host retransmits the data packets with the corresponding sequence numbers according to the sequence numbers of the data packets, and retransmits the data packets not owned by the original resource file.

当MCU系统软件的当前运行资源文件更换为原始资源文件时,将重新启动MCU系统,并在完成MCU系统的重新启动后,就可以完成MCU系统软件的更换。When the current running resource file of the MCU system software is replaced with the original resource file, the MCU system will be restarted, and after the restart of the MCU system is completed, the replacement of the MCU system software can be completed.

在本实施例的技术方案中,通过分别获取原始资源文件和运行资源文件各个数据包的校验值,并对其对应的校验值进行比对分析,当各个数据包的校验值不同时,将运行资源文件中校验值不同的数据包更换为原始资源文件对应的数据包,以实现无需将运行资源文件的所有数据包进行更换,就可以完成MCU系统软件版本的更新。In the technical solution of this embodiment, by obtaining the verification values of each data packet of the original resource file and the running resource file respectively, and comparing and analyzing the corresponding verification values, when the verification values of each data packet are different , replacing the data packets with different check values in the running resource file with the corresponding data packets of the original resource file, so as to complete the update of the MCU system software version without replacing all the data packets of the running resource file.

实施例三Embodiment Three

图4为本发明实施例三提供的一种系统软件的更换方法的流程图,如图4所示,该系统软件的更换方法具体包括如下步骤:Fig. 4 is a flow chart of a method for replacing system software provided by Embodiment 3 of the present invention. As shown in Fig. 4, the method for replacing system software specifically includes the following steps:

S310、初始化系统软件的原始资源文件以及环境。S310. Initialize the original resource file and environment of the system software.

其中,可通过对操作权限的更改和分区的读写挂载来对系统软件的原始资源文件以及环境进行初始化。当然,在本方案中对操作权限的更改和分区的读写挂载可通过shell脚本来实现。示例性地,使用bash shell命令运行“chmod 777 file”,可实现对操作权限的更改;使用bash shell命令运行“mount-oremount,rw/system”,实现重新挂载分区。Among them, the original resource files of the system software and the environment can be initialized by changing the operation authority and reading and writing the partition. Of course, in this solution, the change of the operating authority and the read-write mounting of the partition can be realized through shell scripts. For example, use the bash shell command to run "chmod 777 file" to change the operating authority; use the bash shell command to run "mount-oremount,rw/system" to remount the partition.

S320、检测U盘general file是否存在系统软件的原始资源文件,若存在有原始资源文件,将执行步骤S350;若不存在原始资源文件,将执行步骤S330。S320. Detect whether the original resource file of the system software exists in the general file of the U disk. If there is an original resource file, step S350 will be executed; if there is no original resource file, step S330 will be executed.

具体来说,在本方案中,假设移动存储设备为U盘,但对此并不进行限定。同时,U盘中的文件夹的命名也是假设为general file,并不仅仅限定与此,只有该文件夹中包含有系统软件的原始资源文件即可。Specifically, in this solution, it is assumed that the mobile storage device is a USB flash drive, but this is not limited. At the same time, the name of the folder in the U disk is also assumed to be general file, which is not limited to this, as long as the folder contains the original resource files of the system software.

S330、检测系统分区system/vendor是否存在系统软件的原始资源文件。S330. Detect whether the original resource file of the system software exists in the system partition system/vendor.

若存在原始资源文件,将执行步骤S350;若不存在原始资源文件,将执行步骤S340。If there is an original resource file, step S350 will be executed; if there is no original resource file, step S340 will be executed.

S340、终止一键更换系统软件。S340, terminating the one-key system software replacement.

S350、将系统软件的原始资源文件复制到/system/tmp目录。S350. Copy the original resource file of the system software to the /system/tmp directory.

S360、将/system/app.bin等资源进行备份,并保存到/system/vendor目录。S360. Back up resources such as /system/app.bin and save them in the /system/vendor directory.

S370、使用/system/tmp目录下的资源文件,把/system/app.bin等资源文件进行替换或删除。S370. Use resource files in the /system/tmp directory to replace or delete resource files such as /system/app.bin.

S380、对替换后的系统软件的资源文件进行权限管理,并清除/data/和/system/tmp/目录下的相关资源文件。S380. Perform permission management on resource files of the replaced system software, and clear related resource files in /data/ and /system/tmp/ directories.

S390、重新启动智能终端设备的系统。S390. Restart the system of the smart terminal device.

本实施例的技术方案,通过对U盘和系统分区进行检测,以获取系统软件的原始资源文件,并复制到/system/tmp目录;并将/system/tmp目录下的资源文件,把/system/app.bin等资源文件进行替换或删除,并重新对系统软件的资源文件进行权限管理和清除,实现了对安装有Android系统的智能终端设备的系统软件的一键更换。The technical solution of this embodiment, by detecting the U disk and the system partition, to obtain the original resource file of the system software, and copy it to the /system/tmp directory; and copy the resource file under the /system/tmp directory to /system Resource files such as /app.bin are replaced or deleted, and the resource files of the system software are re-managed and cleared, realizing the one-key replacement of the system software of the smart terminal device installed with the Android system.

实施例四Embodiment Four

图5为本发明实施例四提供的一种系统软件的更换装置的结构示意图,本实施例可适用于对系统软件进行更换的情况,该装置可采用软件和/或硬件的方式来实现,如图5所示,该系统软件的更换装置具体包括:检测获取模块410,保存模块420和替换模块430。Fig. 5 is a schematic structural diagram of a device for replacing system software provided by Embodiment 4 of the present invention. This embodiment is applicable to the situation of replacing system software, and the device can be realized by means of software and/or hardware, such as As shown in FIG. 5 , the system software replacement device specifically includes: a detection and acquisition module 410 , a storage module 420 and a replacement module 430 .

其中,检测获取模块410,用于检测并获取系统软件的原始资源文件,并将原始资源文件保存到第一预设目录;Wherein, the detection and acquisition module 410 is used to detect and acquire the original resource file of the system software, and save the original resource file to the first preset directory;

保存模块420,用于将系统软件的运行资源文件在第二预设目录保存为备份资源文件;其中,运行资源文件为根据用户对系统的需求而配置的资源文件;The saving module 420 is used to save the running resource file of the system software in the second preset directory as a backup resource file; wherein, the running resource file is a resource file configured according to the user's requirements for the system;

更换模块430,用于将运行资源文件更换为第一预设目录中的原始资源文件。A replacement module 430, configured to replace the running resource file with the original resource file in the first preset directory.

本实施例的技术方案,通过检测并获取系统软件的原始资源文件,并将原始资源文件保存到第一预设目录;将系统软件的运行资源文件在第二预设目录保存为备份资源文件;将运行资源文件替换为第一预设目录中的原始资源文件的技术手段,需对系统软件的整块镜像文件进行刷写的问题,实现了无需重新升级系统软件即可将用户定制的系统软件更换为原始系统软件的效果。In the technical solution of this embodiment, the original resource file of the system software is detected and obtained, and the original resource file is saved in the first preset directory; the running resource file of the system software is saved in the second preset directory as a backup resource file; The technical means of replacing the running resource files with the original resource files in the first preset directory requires flashing the entire image file of the system software, which realizes the system software customized by the user without re-upgrading the system software. Effect of replacing with original system software.

进一步地,该系统软件的更换装置还包括:Further, the replacement device of the system software also includes:

原始资源文件生成模块440,用于将系统软件的原始apk文件和原始bin文件保存到Android系统分区,并对原始apk文件和原始bin文件进行打包,以生成系统软件的原始资源文件。The original resource file generation module 440 is used to save the original apk file and the original bin file of the system software to the Android system partition, and package the original apk file and the original bin file to generate the original resource file of the system software.

进一步地,检测获取模块410,包括:Further, the detection and acquisition module 410 includes:

判断单元411,用于对与终端设备相关联的移动存储设备进行检测,并判断移动存储设备中是否复制有系统软件的原始资源文件;The judging unit 411 is configured to detect the mobile storage device associated with the terminal device, and judge whether the original resource file of the system software is copied in the mobile storage device;

第一保存单元412,用于若检测到原始资源文件,将原始资源文件保存到第一预设目录;The first saving unit 412 is configured to save the original resource file to a first preset directory if the original resource file is detected;

第二保存单元413,用于若未检测到原始资源文件,对Android系统分区进行检测,以获取原始资源文件,并保存到第一预设目录。The second saving unit 413 is configured to detect the Android system partition if the original resource file is not detected, so as to obtain the original resource file, and save it to the first preset directory.

进一步地,更换模块430,包括:Further, replacing the module 430 includes:

比较分析单元431,用于对运行资源文件与第一预设目录中的原始资源文件进行比较分析,并识别提取相同的资源文件;A comparison and analysis unit 431, configured to compare and analyze the running resource file and the original resource file in the first preset directory, and identify and extract the same resource file;

获取单元432,用于从运行资源文件和原始资源文件中剔除相同的资源文件,以分别获取第一资源文件和第二资源文件;The obtaining unit 432 is configured to remove the same resource file from the running resource file and the original resource file, so as to obtain the first resource file and the second resource file respectively;

更换单元433,用于将第一资源文件更换为第二资源文件。A replacing unit 433, configured to replace the first resource file with the second resource file.

进一步地,更换模块中的比较分析单元、获取单元和更换单元可分别对应的用第一校验单元、第二校验单元和对比更换单元进行替换。Further, the comparison and analysis unit, the acquisition unit and the replacement unit in the replacement module can be replaced with the first verification unit, the second verification unit and the comparison replacement unit respectively.

其中,第一校验单元,用于对第一预设目录中的原始资源文件进行校验,并获取原始资源文件对应的第一校验值;Wherein, the first verification unit is configured to verify the original resource files in the first preset directory, and obtain the first verification value corresponding to the original resource files;

第二校验单元,用于计算并获取运行资源文件对应的第二校验值;The second verification unit is used to calculate and obtain the second verification value corresponding to the running resource file;

对比更换单元,用于对第一校验值和第二校验值进行比对,并在第一校验值和第二校验值不同时,通过升级协议将运行资源文件更换为原始资源文件。The comparison and replacement unit is used to compare the first check value with the second check value, and replace the running resource file with the original resource file through the upgrade protocol when the first check value and the second check value are different .

上述系统软件的更换装置可执行本发明任意实施例所提供的系统软件的更换方法,具备执行方法相应的功能模块和有益效果。The system software replacement device described above can execute the system software replacement method provided by any embodiment of the present invention, and has corresponding functional modules and beneficial effects for executing the method.

实施例五Embodiment five

图6为本发明实施例五提供的一种终端设备的结构示意图。图6示出了适于用来实现本发明实施方式的示例性计算机设备512的框图。图6显示的计算机设备512仅仅是一个示例,不应对本发明实施例的功能和使用范围带来任何限制。FIG. 6 is a schematic structural diagram of a terminal device provided by Embodiment 5 of the present invention. FIG. 6 shows a block diagram of an exemplary computer device 512 suitable for use in implementing embodiments of the invention. The computer device 512 shown in FIG. 6 is only an example, and should not limit the functions and scope of use of this embodiment of the present invention.

如图6所示,计算机设备512以通用计算设备的形式表现。计算机设备512的组件可以包括但不限于:一个或者多个处理器或者处理单元516,系统存储器528,连接不同系统组件(包括系统存储器528和处理单元516)的总线518。As shown in FIG. 6, computer device 512 takes the form of a general-purpose computing device. Components of computer device 512 may include, but are not limited to, one or more processors or processing units 516, system memory 528, bus 518 connecting various system components including system memory 528 and processing unit 516.

总线518表示几类总线结构中的一种或多种,包括存储器总线或者存储器控制器,外围总线,图形加速端口,处理器或者使用多种总线结构中的任意总线结构的局域总线。举例来说,这些体系结构包括但不限于工业标准体系结构(ISA)总线,微通道体系结构(MAC)总线,增强型ISA总线、视频电子标准协会(VESA)局域总线以及外围组件互连(PCI)总线。Bus 518 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus structures. These architectures include, by way of example, but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect ( PCI) bus.

计算机设备512典型地包括多种计算机系统可读介质。这些介质可以是任何能够被计算机设备512访问的可用介质,包括易失性和非易失性介质,可移动的和不可移动的介质。Computer device 512 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by computing device 512 and include both volatile and nonvolatile media, removable and non-removable media.

系统存储器528可以包括易失性存储器形式的计算机系统可读介质,例如随机存取存储器(RAM)530和/或高速缓存存储器532。计算机设备512可以进一步包括其它可移动/不可移动的、易失性/非易失性计算机系统存储介质。仅作为举例,存储系统534可以用于读写不可移动的、非易失性磁介质(图6未显示,通常称为“硬盘驱动器”)。尽管图6中未示出,可以提供用于对可移动非易失性磁盘(例如“软盘”)读写的磁盘驱动器,以及对可移动非易失性光盘(例如CD-ROM,DVD-ROM或者其它光介质)读写的光盘驱动器。在这些情况下,每个驱动器可以通过一个或者多个数据介质接口与总线518相连。系统存储器528可以包括至少一个程序产品,该程序产品具有一组(例如至少一个)程序模块,这些程序模块被配置以执行本发明各实施例的功能。System memory 528 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 530 and/or cache memory 532 . Computer device 512 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 534 may be used to read and write to non-removable, non-volatile magnetic media (not shown in FIG. 6, commonly referred to as a "hard drive"). Although not shown in FIG. 6, a disk drive for reading and writing to removable nonvolatile disks (e.g., "floppy disks") may be provided, as well as for removable nonvolatile optical disks (e.g., CD-ROM, DVD-ROM). or other optical media) CD-ROM drive. In these cases, each drive may be connected to bus 518 through one or more data media interfaces. System memory 528 may include at least one program product having a set (eg, at least one) of program modules configured to perform the functions of various embodiments of the present invention.

具有一组(至少一个)程序模块542的程序/实用工具540,可以存储在例如系统存储器528中,这样的程序模块542包括——但不限于——操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。程序模块542通常执行本发明所描述的实施例中的功能和/或方法。Programs/utilities 540 may be stored, for example, in system memory 528 as a set (at least one) of program modules 542 including - but not limited to - an operating system, one or more application programs, other Program modules, as well as program data, each or some combination of these examples may include implementations of network environments. Program modules 542 generally perform the functions and/or methodologies of the described embodiments of the invention.

计算机设备512也可以与一个或多个外部设备514(例如键盘、指向设备、显示器524等)通信,还可与一个或者多个使得用户能与该计算机设备512交互的设备通信,和/或与使得该计算机设备512能与一个或多个其它计算设备进行通信的任何设备(例如网卡,调制解调器等等)通信。这种通信可以通过输入/输出(I/O)接口522进行。并且,计算机设备512还可以通过网络适配器520与一个或者多个网络(例如局域网(LAN),广域网(WAN)和/或公共网络,例如因特网)通信。如图所示,网络适配器520通过总线518与计算机设备512的其它模块通信。应当明白,尽管图中未示出,可以结合计算机设备512使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理单元、外部磁盘驱动阵列、RAID系统、磁带驱动器以及数据备份存储系统等。The computer device 512 may also communicate with one or more external devices 514 (e.g., a keyboard, pointing device, display 524, etc.), and with one or more devices that enable a user to interact with the computer device 512, and/or with Any device (eg, network card, modem, etc.) that enables the computing device 512 to communicate with one or more other computing devices. Such communication may occur through input/output (I/O) interface 522 . Also, the computer device 512 can also communicate with one or more networks (eg, a local area network (LAN), a wide area network (WAN), and/or a public network, such as the Internet) through a network adapter 520 . As shown, network adapter 520 communicates with other modules of computer device 512 over bus 518 . It should be appreciated that although not shown, other hardware and/or software modules may be used in conjunction with computer device 512, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives And data backup storage system, etc.

处理单元516通过运行存储在系统存储器528中的程序,从而执行各种功能应用以及数据处理,例如实现本发明实施例所提供的一种系统软件的更换方法,包括:The processing unit 516 executes various functional applications and data processing by running the programs stored in the system memory 528, for example, implementing a method for replacing system software provided by an embodiment of the present invention, including:

检测并获取系统软件的原始资源文件,并将原始资源文件保存到第一预设目录;Detect and obtain the original resource file of the system software, and save the original resource file to the first preset directory;

将系统软件的运行资源文件在第二预设目录保存为备份资源文件;其中,运行资源文件为根据用户对系统的需求而配置的资源文件;saving the running resource file of the system software in the second preset directory as a backup resource file; wherein, the running resource file is a resource file configured according to the user's requirements for the system;

将运行资源文件更换为第一预设目录中的原始资源文件。Replace the running resource file with the original resource file in the first preset directory.

实施例六Embodiment six

本发明实施例六还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如本申请所有发明实施例提供的一种系统软件的更换方法,包括:Embodiment 6 of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, a system software replacement method as provided in all invention embodiments of the present application is implemented, including:

检测并获取系统软件的原始资源文件,并将原始资源文件保存到第一预设目录;Detect and obtain the original resource file of the system software, and save the original resource file to the first preset directory;

将系统软件的运行资源文件在第二预设目录保存为备份资源文件;其中,运行资源文件为根据用户对系统的需求而配置的资源文件;saving the running resource file of the system software in the second preset directory as a backup resource file; wherein, the running resource file is a resource file configured according to the user's requirements for the system;

将运行资源文件更换为第一预设目录中的原始资源文件。Replace the running resource file with the original resource file in the first preset directory.

本发明实施例的计算机存储介质,可以采用一个或多个计算机可读的介质的任意组合。计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质。计算机可读存储介质例如可以是--但不限于--电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本文件中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。The computer storage medium in the embodiments of the present invention may use any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the above. More specific examples (non-exhaustive list) of computer readable storage media include: electrical connections with one or more leads, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), Erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。A computer readable signal medium may include a data signal carrying computer readable program code in baseband or as part of a carrier wave. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. .

计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括——但不限于无线、电线、光缆、RF等等,或者上述的任意合适的组合。Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including - but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

可以以一种或多种程序设计语言或其组合来编写用于执行本发明操作的计算机程序代码,所述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for carrying out the operations of the present invention may be written in one or more programming languages, or combinations thereof, including object-oriented programming languages—such as Java, Smalltalk, C++, and conventional Procedural Programming Language - such as "C" or a similar programming language. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In cases involving a remote computer, the remote computer can be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as through an Internet service provider). Internet connection).

注意,上述仅为本发明的较佳实施例及所运用技术原理。本领域技术人员会理解,本发明不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本发明的保护范围。因此,虽然通过以上实施例对本发明进行了较为详细的说明,但是本发明不仅仅限于以上实施例,在不脱离本发明构思的情况下,还可以包括更多其他等效实施例,而本发明的范围由所附的权利要求范围决定。Note that the above are only preferred embodiments of the present invention and applied technical principles. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the protection scope of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and can also include more other equivalent embodiments without departing from the concept of the present invention, and the present invention The scope is determined by the scope of the appended claims.

Claims (10)

Translated fromChinese
1.一种系统软件的更换方法,其特征在于,包括:1. A method for replacing system software, comprising:检测并获取系统软件的原始资源文件,并将所述原始资源文件保存到第一预设目录;Detecting and obtaining the original resource file of the system software, and saving the original resource file to a first preset directory;将系统软件的运行资源文件在第二预设目录保存为备份资源文件;其中,所述运行资源文件为根据用户对系统的需求而配置的资源文件;saving the running resource file of the system software as a backup resource file in a second preset directory; wherein, the running resource file is a resource file configured according to the user's requirements for the system;将所述运行资源文件更换为所述第一预设目录中的原始资源文件。The running resource file is replaced with the original resource file in the first preset directory.2.根据权利要求1所述的方法,其特征在于,在所述检测并获取系统软件的原始资源文件,并将所述原始资源文件保存到第一预设目录之前,还包括:2. The method according to claim 1, further comprising:将系统软件的原始apk文件和原始bin文件保存到Android系统分区,并对所述原始apk文件和所述原始bin文件进行打包,以生成系统软件的原始资源文件。The original apk file and the original bin file of the system software are saved to the Android system partition, and the original apk file and the original bin file are packaged to generate the original resource file of the system software.3.根据权利要求1所述的方法,其特征在于,所述检测并获取系统软件的原始资源文件,并将所述原始资源文件保存到第一预设目录,包括:3. The method according to claim 1, wherein the detecting and obtaining the original resource file of the system software, and saving the original resource file to the first preset directory comprises:对与终端设备相关联的移动存储设备进行检测,并判断所述移动存储设备中是否复制有系统软件的原始资源文件;Detecting the mobile storage device associated with the terminal device, and judging whether the original resource file of the system software is copied in the mobile storage device;若检测到所述原始资源文件,将所述原始资源文件保存到第一预设目录;If the original resource file is detected, saving the original resource file to a first preset directory;若未检测到所述原始资源文件,对Android系统分区进行检测,以获取所述原始资源文件,并保存到第一预设目录。If the original resource file is not detected, the Android system partition is detected to obtain the original resource file and saved to the first preset directory.4.根据权利要求1所述的方法,其特征在于,所述将所述运行资源文件更换为所述第一预设目录中的原始资源文件,包括:4. The method according to claim 1, wherein the replacing the running resource file with the original resource file in the first preset directory comprises:对所述运行资源文件与所述第一预设目录中的原始资源文件进行比较分析,并识别提取相同的资源文件;comparing and analyzing the running resource file and the original resource file in the first preset directory, and identifying and extracting the same resource file;从所述运行资源文件和所述原始资源文件中剔除所述相同的资源文件,以分别获取第一资源文件和第二资源文件;Excluding the same resource file from the running resource file and the original resource file to obtain a first resource file and a second resource file respectively;将所述第一资源文件更换为所述第二资源文件。Replace the first resource file with the second resource file.5.根据权利要求1所述的方法,其特征在于,所述将所述运行资源文件替换为所述第一预设目录中的原始资源文件,包括:5. The method according to claim 1, wherein the replacing the running resource file with the original resource file in the first preset directory comprises:对所述第一预设目录中的原始资源文件进行校验,并获取所述原始资源文件对应的第一校验值;Verifying the original resource files in the first preset directory, and acquiring a first verification value corresponding to the original resource files;计算并获取所述运行资源文件对应的第二校验值;Calculating and acquiring a second check value corresponding to the running resource file;对所述第一校验值和所述第二校验值进行比对,并在所述第一校验值和所述第二校验值不同时,通过升级协议将所述运行资源文件更换为所述原始资源文件。comparing the first check value with the second check value, and replacing the running resource file through an upgrade protocol when the first check value is different from the second check value for the original resource file.6.根据权利要求5所述的方法,其特征在于,所述通过升级协议将所述运行资源文件更换为所述原始资源文件,包括:6. The method according to claim 5, wherein the replacing the running resource file with the original resource file through an upgrade protocol comprises:当所述原始资源文件的长度超过通过所述升级协议确认的长度,终止将所述原始资源文件更换为所述原始资源文件;When the length of the original resource file exceeds the length confirmed by the upgrade agreement, stop replacing the original resource file with the original resource file;当所述原始资源文件传输超过通过所述升级协议确认的最大时长、传输错误、校验错误和/或缺少数据包时,重新传输所述原始资源文件的数据。When the transmission of the original resource file exceeds the maximum duration confirmed by the upgrade protocol, a transmission error, a verification error and/or a data packet is missing, the data of the original resource file is retransmitted.7.一种系统软件的更换装置,其特征在于,包括:7. A system software replacement device, characterized in that it comprises:检测获取模块,用于检测并获取系统软件的原始资源文件,并将所述原始资源文件保存到第一预设目录;A detection and acquisition module, configured to detect and acquire the original resource file of the system software, and save the original resource file to the first preset directory;保存模块,用于将系统软件的运行资源文件在第二预设目录保存为备份资源文件;其中,所述运行资源文件为根据用户对系统的需求而配置的资源文件;The saving module is used to save the running resource file of the system software in the second preset directory as a backup resource file; wherein, the running resource file is a resource file configured according to the user's requirements for the system;替换模块,用于将所述运行资源文件替换为所述第一预设目录中的原始资源文件。A replacement module, configured to replace the running resource file with the original resource file in the first preset directory.8.根据权利要求7所述的装置,其特征在于,还包括:8. The device according to claim 7, further comprising:原始资源文件生成模块,用于将系统软件的原始apk文件和原始bin文件保存到Android系统分区,并对所述原始apk文件和原始bin文件进行打包,以生成系统软件的原始资源文件。The original resource file generation module is used to save the original apk file and the original bin file of the system software to the Android system partition, and package the original apk file and the original bin file to generate the original resource file of the system software.9.一种终端设备,其特征在于,所述设备包括:9. A terminal device, characterized in that the device comprises:一个或多个处理器;one or more processors;存储器,用于存储一个或多个程序;memory for storing one or more programs;当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-6中任一所述的系统软件的更换方法。When the one or more programs are executed by the one or more processors, the one or more processors are made to implement the system software replacement method according to any one of claims 1-6.10.一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现如权利要求1-6中任一所述的系统软件的更换方法。10. A computer-readable storage medium, on which a computer program is stored, wherein when the program is executed by a processor, the system software replacement method according to any one of claims 1-6 is realized.
CN201810240841.8A2018-03-222018-03-22System software replacing method and device, terminal equipment and storage mediumActiveCN108509215B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201810240841.8ACN108509215B (en)2018-03-222018-03-22System software replacing method and device, terminal equipment and storage medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201810240841.8ACN108509215B (en)2018-03-222018-03-22System software replacing method and device, terminal equipment and storage medium

Publications (2)

Publication NumberPublication Date
CN108509215Atrue CN108509215A (en)2018-09-07
CN108509215B CN108509215B (en)2022-03-29

Family

ID=63378111

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201810240841.8AActiveCN108509215B (en)2018-03-222018-03-22System software replacing method and device, terminal equipment and storage medium

Country Status (1)

CountryLink
CN (1)CN108509215B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN110096293A (en)*2019-04-302019-08-06上海睿赛德电子科技有限公司A kind of general Bootloader implementation method based on STM32 with OTA upgrade function
CN110580169A (en)*2019-08-162019-12-17深圳市同洲电子股份有限公司method for copying and rewriting android system through USB storage equipment
CN110673827A (en)*2019-08-272020-01-10广州视源电子科技股份有限公司 Resource calling method and device based on Android system, and electronic device
CN110865796A (en)*2019-09-292020-03-06深圳市火乐科技发展有限公司Software customization method and device for projection equipment
CN111240738A (en)*2020-01-202020-06-05北京无限光场科技有限公司File processing method, device, equipment and medium
CN113852717A (en)*2021-09-272021-12-28努比亚技术有限公司Wallpaper module position migration method and device and computer-readable storage medium
CN115268792A (en)*2022-08-022022-11-01亿咖通(湖北)技术有限公司Vehicle machine repartitioning method and device, vehicle machine and storage medium

Citations (13)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101377744A (en)*2008-09-242009-03-04深圳华为通信技术有限公司Method and apparatus for recovering terminal equipment software upgrade
CN101409074A (en)*2008-11-242009-04-15杭州鑫方软件有限公司Method for updating embedded speech identification system function
CN102360299A (en)*2011-09-302012-02-22奇智软件(北京)有限公司Software system resetting method, server and client
CN102650947A (en)*2012-04-012012-08-29广东欧珀移动通信有限公司Continuous increment over-the-air upgrade method of Android handheld equipment
CN102802083A (en)*2012-08-242012-11-28乐视网信息技术(北京)股份有限公司Set top box updating method based on Android system and set top box
US20130125107A1 (en)*2011-11-112013-05-16Wyse Technology Inc.Robust firmware update with recovery logic
WO2013138895A1 (en)*2012-03-222013-09-26Irdeto Canada CorporationUpdating software components
CN105824722A (en)*2016-03-182016-08-03苏州三星电子电脑有限公司Backup restoring system for computer cloud
CN106155729A (en)*2015-04-212016-11-23阿里巴巴集团控股有限公司The hot update method of Lua script, Apparatus and system
CN106528086A (en)*2016-10-102017-03-22广州视源电子科技股份有限公司Method and system for upgrading Android software
CN106911502A (en)*2017-02-222017-06-30烽火通信科技股份有限公司A kind of upgrade method and system of intelligent home gateway equipment
US20170325056A1 (en)*2016-05-092017-11-09Rapidsos, Inc.Systems and methods for emergency communications
CN107783778A (en)*2017-10-302018-03-09厦门亿联网络技术股份有限公司A kind of method for updating increment of feature based value look-up table

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101377744A (en)*2008-09-242009-03-04深圳华为通信技术有限公司Method and apparatus for recovering terminal equipment software upgrade
CN101409074A (en)*2008-11-242009-04-15杭州鑫方软件有限公司Method for updating embedded speech identification system function
CN102360299A (en)*2011-09-302012-02-22奇智软件(北京)有限公司Software system resetting method, server and client
US20130125107A1 (en)*2011-11-112013-05-16Wyse Technology Inc.Robust firmware update with recovery logic
WO2013138895A1 (en)*2012-03-222013-09-26Irdeto Canada CorporationUpdating software components
CN102650947A (en)*2012-04-012012-08-29广东欧珀移动通信有限公司Continuous increment over-the-air upgrade method of Android handheld equipment
CN102802083A (en)*2012-08-242012-11-28乐视网信息技术(北京)股份有限公司Set top box updating method based on Android system and set top box
CN106155729A (en)*2015-04-212016-11-23阿里巴巴集团控股有限公司The hot update method of Lua script, Apparatus and system
CN105824722A (en)*2016-03-182016-08-03苏州三星电子电脑有限公司Backup restoring system for computer cloud
US20170325056A1 (en)*2016-05-092017-11-09Rapidsos, Inc.Systems and methods for emergency communications
CN106528086A (en)*2016-10-102017-03-22广州视源电子科技股份有限公司Method and system for upgrading Android software
CN106911502A (en)*2017-02-222017-06-30烽火通信科技股份有限公司A kind of upgrade method and system of intelligent home gateway equipment
CN107783778A (en)*2017-10-302018-03-09厦门亿联网络技术股份有限公司A kind of method for updating increment of feature based value look-up table

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
CHEN QI: ""crsync-基于rsync rolling算法的文件增量更新"", 《HTTPS://GIST.GITHUB.COM/9468305/FA8F1307EA4738225FCA》*
YANG YANAN等: ""An Incremental Updating Algorithm for Sequence Patterns Based on Improved PrefixSpan"", 《2017 9TH INTERNATIONAL CONFERENCE ON INTELLIGENT HUMAN-MACHINE SYSTEMS AND CYBERNETICS》*

Cited By (11)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN110096293A (en)*2019-04-302019-08-06上海睿赛德电子科技有限公司A kind of general Bootloader implementation method based on STM32 with OTA upgrade function
CN110580169A (en)*2019-08-162019-12-17深圳市同洲电子股份有限公司method for copying and rewriting android system through USB storage equipment
CN110673827A (en)*2019-08-272020-01-10广州视源电子科技股份有限公司 Resource calling method and device based on Android system, and electronic device
CN110673827B (en)*2019-08-272022-12-20广州视源电子科技股份有限公司 Android system-based resource calling method, device, and electronic equipment
CN110865796A (en)*2019-09-292020-03-06深圳市火乐科技发展有限公司Software customization method and device for projection equipment
CN110865796B (en)*2019-09-292023-07-25深圳市火乐科技发展有限公司Software customization method and device for projection equipment
CN111240738A (en)*2020-01-202020-06-05北京无限光场科技有限公司File processing method, device, equipment and medium
CN111240738B (en)*2020-01-202023-11-21北京有竹居网络技术有限公司 Document processing methods, devices, equipment and media
CN113852717A (en)*2021-09-272021-12-28努比亚技术有限公司Wallpaper module position migration method and device and computer-readable storage medium
CN113852717B (en)*2021-09-272024-03-19努比亚技术有限公司Wallpaper module position migration method, equipment and computer readable storage medium
CN115268792A (en)*2022-08-022022-11-01亿咖通(湖北)技术有限公司Vehicle machine repartitioning method and device, vehicle machine and storage medium

Also Published As

Publication numberPublication date
CN108509215B (en)2022-03-29

Similar Documents

PublicationPublication DateTitle
CN108509215B (en)System software replacing method and device, terminal equipment and storage medium
KR101143112B1 (en)Applying custom software image updates to non-volatile storage in a failsafe manner
US10303459B2 (en)Electronic system with update control mechanism and method of operation thereof
CN103365696B (en)BIOS image file acquisition methods and device
CN109710317B (en) System startup method, device, electronic device and storage medium
CN114868117B (en)Peer-to-peer storage device messaging over control bus
CN102841802B (en) Software upgrade method for mobile terminal
CN103150231A (en) Computer boot method and computer system
CN111813428A (en)Method and device for upgrading terminal firmware, electronic equipment and storage medium
CN105786542A (en)Intelligent device and system update method of the intelligent device
US9218249B2 (en)Electronic apparatus, method of restoring guid partition table (GPT) and computer-readable recording medium
CN105159703B (en)The method and system of factory reset
CN115951949A (en) Method, device and computing device for recovering configuration parameters of BIOS
CN111459524A (en)Software upgrading method, device and system
WO2024148863A1 (en)Image compiling method and apparatus, nonvolatile readable storage medium, and electronic device
CN104216771A (en)Restarting method and device for software program
US11231940B2 (en)System and method for automatic recovery of information handling systems
WO2021129331A1 (en)Control method and control device for enabling operations of application program in multiple systems
WO2022242665A1 (en)Data storage method and related device
CN110399168A (en) System startup method, device and equipment for multi-data disk storage server
US10572166B1 (en)Firmware download for a solid state storage card
US20150212866A1 (en)Management system for service of multiple operating environments, and methods thereof
CN118796288A (en) Method, device, computer equipment and storage medium for performing hardware initialization operation
CN100478887C (en)Veneer software memory method and system
US20250252188A1 (en)Firmware update method for embedded device, and embedded device

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp