CN114443083B - System upgrading method and device, electronic equipment and storage medium - Google Patents

System upgrading method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114443083B
CN114443083B CN202110779177.6A CN202110779177A CN114443083B CN 114443083 B CN114443083 B CN 114443083B CN 202110779177 A CN202110779177 A CN 202110779177A CN 114443083 B CN114443083 B CN 114443083B
Authority
CN
China
Prior art keywords
data
upgrade
upgrading
address
difference
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.)
Active
Application number
CN202110779177.6A
Other languages
Chinese (zh)
Other versions
CN114443083A (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.)
Honor Device Co Ltd
Original Assignee
Honor Device 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 Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202110779177.6A priority Critical patent/CN114443083B/en
Publication of CN114443083A publication Critical patent/CN114443083A/en
Application granted granted Critical
Publication of CN114443083B publication Critical patent/CN114443083B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Abstract

The application provides a system upgrading method, a system upgrading device, electronic equipment and a storage medium, which relate to the technical field of upgrading, and the specific scheme comprises the following steps: acquiring an ith upgrade package of a system to be upgraded, acquiring first difference data from a temporary file in a mounting state and acquiring original data of a source version from a user read-only space; obtaining second difference data according to all the first difference data, the original data of the source version and the ith upgrade package, and storing the second difference data into a temporary file; responding to a restart instruction, and starting a system to be upgraded according to all the difference data in the temporary file and the original data of the source version; responding to the successful start of the system to be upgraded, writing all the difference data in the temporary file into a user read-only space, combining all the difference data and the original data of the source version into target data of the system to be upgraded, wherein the target data points to the target version of the system to be upgraded, restarting and upgrading a plurality of upgrade packages at one time is realized, the time consumption is reduced, and the upgrade efficiency is improved.

Description

System upgrading method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of upgrade technologies, and in particular, to a method and an apparatus for upgrading a system, an electronic device, and a storage medium.
Background
The storage space of the electronic equipment comprises a user read-only space and a user space, the user space can adopt a single partition, part of the space in the user read-only space can adopt a single partition or a double partition, the user read-only space adopts the single partition when the electronic equipment runs, for the electronic equipment with the structure, the system upgrading method can upgrade a system to be upgraded according to a snapshot mechanism, one upgrade package corresponds to one temporary file, and the electronic equipment is restarted after the difference data corresponding to the upgrade package is written in the temporary file. If the electronic equipment needs to execute multiple reboots for upgrading the plurality of upgrading packages, time consumption is increased due to the fact that the electronic equipment restarts the system to be upgraded for multiple times, and upgrading efficiency is reduced.
Disclosure of Invention
The system upgrading method, the device, the electronic equipment and the storage medium solve the problem of low upgrading efficiency caused by repeated restarting and upgrading of a plurality of upgrading packages.
In order to achieve the purpose, the following technical scheme is adopted in the application:
in a first aspect, the present application provides a system upgrade method, including: the method comprises the steps of obtaining an ith upgrade package of a system to be upgraded, obtaining first difference data from a temporary file in a mounting state and obtaining original data of a source version from a user read-only space, wherein each first difference data is used for indicating data with difference between two adjacent versions in all the versions, all the versions are versions appearing before the version corresponding to the ith upgrade package, and i is a natural number greater than or equal to 2; obtaining second difference data according to all the first difference data, the original data of the source version and the ith upgrade package, and storing the second difference data into a temporary file, wherein the second difference data is used for indicating the difference between the ith upgrade package and the (i-1) th upgrade package; responding to a restart instruction, and starting the system to be upgraded according to all the difference data in the temporary file and the original data of the source version; and responding to the successful start of the system to be upgraded, writing all the difference data in the temporary file into the user read-only space, combining all the difference data and the original data of the source version into target data of the system to be upgraded, and pointing the target data to the target version of the system to be upgraded.
According to the system upgrading method provided by the application, before the electronic equipment responds to the restart instruction, the difference data corresponding to the plurality of upgrading packets, such as the difference data from the 1 st upgrading packet to the difference data from the ith upgrading packet, are stored in the temporary file. When the electronic equipment responds to the restart instruction and verifies that the system to be upgraded is successfully started, the electronic equipment can write all the difference data in the temporary file into the user read-only space, all the difference data written into the user read-only space and the original data of the source version in the user read-only space can be combined into target data of the system to be upgraded, and the target data point to the target version of the system to be upgraded, so that the target version of the system to be upgraded is stored in the user read-only space, a plurality of upgrade packages are restarted and upgraded at one time, time consumption is reduced, and upgrade efficiency is improved. The differential data of the ith upgrading packet can be obtained according to the data corresponding to the previous version, the ith upgrading packet is obtained on the basis of the previous version, the second differential data of the ith upgrading packet is obtained by taking the data corresponding to the previous version as the reference, the accuracy of the differential data can be ensured, and the processing of the upgrading packet cannot be interrupted due to the fact that the differential data are not written in the user read-only space when the electronic equipment takes the data corresponding to the previous version as the reference, so that time consumption can be reduced, and upgrading efficiency can be improved.
In a first possible implementation manner, the obtaining second difference data according to all the first difference data, the original data of the source version, and the ith upgrade package, and storing the second difference data in a temporary file includes: according to all the first difference data, the original data of the source version and each piece of upgrading data in the ith upgrading packet, carrying out differential reduction processing on each piece of upgrading data to obtain second difference data corresponding to each piece of upgrading data; temporarily storing second difference data corresponding to each piece of upgrading data into a user space; and responding to a restoration processing completion instruction, and storing the second difference data in the user space into the temporary file.
In this embodiment, before storing the difference data in the temporary file, the electronic device temporarily stores the difference data in the user space, so as to avoid the data in the temporary file from being replaced, ensure that the read data is correct when the upgrade data is subjected to differential reduction, and improve the reduction accuracy. The difference data of the plurality of upgrade packages can share one temporary file, the number of the temporary files in the electronic equipment is reduced, and when the difference data of any upgrade package is stored in the temporary file, the difference data with differences can be written into the temporary file, so that the data volume written in the temporary file is reduced. After the electronic equipment completes the differential restoration processing of the plurality of upgrading packets, the upgrading of the system to be upgraded is completed by executing one-time restarting operation, and the differential restoration processing of the plurality of upgrading packets can not interrupt the processing of the upgrading packets because no differential data is written in the user read-only space, so that the time consumption can be reduced, and the upgrading efficiency can be improved.
In a second possible implementation manner, the obtaining second difference data according to all the first difference data, the original data of the source version, and the ith upgrade package, and storing the second difference data in a temporary file includes: determining a specific address set of the ith upgrading packet according to the address of each piece of upgrading data in the ith upgrading packet, wherein each address in the specific address set is an address of any two pieces of upgrading data, and the source address of one piece of upgrading data is coincident with the target address of the other piece of upgrading data; acquiring data corresponding to each address in the specific address set from all the first difference data and the original data, and temporarily storing each address and the data corresponding to each address into a user space; according to all the first difference data, the data in the user space, the original data of the source version and each piece of upgrading data in the ith upgrading packet, carrying out differential reduction processing on each piece of upgrading data to obtain second difference data corresponding to each piece of upgrading data; and storing the second difference data into the temporary file.
In this embodiment, the electronic device temporarily stores each address in the specific address set and data corresponding to each address in the user space in advance, and when the upgrade package is subjected to differential restoration processing, if data in the addresses needs to be used, the data can be read from the user space, even if the data is written in the addresses, correct data can be read from the user space, the restoration accuracy is improved, and the amount of data temporarily stored in the user space is reduced compared with the amount of temporarily stored differential data. And the electronic equipment can be directly written into the temporary file after obtaining the second difference data, so that the process of moving from the user space to the temporary file is omitted, and the processing efficiency is improved.
For example, the upgrade data includes: data a with source addresses of 1 to 5 and destination addresses of 1 to 8, data B with source addresses of 6 to 12 and destination addresses of 50 to 70, and the destination address of data a coincides with the source address of data B, data corresponding to addresses 6 to 8 can be temporarily stored in the user space. After the differential reduction processing is performed on the data a, the data in the addresses 6 to 8 are modified, but the electronic device may read the data of the addresses 6 to 8 that are not modified (i.e., the data written in the previous version) from the user space, and then perform the differential reduction processing on the data B by using the data that are not modified.
With reference to the second possible implementation manner, in a possible implementation manner, the method further includes: sequencing each piece of upgrade data in the ith upgrade package according to a first sequencing condition and a second sequencing condition to obtain a sequencing result of the ith upgrade package, wherein the first sequencing condition indicates that the sequencing of the upgrade data corresponding to the specific address set is before other upgrade data, and the second sequencing condition indicates that the write operation of the address in the specific address set as a target address is later than the read operation of the address as a source address; the performing differential reduction processing on each piece of upgrade data according to all the first difference data, the data in the user space, the original data of the source version, and each piece of upgrade data in the ith upgrade package to obtain second difference data corresponding to each piece of upgrade data includes: and according to the sequencing result of the ith upgrading packet, carrying out differential reduction processing on each piece of upgrading data according to all the first difference data, the data in the user space, the original data of the source version and each piece of upgrading data in the ith upgrading packet so as to obtain second difference data corresponding to each piece of upgrading data.
In this embodiment, the electronic device performs differential restoration processing on each upgrade data of the ith upgrade package according to the sorting result of the ith upgrade package, so that the differential restoration processing of the ith upgrade package is an ordered processing process.
With reference to the second possible implementation manner, in another possible implementation manner, the method further includes: determining first type data and second type data from data temporarily stored in a user space according to a sequencing result, keeping the first type data in the user space, and deleting the second type data from the user space; the first type data indicates that writing data in the address of the first type data affects other data to read data from the address of the first type data, and the second type data indicates that writing data in the address corresponding to the second type data does not affect other data to read data from the address of the second type data.
In this embodiment, the electronic device may classify the data temporarily stored in the user space, and delete the second type of data from the user space, so as to further reduce the amount of data temporarily stored in the user space. With the upgrade data as well: for example, the source address is data a with 1 to 5 and the destination address is data a with 1 to 8, the source address is data B with 6 to 12 and the destination address is data B with 50 to 70, according to the sorting result, the data B is sorted before the data a, the corresponding electronic device will read the data from the addresses 6 to 8 to perform differential reduction processing on the data B, and then write the addresses 6 to 8 as the destination addresses into the differential reduction result of the data a, so that when the sorting result is used to perform differential reduction processing on the data a and the data B, even if the data corresponding to the addresses 6 to 8 are not temporarily stored in the user space, the differential data of the data a and the data B can be correctly reduced. Also for example, the upgrade data includes: data C with source addresses of 50 to 70 and destination addresses of 9 to 12, the data C being ordered before the data B. The electronic equipment reads data from the source addresses 50 to 70, and obtains data written into the target addresses 9 to 12 according to the data in the source addresses 50 to 70; and then the electronic equipment reads data from the source addresses 6 to 12 again, because the data C has written data in the address 12 when being subjected to the differential reduction processing, the data in the address 12 is changed before the data is read from the address 12, if the data in the address 12 is not temporarily stored before the 2 nd upgrade package is subjected to the differential reduction processing, the situation that the original data of the address 12 cannot be read exists, and on the basis of the situation, the electronic equipment temporarily stores the data in the address 12 into the user space, the data in the address 12 is the second type of data, and the data in the addresses 6 to 8 is the first type of data, and through the division, the efficiency and the accuracy are improved, and meanwhile, the data amount temporarily stored in the user space is reduced.
In a third possible implementation manner, the obtaining second difference data according to all the first difference data, the original data of the source version, and the ith upgrade package, and storing the second difference data in a temporary file includes: sequencing each piece of upgrading data according to the address of each piece of upgrading data in the ith upgrading packet to obtain a sequencing result, sequencing the upgrading data with the same address before the upgrading data without the same address by using the sequencing result, wherein the upgrading data with the same address is the upgrading data to which the source address and the target address are superposed, the source address and the target address are positioned in different upgrading data, and the sequencing of the different upgrading data with the same address is that the writing operation of the address as the target address is later than the reading operation of the address as the source address; according to the sorting result, all the first difference data, the original data of the source version and each piece of upgrading data in the ith upgrading packet, carrying out differential reduction processing on each piece of upgrading data to obtain second difference data corresponding to each piece of upgrading data; and storing the second difference data into the temporary file.
With reference to the third possible implementation manner, in one possible implementation manner, the method further includes: determining specific type upgrading data from the upgrading data of the ith upgrading packet, and temporarily storing data written in a source address and a source address of the specific type upgrading data into a user space; the upgrade data of a specific type indicates that writing data in the target address of the upgrade data affects data reading of source addresses of other upgrade data, and the data written in the source address of the upgrade data of a specific type is acquired from the temporary file and the user read-only space.
In this embodiment, the electronic device sequences the upgrade data in the ith upgrade package, and if there is no data that may affect data reading of source addresses of other upgrade data, the electronic device does not need to temporarily store the data in the user space, and if there is data that may affect data reading of source addresses of other upgrade data, the electronic device temporarily stores the data in the user space.
In a fourth possible implementation manner, the obtaining second difference data according to all the first difference data, the original data of the source version, and the ith upgrade package, and storing the second difference data in a temporary file includes: acquiring data corresponding to each source address from all the first difference data and the original data, and temporarily storing the data corresponding to each source address and each source address into a user space; performing differential reduction processing on each piece of upgrade data according to the first difference data, the original data of the source version, the data in the user space and each piece of upgrade data in the ith upgrade package to obtain second difference data corresponding to each piece of upgrade data; and storing the second difference data into the temporary file.
In this embodiment, the electronic device reads data of all source addresses from the temporary file and the user read-only space and temporarily stores the data in the user space. If the temporary file is read first, if the temporary file is not read from the user read-only space any more; and then the electronic equipment performs differential restoration processing on the upgrade package by using the data temporarily stored in the user space. Although the amount of data temporarily stored in the user space is increased relative to the data corresponding to the temporary storage partial address, the amount of data is still reduced to some extent relative to the temporary storage difference data.
In a fifth possible implementation manner, the method further includes: the method further comprises the following steps: analyzing the ith upgrade package to determine the size of a temporary file, and creating a second temporary file according to the size of the temporary file; the storing the second difference data into a temporary file comprises: storing the second difference data into the second temporary file, controlling the second temporary file to be in a mount state, storing the first difference data into a first temporary file in the mount state, wherein the number of the first temporary file is related to the number of all versions, and the temporary files comprise the first temporary file and the second temporary file.
With reference to the first possible implementation manner to the fifth possible implementation manner, the obtaining, according to all the first difference data, the original data of the source version, and the ith upgrade package, second difference data includes: if the upgrade data of the ith upgrade package simultaneously comprises a source address and a target address, reading data from all the first difference data and the original data according to the source address, and carrying out differential reduction processing on difference results in the upgrade data to obtain data to be written in the target address; if the upgrading data of the ith upgrading packet comprises a target address and no zero clearing operation is performed, writing the upgrading data into the target address; and if the upgrade data of the ith upgrade package comprises a target address but has zero clearing operation, writing zero into the target address.
In this embodiment, the electronic device uses a multi-level mounting technology, each upgrade package corresponds to one temporary file, and the difference data of each upgrade package is stored in the corresponding temporary file, which, compared to the above implementation manner, increases the storage space occupied by the difference data, but achieves the purpose of independently storing the difference data of the upgrade package.
In a second aspect, the present application provides an electronic device comprising: one or more processors, memory; wherein the memory is configured to store one or more computer program codes comprising computer instructions that, when executed by the one or more processors, cause the electronic device to perform the system upgrade method described above.
In a third aspect, the present application provides a system upgrade apparatus, including: a processing unit and a storage unit for storing one or more programs; the processing unit is configured to execute the one or more programs; the one or more programs include instructions for performing the system upgrade method described above. The processing unit and the storage unit can be two functional units in a processor of the electronic device, the storage unit in the processor is used for storing programs, and the processing unit in the processor executes the programs to realize the system upgrading method.
In a fourth aspect, the present application provides a computer storage medium, which may include computer instructions, which, when run on an electronic device, cause the electronic device to perform the above system upgrade method.
In a fifth aspect, the present application provides a computer program product, which when run on a computer, causes the computer to perform the above system upgrade method.
In a sixth aspect, the present application provides a system upgrade method, including: acquiring a 1 st upgrade package of a system to be upgraded, and acquiring original data of a source version from a user read-only space; obtaining difference data of the 1 st upgrade package according to the original data of the source version and the 1 st upgrade package, and writing the difference data of the 1 st upgrade package into a temporary file in a mount state, wherein the difference data is used for indicating data with difference between a version corresponding to the 1 st upgrade package and the source version; acquiring a 2 nd upgrade package of the system to be upgraded, acquiring the difference data from the temporary file in the mounting state and acquiring original data of a source version from a user read-only space; obtaining difference data of the 2 nd upgrade package according to the difference data, the original data of the source version and the 2 nd upgrade package, and storing the difference data of the 2 nd upgrade package into a temporary file, wherein the difference data of the 2 nd upgrade package is used for indicating the difference between the version corresponding to the 2 nd upgrade package and the version corresponding to the 1 st upgrade package; responding to a restart instruction, and starting the system to be upgraded according to the difference data of the 1 st upgrade package, the difference data of the 2 nd upgrade package and the original data of the source version; and responding to the successful start of the system to be upgraded, writing the difference data of the 1 st upgrade package and the difference data of the 2 nd upgrade package into the user read-only space, combining the difference data of the 1 st upgrade package, the difference data of the 2 nd upgrade package and the original data of the source version into target data of the system to be upgraded, and pointing the target data to the target version of the system to be upgraded.
In this embodiment, after the electronic device obtains the 1 st upgrade package and the 2 nd upgrade package of the system to be upgraded, and after the differential reduction processing of the 1 st upgrade package is completed, the electronic device may obtain the difference data of the 1 st upgrade package from the temporary file and obtain the original data of the source version from the user read-only space, and perform the differential reduction processing on the 2 nd upgrade package by using these data as reference data, so that the differential reduction processing may be performed on the 2 nd upgrade package even if the electronic device is not restarted. And after the differential reduction processing of the 2 nd upgrade package is completed, the restarting operation is executed to determine whether the electronic equipment can be successfully started when the system to be upgraded of the version 2 (the version corresponding to the 2 nd upgrade package) is operated, and if the system to be upgraded can be successfully started, the system to be upgraded is determined to be upgraded to the version 2, so that the electronic equipment completes the upgrading of the system to be upgraded by executing the restarting operation once, the time consumption can be reduced, and the upgrading efficiency can be improved.
If the electronic device further obtains the 3 rd upgrade package, even the 4 th upgrade package, and so on when obtaining the 1 st upgrade package and the 2 nd upgrade package, the electronic device may refer to the 2 nd upgrade package differential restoration processing mode to perform differential restoration processing on the 3 rd upgrade package and the 4 th upgrade package. And after the differential reduction processing is carried out on the last obtained upgrading packet, a restarting operation is carried out to complete the jump upgrading of the system to be upgraded.
In a seventh aspect, an electronic device is provided, which includes: one or more processors, memory; wherein the memory is configured to store one or more computer program codes comprising computer instructions that, when executed by the one or more processors, cause the electronic device to perform the system upgrade method described above.
It should be appreciated that the description of technical features, solutions, benefits, or similar language in this application does not imply that all of the features and advantages may be realized in any single embodiment. Rather, it is to be understood that the description of a feature or advantage is intended to include the specific features, aspects or advantages in at least one embodiment. Therefore, the descriptions of technical features, technical solutions or advantages in the present specification do not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions and advantages described in the present embodiments may also be combined in any suitable manner. One skilled in the relevant art will recognize that an embodiment may be practiced without one or more of the specific features, aspects, or advantages of a particular embodiment. In other instances, additional features and advantages may be recognized in certain embodiments that may not be present in all embodiments.
Drawings
Fig. 1 is a first diagram illustrating a composition example of an electronic device provided in the present application;
fig. 2 is a diagram illustrating a software structure of an electronic device according to the present application;
FIG. 3 is a diagram illustrating a system upgrade method provided in the related art;
FIG. 4 is a schematic diagram of an upgrade order triggering instruction provided in the present application;
FIG. 5 is a first schematic diagram illustrating a system upgrade method provided in the present application;
FIG. 6 is a first flowchart illustrating a system upgrade method provided in the present application;
fig. 7 is a schematic diagram of a system upgrade method provided in the present application;
fig. 8 is a third schematic diagram of a system upgrade method provided in the present application;
fig. 9 is a schematic diagram of a system upgrade method provided in the present application;
fig. 10 is a schematic diagram of a system upgrade method provided in the present application.
Detailed Description
The terms "first", "second" and "third", etc. in the description and claims of this application and the description of the drawings are used for distinguishing between different objects and not for limiting a particular order.
In the embodiments of the present application, words such as "exemplary" or "for example" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "such as" is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the word "exemplary" or "such as" is intended to present concepts related in a concrete fashion.
For clarity and conciseness of the following description of the various embodiments, a brief introduction to related technologies and terminology is first given:
in response, indicating the condition or state on which the performed operation depends, when the dependent condition or state is satisfied, the performed operation or operations may be in real-time or with a set delay; there is no restriction on the order of execution of the operations performed unless otherwise specified.
The system upgrading method of the electronic equipment is improved at present, the electronic equipment can be mobile phones, tablet computers, desktop computers, laptop computers, notebook computers, ultra-mobile Personal computers (UMPCs), handheld computers, netbooks, personal Digital Assistants (PDAs), wearable electronic equipment, smart watches and other equipment, and the specific form of the electronic equipment is not particularly limited.
In this embodiment, the electronic device may be configured as shown in fig. 1, and may include a processor 110, an external memory interface 120, an internal memory 121, a Universal Serial Bus (USB) interface 130, an antenna 1, an antenna 2, a mobile communication module 140, a wireless communication module 150, and a display screen 160.
It is to be understood that the illustrated structure of the present embodiment does not constitute a specific limitation to the electronic device. In other embodiments, an electronic device may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Processor 110 may include one or more processing units, such as: the processor 110 may include an Application Processor (AP), a modem processor, a Graphics Processing Unit (GPU), an Image Signal Processor (ISP), a controller, a video codec, a Digital Signal Processor (DSP), a baseband processor, and/or a neural-Network Processing Unit (NPU), etc. The different processing units may be separate devices or may be integrated into one or more processors. For example, in the present application, the processor 110 may obtain an upgrade package of the system to be upgraded, and upgrade the system to be upgraded to a target version corresponding to the upgrade package.
A memory may also be provided in processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that have just been used or recycled by the processor 110. If the processor 110 needs to use the instruction or data again, it can be called directly from memory. Avoiding repeated accesses reduces the latency of the processor 110, thereby increasing the efficiency of the system.
In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (I2C) interface, an integrated circuit built-in audio (I2S) interface, a Pulse Code Modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a general-purpose input/output (GPIO) interface, a Subscriber Identity Module (SIM) interface, and/or a Universal Serial Bus (USB) interface, and the functions of these interfaces are not described in detail.
The USB interface 130 is an interface conforming to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, or the like. The USB interface 130 may be used to connect a charger to charge the electronic device, and may also be used to transmit data between the electronic device and a peripheral device, for example, the electronic device may obtain an upgrade package of a system to be upgraded by using the USB interface 130. And the method can also be used for connecting a headset and playing audio through the headset. The interface may also be used to connect other electronic devices, such as AR devices and the like.
The wireless communication function of the electronic device may be implemented by the antenna 1, the antenna 2, the mobile communication module 140, the wireless communication module 150, the modem processor, the baseband processor, and the like.
The antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in an electronic device may be used to cover a single or multiple communication bands. Different antennas can also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed as a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
The mobile communication module 140 may provide a solution including 2G/3G/4G/5G wireless communication applied on the electronic device. The mobile communication module 140 may include at least one filter, a switch, a power amplifier, a Low Noise Amplifier (LNA), and the like. The mobile communication module 140 may receive the electromagnetic wave from the antenna 1, filter, amplify, etc. the received electromagnetic wave, and transmit the filtered electromagnetic wave to the modem processor for demodulation. The mobile communication module 140 may also amplify the signal modulated by the modem processor, and convert the signal into electromagnetic wave through the antenna 1 to radiate the electromagnetic wave. In some embodiments, at least some of the functional modules of the mobile communication module 140 may be disposed in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 140 may be provided in the same device as at least some of the modules of the processor 110.
The modem processor may include a modulator and a demodulator. The modulator is used for modulating a low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used for demodulating the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then passes the demodulated low frequency baseband signal to a baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then transferred to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 4. In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be provided in the same device as the mobile communication module 140 or other functional modules, independent of the processor 110.
The wireless communication module 150 may provide solutions for wireless communication applied to electronic devices, including Wireless Local Area Networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global Navigation Satellite Systems (GNSS), frequency Modulation (FM), near Field Communication (NFC), infrared (IR), and the like. The wireless communication module 150 may be one or more devices integrating at least one communication processing module. The wireless communication module 150 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering on electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 150 may also receive a signal to be transmitted from the processor 110, perform frequency modulation and amplification on the signal, and convert the signal into electromagnetic waves through the antenna 2 to radiate the electromagnetic waves.
In some embodiments, antenna 1 of the electronic device is coupled to the mobile communication module 140 and antenna 2 is coupled to the wireless communication module 150 so that the electronic device can communicate with the network and other devices through wireless communication techniques. The wireless communication technology may include global system for mobile communications (GSM), general Packet Radio Service (GPRS), code division multiple access (code division multiple access, CDMA), wideband Code Division Multiple Access (WCDMA), time-division code division multiple access (time-division code division multiple access, TD-SCDMA), long Term Evolution (LTE), LTE, BT, GNSS, WLAN, NFC, FM, and/or IR technologies, etc. The GNSS may include a Global Positioning System (GPS), a global navigation satellite system (GLONASS), a beidou satellite navigation system (BDS), a quasi-zenith satellite system (QZSS), and/or a Satellite Based Augmentation System (SBAS).
The electronic device implements display functions via the GPU, the display screen 150, and the application processor, etc. The GPU is a microprocessor for image processing, and is connected to the display screen 150 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
The display screen 150 is used to display images, video, pages, etc. The display screen 150 includes a display panel. The display panel may adopt a Liquid Crystal Display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (active-matrix organic light-emitting diode, AMOLED), a flexible light-emitting diode (FLED), a miniature, a Micro-OLED, a quantum dot light-emitting diode (QLED), and the like. In some embodiments, the electronic device may include 1 or N display screens 150, N being a positive integer greater than 1.
A display 150 of the electronic device may display a series of Graphical User Interfaces (GUIs), which are the main screens of the electronic device. Generally, the size of the display 150 of the electronic device is fixed, and only limited controls can be displayed in the display 150 of the electronic device. A control is a GUI element, which is a software component contained in an application program and controls all data processed by the application program and interactive operations related to the data, and a user can interact with the control through direct manipulation (direct manipulation) to read or edit information related to the application program. Generally, a control may include a visual interface element such as an icon, button, menu, tab, text box, dialog box, status bar, navigation bar, widget, and the like.
The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to extend the storage capability of the electronic device. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music, video and the like are saved in the external memory card, and for example, an upgrade package of the system to be upgraded is saved in the external memory card.
The internal memory 121 may be used to store computer-executable program code, which includes instructions. The processor 110 executes various functional applications of the electronic device and data processing by executing instructions stored in the internal memory 121. For example, in the present embodiment, the processor 110 may perform upgrade processing on different upgrade packages by executing instructions stored in the internal memory 121. The storage space of the internal memory 121 may include a user read-only space and a user space, the user space may adopt a single partition, a part of the user read-only space may adopt a single partition or a double partition, and the user read-only space adopts a single partition when the electronic device is in operation. The user read-only space may store programs such as an operating system, application programs required for at least one function (e.g., a sound playing function, an image playing function, etc.), and the like. The user space may store data generated during the operation of the program, data written by the user into the user space, data created during the use of the electronic device, such as an image and a short video stored in the user space by the user, audio data created during the use of the electronic device, a phone book, and the like, and the types of data stored in the user read-only space and the user space are not limited in this embodiment. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (UFS), and the like. The processor 110 executes various functional applications of the electronic device and data processing by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
In addition, an operating system runs on the above components. For example, the iOS OS developed by apple, the Android open source OS developed by google, the hong meng OS (Harmony OS) developed by hua corporation, the Windows operating system developed by microsoft, and the like. A running application may be installed on the operating system.
The operating system of the electronic device may employ a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. The embodiment of the application takes an Android system with a layered architecture as an example, and exemplarily illustrates a software structure of an electronic device.
Fig. 2 is a block diagram of a software structure of an electronic device according to an embodiment of the present application. The layered architecture divides the software into several layers, each layer having a clear role and division of labor. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into four layers, an application layer, an application framework layer, an Android runtime (Android runtime) and system layer, and a kernel layer from top to bottom, respectively.
The application layer may include a series of application packages. As shown in fig. 2, the application package may include an application related to the upgrade of the system to be upgraded, such as a setup application, in which a version of the system to be upgraded, a target version to which the system to be upgraded is upgradable, and the like are recorded. The application framework layer provides an Application Programming Interface (API) and a programming framework for the application program of the application layer. The application framework layer includes a number of predefined functions. As shown in fig. 2, the application framework layer may provide an upgrade-related API for the setting application of the application layer, and send the instruction of the application layer to the system layer by using the upgrade-related API; if the application program is set to generate the upgrading instruction, the upgrading instruction is sent to the system layer by using the API relevant to upgrading in the application program framework layer.
Further, the application framework layer may include a content provider for storing and retrieving data and making such data accessible to applications, a view system, and the like. The view system includes visual controls such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications. The display interface may be composed of one or more views. For example, a display interface including a notification icon indicating a system upgrade may include a view displaying text and a view displaying pictures. The application program layer can call the application program framework layer to display an interface for setting an application program, an interface for displaying a plurality of upgrade packages of the system to be upgraded and the like on the display screen, and the application program layer can generate an upgrade instruction by using the interfaces of the plurality of upgrade packages of the system to be upgraded.
The Android Runtime comprises a core library and a virtual machine. The Android runtime is responsible for scheduling and managing an Android system.
The core library comprises two parts: one part is a function which needs to be called by java language, and the other part is a core library of android. The application layer and the application framework layer run in a virtual machine. And executing java files of the application program layer and the application program framework layer into a binary file by the virtual machine. The virtual machine is used for performing the functions of object life cycle management, stack management, thread management, safety and exception management, garbage collection and the like.
The system layer may include a plurality of services, for example, an upgrade service, and the upgrade service is used to complete differential processing of an upgrade package, merging of source data and differential data, and the like, so as to complete upgrading of the system to be upgraded, where the source data is data of an operating version of the system to be upgraded before upgrading, the current operating version may be referred to as a source version, and the data of the current operating version is referred to as source data. The kernel layer is a layer between hardware and software. The kernel layer at least comprises an upgrade driver, and the upgrade service calls the upgrade driver to read and write data, calls the upgrade driver to complete the mounting and the unloading of the temporary file and the like.
Although the Android system is taken as an example in the embodiment of the present application for description, the basic principle is also applicable to electronic devices according to an os, windows, or a hong meng operating system.
For the electronic device, the upgrade package of the system to be upgraded may be stored in the user space of the internal memory 121, for example, the upgrade package is received by using the USB interface 130 or the wireless communication module 150, and the processor 110 may read the upgrade package from the internal memory 121, and perform an upgrade process on the upgrade package by the processor 110. The process of performing the upgrade processing on the upgrade package by the processor 110 is shown in fig. 3, where the upgrade processing performed on the upgrade package by the processor 110 includes a first phase and a second phase, where the first phase may be referred to as a pre-restart phase or a data parsing phase, and the second phase may be referred to as a post-restart phase or an upgrade verification phase.
In the first stage, the processor 110 reads upgrade data from the upgrade package, and reads source data from the user read-only space, where the source data is a source version of data currently operated by the electronic device; the processor 110 performs differential reduction processing on the upgrade data in the upgrade package according to the upgrade data in the upgrade package and data in the user read-only space to obtain difference data of the upgrade package, where the difference data of the upgrade package is data having a difference between a target version corresponding to the system to be upgraded and a current operating source version of the electronic device. In the first stage, the processor 110 may further obtain the size of the temporary file through parsing the upgrade package, create the temporary file according to the size of the temporary file, map the temporary file into the system in a mount manner, so that the temporary file is in a mount state, and the temporary file exists in the electronic device in a form of a mount device. The processor 110 writes the difference data into the temporary file, and after monitoring that the data writing is completed, the processor 110 controls the temporary file to be switched from a mount state to an unload state.
And in the second stage, the electronic equipment is restarted in response to the restarting instruction. The processor 110 of the electronic device responds to the mount instruction to switch the temporary file to the mount state, the processor 110 merges source data in the user read-only space and difference data in the temporary file to obtain target data, the target data points to the target version, and the processor 110 calls the target data to enable the electronic device to operate a system to be upgraded of the target version. When the system to be upgraded is started successfully, the processor 110 can receive the instruction that the verification passes, the processor 110 writes the difference data into the user read-only partition, and deletes the temporary file; and if the processor receives the command of the verification failure, deleting the temporary file, and restoring the system to be upgraded to the source version.
For each upgrade package in the system to be upgraded, the processor 110 processes each upgrade package by using the upgrade processing flow shown in fig. 3, and if a plurality of upgrade packages are upgraded, the processor 110 needs to execute the upgrade processing flow shown in fig. 3 for a plurality of times and execute a plurality of reboots, so that time consumption is increased due to the plurality of reboots in upgrading of the system to be upgraded, and the upgrade efficiency is reduced.
For example, the internal memory 121 stores three upgrade packages of the system to be upgraded, the three upgrade packages correspond to different versions, and the relationship between the versions is a progressive relationship, such as version 1 corresponding to upgrade package 1, version 2 corresponding to upgrade package 2, and version 3 corresponding to upgrade package 3. The display 150 may display the three upgrade packages and display an upgrade button at the same time of displaying the three upgrade packages, as shown in fig. 4, and the user may click the upgrade control shown in fig. 4, and the upgrade instruction bound to the upgrade control is sent to the processor 110. In response to the upgrade instruction, the processor 110 sequentially performs upgrade processing on the upgrade packages 1 to 3 by using the upgrade processing flow shown in fig. 3, so that the system to be upgraded can be upgraded to the version 3. As can be seen from the processing of the upgrade package 1 to the upgrade package 3, the processor 110 needs to execute the upgrade processing flow shown in fig. 3 for 3 times, and the electronic device is restarted for 3 times. That is, if N upgrade packages of the system to be upgraded are stored in the internal memory 121, the processor needs to execute the upgrade processing procedure shown in fig. 3N times and the electronic device is restarted N times, which increases the time consumption and reduces the upgrade efficiency, where N is a natural number greater than or equal to 2.
And when the processor 110 performs the differential restoration processing on the upgrade data in the upgrade package, the processor 110 takes the previous version of the data as the reference data. For example, the (i + 1) th upgrade package corresponds to the version i +1, the previous version is the version i, the version i corresponds to the ith upgrade package, and when the differential reduction processing is performed on the (i + 1) th upgrade package, the data of the version i is already written in the user read-only space, so that the processor 110 may read the data of the version i from the user read-only space and perform the differential reduction processing on the upgrade data of the (i + 1) th upgrade package. If the data of the version i is not written in the user read-only space, the processor 110 cannot perform differential restoration processing on the (i + 1) th upgrade package; for example, the processor 110 does not respond to the restart instruction after completing the differential restoration processing on the ith upgrade package, data of the version i will not be written in the user read-only space, and the corresponding processor 110 cannot perform upgrade processing on the (i + 1) th upgrade package to the nth upgrade package, thereby further reducing upgrade efficiency.
In this embodiment of the present application, when the processor 110 performs differential restoration processing on the upgrade data in the upgrade package, the processor 110 still uses the data of the previous version as the reference data, but the difference is that: the processor 110 reads the previous version of data from the user read-only space, and changes the previous version of data from the user read-only space and the temporary file in the mounted state into the same read data, so that if the difference data of the previous version is not written into the user read-only space, the processor 110 can read the difference data of the previous version from the temporary file in the mounted state and can read the source data from the user read-only space, and the source data read from the user read-only space and the difference data read from the temporary file serve as reference data for differential reduction processing.
For example, when the i +1 th upgrade package is subjected to differential restoration processing, the difference data that is not written into the user read-only space (for example, the difference data of at least the i th upgrade package) is read from the temporary file in the mounted state, and the source data is read from the user read-only space, and the two data are merged to be the data of version i, so that even if the electronic device is not restarted, the processor 110 can continue to perform differential restoration processing on the i +1 th upgrade package. The same processor 110 may refer to the differential restoration processing procedure of the (i + 1) th upgrade package, and perform differential restoration processing on the (i + 2) th upgrade package to the nth upgrade package.
After the differential restoration processing of the nth upgrade package is completed, the processor 110 unloads the temporary file, controls the electronic device to restart, and merges the differential data in the temporary file into the user read-only space to verify whether the upgrade package can be successfully started, if the upgrade package can be successfully started, the system to be upgraded is upgraded to the version N corresponding to the nth upgrade package, so that the processor 110 executes one-time restart operation to complete the jump upgrade of the system to be upgraded, and the differential restoration processing of a plurality of upgrade packages cannot interrupt the processing of the upgrade packages because the differential data are not written in the user read-only space, thereby reducing the time consumption and improving the upgrade efficiency.
The electronic device is used as an execution main body, and is specifically executed by a processor in the electronic device, data related to the execution process of the processor can be stored in an internal memory, for example, the data can be stored in a user space of the internal memory, for example, 1 st to nth upgrade packages of a system to be upgraded are stored in the internal memory, versions corresponding to the 1 st to nth upgrade packages are versions 1 to N, and the electronic device can process the 1 st to nth upgrade packages to upgrade the system to be upgraded to the version N. The processing of the electronic device on the 1 st to the nth upgrade packages is started after receiving an upgrade instruction, and the upgrade instruction may be manually triggered by a user or automatically generated by the electronic device.
If the user can trigger the upgrade control displayed on the display screen, for example, the user manually clicks the upgrade control to complete the triggering of the upgrade control, and the upgrade instruction bound to the upgrade control is sent to the processor of the electronic device. Or, a timer is arranged in the electronic equipment, the upgrading time is set through the timer, and the upgrading instruction is automatically triggered when the electronic equipment reaches the upgrading time. For example, after the 1 st to nth upgrade packages are stored in the user space of the internal memory, the electronic device starts timing, and triggers an upgrade instruction after the timing reaches the upgrade time.
Fig. 5 is a first schematic diagram of a system upgrade method according to an embodiment of the present application. Fig. 5 shows that the electronic device responds to the upgrade instruction, processes a plurality of upgrade packages, and performs a jump upgrade on the system to be upgraded by a single restart, for example, in response to the upgrade instruction, processes the 1 st to nth upgrade packages, and upgrades the system to be upgraded to version N by a single restart, which reduces time consumption and improves upgrade efficiency compared to a process of upgrading the system to be upgraded to version N by multiple restarts. The system upgrading method shown in fig. 5 includes the following steps:
the electronic equipment reads the 1 st upgrade package from the user space and reads source data from the user read-only space, wherein the source data is data of a currently operated version of the electronic equipment, and if the currently operated version of the electronic equipment is version 0, the electronic equipment can read the data of the version 0 from the user read-only space;
the method comprises the steps that the electronic equipment takes source data read from a user read-only space as reference data, differential reduction processing is carried out on upgrade data in a 1 st upgrade package to obtain difference data of the 1 st upgrade package, the difference data of the 1 st upgrade package are stored into a temporary file, the temporary file is a file used for storing the difference data by the electronic equipment, the electronic equipment can analyze the 1 st upgrade package to an Nth upgrade package to obtain the size of the temporary file, the temporary file is created according to the size of the temporary file, the temporary file is mapped into a system in a mounting mode to be in a mounting state, and the temporary file exists in the electronic equipment in the form of one mounting device;
the electronic equipment reads the 2 nd upgrade package from the user space, because the difference data of the 1 st upgrade package is stored in the temporary file, the electronic equipment reads the difference data from the temporary file and the source data from the user read-only space, and performs differential reduction processing on the upgrade data in the 2 nd upgrade package by taking the difference data read from the temporary file and the source data read from the user read-only space as reference data to obtain the difference data of the 2 nd upgrade package.
The electronic equipment temporarily stores the difference data of the 2 nd upgrade package in the user space, writes the difference data of the 2 nd upgrade package temporarily stored in the user space into a temporary file after completing the differential reduction processing of the 2 nd upgrade package, and deletes the difference data temporarily stored in the user space. The reason why the difference data of the 2 nd upgrade package is temporarily stored in the user space is that: the difference data of the 1 st upgrade package and the difference data of the 2 nd upgrade package may be for the same address, but the data written in the same address are different, and directly writing the difference data of the 2 nd upgrade package into the temporary file may modify the data written in the address; if the data written in the address is used when the differential restoration processing is performed on the other upgrade data in the 2 nd upgrade package, a differential restoration error may be caused, so this embodiment temporarily stores the differential data of the 2 nd upgrade package into the user space until the differential restoration processing of the 2 nd upgrade package is completed.
For example, the difference data of the upgrade data 2 of the 2 nd upgrade package indicates that data E is written in the address 10, the data written in the address 10 in the temporary file is data F, and the data written in the address 10 is modified into data E when the difference data of the 2 nd upgrade package is directly written. When the electronic device performs differential reduction processing on the upgrade data 4, the data in the address 10 is used for searching, at this time, the data in the address 10 is modified into the data E, the electronic device performs differential reduction processing by using the data E, but not the data F, that is, the electronic device cannot perform differential reduction processing by using the data written in the address 10 in the version 1, so that a differential reduction error of the 2 nd upgrade package is caused, and for this reason, each piece of difference data of the 2 nd upgrade package is obtained, and the electronic device temporarily stores the piece of difference data into a user space.
The electronic equipment reads the 3 rd upgrade package from the user space, reads the difference data from the temporary file (the difference data of the 1 st upgrade package and the 2 nd upgrade package are stored in the temporary file, so the electronic equipment can read the difference data of the 1 st upgrade package and the 2 nd upgrade package from the temporary file), reads the source data from the user read-only space, and performs differential reduction processing on the upgrade data in the 3 rd upgrade package by taking the difference data read from the temporary file and the source data read from the user read-only space as reference data to obtain the difference data of the 2 nd upgrade package. The same electronic device temporarily stores the difference data of the 3 rd upgrade package in the user space, writes the difference data of the 3 rd upgrade package temporarily stored in the user space into the temporary file after completing the differential reduction processing of the 3 rd upgrade package, and deletes the difference data temporarily stored in the user space.
By analogy, the electronic device sequentially performs differential reduction processing on the 4 th upgrade package to the nth upgrade package, and when performing differential reduction processing on any jth upgrade package in the upgrade packages, the reference data is as follows: the data read in the user read-only space and the difference data corresponding to the 1 st upgrade package to the j-1 st upgrade package, wherein the value of j is [4, N ]. And after the differential reduction processing of the jth upgrade package is completed, writing the differential data of the jth upgrade package temporarily stored in the user space into a temporary file, and deleting the differential data temporarily stored in the user space, so that the 1 st upgrade package to the Nth upgrade package can share the same temporary file.
And after the electronic equipment writes the difference data of the Nth upgrading packet into the temporary file, switching the temporary file from a mounting state to an unloading state, and waiting for a restart instruction. The restart instruction may be triggered manually by a user or generated automatically by the electronic device, which may specifically refer to a generation process of the upgrade instruction. After the electronic equipment is restarted, the temporary file is switched to the mounting state in response to the mounting instruction, the electronic equipment merges source data in a user read-only space and difference data in the temporary file to obtain target data, and the electronic equipment calls the target data to enable the electronic equipment to operate a system to be upgraded of a target version (such as a version N corresponding to the Nth upgrade package). When the system to be upgraded is started successfully, the electronic equipment can receive the command that the verification passes, write the difference data in the temporary file into the user read-only partition, and delete the temporary file; and if an instruction of failed verification is received, deleting the temporary file, and restoring the system to be upgraded to the source version.
As for the system upgrading method shown in fig. 5, a corresponding flowchart is shown in fig. 6, and may include the following steps:
s601, analyzing the 1 st to the Nth upgrade packages to obtain the size of the temporary file, creating the temporary file according to the size of the temporary file, and controlling the temporary file to be in a mounting state.
S602, obtaining the 1 st upgrade package of the system to be upgraded.
S603, if the upgrading data in the 1 st upgrading packet simultaneously comprises a source address and a target address, reading the data written in the source address from the read-only space of the user, and restoring the difference result in the upgrading data by using the read data to obtain the data written in the target address, wherein the source address and the target address can be in one address range or one address.
S604, if the upgrading data in the 1 st upgrading packet only comprises the target address and is not subjected to zero clearing operation, writing the upgrading data into the target address.
S605, if the upgrade data in the 1 st upgrade package only comprises the target address range but has zero clearing operation, writing zero into the target address. And step S603 to step S605 are used to complete the differential restoration processing of the upgrade data in the 1 st upgrade package, so as to obtain the differential data of the 1 st upgrade package.
S606, writing the difference data of the 1 st upgrade package into the temporary file in the mounting state.
S607, the 2 nd upgrade package of the system to be upgraded is obtained.
S608, if the upgrade data in the 2 nd upgrade package includes a source address and a target address at the same time, firstly reading the data written in the source address from the temporary file, if the data written in the source address is not read, then reading the data written in the source address from the user read-only space, and restoring the difference result in the upgrade data by using the read data to obtain the data written in the target address, wherein the source address and the target address can be in an address range or an address range.
And S609, if the upgrading data in the 2 nd upgrading packet only comprises the target address and is not subjected to zero clearing operation, writing the upgrading data into the target address.
S610, if the upgrading data in the 2 nd upgrading packet only comprises the target address range but has zero clearing operation, writing zero into the target address. And step S608 to step S610 are used to complete the differential restoration processing on the upgrade data in the 2 nd upgrade package, so as to obtain the differential data of the 2 nd upgrade package.
S611, when one piece of difference data of the 2 nd upgrading packet is obtained, the difference data of the 2 nd upgrading packet is temporarily stored in the user space.
And S612, judging whether the differential reduction processing of the 2 nd upgrade package is finished or not, if the differential reduction processing of the 2 nd upgrade package is finished, executing the step S613, and if the differential reduction processing of the residual upgrade data in the 2 nd upgrade package is not finished, returning to execute the steps S608 to S610 to perform the differential reduction processing on the residual upgrade data.
S613, writing the difference data of the 2 nd upgrade package in the user space into a temporary file, and deleting all the difference data temporarily stored in the user space. When the electronic equipment writes the difference data of the 2 nd upgrade package into the temporary file, writing the second difference data which is different from other difference data in all the difference data of the 2 nd upgrade package into the temporary file. Whether the second difference data is different from other difference data or not can be determined according to the target address in each piece of data and the data written by the target address, and if at least one of the target addresses of any two pieces of difference data is different from the data written by the target address, the electronic equipment writes the second difference data to which the target address belongs into the temporary file. Or after the electronic equipment obtains the second difference data, the electronic equipment takes the next position of the last difference data stored in the temporary file as the difference data starting position of the 2 nd upgrade package, and stores each difference data of the 2 nd upgrade package in sequence.
And S614, sequentially processing the 3 rd to the Nth upgrading packets according to the processing mode of the 2 nd upgrading packet, reading the data written in the source address from the temporary file when the data is written in the read source address, and reading the data written in the source address from the user read-only space if the data is not read.
And S615, after the differential reduction processing of the Nth upgrading packet is completed, switching the temporary file to an unloading state.
And S616, responding to the restart instruction, and controlling the electronic equipment to restart.
And S617, after the electronic equipment is restarted, controlling the temporary file to be switched from the uninstalling state to the mounting state.
And S618, combining all the difference data in the temporary file and the data of the source version in the user read-only space to obtain target data pointing to the target version of the system to be upgraded, and operating the target data to complete the starting of the system to be upgraded. The electronic equipment can detect the starting of the system to be upgraded to obtain a starting result of the system to be upgraded, and the starting result is used for indicating whether the system to be upgraded is started successfully or fails to be started.
S619, responding to the successful start of the system to be upgraded, writing all the difference data in the temporary file into a user read-only space, combining all the difference data and the data of the source version into target data of the system to be upgraded, pointing the target data to the target version of the system to be upgraded, and completing the upgrade of the system to be upgraded from the source version to the target version.
The above-mentioned processes shown in fig. 5 and fig. 6 have the advantages that the electronic device stores the difference data of a plurality of upgrade packages in the temporary file, the number of temporary files in the electronic device is reduced, and when the difference data of any upgrade package is stored in the temporary file, the difference data with differences can be written into the temporary file, so as to reduce the data volume written in the temporary file. And before storing the difference data to the temporary file, the electronic equipment temporarily stores the difference data in a user space, so that the data in the temporary file is prevented from being replaced, the source data read during differential restoration processing of the upgrade data is ensured to be correct, and the restoration accuracy is improved. The electronic equipment executes the restart operation after completing the differential reduction processing on the 1 st to Nth upgrade packages so as to determine whether the electronic equipment can be successfully started when the system to be upgraded of the version N is operated, if the system to be upgraded can be successfully started, the system to be upgraded is determined to be upgraded to the version N, therefore, the electronic equipment completes the upgrade of the system to be upgraded by executing the restart operation once, and the differential reduction processing of the plurality of upgrade packages can not interrupt the processing of the upgrade packages because no difference data is written in a user read-only space, so that the time consumption can be reduced, and the upgrade efficiency can be improved.
Fig. 7 is a schematic diagram of a system upgrade method provided in an embodiment of the present application, where fig. 7 also shows a process in which an electronic device responds to an upgrade instruction, processes a plurality of upgrade packages, and performs a jump upgrade on a system to be upgraded by means of one restart, and a difference between the process and the system upgrade method shown in fig. 5 and fig. 6 is that: fig. 5 and 6 show that difference data is temporarily stored in the user space, and fig. 7 shows that data used in the differential restoration processing is temporarily stored in the user space, and reference data used in the differential restoration processing is also different. See in detail the process shown below:
the electronic device reads the 1 st upgrade package from the user space, and performs differential restoration processing on the 1 st upgrade package, which is the same as that in fig. 5 and is not described again here;
the electronic equipment reads the 2 nd upgrading packet from the user space, and reads the address of each piece of upgrading data in the 2 nd upgrading packet, wherein if some upgrading data comprise a source address and a target address at the same time, some upgrading data only comprise the target address; one address may be used both as a source address in one piece of upgrade data for data reading and as a destination address in another piece of upgrade data for data writing. In this embodiment, if an address is used as a target address of one piece of upgrade data to perform data writing and used as a source address of another piece of upgrade data to perform data reading for any two pieces of upgrade data having the same address, the electronic device sorts the two pieces of upgrade data in such a manner that the writing operation of the address as the target address is later than the reading operation of the address as the source address.
If the upgrading data is sequenced, the data read from the source address can still be influenced when the data written in the target address still influences, the data in the source address is temporarily stored in the user space, wherein when the data is read from the source address to be temporarily stored in the user space, the data is firstly read from the temporary file, and if the source address can be searched from the temporary file, the data in the source address is temporarily stored in the user space; if the source address is not found from the temporary file, the source address is found from the user read-only space, and the data in the source address in the user read-only space is temporarily stored in the user space. If the upgrading data is sequenced, the reading of the data from the source address cannot be influenced when the data is written in any target address, and the link of temporarily storing the data in the source address to the user space can be omitted.
For example, the upgrade data includes: data a having source addresses of 1 to 5 and destination addresses of 1 to 8, data B having source addresses of 6 to 12 and destination addresses of 50 to 70, the two pieces of upgrade data being sorted later and data B sorted earlier than data a. The electronic equipment reads data from the source addresses 6 to 12, and obtains the data written into the target addresses 50 to 70 according to the data in the source addresses 6 to 12; then the electronic device reads data from the source addresses 1 to 5, because the data a is the data written in the destination addresses 50 to 70, and will not affect the data in the source addresses 1 to 5, so that the two pieces of upgrade data are subjected to differential restoration processing by using the sorting of the two pieces of upgrade data, which will not affect each other, and the data in the source addresses 1 to 5 and the source addresses 6 to 12 need not be temporarily stored in the user space.
If the upgrade data also has: data C with source addresses of 50 to 70 and destination addresses of 9 to 12, the data C being ordered before the data B. The electronic equipment reads data from the source addresses 50 to 70, and obtains the data written into the target addresses 9 to 12 according to the data in the source addresses 50 to 70; then the electronic device reads the data from the source addresses 6 to 12 again, because the data C has been written into the address 12 when being subjected to the differential restore processing, which indicates that the data in the address 12 has changed before the data is read from the address 12, if the data in the address 12 is not temporarily stored before the 2 nd upgrade package is subjected to the differential restore processing, there is a case that the original data of the address 12 cannot be read, and based on this, the electronic device needs to temporarily store the data in the address 12 into the user space.
After the electronic device finishes sequencing the 2 nd upgrade package and temporarily stores the data in the source address affected by the target address to the user space, the electronic device performs differential reduction processing on the upgrade data in the 2 nd upgrade package according to the sequencing of all the upgrade data in the 2 nd upgrade package. The order in which the electronic device reads the data during the differential restore process is: reading the temporarily stored data from the user space, reading the difference data from the temporary file if the temporarily stored data are not read, reading the source data from the user read-only space if the temporarily stored data are not read, taking the difference data read from the temporary file, the source data read from the user read-only space and the data read from the user space as reference data, and performing differential reduction processing on the upgrade data in the 2 nd upgrade package according to the sequence of all the upgrade data in the 2 nd upgrade package to obtain the difference data of the 2 nd upgrade package.
The data in the source address can be temporarily stored in the user space even if the data in the source address can be modified by storing the difference data, and the data in the source address can be read from the user space when differential reduction processing is performed on the rest upgrade data, so that the read data is correct. And after the electronic equipment completes the differential reduction processing on the 2 nd upgrading packet, deleting the data temporarily stored in the user space.
The electronic equipment reads the 3 rd upgrading packet from the user space, and sequences all upgrading data in the 3 rd upgrading packet in a mode that the writing operation with the address as the target address is later than the reading operation with the address as the source address. If the data written in the target address still influences the data read from the source address after the upgrading data is sequenced, the data in the source address is temporarily stored in the user space. The electronic equipment carries out differential reduction processing on the upgrade data in the 3 rd upgrade package according to the sequence of all the upgrade data in the 3 rd upgrade package, and also reads the temporary data from the user space firstly, reads the difference data from the temporary file if not, reads the source data from the user read-only space if not, and takes the difference data read from the temporary file, the source data read from the user read-only space and the data read from the user space as the reference data, but only carries out differential reduction relative to the 2 nd upgrade package, and at the moment, the difference data of the 1 st upgrade package and the 2 nd upgrade package are stored in the temporary file.
By analogy, the electronic device sequentially performs differential reduction processing on the 4 th upgrade package to the nth upgrade package, and when performing differential reduction processing on any jth upgrade package in the upgrade packages, the reference data is as follows: reading the temporary stored data from the user space, if the temporary data is not read from the temporary file, reading the source data from the user read-only space, wherein the difference data stored in the temporary file is the difference data corresponding to the 1 st upgrade package to the j-1 st upgrade package, and the value of j is [4, N ]. And the electronic equipment directly stores the differential data of the jth upgrading packet into a temporary file every time the differential data of the jth upgrading packet is obtained, so that all upgrading packets share the same temporary file, and the data of the source address temporarily stored in the user space is deleted after the differential reduction processing of the jth upgrading packet is completed.
After the electronic device writes the difference data of the nth upgrade package into the temporary file, the temporary file is switched from the mount state to the unload state, and a restart instruction is waited, and a process after the electronic device is restarted in response to the restart instruction is the same as the system upgrade method shown in fig. 5, which is not described herein again.
The system upgrade method shown in fig. 7 has an advantage over the system upgrade method shown in fig. 5 in that the system upgrade method shown in fig. 7 temporarily stores data in the source address affected by the data written in the destination address into the user space, and reduces the amount of data stored in the user space relative to the difference data stored in each upgrade package shown in fig. 5. Since the data in the source address is temporarily stored in the user space, when the upgrade data is subjected to differential reduction processing, the reference data changes relative to the system upgrade method shown in fig. 5, the reference data adds the source data read from the user read-only space on the basis of the difference data read from the temporary file and the data read from the user space, but the differential reduction process using the reference data does not change. In addition, in the system upgrading method shown in fig. 7, each piece of difference data is obtained, and the difference data can be directly written into the temporary file, so that the process of moving the temporary file from the user space is omitted, and the processing efficiency is improved.
In this embodiment, the electronic device may change the system upgrade method shown in fig. 7, for example, before performing the differential reduction processing on the y-th upgrade package, the electronic device temporarily stores data in the source address related to the y-th upgrade package into the user space, where the data temporarily stored in the source address in the user space is read from the temporary file first, and if the temporary file is not read, the data is read from the user read-only space, and a value of y is [1, n ].
As shown in fig. 8, the electronic device reads the 2 nd upgrade package from the user space, and for the source address in the upgrade data of the 2 nd upgrade package, first searches the source address from the temporary file, if the data of the source address is found from the temporary file, and if the data of the source address is not found from the user read-only space, temporarily stores the data of the source address in the user space. After the temporary storage of the data is finished, the difference data read from the temporary file, the source data read from the user read-only space and the data read from the user space are used as reference data, and the upgrade data of the 2 nd upgrade package are subjected to differential reduction processing. The 3 rd to nth upgrade packages can be processed by referring to the processing flow of the 2 nd upgrade package.
Fig. 9 is a fourth schematic diagram illustrating a system upgrade method according to an embodiment of the present application, where the system upgrade method illustrated in fig. 9 also uses data of a temporary source address to be temporarily stored in a user space, where the temporary source address to be temporarily stored in the user space is different from the system upgrade methods illustrated in fig. 7 and 8. The specific electronic equipment reads the 2 nd upgrade package from the user space, and temporarily stores the data of all source addresses in the user space; and if the difference data of the source addresses cannot be read from the temporary file, reading the data of the source addresses from the user read-only space. The electronic equipment utilizes the data temporarily stored in the user space to carry out differential reduction processing on the 2 nd upgrade package, obtains the difference data of each upgrade data in the 2 nd upgrade package, and stores the difference data into the temporary file. And after the 2 nd upgrading packet is subjected to differential restoration processing, deleting the data of the source address temporarily stored in the user space.
The electronic equipment reads a 3 rd upgrading packet from a user space, the electronic equipment stores data of all source addresses into the user space again, the data are the same as those of the 2 nd upgrading packet, the data are read from a temporary file and then read from a user read-only space, the difference is that the difference data of the 1 st upgrading packet and the 2 nd upgrading packet are stored in the temporary file at the moment, then the electronic equipment performs differential reduction processing on the 3 rd upgrading packet by using data temporarily stored in the user space, wherein the difference is 8230, and so on, when the electronic equipment reads one upgrading packet, the electronic equipment reads data of all the source addresses from the temporary file and the user read-only space and temporarily stores the data into the user space; and then the electronic equipment performs differential restoration processing on the upgrade package by using the data temporarily stored in the user space. Although the system upgrade method shown in fig. 9 increases the amount of data buffered in the user space compared to fig. 7, the amount of data is still reduced to some extent compared to the buffered difference data.
In the system upgrading method shown in fig. 5 to 9, the difference data of the plurality of upgrade packages share the same temporary file. In this embodiment, the difference data of the upgrade package may be stored in different temporary files, but all the temporary files are also unloaded after the differential reduction processing is completed on all the upgrade packages, so that the system to be upgraded is upgraded in a jump manner by one restart, time consumption is reduced and upgrade efficiency is improved compared with multiple restarts. As shown in fig. 10, the process is as follows:
the electronic device reads the 1 st upgrade package from the user space, and performs differential restoration processing on the 1 st upgrade package, which is the same as that in fig. 5, and is not described here any more, and the temporary file for storing the differential data of the 1 st upgrade package is marked as a temporary file 1, and the temporary file 1 is created by analyzing the size of the temporary file obtained by analyzing the 1 st upgrade package;
the electronic equipment reads the 2 nd upgrade package from the user space, analyzes the 2 nd upgrade package to obtain the size of a temporary file, and creates a temporary file 2 according to the size of the temporary file; when the 2 nd upgrade package is subjected to differential reduction processing, because the difference data of the 1 st upgrade package is stored in the temporary file 1, the electronic device reads the difference data from the temporary file 1 and the source data from the user read-only space, and performs differential reduction processing on the upgrade data in the 2 nd upgrade package by taking the difference data read from the temporary file 1 and the source data read from the user read-only space as reference data, so as to obtain the difference data of the 2 nd upgrade package, and the difference data of the 2 nd upgrade package is stored in the temporary file 2.
And performing differential reduction processing on the 3 rd to the Nth upgrade packages according to the processing of the 2 nd upgrade package, constructing a temporary file for each upgrade package, for example, the xth upgrade package from the 3 rd to the Nth upgrade package, wherein the value of x is [3, N ], analyzing the xth upgrade package to obtain the size of the temporary file, creating the temporary file x according to the size of the temporary file, and performing differential reduction processing on the upgrade data in the xth upgrade package by taking the difference data read from the temporary file 1 to the temporary file x-1 and the source data read from the user read-only space as reference data.
After the electronic equipment writes the difference data of the Nth upgrading package into the temporary file, the temporary file is switched from a mounting state to an unloading state, and a restarting instruction is waited for, after the electronic equipment responds to the restarting instruction, the electronic equipment combines the difference data in each file and the source data in the user read-only space, so that whether the system to be upgraded can be started successfully or not based on the combined target data is verified through a multilevel mounting technology. And if the system to be upgraded is successfully started, writing the difference data in each temporary file into the user read-only space one by one.
In the system upgrading method shown in fig. 10, the electronic device uses a multi-level mounting technology, each upgrade package corresponds to one temporary file, and the difference data of each upgrade package is stored in the corresponding temporary file, which, compared to the system upgrading method, increases the storage space occupied by the difference data, but achieves the purpose of independently storing the difference data of the upgrade package.
Some embodiments of the present application also provide an electronic device, which may include: one or more processors, memory; wherein the memory is configured to store one or more computer program codes comprising computer instructions that, when executed by the one or more processors, cause the electronic device to perform the system upgrade method described above.
In the embodiment of the present application, the electronic device may be divided into the functional modules according to the method example, for example, each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. It should be noted that, in the embodiment of the present application, the division of the module is schematic, and is only one logic function division, and there may be another division manner in actual implementation.
In the case of dividing each function module by corresponding functions, the system upgrading apparatus may be an apparatus for implementing the method provided in the embodiment for an electronic device or an electronic device, and for example, the system upgrading apparatus may include: a processing unit and a storage unit. Wherein the storage unit is used for storing one or more programs; the processing unit is configured to execute the one or more programs; the one or more programs include instructions for performing the system upgrade method described above. The processing unit and the storage unit can be two functional units in a processor of the electronic device, the storage unit in the processor is used for storing programs, and the processing unit in the processor executes the programs to realize the system upgrading method.
It should be noted that all relevant contents of each step related to the method embodiment may be referred to the functional description of the corresponding functional module, and are not described herein again.
The present embodiment also provides a computer-readable storage medium, which includes instructions, when the instructions are executed on an electronic device, the electronic device is caused to execute the relevant method steps in fig. 5 to 10, so as to implement the system upgrading method in the foregoing embodiments.
The present embodiment also provides a computer program product containing instructions, which when run on an electronic device, causes the electronic device to execute the relevant method steps as in fig. 5 to fig. 10, so as to implement the system upgrade method in the foregoing embodiments.
The present embodiment also provides a control device, which includes a processor and a memory, the memory is used for storing computer program codes, the computer program codes include computer instructions, when the processor executes the computer instructions, the control device executes the relevant method steps as in fig. 5 to 10 to implement the system upgrading method in the above embodiment. The control device may be an integrated circuit IC or a system on chip SOC. The integrated circuit can be a general integrated circuit, a Field Programmable Gate Array (FPGA) or an Application Specific Integrated Circuit (ASIC).
Through the description of the foregoing embodiments, it will be clear to those skilled in the art that, for convenience and simplicity of description, only the division of the functional modules is illustrated, and in practical applications, the above function distribution may be completed by different functional modules as needed, that is, the internal structure of the apparatus may be divided into different functional modules to complete all or part of the above described functions. For the specific working processes of the system, the apparatus and the unit described above, reference may be made to the corresponding processes in the foregoing method embodiments, and details are not described here again.
In the several embodiments provided in this embodiment, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, each functional unit in the embodiments of the present embodiment may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. With this understanding, the technical solutions of the present embodiment substantially or partially contribute to the prior art, or all or part of the technical solutions may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) or a processor to execute all or part of the steps of the methods described in the embodiments. And the aforementioned storage medium includes: flash memory, removable hard drive, read only memory, random access memory, magnetic or optical disk, and the like.
The above description is only an embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions within the technical scope of the present disclosure should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (14)

1. A system upgrading method is applied to electronic equipment and comprises the following steps:
the method comprises the steps of obtaining an ith upgrade package of a system to be upgraded, obtaining first difference data from a temporary file in a mounting state and obtaining original data of a source version from a user read-only space, wherein each first difference data is used for indicating data with difference between two adjacent versions in all the versions, all the versions are versions appearing before the version corresponding to the ith upgrade package, and i is a natural number greater than or equal to 2;
according to all the first difference data, the original data of the source version and the ith upgrade package, carrying out differential reduction processing on upgrade data in the ith upgrade package to obtain second difference data, and storing the second difference data into a temporary file, wherein the second difference data is used for indicating the difference between the ith upgrade package and the (i-1) th upgrade package;
responding to a restart instruction, and starting the system to be upgraded according to all difference data in the temporary file in the mounting state and the original data of the source version in the user read-only space;
responding to the successful start of the system to be upgraded, writing all difference data in a temporary file into the user read-only space, combining all difference data and the original data of the source version into target data of the system to be upgraded, and pointing the target data to the target version of the system to be upgraded;
when differential reduction processing is performed on the upgrade data in the ith upgrade package, if a source address in first upgrade data in the ith upgrade package is overlapped with a target address in second upgrade data but the source address in the second upgrade data is not overlapped with the target address in the first upgrade data, the differential reduction processing of the first upgrade data is earlier than that of the second upgrade data; if the source address in the first upgrading data is coincident with the target address in the second upgrading data, and the source address in the second upgrading data is coincident with the target address in the first upgrading data, the differential reduction processing of one piece of upgrading data in the first upgrading data and the second upgrading data is earlier than that of the other piece of upgrading data, before the differential reduction processing is performed on the upgrading data with early differential reduction processing, the data of the coincident source address in the upgrading data with late differential reduction processing is temporarily stored, and when the differential reduction processing is performed on the upgrading data with late differential reduction processing, the temporarily stored data is adopted; the first upgrade data and the second upgrade data are any two pieces of upgrade data in the ith upgrade package.
2. The method according to claim 1, wherein the performing differential reduction processing on the upgrade data in the ith upgrade package according to all the first difference data, the original data of the source version, and the ith upgrade package to obtain second difference data, and storing the second difference data in a temporary file includes:
according to all the first difference data, the original data of the source version and each piece of upgrading data in the ith upgrading packet, carrying out differential reduction processing on each piece of upgrading data to obtain second difference data corresponding to each piece of upgrading data;
temporarily storing the second difference data corresponding to each piece of upgrading data into a user space;
and responding to a restoration processing completion instruction, and storing the second difference data in the user space into the temporary file.
3. The method according to claim 1, wherein the performing differential reduction processing on the upgrade data in the ith upgrade package according to all the first difference data, the original data of the source version, and the ith upgrade package to obtain second difference data, and storing the second difference data in a temporary file includes:
determining a specific address set of the ith upgrading packet according to the address of each piece of upgrading data in the ith upgrading packet, wherein each address in the specific address set is an address in which a source address in one piece of upgrading data in any two pieces of upgrading data is coincident with a target address of the other piece of upgrading data;
acquiring data corresponding to each address in the specific address set from all the first difference data and the original data, and temporarily storing each address and the data corresponding to each address into a user space;
according to all the first difference data, the data in the user space, the original data of the source version and each piece of upgrading data in the ith upgrading packet, carrying out differential reduction processing on each piece of upgrading data to obtain second difference data corresponding to each piece of upgrading data;
and storing the second difference data into the temporary file.
4. The method of claim 3, further comprising: sequencing each piece of upgrade data in the ith upgrade package according to a first sequencing condition and a second sequencing condition to obtain a sequencing result of the ith upgrade package, wherein the first sequencing condition indicates that the sequencing of the upgrade data corresponding to the specific address set is before other upgrade data, and the second sequencing condition indicates that the write operation of the address in the specific address set as a target address is later than the read operation of the address as a source address;
the performing differential reduction processing on each piece of upgrade data according to all the first difference data, the data in the user space, the original data of the source version, and each piece of upgrade data in the ith upgrade package to obtain second difference data corresponding to each piece of upgrade data includes: and according to the sequencing result of the ith upgrading packet, carrying out differential reduction processing on each piece of upgrading data according to all the first difference data, the data in the user space, the original data of the source version and each piece of upgrading data in the ith upgrading packet so as to obtain second difference data corresponding to each piece of upgrading data.
5. The method of claim 4, further comprising: determining first type data and second type data from data temporarily stored in a user space according to a sequencing result, keeping the first type data in the user space, and deleting the second type data from the user space; the first type data indicates that writing data in the address of the first type data affects other data to read data from the address of the first type data, and the second type data indicates that writing data in the address corresponding to the second type data does not affect other data to read data from the address of the second type data.
6. The method according to claim 1, wherein the performing differential reduction processing on the upgrade data in the ith upgrade package according to all the first difference data, the original data of the source version, and the ith upgrade package to obtain second difference data, and storing the second difference data in a temporary file includes:
sequencing each piece of upgrading data according to the address of each piece of upgrading data in the ith upgrading packet to obtain a sequencing result, sequencing the upgrading data with the same address before the upgrading data without the same address by using the sequencing result, wherein the upgrading data with the same address is the upgrading data to which the source address and the target address are superposed, the source address and the target address are positioned in different upgrading data, and the sequencing of the different upgrading data with the same address is that the writing operation of the address as the target address is later than the reading operation of the address as the source address;
according to the sorting result, all the first difference data, the original data of the source version and each piece of upgrading data in the ith upgrading packet, carrying out differential reduction processing on each piece of upgrading data to obtain second difference data corresponding to each piece of upgrading data;
and storing the second difference data into the temporary file.
7. The method of claim 6, further comprising: determining specific type upgrading data from upgrading data of the ith upgrading packet, and temporarily storing data written in a source address and a source address of the specific type upgrading data into a user space; the upgrade data of a specific type indicates that writing data in the target address of the upgrade data affects data reading of source addresses of other upgrade data, and the data written in the source address of the upgrade data of a specific type is acquired from the temporary file and the user read-only space.
8. The method according to claim 1, wherein the performing differential reduction processing on the upgrade data in the ith upgrade package according to all the first difference data, the original data of the source version, and the ith upgrade package to obtain second difference data, and storing the second difference data in a temporary file includes:
acquiring data corresponding to each source address from all the first difference data and the original data, and temporarily storing the data corresponding to each source address and each source address into a user space;
according to the first difference data, the original data of the source version, the data in the user space and each piece of upgrading data in the ith upgrading packet, carrying out differential reduction processing on each piece of upgrading data to obtain second difference data corresponding to each piece of upgrading data;
and storing the second difference data into the temporary file.
9. The method according to claim 1, wherein the performing differential reduction processing on the upgrade data in the ith upgrade package according to all the first difference data, the original data of the source version, and the ith upgrade package to obtain second difference data includes:
if the upgrade data of the ith upgrade package simultaneously comprises a source address and a target address, reading data from all the first difference data and the original data according to the source address, and carrying out differential reduction processing on the difference result in the upgrade data to obtain data to be written in the target address;
if the upgrade data of the ith upgrade package comprises a target address and zero clearing operation does not exist, writing the upgrade data into the target address;
and if the upgrade data of the ith upgrade package comprises a target address but has zero clearing operation, writing zero into the target address.
10. An electronic device, characterized in that the electronic device comprises: one or more processors, memory; wherein the memory is configured to store one or more computer program codes comprising computer instructions that, when executed by the one or more processors, cause the electronic device to perform the system upgrade method of any one of claims 1 to 9.
11. A system upgrade apparatus, comprising: a processing unit and a storage unit for storing one or more programs; the processing unit is to execute the one or more programs; the one or more programs include instructions for performing the system upgrade method of any one of claims 1 to 9.
12. A computer storage medium comprising computer instructions that, when run on an electronic device, cause the electronic device to perform the system upgrade method of any one of claims 1 to 9.
13. A system upgrading method is applied to electronic equipment and comprises the following steps:
acquiring a 1 st upgrade package of a system to be upgraded, and acquiring original data of a source version from a user read-only space;
obtaining difference data of the 1 st upgrade package according to the original data of the source version and the 1 st upgrade package, and writing the difference data of the 1 st upgrade package into a temporary file in a mount state, wherein the difference data is used for indicating data with difference between a version corresponding to the 1 st upgrade package and the source version;
acquiring a 2 nd upgrade package of the system to be upgraded, acquiring the difference data from the temporary file in the mounting state and acquiring original data of a source version from a user read-only space;
according to the difference data, the original data of the source version and the 2 nd upgrade package, carrying out differential reduction processing on the upgrade data in the 2 nd upgrade package to obtain difference data of the 2 nd upgrade package, and storing the difference data of the 2 nd upgrade package into a temporary file, wherein the difference data of the 2 nd upgrade package is used for indicating the difference between the version corresponding to the 2 nd upgrade package and the version corresponding to the 1 st upgrade package;
responding to a restart instruction, and starting the system to be upgraded according to the difference data of the 1 st upgrade package, the difference data of the 2 nd upgrade package and the original data of the source version in the user read-only space in the temporary file in the mounting state;
responding to the successful start of the system to be upgraded, writing the difference data of the 1 st upgrade package and the difference data of the 2 nd upgrade package into the user read-only space, combining the difference data of the 1 st upgrade package, the difference data of the 2 nd upgrade package and the original data of the source version into target data of the system to be upgraded, wherein the target data points to the target version of the system to be upgraded;
when differential restoration processing is performed on the upgrade data in the 2 nd upgrade package, if a source address in first upgrade data in the 2 nd upgrade package is overlapped with a target address in second upgrade data but the source address in the second upgrade data is not overlapped with the target address in the first upgrade data, the differential restoration processing of the first upgrade data is earlier than that of the second upgrade data; if the source address in the first upgrading data is coincident with the target address in the second upgrading data, and the source address in the second upgrading data is coincident with the target address in the first upgrading data, the differential reduction processing of one piece of upgrading data in the first upgrading data and the second upgrading data is earlier than that of the other piece of upgrading data, before the differential reduction processing is performed on the upgrading data with early differential reduction processing, the data of the coincident source address in the upgrading data with late differential reduction processing is temporarily stored, and when the differential reduction processing is performed on the upgrading data with late differential reduction processing, the temporarily stored data is adopted; the first upgrade data and the second upgrade data are any two pieces of upgrade data in the 2 nd upgrade package.
14. An electronic device, characterized in that the electronic device comprises: one or more processors, memory; wherein the memory is to store one or more computer program codes comprising computer instructions that, when executed by the one or more processors, cause the electronic device to perform the system upgrade method of claim 13.
CN202110779177.6A 2021-07-09 2021-07-09 System upgrading method and device, electronic equipment and storage medium Active CN114443083B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110779177.6A CN114443083B (en) 2021-07-09 2021-07-09 System upgrading method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110779177.6A CN114443083B (en) 2021-07-09 2021-07-09 System upgrading method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114443083A CN114443083A (en) 2022-05-06
CN114443083B true CN114443083B (en) 2023-04-11

Family

ID=81362462

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110779177.6A Active CN114443083B (en) 2021-07-09 2021-07-09 System upgrading method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114443083B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116719670B (en) * 2022-09-30 2024-04-12 荣耀终端有限公司 Data processing method, electronic device and readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104899066A (en) * 2015-06-19 2015-09-09 青岛海信移动通信技术股份有限公司 Method and device for continuous upgrading
CN109656597A (en) * 2018-12-19 2019-04-19 广东美的暖通设备有限公司 Firmware upgrade method, device and computer readable storage medium

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103530142A (en) * 2013-05-08 2014-01-22 Tcl集团股份有限公司 Android system upgrading method and system based on storage device
CN105718268A (en) * 2016-01-22 2016-06-29 青岛海信移动通信技术股份有限公司 Method and device for verifying OTA multi-pack upgrading
CN106686578A (en) * 2016-12-28 2017-05-17 深圳天珑无线科技有限公司 Difference package generation method and apparatus
CN107220060A (en) * 2017-06-15 2017-09-29 福州汇思博信息技术有限公司 It is a kind of while supporting the method and system of multiple OTA AKUs upgrading
US20190163461A1 (en) * 2017-11-29 2019-05-30 Nutanix, Inc. Upgrade managers for differential upgrade of distributed computing systems
CN108121560A (en) * 2018-01-29 2018-06-05 宇龙计算机通信科技(深圳)有限公司 Difference bag upgrade method, device, terminal and computer readable storage medium
CN110096302B (en) * 2018-01-31 2024-03-01 斑马智行网络(香港)有限公司 Software data storage and upgrading method, device, equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104899066A (en) * 2015-06-19 2015-09-09 青岛海信移动通信技术股份有限公司 Method and device for continuous upgrading
CN109656597A (en) * 2018-12-19 2019-04-19 广东美的暖通设备有限公司 Firmware upgrade method, device and computer readable storage medium

Also Published As

Publication number Publication date
CN114443083A (en) 2022-05-06

Similar Documents

Publication Publication Date Title
US11947974B2 (en) Application start method and electronic device
CN111625431B (en) Log information generation method and device and electronic equipment
US6961848B2 (en) System and method for supporting legacy operating system booting in a legacy-free system
CN114443083B (en) System upgrading method and device, electronic equipment and storage medium
CN105335200B (en) Method for upgrading system and device
US10599444B2 (en) Extensible input stack for processing input device data
CN112394906A (en) Method and equipment for switching application operation
CN116700768B (en) Application processing method and related device
CN111158987A (en) Health check method and device of micro-service architecture
CN113934691B (en) Method for accessing file, electronic device and readable storage medium
US9934124B2 (en) Implementation of processor trace in a processor that supports binary translation
US20230350738A1 (en) Method for Reusing Shared Library and Electronic Device
US11194603B2 (en) User equipment, server, control method of the user equipment and control method of the server for performing ahead-of-time (AOT) compilation of an application based on usage frequency
WO2023061014A1 (en) Task management method and apparatus
CN116643778B (en) Application program optimization method and electronic equipment
CN116662270B (en) File analysis method and related device
CN113722011B (en) Application interface starting method, device, equipment and storage medium
CN117312055B (en) Data backup method and related device
WO2024037346A1 (en) Page management method and electronic device
CN113485923B (en) Project code detection method and device and electronic equipment
EP4318215A1 (en) Application icon update method and related apparatus
CN113495869B (en) File system space adjusting method and device and electronic equipment
WO2024055875A1 (en) Method for adding service card, and electronic device and computer-readable storage medium
CN117389638A (en) Electronic equipment starting method and electronic equipment
CN117093472A (en) Memory operation processing method, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant