Disclosure of Invention
The technical problem to be solved by the present invention is to provide a system upgrading method, a storage medium and a terminal device, aiming at solving the problem that an upgrading program or a system start program may be abnormal after upgrading is interrupted due to an abnormal condition in the upgrading process of the terminal device in the prior art.
In order to achieve the purpose, the invention adopts the following technical scheme:
in a first aspect, an embodiment of the present invention provides a system upgrade method, which is applied to a terminal device, where the terminal device is configured with first system data and second system data, and the method includes:
reading data header information of target system data, wherein the target system data is first system data or second system data;
checking the integrity of the data header information;
and selecting system data to be updated from the first system data and the second system data according to the integrity, and upgrading the system data to be updated.
As a further improved technical solution, the selecting system data to be updated from the first system data and the second system data according to the integrity, and the updating the system data to be updated specifically includes:
selecting system data to be updated from the first system data and the second system data according to the integrity;
and acquiring upgrading data corresponding to the system data to be updated, and upgrading the system data to be updated based on the acquired upgrading data.
As a further improved technical solution, the selecting, according to the integrity, system data to be updated from the first system data and the second system data specifically includes:
when the target system data is complete data, reading an identifier corresponding to the target system data, wherein the identifier comprises an updating identifier and a loading identifier;
and when the mark corresponding to the read target system data is the updating mark, the target system data corresponding to the updating mark is the system data to be updated.
As a further improved technical solution, before selecting the system data to be updated from the first system data and the second system data according to the integrity and upgrading the system data to be updated, the method further includes:
and selecting system data to be loaded from the first system data and the second system data according to the integrity, and loading the system data to be loaded to start the system.
As a further improved technical solution, the selecting, according to the integrity, system data to be updated from the first system data and the second system data, and after the updating the system data to be updated, further includes:
and modifying the identifier corresponding to the target system data into a loading identifier.
As a further improved technical solution, the first system data is stored in a first storage area, and the second system data is stored in a second storage area.
As a further improved solution, the first system header information and the second system header information are stored in a third storage area.
As a further improved technical solution, the identifier is a storage area address corresponding to the target system data.
In a second aspect, the present invention provides a computer-readable storage medium storing one or more programs, which are executable by one or more processors to implement the steps in the system upgrade method as described in any one of the above.
In a third aspect, an embodiment of the present invention provides a terminal device, which includes: a processor and memory and a communication bus; the memory has stored thereon a computer readable program executable by the processor;
the communication bus realizes connection communication between the processor and the memory;
the processor, when executing the computer readable program, implements the steps in the system upgrade method as described in any one of the above.
Has the advantages that: compared with the prior art, the invention provides a system upgrading method, a storage medium and a terminal device, which are applied to the terminal device, wherein the terminal device is configured with first system data and second system data, and the method comprises the following steps: reading data header information of target system data, wherein the target system data is first system data or second system data; checking the integrity of the data header information; and selecting system data to be updated from the first system data and the second system data according to the integrity, and upgrading the system data to be updated. The invention ensures that the data loaded by the system is complete, the other system data is the system data to be updated, the system data to be updated is loaded and used when the next start is carried out after the system data to be updated is successfully updated, and if the update fails, the other complete data can be normally started, thereby avoiding the problem that the terminal equipment cannot be used due to the failure of the system update in the prior art and improving the stability of the update process.
Detailed Description
The present invention provides a system upgrade method, a storage medium and a terminal device, and in order to make the objects, technical solutions and effects of the present invention clearer and clearer, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
The invention will be further explained by the description of the embodiments with reference to the drawings.
The embodiment provides a system upgrade method, which is applied to a terminal device, where the terminal device is configured with first system data and second system data, as shown in fig. 1, the method includes:
s100, reading data header information of target system data, wherein the target system data is first system data or second system data.
Specifically, the system data is stored in advance in emmc (embedded multimediacard), nand flash and other storage devices, which can be read and written without losing power-down data, so as to ensure that the data system data is not lost and can be updated or modified.
In this embodiment, the data header information of the preset system data is read by a boot loader, where the boot loader is a first section of code executed by the embedded system after power-up, and after the boot loader completes initialization of the CPU and related hardware, the boot loader loads an operating system image or a cured embedded application program into the memory and then jumps to a space where the operating system is located, so as to start the operating system to run.
In this embodiment, the system data burned in the terminal device includes two sets of system data, the two sets of system data are completely consistent during initialization, and subsequent system operation or update is performed on the basis of the two sets of system data. If the data of one part is incomplete due to update failure, the system can also operate by using the data of the other part, and update or repair the incomplete data. That is, when the system is booted up at any one time, the data of the two operating systems may be consistent or different, and optionally, one of the operating systems is updated in version compared with the other operating system.
In this embodiment, the target system data is preconfigured with an identifier, that is, the first system data and the second system data are both configured with identifiers, and the identifier may change correspondingly with each upgrade, and in practical applications, the identifier includes an update identifier and a load identifier (the update identifier may be 1, and the load identifier may be 2).
And S200, verifying the integrity of the data header information.
In this embodiment, the first system data and the second system data are stored in different areas, specifically, the first system data is stored in a first storage area, and the second system data is stored in a second storage area. Each system data includes a data header of the data, a Bootloader and other data of the system. When reading the header information of two pieces of data, the Bootloader needs to obtain the header information from different areas. It should be noted that the header information of the first system and the second system is stored in the third storage area, so that the Bootloader can directly obtain the header information of the two pieces of data from the third storage area when reading the header information of the two pieces of data. It should be noted that, when the system data to be updated is updated, the header information of the system data to be updated is also changed accordingly. The invention also ensures the stability of the upgrading process by verifying the integrity of the data header information.
S300, selecting system data to be updated from the first system data and the second system data according to the integrity, and upgrading the system data to be updated.
In this embodiment, the situation that both the system data are incomplete does not occur. Therefore, when one system data is incomplete, the system can be loaded by the other system data, and the stability of the upgrading process is guaranteed.
In an implementation manner of this embodiment, the selecting, according to the integrity, system data to be updated from the first system data and the second system data, and upgrading the system data to be updated specifically includes:
s301, selecting system data to be updated from the first system data and the second system data according to the integrity;
s302, obtaining upgrading data corresponding to the system data to be updated, and upgrading the system data to be updated based on the obtained upgrading data.
In this embodiment, the upgrading method of the system is performed by OTA, and in practical application, the terminal device sends a request to the server to obtain upgrading data corresponding to the current system (system data to be updated), and then upgrades the system data to be updated according to the obtained upgrading data. Therefore, the embodiment of the invention upgrades in a differential mode, only the differential part of data is needed to be upgraded, but not the whole data to be updated, so that the quick upgrade can be realized, and meanwhile, the influence of the erasing chip on the service life of the single equipment is also reduced.
Further, when the mark corresponding to the read target system data is an update mark, the target system data corresponding to the update mark is system data to be updated. It should be noted that, after the update and upgrade are completed, the identifier corresponding to the target system data is modified into a loading identifier.
Further, the identifier of the data to be updated is the address of the storage area of the system data, for example, when the system data to be updated is the first system data, and the storage area is the first storage area, the address of the first storage area is directly sent to the processor, and the processor can find the system data that needs to be updated according to the address.
In practical application, before selecting the system data to be updated from the first system data and the second system data according to the integrity and upgrading the system data to be updated, the method further includes: and selecting system data to be loaded from the first system data and the second system data according to the integrity, and loading the system data to be loaded to start the system.
In this embodiment, the current boot mode may be determined by Bootloader, where the boot mode includes two types, one type is a boot mode, that is, a normal boot operation of the device. The other is an upgrade mode, i.e., a mode in which the system restarts after the system data is updated. In this embodiment, Bootloader may determine which mode is currently through system history information.
Further, if the current starting mode is the upgrading mode, the identifier of the data to be updated is sent to a processor of the system, and the processor finishes upgrading the data of the system to be updated.
In this embodiment, the identifier of the system data to be updated may be A, B or other letters or other symbols with identifiers, and after receiving the identifier, the processor can determine which system data needs to be updated according to the correspondence between the pre-stored identifier and the data, and then perform the update operation.
And when the upgrading is successful, restarting the system, so that the system executes the steps again, and loading the upgraded system data to realize the upgrading of the system.
In summary, compared with the prior art, the embodiment of the invention has the following advantages:
the invention discloses a system upgrading method, which is applied to terminal equipment, wherein the terminal equipment is configured with first system data and second system data, and the method comprises the following steps: reading data header information of target system data, wherein the target system data is first system data or second system data; checking the integrity of the data header information; and selecting system data to be updated from the first system data and the second system data according to the integrity, and upgrading the system data to be updated. The invention ensures that the data loaded by the system is complete, the other system data is the system data to be updated, the system data to be updated is loaded and used when the next start is carried out after the system data to be updated is successfully updated, and if the update fails, the other complete data can be normally started, thereby avoiding the problem that the terminal equipment cannot be used due to the failure of the system update in the prior art and improving the stability of the update process. Meanwhile, the size of the upgrade package is greatly reduced by a differential upgrade mode, so that the fast upgrade and the fast start are realized, and the erasing pressure of the memory chip is reduced.
Based on the system upgrading method, the present invention further provides a computer-readable storage medium, where one or more programs are stored, and the one or more programs are executable by one or more processors (in this embodiment, the processor 11) to implement the steps in the upgrading method of the present invention, specifically, as described in the foregoing method.
Based on the system upgrade method, the present invention further provides a terminal device, as shown in fig. 2, where the terminal device 100 includes a processor 11 and a memory 22 connected to the processor 11, and fig. 2 only shows some components of the terminal device 100, but it should be understood that not all of the shown components are required to be implemented, and more or fewer components may be implemented instead.
The memory 22 may be an internal storage unit of the terminal device 100 in some embodiments, such as a memory of the terminal device 100. The memory 22 may also be an external storage device of the terminal device 100 in other embodiments, such as a plug-in usb disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the terminal device 100. Further, the memory 22 may also include both an internal storage unit and an external storage device of the terminal device 100. The memory 22 is used for storing application software installed in the terminal device 100 and various data, such as an upgrade program code of the desktop starter. The memory 22 may also be used to temporarily store data that has been output or is to be output. In an embodiment, the memory 22 stores an upgrade program of the desktop launcher, and the upgrade program of the desktop launcher can be executed by the processor 11, so as to implement the upgrade method in the present application, specifically the method described above.
The processor 11 may be, in some embodiments, a Central Processing Unit (CPU), a microprocessor, a mobile phone baseband processor or other data Processing chip, and is configured to run program codes stored in the memory 22 or process data, for example, execute the upgrading method, and the like, as described in the above method.
Those skilled in the art will appreciate that fig. 2 is a block diagram of only a portion of the structure associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, and that a particular terminal device may include more or less components than those shown, or may have some components combined, or may have a different arrangement of components. The steps of the system upgrade method described above are implemented when the processor executes the computer program, which is specifically described above.
Of course, it will be understood by those skilled in the art that all or part of the processes of the methods of the above embodiments may be implemented by a computer program instructing relevant hardware (such as a processor, a controller, etc.), and the program may be stored in a computer readable storage medium, and when executed, the program may include the processes of the above method embodiments. The storage medium may be a memory, a magnetic disk, an optical disk, etc.
It is to be understood that the invention is not limited to the examples described above, but that modifications and variations may be effected thereto by those of ordinary skill in the art in light of the foregoing description, and that all such modifications and variations are intended to be within the scope of the invention as defined by the appended claims.