Method, device and equipment for generating upgrade file and storage medium

By overlaying interference codes and check codes into the upgrade files of embedded terminals, key information is hidden, solving the problem of upgrade files being easily tampered with and achieving the security and stability of upgrade files.

CN114417402BActive Publication Date: 2025-12-19TECHTOTOP MICROELECTRONICS
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111643797.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-29
Publication Date
2025-12-19
Estimated Expiration
2041-12-29

AI Technical Summary

Technical Problem

In existing technologies, the upgrade process of embedded terminals is easily tampered with, which can lead to system failure or paralysis, and the security of upgrade files cannot be guaranteed.

Method used

By overlaying interference codes and calculating checksums into the original upgrade package data, key information is hidden in a specific address area, generating an upgrade file that is difficult to tamper with.

Benefits of technology

It effectively prevents upgrade files from being illegally tampered with, ensuring the security and stability of terminal upgrades and avoiding system failures and malfunctions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114417402B_ABST
    Figure CN114417402B_ABST
Patent Text Reader

Abstract

Embodiments of the present application are suitable for the terminal technical field, and provide a generation method and device of an upgrade file, equipment and a storage medium, the method comprises: obtaining original upgrade package data of a terminal to be upgraded, the original upgrade package data comprising file version information; superimposing an interference code in the file version information to obtain interference version information; calculating a first check code by using the original upgrade package data and the interference version information; determining a reserved character and calculating a second check code based on the reserved character; and writing the interference version information, the reserved character, the first check code and the second check code into a reserved address region of the original upgrade package data respectively to obtain an upgrade file used for upgrading the terminal to be upgraded. By using the above method, the upgrade file used by the terminal in the upgrading process can be prevented from being illegally tampered with, and the security of the upgrade file is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The embodiment of the present application belongs to the technical field of terminals, and particularly relates to a generation method and device of an upgrade file, equipment and a storage medium. BACKGROUND

[0002] An embedded system is a special-purpose computer system that is application-centered and computer technology-based, and can flexibly tailor software and hardware modules according to user requirements (function, reliability, cost, size, power consumption, environment, etc.). A terminal using an embedded system can be referred to as an embedded terminal.

[0003] In order to meet the changing needs of customers and prolong the life cycle of products, it is necessary to continuously improve the functions of embedded terminals, and the upgrade of embedded terminals is particularly important.

[0004] At present, the upgrade of embedded terminals is usually performed on a common upgrade platform to upgrade the entire terminal system. In the actual upgrade process, the common upgrade platform may face the risk of tampering with the upgrade package by human beings. This may cause problems in the upgrade process, cause system failure, and even cause system paralysis to cause the entire embedded terminal product to fail. SUMMARY

[0005] Therefore, the embodiment of the present application provides a generation method and device of an upgrade file, equipment and a storage medium, which can prevent the upgrade file used by the terminal in the upgrade process from being illegally tampered with, and ensure the security of the upgrade file.

[0006] The first aspect of the embodiment of the present application provides a generation method of an upgrade file, comprising:

[0007] Obtaining original upgrade package data of a terminal to be upgraded, wherein the original upgrade package data comprises file version information;

[0008] Superimposing an interference code in the file version information to obtain interference version information;

[0009] Calculating a first check code by using the original upgrade package data and the interference version information;

[0010] Determining a reserved character and calculating a second check code based on the reserved character;

[0011] Writing the interference version information, the reserved character, the first check code and the second check code into a reserved address region of the original upgrade package data respectively to obtain an upgrade file used for upgrading the terminal to be upgraded.

[0012] The second aspect of the embodiment of the present application provides a generation device of an upgrade file, comprising:

[0013] An original upgrade package data obtaining module is configured to obtain original upgrade package data of a terminal to be upgraded, wherein the original upgrade package data comprises file version information.

[0014] An interference version information generating module is configured to superimpose an interference code in the file version information to obtain interference version information.

[0015] A first check code calculating module is configured to calculate a first check code by using the original upgrade package data and the interference version information.

[0016] A second check code calculating module is configured to determine a reserved character and calculate a second check code based on the reserved character.

[0017] An upgrade file generating module is configured to write the interference version information, the reserved character, the first check code and the second check code into a reserved address region of the original upgrade package data respectively to obtain an upgrade file used for upgrading the terminal to be upgraded.

[0018] A third aspect of the embodiments of the present application provides an upgrade file generating device, which comprises a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor implements the upgrade file generating method of the first aspect when executing the computer program.

[0019] A fourth aspect of the embodiments of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executable on a processor to implement the upgrade file generating method of the first aspect.

[0020] A fifth aspect of the embodiments of the present application provides a computer program product, which, when running on a computer, enables the computer to execute the upgrade file generating method of the first aspect.

[0021] Compared with the prior art, the embodiments of the present application have the following advantages:

[0022] When the original upgrade package data of the terminal to be upgraded is acquired, the file version information contained in the original upgrade package data is superimposed with an interference code to obtain interference version information, and the original upgrade package data and the interference version information are used to calculate a first check code; on this basis, a second check code is calculated based on the reserved character; then, the interference version information, the reserved character, the first check code and the second check code are written into the reserved address region of the original upgrade package data, so that an upgrade file used for upgrading the terminal to be upgraded is obtained. The key check information and version information of the upgrade file are hidden in the specific address region of the original upgrade package by processing the upgrade information, so that the upgrade information can be prevented from being identified by malicious software; meanwhile, the upgrade information can also be prevented from being tracked and tampered by human beings by superimposing the interference code on the upgrade information, so that the upgrade security of the terminal is further ensured. BRIEF DESCRIPTION OF DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative effort on the basis of these drawings.

[0024] Figure 1 is a schematic diagram of upgrade information stored in a file header in the prior art;

[0025] Figure 2 is a schematic diagram of a generation method of an upgrade file provided by the embodiments of the present application;

[0026] Figure 3 is a schematic diagram of another generation method of an upgrade file provided by the embodiments of the present application;

[0027] Figure 4 is a schematic diagram of a generation process of an upgrade file provided by the embodiments of the present application;

[0028] Figure 5 is a schematic diagram of upgrade information stored in a file header provided by the embodiments of the present application;

[0029] Figure 6 is a schematic diagram of a terminal upgrade process provided by the embodiments of the present application;

[0030] Figure 7 is a schematic diagram of a generation device of an upgrade file provided by the embodiments of the present application;

[0031] Figure 8is a schematic diagram of a generation device of an upgrade file provided by an embodiment of the present application. DETAILED DESCRIPTION

[0032] In the following description, for the purpose of explanation and not limitation, specific details are set forth, such as particular system configurations, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.

[0033] Various terminals such as embedded terminals need to verify upgrade files when upgrading, to confirm whether the received upgrade file is a legal file and is suitable for this upgrade. Generally, the upgrade information is stored in the file header of the upgrade file, and the verification of the upgrade file by the terminal is mainly achieved by comparing the upgrade information. If it is confirmed that the upgrade condition is met, the terminal removes the upgrade information in the file header to obtain the original upgrade package data, and uses the original upgrade package data to perform firmware upgrade.

[0034] Generally, the file header of the upgrade file is an interrupt vector table, and the corresponding upgrade information can be obtained through the interrupt vector table. For example, as shown in Figure 1 is a schematic diagram of upgrade information stored in a file header in the prior art. Figure 1 The area 101 in the file header is the original data of the upgrade file, and the remaining part is additional information. For example, Figure 1 The model, version, time, and other information recorded in the area 102 are obvious; in addition, the information in the area 103 is verification information. After the above information is mastered, the upgrade file is easily tampered with illegally. Moreover, the illegally tampered upgrade file can easily bypass the defense mechanism of the terminal by modifying the verification information. In this way, the terminal uses the illegally tampered upgrade file to upgrade, which is likely to cause the upgraded terminal to malfunction; seriously, it can also cause the terminal to crash or product failure.

[0035] To solve the above problems, the embodiments of the present application provide a generation method, device, and equipment of an upgrade file and a storage medium, which can hide the key verification information and version information of the upgrade file in a specific address area in the original upgrade package by processing the upgrade information, to prevent the upgrade information from being maliciously tampered with; at the same time, the embodiments of the present application can also prevent the upgrade information from being tracked and analyzed and tampered with by humans by superimposing an interference code on the upgrade information, to ensure the upgrade safety of the terminal.

[0036] The technical solutions of the present application are described below through specific embodiments.

[0037] Referring toFigure 2 FIG. 1 shows a schematic diagram of a method for generating an upgrade file according to an embodiment of the present application. The method can include the following steps:

[0038] S201, obtaining original upgrade package data of a terminal to be upgraded, the original upgrade package data including file version information.

[0039] It should be noted that the method can be applied to a device having a function of generating an upgrade file. The device can obtain an upgrade file for upgrading a terminal by compiling a program file and processing upgrade information. For example, the device can be a file compiling device, such as a compiler.

[0040] In the embodiment of the present application, the terminal to be upgraded can include any type of terminal device. For example, the terminal to be upgraded can be an embedded terminal or a non-embedded terminal. The type of the terminal to be upgraded is not limited in the embodiment of the present application.

[0041] The original upgrade package data in the embodiment of the present application can be upgrade package data obtained by compiling a program file. The original upgrade package data stores various upgrade information of the upgrade file, such as file version information, terminal model information, and check information.

[0042] It should be noted that, compared with the upgrade package data in the prior art, the original upgrade package data in the embodiment of the present application further includes a reserved address region. The reserved address region can be a region left empty in advance in the process of generating an upgrade package by a compiler through a special compiling instruction. The program file itself does not use the reserved address region, but leaves it for writing upgrade information when the upgrade file is made. The length of the reserved address region can be determined according to actual needs. For example, the length of the reserved address region can be 16 bytes, 32 bytes, or other lengths.

[0043] S202, superimposing an interference code on the file version information to obtain interference version information.

[0044] In the embodiment of the present application, the processing of the upgrade information can be first implemented by interfering with the file version information.

[0045] Generally, the file version information is an important attribute information of the upgrade file, which can be used to identify the version number of the upgrade file, distinguish the release time of the upgrade file, and the like. In particular, on a public upgrade platform, there can be several versions of upgrade packages for the same type of terminal. If the file version information is not interfered with, a malicious program or an individual can easily lock the position of the file version information in the upgrade file by searching for the version number of each upgrade package and tracking and analyzing the same, and then infer the storage position of the check information of the upgrade file.

[0046] In the embodiment of the present application, the interference to the file version information can be implemented by superimposing the interference code on the file version information. For example, the interference code can be inserted between each byte of the file version information, or each byte can be directly superimposed with the interference code, which is not limited in the embodiment of the present application.

[0047] In a possible implementation of the embodiment of the present application, when the interference code is superimposed on the file version information to obtain the interference version information, the multiple bytes included in the file version information can be determined first.

[0048] Generally, the file version information can include multiple bytes. For example, the file version information can be 4 bytes, 6 bytes, etc.

[0049] Then, the preset interference code can be superimposed on each byte of the file version information respectively to obtain the interference version information. The interference version information is the version information that is not easy to be identified after the original file version information is interfered.

[0050] For example, if the file version information is 01, and the preset interference code is 0x33, the interference version information obtained after superimposing the interference code can be 34.

[0051] The embodiment of the present application can effectively prevent malicious programs or personal tracking analysis by interfering with the file version information, greatly increasing the difficulty of malicious programs or individuals cracking the upgrade file.

[0052] S203, calculating a first check code by using the original upgrade package data and the interference version information.

[0053] In the embodiment of the present application, the first check code can be the check information used in subsequent upgrade of the terminal by using the upgrade file. The first check code can be calculated based on the original upgrade package data and the interference version information. Specifically, the first check code can be calculated by using all the upgrade package data and the interference version information, or the first check code can be calculated by using part of the upgrade package data and the interference version information, which is not limited in the embodiment of the present application.

[0054] In an example of the embodiment of the present application, if the first check code is calculated by using part of the upgrade package data and the interference version information, the calculation can be based on part of the data before the reserved address region in the upgrade package data and the interference version information.

[0055] Therefore, in the specific implementation, the first half of the data before the reserved address region in the original upgrade package data can be read first, and the first check data can be obtained by merging the first half of the data and the interference version information; and then the first check code can be calculated by using the first check data.

[0056] It should be noted that any type of check algorithm can be used to calculate the first check code when the first check data is used to calculate the first check code. For example, cyclic redundancy check (Cyclic Redundancy Check, CRC). The first check code calculated by using the CRC check algorithm can be a CRC16 cyclic redundancy check code in hexadecimal.

[0057] S204, determining a reserved character, and calculating a second check code based on the reserved character.

[0058] In the embodiment of the present application, the reserved address region also includes a reserved field reserved for expanding other upgrade information. The compiler will compile the reserved field as character 0 when generating the original upgrade package data. In this way, due to the existence of a long segment of continuous character 0, malicious programs or individuals can crack the upgrade file based on the field. Therefore, the reserved field needs to be processed.

[0059] In a specific implementation, the field length of the reserved field can be determined, and then a random code equal to the field length is generated as the reserved character according to the field length. For example, a random number generator can be called to generate a segment of random numbers equal to the length of the reserved field, and these random numbers can be written into the above-mentioned reserved field when generating the upgrade file.

[0060] In the embodiment of the present application, the original upgrade package data and the reserved character can be used to calculate the second check code. Similar to the calculation of the first check code, the second check code can be a check code calculated using all of the upgrade package data and the reserved character, or a check code calculated using part of the upgrade package data and the reserved character, which is not limited in the embodiment of the present application.

[0061] In an example of the embodiment of the present application, if the second check code is calculated using part of the upgrade package data and the reserved character, the calculation can be based on part of the data after the reserved address region in the upgrade package data and the reserved character.

[0062] Therefore, in a specific implementation, the second half of the data after the reserved address region in the original upgrade package data can be read, and the above-mentioned reserved character and the second half of the data can be combined to obtain second check data; then, the second check code can be calculated by using the second check data. The second check code can also be a CRC16 check code in hexadecimal.

[0063] S205, respectively writing the interference version information, the reserved character, the first check code and the second check code into the reserved address region of the original upgrade package data to obtain an upgrade file used for upgrading the terminal to be upgraded.

[0064] After the interference to the file version information is completed, the reserved character is determined, and the first check code and the second check code are calculated, the above information can be written into the reserved address region of the original upgrade package data to obtain an upgrade file which is difficult to be illegally cracked or tampered. The above upgrade file can be used by the terminal to be upgraded to complete the firmware upgrade.

[0065] Referring to Figure 3 , a schematic diagram of another method for generating an upgrade file is shown, which can specifically include the following steps:

[0066] S301, determining a reserved address region, the reserved address region including a plurality of data sub-regions, each data sub-region having a corresponding data label, and the reserved address region being used for writing processed upgrade information.

[0067] In the embodiment of the present application, the reserved address region can be a region determined in advance when compiling the program file. The reserved address region can include a plurality of data sub-regions, each data sub-region having a corresponding data label. Based on different data labels, each data sub-region can be used to store different upgrade information. For example, the data sub-region having the data label of version information can be used to store the interfered file version information, i.e. the interference version information; and the data sub-region having the data label of the first check code can be used to store the first check code.

[0068] S302, when compiling the program file of the terminal to be upgraded into original upgrade package data, compiling the reserved address region into a blank region.

[0069] In the embodiment of the present application, a compiling instruction can be used to pre-empty a region at a specified address in the process of generating the file package, which is used to write the upgrade information of the upgrade file.

[0070] As an example of the embodiment of the present application, the following compiling instruction can be used to make the compiler pre-empty a region of 16 bytes in length at a specified address of the generated file package:

[0071] #if defined(__GNUC__) / *GNU GCC Compiler* /

[0072] const u8 sys_upCheck

[16] __attribute__((section(".ARM.__at_0x080027F0")));

[0073] #else

[0074] const u8 sys_upCheck

[16] __attribute__((at (INTFLASH_BASE_ADR + BOOTLOADER_SIZE + 2032)));

[0075] #endif

[0076] As shown in Table 1, is an example of a reserved address region generated based on the above-mentioned compiling instruction provided by the embodiment of the present application, the reserved address region in the example includes four data sub-regions, each data sub-region has a certain length, and is respectively used for storing interference version information, a first check code, a second check code and a reserved character.

[0077] Table 1, reserved address region example

[0078] Address 00~03 04~05 06~07 08~15 Length 4 bytes 2 bytes 2 bytes 8 bytes Data tag Version information First check code Second check code Reserved character

[0079] Of course, the example in Table 1 is only an example of a 16-byte length reserved address region, in actual application, other length address regions can be reserved according to specific needs, and the length of different data sub-regions can also be determined according to their needs, and the length of the reserved address region and each data sub-region is not limited by the embodiment of the present application.

[0080] It should be noted that the program itself does not use the reserved address region, and only uses the reserved address region for writing interference version information and check information when making an upgrade file. In this way, when rewriting this region, it will not cause any impact on the function of the program itself.

[0081] S303, obtaining the original upgrade package data, the original upgrade package data including file version information.

[0082] S304, superimposing interference code in the file version information to obtain interference version information.

[0083] S305, calculating a first check code using the original upgrade package data and the interference version information.

[0084] S306, determining a reserved character and calculating a second check code based on the reserved character.

[0085] It should be noted that S303-S306 in the embodiment are similar to S201-S204 in the previous embodiment, and can be mutually referred, and the embodiment will not be repeated here.

[0086] S307, according to the data tag, respectively writing the interference version information, the reserved character, the first check code and the second check code into the corresponding data sub-region.

[0087] The data tags in Table 1 can be used to represent the specific function of the data sub-region, i.e., the type of information to be written. Therefore, in this embodiment, the interference version information, reserved characters, first checksum, and second checksum can be written into the corresponding data sub-region according to the data tags in Table 1. That is: the interference version information is written into the data sub-regions with addresses 00-03 in Table 1, the first checksum is written into the data sub-regions with addresses 04-05 in Table 1, the second checksum is written into the data sub-regions with addresses 06-07 in Table 1, and the reserved characters are written into the data sub-regions with addresses 08-15 in Table 1.

[0088] S308. The original upgrade package data containing the interference version information, the reserved character, the first verification code, and the second verification code is encapsulated to obtain an upgrade file for upgrading the terminal to be upgraded.

[0089] After completing the aforementioned operations, the original upgrade package data, which contains the aforementioned interfering version information and various verification information, can be used to obtain the final releasable upgrade file. For example, this upgrade file can be transmitted to a public upgrade platform for upgrading corresponding embedded terminals.

[0090] It should be noted that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0091] To facilitate understanding, the method for generating upgrade files provided in this application embodiment will be introduced below with reference to a specific example.

[0092] like Figure 4 The diagram shown is a schematic representation of an upgrade file generation process provided in an embodiment of this application. According to... Figure 4 The process shown involves first obtaining the original upgrade package data of the terminal to be upgraded when generating the upgrade file. Based on this original upgrade package data, the file version information of the upgrade file can be determined. To increase the difficulty of cracking or tampering with the upgrade file, interference codes can be superimposed on the file version information to obtain interference version information. Based on this, the checksum of the first half of the upgrade file, i.e., the first checksum, can be calculated. The first checksum can be calculated by merging the data in the original upgrade package data before the reserved address area with the aforementioned interference version information. Then, according to... Figure 4The flowchart shows that a random number can be randomly generated as the reserved character. On this basis, the check code of the second half of the upgrade file, i.e., the second check code, can be calculated. The first check code can be calculated after the reserved character and the data in the original upgrade package data after the reserved address region are merged. In this way, after the above processing is completed, the interference version information, the first check code, the second check code and the reserved character obtained can be written into the reserved address region as shown in Table 1. Then, by encapsulating the original upgrade package data in which the above information is written, the final publishable upgrade file can be obtained.

[0093] As Figure 5 shown, it is a schematic diagram of the upgrade information stored in the file header provided by an embodiment of the present application. Figure 5 That is, it is an example after the upgrade information is processed and hidden using the method provided by the embodiment of the present application. As Figure 5 known from the above, although various types of information required for upgrading are contained in the file header, it is very difficult for malicious programs or individuals to crack the upgrade file without knowing the specific storage address of the upgrade information, because there is no obvious feature for analysis and identification. Moreover, since the file version information is superimposed with the interference code, it can effectively prevent malicious programs or individuals from identifying the location of the upgrade information by tracking and analyzing the version, greatly increasing the difficulty of cracking the upgrade file.

[0094] As Figure 6 shown, it is a schematic diagram of a terminal upgrade flow provided by an embodiment of the present application, i.e. Figure 6 the specific flow of upgrading the terminal using the upgrade file generated by the method provided by the embodiment of the present application is shown.

[0095] According to Figure 6The upgrade procedure shown. After receiving the upgrade file, the terminal to be upgraded can first judge the data integrity of the upgrade file. If the upgrade file is not received, it can continue to be received; if the upgrade file has been received, it can start to execute the upgrade process. First, the terminal to be upgraded can extract the upgrade information from a specific address, that is, the address reserved in the upgrade package for writing upgrade information when generating the upgrade file. The upgrade information extracted by the terminal to be upgraded can include the interference version information, the first check code, the second check code and other information in Table 1. For the extracted upgrade information, the terminal to be upgraded can first check the first check code. If the first check code fails, the terminal to be upgraded can terminate the current upgrade procedure; if the first check code passes, the terminal to be upgraded can remove the interference code superimposed in the interference version information, and restore the interference version information to the original file version information. Then, the terminal to be upgraded can determine whether the version is correct according to the file version information, whether to continue to use the upgrade file of the version to execute the upgrade procedure. If the terminal to be upgraded determines to continue to execute the upgrade procedure, the second check code can be checked. Only in the case that the second check code passes, the terminal to be upgraded will use the upgrade file to upgrade the firmware.

[0096] Referring to Figure 7 , a schematic diagram of an upgrade file generation device provided by an embodiment of the present application is shown, which can specifically include an original upgrade package data acquisition module 701, an interference version information generation module 702, a first check code calculation module 703, a second check code calculation module 704, and an upgrade file generation module 705, wherein:

[0097] The original upgrade package data acquisition module 701 is configured to acquire the original upgrade package data of the terminal to be upgraded, wherein the original upgrade package data includes file version information.

[0098] The interference version information generation module 702 is configured to superimpose an interference code in the file version information to obtain interference version information.

[0099] The first check code calculation module 703 is configured to calculate a first check code by using the original upgrade package data and the interference version information.

[0100] The second check code calculation module 704 is configured to determine a reserved character and calculate a second check code based on the reserved character.

[0101] The upgrade file generation module 705 is configured to write the interference version information, the reserved character, the first check code and the second check code into a reserved address region of the original upgrade package data, respectively, to obtain an upgrade file for upgrading the terminal to be upgraded.

[0102] In the embodiment of the present application, the interference version information generation module 702 can be specifically configured to: determine the number of bytes included in the file version information; and superimpose a preset interference code in each byte of the file version information respectively to obtain the interference version information.

[0103] In the embodiment of the present application, the first check code calculation module 703 can be specifically configured to: read the first half of the data in the original upgrade package data before the reserved address region; merge the first half of the data and the interference version information to obtain first check data; and calculate the first check code by using the first check data.

[0104] In the embodiment of the present application, the second check code calculation module 704 can be specifically configured to: determine the field length of the reserved field; and generate a random code equal to the field length as the reserved character according to the field length.

[0105] In the embodiment of the present application, the second check code calculation module 704 can also be configured to: read the second half of the data in the original upgrade package data after the reserved address region; merge the reserved character and the second half of the data to obtain second check data; and calculate the second check code by using the second check data.

[0106] In the embodiment of the present application, the apparatus can further include a reserved address region determination module and a compiling module, wherein:

[0107] The reserved address region determination module is configured to determine the reserved address region, and the reserved address region is used for writing the processed upgrade information.

[0108] The compiling module is configured to compile the reserved address region as a blank region when compiling the program file of the terminal to be upgraded into the original upgrade package data.

[0109] In the embodiment of the present application, the reserved address region can include a plurality of data sub-regions, each of the data sub-regions can have a corresponding data label; and the upgrade file generation module 705 can be specifically configured to: write the interference version information, the reserved character, the first check code and the second check code into the corresponding data sub-regions according to the data labels respectively; and encapsulate the original upgrade package data in which the interference version information, the reserved character, the first check code and the second check code are written to obtain an upgrade file used for upgrading the terminal to be upgraded.

[0110] For the apparatus embodiment, it is basically similar to the method embodiment, so it is described more simply, and for the related parts, refer to the description in the method embodiment.

[0111] Refer toFigure 8 FIG. 8 shows a schematic diagram of a device for generating an upgrade file according to an embodiment of the present application. As shown in FIG. 8, the device 800 for generating an upgrade file according to an embodiment of the present application includes a processor 810, a memory 820, and a computer program 821 stored in the memory 820 and capable of running on the processor 810. The processor 810 implements the steps in the method for generating an upgrade file according to various embodiments of the present application when running the computer program 821, such as steps S201-S205 shown in FIG. 2. Alternatively, the processor 810 implements the functions of the various modules / units in the various apparatus embodiments of the present application when running the computer program 821, such as the functions of the modules 701-705 shown in FIG. 7. Figure 8 Figure 2 Figure 7

[0112] For example, the computer program 821 can be divided into one or more modules / units, which are stored in the memory 820 and executed by the processor 810 to complete the present application. The one or more modules / units can be a series of computer program instruction segments capable of completing a specific function, which can be used to describe the execution process of the computer program 821 in the device 800. For example, the computer program 821 can be divided into an original upgrade package data acquisition module, an interference version information generation module, a first check code calculation module, a second check code calculation module, and an upgrade file generation module, and the specific functions of the modules are as follows:

[0113] The original upgrade package data acquisition module is configured to acquire original upgrade package data of a terminal to be upgraded, wherein the original upgrade package data includes file version information.

[0114] The interference version information generation module is configured to superimpose an interference code in the file version information to obtain interference version information.

[0115] The first check code calculation module is configured to calculate a first check code by using the original upgrade package data and the interference version information.

[0116] The second check code calculation module is configured to determine a reserved character and calculate a second check code based on the reserved character.

[0117] The upgrade file generation module is configured to write the interference version information, the reserved character, the first check code, and the second check code into a reserved address region of the original upgrade package data, respectively, to obtain an upgrade file for upgrading the terminal to be upgraded.

[0118] ​​​The generating device 800 can be a device for upgrading various terminals in the foregoing embodiments, and can be a desktop computer, a cloud server, or the like. The generating device 800 can include, but is not limited to, a processor 810 and a memory 820. Those skilled in the art can understand that Figure 8 The generating device 800 is only an example and does not limit the generating device 800, and can include more or fewer components than shown, or combine certain components, or different components, for example, the generating device 800 can also include an input / output device, a network access device, a bus, and the like.

[0119] The processor 810 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gates or transistor logic, discrete hardware components, or the like. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0120] The memory 820 can be an internal storage unit of the generating device 800, for example, a hard disk or a memory of the generating device 800. The memory 820 can also be an external storage device of the generating device 800, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, or the like. Further, the memory 820 can include both the internal storage unit and the external storage device of the generating device 800. The memory 820 is used to store the computer program 821 and other programs and data required by the generating device 800. The memory 820 can also be used to temporarily store data that has been output or will be output.

[0121] The embodiments of the present application also disclose a generating device for upgrading a file, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the method for generating an upgrading file according to the foregoing embodiments when executing the computer program.

[0122] The embodiment of the present application further discloses a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize the generation method of the upgrade file according to the foregoing embodiments.

[0123] The embodiment of the present application further discloses a computer program product, which, when running on a computer, enables the computer to execute the generation method of the upgrade file according to the foregoing embodiments.

[0124] The foregoing embodiments are only used to illustrate the technical solutions of the present application, rather than limit the same. Although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced by equivalent ones, and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. A method of generating an upgrade file, characterized by, The method comprises the following steps: obtaining original upgrade package data of a terminal to be upgraded, wherein the original upgrade package data comprises file version information; superimposing interference codes in the file version information to obtain interference version information; reading first-half data in the original upgrade package data before a reserved address region, merging the first-half data and the interference version information to obtain first check data, and calculating a first check code by using the first check data; determining the length of a reserved field, generating a random code equal to the length of the reserved field as a reserved character according to the length of the reserved field; reading second-half data in the original upgrade package data after the reserved address region, merging the reserved character and the second-half data to obtain second check data, and calculating a second check code by using the second check data; writing the interference version information, the reserved character, the first check code and the second check code into the reserved address region of the original upgrade package data respectively to obtain an upgrade file for upgrading the terminal to be upgraded.

2. The method of claim 1, wherein, The step of superimposing interference codes in the file version information to obtain interference version information comprises the following steps: determining a plurality of bytes included in the file version information; superimposing preset interference codes in each byte of the file version information respectively to obtain the interference version information.

3. The method according to claim 1 or 2, characterized in that, Before obtaining the original upgrade package data of the terminal to be upgraded, the method further comprises the following steps: determining the reserved address region, wherein the reserved address region is used for writing processed upgrade information; compiling the reserved address region as a blank region when compiling a program file of the terminal to be upgraded into the original upgrade package data.

4. The method of claim 3, wherein, The reserved address region comprises a plurality of data sub-regions, and each data sub-region has a corresponding data label; the step of writing the interference version information, the reserved character, the first check code and the second check code into the reserved address region of the original upgrade package data respectively to obtain an upgrade file for upgrading the terminal to be upgraded comprises the following steps: writing the interference version information, the reserved character, the first check code and the second check code into corresponding data sub-regions according to the data labels respectively; packaging the original upgrade package data with the interference version information, the reserved character, the first check code and the second check code written therein to obtain an upgrade file for upgrading the terminal to be upgraded.

5. An upgrade file generation apparatus characterized by comprising: The method comprises the following steps: an original upgrade package data obtaining module is configured to obtain original upgrade package data of a terminal to be upgraded, wherein the original upgrade package data comprises file version information; an interference version information generating module is configured to superimpose interference codes in the file version information to obtain interference version information; a first check code calculating module is configured to read first-half data in the original upgrade package data before a reserved address region, merge the first-half data and the interference version information to obtain first check data, and calculate a first check code by using the first check data; a reserved character generating module is configured to determine the length of a reserved field, generate a random code equal to the length of the reserved field as a reserved character according to the length of the reserved field; The second check code calculation module is configured to determine a field length of the reserved field, generate a random code equal to the field length as a reserved character according to the field length, read a latter half of data in the original upgrade package data after the reserved address region, combine the reserved character and the latter half of data to obtain second check data, and calculate a second check code using the second check data. The upgrade file generation module is configured to write the interference version information, the reserved character, the first check code and the second check code into the reserved address region of the original upgrade package data respectively to obtain an upgrade file used for upgrading the terminal to be upgraded.

6. An upgrade file generation device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor implements the method for generating an upgrade file according to any one of claims 1-4 when executing the computer program.

7. A computer-readable storage medium storing a computer program, wherein the computer program comprises the following steps of: receiving a request for a resource from a client; determining whether the client is authorized to access the resource; and if the client is authorized to access the resource, providing the resource to the client. The computer program implements the method for generating an upgrade file according to any one of claims 1-4 when executed by the processor.

Citation Information

Patent Citations

  • Method for generating universal header data information of upgraded file

    CN103761095A

  • Method for generating upgrade file in system upgrade and / or application upgrade

    CN105487888A