Firmware upgrading method and device, equipment, storage medium and program product
By obtaining the set of tag block information in the encrypted upgrade package, the problem of long waiting time for firmware upgrades is solved, and rapid decryption and upgrade are achieved.
Patent Information
- Application Number
- CN202411438140.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2025-02-11
AI Technical Summary
During the current firmware upgrade process, the upgrade package is huge in size and takes too long to decrypt, resulting in too long waiting time for firmware upgrade.
By obtaining the set of marking block information in the preset location in the pre-built encryption upgrade package, the upgrade firmware in the encryption upgrade package is decrypted based on this information, the decrypted upgrade firmware is obtained, and the firmware upgrade is performed.
You can directly obtain firmware for upgrade without decompressing the upgrade package, which shortens decryption time and reduces firmware upgrade waiting time.
Smart Images

Figure CN119415116A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic information technology, and in particular to a firmware upgrade method, device, equipment, storage medium and program product. Background Art
[0002] In scenarios with high information security requirements, upgraded firmware needs to be encrypted before being released.
[0003] However, the current upgrade firmware is huge, and one upgrade package contains multiple firmwares that need to be upgraded. If these firmwares are packaged using a compression algorithm and the compressed upgrade package is encrypted using a traditional encryption algorithm, it will take too long to decrypt on the embedded device, thereby increasing the waiting time for firmware upgrades.
[0004] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention
[0005] The main purpose of this application is to provide a firmware upgrade method, device, equipment, storage medium and program product, aiming to solve the current technical problem of long waiting time for firmware upgrade.
[0006] To achieve the above object, the present application proposes a firmware upgrade method, the method comprising:
[0007] Obtaining a set of marker block information at a preset position in a pre-built encryption upgrade package;
[0008] Decrypting the upgrade firmware at the corresponding position in the encrypted upgrade package based on the position information and the encryption length in the marker block information set to obtain the decrypted upgrade firmware;
[0009] Firmware upgrade is performed based on the decrypted upgrade firmware.
[0010] In one embodiment, the step of decrypting the upgrade firmware at the corresponding position in the encrypted upgrade package based on the position information and the encryption length in the marker block information set to obtain the decrypted upgrade firmware includes:
[0011] Decrypting the marker block information set to obtain a decrypted marker block information set;
[0012] The step of decrypting the upgrade firmware at the corresponding position in the encrypted upgrade package based on the position information and the encryption length in the marker block information set to obtain the decrypted upgrade firmware comprises:
[0013] The upgrade firmware at the corresponding position in the encrypted upgrade package is decrypted based on the position information and the encryption length in the decrypted mark block information set to obtain the decrypted upgrade firmware.
[0014] In one embodiment, the step of obtaining a set of marker block information at a preset position in a pre-built encrypted upgrade package includes:
[0015] Obtaining the upgrade firmware and the file system where the upgrade firmware is located;
[0016] Compressing the upgrade firmware using a preset compression algorithm to obtain compressed upgrade firmware;
[0017] Encapsulating the compressed upgrade firmware through a file system image to obtain an upgrade image;
[0018] Parsing the file system layout to locate the position of the upgrade firmware in the upgrade image;
[0019] Encrypting the dictionary table in the position to obtain encrypted data;
[0020] Recording the relevant information of the position and the encryption length of the encrypted data as first encryption mark block information;
[0021] Encrypting the first encrypted marker block information to obtain the marker block information set;
[0022] The marking block information set is saved to a preset position in the upgrade image to obtain a new upgrade image;
[0023] The new upgrade image is used as the encrypted upgrade package.
[0024] In one embodiment, before the step of encrypting the first encrypted marker block information to obtain a marker block information set, the step includes:
[0025] Encrypting metadata of the file system to obtain encrypted metadata;
[0026] Recording the metadata location information and the encrypted length of the encrypted metadata as second encrypted mark block information;
[0027] The step of encrypting the first encrypted marker block information to obtain the marker block information set comprises:
[0028] The first encrypted marker block information and the second encrypted marker block information are encrypted to obtain the marker block information set.
[0029] In one embodiment, the file system is a FAT32 file system, and the step of encrypting the dictionary table in the location to obtain encrypted data includes:
[0030] The FAT table information in the position is encrypted to obtain the encrypted data.
[0031] In one embodiment, the preset compression algorithm is an LZ4 compression algorithm, and the step of encrypting the dictionary table in the position to obtain encrypted data includes:
[0032] The hash table in the position is encrypted to obtain the encrypted data.
[0033] In addition, to achieve the above purpose, the present application also proposes a firmware upgrade device, the firmware upgrade device comprising:
[0034] A data acquisition module, used to acquire a set of marker block information at a preset position in a pre-built encryption upgrade package;
[0035] A decryption module, used to decrypt the upgrade firmware at the corresponding position in the encrypted upgrade package based on the position information and the encryption length in the marker block information set to obtain the decrypted upgrade firmware;
[0036] The firmware upgrade module is used to perform firmware upgrade based on the decrypted upgrade firmware.
[0037] In addition, to achieve the above objectives, the present application also proposes a firmware upgrade device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the firmware upgrade method described above.
[0038] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the firmware upgrade method described above are implemented.
[0039] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the firmware upgrade method described above are implemented.
[0040] One or more technical solutions proposed in this application have at least the following technical effects:
[0041] The present application obtains a marker block information set at a preset position in a pre-built encrypted upgrade package, decrypts the upgrade firmware at the corresponding position in the encrypted upgrade package based on the position information and encryption length in the marker block information set, obtains the decrypted upgrade firmware, and performs firmware upgrade based on the decrypted upgrade firmware, so that the firmware can be directly obtained for upgrading without decompressing the upgrade package, and the upgrade firmware at the corresponding position in the encrypted upgrade package is decrypted based on the position information and encryption length in the marker block information set, thereby shortening the decryption time and reducing the waiting time for firmware upgrade. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0044] Figure 1 A flowchart of the first embodiment of the firmware upgrade method of the present application is provided;
[0045] Figure 2 This is a schematic diagram of the FAT32 file system structure;
[0046] Figure 3 This is a schematic diagram of the LZ4 compressed file format;
[0047] Figure 4 This is a schematic diagram of the module structure of the firmware upgrade device according to an embodiment of the present application;
[0048] Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the firmware upgrade method in the embodiment of the present application.
[0049] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0050] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0051] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0052] The main solution of the embodiment of the present application is: obtain a marking block information set at a preset position in a pre-built encrypted upgrade package; decrypt the upgrade firmware at the corresponding position in the encrypted upgrade package based on the position information and encryption length in the marking block information set to obtain the decrypted upgrade firmware; and perform firmware upgrade based on the decrypted upgrade firmware.
[0053] In this embodiment, for the convenience of description, the firmware upgrade system is used as the execution subject for explanation below.
[0054] Since the current upgrade firmware is large in size, usually between 2GB and 7GB, and one upgrade package contains multiple firmwares that need to be upgraded, if these firmwares are packaged using a compression algorithm and the compressed upgrade package is encrypted using a traditional symmetric encryption algorithm, it will take too long to decrypt on the embedded device, thereby increasing the waiting time for firmware upgrades.
[0055] The present application provides a solution, which obtains a marker block information set at a preset position in a pre-built encrypted upgrade package, decrypts the upgrade firmware at the corresponding position in the encrypted upgrade package based on the position information and encryption length in the marker block information set, obtains the decrypted upgrade firmware, and performs firmware upgrade based on the decrypted upgrade firmware, so that the firmware can be directly obtained for upgrading without decompressing the upgrade package, and the upgrade firmware at the corresponding position in the encrypted upgrade package is decrypted based on the position information and encryption length in the marker block information set, thereby shortening the decryption time and reducing the waiting time for firmware upgrade.
[0056] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a firmware upgrade device, etc., or an electronic system capable of realizing the above functions, a firmware upgrade system, etc. The following takes the firmware upgrade system as an example to illustrate this embodiment and the following embodiments.
[0057] Based on this, the present application embodiment provides a firmware upgrade method, referring to Figure 1 , Figure 1 A flowchart of the first embodiment of the firmware upgrade method of the present application is provided.
[0058] In this embodiment, the firmware upgrade method includes steps S120, S140, and S150:
[0059] Step S120, obtaining a set of marking block information at a preset position in a pre-built encrypted upgrade package;
[0060] It should be noted that in a scenario where a firmware upgrade is required, a pre-built encrypted upgrade package is obtained.
[0061] Among them, a marking block information set exists at a preset position of the pre-built encrypted upgrade package.
[0062] The marker block information set refers to a series of data blocks or information sets located at specific preset positions in the pre-built encrypted upgrade package. These marker blocks contain important information about the encrypted firmware and are used to guide the subsequent decryption and firmware upgrade process.
[0063] As an implementation method, a marker block information set exists at the beginning / end of the pre-built encrypted upgrade package.
[0064] Before step S120, an encrypted upgrade package may be constructed first. As an implementation method, the method for constructing the encrypted upgrade package may include the following steps (1) to (4):
[0065] (1) using a high-performance compression algorithm (such as the LZ4 algorithm) to compress each upgrade firmware; using a file system image to encapsulate all compressed upgrade firmware to obtain an upgrade image;
[0066] (2) By parsing the file system layout, locate the location of the upgrade firmware in the upgrade image, and encrypt the dictionary (depending on the specific algorithm, some algorithms use hash tables, collectively referred to as dictionary tables) of the location according to the characteristics of the compression algorithm, and record the location information and encryption length as the encryption mark block information (ENC_INFO) for subsequent use;
[0067] (3) Continue parsing the file system until all firmware is encrypted and a series of encrypted mark block information is obtained; encrypt the key partition information, file distribution information, etc. of the file system, and also record and save the location and encryption length as encrypted mark block information;
[0068] (4) All the generated encrypted mark block information is encrypted and then saved at the end of the upgrade image. The new upgrade image is used as the encrypted upgrade package, and the encrypted upgrade package is thus completed.
[0069] Step S140, decrypting the upgrade firmware at the corresponding position in the encrypted upgrade package based on the position information and the encryption length in the marking block information set to obtain the decrypted upgrade firmware;
[0070] Among them, using the location information and encryption length provided in the marker block information set, the system can locate the encrypted firmware at the corresponding position in the encrypted upgrade package. Then, the system will decrypt the encrypted firmware using the same encryption algorithm and key (or key generation method) as when encrypting.
[0071] Step S150: performing firmware upgrade based on the decrypted upgrade firmware.
[0072] The image file containing the upgraded firmware can be mounted to the system so as to extract the firmware therefrom and perform the upgrade operation.
[0073] It should be noted that "mount" is a computer science term, which is usually used to connect a storage device (such as a hard disk partition, optical disc, USB device, etc.) or a part of a file system to the file system tree (also called a directory tree) of the operating system, so that users can access the contents of these devices or file systems just like accessing local files.
[0074] The present embodiment provides a firmware upgrade method, which obtains a marker block information set at a preset position in a pre-constructed encrypted upgrade package, decrypts the upgrade firmware at the corresponding position in the encrypted upgrade package based on the position information and encryption length in the marker block information set, obtains the decrypted upgrade firmware, and performs firmware upgrade based on the decrypted upgrade firmware, so that the firmware can be directly obtained for upgrading without decompressing the upgrade package, and the upgrade firmware at the corresponding position in the encrypted upgrade package is decrypted based on the position information and encryption length in the marker block information set, thereby shortening the decryption time and reducing the waiting time for firmware upgrade.
[0075] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the first embodiment can be referred to the above description, and will not be described in detail later. On this basis, in step S140, the upgrade firmware at the corresponding position in the encrypted upgrade package is decrypted based on the position information and the encryption length in the marker block information set, and before obtaining the decrypted upgrade firmware, the firmware upgrade method further includes step S130:
[0076] Step S130, decrypting the marker block information set to obtain a decrypted marker block information set;
[0077] The marker block information set may be decrypted using an appropriate decryption algorithm and key, such as a symmetric decryption algorithm, an asymmetric decryption algorithm, and the like.
[0078] The step S140, decrypting the upgrade firmware at the corresponding position in the encrypted upgrade package based on the position information and the encryption length in the marker block information set, and obtaining the decrypted upgrade firmware includes step S141:
[0079] Step S141, decrypting the upgrade firmware at the corresponding position in the encrypted upgrade package based on the position information and the encryption length in the decrypted mark block information set to obtain the decrypted upgrade firmware.
[0080] Among them, using the location information and encryption length provided in the marker block information set, the system can locate the encrypted firmware at the corresponding position in the encrypted upgrade package. Then, the system will decrypt the encrypted firmware using the same encryption algorithm and key (or key generation method) as when encrypting.
[0081] The present embodiment provides a firmware upgrade method, which obtains a marker block information set at a preset position in a pre-constructed encrypted upgrade package, decrypts the upgrade firmware at the corresponding position in the encrypted upgrade package based on the position information and encryption length in the marker block information set, obtains the decrypted upgrade firmware, and performs firmware upgrade based on the decrypted upgrade firmware, so that the firmware can be directly obtained for upgrading without decompressing the upgrade package, and the upgrade firmware at the corresponding position in the encrypted upgrade package is decrypted based on the position information and encryption length in the marker block information set, thereby shortening the decryption time and reducing the waiting time for firmware upgrade.
[0082] Based on the second embodiment of the present application, in the third embodiment of the present application, the same or similar contents as those in the second embodiment can be referred to the above description, and will not be described in detail later. On this basis, before step S120, obtaining the marker block information set at the preset position in the pre-built encrypted upgrade package, the firmware upgrade method further includes steps S10 to S60, S90 to S110:
[0083] Step S10, obtaining the upgrade firmware and the file system where the upgrade firmware is located;
[0084] Among them, the file system is a structure in the operating system for organizing and storing files and data. Different devices or operating systems may use different file systems.
[0085] Step S20, compressing the upgrade firmware using a preset compression algorithm to obtain compressed upgrade firmware;
[0086] Among them, in order to reduce the size of the upgraded firmware and improve its transmission efficiency, this step uses a preset compression algorithm (such as ZIP, GZIP, TAR, LZ4, etc.) to compress the firmware. The compressed firmware file will take up less storage space and may be completed faster in network transmission.
[0087] Step S30, encapsulating the compressed upgrade firmware through a file system image to obtain an upgrade image;
[0088] The file system image is a file that contains the complete file system structure, which simulates the file system layout on the actual storage device. The packaging process ensures that the firmware file can be correctly identified, decompressed and installed on the target device.
[0089] Step S40, parsing the file system layout, and locating the position of the upgrade firmware in the upgrade image;
[0090] After the encapsulation is completed, this step parses the file system layout in the upgrade image to determine the exact location of the compressed firmware file in the image. This usually involves reading the metadata or header information of the image file to obtain the file system structure and file storage location.
[0091] Step S50, encrypting the dictionary table in the position to obtain encrypted data;
[0092] In the firmware compression process, a data structure called a dictionary table is usually used to store recurring strings or data blocks to improve compression efficiency. This step encrypts the dictionary table part located in the firmware compressed data to increase the security of the firmware data and prevent unauthorized access or tampering.
[0093] Step S60, recording the relevant information of the position and the encryption length of the encrypted data as first encryption mark block information;
[0094] In order to accurately find and decrypt the encrypted firmware data during the decryption process, this step records the location information of the encrypted data (such as the starting offset and the ending offset) and the encryption length. This information is organized into one or more encrypted marker block information (herein referred to as the first encrypted marker block information) for subsequent use.
[0095] Step S90, encrypting the first encrypted marker block information to obtain the marker block information set;
[0096] In order to further improve security, the first encrypted mark block information may be encrypted.
[0097] Step S100, saving the marking block information set to a preset position in the upgrade image to obtain a new upgrade image;
[0098] As an implementation mode, the marker block information set may be saved to the head end / end of the upgrade image to obtain a new upgrade image.
[0099] Step S110: using the new upgrade image as the encrypted upgrade package.
[0100] This embodiment provides a firmware upgrade method, which records key information such as the location and encryption length of encrypted data through a marker block information set, which is crucial for the subsequent decryption process. By encrypting the marker block information set and saving it in a preset position in the upgrade image, the security of this information during transmission and storage is ensured, thereby improving the reliability of the firmware upgrade.
[0101] Based on the third embodiment of the present application, in the fourth embodiment of the present application, the same or similar contents as those in the third embodiment can be referred to the above description, and will not be described in detail later. On this basis, in step S90, before encrypting the first encrypted marking block information to obtain the marking block information set, the firmware upgrade method further includes steps S70 to S80:
[0102] Step S70, encrypting the metadata of the file system to obtain encrypted metadata;
[0103] Among them, metadata is information that describes the structure and content of the file system, such as file name, file size, file location, file permissions, etc.
[0104] As an implementation method, key file system partition information, file distribution information and other contents in the file system may be encrypted to obtain encrypted metadata.
[0105] Step S80, recording the metadata location information and the encrypted length of the encrypted metadata as second encrypted mark block information;
[0106] After encrypting the metadata, this step records the location information (such as the start offset and end offset) and the encryption length of the encrypted metadata in the file system image. This information is organized into the second encryption mark block information so that the encrypted metadata can be accurately found and decrypted during the decryption process.
[0107] The step S90 of encrypting the first encrypted marker block information to obtain the marker block information set includes the step S91:
[0108] Step S91, encrypting the first encrypted marker block information and the second encrypted marker block information to obtain the marker block information set.
[0109] Among them, this step combines the previously recorded first encrypted mark block information (about the location and encryption length of the encrypted firmware data) and the second encrypted mark block information (about the location and encryption length of the encrypted metadata), and encrypts the combined information. The encrypted mark block information set contains complete information about the encrypted firmware data and the encrypted metadata. The encrypted mark block information set ensures the security of this information during transmission and storage.
[0110] This embodiment provides a firmware upgrade method, which helps to accurately find and decrypt the encrypted metadata during the decryption process by recording the location information and encryption length of the encrypted metadata as the second encryption mark block information. This enhances the recoverability of the file system image, so that the file system structure and content can be completely restored when needed.
[0111] Based on the third embodiment of the present application, in the fifth embodiment of the present application, the same or similar contents as those in the third embodiment can be referred to the above description, and will not be described in detail later. On this basis, the file system is a FAT32 file system, and step S50, encrypting the dictionary table in the position, and obtaining the encrypted data also includes step S51:
[0112] Step S51, encrypting the FAT table information in the position to obtain the encrypted data.
[0113] This embodiment takes the FAT32 file system as an example. Figure 2 As shown, Figure 2 This is a schematic diagram of the FAT32 file system structure;
[0114] Among them, the structure of the FAT32 file system generally includes a boot area, a FAT table and a data area.
[0115] In order to achieve the confidentiality of the file system, some key parts of the FAT32 file system can be encrypted. As an implementation method, the boot area and the FAT table can be encrypted:
[0116] (1) Encrypting the boot area: By encrypting the boot area, unauthorized access or tampering can be prevented. If the boot area is encrypted, any device or software that attempts to access the file system without the correct decryption key will not be able to recognize or access the file system.
[0117] (2) FAT table encryption: The FAT table contains the storage location and link information of the file. By encrypting the FAT table, the contents of the file system can be further protected. Without the correct decryption key, the attacker will not be able to obtain the storage location of the file, and thus cannot read or tamper with the file content.
[0118] In this embodiment, each upgrade firmware is first compressed using a high-performance compression algorithm (such as the LZ4 algorithm); all compressed upgrade firmware are encapsulated using a file system image to obtain an upgrade image;
[0119] Then, by parsing the file system layout, that is, the FAT32 file system layout, the location of the upgrade firmware in the upgrade image is located, and according to the characteristics of the compression algorithm, the dictionary (depending on the specific algorithm, some algorithms use hash tables, collectively referred to as dictionary tables) of the location is encrypted, and the location information and the encryption length are recorded as the encryption mark block information (ENC_INFO) for subsequent use;
[0120] Then, the file system is parsed continuously until all firmware is encrypted and a series of encrypted mark block information is obtained; the key partition information and file distribution information of the file system are encrypted, and the location and encryption length are also recorded and saved as encrypted mark block information;
[0121] Finally, all the generated encrypted mark block information is encrypted and then saved at the end of the upgrade image. The new upgrade image is used as an encrypted upgrade package, and thus the encrypted upgrade package is completed.
[0122] The present embodiment provides a firmware upgrade method, which obtains a marker block information set at a preset position in a pre-constructed encrypted upgrade package, decrypts the upgrade firmware at the corresponding position in the encrypted upgrade package based on the position information and encryption length in the marker block information set, obtains the decrypted upgrade firmware, and performs firmware upgrade based on the decrypted upgrade firmware, so that the firmware can be directly obtained for upgrading without decompressing the upgrade package, and the upgrade firmware at the corresponding position in the encrypted upgrade package is decrypted based on the position information and encryption length in the marker block information set, thereby shortening the decryption time and reducing the waiting time for firmware upgrade.
[0123] Based on the third embodiment of the present application, in the sixth embodiment of the present application, the same or similar contents as those in the third embodiment can be referred to the above description, and will not be described in detail later. On this basis, the preset compression algorithm is the LZ4 compression algorithm, and step S50, encrypting the dictionary table in the position, and obtaining the encrypted data also includes step S52:
[0124] Step S52, encrypting the hash table in the position to obtain the encrypted data.
[0125] This embodiment takes the preset compression algorithm as the LZ4 compression algorithm as an example. Figure 3 As shown, Figure 3 This is a schematic diagram of the LZ4 compressed file format.
[0126] Among them, the LZ4 compressed file format includes LZ4 information, hash table and token data block. LZ4 uses hash table (dictionary table) to find matching strings. As long as part of the data in the hash table (dictionary table) is encrypted, the LZ4 compressed file will not be able to be decompressed. At the same time, the size of the hash table (dictionary table) is generally at the KB level, and the amount of data is very small, so the purpose of using smaller data encryption to protect larger files is achieved.
[0127] The present embodiment provides a firmware upgrade method, which obtains a marker block information set at a preset position in a pre-constructed encrypted upgrade package, decrypts the upgrade firmware at the corresponding position in the encrypted upgrade package based on the position information and encryption length in the marker block information set, obtains the decrypted upgrade firmware, and performs firmware upgrade based on the decrypted upgrade firmware, so that the firmware can be directly obtained for upgrading without decompressing the upgrade package, and the upgrade firmware at the corresponding position in the encrypted upgrade package is decrypted based on the position information and encryption length in the marker block information set, thereby shortening the decryption time and reducing the waiting time for firmware upgrade.
[0128] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the firmware upgrade method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0129] This application also provides a firmware upgrade device, please refer to Figure 4 , the firmware upgrade device comprises:
[0130] The data acquisition module 10 is used to acquire a set of marker block information at a preset position in a pre-built encrypted upgrade package;
[0131] A decryption module 20, configured to decrypt the upgrade firmware at the corresponding position in the encrypted upgrade package based on the position information and the encryption length in the marker block information set, to obtain the decrypted upgrade firmware;
[0132] The firmware upgrade module 30 is used to perform firmware upgrade based on the decrypted upgrade firmware.
[0133] The firmware upgrade device provided by the present application adopts the firmware upgrade method in the above embodiment, which can solve the technical problem that the current firmware upgrade waiting time is too long. Compared with the prior art, the beneficial effects of the firmware upgrade device provided by the present application are the same as the beneficial effects of the firmware upgrade method provided by the above embodiment, and other technical features in the firmware upgrade device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0134] The present application provides a firmware upgrade device, which includes: at least one processor; and a memory that is communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the firmware upgrade method in the above-mentioned embodiment one.
[0135] Reference below Figure 5 , which shows a schematic diagram of the structure of a firmware upgrade device suitable for implementing the embodiments of the present application. The firmware upgrade device in the embodiments of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The firmware upgrade device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0136] like Figure 5 As shown, the firmware upgrade device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the firmware upgrade device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the firmware upgrade device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a firmware upgrade device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or provided instead.
[0137] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0138] The firmware upgrade device provided by the present application adopts the firmware upgrade method in the above embodiment, which can solve the technical problem that the current firmware upgrade waiting time is too long. Compared with the prior art, the beneficial effects of the firmware upgrade device provided by the present application are the same as the beneficial effects of the firmware upgrade method provided by the above embodiment, and the other technical features in the firmware upgrade device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0139] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0140] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0141] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the firmware upgrade method in the above-mentioned embodiment.
[0142] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0143] The computer-readable storage medium may be included in the firmware upgrade device; or may exist independently without being assembled into the firmware upgrade device.
[0144] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the firmware upgrade device, the firmware upgrade device: obtains a marking block information set at a preset position in a pre-built encrypted upgrade package; decrypts the upgrade firmware at the corresponding position in the encrypted upgrade package based on the position information and encryption length in the marking block information set to obtain the decrypted upgrade firmware; and performs firmware upgrade based on the decrypted upgrade firmware.
[0145] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0146] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0147] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0148] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned firmware upgrade method, and can solve the technical problem that the waiting time for firmware upgrade is too long. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the firmware upgrade method provided by the above-mentioned embodiment, and will not be repeated here.
[0149] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned firmware upgrade method when executed by a processor.
[0150] The computer program product provided by this application can solve the technical problem of long waiting time for firmware upgrade. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as those of the firmware upgrade method provided by the above embodiment, which will not be described in detail here.
[0151] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A firmware upgrade method, characterized in that: The method comprises the following steps: Obtaining a set of marker block information at a preset position in a pre-built encryption upgrade package; Decrypting the upgrade firmware at the corresponding position in the encrypted upgrade package based on the position information and the encryption length in the marker block information set to obtain the decrypted upgrade firmware; Firmware upgrade is performed based on the decrypted upgrade firmware.
2. The method according to claim 1, characterized in that The step of decrypting the upgrade firmware at the corresponding position in the encrypted upgrade package based on the position information and the encryption length in the marker block information set to obtain the decrypted upgrade firmware includes: Decrypting the marker block information set to obtain a decrypted marker block information set; The step of decrypting the upgrade firmware at the corresponding position in the encrypted upgrade package based on the position information and the encryption length in the marker block information set to obtain the decrypted upgrade firmware comprises: The upgrade firmware at the corresponding position in the encrypted upgrade package is decrypted based on the position information and the encryption length in the decrypted marking block information set to obtain the decrypted upgrade firmware.
3. The method according to claim 2, characterized in that The step of obtaining a set of marker block information at a preset position in a pre-built encrypted upgrade package includes: Obtaining the upgrade firmware and the file system where the upgrade firmware is located; Compressing the upgrade firmware using a preset compression algorithm to obtain compressed upgrade firmware; Encapsulating the compressed upgrade firmware through a file system image to obtain an upgrade image; Parsing the file system layout to locate the position of the upgrade firmware in the upgrade image; Encrypting the dictionary table in the position to obtain encrypted data; Recording the relevant information of the position and the encryption length of the encrypted data as first encryption mark block information; Encrypting the first encrypted marker block information to obtain the marker block information set; The marking block information set is saved to a preset position in the upgrade image to obtain a new upgrade image; The new upgrade image is used as the encrypted upgrade package.
4. The method as claimed in claim 3, characterized in that Before the step of encrypting the first encrypted marker block information to obtain a marker block information set, the following steps are included: Encrypting metadata of the file system to obtain encrypted metadata; Recording the metadata location information and the encrypted length of the encrypted metadata as second encrypted mark block information; The step of encrypting the first encrypted marker block information to obtain the marker block information set comprises: The first encrypted marker block information and the second encrypted marker block information are encrypted to obtain the marker block information set.
5. The method according to claim 3, characterized in that The file system is a FAT32 file system, and the step of encrypting the dictionary table in the location to obtain encrypted data comprises: The FAT table information in the position is encrypted to obtain the encrypted data.
6. The method according to claim 3, characterized in that The preset compression algorithm is the LZ4 compression algorithm, and the step of encrypting the dictionary table in the position to obtain encrypted data includes: The hash table in the position is encrypted to obtain the encrypted data.
7. A firmware upgrade device, characterized in that: The device comprises: A data acquisition module, used to acquire a set of marker block information at a preset position in a pre-built encryption upgrade package; A decryption module, used to decrypt the upgrade firmware at the corresponding position in the encrypted upgrade package based on the position information and the encryption length in the marker block information set to obtain the decrypted upgrade firmware; The firmware upgrade module is used to perform firmware upgrade based on the decrypted upgrade firmware.
8. A firmware upgrade device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the firmware upgrade method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the firmware upgrade method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the firmware upgrade method according to any one of claims 1 to 6 are implemented.