CN116069370A - Method, apparatus, storage medium and computer program product for upgrading a cold patch - Google Patents

Method, apparatus, storage medium and computer program product for upgrading a cold patch Download PDF

Info

Publication number
CN116069370A
CN116069370A CN202111274666.2A CN202111274666A CN116069370A CN 116069370 A CN116069370 A CN 116069370A CN 202111274666 A CN202111274666 A CN 202111274666A CN 116069370 A CN116069370 A CN 116069370A
Authority
CN
China
Prior art keywords
partition
static
sub
starting
patch
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.)
Pending
Application number
CN202111274666.2A
Other languages
Chinese (zh)
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 CN202111274666.2A priority Critical patent/CN116069370A/en
Publication of CN116069370A publication Critical patent/CN116069370A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/654Updates using techniques specially adapted for alterable solid state memories, e.g. for EEPROM or flash memories
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/658Incremental updates; Differential updates

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The method is applied to electronic equipment with a data storage structure in a virtual AB mode, when the electronic equipment performs cold patch upgrading in a virtual AB mode starting mode, before the starting sequence is changed from starting from a first static partition to starting from a second static partition after upgrading, whether the second static partition is available or not is judged, when the second static partition is unavailable, the electronic equipment is set to start in a Recovery mode, the second static partition is used as a backup partition, a first static partition is triggered to copy patch files from the second static partition, after copying of the patch files is completed, the electronic equipment is restarted by adopting a virtual AB starting mode and using the first static partition as a starting inlet, so that cold patch upgrading can be realized no matter whether the second static partition is available or not, further the success rate of upgrading of the cold patch is improved, and the reliability of products is improved.

Description

Method, apparatus, storage medium and computer program product for upgrading a cold patch
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and apparatus for upgrading a cold patch, a storage medium, and a computer program product.
Background
Currently, there are two ways of hot patch upgrade and cold patch upgrade in a method for upgrading software of an electronic device, such as a mobile phone. The hot patch upgrade is the replacement of the code segment, so that the local modification of the software can be realized under the condition of not interrupting the service operation, i.e. the hot patch does not need to be restarted; whereas cold patch is a replacement for the executable (specifically, the process) itself, repair of the process requires reallocation of some underlying resources, so cold patch upgrades need to be restarted. For the cold patch upgrade mode, in the application scenario of the prior art, the mode of starting the electronic device may be further divided into a Recovery (Recovery) mode (may also be referred to as a non-AB mode), an AB (FULL-AB) mode, and a virtual AB mode.
Taking an electronic device with a starting mode of a virtual AB mode (which can also be understood as a data storage structure of the electronic device is a virtual AB mode) as an example, if a mobile phone is currently operated in a first static partition during cold patch upgrade, the cold patch upgrade operation cannot be performed on the first static partition because the first static partition is being used, at this time, the cold patch upgrade operation needs to be performed on a second static partition, that is, a patch file is written into a sub-partition corresponding to the patch file in the second static partition, and after the patch file is written into the sub-partition corresponding to the patch file in the second static partition, the starting sequence is directly changed to start from the second static partition, and then the electronic device is restarted according to the changed starting sequence. However, in an actual application scenario, the second static partition may not be available due to physical damage, byte (bit) jump, etc. of the image, so the above-mentioned cold patch upgrade mode may not start the second static partition at all, which may result in failure of cold patch upgrade, and in this case, the mobile phone may roll back to the first static partition, i.e. recover to the version before cold patch upgrade, which may cause the mobile phone to be unable to start up more seriously.
Disclosure of Invention
In order to solve the above technical problems, the present application provides a method, an apparatus, a storage medium, and a computer program product for upgrading a cold patch, which aim to solve the above technical problems, so that an electronic device can complete upgrading of the cold patch by means of a first static partition when a second static partition is unavailable, thereby improving the success rate of upgrading the cold patch and improving the reliability of the product.
In a first aspect, the present application provides a method for upgrading a cold patch, applied to an electronic device, where the electronic device includes a processor and a memory, the memory includes a base partition, a first static partition, a second static partition, a dynamic partition, and a user data partition, the first static partition includes a plurality of sub-partitions, the second static partition includes a plurality of sub-partitions, and the plurality of sub-partitions of the first static partition respectively correspond to the plurality of sub-partitions of the second static partition one by one, and the method includes: loading the basic partition when starting, and acquiring a starting sequence recorded in the basic partition; when the starting sequence is that the first static partition is started, loading data of the first static partition and the dynamic partition to run an operating system; after starting, a first cold patch package is obtained, wherein the first cold patch package comprises a first patch file, the first patch file corresponds to a first sub-partition and a second sub-partition, the first sub-partition is a sub-partition of a second static partition, and the second sub-partition is a sub-partition corresponding to the first sub-partition in the first static partition; performing data writing operation on the first sub-partition according to the first patch file; determining whether the second static partition can be started; when the second static partition is determined to be unable to be started, starting the electronic equipment in a Recovery mode; copying the files in the first sub-partition to the second sub-partition after the electronic equipment enters a Recovery mode; restarting the electronic equipment according to the starting sequence, so that the electronic equipment sequentially loads the data of the basic partition, the first static partition and the dynamic partition to run the operating system.
Therefore, in the method provided by the embodiment of the application, after the first sub-partition to be upgraded in the second static partition is upgraded, namely after the writing operation from the first patch file to the first sub-partition is completed, whether the second static partition is available or not is determined according to the starting identifier corresponding to the second static partition, namely whether the electronic equipment can be restarted by taking the second static partition as a starting inlet, and when the starting identifier is unavailable, cold patch upgrade is completed by means of the first static partition running currently, so that the upgrading success rate of the cold patch is improved, and the reliability of products is improved.
According to a first aspect, performing a data write operation for a first sub-partition according to a first patch file, includes: according to the starting sequence, determining a second static partition which is not started currently as a static partition to be operated by the cold patch butyl upgrading; according to the first patch file, determining a first sub-partition in the second static partition as a sub-partition to be operated by the cold patch butyl upgrading; acquiring a path address of a first sub-partition; and writing the first patch file into the first sub-partition according to the path address. Therefore, the fact that the sub-partition of which static partition is subjected to writing processing in the cold patch upgrading operation at the present time can be accurately determined, and the fact that the patch file in the cold patch Ding Bao acquired at the present time can be accurately written into the correct sub-partition is guaranteed.
According to the first aspect, or any implementation manner of the first aspect, determining whether the second static partition may be started includes: acquiring a starting identifier corresponding to the second static partition from the basic partition; and determining whether the second static partition can be started according to the starting identification. Because the basic partition is not upgraded in the cold patch upgrade process, the startup identification for recording whether the first static partition and the second static partition are available is recorded in the basic partition, so that the startup identification for identifying the first static partition and the second static partition is not lost due to the cold patch upgrade.
According to the first aspect, or any implementation manner of the first aspect, according to the start-up identifier, determining whether the second static partition may be started includes: when the starting identifier is an un-bootable, determining that the second static partition can not be started; and when the starting identifier is Bootable, determining that the second static partition can be started. In the virtual AB mode, a mark capable of identifying whether the partition can be started exists in a first static partition and a second static partition in a double partition mode, specifically, a Bootable is used for identifying that the static partition comprises a complete system capable of being started, an unBootable is used for identifying that a starting system corresponding to the static partition is incomplete, if one or a plurality of sub-partitions have mirror image physical damage or bit jump, whether the static partition can be started or not can be determined by identifying whether the starting mark recorded in a basic partition is the unBootable or the Bootable.
According to the first aspect, or any implementation manner of the first aspect, before acquiring the start identifier corresponding to the second static partition from the base partition, the method further includes: acquiring a starting identifier corresponding to a second static partition recorded in an X-loader sub-partition in the second static partition; and recording the starting identification corresponding to the second static partition into the basic partition. The starting identification of each static partition is recorded in an X-loader sub-partition in the static partition, and the base partition can access the X-loader small partition of each static partition, so that before cold patch upgrading is carried out, the base partition can determine the starting identification corresponding to each static partition.
According to a first aspect of the present invention, or any implementation manner of the first aspect, the method for starting the electronic device in the Recovery mode includes: writing a first starting instruction for starting a Recovery mode in a MIsc sub-partition in the base partition; and responding to the first starting instruction, and enabling the electronic equipment to start in a Recovery mode.
According to a first aspect of the present invention, or any implementation manner of the first aspect, after copying the file in the first sub-partition to the second sub-partition, the method further includes: and erasing the first starting instruction written in the misc sub-partition so as to restart the electronic equipment according to the virtual AB mode. In this way, after the copying of the patch file is completed, the starting instruction for controlling the electronic device to start in the Recovery mode is erased from the MIsc sub-partition, so that the electronic device can continue to load the data of each partition in the memory in sequence according to the starting sequence of the virtual AB mode after restarting, and the operating system is operated.
According to a first aspect, or any implementation manner of the first aspect, copying a file in a first sub-partition to a second sub-partition includes: writing a first upgrading instruction of a sub-partition to be upgraded of a first patch file in a command file of a cache sub-partition in the basic partition; and in response to the first upgrade instruction, copying the files in the first sub-partition to the second sub-partition. According to the method, when the fact that the second static partition after upgrading the sub-partition is unavailable to start is determined, the updated second static partition is used as a backup partition, so that under the condition that the electronic device enters a Recovery mode and cannot access the user data partition, the first patch file can be copied from the second static partition to a second sub-partition corresponding to the first sub-partition in the first static partition, and the electronic device is restarted by taking the first static partition as a starting inlet.
According to the first aspect, or any implementation manner of the first aspect, after restarting the electronic device according to the start-up sequence, the electronic device loads data of the base partition, the first static partition, and the dynamic partition in order to run the operating system, the method further includes: acquiring a second cold patch package, wherein the second cold patch package comprises a second patch file, and the second patch file corresponds to the first sub-partition and the second sub-partition; acquiring a first patch file written in a second sub-partition; generating a first target patch file according to the first patch file and the second patch file; performing data writing operation on the first sub-partition according to the first target patch file; determining whether the second static partition can be started; when the second static partition is determined to be unable to be started, starting the electronic equipment in a Recovery mode; copying the files in the first sub-partition to the second sub-partition after the electronic equipment enters a Recovery mode; restarting the electronic equipment according to the starting sequence, so that the electronic equipment sequentially loads the data of the basic partition, the first static partition and the dynamic partition to run the operating system. According to the method provided by the embodiment of the invention, a differential mode is adopted when a cold patch is upgraded for the first time, only the sub-partition which needs to be upgraded in the static partition is upgraded, the first static partition and the second static partition after the upgrade do not need to be synchronized, the electronic equipment directly operates in the static partition after the upgrade, and when the next cold patch is upgraded, the patch file in the backup partition and the currently acquired patch file are used as target patch files, and the sub-partition in the static partition which needs to be upgraded is upgraded in a full quantity, so that a system of the static partition after the subsequent upgrade is a system for repairing all patches.
According to the first aspect, or any implementation manner of the first aspect, the method further includes: when the second static partition is determined to be started, changing the starting sequence from the starting of the first static partition to the starting of the second static partition; restarting the electronic equipment according to the changed starting sequence, so that the electronic equipment sequentially loads the data of the basic partition, the second static partition and the dynamic partition to run the operating system. In this way, when the patch file is written into the sub-partition of the second static partition and then the second static partition is determined to be available, the second static partition is directly taken as a starting inlet, and the electronic equipment is restarted according to the starting mode of the virtual AB mode, so that the cold patch butyl upgrading is completed.
According to the first aspect, or any implementation manner of the first aspect, when the starting sequence is that the second static partition is started, loading data of the second static partition and the dynamic partition to run an operating system; after starting, a third cold patch package is obtained, wherein the third cold patch package comprises a third patch file, the third patch file corresponds to a third sub-partition and a fourth sub-partition, the third sub-partition is a sub-partition of the first static partition, and the fourth sub-partition is a sub-partition of the second static partition; performing data writing operation on the third sub-partition according to the third patch file; determining whether the first static partition can be started; when the fact that the first static partition cannot be started is determined, starting the electronic equipment in a Recovery mode; copying the file in the third sub-partition to a fourth sub-partition after the electronic equipment enters a Recovery mode; and restarting the electronic equipment according to the starting sequence, and sequentially loading the data of the basic partition, the second static partition and the dynamic partition to run the operating system.
According to the first aspect, or any implementation manner of the first aspect, performing, according to the third patch file, a data writing operation for the third sub-partition includes: according to the starting sequence, determining a second static partition which is not started currently as a static partition to be operated by the cold patch butyl upgrading; according to the third patch file, determining a third sub-partition in the first static partition as a sub-partition to be operated by the cold patch butyl upgrading; obtaining a path address of a third sub-partition; and writing the third patch file into the third sub-partition according to the path address.
According to a first aspect, or any implementation manner of the first aspect, determining whether the first static partition may be started includes: acquiring a starting identifier corresponding to a first static partition from a basic partition; and determining whether the first static partition can be started according to the starting identification.
According to the first aspect, or any implementation manner of the first aspect, according to the start-up identifier, determining whether the first static partition may be started includes: when the starting identifier is an un-bootable, determining that the first static partition can not be started; and when the starting identifier is Bootable, determining that the first static partition can be started.
According to the first aspect, or any implementation manner of the first aspect, before acquiring the start identifier corresponding to the first static partition from the base partition, the method further includes: acquiring a starting identifier corresponding to a first static partition recorded in an X-loader sub-partition in the first static partition; and recording the starting identification corresponding to the first static partition into the basic partition.
According to the first aspect, or any implementation manner of the first aspect, the method for starting the electronic device in the Recovery mode includes: writing a second starting instruction for starting the Recovery mode in the MIsc sub-partition in the base partition; and responding to the second starting instruction, and enabling the electronic equipment to start in a Recovery mode.
According to the first aspect, or any implementation manner of the first aspect, after copying the file in the third sub-partition to the fourth sub-partition, the method further includes: and erasing the second starting instruction written in the misc sub-partition so as to restart the electronic equipment according to the virtual AB mode.
According to the first aspect, or any implementation manner of the first aspect, copying the file in the third sub-partition to the fourth sub-partition includes: writing a second upgrading instruction of the sub-partition to be upgraded of the third patch file in a command file of the cache sub-partition in the basic partition; and in response to the second upgrade instruction, copying the file in the third sub-partition to the fourth sub-partition.
According to the first aspect, or any implementation manner of the first aspect, after restarting the electronic device according to the start-up sequence, the electronic device loads data of the base partition, the second static partition, and the dynamic partition in order to run the operating system, the method further includes: acquiring a fourth cold patch package, wherein the fourth cold patch package comprises a fourth patch file, and the fourth patch file corresponds to the third sub-partition and the fourth sub-partition; acquiring a third patch file written in a fourth sub-partition; generating a second target patch file according to the third patch file and the fourth patch file; performing data writing operation on the third sub-partition according to the second target patch file; determining whether the first static partition can be started; when the fact that the first static partition cannot be started is determined, starting the electronic equipment in a Recovery mode; copying the file in the third sub-partition to a fourth sub-partition after the electronic equipment enters a Recovery mode; restarting the electronic equipment according to the starting sequence, so that the electronic equipment sequentially loads the data of the basic partition, the second static partition and the dynamic partition to run the operating system.
According to the first aspect, or any implementation manner of the first aspect, when it is determined that the first static partition may be started, changing the starting sequence from starting from the second static partition to starting from the first static partition; restarting the electronic equipment according to the changed starting sequence, so that the electronic equipment sequentially loads the data of the basic partition, the first static partition and the dynamic partition to run the operating system.
In a second aspect, the application provides an electronic device, where a data storage structure of the electronic device is in a virtual AB mode, and the electronic device includes a processor and a memory, where the memory includes a base partition, a first static partition, a second static partition, a dynamic partition, and a user data partition, the first static partition includes a plurality of sub-partitions, the second static partition includes a plurality of sub-partitions, and the plurality of sub-partitions of the first static partition are respectively in one-to-one correspondence with the plurality of sub-partitions of the second static partition; wherein the memory is coupled to the processor, the memory storing program instructions; the program instructions, when executed by a processor, cause an electronic device to perform the instructions of the first aspect, or the method in any implementation of the first aspect above.
In a third aspect, the present application provides a computer readable medium storing a computer program for causing an electronic device to execute instructions of the first aspect, or of a method in any one of the implementations of the first aspect, when the computer program is run on the electronic device.
In a fourth aspect, the present application provides a computer program product comprising instructions which, when run on an electronic device, cause the electronic device to perform the method of the first aspect, or any implementation of the first aspect above.
In a fifth aspect, the present application provides a chip comprising processing circuitry, a transceiver pin. Wherein the transceiver pin and the processing circuit communicate with each other via an internal connection path, the processing circuit executing instructions of the first aspect, or of the method in any implementation of the first aspect above, to control the receiver pin to receive signals, to control the transmitter pin to transmit signals.
Drawings
Fig. 1 is a schematic diagram of a hardware structure of an electronic device exemplarily shown;
FIG. 2 is a schematic diagram of a data storage structure for the Recovery mode, the AB mode, and the virtual AB mode, which are shown by way of example;
FIG. 3 is a schematic diagram of an exemplary scenario in which an end-side and a server-side interact to obtain a cold patch package;
FIG. 4 is a schematic diagram of a software architecture of an electronic device shown by way of example;
FIG. 5 is one of the flow charts of the cold patch upgrade method provided by the exemplary embodiments of the present application;
FIG. 6 is a schematic diagram of loading partitions as exemplarily shown with respect to step S102 shown in FIG. 5;
fig. 7 is a schematic diagram of the patch file written in the first cold patch package exemplarily shown with respect to step S104 and step S105 shown in fig. 5;
FIG. 8 is a schematic diagram illustrating the acquisition of a boot identification of a second static partition;
FIG. 9 is a schematic diagram of loading partitions upon rebooting the electronic device, as exemplarily shown with respect to step S106 shown in FIG. 5;
FIG. 10 is a schematic diagram of loading partitions upon rebooting the electronic device, as exemplarily shown with respect to step S107 shown in FIG. 5;
FIG. 11 is a second flow chart illustrating a method of upgrading a cold patch provided by an embodiment of the present application;
fig. 12 is a schematic diagram of the patch file written in the second cold patch package exemplarily shown with respect to step S202 to step S205 shown in fig. 11;
FIG. 13 is a third flow chart illustrating a method of upgrading a cold patch provided by an embodiment of the present application;
fig. 14 is a flowchart illustrating a method for upgrading a cold patch according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
The term "and/or" is herein merely an association relationship describing an associated object, meaning that there may be three relationships, e.g., a and/or B, may represent: a exists alone, A and B exist together, and B exists alone.
The terms first and second and the like in the description and in the claims of embodiments of the present application are used for distinguishing between different objects and not necessarily for describing a particular sequential order of objects. For example, the first target object and the second target object, etc., are used to distinguish between different target objects, and are not used to describe a particular order of target objects.
In the embodiments of the present application, words such as "exemplary" or "such as" are used to mean serving as examples, illustrations, or descriptions. Any embodiment or design described herein as "exemplary" or "for example" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
In the description of the embodiments of the present application, unless otherwise indicated, the meaning of "a plurality" means two or more. For example, the plurality of processing units refers to two or more processing units; the plurality of systems means two or more systems.
In order to better understand the technical solution provided in the embodiments of the present application, before describing the technical solution of the embodiments of the present application, a description is first given of a hardware structure of an electronic device (for example, a mobile phone, a tablet device, a PC device, etc.) applicable to the embodiments of the present application with reference to the accompanying drawings.
Referring to fig. 1, an electronic device 100 may include: processor 110, external memory interface 120, internal memory 121, universal serial bus (universal serial bus, USB) interface 130, charge management module 140, power management module 141, battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, sensor module 180, keys 190, motor 191, indicator 192, camera 193, display 194, and subscriber identity module (subscriber identification module, SIM) card interface 195, among others.
By way of example, the audio module 170 may include a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, and the like.
By way of example, the sensor module 180 may include a pressure sensor, a gyroscope sensor, a barometric pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, and the like.
Further, the processor 110 may include one or more processing units, such as: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural network processor (neural-network processing unit, NPU), etc.
It will be appreciated that in particular implementations, the different processing units may be separate devices or may be integrated in one or more processors.
Further, in some embodiments, the controller may be a neural hub and command center of the electronic device 100. The controller can generate operation control signals according to the instruction operation codes and the time sequence signals to finish the control of instruction fetching and instruction execution.
In addition, memory in the processor 110 is primarily used for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory.
Further, it is understood that in an actual application scenario, executable program code, including instructions, that trigger the electronic device 100 to implement various functional applications and data processing is stored in the internal memory 121.
For example, in particular, in the technical solution provided in the embodiment of the present application, the starting of the electronic device 100 and the upgrading of the cold patch mainly involve the internal memory 121, that is, the relevant instructions for implementing the upgrading method of the cold patch provided in the embodiment of the present application are stored in advance in the internal memory 121, and the processor 110 executes the instructions stored in the internal memory 121, so that the electronic device 100 can execute the upgrading method of the cold patch provided in the embodiment of the present application.
In addition, it should be noted that, in a specific implementation, the internal memory 121 may include a storage program area and a storage data area. The storage program area may store an application program (such as a sound playing function, an image playing function, etc.) required for at least one function of the operating system, etc. The storage data area may store data created during use of the electronic device 100 (e.g., audio data, phonebook, etc.), and so on. 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 (universal flash storage, UFS), and the like.
Exemplary, regarding the program storage area, specifically, in the technical solutions provided in the embodiments of the present application, for example, basic partition (Common), static partition (Slot), and dynamic partition (Super); the storage data area, specifically in the technical solution provided in the embodiments of the present application, may be, for example, a user data partition (Userdata).
In addition, it can be understood that in an actual application scenario, the basic partition generally stores content which is not updated when the cold patch is updated, the static partition and the dynamic partition store content which is possibly updated when the cold patch is updated, and the user data partition stores data created in the use process of the electronic device, and the content is not updated when the cold patch is updated, so that user data loss caused by updating is avoided, and user experience is affected.
For example, in practical applications, the data storage structure of the internal memory 121 of the electronic device 100 may be, for example, a Recovery mode, an AB mode, and a virtual AB mode, and the startup modes of the electronic device 100 with different data storage structures may also be different.
It should be noted that, in practical application, the mode corresponding to the data storage structure is generally consistent with the mode corresponding to the start mode, that is, the data storage structure is the electronic device in the Recovery mode, and the corresponding start mode is also the Recovery mode; the data storage structure is an electronic device in an AB mode, and the corresponding starting mode is also the AB mode; the data storage structure is an electronic device in a virtual AB mode, and the corresponding starting mode is also the virtual AB mode.
Specifically, based on the characteristics of the four partitions, for the partitions that generally do not need to be upgraded in the cold patch butyl upgrade and the system upgrade, for example, the base partition and the user data partition, both in the Recovery mode, the AB mode and the virtual AB mode, a single partition is adopted, and the partitions that need to be upgraded are different.
For example, since the cold patch upgrade is performed in the Recovery mode, other functions of the electronic device cannot be used in the upgrade process, the electronic device can only stay on the upgrade interface in the Recovery mode, and the user interface can be accessed for normal use after the cold patch upgrade is completed and the electronic device is restarted. Therefore, in the Recovery mode, the static partition and the dynamic partition are also single partitions, see the schematic diagram (1) of the data storage structure of the Recovery mode in fig. 2, so that the occupation of the memory space can be reduced, and more space is reserved for the user data partition.
The AB mode is exemplary, so that a user can return to the main interface of the electronic device at will during the upgrade process of the cold patch, thereby not affecting the use of the electronic device. Thus, in the AB mode, the static partition and the dynamic partition adopt dual partitions, see the AB mode data storage structure schematic diagram (2) in fig. 2, and the static partition may be divided into a first static partition (SlotA) and a second static partition (SlotB), and the dynamic partition may be divided into a first dynamic partition (SuperA) and a second dynamic partition (SuperB), for example. The partition dividing mode can enable the electronic equipment to return to the main interface of the electronic equipment at will in the cold patch butyl upgrading process, but occupies a large space of the memory, so that the available space of the user data partition is greatly reduced.
The virtual AB mode combines the advantages of the Recovery mode and the AB mode, and divides a static partition, which occupies a small memory space, into a first static partition (SlotA) and a second static partition (SlotB), and a dynamic partition, which occupies a large memory space, is a single partition, which is shown in fig. 2 as a virtual AB mode data storage structure diagram (3).
It should be noted that, in practical application, the partition deployment information for the internal memory in the electronic device may be described by a partition table shown in table 1.
TABLE 1 partition Table
Figure BDA0003329047040000081
Figure BDA0003329047040000091
In this way, the starting address and size of each partition are defined by the partition table, so that the corresponding partition size can be adjusted as needed for different hardware.
It should be understood that the above description is only an example for better understanding of the technical solution of the present embodiment, and is not to be taken as the only limitation of the present embodiment.
That is, in practical applications, the partitions recorded in the partition table may be set in a partition manner according to the actual service requirements.
In addition, regarding the distribution of the partitions using the double partition shown in fig. 2 (2) and 2 (3) in the memory, the distribution is not limited to that shown in fig. 2 (2) and 2 (3), and the positions of the respective partitions are determined according to the assigned start address and end address in practical application.
As to the hardware architecture of the electronic device 100, it should be understood that the electronic device 100 shown in fig. 1 is merely an example, and in particular implementations, the electronic device 100 may have more or fewer components than shown, may combine two or more components, or may have different component configurations. The various components shown in fig. 1 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
In a specific technical solution of the embodiment of the present application, an electronic device with a data storage structure as a virtual AB mode is taken as an example to describe in detail an upgrade process of a cold patch.
It should be noted that, in an actual application scenario, along with development of Over-the-Air Technology (OTA), OTA upgrading for implementing remote version upgrade of a terminal device through a wireless network interface of the terminal device is becoming popular. In combination with an actual service scenario, the upgrade scheme of the cold patch butyl described in the embodiment of the present application takes an OTA upgrade scenario as an example. For example, referring to fig. 3, a cold patch Ding Bao for repairing software is provided to an OTA server in the cloud by a packet capturing server for management, where the OTA server sends a corresponding cold patch Ding Bao to an electronic device according to a request for acquiring a cold patch initiated by a different electronic device (such as a PC device, a tablet device, a mobile phone, etc.) at the end side, or the OTA server actively pushes the cold patch Ding Bao sent by the packet capturing server to the corresponding electronic device after receiving the cold patch.
For example, the cold patch Ding Bao issued by the clapping server to the OTA server may be issued by the clapping server after the clapping server has made the cold patch Ding Baohou and actively sends the cold patch to the OTA server, or may be issued by the OTA server to the clapping server after the request for obtaining the cold patch is initiated by the OTA server and when the cold patch exists in the clapping server.
Regarding the manner in which the copy server makes the cold patch Ding Bao version, pushes the cold patch to the OTA server, and the OTA server pushes the cold patch to the electronic device, the present application will not describe this.
In addition, in order to upgrade the cold patch of the electronic equipment according to the technical scheme provided by the embodiment of the application, the software structure of the electronic equipment is adjusted.
Illustratively, referring to FIG. 4, OUC (OTA Update Client), APK patch engine, etc. for OTA upgrades are included in the Application layer (Application).
Illustratively, with continued reference to FIG. 4, a cold patch Ding Yinqing, notification manager, etc. is included in the application Framework layer (Framework).
For example, referring to fig. 4, the Native layer for the loading process includes an ereovery upgrade engine (engine for restoring the factory system), a Recovery upgrade engine, a virtual AB upgrade engine, and the like, so when a cold patch is upgraded in the virtual AB mode, when the upgraded second static partition cannot be started, the Recovery upgrade engine may be directly triggered, and according to the technical scheme provided by the embodiment of the present application, the electronic device is restarted by means of the currently running first static partition to complete cold patch upgrade.
Illustratively, with continued reference to FIG. 4, a control-initiated interface (Boot ctrl), a call CMD service interface (CMD server), a hardware description interface (Hardware Description Language, HDL) describing hardware are included in the hardware abstraction layer (Hardware Abstraction Layer, HAL).
Illustratively, with continued reference to FIG. 4, a cold patch Ding Yinqing is included in the Kernel layer (Kernel).
By way of example, with continued reference to fig. 4, a specific boot mode of the electronic device, such as a Fast boot upgrade mode (Fast boot upgrade), an AB partition boot mode, and a boot mode selection program that may select other boot modes, is included in the boot loader layer (BootLoader).
Note that, the BootLoader shown in fig. 4 is a program that is cured on a Read-Only Memory (ROM) chip on a motherboard in the electronic device, and is executed before the operating system runs. Through the small program, the electronic device can initialize the hardware device and establish a mapping table of the memory space when determining, thereby establishing a proper system software and hardware environment and preparing for finally calling the kernel of the operating system. That is, what kind of starting mode is adopted when the electronic device is started is determined in BootLoader.
As to the software structure of the electronic device, it is to be understood that the layers and the components included in the layers in the software structure shown in fig. 4 do not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer layers than shown, and more or fewer components may be included in each layer, as the present application is not limited.
Based on the above hardware structure and software structure, the following description describes in detail the technical scheme provided in the embodiment of the present application, taking the scenario that the first static partition is started and loaded for the first time by the electronic device, the second static partition is updated for the cold patch performed after the electronic device is started and loaded for the first time by the electronic device, and the first static partition is updated for the cold patch performed after the electronic device is started.
Referring to fig. 5, the first boot loading of the electronic device is a first static partition, and the cold patch upgrade performed after the boot is an implementation flow of the second static partition, which specifically includes:
step S101, loading the basic partition at the starting time, and acquiring the starting sequence recorded in the basic partition.
Specifically, the electronic device loads the base partition first when the electronic device is started, and reads the recorded starting mode from the mis sub-partition in the base partition after the base partition is loaded.
It will be appreciated from the above description that the current startup mode of the electronic device may be generally a Recovery mode, an AB mode, and a virtual AB mode.
The technical solution provided in this embodiment is to solve the problem in the process of upgrading the cold patch in the virtual AB mode, so this embodiment takes the starting mode read from the mis sub-partition as the virtual AB mode as an example.
Accordingly, when the startup mode is the virtual AB mode, for this startup mode, the data storage structure in the memory adopts the structure of fig. 2 (3), so that the startup sequence to be followed by the startup operation needs to be obtained from the base partition, so as to determine whether the startup operation is started from the first static partition or the second static partition.
In step S102, when the starting sequence is that the first static partition is started, the data of the first static partition and the dynamic partition are loaded to run the operating system.
Illustratively, when it is determined that the boot sequence is to be initiated from the first static partition, the process of loading the data of the first static partition and the dynamic partition in sequence is detailed in fig. 6.
Step S103, after starting, acquiring a first cold patch package.
For example, after the electronic device loads the data of the base partition, the first static partition and the dynamic partition in turn according to the loading sequence shown in fig. 6, and further starts the operating system, and enters the user interface, the electronic device may obtain a first cold patch packet for repairing/upgrading locally installed software/application programs or some Bug of the operating system from the OTA server.
Illustratively, in one possible implementation, the operation of obtaining the first cold patch package may be: the electronic device actively obtains a first cold patch package from the OTA server.
For example, the electronic device periodically initiates a Request1 for searching the cold patch package to the OTA server, and after receiving the Request1, if the first cold patch package requested by the Request1 is queried and stored locally, the OTA server makes a Response1 to the electronic device and sends the queried first cold patch package to the electronic device; if the OTA server does not inquire the first cold patch package locally, a Request2 for searching the cold patch package can be initiated to the patch package server, and after the patch package server receives the Response2, if the first cold patch package is inquired to be released locally, the Response2 is made to the OTA server, the first cold patch package is sent to the OTA server, and therefore the OTA server can send the received first cold patch package to the electronic equipment.
For example, in another possible implementation, the operation of obtaining the first cold patch package may be: the OTA server periodically pushes the first cold patch package acquired from the package beating server to the electronic device.
For example, the OTA server periodically pushes the first cold patch package to the electronic device after actively acquiring the first cold patch package from the package beating server or after receiving the first cold patch package actively issued by the package beating server.
It can be appreciated that in an actual application scenario, the first cold patch package includes a patch file for upgrading one or several sub-partitions in the static partition.
For convenience of explanation, the first cold patch package in this embodiment includes a first patch file. The first patch file corresponds to a first sub-partition and a second sub-partition, the first sub-partition is one sub-partition of the second static partition, the second sub-partition is a sub-partition corresponding to the first sub-partition in the first static partition, for example, the vendor_a and vendor_b in fig. 7, that is, when the first patch file is a vendor (2.0) patch file, the first sub-partition corresponding to the patch file is vendor_b in fig. 7, and the second sub-partition is vendor_a in fig. 7.
It should be understood that the above description is only an example for better understanding of the technical solution of the present embodiment, and is not to be taken as the only limitation of the present embodiment.
Step S104, performing data writing operation on the first sub-partition according to the first patch file.
In practical application, after the first patch file is parsed from the first cold patch package, the static partition which is not started currently is determined as the static partition to be operated by the cold patch upgrade according to the starting sequence recorded in the base partition, then the sub-partition corresponding to the first patch file in the determined static partition is determined as the sub-partition to be operated by the cold patch upgrade according to the first patch file, then the address path of the determined sub-partition is obtained, for example, the starting address and the ending address of the sub-partition recorded in the partition table are obtained, and finally the first patch file is written into the determined sub-partition according to the obtained path address.
In this embodiment, since the starting sequence is started from the first static partition, the second static partition that is not started currently is determined as the static partition to be operated by the cold patch upgrade.
Correspondingly, according to the first patch file, the first sub-partition in the second static partition is determined to be the sub-partition to be operated by the cold patch upgrade.
Finally, the path address of the first sub-partition is obtained from the partition table, and then the first patch file is written into the first sub-partition according to the obtained path address, as shown in schematic diagram (1) in fig. 7.
For example, with continued reference to fig. 7, after the first patch file is written to the vendor_b sub-partition of the second static partition according to the operation of step S104, the version of the vendor_b sub-partition may be upgraded from 1.0 to 2.0, as shown in fig. 7 (2).
Step S105, determining whether the second static partition can be started.
Specifically, for the virtual AB mode, the first static partition and the second static partition both have several attributes, active, bootable (Bootable corresponding to Bootable) and Successful. The system only has one partition set as the active attribute, and the bootloader selects the partition set as the active for starting; the Bootable is used for marking that the partition can be started, and the partition set as the Bootable indicates that the partition contains a complete system capable of being started; the UnBooable is used for identifying the unavailable start of the partition, and the partition set as the UnBooable indicates that the partition contains an incomplete system, namely if the static partition identified by the UnBooable is started, the electronic equipment cannot be restarted at all or rolls back the version before the cold patch upgrading operation; the success of the partition is identified by the success of the partition, and a partition set to success indicates that the partition may be operating correctly in the last boot or current boot. Based on the method, whether the second static partition can be started or not can be determined by judging whether the starting identifier recorded in the basic partition is Bootable or not.
Based on the starting identification, when determining whether the second static partition can be started, the second static partition can be determined whether to be started or not according to the starting identification by acquiring the starting identification corresponding to the second static partition from the basic partition.
When the boot identifier corresponding to the second static partition obtained from the base partition is Bootable, it is determined that the second static partition may be booted, and step S106 is performed in this case, that is, the boot sequence is upgraded to be started from the second static partition, and then the electronic device is restarted according to the changed boot sequence.
Correspondingly, when the starting identifier corresponding to the second static partition obtained from the base partition is un-bootable, determining that the second static partition can not be started, in this case, entering step S107, that is, performing cold patch upgrade by using a Recovery mode by means of the first static partition which is currently active, and restarting the electronic device.
In addition, it should be noted that, in an actual application scenario, a startup identifier for identifying whether each static partition can be started may be recorded in an X-loader sub-partition in each static partition.
For example, for the current scenario (the electronic device is first started and loaded with the first static partition, and the cold patch upgrade performed after the startup is performed on the second static partition), it needs to be determined whether the second static partition can be started, so that the starting identifier corresponding to the second static partition is obtained from the base partition.
For example, in one implementation, the boot identifier corresponding to the second static partition may be obtained from an X-loader sub-partition in the second static partition before the electronic device obtains the first cold patch package, and then the obtained boot identifier is recorded in the base partition.
For example, in another implementation, the boot identifier corresponding to the second static partition may be obtained from the X-loader sub-partition in the second static partition after the electronic device obtains the first cold patch package, and then the obtained boot identifier is recorded in the base partition, as shown in fig. 8 in detail.
And step S106, changing the starting sequence from the starting of the first static partition to the starting of the second static partition, restarting the electronic equipment according to the changed starting sequence, and enabling the electronic equipment to sequentially load the data of the basic partition, the second static partition and the dynamic partition so as to run the operating system.
For example, after changing the boot sequence from the first static partition to the second static partition, the data of the base partition, the second static partition, and the dynamic partition may be sequentially loaded according to the partition loading diagram shown in fig. 9 to run the operating system.
Step S107, the electronic device is started in a Recovery mode.
Specifically, when it is determined that the second static partition is not bootable, for example, it may be that the dtbo_b sub-partition in the second static partition in fig. 10 (1) has a mirror physical damage or bit jump, or that other sub-partitions have a mirror physical damage or bit jump, the electronic device writes a first boot instruction for starting the Recovery mode in the risc sub-partition in the base partition, so that the electronic device can start in the Recovery mode after responding to the first boot instruction.
For example, the first boot instruction written to the MIsc child partition may be "boot-recovery".
Step S108, after the electronic device enters the Recovery mode, the files in the first sub-partition are copied to the second sub-partition.
Specifically, after the electronic device enters the Recovery mode, the electronic device writes a first upgrade instruction of a sub-partition to be upgraded by the first patch file in a command file of a cache sub-partition in the base partition, so that the electronic device can copy the file in the first sub-partition to the second sub-partition after responding to the first upgrade instruction.
Illustratively, in this embodiment, the first upgrade instruction written to the command file may be determined according to a file name of the first patch file written to the first sub-partition.
For example, when the first patch file is a vendor patch file, the first upgrade instruction written to the command file may be "-ota-ab-vendor-update".
Also for example, where the first patch file is a patch file, the first upgrade instruction written to the command file may be "-ota-ab-patch-update.
Thus, after entering the Recovery mode, the electronic device can know which sub-partition in the second static partition is to be copied to the corresponding sub-partition in the first static partition.
For example, referring to diagram (1) in fig. 10, according to the "boot-Recovery" instruction written into the MIsc sub-partition in the base partition, the Recovery mode is triggered, and then according to the "-ota-ab-vendor-update" instruction written into the command file of the cache sub-partition in the base partition, the vendor_b (2.0) copy mode in which the version upgrade has been completed in the second static partition is copied to the vendor_a sub-partition in the first static partition, so that the vendor_a sub-partition is upgraded from version 1.0 to version 2.0.
In addition, in practical application, when the file in the first sub-partition is copied to the second sub-partition, a file copying method may be selected appropriately according to the size of the file, the number of times of copying, and the desired copying speed.
For example, in one implementation, for a scene with a sub-partition size smaller than 256KB that needs to be replicated, a Buffer vs. filechannel (indirect mode) may be used for replication, and vice versa.
For example, in another implementation, for more times than 7 times, for example, the replication may be performed by using filechannel.
Illustratively, in another implementation, a Path-to-Path approach may be employed for fast replication.
It should be understood that the above description is only an example for better understanding of the technical solution of the present embodiment, and is not to be taken as the only limitation of the present embodiment.
In addition, it should be noted that, in order to ensure that the electronic device may still be started in the virtual AB mode, after the operation in step S108 is completed, the first start instruction written in the mis sub-partition needs to be erased, so that when the electronic device starts the start mode of loading the base partition to read the record of the mis sub-partition, the electronic device will not read the message started in the Recovery mode, but still restart in the virtual AB mode.
Step S109, restarting the electronic device according to the starting sequence, so that the electronic device sequentially loads the data of the basic partition, the first static partition and the dynamic partition to run the operating system.
For example, after the operation shown in the schematic diagram (1) in fig. 10 is completed, the data of the base partition, the first static partition and the dynamic partition are sequentially loaded according to the loading sequence of the schematic diagram (2) in fig. 10 to run the operating system, and after the operating system runs, the cold patch upgrade is completed.
In addition, it should be noted that, in practical application, when the boot identifier of the first static partition or the second static partition is an un-Bootable, each subsequent cold patch upgrade operation can only be started from the static partition whose boot identifier is Bootable. If the static partition with the starting identifier of UnBooable is to be started, the version upgrade of the operating system needs to be completed once, so that the repair of the unavailable static partition is completed, the starting identifier is changed from UnBooable to Booable, and the step S106 can be normally carried out during the subsequent cold patch upgrade.
Therefore, in the method provided by the embodiment of the application, after the first sub-partition to be upgraded in the second static partition is upgraded, namely after the writing operation from the first patch file to the first sub-partition is completed, whether the second static partition is available or not is determined according to the starting identifier corresponding to the second static partition, namely whether the electronic equipment can be restarted by taking the second static partition as a starting inlet, and when the starting identifier is unavailable, cold patch upgrade is completed by means of the first static partition running currently, so that the upgrading success rate of the cold patch is improved, and the reliability of products is improved.
In addition, it should be noted that, because the technical solution provided in the embodiment of the present application does not need to perform a synchronous upgrade on another static partition after the cold patch upgrade is completed, when the next cold patch upgrade is performed, in order to avoid that the static partition switched to after the restart is the static partition that has not been upgraded last time and thus loses the first patch file of the last cold patch upgrade, which affects the use of the user, after restarting according to step S109 in fig. 5, the electronic device performs a new round of cold patch upgrade according to the process shown in fig. 11 if the cold patch package is received again, for example, referred to as the second cold patch package, and specifically includes:
step S201, a second cold patch package is acquired.
Specifically, the second cold patch package includes a second patch file, where the second patch file is a patch file for the first sub-partition, that is, the same sub-partition in the second static partition is upgraded in the same process as the last cold patch butyl upgrade process.
Step S202, a first patch file written in a second sub-partition is obtained.
Step S203, a first target patch file is generated according to the first patch file and the second patch file.
In step S204, a data writing operation is performed on the first sub-partition according to the first target patch file.
For example, still with the child partition to be upgraded in the second static partition being a vendor_b, referring to fig. 12, when the vendor_b is upgraded, a first patch file needs to be read from the vendor_a child partition in the first static partition that is currently started, then a first target patch file that needs to be finally written into the vendor_b child partition is generated according to the second patch file in the obtained second cold patch package and the first patch file that is read, and the first target patch file is written into the vendor_b child partition, so that the version of the vendor_b child partition is upgraded to 3.0 version shown in fig. 12 in schematic diagram (2).
It should be noted that, before executing the steps S202 to S204, the patch file written into the vendor_b sub-partition in the second static partition is first erased, so as to avoid the exception of the upgrade.
It should be understood that the above description is only an example for better understanding of the technical solution of the present embodiment, and is not to be taken as the only limitation of the present embodiment.
In step S205, it is determined whether the second static partition can be started.
Specifically, when the boot identifier corresponding to the second static partition obtained from the base partition is Bootable, it is determined that the second static partition may be started, and step S206 is performed in this case, that is, the boot sequence is updated to the second static partition, and then the electronic device is restarted.
Correspondingly, when the starting identifier corresponding to the second static partition obtained from the base partition is un-bootable, determining that the second static partition can not be started, in this case, entering step S207, that is, performing cold patch upgrade by using a Recovery mode by means of the first static partition which is currently active, and restarting the electronic device.
Step S206, changing the starting sequence from the first static partition to the second static partition, and restarting the electronic device according to the changed starting sequence to load the data of the basic partition, the second static partition and the dynamic partition in sequence so as to run the operating system.
Step S207, the electronic device is started in a Recovery mode.
In step S208, after the electronic device enters the Recovery mode, the file in the first sub-partition is copied to the second sub-partition.
Step S209, restarting the electronic device according to the starting sequence, so that the electronic device sequentially loads the data of the basic partition, the first static partition and the dynamic partition to run the operating system
It is easy to find that, in the embodiment shown in fig. 12, steps S201, S202, and S205 to S209 are substantially similar to steps S103 to S109 in the embodiment shown in fig. 5, and specific implementation details of this embodiment may be referred to the description of the embodiment shown in fig. 5, which is not repeated herein.
Therefore, in the method provided by the embodiment of the application, a differential mode is adopted when a cold patch is upgraded for the first time, only the sub-partition which needs to be upgraded in the static partition is upgraded, the first static partition and the second static partition after the upgrade do not need to be synchronized, the electronic equipment directly operates in the static partition after the upgrade, and in the next time of cold patch upgrade, the sub-partition in the static partition which needs to be upgraded is upgraded in a full quantity by taking the patch file in the backup partition and the currently acquired patch file as target patch files, so that the system of the static partition after the subsequent upgrade is a system for repairing all patches.
In addition, it should be noted that in an actual application scenario, whether the electronic device is restarted from the first static partition or from the second static partition, if a cold patch upgrade packet, for example, the second cold patch packet described above, is received again after the electronic device is restarted, if the upgrade is the same sub-partition, the contents in the sub-partition that needs to be upgraded are erased, then the target patch file that needs to be written in this time is generated according to the patch file in the cold patch Ding Bao that is acquired this time and the patch file that is written in the corresponding sub-partition in the static partition that is started currently when the cold patch is updated last time, and then the target patch file is written in the corresponding sub-partition. The above embodiment is only exemplified by the first static partition that is still started after the restart, and the manner of starting from the second static partition is similar to the above embodiment and is not repeated here.
Referring to fig. 13, the first boot loading of the electronic device is a second static partition, and the cold patch upgrade performed after the boot is an implementation flow of the first static partition, which specifically includes:
step S301, loading the basic partition at the starting time, and acquiring the starting sequence recorded in the basic partition.
In step S302, when the startup sequence is that of the second static partition, the second static partition and the dynamic partition are loaded.
Step S303, after starting, obtaining a third cold patch package.
The third cold patch package includes a third patch file, where the third patch file corresponds to a third sub-partition and a fourth sub-partition, the third sub-partition is a sub-partition of the first static partition, for example, may be a vendor_a sub-partition, the fourth sub-partition is a sub-partition corresponding to the third sub-partition in the second static partition, for example, the third sub-partition is a vendor_a sub-partition, and the fourth sub-partition is a vendor_b sub-partition.
Step S304, the data writing operation is carried out on the third sub-partition according to the third patch file.
Step S305, determining whether the first static partition can be started.
For example, the boot identifier corresponding to the first static partition is recorded in the base partition, and similar to the boot identifier of the second static partition, the partition is identified as not Bootable by the UnBootable, and the partition is identified as Bootable by the Bootable. Therefore, when determining whether the first static partition can be started according to the starting identifier corresponding to the first static partition recorded by the base partition, the starting identifier corresponding to the first static partition is obtained from the base partition.
Correspondingly, when the acquired starting identifier is an un-bootable, determining that the first static partition can not be started; and when the starting identifier is Bootable, determining that the first static partition can be started.
In addition, the boot identifier for identifying whether the first static partition can boot is stored in a similar location as the boot identifier for identifying whether the second static partition can boot, i.e., recorded in the X-loader sub-partition in the first static partition.
That is, before the start identifier corresponding to the first static partition is obtained from the base partition, the start identifier corresponding to the first static partition recorded in the X-loader sub-partition in the first static partition needs to be obtained first; and then recording the starting identification corresponding to the first static partition into the basic partition.
Thus, through the determination of step S305, when it is determined that the first static partition can be started, step S306 is entered; otherwise, the process advances to step S307.
And step S306, changing the starting sequence from the starting of the second static partition to the starting of the first static partition, and restarting the electronic equipment according to the changed starting sequence, so that the electronic equipment sequentially loads the data of the basic partition, the first static partition and the dynamic partition to run the operating system.
Step S307, the electronic device is started in the Recovery mode.
In step S308, after the electronic device enters the Recovery mode, the file in the third sub-partition is copied to the fourth sub-partition.
Step S309, restarting the electronic device according to the starting sequence, and loading the data of the basic partition, the second static partition and the dynamic partition in sequence to run the operating system.
It is not difficult to find that steps S301 to S309 in the embodiment shown in fig. 13 are substantially similar to steps S101 to S109 in the embodiment shown in fig. 5, and specific implementation details of this embodiment may be referred to the description of the embodiment shown in fig. 5, and will not be repeated here.
Therefore, in the method provided by the embodiment, after the sub-partition to be upgraded in the first static partition is upgraded, the writing operation from the third patch file to the third sub-partition and the writing operation from the sixth patch file to the virtual dynamic partition of the user data partition are completed, whether the first static partition is available or not is determined according to the starting identifier corresponding to the first static partition, that is, whether the electronic equipment can be restarted by taking the first static partition as the starting inlet or not is determined, and when the starting identifier is unavailable, the cold patch upgrade is completed by means of the second static partition running currently, so that the success rate of upgrading the cold patch is improved, and the reliability of products is improved.
Referring to fig. 14, after restarting according to step S309 in fig. 13, if a cold patch packet, for example, a fourth cold patch packet is received again, the cold patch upgrade procedure for the newly received cold patch Ding Bao specifically includes:
in step S401, a fourth cold patch package is acquired.
Illustratively, in this embodiment the fourth cold patch package includes a fourth patch file. Wherein the fourth patch file corresponds to the third sub-partition and the fourth sub-partition.
Step S402, a third patch file written in the fourth sub-partition is obtained.
Step S403, generating a second target patch file according to the third patch file and the fourth patch file.
In step S404, a data writing operation is performed on the third sub-partition according to the second target patch file.
Step S405, determines whether the first static partition can be started.
Specifically, when the boot identifier corresponding to the first static partition is Bootable, it is determined that the first static partition may be booted, and step S406 is entered.
Accordingly, when the boot identifier corresponding to the first static partition is an un-boot identifier, it is determined that the first static partition is not available for booting, and step S407 is entered.
Step S406, the starting sequence is changed from the second static partition to the first static partition, and the electronic device is restarted according to the changed starting sequence, so that the electronic device sequentially loads the data of the basic partition, the first static partition and the dynamic partition to run the operating system.
Step S407, the electronic device is started in a Recovery mode.
In step S408, after the electronic device enters the Recovery mode, the file in the third sub-partition is copied to the fourth sub-partition.
And step S409, restarting the electronic equipment according to the starting sequence, so that the electronic equipment sequentially loads the data of the basic partition, the second static partition and the dynamic partition to run the operating system.
It is not difficult to find that steps S401 to S409 in the embodiment shown in fig. 14 are substantially similar to steps S201 to S209 in the embodiment shown in fig. 11, and specific implementation details of this embodiment may be referred to the description of the embodiment shown in fig. 11, which is not repeated here.
Therefore, in the method provided by the embodiment of the application, a differential mode is adopted when a cold patch is upgraded for the first time, only the sub-partition which needs to be upgraded in the static partition is upgraded, the first static partition and the second static partition after the upgrade do not need to be synchronized, the electronic equipment directly operates in the static partition after the upgrade, and in the next time of cold patch upgrade, the sub-partition in the static partition which needs to be upgraded is upgraded in a full quantity by taking the patch file in the backup partition and the currently acquired patch file as target patch files, so that the system of the static partition after the subsequent upgrade is a system for repairing all patches.
Furthermore, it should be understood that "first", "second", "third" and "fourth" appearing in the technical solutions provided in the embodiments of the present application are merely examples listed for better understanding of the technical solutions of the embodiments, and are not the only limitation of the embodiments.
In addition, it should be noted that, in an actual application scenario, the method for upgrading the cold patch provided in the foregoing embodiments implemented by the electronic device may also be performed by a chip system included in the electronic device, where the chip system may include a processor. The chip system may be coupled to a memory such that the chip system, when running, invokes a computer program stored in the memory, implementing the steps performed by the electronic device described above. The processor in the chip system can be an application processor or a non-application processor.
In addition, the embodiment of the application further provides a computer readable storage medium, and the computer storage medium stores computer instructions, which when executed on the electronic device, cause the electronic device to execute the related method steps to implement the method for upgrading the cold patch in the embodiment.
In addition, the embodiment of the application further provides a computer program product, when the computer program product runs on the electronic device, the electronic device is caused to execute the related steps, so as to realize the method for upgrading the cold patch in the embodiment.
In addition, embodiments of the present application also provide a chip (which may also be a component or module) that may include one or more processing circuits and one or more transceiver pins; the receiving pin and the processing circuit communicate with each other through an internal connection path, and the processing circuit executes the related method steps to implement the method for upgrading the cold patch in the above embodiment, so as to control the receiving pin to receive signals and control the sending pin to send signals.
In addition, as can be seen from the foregoing description, the electronic device, the computer-readable storage medium, the computer program product, or the chip provided in the embodiments of the present application are used to perform the corresponding methods provided above, and therefore, the advantages achieved by the method can refer to the advantages in the corresponding methods provided above, which are not repeated herein.
Furthermore, it should be understood that the above embodiments are merely illustrative of the technical solutions of the present application, and not limiting thereof; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the essence of the corresponding technical solutions from the technical solutions of the embodiments of the present application.

Claims (13)

1. The utility model provides an upgrade method of cold patch butyl, which is characterized in that is applied to the electronic equipment that data storage structure is virtual AB mode, the electronic equipment includes processor and memory, the memory includes basic subregion, first static subregion, second static subregion, dynamic subregion and user data subregion, first static subregion includes a plurality of subregions, second static subregion includes a plurality of subregions, and a plurality of subregions of first static subregion respectively with a plurality of subregions of second static subregion one-to-one, the method includes:
loading the basic partition when starting, and acquiring a starting sequence recorded in the basic partition;
when the starting sequence is that the first static partition is started, loading data of the first static partition and the dynamic partition to run an operating system;
after starting, a first cold patch package is obtained, wherein the first cold patch package comprises a first patch file, the first patch file corresponds to a first sub-partition and a second sub-partition, the first sub-partition is a sub-partition of the second static partition, and the second sub-partition is a sub-partition corresponding to the first sub-partition in the first static partition;
Performing data writing operation on the first sub-partition according to the first patch file;
determining whether the second static partition can be started;
when the second static partition is determined to be unable to be started, starting the electronic equipment in a Recovery mode;
copying the files in the first sub-partition to the second sub-partition after the electronic equipment enters a Recovery mode;
restarting the electronic equipment according to the starting sequence, so that the electronic equipment sequentially loads the data of the basic partition, the first static partition and the dynamic partition to run the operating system.
2. The method of claim 1, wherein the performing a data write operation for the first sub-partition according to the first patch file comprises:
according to the starting sequence, determining the second static partition which is not started currently as the static partition to be operated by the cold patch butyl upgrading;
according to the first patch file, determining the first sub-partition in the second static partition as a sub-partition to be operated by the cold patch butyl upgrading;
acquiring a path address of the first sub-partition;
and writing the first patch file into the first sub-partition according to the path address.
3. The method of claim 1, wherein the determining whether the second static partition is bootable comprises:
acquiring a starting identifier corresponding to the second static partition from the basic partition;
and determining whether the second static partition can be started according to the starting identification.
4. The method of claim 3, wherein the determining whether the second static partition is bootable based on the boot identification comprises:
when the starting identifier is an un-bootable, determining that the second static partition can not be started;
and when the starting identifier is Bootable, determining that the second static partition can be started.
5. The method of claim 3, wherein prior to said obtaining the boot identifier corresponding to the second static partition from the base partition, the method further comprises:
acquiring a starting identifier corresponding to the second static partition recorded in an X-loader sub-partition in the second static partition;
and recording the starting identification corresponding to the second static partition into the basic partition.
6. The method of claim 1, wherein the booting the electronic device in the Recovery mode comprises:
Writing a first starting instruction for starting a Recovery mode in a MIsc sub-partition in the base partition;
and responding to the first starting instruction, and starting the electronic equipment in a Recovery mode.
7. The method of claim 6, wherein after the copying the file in the first sub-partition to the second sub-partition, the method further comprises:
and erasing the first starting instruction written in the MIsc sub-partition so as to restart the electronic equipment according to a virtual AB mode.
8. The method of claim 1, wherein copying the file in the first sub-partition to the second sub-partition comprises:
writing a first upgrading instruction of a sub-partition to be upgraded of the first patch file into a command file of a cache sub-partition in the basic partition;
and in response to the first upgrading instruction, copying the files in the first sub-partition to the second sub-partition.
9. The method of any of claims 1 to 8, wherein after the restarting the electronic device according to the boot sequence causes the electronic device to sequentially load data of the base partition, the first static partition, and the dynamic partition to run the operating system, the method further comprises:
Acquiring a second cold patch package, wherein the second cold patch package comprises a second patch file, and the second patch file corresponds to the first sub-partition and the second sub-partition;
acquiring the first patch file written in the second sub-partition;
generating a first target patch file according to the first patch file and the second patch file;
performing data writing operation on the first sub-partition according to the first target patch file;
determining whether the second static partition can be started;
when the second static partition is determined to be unable to be started, starting the electronic equipment in a Recovery mode;
copying the files in the first sub-partition to the second sub-partition after the electronic equipment enters a Recovery mode;
restarting the electronic equipment according to the starting sequence, so that the electronic equipment sequentially loads the data of the basic partition, the first static partition and the dynamic partition to run the operating system.
10. The method according to any one of claims 1 to 8, further comprising:
changing the boot sequence from booting from the first static partition to booting from the second static partition upon determining that the second static partition may boot;
Restarting the electronic equipment according to the changed starting sequence, so that the electronic equipment sequentially loads the data of the basic partition, the second static partition and the dynamic partition to run the operating system.
11. The electronic device is characterized in that a data storage structure of the electronic device is in a virtual AB mode and comprises a processor and a memory, wherein the memory comprises a basic partition, a first static partition, a second static partition, a dynamic partition and a user data partition, the first static partition comprises a plurality of sub-partitions, the second static partition comprises a plurality of sub-partitions, and the sub-partitions of the first static partition are respectively in one-to-one correspondence with the sub-partitions of the second static partition;
wherein the memory is coupled to the processor, the memory storing program instructions;
the program instructions, when executed by the processor, cause the electronic device to perform the method of upgrading a cold patch as claimed in any one of claims 1 to 10.
12. A computer readable storage medium comprising a computer program, characterized in that the computer program, when run on an electronic device, causes the electronic device to perform the method of upgrading a cold patch according to any of claims 1-10.
13. A computer program product, characterized in that the computer program product comprises a computer program which, when run on an electronic device, causes the electronic device to perform the method of upgrading a cold patch according to any of claims 1-10.
CN202111274666.2A 2021-10-29 2021-10-29 Method, apparatus, storage medium and computer program product for upgrading a cold patch Pending CN116069370A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111274666.2A CN116069370A (en) 2021-10-29 2021-10-29 Method, apparatus, storage medium and computer program product for upgrading a cold patch

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111274666.2A CN116069370A (en) 2021-10-29 2021-10-29 Method, apparatus, storage medium and computer program product for upgrading a cold patch

Publications (1)

Publication Number Publication Date
CN116069370A true CN116069370A (en) 2023-05-05

Family

ID=86180678

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111274666.2A Pending CN116069370A (en) 2021-10-29 2021-10-29 Method, apparatus, storage medium and computer program product for upgrading a cold patch

Country Status (1)

Country Link
CN (1) CN116069370A (en)

Similar Documents

Publication Publication Date Title
US9507604B2 (en) Boot method and boot system
US20230393840A1 (en) File update method and apparatus, device and storage medium
KR101555210B1 (en) Apparatus and method for downloadin contents using movinand in portable terminal
CN110825563B (en) System recovery method and device and electronic equipment
CN114265616B (en) Upgrading method of operating system, electronic equipment and storage medium
KR20200090010A (en) Method for updating firmware, electronic device and storage medium therefor
EP4270299A1 (en) Operating system upgrade method, electronic device, and storage medium
CN113868156B (en) System upgrade power-down protection method, electronic device and storage medium
CN115543368A (en) Operating system upgrading method and electronic equipment
CN117707626A (en) System starting method and electronic equipment
CN111290773A (en) System upgrading method, device and readable storage medium
CN116400938B (en) Operating system upgrading method, device and storage medium
CN115357295B (en) System rollback method, device and storage medium
CN116069370A (en) Method, apparatus, storage medium and computer program product for upgrading a cold patch
EP3992783A1 (en) Patch releasing method, server and terminal device
CN113190244A (en) Method and device for upgrading wireless module, computer equipment and storage medium
CN111324410A (en) Terminal boot animation playing method and device, terminal and storage medium
CN117177246B (en) Method for locking electronic equipment, electronic equipment and server
CN116069369A (en) Method, apparatus, storage medium and computer program product for controlling upgrade temperature
CN117290164B (en) Information recording method at restarting, electronic device and readable storage medium
CN111381892A (en) Data processing method, device, equipment and machine readable medium
CN115562697B (en) Upgrade method, device and storage medium
CN117707565A (en) Terminal equipment and upgrading method thereof
CN116643778B (en) Application program optimization method and electronic equipment
WO2024114029A1 (en) Operating system upgrade method and electronic device

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