Differential upgrade method, device, equipment, storage medium and program product
By obtaining and processing the load files in the differential upgrade package and generating an updated firmware package, the problem of low efficiency of device firmware upgrade is solved and efficient differential upgrade in different devices is achieved.
Patent Information
- Application Number
- CN202410658232.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-27
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2044-05-27
AI Technical Summary
The device firmware upgrade efficiency in the existing technology is low, mainly because the restoration process of the differential file depends on the device to be upgraded, which causes the differential file generated by the server to be compatible with the device, affecting the upgrade efficiency.
By obtaining multiple load files in the differential upgrade package, including registration information, license information and upgrade code, determine the current firmware package of the target firmware, process multiple current resource files and differential files based on the registration information, and generate an updated firmware package. Ensure that differential upgrade can be achieved regardless of the differential file type in the device to be upgraded.
It improves the efficiency of device firmware upgrades, ensures that differential upgrades can be effectively performed on different devices, and improves the compatibility and efficiency of the upgrade process.
Smart Images

Figure CN118227186B
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the technical field of firmware upgrade, and in particular, to a differential upgrade method, apparatus, device, storage medium, and program product. Background Art
[0002] In a device, you can upgrade the firmware in the device by differential upgrade. Differential upgrade means that the server generates a differential upgrade package by comparing the difference between the current version and the new version. The device to be upgraded implements the firmware upgrade by downloading and installing the differential upgrade package.
[0003] The differential upgrade package may include multiple differential files, which are used to record the difference information between the current version and the new version. The device to be upgraded can restore the multiple differential files to the installation information of the new version and install it.
[0004] In the above process, since the restoration process of the differential file is implemented by the device to be upgraded, the server needs to generate a differential file compatible with the device to be upgraded, resulting in low efficiency of device firmware upgrade. Summary of the invention
[0005] The embodiments of the present application provide a differential upgrade method, apparatus, device, storage medium and program product to solve the defect of low firmware upgrade efficiency of devices in the prior art.
[0006] In a first aspect, the present application provides a differential upgrade method, comprising:
[0007] Acquire multiple loading files in a differential upgrade package, where the differential upgrade package is used to upgrade the target firmware, and the multiple loading files include registration information, permission information, and upgrade code;
[0008] Determine a current firmware package of the target firmware, wherein the current firmware package includes a plurality of current resource files;
[0009] Running the upgrade code to perform a first verification process on the license information;
[0010] After the first verification process of the permission information is passed, the multiple current resource files and the multiple differential files in the differential upgrade package are processed respectively according to the registration information to determine an update firmware package;
[0011] The target firmware is upgraded according to the update firmware package.
[0012] In a possible implementation, the upgrade code includes multiple differential algorithms, and according to the registration information, the multiple current resource files and the multiple differential files are processed respectively to determine the update firmware package, including:
[0013] Determine, according to the registration information, an i-th differential file, an i-th current resource file corresponding to the i-th differential file, and a target algorithm corresponding to the i-th differential file, wherein the target algorithm is any one of the multiple differential algorithms;
[0014] According to the registration information, performing a second verification process on the i-th difference file;
[0015] After the second verification process of the i-th differential file passes, determining the i-th updated resource file according to the i-th differential file, the i-th current resource file and the target algorithm;
[0016] The update firmware package includes the multiple i-th update resource files, where i is 1, 2, ..., N in sequence, and N is the number corresponding to the multiple differential files.
[0017] In a possible implementation, determining the i-th updated resource file according to the i-th differential file, the i-th current resource file and the target algorithm includes:
[0018] Inputting the i-th differential file and the i-th current resource file into the algorithm corresponding to the i-th differential file to obtain the i-th selected resource file;
[0019] Performing a third verification process on the i-th selected resource file;
[0020] After the third verification process of the i-th candidate resource file passes, the i-th current resource file is deleted, and the i-th candidate resource file is determined as the i-th updated resource file.
[0021] In a possible implementation manner, the permission information is used to record the minimum operating spaces respectively corresponding to the plurality of differential files, and a first verification process is performed on the permission information, including:
[0022] Obtain the remaining storage space of the device where the target firmware is located;
[0023] Determine whether the minimum operating spaces respectively corresponding to the plurality of differential files are smaller than the remaining storage space;
[0024] If so, determining that the first verification process of the license information passes;
[0025] If not, it is determined that the first verification process of the permission information has failed.
[0026] In a possible implementation manner, after obtaining multiple loading files in the differential upgrade package, the method further includes:
[0027] Respectively obtain the first signature information of the registration information, the second signature information of the license information, and the third signature information corresponding to the upgrade code;
[0028] Performing security verification on the first signature information, the second signature information, and the third signature information respectively;
[0029] Determine that the security verification of the first signature information, the second signature information, and the third signature information passes.
[0030] In a second aspect, the present application provides a differential upgrade method, comprising:
[0031] Obtaining a current firmware package and an updated firmware package, wherein the updated firmware package is a firmware package after the initial firmware package is upgraded, the current firmware package includes a plurality of current resource files, and the updated firmware package includes a plurality of updated resource files;
[0032] Performing differential processing on the multiple current resource files and the multiple updated resource files by using a differential algorithm to obtain multiple differential files;
[0033] Generate registration information according to the plurality of differential files and the differential algorithm used by each differential file;
[0034] generating license information according to the plurality of differential files;
[0035] Generate upgrade code according to the difference algorithm used by each difference file;
[0036] A differential upgrade package is generated according to the plurality of differential files, the registration information, the license information and the upgrade code.
[0037] In a possible implementation manner, the current resource file corresponds to the updated resource file, and for any one of the current resource files, the current resource file and the updated resource file are subjected to differential processing by a differential algorithm to obtain a differential file, including:
[0038] According to the current resource file and the updated resource file, determining a plurality of parameter operation ratios corresponding to each differential algorithm among a plurality of differential algorithms;
[0039] Determining score values corresponding to the plurality of differential algorithms respectively according to the plurality of parameter operation ratios;
[0040] Determine the differential algorithm corresponding to the highest score value among the multiple score values as the target algorithm;
[0041] According to the target algorithm, the current resource file and the updated resource file are differentially processed to obtain a differential file.
[0042] In a possible implementation, for any differential algorithm, determining a score value corresponding to the differential algorithm according to the multiple parameter operation ratios includes:
[0043] Determining whether the operating ratios of the multiple parameters are less than or equal to preset values;
[0044] If yes, determining the score value corresponding to the differential algorithm according to the multiple parameter operation ratios and the weight value corresponding to each parameter operation ratio;
[0045] If not, the score value corresponding to the differential algorithm is determined to be 0.
[0046] In a possible implementation, generating registration information according to the plurality of differential files and the differential algorithm used by each differential file includes:
[0047] Obtain multiple field headers corresponding to the registration information;
[0048] Determine the field information corresponding to each field header according to the plurality of differential files and the differential algorithm used by each differential file;
[0049] Registration information is generated according to the multiple field headers and the field information corresponding to each field header.
[0050] In a possible implementation, generating license information according to the plurality of differential files includes:
[0051] Determine the minimum operating space corresponding to each differential file in turn;
[0052] The permission information is generated according to the plurality of differential files and the minimum execution space corresponding to each differential file.
[0053] In a third aspect, the present application provides a differential upgrade device, comprising:
[0054] An acquisition module, used to acquire multiple loading files in a differential upgrade package, where the differential upgrade package is used to upgrade the target firmware, and the multiple loading files include registration information, permission information, and upgrade code;
[0055] A first determining module, configured to determine a current firmware package of the target firmware, wherein the current firmware package includes a plurality of current resource files;
[0056] a second determination module, configured to run the upgrade code to perform a first verification process on the license information; after the first verification process of the license information passes, the plurality of current resource files and the plurality of differential files in the differential upgrade package are processed respectively according to the registration information to determine an update firmware package;
[0057] An upgrade module is used to upgrade the target firmware according to the update firmware package.
[0058] In a possible implementation manner, the upgrade code includes multiple differential algorithms, and the second determination module is specifically used to:
[0059] Determine, according to the registration information, an i-th differential file, an i-th current resource file corresponding to the i-th differential file, and a target algorithm corresponding to the i-th differential file, wherein the target algorithm is any one of the multiple differential algorithms;
[0060] According to the registration information, performing a second verification process on the i-th difference file;
[0061] After the second verification process of the i-th differential file passes, determining the i-th updated resource file according to the i-th differential file, the i-th current resource file and the target algorithm;
[0062] The update firmware package includes the multiple i-th update resource files, where i is 1, 2, ..., N in sequence, and N is the number corresponding to the multiple differential files.
[0063] In a possible implementation manner, the second determining module is specifically configured to:
[0064] Inputting the i-th differential file and the i-th current resource file into the algorithm corresponding to the i-th differential file to obtain the i-th selected resource file;
[0065] Performing a third verification process on the i-th selected resource file;
[0066] After the third verification process of the i-th candidate resource file passes, the i-th current resource file is deleted, and the i-th candidate resource file is determined as the i-th updated resource file.
[0067] In a possible implementation manner, the permission information is used to record the minimum operating spaces respectively corresponding to the multiple differential files, and the second determination module is specifically used to:
[0068] Obtain the remaining storage space of the device where the target firmware is located;
[0069] Determine whether the minimum operating spaces respectively corresponding to the plurality of differential files are smaller than the remaining storage space;
[0070] If so, determining that the first verification process of the license information passes;
[0071] If not, it is determined that the first verification process of the permission information has failed.
[0072] In a possible implementation, the method further includes a verification module, and the verification module is specifically configured to:
[0073] Respectively obtain the first signature information of the registration information, the second signature information of the license information, and the third signature information corresponding to the upgrade code;
[0074] Performing security verification on the first signature information, the second signature information, and the third signature information respectively;
[0075] Determine that the security verification of the first signature information, the second signature information, and the third signature information passes.
[0076] In a fourth aspect, the present application provides a differential upgrade device, comprising:
[0077] An acquisition module, used to acquire a current firmware package and an updated firmware package, wherein the updated firmware package is a firmware package after the initial firmware package is upgraded, the current firmware includes a plurality of current resource files, and the updated firmware package includes a plurality of updated resource files;
[0078] A first determining module, configured to perform differential processing on the multiple current resource files and the multiple updated resource files by using a differential algorithm to obtain multiple differential files;
[0079] A second determination module, configured to generate registration information according to the plurality of differential files and a differential algorithm used by each differential file;
[0080] A third determination module, configured to generate license information according to the plurality of differential files;
[0081] The fourth determination module is used to generate an upgrade code according to the difference algorithm used by each difference file;
[0082] A generation module is used to generate a differential upgrade package according to the multiple loading files and the multiple differential files.
[0083] In a possible implementation manner, the current resource files correspond to the updated resource files one by one, and for any current resource file, the first determining module is specifically configured to:
[0084] According to the current resource file and the updated resource file, determining a plurality of parameter operation ratios corresponding to each differential algorithm among a plurality of differential algorithms;
[0085] Determining score values corresponding to the plurality of differential algorithms respectively according to the plurality of parameter operation ratios;
[0086] Determine the differential algorithm corresponding to the highest score value among the multiple score values as the target algorithm;
[0087] According to the target algorithm, the current resource file and the updated resource file are differentially processed to obtain a differential file.
[0088] In a possible implementation, for any differential algorithm, the first determination module is specifically configured to:
[0089] Determining whether the operating ratios of the multiple parameters are less than or equal to preset values;
[0090] If yes, determining the score value corresponding to the differential algorithm according to the multiple parameter operation ratios and the weight value corresponding to each parameter operation ratio;
[0091] If not, the score value corresponding to the differential algorithm is determined to be 0.
[0092] In a possible implementation manner, the second determining module is specifically configured to:
[0093] Obtain multiple field headers corresponding to the registration information;
[0094] Determine the field information corresponding to each field header according to the plurality of differential files and the differential algorithm used by each differential file;
[0095] Registration information is generated according to the multiple field headers and the field information corresponding to each field header.
[0096] In a possible implementation manner, the second determining module is specifically configured to:
[0097] Determine the minimum operating space corresponding to each differential file in turn;
[0098] The permission information is generated according to the plurality of differential files and the minimum execution space corresponding to each differential file.
[0099] In a fifth aspect, the present application provides a differential upgrade device, comprising: a processor, and a memory communicatively connected to the processor;
[0100] The memory stores computer-executable instructions;
[0101] The processor executes the computer-executable instructions stored in the memory to implement the method described in any one of the first aspects.
[0102] In a sixth aspect, the present application provides a differential upgrade device, comprising: a processor, and a memory communicatively connected to the processor;
[0103] The memory stores computer-executable instructions;
[0104] The processor executes the computer-executable instructions stored in the memory to implement the method described in any one of the second aspects.
[0105] In a seventh aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method as described in any one of the first aspects.
[0106] In an eighth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method as described in any one of the second aspects.
[0107] In a ninth aspect, the present application provides a computer program product, comprising a computer program, which, when executed by a computer, implements the method as described in any one of the first aspects.
[0108] In a tenth aspect, the present application provides a computer program product, comprising a computer program, which, when executed by a computer, implements the method as described in any one of the second aspects.
[0109] The embodiment of the present application provides a differential upgrade method, device, equipment, storage medium and program product, which obtains multiple loading files in a differential upgrade package, the differential upgrade package is used to upgrade the target firmware, the multiple loading files include registration information, license information and upgrade code, determine the current firmware package of the target firmware, the current firmware package includes multiple current resource files, run the upgrade code to perform a first verification process on the license information, after the first verification process of the license information passes, according to the registration information, respectively process the multiple current resource files and the multiple differential files in the differential upgrade package, determine the update firmware package, and upgrade the target firmware according to the update firmware package. In this way, it can be ensured that no matter what type of differential file is in the device to be upgraded, differential upgrade can be achieved to improve the firmware upgrade efficiency of the device. BRIEF DESCRIPTION OF THE DRAWINGS
[0110] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0111] Figure 1 A schematic diagram of an existing differential upgrade process provided in an embodiment of the present application;
[0112] Figure 2 A flowchart of a differential upgrade method provided in an embodiment of the present application;
[0113] Figure 3 A flowchart of another differential upgrade method provided in an embodiment of the present application;
[0114] Figure 4 A flowchart of another differential upgrade method provided in an embodiment of the present application;
[0115] Figure 5 A schematic diagram of generating a differential file provided in an embodiment of the present application;
[0116] Figure 6 A schematic diagram of a differential upgrade package structure provided in an embodiment of the present application;
[0117] Figure 7 A flowchart of another differential upgrade method provided in an embodiment of the present application;
[0118] Figure 8 A schematic diagram of the structure of a differential upgrade device provided in an embodiment of the present application;
[0119] Fig. 9 A schematic diagram of the structure of another differential upgrade device provided in an embodiment of the present application;
[0120] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0121] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0122] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0123] It should be noted that, although the terms "first", "second", etc. are used to describe various information in the embodiments of the present application, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. Optionally, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information.
[0124] It should be understood that the terms "comprises" and "includes" indicate the presence of the previously mentioned features, steps, operations, but do not exclude the presence, occurrence or addition of one or at least one other feature, step, operation. The terms "and / or" and the like used in this application may be interpreted as inclusive, or mean any one or any combination. Optionally, "A and / or B" means "any of the following: A; B; A and B". In addition, the character " / " in this article generally indicates that the objects associated before and after are in an "or" relationship.
[0125] In a device, you can upgrade the firmware in the device by differential upgrade. Differential upgrade is to generate a differential upgrade package by comparing the difference between the current version and the new version. The device to be upgraded downloads and installs the differential upgrade package to achieve firmware upgrade.
[0126] Next, combine Figure 1 , the existing differential upgrade process is explained.
[0127] Figure 1 A schematic diagram of an existing differential upgrade process provided in an embodiment of the present application. Figure 1 , Figure 1 It may include a server 101 and a device to be upgraded 102 .
[0128] A communication connection may be established between the server 101 and the device to be upgraded 102. For example, the server 101 may establish a communication connection with the device to be upgraded 102 via a protocol such as Hypertext Transfer Protocol (HTTP) or Hypertext Transfer Protocol over Secure Socket Layer (HTTPS), which is not specifically limited herein.
[0129] Among them, a database may be provided in the server 101, and the database may include a first version firmware image package and a second version firmware image package. The first version firmware image package may be a firmware image package currently running in the device 102 to be upgraded, and the second version firmware image package may be a firmware image package to be upgraded in the device 102 to be upgraded. The server 101 may prepare a differential upgrade package of the firmware in the device 102 to be upgraded based on the first version firmware image package and the second version firmware image package. The server 101 may also send a differential upgrade package to the device 102 to be upgraded. The differential upgrade package may include multiple differential files, and the multiple differential files are used to record the difference information between versions.
[0130] Server 101 may be a cloud server, a server of a distributed system, or a server combined with a blockchain, and no specific limitation is made here.
[0131] The device to be upgraded 102 may include a restoration program. The device to be upgraded 102 may receive a differential upgrade package, and restore the differential upgrade package using multiple differential algorithms in the restoration program to generate a second version firmware image package to implement differential upgrade.
[0132] The device 102 to be upgraded may be any form of terminal, for example, may include a mobile phone, a computer, a tablet, a wearable device, a network camera, a network video recorder, etc. The embodiment of the present application does not specifically limit the device 102 to be upgraded.
[0133] In the above process, since the restoration process of the differential file is implemented by the device to be upgraded, the server needs to generate a differential file compatible with the device to be upgraded, resulting in low efficiency of device firmware upgrade.
[0134] In order to solve the above technical problems, the embodiment of the present application provides a differential upgrade method, which obtains multiple loading files in a differential upgrade package, processes multiple differential files in the differential upgrade package according to the multiple loading files, so as to obtain an update firmware package for upgrade processing. In this way, it can be ensured that no matter what type of differential file is in the device to be upgraded, differential upgrade can be implemented to improve the firmware upgrade efficiency of the device.
[0135] The technical solution shown in the present application is described in detail below through specific embodiments. It should be noted that the following embodiments can exist independently or in combination with each other, and the same or similar contents will not be described repeatedly in different embodiments.
[0136] Figure 2 A flowchart of a differential upgrade method provided by an embodiment of the present application. The execution subject of the embodiment of the present application can be a terminal device or a client set in the terminal device. The client can be implemented by software or by a combination of software and hardware. Figure 2 , the method comprising:
[0137] S201. Acquire multiple loading files in a differential upgrade package.
[0138] The differential upgrade package can be used to upgrade the target firmware, and the target firmware can be the firmware to be upgraded in the terminal device. The differential upgrade package can include multiple differential files and multiple loading files.
[0139] Multiple differential files can be used to record the difference information between the current firmware package and the updated firmware package. The current firmware package can be the firmware package corresponding to the firmware currently running on the terminal device. The updated firmware package can be the firmware package corresponding to the firmware that the terminal device needs to upgrade.
[0140] Multiple loading files can be used to control multiple differential files for differential upgrade. Multiple loading files can include registration information, license information and upgrade code.
[0141] In response to the upgrade instruction sent by the server, multiple loading files in the differential upgrade package can be obtained. The upgrade instruction can be used to instruct the terminal device to perform an upgrade operation.
[0142] Optionally, multiple loading files in the differential upgrade package may be obtained by streaming download.
[0143] Streaming download refers to downloading multiple files in the differential upgrade package to the terminal device block by block in a streaming manner.
[0144] Optionally, after obtaining the differential upgrade package of the target firmware, the security verification of multiple loaded files can be performed in the following manner: respectively obtain the first signature information of the registration information, the second signature information of the license information, and the third signature information corresponding to the upgrade code; respectively perform security verification on the first signature information, the second signature information, and the third signature information; and determine that the security verification of the first signature information, the second signature information, and the third signature information has passed.
[0145] S202: Determine the current firmware package of the target firmware.
[0146] The current firmware package can be stored in the terminal device. The current firmware package can include multiple current resource files. Multiple current resource files can be used to record the resource files corresponding to the firmware currently running on the terminal device.
[0147] The current firmware package of the target firmware may be determined in the storage space of the terminal device.
[0148] For example, the name of the target firmware is abc, and the current firmware package abc1.2.1 can be determined based on abc.
[0149] S203: Run the upgrade code to perform a first verification process on the license information.
[0150] The upgrade code can be used to record program codes for restoring multiple differential files.
[0151] The upgrade code may include third signature information, program code for decryption, program code for calling multiple differential restoration algorithms, etc.
[0152] The packaging format of the upgrade code may be compatible with the system of the terminal device, and the upgrade code may be run in the system of the terminal device.
[0153] Running the upgrade code can be used to execute a processing script corresponding to the upgrade code to perform corresponding processing steps.
[0154] The permission information may be used to record device object information corresponding to the updated firmware package.
[0155] The device object information may include the second signature information, the first identification information of the current firmware package, the operating environment of the current operating system, the minimum memory space when multiple differential files are restored, the minimum flash memory space when multiple differential files are restored, etc.
[0156] The first verification process may be used to verify the security of the license information.
[0157] The upgrade code may be run to verify the first identification information of the current firmware package in the license information to determine the security of the license information.
[0158] S204: After the first verification process of the permission information is passed, the multiple current resource files and the multiple differential files in the differential upgrade package are processed respectively according to the registration information to determine the update firmware package.
[0159] The registration information can be used to record the differential comparison information of each file with the same name in the current firmware package and the updated firmware package. The differential comparison information can include the differential information of multiple differential files of the first signature information. The differential information of each differential file can include the differential file name, the hash information of the current resource file, the file length of the current resource file, the hash information of the updated resource file, the file length of the updated resource file, the hash information of the differential file, the file length of the differential file, the secure encryption method of the differential file, the differential algorithm information, etc.
[0160] The differential algorithm information may include the differential algorithm name, the old version files of the file directory, the differential files of the file directory, the restored files of the file directory, and may also include a loading method and at least one verification method, which are not limited here. The loading method may include file stream loading and all file loading. The verification method may include verifying patch data, verifying old version data, etc.
[0161] The differential file may correspond to the current resource file, wherein the current resource file may be empty.
[0162] The current resource file being empty may indicate that there is no current resource file corresponding to the updated resource file in the current firmware package, that is, the updated resource file is a newly added file. Correspondingly, the differential file may indicate the differential information between the updated resource file and the empty file, that is, the updated resource file itself is differentially processed to obtain the differential file.
[0163] The update firmware package may include multiple update resource files.
[0164] After the first verification process of the license information is passed, the multiple current resource files and the multiple differential files can be processed respectively according to the registration information and the multiple differential algorithms to restore the multiple updated resource files.
[0165] S205: Upgrade the target firmware according to the update firmware package.
[0166] The device status of the terminal device can be determined. If the device status is an upgradeable state, the target firmware is upgraded according to the update firmware package, and the upgrade result of the terminal device is verified. After the upgrade result is passed, it is determined that the upgrade is completed.
[0167] The differential upgrade method provided in this embodiment obtains multiple loading files in a differential upgrade package, the differential upgrade package is used to upgrade the target firmware, the multiple loading files include registration information, permission information and upgrade code, determine the current firmware package of the target firmware, the current firmware package includes multiple current resource files, run the upgrade code to perform a first verification process on the permission information, after the first verification process of the permission information passes, according to the registration information, respectively process the multiple current resource files and the multiple differential files, determine the update firmware package, and upgrade the target firmware according to the update firmware package. In this way, it can be ensured that no matter what type of differential file is in the device to be upgraded, differential upgrade can be achieved to improve the firmware upgrade efficiency of the device.
[0168] Figure 3 A flowchart of another differential upgrade method provided in an embodiment of the present application. Based on the above embodiment, see Figure 3 , the method is described in detail. The method comprises:
[0169] S301. Acquire multiple loading files in a differential upgrade package.
[0170] The execution process of S301 can refer to the execution process of S201, which will not be described in detail here.
[0171] S302: Obtain first signature information of registration information, second signature information of license information, and third signature information corresponding to the upgrade code respectively.
[0172] The first signature information can be used to perform security verification on the registration information, the second signature information can be used to perform security verification on the license information, and the third signature information can be used to perform security verification on the upgrade code.
[0173] The signature fields corresponding to the registration information, the license information and the upgrade code can be determined, and the first signature information of the registration information, the second signature information of the license information and the third signature information corresponding to the upgrade code can be obtained according to the signature fields.
[0174] S303: Perform security verification on the first signature information, the second signature information, and the third signature information respectively.
[0175] Among them, security verification can adopt an asymmetric encryption algorithm.
[0176] For example, the first signature information can be encrypted information encrypted by the server using a public key. The terminal device can decrypt the encrypted information using a private key and determine whether the decrypted information is consistent with the verification information. If they are consistent, the security verification is determined to be successful; if they are inconsistent, the security verification is determined to be unsuccessful.
[0177] The first signature information, the second signature information, and the third signature information may be respectively securely verified by an asymmetric encryption algorithm.
[0178] S304: Determine whether the security verification of the first signature information, the second signature information, and the third signature information passes.
[0179] The security verification results corresponding to the first signature information, the second signature information, and the third signature information can be determined, and it can be determined that the security verification results of the first signature information, the second signature information, and the third signature information are all security verification passed.
[0180] S305: Determine the current firmware package of the target firmware.
[0181] The execution process of S305 can refer to the execution process of S202, which will not be described in detail here.
[0182] S306: Run the upgrade code to obtain the remaining storage space of the device where the target firmware is located.
[0183] The remaining storage space may include the remaining memory space and the remaining flash memory space.
[0184] The actual identification information of the current firmware package can be obtained by running the upgrade code, and it can be determined whether the first identification information in the license information matches the actual identification information. If so, the remaining storage space of the device where the target firmware is located is obtained.
[0185] S307: Determine whether the minimum operating spaces corresponding to the plurality of differential files are smaller than the remaining storage space.
[0186] If not, execute S308;
[0187] If so, execute S309.
[0188] The permission information is used to record the minimum operating space corresponding to the plurality of differential files.
[0189] If the minimum operating space corresponding to at least one differential file among the multiple differential files is larger than the remaining storage space, execute S308; if the minimum operating space corresponding to any differential file among the multiple differential files is smaller than the remaining storage space, execute S309.
[0190] S308: Determine whether the first verification process of the license information has failed.
[0191] If it is determined that the first verification process of the license information has not passed, it is determined that the target firmware upgrade has failed.
[0192] S309: Determine whether the first verification process of the license information has passed.
[0193] After S309, S310 is executed.
[0194] Determining that the first verification process of the license information passes can ensure that each differential file in the differential upgrade package can be reliably run in the terminal device.
[0195] S310, i is initialized to 1.
[0196] S311. Determine, according to the registration information, the ith differential file, the ith current resource file corresponding to the ith differential file, and the target algorithm corresponding to the ith differential file.
[0197] The target algorithm is any one of multiple differential algorithms.
[0198] The registration information may include the first signature information and differential information of the plurality of differential files.
[0199] For example, the registration information can be represented by the following code:
[0200] “RegSign”: “rsa2048:4ac7dc54ela58b7d1……”,
[0201] "RegDiff":{
[0202] {“Name”: “uImage”,
[0203] "Compare": "Bsdiffv1.0.0Args:-f",
[0204] "oldsize": "115200",
[0205] “NewSize”: “238900”,
[0206] “Diffsize”: “565”,
[0207] "oldHash": "sha256:9d94fffff984ff8a5b7b223a3a4a789f7......",
[0208] "NewHash": "sha256:273b1215be17107ae08b9923d2695...",
[0209] "DiffHash": "sha256:30f6ee73£09644c276969decb4915d...",
[0210] "Encrypt": "aes128"}
[0211] …
[0212] Among them, "RegSign" can represent the first signature information, "RegDiff" can represent the differential information of the differential file, "Name" represents the name of the differential file, "Compare" represents the differential algorithm information, "oldsize" represents the file length of the current resource file, "NewSize" represents the file length of the updated resource file, "Diffsize" represents the file length of the differential file, "oldHash" represents the hash information of the current resource file, "NewHash" represents the hash information of the updated resource file, "DiffHash" represents the hash information of the differential file, and "Encrypt" represents the secure encryption method of the differential file.
[0213] The i-th differential file can be downloaded according to the order of multiple differential files in the registration information, the i-th current resource file corresponding to the i-th differential file can be determined according to the differential file name in the registration information, and the target algorithm corresponding to the i-th differential file can be determined according to the differential algorithm information in the registration information.
[0214] S312: Perform a second verification process on the i-th differential file according to the registration information.
[0215] The second verification process may be used to verify the security of the i-th differential file.
[0216] The i-th differential file can be decrypted according to the security encryption method in the registration information. After decrypting the i-th differential file, a second verification process is performed on the i-th differential file and the i-th current resource file according to the file length of the current resource file, the file length of the differential file, the hash information of the current resource file, and the hash information of the differential file in the registration information.
[0217] Optionally, the i-th differential file can be subjected to a second verification process in the following manner: determine the actual differential file length and actual differential hash information corresponding to the i-th differential file, and the actual current resource file length and actual current resource hash information corresponding to the i-th current resource file, compare the actual differential file length with the file length of the differential file in the registration information, compare the actual differential hash information with the hash information of the differential file in the registration information, compare the actual current resource file length with the file length of the current resource file in the registration information, and compare the actual current resource hash information with the hash information of the current resource in the registration information; if the above-mentioned multiple comparison results are all matched, it is determined that the second verification process has passed; if any one of the comparison results is a mismatch, it is determined that the second verification process has failed.
[0218] When the second verification process fails, it is determined that the target firmware upgrade fails.
[0219] S313: After the second verification process of the i-th differential file passes, determine the i-th updated resource file according to the i-th differential file, the i-th current resource file and the target algorithm.
[0220] After the second verification process of the i-th differential file is passed, the algorithm interface of the target algorithm can be determined, the i-th differential file and the i-th current resource file can be input into the algorithm interface, and the i-th updated resource file can be determined.
[0221] Optionally, the i-th updated resource file can be determined according to the i-th differential file, the i-th current resource file and the target algorithm in the following manner: input the i-th differential file and the i-th current resource file into the algorithm corresponding to the i-th differential file to obtain the i-th selected resource file; perform a third verification process on the i-th selected resource file; after the third verification process of the i-th selected resource file passes, delete the i-th current resource file, and determine the i-th selected resource file as the i-th updated resource file.
[0222] The third verification process may be used to determine the security of the i-th candidate resource file.
[0223] Optionally, the third verification process can be performed on the i-th selected resource file in the following manner: determine the actual file length and actual hash information corresponding to the i-th selected resource file, compare the actual file length with the file length of the updated resource file in the registration information, and compare the actual hash information with the hash information of the updated resource file in the registration information; if the above-mentioned multiple comparison results are all matched, it is determined that the third verification process has passed; if any one of the comparison results is a mismatch, it is determined that the third verification process has failed.
[0224] When the third verification process fails, it is determined that the target firmware upgrade fails.
[0225] S314. Update i to i+1, and determine whether i+1 is greater than N.
[0226] If yes, execute S315;
[0227] If not, execute S311.
[0228] Wherein, N may be the number corresponding to the plurality of differential files. The update firmware package may include N update resource files.
[0229] S315: Upgrade the target firmware according to the update firmware package.
[0230] The execution process of S315 can refer to the execution process of S205, which will not be described in detail here.
[0231] The implementation content of each step in the embodiment of the present application can refer to the description of the corresponding steps or operations in the above method embodiment, and repeated content will not be repeated.
[0232] The differential upgrade method provided in this embodiment obtains multiple loading files in a differential upgrade package, the differential upgrade package is used to upgrade the target firmware, the multiple loading files include registration information, permission information and upgrade code, determine the current firmware package of the target firmware, the current firmware package includes multiple current resource files, run the upgrade code to obtain the remaining storage space of the device where the target firmware is located, judge whether the minimum running space corresponding to the multiple differential files is less than the remaining storage space, after the first verification process of the permission information is passed, determine the i-th differential file, the i-th current resource file corresponding to the i-th differential file, and the target algorithm corresponding to the i-th differential file according to the registration information, the target algorithm is any one of the multiple differential algorithms, perform a second verification process on the i-th differential file according to the registration information, after the second verification process of the i-th differential file is passed, determine the i-th update resource file according to the i-th differential file, the i-th current resource file and the target algorithm, wherein i is 1, 2, ..., N in sequence, N is the number corresponding to the multiple differential files, and the target firmware is upgraded according to the update firmware package. In this way, it can be ensured that no matter what type of differential file is in the device to be upgraded, differential upgrade can be implemented, so as to improve the firmware upgrade efficiency of the device.
[0233] Figure 4 A flowchart of another differential upgrade method provided in the embodiment of the present application. The execution subject of the embodiment of the present application can be a server. The server can be implemented by combining software and hardware. Figure 4 , the method comprising:
[0234] S401, obtaining a current firmware package and an updated firmware package.
[0235] The updated firmware package may be a firmware package after the initial firmware package is upgraded, the current firmware package includes multiple current resource files, and the updated firmware package includes multiple updated resource files. The multiple current resource files may correspond to the multiple updated resource files.
[0236] The target firmware to be upgraded can be determined, and the current firmware package and the update firmware package can be obtained according to the target firmware.
[0237] S402: Perform differential processing on multiple current resource files and multiple updated resource files by using a differential algorithm to obtain multiple differential files.
[0238] There may be multiple differential algorithms, and different differential algorithms may have different differential restoration conditions.
[0239] The updated resource file may be the same as or different from the current resource file. When the updated resource file is the same as the current resource file, the difference file is empty; when the updated resource file is different from the current resource file, the difference file may indicate the difference information between the updated resource file and the current resource file.
[0240] For any updated resource file, it can be determined whether there is a target current resource file corresponding to the updated resource file in multiple current resource files. If not, the target algorithm can be determined from multiple differential algorithms based on the updated resource file, and the updated resource file can be differentially processed according to the target algorithm to obtain a differential file. If it exists, it is determined whether the updated resource file is the same as the target current resource file. If they are different, the target algorithm is determined from multiple differential algorithms, and the updated resource file and the target current resource file are differentially processed according to the target algorithm to obtain a differential file. If they are the same, it is determined that the differential file is empty.
[0241] Next, combine Figure 5 , an example is given of a process of performing differential processing on multiple current resource files and multiple updated resource files through a differential algorithm to obtain multiple differential files.
[0242] Figure 5 A schematic diagram of differential file generation provided in the embodiment of the present application. Figure 5 , Figure 5 It can include multiple current resource files, multiple updated resource files, and multiple differential files.
[0243] The multiple current resource files may include current resource file 1, current resource file 2, ..., current resource file n. The multiple updated resource files may include updated resource file 1, updated resource file 2, ..., updated resource file n. The multiple differential files may include differential file 1, differential file 2, ..., differential file n.
[0244] Among them, the current resource file 1 corresponds to the updated resource file 1, ..., the current resource file n corresponds to the updated resource file n.
[0245] Differential file 1 may be generated based on current resource file 1 and updated resource file 1, ..., and differential file n may be generated based on current resource file n and updated resource file n.
[0246] Here, assuming that the current resource file 3 is empty, the differential file 3 can be generated based on the empty current resource file 3 and the updated resource file 3.
[0247] Assuming that the current resource file 4 is the same as the updated resource file 4 , the differential file 4 can be generated as an empty differential file based on the current resource file 4 and the updated resource file 4 .
[0248] S403: Generate registration information according to the plurality of differential files and the differential algorithm used by each differential file.
[0249] The initial information corresponding to the registration information can be determined, and the multiple sub-information corresponding to the initial information can be determined according to the multiple differential files and the differential algorithm used by each differential file, and the multiple sub-information and the initial information can be combined to generate the registration information.
[0250] The initial information may be used to represent the structure of the registration information, and the sub-information may be specific information corresponding to each structure.
[0251] Optionally, registration information can be generated in the following manner: obtain multiple field headers corresponding to the registration information; determine the field information corresponding to each field header based on multiple differential files and the differential algorithm used by each differential file; generate registration information based on multiple field headers and the field information corresponding to each field header.
[0252] Among them, the field header can be used to represent the attributes of the corresponding field information.
[0253] For example, the field header may be RegSign, RegDiff, etc., where "RegSign" may represent the first signature information, and "RegDiff" may represent the differential information of the differential file.
[0254] S404: Generate license information based on the multiple differential files.
[0255] The first identification information of the current firmware package may be determined, and the permission information may be generated according to the plurality of differential files and the first identification information.
[0256] Optionally, the permission information may be generated in the following manner: determining the minimum operating space corresponding to each differential file in sequence; and generating the permission information according to the plurality of differential files and the minimum operating space corresponding to each differential file.
[0257] The minimum operating space may include a minimum memory operating space and a minimum flash memory operating space.
[0258] S405: Generate an upgrade code according to the differential algorithm used by each differential file.
[0259] At least one differential algorithm corresponding to the plurality of differential files may be determined, and based on the at least one differential algorithm, an algorithm interface corresponding to the at least one differential algorithm may be determined, and based on the at least one algorithm interface, an upgrade code may be generated.
[0260] S406: Generate a differential upgrade package according to the multiple differential files, registration information, license information and upgrade code.
[0261] The differential upgrade package may be used to upgrade the target firmware, and the target firmware may be the firmware to be upgraded in the terminal device to be upgraded.
[0262] Multiple differential files, registration information, license information and upgrade codes can be packaged to generate a differential upgrade package.
[0263] Next, combine Figure 6 , the structure of the differential upgrade package is illustrated with an example.
[0264] Figure 6 A schematic diagram of a differential upgrade package structure provided in an embodiment of the present application. Figure 6 , Figure 6 It may include multiple loading files and multiple differential files. The multiple loading files may include registration information, license information and upgrade codes. The multiple differential files may include differential file 1, differential file 2, ..., differential file n.
[0265] The implementation content of each step in the embodiment of the present application can refer to the description of the corresponding steps or operations in the above method embodiment, and repeated content will not be repeated.
[0266] The differential upgrade method provided in this embodiment obtains the current firmware package and the updated firmware package, wherein the updated firmware package is the firmware package after the initial firmware package is upgraded, the current firmware includes multiple current resource files, and the updated firmware package includes multiple updated resource files. The multiple current resource files and the multiple updated resource files are differentially processed by a differential algorithm to obtain multiple differential files. Registration information is generated according to the multiple differential files and the differential algorithm used by each differential file. Permission information is generated according to the multiple differential files. An upgrade code is generated according to the differential algorithm used by each differential file. A differential upgrade package is generated according to the multiple differential files, the registration information, the permission information and the upgrade code. In this way, it can be ensured that no matter what type of differential file is in the device to be upgraded, differential upgrade can be achieved to improve the firmware upgrade efficiency of the device.
[0267] Next, combine Figure 7 For any current resource file, the current resource file corresponds to the updated resource file, and the current resource file and the updated resource file are differentially processed by a differential algorithm to obtain a differential file (S402) for further explanation.
[0268] Figure 7 A flowchart of another differential upgrade method provided in an embodiment of the present application. Based on the above embodiment, see Figure 7 , the method is described in detail. The method comprises:
[0269] S701. Determine, according to a current resource file and an updated resource file, a plurality of parameter operation ratios corresponding to each differential algorithm among a plurality of differential algorithms.
[0270] Multiple differencing algorithms may be algorithms supported by the server.
[0271] The plurality of parameter operation ratios may include a time operation ratio, a memory operation ratio, a flash operation ratio, a CPU operation ratio, etc. The parameter operation ratio may be a ratio of the actual operation data of the differential algorithm to the restricted operation data.
[0272] The time operation ratio may be the ratio of the actual operation time of the differential algorithm to the operation time threshold. The memory operation ratio may be the ratio of the actual memory operation ratio of the differential algorithm to the memory threshold. The flash operation ratio may be the ratio of the actual flash operation ratio of the differential algorithm to the flash threshold. The CPU operation ratio may be the ratio of the actual CPU consumption data to the CPU consumption threshold.
[0273] For any differential algorithm, the current resource file and the updated resource file are differentially processed by the differential algorithm to determine the operating ratios of multiple parameters corresponding to the differential algorithm.
[0274] S702: Determine the score values corresponding to the plurality of differential algorithms according to the operation ratios of the plurality of parameters.
[0275] The score value can be used to indicate the processing performance of the differential algorithm. The higher the score value, the higher the processing performance.
[0276] The weight values corresponding to the multiple parameter operation ratios can be obtained, and the score values corresponding to the multiple differential algorithms can be determined according to the multiple parameter operation ratios and the weight value corresponding to each parameter operation ratio.
[0277] Optionally, for any differential algorithm, the score value corresponding to the differential algorithm can be determined according to multiple parameter operating ratios in the following manner: determine whether the multiple parameter operating ratios are less than or equal to preset values; if so, determine the score value corresponding to the differential algorithm according to the multiple parameter operating ratios and the weight values corresponding to each parameter operating ratio; if not, determine that the score value corresponding to the differential algorithm is 0.
[0278] Among them, the score value corresponding to the differential algorithm can be determined according to multiple parameter operation ratios and the weight value corresponding to each parameter operation ratio in the following manner: the products of multiple parameter operation ratios and their corresponding weight values can be determined respectively, and the multiple products are added together to determine the score value corresponding to the differential algorithm.
[0279] For example, multiple parameter operation ratios include time operation ratios , memory operation ratio , Flash operation ratio , CPU operation ratio The weight value of the time operation ratio is , the weight of the memory operation ratio is , the weight of the flash operation ratio is , the weight value of CPU operation ratio is .
[0280] First judge , , and Is it less than or equal to the preset value 1. If not, the score corresponding to the differential algorithm is determined to be 0; if so, the score S corresponding to the differential algorithm is determined by the following formula:
[0281]
[0282] S703: Determine the differential algorithm corresponding to the highest score value among the multiple score values as the target algorithm.
[0283] The target algorithm may be the most efficient algorithm for generating a certain differential file.
[0284] The differential algorithm corresponding to the score value of 0 may be removed to determine at least one differential algorithm to be selected, and among the at least one differential algorithm to be selected, the differential algorithm to be selected with the highest score value may be determined as the target algorithm.
[0285] For example, if there are m algorithms, the corresponding scoring values of the m algorithms can be determined respectively: .
[0286] The target algorithm S' can be:
[0287]
[0288] Here, MAX can be a maximum value function.
[0289] S704: Perform differential processing on the current resource file and the updated resource file according to the target algorithm to obtain a differential file.
[0290] The differential processing may be differential processing performed by a target algorithm.
[0291] A target algorithm may be used to calculate differential data based on the current resource file and the updated resource file, and a differential file may be generated based on the differential data.
[0292] The implementation content of each step in the embodiment of the present application can refer to the description of the corresponding steps or operations in the above method embodiment, and repeated content will not be repeated.
[0293] The differential upgrade method provided in this embodiment determines multiple parameter operation ratios corresponding to each differential algorithm in multiple differential algorithms according to the current resource file and the updated resource file, determines the score values corresponding to the multiple differential algorithms according to the multiple parameter operation ratios, determines the differential algorithm corresponding to the highest score value among the multiple score values as the target algorithm, and performs differential processing on the current resource file and the updated resource file according to the target algorithm to obtain a differential file. In this way, the server can determine the best algorithm from the multiple differential algorithms according to the current resource file and the updated resource file, and perform differential upgrade according to the best algorithm to improve the firmware upgrade efficiency of the device.
[0294] In a possible implementation, the multiple loading files may include registration information, licensing information, and upgrade codes.
[0295] Figure 8 This is a schematic diagram of the structure of a differential upgrade device provided in an embodiment of the present application. Figure 8 The device 800 includes an acquisition module 801, a first determination module 802, a second determination module 803 and an upgrade module 804, wherein:
[0296] An acquisition module 801 is used to acquire multiple loading files in a differential upgrade package, where the differential upgrade package is used to upgrade the target firmware, and the multiple loading files include registration information, permission information, and upgrade code;
[0297] A first determining module 802 is used to determine a current firmware package of the target firmware, wherein the current firmware package includes a plurality of current resource files;
[0298] The second determination module 803 is used to run the upgrade code to perform a first verification process on the license information; after the first verification process of the license information passes, the multiple current resource files and the multiple differential files in the differential upgrade package are processed respectively according to the registration information to determine the update firmware package;
[0299] The upgrade module 804 is used to upgrade the target firmware according to the update firmware package.
[0300] In a possible implementation manner, the upgrade code includes multiple differential algorithms, and the second determination module 803 is specifically used to:
[0301] Determine, according to the registration information, an i-th differential file, an i-th current resource file corresponding to the i-th differential file, and a target algorithm corresponding to the i-th differential file, wherein the target algorithm is any one of the multiple differential algorithms;
[0302] According to the registration information, performing a second verification process on the i-th difference file;
[0303] After the second verification process of the i-th differential file passes, determining the i-th updated resource file according to the i-th differential file, the i-th current resource file and the target algorithm;
[0304] The update firmware package includes the multiple i-th update resource files, where i is 1, 2, ..., N in sequence, and N is the number corresponding to the multiple differential files.
[0305] In a possible implementation manner, the second determining module 803 is specifically configured to:
[0306] Inputting the i-th differential file and the i-th current resource file into the algorithm corresponding to the i-th differential file to obtain the i-th selected resource file;
[0307] Performing a third verification process on the i-th selected resource file;
[0308] After the third verification process of the i-th candidate resource file passes, the i-th current resource file is deleted, and the i-th candidate resource file is determined as the i-th updated resource file.
[0309] In a possible implementation manner, the permission information is used to record the minimum operating spaces respectively corresponding to the multiple differential files, and the second determining module 803 is specifically used to:
[0310] Obtain the remaining storage space of the device where the target firmware is located;
[0311] Determine whether the minimum operating spaces respectively corresponding to the plurality of differential files are smaller than the remaining storage space;
[0312] If so, determining that the first verification process of the license information passes;
[0313] If not, it is determined that the first verification process of the permission information has failed.
[0314] In a possible implementation, the method further includes a verification module 805, and the verification module 805 is specifically used to:
[0315] Respectively obtain the first signature information of the registration information, the second signature information of the license information, and the third signature information corresponding to the upgrade code;
[0316] Performing security verification on the first signature information, the second signature information, and the third signature information respectively;
[0317] Determine that the security verification of the first signature information, the second signature information, and the third signature information passes.
[0318] Fig. 9 This is a schematic diagram of the structure of another differential upgrade device provided in an embodiment of the present application. Fig. 9 The device 900 includes an acquisition module 901, a first determination module 902, a second determination module 903, a third determination module 904, a fourth determination module 905 and a generation module 906, wherein:
[0319] The acquisition module 901 is used to acquire a current firmware package and an updated firmware package, wherein the updated firmware package is a firmware package after the initial firmware package is upgraded, the current firmware includes a plurality of current resource files, and the updated firmware package includes a plurality of updated resource files;
[0320] A first determining module 902 is configured to perform differential processing on the multiple current resource files and the multiple updated resource files by using a differential algorithm to obtain multiple differential files;
[0321] A second determination module 903, configured to generate registration information according to the plurality of differential files and a differential algorithm used by each differential file;
[0322] A third determining module 904, configured to generate license information according to the plurality of differential files;
[0323] The fourth determination module 905 is used to generate an upgrade code according to the difference algorithm used by each difference file;
[0324] The generating module 906 is used to generate a differential upgrade package according to the multiple loading files and the multiple differential files.
[0325] In a possible implementation manner, the current resource files correspond to the updated resource files one by one, and for any current resource file, the first determining module 902 is specifically configured to:
[0326] According to the current resource file and the updated resource file, determining a plurality of parameter operation ratios corresponding to each differential algorithm among a plurality of differential algorithms;
[0327] Determining score values corresponding to the plurality of differential algorithms respectively according to the plurality of parameter operation ratios;
[0328] Determine the differential algorithm corresponding to the highest score value among the multiple score values as the target algorithm;
[0329] According to the target algorithm, the current resource file and the updated resource file are differentially processed to obtain a differential file.
[0330] In a possible implementation, for any differential algorithm, the first determination module 902 is specifically configured to:
[0331] Determining whether the operating ratios of the multiple parameters are less than or equal to preset values;
[0332] If yes, determining the score value corresponding to the differential algorithm according to the multiple parameter operation ratios and the weight value corresponding to each parameter operation ratio;
[0333] If not, the score value corresponding to the differential algorithm is determined to be 0.
[0334] In a possible implementation manner, the second determining module 903 is specifically configured to:
[0335] Obtain multiple field headers corresponding to the registration information;
[0336] Determine the field information corresponding to each field header according to the plurality of differential files and the differential algorithm used by each differential file;
[0337] Registration information is generated according to the multiple field headers and the field information corresponding to each field header.
[0338] In a possible implementation manner, the second determining module 903 is specifically configured to:
[0339] Determine the minimum operating space corresponding to each differential file in turn;
[0340] The permission information is generated according to the plurality of differential files and the minimum execution space corresponding to each differential file.
[0341] Fig.10This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig.10 , the electronic device 1000 may include: a memory 1001 , a processor 1002 , and a transceiver 1003 .
[0342] The memory 1001 is used to store program instructions;
[0343] The processor 1002 is used to execute the program instructions stored in the memory, so as to enable the electronic device 1000 to execute the above method.
[0344] The transceiver 1003 may include: a transmitter and / or a receiver. The transmitter may also be referred to as a transmitter, a transmitter, a transmission port, a transmission interface, or the like, and the receiver may also be referred to as a receiver, a reception port, a reception interface, or the like. Exemplarily, the memory 1001, the processor 1002, and the transceiver 1003 are interconnected via a bus 1004.
[0345] The embodiment of the present application also provides a computer program product, which can be executed by a processor. When the computer program product is executed, the above method can be implemented.
[0346] The differential upgrade device, electronic device, computer-readable storage medium and computer program product of the embodiments of the present application can execute the technical solutions shown in the above-mentioned differential upgrade method embodiments. Their implementation principles and beneficial effects are similar and will not be repeated here.
[0347] All or part of the steps of the above-mentioned method embodiments can be completed by hardware related to program instructions. The above-mentioned program can be stored in a readable memory. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the above-mentioned memory (storage medium) includes: read-only memory (ROM), random access memory (RAM), flash memory, hard disk, solid state drive, magnetic tape, floppy disk, optical disc and any combination thereof.
[0348] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer-executable instructions. These computer-executable instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device generate instructions for implementing the process in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0349] These computer executable instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0350] These computer executable instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0351] Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A differential upgrade method, characterized in that: include: Acquire multiple loading files in a differential upgrade package, the differential upgrade package is used to upgrade the target firmware, the multiple loading files include registration information, permission information and upgrade code, wherein the registration information is used to record the differential comparison information of each file with the same name in the current firmware package and the updated firmware package, and the permission information is used to record the device object information corresponding to the updated firmware package; the upgrade code includes program code for calling multiple differential restoration algorithms; Determine a current firmware package of the target firmware, wherein the current firmware package includes a plurality of current resource files; Running the upgrade code to perform a first verification process on the license information; After the first verification process of the permission information is passed, the multiple current resource files and the multiple differential files in the differential upgrade package are processed respectively according to the registration information to determine an update firmware package; Performing an upgrade process on the target firmware according to the update firmware package; The upgrade code includes a plurality of differential algorithms, and processes the plurality of current resource files and the plurality of differential files in the differential upgrade package respectively according to the registration information to determine an update firmware package, including: Determine, according to the registration information, an i-th differential file, an i-th current resource file corresponding to the i-th differential file, and a target algorithm corresponding to the i-th differential file, wherein the target algorithm is any one of the multiple differential algorithms; According to the registration information, performing a second verification process on the i-th difference file; After the second verification process of the i-th differential file passes, determining the i-th updated resource file according to the i-th differential file, the i-th current resource file and the target algorithm; The update firmware package includes a plurality of the i-th update resource files, where i is 1, 2, ..., N in sequence, and N is the number corresponding to the plurality of differential files.
2. The method according to claim 1, characterized in that Determining an i-th updated resource file according to the i-th differential file, the i-th current resource file and the target algorithm includes: Inputting the i-th differential file and the i-th current resource file into the algorithm corresponding to the i-th differential file to obtain the i-th selected resource file; Performing a third verification process on the i-th selected resource file; After the third verification process of the i-th candidate resource file passes, the i-th current resource file is deleted, and the i-th candidate resource file is determined as the i-th updated resource file.
3. The method according to claim 1 or 2, characterized in that: The permission information is used to record the minimum operating spaces respectively corresponding to the plurality of differential files, and a first verification process is performed on the permission information, including: Obtain the remaining storage space of the device where the target firmware is located; Determine whether the minimum operating spaces respectively corresponding to the plurality of differential files are smaller than the remaining storage space; If so, determining that the first verification process of the license information passes; If not, it is determined that the first verification process of the permission information has failed.
4. The method according to claim 1 or 2, characterized in that: After obtaining multiple loading files in the differential upgrade package, it also includes: Respectively obtain the first signature information of the registration information, the second signature information of the license information, and the third signature information corresponding to the upgrade code; Performing security verification on the first signature information, the second signature information, and the third signature information respectively; Determine that the security verification of the first signature information, the second signature information, and the third signature information passes.
5. A differential upgrade method, characterized in that: include: Obtaining a current firmware package and an updated firmware package, wherein the updated firmware package is a firmware package after the initial firmware package is upgraded, the current firmware package includes a plurality of current resource files, and the updated firmware package includes a plurality of updated resource files; Performing differential processing on the multiple current resource files and the multiple updated resource files by using a differential algorithm to obtain multiple differential files; Generate registration information according to the plurality of differential files and the differential algorithm used by each differential file, wherein the registration information is used to record differential comparison information of each file with the same name in the current firmware package and the updated firmware package; Generate permission information according to the plurality of differential files, the permission information being used to record device object information corresponding to the updated firmware package, the device object information including at least one of first identification information of the current firmware package and a minimum operating space corresponding to each differential file; Generate an upgrade code according to the differential algorithm used by each differential file, wherein the upgrade code includes a program code for calling a plurality of differential restoration algorithms; Generate a differential upgrade package according to the plurality of differential files, the registration information, the license information and the upgrade code; The step of generating the upgrade code according to the differential algorithm used by each differential file includes: Determining at least one differential algorithm corresponding to the plurality of differential files; Determine, according to the at least one differential algorithm, an algorithm interface corresponding to each of the at least one differential algorithm; The upgrade code is generated according to at least one of the algorithm interfaces.
6. The method according to claim 5, characterized in that The current resource file corresponds to the updated resource file. For any one of the current resource files, the current resource file and the updated resource file are subjected to differential processing by a differential algorithm to obtain a differential file, including: According to the current resource file and the updated resource file, determining a plurality of parameter operation ratios corresponding to each differential algorithm among a plurality of differential algorithms; Determining score values corresponding to the plurality of differential algorithms respectively according to the plurality of parameter operation ratios; Determine the differential algorithm corresponding to the highest score value among the multiple score values as the target algorithm; According to the target algorithm, the current resource file and the updated resource file are differentially processed to obtain a differential file.
7. The method according to claim 6, characterized in that For any differential algorithm, determining a score value corresponding to the differential algorithm according to the running ratio of the multiple parameters includes: Determining whether the operating ratios of the multiple parameters are less than or equal to preset values; If yes, determining the score value corresponding to the differential algorithm according to the multiple parameter operation ratios and the weight value corresponding to each parameter operation ratio; If not, the score value corresponding to the differential algorithm is determined to be 0.
8. A differential upgrade device, characterized in that: The device comprises: an acquisition module, used to acquire multiple loading files in a differential upgrade package, the differential upgrade package is used to upgrade the target firmware, the multiple loading files include registration information, permission information and upgrade code, the upgrade code includes program code for calling multiple differential restoration algorithms, wherein the registration information is used to record the differential comparison information of each file with the same name in the current firmware package and the update firmware package, and the permission information is used to record the device object information corresponding to the update firmware package; A first determining module, configured to determine a current firmware package of the target firmware, wherein the current firmware package includes a plurality of current resource files; a second determination module, configured to run the upgrade code to perform a first verification process on the license information, and after the first verification process on the license information passes, respectively process the multiple current resource files and the multiple differential files in the differential upgrade package according to the registration information to determine an update firmware package; An upgrade module, used for upgrading the target firmware according to the update firmware package; The upgrade code includes multiple differential algorithms, and the second determination module is specifically used to determine the i-th differential file, the i-th current resource file corresponding to the i-th differential file, and the target algorithm corresponding to the i-th differential file according to the registration information, and the target algorithm is any one of the multiple differential algorithms; according to the registration information, a second verification process is performed on the i-th differential file; after the second verification process of the i-th differential file passes, the i-th update resource file is determined according to the i-th differential file, the i-th current resource file and the target algorithm; wherein the update firmware package includes multiple i-th update resource files, and i is 1, 2, ..., N in sequence, and N is the number corresponding to the multiple differential files.
9. A differential upgrade device, characterized in that: The device comprises: An acquisition module, used to acquire a current firmware package and an updated firmware package, wherein the updated firmware package is a firmware package after the initial firmware package is upgraded, the current firmware includes a plurality of current resource files, and the updated firmware package includes a plurality of updated resource files; A first determining module, configured to perform differential processing on the multiple current resource files and the multiple updated resource files by using a differential algorithm to obtain multiple differential files; A second determination module, configured to generate registration information according to the plurality of differential files and a differential algorithm used by each differential file, wherein the registration information is used to record differential comparison information of each file with the same name in the current firmware package and the updated firmware package; a third determination module, configured to generate permission information according to the plurality of differential files, wherein the permission information is used to record device object information corresponding to the updated firmware package, wherein the device object information includes at least one of first identification information of the current firmware package and a minimum operating space corresponding to each differential file; A fourth determination module, for generating an upgrade code according to the differential algorithm used by each differential file, wherein the upgrade code includes a program code for calling a plurality of differential restoration algorithms; A generating module, configured to generate a differential upgrade package according to the plurality of differential files, the registration information, the license information and the upgrade code; The fourth determination module is specifically used to determine at least one differential algorithm corresponding to multiple differential files; determine the algorithm interface corresponding to the at least one differential algorithm according to the at least one differential algorithm; and generate the upgrade code according to the at least one algorithm interface.
10. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 4 or any one of claims 5 to 7.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 4 or any one of claims 5 to 7 when executed by a processor.
12. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 4 or any one of claims 5 to 7.
Citation Information
Patent Citations
Firmware upgrading method and device and computer equipment
CN111857790A
Memory self-adaptive differential upgrading method
CN114416154A
Embedded device firmware updating method, embedded device and development end device
CN114780127A
Vehicle-mounted program upgrading method, device, equipment and medium
CN115309422A
Block differential upgrade package generation method and device and block differential upgrade method and device
CN115718614A
