Cold patch upgrading method, device, storage medium and computer program product

By using the Recovery mode in the virtual AB mode to copy the files of the first static partition to the second static partition, the problem of cold patch upgrade failure caused by image damage is solved, and the upgrade success rate and device reliability are improved.

CN116069370BActive Publication Date: 2025-10-17HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111274666.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-29
Publication Date
2025-10-17
Estimated Expiration
2041-10-29

AI Technical Summary

Technical Problem

In virtual AB mode, if the second static partition of an electronic device is unavailable due to image damage or byte jump, the cold patch upgrade will fail, which may cause the device to be unable to start or roll back to the old version, affecting the upgrade success rate and reliability.

Method used

By loading the basic partition in the first static partition and obtaining the boot order, when it is determined that the second static partition is unavailable, the first sub-partition file is copied to the second sub-partition using the Recovery mode, and the first static partition is used as the boot entry when restarting to complete the cold patch upgrade and ensure that the patch file is accurately written to the correct sub-partition.

Benefits of technology

The success rate of cold patch upgrades is improved, ensuring that electronic equipment can still be upgraded when the second static partition is unavailable, thereby improving product reliability and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116069370B_ABST
    Figure CN116069370B_ABST
Patent Text Reader

Abstract

The present application provides a cold patch upgrade method, device, storage medium and computer program product. The method is applied to an electronic device whose data storage structure is a virtual AB mode. When the electronic device performs a cold patch upgrade in a virtual AB mode startup mode, before changing the startup sequence from starting from a first static partition to starting from an upgraded second static partition, it is determined whether the second static partition is available. If the second static partition is unavailable, the electronic device is set to start in Recovery mode, and the second static partition is used as a backup partition. The first static partition is triggered to copy a patch file from the second static partition. After the patch file is copied, the electronic device is restarted in a virtual AB startup mode with the first static partition as the startup entry. In this way, regardless of whether the second static partition is available, the cold patch upgrade can be achieved, thereby improving the success rate of the cold patch upgrade and improving the reliability of the product.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a cold patch upgrading method and device, a storage medium and a computer program product. BACKGROUND

[0002] At present, there are two methods for software upgrading of electronic devices, such as mobile phones, namely hot patch upgrading and cold patch upgrading. Hot patch upgrading is a replacement of code segments, so that partial modification of software can be realized without interrupting business operation, that is, hot patch does not need to be restarted. Cold patch is a replacement of an execution body (specifically, a process), and the repair of the process needs to re-allocate some underlying resources, so cold patch upgrading needs to be restarted. As for the cold patch upgrading method, in the application scenarios of the prior art, the starting mode of the electronic device can be divided into recovery mode (also referred to as non-AB mode), AB (FULL-AB) mode and virtual AB mode.

[0003] Taking an electronic device with a virtual AB mode (which can also be understood as a virtual AB mode of data storage structure) as an example, when cold patch upgrading is performed, if the mobile phone is currently running in a first static partition, the first static partition is being used, so cold patch upgrading operation cannot be performed on the first static partition. At this time, cold patch upgrading operation needs to be performed on a second static partition, that is, a patch file is written into a sub-partition of the second static partition corresponding to the patch file, and after the writing of the patch file into the sub-partition of the second static partition corresponding to the patch file is completed, the starting order is directly changed to starting from the second static partition, and then the electronic device is restarted according to the changed starting order. However, in actual application scenarios, the second static partition may be unusable due to physical damage of the image, bit jump and other reasons, so the above-mentioned cold patch upgrading method may not be able to start the second static partition at all, which will result in failure of cold patch upgrading. For this situation, the mobile phone may roll back to the first static partition, that is, recover to the version before cold patch upgrading, and more seriously, the mobile phone may not be able to boot up. SUMMARY

[0004] In order to solve the above technical problems, the present application provides a cold patch upgrading method and device, a storage medium and a computer program product, which are designed to solve the above technical problems, so that the electronic device can complete cold patch upgrading with the help of the first static partition when the second static partition is unusable, thereby improving the success rate of cold patch upgrading and improving the reliability of the product.

[0005] In a first aspect, the application provides a cold patch upgrading method applied to an electronic device. The electronic device comprises a processor and a memory. 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. The plurality of sub-partitions of the first static partition correspond to the plurality of sub-partitions of the second static partition one by one. The method comprises: loading the basic partition at startup and obtaining a startup order recorded in the basic partition; loading data of the first static partition and the dynamic partition to run an operating system when the startup order is to start from the first static partition; obtaining a first cold patch package after startup. 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. The second sub-partition is a sub-partition of the first static partition corresponding to the first sub-partition. The first sub-partition is subjected to a data writing operation according to the first patch file. It is determined whether the second static partition can be started. When it is determined that the second static partition cannot be started, the electronic device is started in a Recovery mode. After the electronic device enters the Recovery mode, files in the first sub-partition are copied to the second sub-partition. The electronic device is restarted according to the startup order, so that the electronic device loads the data of the basic partition, the first static partition and the dynamic partition in sequence to run the operating system.

[0006] Therefore, the method provided by the embodiments of the application can determine whether the second static partition is available according to the startup identifier corresponding to the second static partition after the first sub-partition in the second static partition that needs to be upgraded is upgraded, that is, whether the electronic device can be restarted with the second static partition as a startup entry. When the startup identifier is unavailable, the cold patch upgrading is completed by means of the currently running first static partition, thereby improving the success rate of cold patch upgrading and improving the reliability of the product.

[0007] According to the first aspect, the data writing operation on the first sub-partition according to the first patch file comprises: determining the second static partition that is not currently started as a static partition to be operated in this cold patch upgrading according to the startup order; determining the first sub-partition in the second static partition as a sub-partition to be operated in this cold patch upgrading according to the first patch file; obtaining a path address of the first sub-partition; and writing the first patch file into the first sub-partition according to the path address. In this way, it can be accurately determined that the cold patch upgrading operation is a writing operation on which static partition and sub-partition, thereby ensuring that the patch file in the cold patch package obtained this time can be accurately written into the correct sub-partition.

[0008] According to the first aspect, or any one of the implementations of the first aspect, determining whether the second static partition can be started includes: obtaining, from the base partition, a starting identifier corresponding to the second static partition; and determining whether the second static partition can be started according to the starting identifier. Since the base partition is usually not upgraded during the cold patch upgrade, the starting identifier used to record whether the first static partition and the second static partition are available is recorded in the base partition, so that the starting identifier of the first static partition and the second static partition will not be lost due to the cold patch upgrade.

[0009] According to the first aspect, or any one of the implementations of the first aspect, determining whether the second static partition can be started according to the starting identifier includes: determining that the second static partition cannot be started when the starting identifier is unBootable; and determining that the second static partition can be started when the starting identifier is Bootable. Since the first static partition and the second static partition in the dual-partition form exist in the virtual AB mode, there is an identifier that can identify whether the partition can be started, specifically, Bootable is used to identify that the static partition contains a complete system that can be started, and unBootable is used to identify that the starting system corresponding to the static partition is incomplete, such as some or several sub-partitions having mirror physical damage or bit hopping, so by identifying whether the starting identifier recorded in the base partition is unBootable or Bootable, it can be determined whether the static partition can be started.

[0010] According to the first aspect, or any one of the implementations of the first aspect, before obtaining, from the base partition, the starting identifier corresponding to the second static partition, the method further includes: obtaining the starting identifier corresponding to the second static partition recorded in the X-loader sub-partition of the second static partition; and recording the starting identifier corresponding to the second static partition in the base partition. The starting identifier of each static partition is recorded in the X-loader sub-partition of the static partition, and the base partition can access the X-loader sub-partition of each static partition, so the base partition can determine the starting identifier corresponding to each static partition before the cold patch upgrade.

[0011] According to the first aspect, or any one of the implementations of the first aspect, starting the electronic device in the Recovery mode includes: writing a first starting instruction for starting the Recovery mode in the misc sub-partition of the base partition; and starting the electronic device in the Recovery mode in response to the first starting instruction.

[0012] According to the first application, or any one of the implementation manners of the first aspect, after copying the files in the first sub-partition to the second sub-partition, the method further comprises: erasing the first startup instruction written in the misc sub-partition, so that the electronic device restarts in the virtual AB mode. In this way, after the copying of the patch file is completed, the startup instruction that controls the electronic device to start in the Recovery mode is erased from the misc sub-partition, so that after the electronic device restarts, the electronic device can continue to load the data of each partition in the memory in the startup sequence of the virtual AB mode to run the operating system.

[0013] According to the first aspect, or any one of the implementation manners of the first aspect, copying the files in the first sub-partition to the second sub-partition comprises: writing, in the comand file of the cache sub-partition in the base partition, a first upgrade instruction of the sub-partition to be upgraded by the first patch file; and copying the files in the first sub-partition to the second sub-partition in response to the first upgrade instruction. The method of the embodiments of the present application, when the second static partition after upgrading the sub-partition is unavailable for starting, by taking the second static partition after upgrading as the backup partition, the first patch file can be copied from the second static partition to the second sub-partition corresponding to the first sub-partition in the first static partition in the case that the electronic device enters the Recovery mode and cannot access the user data partition, and then the electronic device is restarted with the first static partition as the startup entry.

[0014] According to the first aspect or any possible implementation of the first aspect, after restarting the electronic device according to the starting sequence to make the electronic device load data of the basic partition, the first static partition and the dynamic partition in sequence to run the operating system, the method further includes: obtaining a second cold patch package, the second cold patch package including a second patch file, the second patch file corresponding to the first sub-partition and the second sub-partition; obtaining 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 a data writing operation on the first sub-partition according to the first target patch file; determining whether the second static partition can start; when it is determined that the second static partition cannot start, starting the electronic device in the Recovery mode; after the electronic device enters the Recovery mode, copying the files in the first sub-partition to the second sub-partition; and restarting the electronic device according to the starting sequence to make the electronic device load data of the basic partition, the first static partition and the dynamic partition in sequence to run the operating system. The method provided in the embodiments of the present application adopts a differential method for the first cold patch upgrade, and only the sub-partition in the static partition that needs to be upgraded is upgraded, and the first static partition and the second static partition do not need to be synchronized after the upgrade, and the electronic device can directly run in the upgraded static partition. When the next cold patch upgrade is performed, the patch file in the backup partition and the currently obtained patch file are used as a target patch file to perform full upgrade on the sub-partition in the static partition that needs to be upgraded, so that the system of the static partition after the subsequent upgrade is a system that has repaired all patches.

[0015] According to the first aspect or any possible implementation of the first aspect, the method further includes: when it is determined that the second static partition can start, changing the starting sequence from starting from the first static partition to starting from the second static partition; and restarting the electronic device according to the changed starting sequence to make the electronic device load data of the basic partition, the second static partition and the dynamic partition in sequence to run the operating system. In this way, when it is determined that the second static partition is available after the patch file is written into the sub-partition of the second static partition, the electronic device is restarted according to the starting mode of the virtual AB mode with the second static partition as the starting entry, and the current cold patch upgrade is completed.

[0016] According to the first aspect, or any one of the implementations of the first aspect, when the startup sequence is to start from the second static partition, data of the second static partition and the dynamic partition are loaded to run the operating system; after starting, a third cold patch package is obtained, the third cold patch package including a third patch file, the third patch file corresponding to a third sub-partition and a fourth sub-partition, the third sub-partition being a sub-partition of the first static partition, and the fourth sub-partition being a sub-partition of the second static partition; a data writing operation is performed on the third sub-partition according to the third patch file; it is determined whether the first static partition can start; when it is determined that the first static partition cannot start, the electronic device is started in a Recovery mode; after the electronic device enters the Recovery mode, files in the third sub-partition are copied to the fourth sub-partition; and the electronic device is restarted to load data of the basic partition, the second static partition and the dynamic partition in sequence according to the startup sequence to run the operating system.

[0017] According to the first aspect, or any one of the implementations of the first aspect, performing the data writing operation on the third sub-partition according to the third patch file includes: determining, according to the startup sequence, the second static partition that is not currently started as a static partition to be operated in this cold patch upgrade; determining, according to the third patch file, the third sub-partition in the first static partition as a sub-partition to be operated in this cold patch upgrade; obtaining a path address of the third sub-partition; and writing the third patch file to the third sub-partition according to the path address.

[0018] According to the first aspect, or any one of the implementations of the first aspect, determining whether the first static partition can start includes: obtaining a startup identifier corresponding to the first static partition from the basic partition; and determining whether the first static partition can start according to the startup identifier.

[0019] According to the first aspect, or any one of the implementations of the first aspect, determining whether the first static partition can start according to the startup identifier includes: when the startup identifier is unBootable, determining that the first static partition cannot start; and when the startup identifier is Bootable, determining that the first static partition can start.

[0020] According to the first aspect, or any one of the implementations of the first aspect, before obtaining the startup identifier corresponding to the first static partition from the basic partition, the method further includes: obtaining the startup identifier corresponding to the first static partition recorded in an X-loader sub-partition in the first static partition; and recording the startup identifier corresponding to the first static partition in the basic partition.

[0021] According to the first aspect, or any one of the implementations of the first aspect, the starting the electronic device in the Recovery mode comprises: writing a second starting instruction of starting the Recovery mode in a misc sub-partition in the base partition; and starting the electronic device in the Recovery mode in response to the second starting instruction.

[0022] According to the first aspect, or any one of the implementations of the first aspect, after copying the file in the third sub-partition to the fourth sub-partition, the method further comprises: erasing the second starting instruction written in the misc sub-partition, so that the electronic device restarts in the virtual AB mode.

[0023] According to the first aspect, or any one of the implementations of the first aspect, copying the file in the third sub-partition to the fourth sub-partition comprises: writing a second upgrade instruction of a sub-partition to be upgraded by the third patch file in a command file of a cache sub-partition in the base partition; and copying the file in the third sub-partition to the fourth sub-partition in response to the second upgrade instruction.

[0024] According to the first aspect, or any one of the implementations of the first aspect, after restarting the electronic device according to the starting sequence, so that the electronic device loads data of the base partition, the second static partition and the dynamic partition in sequence to run the operating system, the method further comprises: obtaining a fourth cold patch package, the fourth cold patch package comprising a fourth patch file corresponding to the third sub-partition and the fourth sub-partition; obtaining the third patch file written in the fourth sub-partition; generating a second target patch file according to the third patch file and the fourth patch file; performing a data writing operation on the third sub-partition according to the second target patch file; determining whether the first static partition can be started; starting the electronic device in the Recovery mode when it is determined that the first static partition cannot be started; copying the file in the third sub-partition to the fourth sub-partition after the electronic device enters the Recovery mode; and restarting the electronic device according to the starting sequence, so that the electronic device loads data of the base partition, the second static partition and the dynamic partition in sequence to run the operating system.

[0025] According to the first aspect, or any one of the implementations of the first aspect, when it is determined that the first static partition can be started, the starting sequence is changed from starting from the second static partition to starting from the first static partition; and the electronic device is restarted according to the changed starting sequence, so that the electronic device loads data of the base partition, the first static partition and the dynamic partition in sequence to run the operating system.

[0026] In a second aspect, the present application provides an electronic device, a data storage structure of the electronic device is a virtual AB mode, the electronic device comprises a processor and a memory, 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 plurality of sub-partitions of the first static partition correspond to the plurality of sub-partitions of the second static partition one by one; wherein the memory and the processor are coupled, and the memory stores program instructions; when the program instructions are executed by the processor, the electronic device executes the method of the first aspect or any one of the implementation manners of the first aspect.

[0027] In a third aspect, the present application provides a computer readable medium for storing a computer program, when the computer program runs on an electronic device, the electronic device executes the method of the first aspect or any one of the implementation manners of the first aspect.

[0028] In a fourth aspect, the present application provides a computer program product, the computer program product comprises a computer program, when the computer program runs on an electronic device, the electronic device executes the method of the first aspect or any one of the implementation manners of the first aspect.

[0029] In a fifth aspect, the present application provides a chip, the chip comprises a processing circuit and a transceiver pin, wherein the transceiver pin and the processing circuit communicate with each other through an internal connection path, the processing circuit executes the method of the first aspect or any one of the implementation manners of the first aspect to control the receiving pin to receive a signal and to control the sending pin to send a signal. BRIEF DESCRIPTION OF DRAWINGS

[0030] Figure 1 Fig. 1 is an exemplary schematic diagram of a hardware structure of an electronic device;

[0031] Figure 2 Fig. 2 is an exemplary schematic diagram of data storage structures of a Recovery mode, an AB mode and a virtual AB mode;

[0032] Figure 3 Fig. 3 is an exemplary schematic diagram of a scenario of obtaining a cold patch package through terminal-side and server-side interaction;

[0033] Figure 4 Fig. 4 is an exemplary schematic diagram of a software structure of an electronic device;

[0034] Figure 5 Fig. 5 is one of exemplary flowcharts of a cold patch upgrade method provided by the embodiments of the present application;

[0035] Figure 6 Fig. 6 is a schematic diagram of a cold patch upgrade method provided by the embodiments of the present application; Figure 5The step S102 shown is an example of a schematic diagram of loading each partition;

[0036] Figure 7 is a schematic diagram of acquiring the boot identifier of the second static partition; Figure 5 The steps S104 and S105 shown are examples of a schematic diagram of writing the patch file in the first cold patch package;

[0037] Figure 8 is a schematic diagram of acquiring the boot identifier of the second static partition;

[0038] Figure 9 is a schematic diagram of acquiring the boot identifier of the second static partition; Figure 5 The step S106 shown is an example of a schematic diagram of loading each partition when restarting the electronic device;

[0039] Figure 10 is a schematic diagram of acquiring the boot identifier of the second static partition; Figure 5 The step S107 shown is an example of a schematic diagram of loading each partition when restarting the electronic device;

[0040] Figure 11 is a schematic diagram of acquiring the boot identifier of the second static partition;

[0041] Figure 12 is a schematic diagram of acquiring the boot identifier of the second static partition; Figure 11 The steps S202 to S205 shown are examples of a schematic diagram of writing the patch file in the second cold patch package;

[0042] Figure 13 is a schematic diagram of acquiring the boot identifier of the second static partition;

[0043] Figure 14 is a schematic diagram of acquiring the boot identifier of the second static partition. DETAILED DESCRIPTION

[0044] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of the present application.

[0045] The term "and / or" in this document is only a description of the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which can represent the three cases of A alone, A and B together, and B alone.

[0046] The terms "first" and "second" and the like in the description and claims of the present application are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. For example, the first target object and the second target object are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order.

[0047] In the present application embodiments, the words "exemplary" and "for example" are used to mean serving as an example, instance, or illustration. Any implementation or design scheme described as "exemplary" or "for example" in the present application embodiments is not necessarily to be construed as preferred or advantageous over other implementations or design schemes. In fact, a variety of implementations and design schemes as described in the present application embodiments are meant to be as examples only and not intended to be limiting.

[0048] In the description of the present application embodiments, the meaning of "a plurality of" is two or more unless otherwise specified. For example, a plurality of processing units means two or more processing units; a plurality of systems means two or more systems.

[0049] In order to better understand the technical solutions provided by the present application embodiments, first, the hardware structure of the electronic device (such as a mobile phone, a tablet device, a PC device, etc.) to which the present application embodiments are applicable will be described with reference to the accompanying drawings.

[0050] Referring to Figure 1 , the electronic device 100 can include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.

[0051] For example, the audio module 170 can include a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, etc.

[0052] For example, the sensor module 180 can include a pressure sensor, a gyroscope sensor, a barometric pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.

[0053] In addition, the processor 110 can include one or more processing units, for example: the processor 110 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc.

[0054] It can be understood that, in a specific implementation, different processing units can be independent devices or integrated in one or more processors.

[0055] In addition, in some embodiments, the controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to instruction operation codes and timing signals, and complete the control of instruction fetching and instruction execution.

[0056] In addition, the memory in the processor 110 is mainly used to store instructions and data. In some embodiments, the memory in the processor 110 is a cache memory.

[0057] In addition, it can be understood that, in actual application scenarios, executable program codes that trigger the electronic device 100 to implement various function applications and data processing are stored in the internal memory 121, and these executable program codes include instructions.

[0058] For example, in the technical solutions provided in the embodiments of the present application, the startup of the electronic device 100 and the cold patch upgrade mainly involve the internal memory 121, that is, the related instructions of the cold patch upgrade method provided in the embodiments of the present application are stored in the internal memory 121 in advance, and the processor 110 executes the instructions stored in the internal memory 121, so that the electronic device 100 can execute the cold patch upgrade method provided in the embodiments of the present application.

[0059] In addition, it should be noted that in a specific implementation, the internal memory 121 can include a program storage area and a data storage area. The program storage area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.), and the like. The data storage area can store data created during use of the electronic device 100 (such as audio data, a phonebook, etc.), and the like. In addition, the internal memory 121 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like.

[0060] For example, with respect to the program storage area, in the technical solutions provided in the embodiments of the present application, it can be, for example, a common partition (Common), a static partition (Slot), and a dynamic partition (Super). With respect to the data storage area, in the technical solutions provided in the embodiments of the present application, it can be, for example, a user data partition (Userdata).

[0061] In addition, it can be understood that in an actual application scenario, the common partition usually stores content that is not upgraded during cold patch upgrading, the static partition and the dynamic partition store content that can be upgraded during cold patch upgrading, and the user data partition stores data created during use of the electronic device, which is usually not upgraded during cold patch upgrading, so as to avoid loss of user data after upgrading and affect user experience.

[0062] For example, in an actual application, the data storage structure of the internal memory 121 of the electronic device 100 can be, for example, a Recovery mode, an AB mode, and a virtual AB mode, and the start mode of the electronic device 100 in different data storage structures is also different.

[0063] It should be noted that in an actual application, the mode corresponding to the data storage structure and the mode corresponding to the start mode are usually consistent, that is, the electronic device with the data storage structure of the Recovery mode also has the start mode of the Recovery mode; the electronic device with the data storage structure of the AB mode also has the start mode of the AB mode; and the electronic device with the data storage structure of the virtual AB mode also has the start mode of the virtual AB mode.

[0064] Specifically, based on the characteristics of the above four partitions, for partitions that are usually not upgraded during cold patch upgrading and system upgrading, such as the common partition and the user data partition, whether in the Recovery mode, the AB mode, or the virtual AB mode, a single partition is used, and the partitions that need to be upgraded are different.

[0065] Exemplarily, since the cold patch upgrade is performed in the Recovery mode, other functions of the electronic device cannot be used during the upgrade process, and the electronic device can only stay in the upgrade interface of the Recovery mode, and can enter the user interface for normal use only after the electronic device is restarted after the cold patch upgrade is completed. Therefore, in the Recovery mode, the static partition and the dynamic partition also adopt single partition, and the Recovery mode data storage structure diagram (1) is shown in detail in Figure 2 . In this way, the occupation of the memory space can be reduced to reserve more space for the user data partition.

[0066] Exemplarily, the AB mode is to enable the user to return to the main interface of the electronic device at will during the cold patch upgrade process, so as to not affect the use of the electronic device. Therefore, in the AB mode, the static partition and the dynamic partition adopt dual partition, and the AB mode data storage structure diagram (2) is shown in detail in Figure 2 . The static partition can be divided into a first static partition (Slot A) and a second static partition (Slot B), and the dynamic partition can be divided into a first dynamic partition (Super A) and a second dynamic partition (Super B). Although this partitioning manner can enable the electronic device to return to the main interface of the electronic device at will during the cold patch upgrade process, it occupies a larger memory space, so that the available space of the user data partition is greatly reduced.

[0067] Exemplarily, the virtual AB mode combines the advantages of the Recovery mode and the AB mode, divides the static partition with smaller stored files, i.e., occupying a smaller memory space, into a first static partition (Slot A) and a second static partition (Slot B), and adopts single partition for the dynamic partition with larger stored files, i.e., occupying a larger memory space, and the virtual AB mode data storage structure diagram (3) is shown in detail in Figure 2 .

[0068] It should be noted that, in actual application, the partition deployment information of the internal memory of the electronic device can be described by the partition table shown in Table 1.

[0069] Table 1 Partition Table

[0070]

[0071]

[0072] In this way, the start address and size of each partition are defined by the partition table, so that the size of the corresponding partition can be adjusted as needed for different hardware.

[0073] It should be understood that the above description is only an example for better understanding the technical solutions of the embodiments and is not the only limitation of the embodiments.

[0074] That is, in actual applications, the partitions recorded in the partition table can be divided and set according to actual business requirements.

[0075] In addition, regarding Figure 2 (2) and Figure 2 The distribution of the partitions using double partitions shown in (2) and (3) in the memory is not limited to Figure 2 (2) and Figure 2 (3) shown, in actual applications, the position of each partition is determined according to the allocated start address and end address.

[0076] The hardware structure of the electronic device 100 is introduced here, and it should be understood that Figure 1 The electronic device 100 shown is only an example, and in specific implementations, the electronic device 100 can have more or fewer components than those shown in the figure, can combine two or more components, or can have a different component configuration. Figure 1 The various components shown in the figure can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application-specific integrated circuits.

[0077] Specifically, in the technical solutions of the embodiments of the present application, the data storage structure is taken as an example of an electronic device in a virtual AB mode to describe the upgrading process of a cold patch in detail.

[0078] It should be noted that in actual application scenarios, with the development of over-the-air technology (OTA), the OTA upgrade of remotely upgrading terminal devices through the wireless network interface of the terminal device is becoming more and more popular. In combination with actual business scenarios, the cold patch upgrading scheme described in the embodiments of the present application takes the OTA upgrade scenario as an example. For example, see Figure 3 The cold patch package for repairing software is provided by the package server to the OTA server in the cloud for management, and the OTA server sends the corresponding cold patch package to the electronic device according to the request of the terminal side different electronic devices (such as PC devices, tablet devices, mobile phones, etc.) to initiate the acquisition of the cold patch package, or the OTA server actively pushes the corresponding cold patch package to the corresponding electronic device after receiving the cold patch package sent by the package server.

[0079] Exemplarily, the cold patch package issued by the patch server to the OTA server can be a cold patch package that the patch server actively sends to the OTA server after the patch server makes the cold patch package, or can be a cold patch package that the OTA server initiates a request to the patch server to acquire the cold patch package, and then initiates the issuance to the OTA server when the patch server has the cold patch package.

[0080] For the way in which the patch server makes a cold patch package version, pushes the cold patch package to the OTA server, and the OTA server pushes the cold patch package to the electronic device, refer to the existing implementation scheme, which will not be described herein.

[0081] In addition, in order to enable the electronic device to perform cold patch upgrading according to the technical solution provided in the embodiments of the present application, the software structure of the electronic device is adjusted.

[0082] Exemplarily, refer to Figure 4 The OUC (OTA Update Client) and APK patch engine for performing OTA upgrading are included in the application layer (Application).

[0083] Exemplarily, continue to refer to Figure 4 The cold patch engine and notification manager are included in the application framework layer (Framework).

[0084] Exemplarily, continue to refer to Figure 4 The Erecovery upgrade engine, the Recovery upgrade engine, and the virtual AB upgrade engine are included in the Native layer for loading processes, so that when the second static partition after upgrading cannot be started in the virtual AB mode, the Recovery upgrade engine can be directly triggered to complete the cold patch upgrading by restarting the electronic device with the help of the currently running first static partition according to the technical solution provided in the embodiments of the present application.

[0085] Exemplarily, continue to refer to Figure 4 The Boot ctrl, the CMD server, and the HDL (Hardware Description Language) are included in the Hardware Abstraction Layer (HAL), which are an interface for controlling booting, a service interface for calling a CMD, and a hardware description interface for describing hardware, respectively.

[0086] Exemplarily, continue to refer to Figure 4 The cold patch engine is included in the Kernel layer.

[0087] Exemplarily, continue to refer to Figure 4The BootLoader includes specific boot modes of the electronic device, such as a fast boot upgrade mode, an AB partition boot mode, and a boot mode selection program that can select other boot modes.

[0088] It should be noted that, Figure 4 The BootLoader shown in FIG. 1 is a program that is fixed to a Read-Only Memory (ROM) chip on the mainboard of the electronic device and is executed before the operating system is run. Through this small program, the electronic device can initialize hardware devices and establish a mapping table of memory space at a certain time, thereby establishing a proper system software and hardware environment and preparing for the final call of the operating system kernel. That is, which boot mode is used to start the electronic device when it is started is determined by the BootLoader.

[0089] The software structure of the electronic device is described here, and it can be understood that, Figure 4 The layers in the software structure shown and the components included in each layer do not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device can include more or fewer layers than shown, and each layer can include more or fewer components, which are not limited by the present application.

[0090] Based on the above hardware structure and software structure, the technical solutions provided by the embodiments of the present application will be described in detail below with respect to the following scenarios: the first static partition is loaded by the first start of the electronic device, and the cold patch upgrade after the start is implemented on the second static partition; and the second static partition is loaded by the first start of the electronic device, and the cold patch upgrade after the start is implemented on the first static partition.

[0091] Referring to Figure 5 , the implementation process of the first static partition being loaded by the first start of the electronic device and the cold patch upgrade after the start being implemented on the second static partition, specifically includes:

[0092] Step S101: loading the basic partition at startup and obtaining the startup order recorded in the basic partition.

[0093] Specifically, the electronic device loads the basic partition at startup, and after loading the basic partition, reads the recorded boot mode from the misc sub-partition in the basic partition.

[0094] As can be understood from the above description, the boot mode of the electronic device can generally be the Recovery mode, the AB mode, and the virtual AB mode.

[0095] Since the technical solution provided by the embodiment is to solve the problem in the cold patch upgrade process in the virtual AB mode, the embodiment takes the virtual AB mode as an example for reading the startup mode from the misc sub-partition.

[0096] Correspondingly, when the startup mode is the virtual AB mode, for this startup mode, the data storage structure in the memory adopts the structure of Figure 2 (3), so it is necessary to obtain the startup order to be followed in the current startup operation from the base partition to determine whether the current startup operation is started from the first static partition or the second static partition.

[0097] Step S102, when the startup order is to start from the first static partition, load the data of the first static partition and the dynamic partition to run the operating system.

[0098] For example, when it is determined that the startup order is to start from the first static partition, the data of the first static partition and the dynamic partition is loaded in sequence, which is described in detail in Figure 6 .

[0099] Step S103, after startup, obtain the first cold patch package.

[0100] For example, the electronic device loads the data of the base partition, the first static partition and the dynamic partition in sequence according to the loading order shown in Figure 6 , and then starts the operating system to enter the user interface, and then obtains the first cold patch package for repairing / upgrading some bugs of the locally installed software / application or operating system from the OTA server.

[0101] For example, in a feasible implementation, the operation of obtaining the first cold patch package can be that the electronic device actively obtains the first cold patch package from the OTA server.

[0102] For example, the electronic device periodically initiates a request Request1 to search for a cold patch package to the OTA server, and the OTA server receives the Request1. If the first cold patch package requested by the Request1 is found in the local storage, the OTA server makes a Response1 to the electronic device, and sends the found first cold patch package to the electronic device. If the OTA server does not find the first cold patch package in the local storage, the OTA server can initiate a request Request2 to search for a cold patch package to the package server, and the package server receives the Response2. If the first cold patch package is found in the local storage, the package server makes a Response2 to the OTA server, and sends the first cold patch package to the OTA server. In this way, the OTA server can send the received first cold patch package to the electronic device.

[0103] For example, in another feasible implementation, the operation of obtaining the first cold patch package may be: the OTA server regularly pushes the first cold patch package obtained from the packet capture server to the electronic device.

[0104] For example, after the OTA server proactively obtains the first cold patch package from the package server, or receives the first cold patch package proactively sent by the package server, the OTA server regularly pushes the first cold patch package to the electronic device.

[0105] It is understandable that in an actual application scenario, the first cold patch package includes patch files for upgrading one or several sub-partitions in the static partition.

[0106] For ease of explanation, the first cold patch package in this embodiment includes a first patch file. The first patch file corresponds to the first subpartition and the second subpartition. The first subpartition is a subpartition of the second static partition, and the second subpartition is a subpartition of the first static partition that corresponds to the first subpartition. For example, Figure 7 vendor_a and vendor_b in the , that is, when the first patch file is the vendor(2.0) patch file, the first sub-partition corresponding to the patch file is Figure 7 In vendor_b, the second subpartition is Figure 7 vendor_a in the .

[0107] It should be understood that the above description is merely an example listed for a better understanding of the technical solution of this embodiment, and is not intended to be the sole limitation on this embodiment.

[0108] Step S104: performing a data writing operation on the first sub-partition according to the first patch file.

[0109] For example, in actual application, after parsing the first patch file from the first cold patch package, the currently unstarted static partition will be determined as the static partition to be operated in this cold patch upgrade according to the startup order recorded in the basic partition, and then the sub-partition corresponding to the first patch file in the above-mentioned static partition will be determined as the sub-partition to be operated in this cold patch upgrade according to the first patch file, and then the address path of the determined sub-partition is obtained, for example, the start address and end address of the sub-partition recorded in the partition table are obtained, and finally the first patch file is written to the determined sub-partition according to the obtained path address.

[0110] Specifically in this embodiment, since the startup sequence is to start from the first static partition, the second static partition that is currently not started is determined as the static partition to be operated in this cold patch upgrade.

[0111] Accordingly, the first sub-partition in the second static partition is determined as the sub-partition to be operated in the cold patch upgrade according to the first patch file.

[0112] 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 the schematic diagram (1) in Figure 7 .

[0113] For example, continuing to refer to Figure 7 , after the first patch file is written into the vendor_b sub-partition of the second static partition according to the operation in step S104, the version of the vendor_b sub-partition is upgraded from 1.0 to 2.0, as shown in the schematic diagram (2) in Figure 7 .

[0114] In step S105, it is determined whether the second static partition can be started.

[0115] Specifically, for the virtual AB mode, the first static partition and the second static partition both have the attributes of active, Bootable (corresponding to unBootable), and Successful. Among them, active is an identifier for identifying the currently active partition, which is an exclusive attribute. There can be only one partition set as the active attribute in the system, and the bootloader selects the partition set as the active attribute to start when starting. Bootable is used to identify that the partition can be started, and the partition set as Bootable indicates that the partition contains a complete system that can be started. unBootable is used to identify that the partition cannot be started, and the partition set as unBootable indicates that the partition contains an incomplete system, that is, if the static partition identified by unBootable is started, it may cause the electronic device to be unable to restart or to be rolled back to the version before the cold patch upgrade operation. Successful is used to identify that the partition is successfully run, and the partition set as Successful indicates that the partition can be correctly run in the last start or the current start. Based on this, it is only necessary to determine whether the start identifier recorded in the base partition is Bootable or unBootable to determine whether the second static partition can be started.

[0116] Based on this, when it is determined whether the second static partition can be started, the start identifier corresponding to the second static partition is obtained from the base partition, and then it can be determined whether the second static partition can be started according to the start identifier.

[0117] Exemplarily, 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 can be booted, in which case step S106 is entered, i.e., the boot order is upgraded to boot from the second static partition, and then the electronic device is restarted according to the changed boot order.

[0118] Correspondingly, when the boot identifier corresponding to the second static partition obtained from the base partition is unBootable, it is determined that the second static partition cannot be booted, in which case step S107 is entered, i.e., the electronic device is restarted by means of the currently active first static partition in the Recovery mode for cold patch upgrading.

[0119] In addition, it should be noted that in actual application scenarios, the boot identifier for identifying whether each static partition can be booted can be recorded in the X-loader sub-partition in each static partition.

[0120] Exemplarily, for the current scenario (the first static partition is loaded when the electronic device is started for the first time, and the cold patch upgrading after the start is for the second static partition), it needs to be determined whether the second static partition can be booted, and therefore the boot identifier corresponding to the second static partition is obtained from the base partition.

[0121] Exemplarily, in one implementation, the boot identifier corresponding to the second static partition can be obtained from the 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.

[0122] Exemplarily, in another implementation, the boot identifier corresponding to the second static partition can 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 detail in Figure 8

[0123] Step S106 changes the boot order from booting from the first static partition to booting from the second static partition, and restarts the electronic device according to the changed boot order, so that the electronic device loads the data of the base partition, the second static partition and the dynamic partition in sequence to run the operating system.

[0124] Exemplarily, after the boot order is changed from booting from the first static partition to booting from the second static partition, the data of the base partition, the second static partition and the dynamic partition can be loaded in sequence to run the operating system according to the partition loading schematic diagram as shown in Figure 9

[0125] ​​Step S107, the electronic device is started in the Recovery mode.

[0126] Specifically, when it is determined that the second static partition is not startable, for example, it is possible that Figure 10 (1) the dtbo_b sub-partition in the second static partition has mirror physical damage or bit flip, or other sub-partitions have mirror physical damage or bit flip, the electronic device writes a first start instruction for starting the Recovery mode in the misc sub-partition in the base partition, so that the electronic device can be started in the Recovery mode in response to the first start instruction.

[0127] For example, the first start instruction written in the misc sub-partition can be "boot-recovery".

[0128] Step S108, after the electronic device enters the Recovery mode, the files in the first sub-partition are copied to the second sub-partition.

[0129] Specifically, after the electronic device enters the Recovery mode, the electronic device writes a first upgrade instruction of the sub-partition to be upgraded by the first patch file in the comand file of the cache sub-partition in the base partition, so that the electronic device can copy the files in the first sub-partition to the second sub-partition in response to the first upgrade instruction.

[0130] For example, in this embodiment, the first upgrade instruction written in the comand file can be determined according to the file name of the first patch file written in the first sub-partition.

[0131] For example, when the first patch file is a vendor patch file, the first upgrade instruction written in the comand file can be "-ota-ab-vendor-update".

[0132] For example, when the first patch file is a patch patch file, the first upgrade instruction written in the comand file can be "-ota-ab-patch-update".

[0133] In this way, after entering the Recovery mode, the electronic device can know which sub-partition in the second static partition to copy the patch file to the corresponding sub-partition in the first static partition.

[0134] For example, see Figure 10As shown in the diagram (1), the Recovery mode is triggered according to the "boot-recovery" instruction written in the misc subpartition in the base partition, and then according to the "-ota-ab-vendor-update" instruction in the command file written in the cache subpartition in the base partition, the vendor_b (2.0) that has completed the version upgrade in the second static partition is copied to the vendor_a subpartition in the first static partition, thereby upgrading the vendor_a subpartition from version 1.0 to version 2.0.

[0135] Furthermore, it should be noted that, in practical applications, when copying files from the first subpartition to the second subpartition, a suitable file copying method may be selected based on the file size, the number of copies required, and the desired copying speed.

[0136] For example, in one implementation, if the size of the sub-partition to be copied is smaller than 256 KB, Buffer vs. FileChannel (non-direct mode) may be used for copying; otherwise, Buffer (direct mode) may be used for copying.

[0137] For example, in another implementation, if the number of times that the data needs to be copied is large, for example, more than 7 times, the FileChannel.transferTo() and FileChannel.transferFrom() methods may be used for copying.

[0138] For example, in another implementation, in order to quickly complete the copy, a Path-to-Path approach may be used.

[0139] It should be understood that the above description is merely an example listed for a better understanding of the technical solution of this embodiment, and is not intended to be the sole limitation on this embodiment.

[0140] In addition, it should be noted that in order to ensure that the electronic device can still be started in virtual AB mode, after completing the operation of step S108, it is necessary to erase the first startup instruction written in the misc sub-partition. In this way, when the electronic device starts to load the basic partition and reads the startup mode recorded in the misc sub-partition, it will not read the message of starting in Recovery mode, but will still restart in virtual AB mode.

[0141] Step S109 : restarting the electronic device according to the startup sequence, so that the electronic device sequentially loads data of the basic partition, the first static partition, and the dynamic partition to run the operating system.

[0142] Exemplary, completed Figure 10After the operation shown in the diagram (1), follow Figure 10 The loading sequence in the diagram (2) is to load the data of the basic partition, the first static partition and the dynamic partition in turn to run the operating system. After the operating system is running, the cold patch upgrade is completed.

[0143] In addition, it should be noted that in actual applications, when the boot flag of the first static partition or the second static partition is unBootable, each subsequent cold patch upgrade operation can only be started from the static partition with the boot flag set to Bootable. If you want to boot from the static partition with the boot flag set to unBootable, you need to first complete an operating system version upgrade to complete the repair of the unavailable static partition, and then change the boot flag from unBootable to Bootable. In this way, subsequent cold patch upgrades can normally enter step S106.

[0144] Therefore, the method provided in the embodiment of the present application, after the first sub-partition that needs to be upgraded in the second static partition is upgraded, that is, after the writing operation of the first patch file to the first sub-partition is completed, determines whether the second static partition is available according to the startup identifier corresponding to the second static partition, that is, whether the electronic device can be restarted with the second static partition as the startup entry. When the startup identifier is unavailable, the cold patch upgrade is completed with the help of the currently running first static partition, thereby improving the success rate of the cold patch upgrade and improving the reliability of the product.

[0145] In addition, it should be noted that, due to the technical solution provided in the embodiment of the present application, it is not necessary to synchronously upgrade another static partition after the cold patch upgrade is completed. Therefore, during the next cold patch upgrade, in order to avoid the static partition switched to after the restart being the static partition that has not been upgraded last time and thus losing the first patch file of the last cold patch upgrade, which affects the user's use, the electronic device is in accordance with Figure 5 After the step S109 in step S109 is restarted, if a cold patch package is received again, for example, the second cold patch package, the Figure 11 The process shown in the figure is to carry out a new round of cold patch upgrade. The cold patch upgrade process for the newly received cold patch package specifically includes:

[0146] Step S201: Obtain a second cold patch package.

[0147] Specifically, the second cold patch package includes a second patch file, which is a patch file for the first sub-partition. That is, the upgrade process is the same as the previous cold patch upgrade process, and the upgrade is for the same sub-partition in the second static partition.

[0148] Step S202: Obtain the first patch file written in the second sub-partition.

[0149] Step S203, generating a first target patch file according to the first patch file and the second patch file.

[0150] Step S204, performing a data write operation on the first sub-partition according to the first target patch file.

[0151] For example, still taking the sub-partition to be upgraded in the second static partition as vendor_b, referring to the schematic diagram (1) in Figure 12 When upgrading vendor_b, the first patch file needs to be read from the vendor_a sub-partition in the currently started first static partition, then a first target patch file that needs to be finally written to the vendor_b sub-partition is generated according to the second patch file in the obtained second cold patch package and the read first patch file, and the first target patch file is written to the vendor_b sub-partition, so that the version of the vendor_b sub-partition is upgraded to the 3.0 version shown in the schematic diagram (2) in Figure 12

[0152] It should be noted that before performing the above steps S202 to S204, the patch file last written to the vendor_b sub-partition in the second static partition needs to be erased, so as to avoid abnormality in this upgrade.

[0153] It should be understood that the above description is only an example for better understanding the technical scheme of the embodiment and is not the only limitation of the embodiment.

[0154] Step S205, determining whether the second static partition can be started.

[0155] Specifically, when the starting identifier corresponding to the second static partition obtained from the base partition is Bootable, it is determined that the second static partition can be started, in which case step S206 is entered, that is, the starting order is upgraded to the second static partition, and then the electronic device is restarted.

[0156] Correspondingly, when the starting identifier corresponding to the second static partition obtained from the base partition is unBootable, it is determined that the second static partition cannot be started, in which case step S207 is entered, that is, the first static partition currently active is used to perform cold patch upgrade in the Recovery mode, and the electronic device is restarted.

[0157] Step S206, changing the starting order from starting from the first static partition to starting from the second static partition, and restarting the electronic device to load the data of the base partition, the second static partition and the dynamic partition in sequence to run the operating system according to the changed starting order.

[0158] ​Step S207, starting the electronic device in the Recovery mode.

[0159] Step S208, copying the files in the first sub-partition to the second sub-partition after the electronic device enters the Recovery mode.

[0160] Step S209, restarting the electronic device according to the startup sequence, so that the electronic device loads the data of the base partition, the first static partition and the dynamic partition in sequence to run the operating system.

[0161] It can be found that, Figure 11 Steps S201, S202, S205 to S209 in the illustrated embodiment are similar to Figure 5 Steps S103 to S109 in the illustrated embodiment, and the specific implementation details of this embodiment can be referred to Figure 5 the description of the illustrated embodiment, which will not be described here.

[0162] Thus, the method provided by the embodiments of the present application uses the differential method when upgrading the cold patch for the first time, only upgrading the sub-partition in the static partition that needs to be upgraded, and the first static partition and the second static partition do not need to be synchronized after the upgrade, and the electronic device can directly run in the upgraded static partition. When upgrading the cold patch for the next time, the sub-partition in the static partition that needs to be upgraded is upgraded in full by taking the patch file in the backup partition and the patch file currently obtained as the target patch file, so that the system of the static partition after subsequent upgrades is a system that has repaired all patches.

[0163] In addition, it should be noted that in actual application scenarios, whether the electronic device is started from the first static partition or the second static partition when restarting, if the cold patch upgrade package is received again after the electronic device is restarted, for example, the second cold patch package mentioned above, if the same sub-partition is upgraded, the contents of the sub-partition that needs to be upgraded will be erased, and then the target patch file to be written this time is generated according to the patch file in the cold patch package obtained this time and the patch file written in the corresponding sub-partition of the static partition started this time last time, and then the target patch file is written to the corresponding sub-partition. The above embodiment is only an example of the first static partition that is still started after restarting, and the method of starting from the second static partition is similar to the above embodiment, which will not be described here.

[0164] Referring to Figure 13 , the first startup of the electronic device loads the second static partition, and the cold patch upgrade performed after the startup is the implementation process of the first static partition, which specifically includes:

[0165] Step S301, loading the base partition at startup and obtaining the startup sequence recorded in the base partition.

[0166] Step S302, when starting from the second static partition, loading the second static partition and the dynamic partition.

[0167] Step S303, after starting, obtaining a third cold patch package.

[0168] For example, the third cold patch package includes 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, for example, it can be a vendor_a sub-partition, and the fourth sub-partition is a sub-partition corresponding to the third sub-partition in the second static partition, for example, when the third sub-partition is a vendor_a sub-partition, the fourth sub-partition is a vendor_b sub-partition.

[0169] Step S304, performing a data write operation on the third sub-partition according to the third patch file.

[0170] Step S305, determining whether the first static partition can start.

[0171] For example, the starting identifier corresponding to the first static partition is also recorded in the basic partition, and similar to the starting identifier of the second static partition, the unBootable identifier is used to identify that the partition cannot start, and the Bootable identifier is used to identify that the partition can start. Therefore, when determining whether the first static partition can start according to the starting identifier corresponding to the first static partition recorded in the basic partition, the starting identifier corresponding to the first static partition is obtained from the basic partition.

[0172] Correspondingly, when the obtained starting identifier is unBootable, it is determined that the first static partition cannot start; when the starting identifier is Bootable, it is determined that the first static partition can start.

[0173] In addition, the starting identifier identifying whether the first static partition can start is stored in a similar position to the starting identifier identifying whether the second static partition can start, that is, it is recorded in the X-loader sub-partition in the first static partition.

[0174] That is, before obtaining the starting identifier corresponding to the first static partition from the basic partition, the starting 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 the starting identifier corresponding to the first static partition is recorded in the basic partition.

[0175] Therefore, through the judgment of step S305, when it is determined that the first static partition can start, step S306 is entered; otherwise, step S307 is entered.

[0176] Step S306, the starting order is changed from starting from the second static partition to starting from the first static partition, the electronic device is restarted according to the changed starting order, and the electronic device loads data of the basic partition, the first static partition and the dynamic partition in sequence to run the operating system.

[0177] Step S307, the electronic device is started in the Recovery mode.

[0178] Step S308, after the electronic device enters the Recovery mode, files in the third sub-partition are copied to the fourth sub-partition.

[0179] Step S309, the electronic device is restarted according to the starting order to load data of the basic partition, the second static partition and the dynamic partition in sequence to run the operating system.

[0180] It can be found that, Figure 13 Steps S301 to S309 in the illustrated embodiment are similar to Figure 5 Steps S101 to S109 in the illustrated embodiment, and the specific implementation details of this embodiment can be referred to Figure 5 the description of the illustrated embodiment, which will not be described here.

[0181] Therefore, the method provided in this embodiment, after the upgrade of the sub-partition in the first static partition that needs to be upgraded is completed, that is, after the writing operation of the third patch file to the third sub-partition and the writing operation of the sixth patch file to the virtual dynamic partition of the user data partition are completed, whether the first static partition is available, that is, whether the electronic device can be restarted with the first static partition as the starting entry, is determined according to the starting identifier corresponding to the first static partition. When the starting identifier is not available, the cold patch upgrade is completed by means of the currently running second static partition, thereby improving the success rate of cold patch upgrade and improving the reliability of the product.

[0182] Referring to Figure 14 , after the electronic device is restarted according to Figure 13 Step S309, if the cold patch package is received again, for example, a fourth cold patch package, the cold patch upgrade process performed on the newly received cold patch package specifically includes:

[0183] Step S401, the fourth cold patch package is obtained.

[0184] Exemplarily, in this embodiment, the fourth cold patch package includes a fourth patch file. The fourth patch file corresponds to the third sub-partition and the fourth sub-partition.

[0185] Step S402, the third patch file written in the fourth sub-partition is obtained.

[0186] S403, generating a second target patch file according to the third patch file and the fourth patch file.

[0187] S404, performing a data writing operation on the third sub-partition according to the second target patch file.

[0188] S405, determining whether the first static partition can be started.

[0189] Specifically, when the starting identifier corresponding to the first static partition is Bootable, it is determined that the first static partition can be started, and step S406 is entered.

[0190] Correspondingly, when the starting identifier corresponding to the first static partition is unBootable, it is determined that the first static partition cannot be started, and step S407 is entered.

[0191] S406, changing the starting order from starting from the second static partition to starting from the first static partition, restarting the electronic device according to the changed starting order, and making the electronic device load data of the basic partition, the first static partition and the dynamic partition in sequence to run the operating system.

[0192] S407, starting the electronic device in a Recovery mode.

[0193] S408, after the electronic device enters the Recovery mode, copying files in the third sub-partition to the fourth sub-partition.

[0194] S409, restarting the electronic device according to the starting order, and making the electronic device load data of the basic partition, the second static partition and the dynamic partition in sequence to run the operating system.

[0195] It can be found that, Figure 14 The steps S401 to S409 in the embodiment shown are substantially similar to Figure 11 The steps S201 to S209 in the embodiment shown, and the specific implementation details of this embodiment can be referred to Figure 11 The description of the embodiment shown, which will not be repeated here.

[0196] Therefore, the method provided by the embodiment of the present application adopts a differential method when upgrading the cold patch for the first time, only upgrades the sub-partition in the static partition that needs to be upgraded, and the first static partition and the second static partition do not need to be synchronized after upgrading, and the electronic device can directly run in the upgraded static partition. When the cold patch is upgraded next time, the patch file in the backup partition and the patch file currently obtained are used as target patch files to perform full upgrade on the sub-partition in the static partition that needs to be upgraded, so that the system of the static partition after subsequent upgrade is a system that has repaired all patches.

[0197] In addition, it should be understood that the "first", "second", "third", "fourth" appearing in the technical solutions provided by the embodiments of the present application are only examples listed for better understanding of the technical solutions of the embodiments, and are not the only limitation of the embodiments.

[0198] In addition, it should be noted that the cold patch upgrading method provided by the above embodiments implemented by the electronic device can also be executed by a chip system included in the electronic device, wherein the chip system can include a processor. The chip system can be coupled with a memory, so that the chip system invokes the computer program stored in the memory when running, to realize the steps executed by the electronic device. The processor in the chip system can be an application processor or a processor other than an application processor.

[0199] In addition, the embodiments of the present application also provide a computer readable storage medium, which stores computer instructions, and when the computer instructions run on the electronic device, the electronic device executes the related method steps to realize the cold patch upgrading method in the above embodiments.

[0200] In addition, the embodiments of the present application also provide a computer program product, which, when running on the electronic device, causes the electronic device to execute the related steps to realize the cold patch upgrading method in the above embodiments.

[0201] In addition, the embodiments of the present application also provide a chip (which can also be a component or a module), which can include one or more processing circuits and one or more transceiver pins; wherein the transceiver pins and the processing circuits communicate with each other through internal connection paths, and the processing circuits execute the related method steps to realize the cold patch upgrading method in the above embodiments to control the receiving pins to receive signals and the sending pins to send signals.

[0202] In addition, as known from the above description, the electronic device, computer readable storage medium, computer program product or chip provided by the embodiments of the present application are all used to execute the corresponding methods provided above, and therefore the beneficial effects that can be achieved are referred to the beneficial effects in the corresponding methods provided above, which will not be described here.

[0203] In addition, it should be understood that the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the embodiments of the present application.

Claims

1. A cold patch upgrade method, characterized in that: The method is applied to an electronic device having a data storage structure in a virtual AB mode, the electronic device including a processor and a memory, the memory including a basic partition, a first static partition, a second static partition, a dynamic partition, and a user data partition, the first static partition including a plurality of sub-partitions, the second static partition including a plurality of sub-partitions, and the plurality of sub-partitions of the first static partition respectively corresponding to the plurality of sub-partitions of the second static partition, the method comprising: Loading the basic partition at startup and obtaining the startup sequence recorded in the basic partition; When the boot sequence is to boot from the first static partition, loading data of the first static partition and the dynamic partition to run the operating system; After startup, obtaining a first cold patch package, the first cold patch package including a first patch file, the first patch file corresponding to a first subpartition and a second subpartition, the first subpartition being a subpartition of the second static partition, and the second subpartition being a subpartition of the first static partition corresponding to the first subpartition; Performing a data writing operation on the first sub-partition according to the first patch file; Determining whether the second static partition can be started; When it is determined that the second static partition cannot be started, starting the electronic device in Recovery mode; After the electronic device enters the Recovery mode, copying the files in the first subpartition to the second subpartition; wherein copying the files in the first subpartition to the second subpartition includes: writing a first upgrade instruction for the subpartition to be upgraded by the first patch file in a command file of a cache subpartition in the base partition, and copying the files in the first subpartition to the second subpartition in response to the first upgrade instruction, wherein the first upgrade instruction is determined according to the file name of the first patch file written to the first subpartition; Restart the electronic device according to the startup sequence, so that the electronic device loads the data of the basic partition, the first static partition and the dynamic partition in sequence to run the operating system; wherein, after the electronic device completes the cold patch upgrade after restarting, the second static partition is not upgraded synchronously using the first static partition.

2. The method according to claim 1, characterized in that The performing the data writing operation on the first sub-partition according to the first patch file includes: According to the startup sequence, the second static partition that is not currently started is determined as the static partition to be operated on by the current cold patch upgrade; According to the first patch file, determining the first sub-partition in the second static partition as the sub-partition to be operated on by this cold patch upgrade; Obtaining the path address of the first sub-partition; The first patch file is written into the first sub-partition according to the path address.

3. The method according to claim 1, characterized in that Determining whether the second static partition can be started includes: Obtaining a startup identifier corresponding to the second static partition from the basic partition; Determine whether the second static partition can be started according to the startup identifier.

4. The method according to claim 3, characterized in that The determining, according to the startup identifier, whether the second static partition can be started includes: When the boot identifier is unBootable, determining that the second static partition cannot be booted; When the boot identifier is Bootable, it is determined that the second static partition can be started.

5. The method according to claim 3, characterized in that Before obtaining the startup identifier corresponding to the second static partition from the basic partition, the method further includes: Obtaining a boot identifier corresponding to the second static partition recorded in the X-loader subpartition in the second static partition; The boot identifier corresponding to the second static partition is recorded in the basic partition.

6. The method according to claim 1, characterized in that Starting the electronic device in the recovery mode includes: Writing a first startup instruction for starting the Recovery mode into the misc sub-partition in the basic partition; In response to the first startup instruction, the electronic device is started in the Recovery mode.

7. The method according to claim 6, characterized in that After copying the files in the first subpartition to the second subpartition, the method further includes: The first startup instruction written in the misc sub-partition is erased to restart the electronic device in the virtual AB mode.

8. The method according to any one of claims 1 to 7, characterized in that After restarting the electronic device according to the startup sequence so that the electronic device sequentially loads data of the basic partition, the first static partition, and the dynamic partition to run the operating system, the method further includes: Obtaining a second cold patch package, where the second cold patch package includes a second patch file, and the second patch file corresponds to the first sub-partition and the second sub-partition; Obtaining 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 a 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 it is determined that the second static partition cannot be started, starting the electronic device in Recovery mode; After the electronic device enters the Recovery mode, copying the files in the first subpartition to the second subpartition; The electronic device is restarted according to the startup sequence, so that the electronic device sequentially loads data of the basic partition, the first static partition, and the dynamic partition to run the operating system.

9. The method according to any one of claims 1 to 7, characterized in that The method further comprises: When it is determined that the second static partition can be started, changing the startup order from starting from the first static partition to starting from the second static partition; The electronic device is restarted according to the changed startup sequence, so that the electronic device sequentially loads data of the basic partition, the second static partition, and the dynamic partition to run the operating system.

10. An electronic device, characterized in that: The data storage structure of the electronic device is a virtual AB mode, including a processor and a memory, the memory including a basic partition, a first static partition, a second static partition, a dynamic partition, and a user data partition, the first static partition including a plurality of sub-partitions, the second static partition including a plurality of sub-partitions, and the plurality of sub-partitions of the first static partition respectively corresponding to the plurality of sub-partitions of the second static partition; The memory is coupled to the processor, and the memory stores program instructions; When the program instructions are executed by the processor, the electronic device executes the cold patch upgrade method according to any one of claims 1 to 9.

11. A computer-readable storage medium comprising a computer program, characterized in that When the computer program is run on an electronic device, the electronic device is enabled to execute the cold patch upgrade method according to any one of claims 1 to 9.

12. A computer program product, characterized in that The computer program product includes a computer program, which, when executed on an electronic device, enables the electronic device to execute the cold patch upgrade method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Method and device for upgrading operation system

    CN104918114A

  • Method and system for operating system recovery and method of using build-to-configuration mode to model computer system

    US20040153733A1