CN114518897A - Remote upgrading method and system for communication module - Google Patents

Remote upgrading method and system for communication module Download PDF

Info

Publication number
CN114518897A
CN114518897A CN202210413878.2A CN202210413878A CN114518897A CN 114518897 A CN114518897 A CN 114518897A CN 202210413878 A CN202210413878 A CN 202210413878A CN 114518897 A CN114518897 A CN 114518897A
Authority
CN
China
Prior art keywords
file
upgrade
upgrading
differential
version file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210413878.2A
Other languages
Chinese (zh)
Inventor
尹志斌
甄岩
郑利斌
陈文彬
霍超
慕迪
赵冲
尚舒野
杨东文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Smartchip Microelectronics Technology Co Ltd
Original Assignee
Beijing Smartchip Microelectronics Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Smartchip Microelectronics Technology Co Ltd filed Critical Beijing Smartchip Microelectronics Technology Co Ltd
Priority to CN202210413878.2A priority Critical patent/CN114518897A/en
Publication of CN114518897A publication Critical patent/CN114518897A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/658Incremental updates; Differential updates

Landscapes

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

Abstract

The embodiment of the invention provides a remote upgrading method and system for a communication module, and belongs to the technical field of module upgrading. The method comprises the following steps: generating a differential upgrade package in response to the upgrade instruction; reordering the operation sequence of the differential upgrade package based on the optimized bsdiff algorithm; directly replacing or inserting original firmware in the communication module through the reordered differential upgrade packet; and after the differential upgrading is completed, judging an upgrading result, and reporting an upgrading completion confirmation signal after the upgrading result is successful. The scheme of the invention ensures the performability of the embedded equipment, saves the resource expenditure, and does not cause interference to the use of a user while upgrading the module.

Description

Remote upgrading method and system for communication module
Technical Field
The invention relates to the technical field of module upgrading, in particular to a communication module remote upgrading method and a communication module remote upgrading system.
Background
Along with the continuous deepening of the construction of the energy Internet, the intelligentization level of a power grid is greatly improved, the requirement on the quality of power utilization service is continuously improved, the production and operation of a company power grid, the operation and management of enterprises and the service of external customers are undergoing historical changes, and the data requirements of all levels of power grid data acquisition and control, user information interaction and the like are in explosive growth. The three characteristics of 5G low time delay, high bandwidth and large connection, and key technologies such as network slicing and edge calculation can meet the requirements of safety, reliability and flexibility of each link of a power distribution network of the power service, fault judgment and accurate positioning of a distribution network line section or equipment can be realized, and the fault section or equipment can be isolated quickly.
The existing program upgrading method of the communication module mainly comprises a program upgrading method based on JTAG, a PC (personal computer) upgrading method based on USB (universal serial bus) port or Ethernet connection, a wireless upgrading method based on a whole packet and the like, but no matter which method has certain defects, the automatic upgrading of the module cannot be completed accurately in a time-saving and labor-saving manner, the existing traditional upgrading method usually adopts a local upgrading mode, has the defects of low efficiency, poor robustness and the like, and simultaneously needs manual upgrading to be carried out point to point on site, so that the workload is large, and the efficiency is low; in addition, the traditional manual upgrading can cause damage to the original program package when the upgrading fails, so that the node can possibly break down, and certain risk exists; the whole package of upgrade is complete upgrade of the whole firmware, the upgrade data volume is large, the duration is long, and huge data flow can cause network congestion and cause upgrade failure. Based on the above problems, a new method for remotely upgrading a communication module needs to be designed.
Disclosure of Invention
The invention aims to provide a communication module remote upgrading method and a communication module remote upgrading system, and at least solves the problem that the existing communication module upgrading method can not finish automatic upgrading of modules accurately in a time-saving, labor-saving and accurate manner.
In order to achieve the above object, a first aspect of the present invention provides a method for remotely upgrading a communication module, the method including: generating a differential upgrade package in response to the upgrade instruction; based on the optimized bsdiff algorithm, reordering the operation sequence of the differential upgrade package; carrying out differential upgrade on original firmware in the communication module through the reordered differential upgrade packet; and after the differential upgrading is completed, judging an upgrading result, and reporting an upgrading completion confirmation signal after the upgrading result is successful.
Optionally, the differentially upgrading the original firmware in the communication module by the reordered differential upgrade package includes: and directly replacing or inserting the old version file in the communication module through the reordered differential upgrade package.
Optionally, the differential upgrade package includes: a header region, a control region, a difference data region, and an insertion data region; the head area is an identity identification area of the differential upgrade package; the control area is an attribute information recording area of the differential upgrade package; the difference data area is a difference data area of the new version file to be upgraded and the old version file; the inserted data area is a newly added data area of the new version file to be upgraded different from the old version file.
Optionally, the generating the differential upgrade package includes: obtaining a differential upgrade package based on a bsdiff algorithm, comprising: reading firmware information of an old version of file before upgrading, and performing dictionary training on suffixes of the firmware information to obtain a suffix sequencing array; traversing the new version file to be upgraded based on the suffix ordering array, and positioning a sequence which is completely the same between the new version file to be upgraded and the old version file before upgrading; and taking the completely same sequence as a reference, expanding the two ends of the reference in the new edition file according to the fixed region range, and correspondingly storing the region into a differential upgrade package of the file to be upgraded when a region which is not matched with the old edition file is identified until all the new edition files are traversed by expansion to obtain the differential upgrade package.
Optionally, the optimized bsdiff algorithm is as follows: reordering the operation sequence in the original bsdiff algorithm according to a preset directed graph and topological ordering; the reordering rule is as follows: sequencing the operation sequence without read-write conflict, and then sequencing the operation sequence with read-write conflict; directly carrying out corresponding operation processing on the operation sequence without read-write conflict; and adding a file pointer to control operation processing to the operation sequence with read-write conflict.
Optionally, the file pointer control operation processing includes: determining the pointed position of the current file pointer, copying a preset number of bytes from the pointed position to a memory, and adding a field for recording the pointed position in front of a data packet of an old version of file; adding or inserting the bytes of the preset number of copied bytes and the differential upgrade package at the pointed position of the old version file to finish a new file fragment updating step, and performing a file pointer offset step according to a file pointer offset rule; and repeating the step of updating the new file fragment and the step of shifting the file pointer until the file pointer traverses the file, and finishing the updating of the operation sequence of the differential upgrade package.
Optionally, the determining an upgrade result includes: acquiring version identity information of an old version file; after the communication module is upgraded, acquiring the identity information of the upgraded version file; and comparing the identity information of the old version file with the identity information of the version file after the upgrade is finished, and if the identity information of the old version file is different from the identity information of the version file after the upgrade is finished, judging that the upgrade result is the upgrade success.
Optionally, the determining an upgrade result includes: after the communication module is upgraded, acquiring the identity information of the upgraded version file; and comparing the identity information of the upgraded version file with the identity information of the preset new version file, and if the identity information of the upgraded version file is the same as the identity information of the preset new version file, judging that the upgrade result is successful.
Optionally, the method further includes: when the upgrading result is judged to be upgrading failure, the differential upgrading operation is executed again; and if the upgrade is still judged to be failed after the differential upgrade for the preset times, outputting alarm information.
A second aspect of the present invention provides a system for remotely upgrading a communication module, the system comprising: the generating unit is used for responding to the upgrading instruction and generating a differential upgrading packet; the processing unit is used for reordering the operation sequence of the differential upgrade package based on the optimized bsdiff algorithm; the updating unit is used for directly replacing or inserting the original firmware in the communication module through the reordered differential upgrading packet, and judging an upgrading result after finishing the differential upgrading; and the transmission unit is used for reporting an upgrade completion confirmation signal after the upgrade result is that the upgrade is successful.
Optionally, the generating the differential upgrade package includes: obtaining a differential upgrade package based on a bsdiff algorithm, comprising: reading firmware information of an old version of file before upgrading, and performing dictionary training on suffixes of the firmware information to obtain a suffix sequencing array; traversing the new version file to be upgraded based on the suffix ordering array, and positioning a sequence in which the new version file to be upgraded and the old version file before upgrading are completely the same; and expanding the files at two ends of the reference in the new edition file according to the fixed region range by taking the completely same sequence as the reference, and correspondingly storing the region into a differential upgrade package of the file to be upgraded when a region which is not matched with the old edition file is identified until the expansion traverses all the new edition files to obtain the differential upgrade package.
Optionally, the determining an upgrade result includes: acquiring version identity information of an old version file; after the communication module is upgraded, acquiring the identity information of the upgraded version file; and comparing the identity information of the old version file with the identity information of the version file after the upgrade is finished, and if the identity information of the old version file is different from the identity information of the version file after the upgrade is finished, judging that the upgrade result is the upgrade success.
Optionally, the determining an upgrade result includes: after the communication module is upgraded, acquiring identity information of the upgraded version file; and comparing the identity information of the upgraded version file with the identity information of the preset new version file, and if the identity information of the upgraded version file is the same as the identity information of the preset new version file, judging that the upgrade result is successful.
Optionally, the updating unit is further configured to: when the upgrading result is judged to be upgrading failure, the differential upgrading operation is executed again; and if the upgrade is still judged to be failed after the differential upgrade of the preset times is carried out again, generating alarm information.
Optionally, the system further includes: and the alarm unit is used for outputting the alarm information.
In another aspect, the present invention provides a computer-readable storage medium having instructions stored thereon, which when executed on a computer, cause the computer to perform the above-mentioned method for remotely upgrading a communication module.
According to the technical scheme, the program data files of the new version and the old version of the firmware are differentiated in a differential upgrading mode to form the increment package required by upgrading, only the difference part of the new version and the old version needs to be upgraded, the same part of the two versions does not need to be upgraded, the same upgrading effect is achieved by transmitting less data, the upgrading efficiency of the communication module is improved, network congestion is reduced, the upgrading success rate is improved, and the reliability of remote communication is ensured.
In order to further save the memory resource expenditure of the embedded equipment, the scheme of the invention also provides an optimized bsdiff algorithm, thereby ensuring the performability of the embedded equipment, saving the resource expenditure, and not causing interference to the use of a user while upgrading the module.
Additional features and advantages of embodiments of the invention will be set forth in the detailed description which follows.
Drawings
The accompanying drawings, which are included to provide a further understanding of the embodiments of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the embodiments of the invention without limiting the embodiments of the invention. In the drawings:
FIG. 1 is a flow chart illustrating steps of a method for remotely upgrading a communication module according to an embodiment of the present invention;
fig. 2 is a system structural diagram of a communication module remote upgrade system according to an embodiment of the present invention.
Detailed Description
The following detailed description of embodiments of the invention refers to the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating the present invention, are given by way of illustration and explanation only, not limitation.
Along with the continuous deepening of the construction of the energy Internet, the intelligentization level of a power grid is greatly improved, the requirement on the quality of power utilization service is continuously improved, the production and operation of a company power grid, the operation and management of enterprises and the service of external customers are undergoing historical changes, and the data requirements of all levels of power grid data acquisition and control, user information interaction and the like are in explosive growth. The three characteristics of 5G low time delay, high bandwidth and large connection, and key technologies such as network slicing and edge calculation can meet the requirements of safety, reliability and flexibility of each link of a power distribution network of the power service, fault judgment and accurate positioning of a distribution network line section or equipment can be realized, and the fault section or equipment can be isolated quickly.
In the using process, the communication module is bound to undergo module upgrading for many times, and at present, the program upgrading of the communication module mainly comprises the following steps:
1) the program upgrading method based on JTAG is to burn BOOT files into a memory chip locally through upgrading software. The method has low downloading speed, is only suitable for downloading and debugging programs in a factory and is not suitable for remote upgrading.
2) The PC is connected with the acquisition terminal through a USB port or an Ethernet to upgrade the software of the communication acquisition terminal, and has the defects of difficult wiring, large workload, low response speed and the like because the communication acquisition terminal can only be upgraded point to point manually on site.
3) The whole package upgrading needs to package a complete software package of a new version, equipment receives all upgrading packages, and after the validity and the integrity of the upgrading packages are verified through a verification algorithm, application codes of an old version are replaced.
The conventional upgrading method generally adopts a local upgrading mode, has the defects of low efficiency, poor robustness and the like, and simultaneously needs manual upgrading from site to site, so that the workload is large and the efficiency is low; in addition, the traditional manual upgrading can cause damage to the original program package when the upgrading fails, so that the node can possibly break down, and certain risk exists; the whole package of upgrade is complete upgrade of the whole firmware, the upgrade data volume is large, the duration is long, and huge data flow can cause network congestion and cause upgrade failure.
Based on the problems, the scheme of the invention provides a remote upgrading method for a communication module, which adopts a differential upgrading mode to differentiate program data files of new and old versions of firmware to form an increment package required by upgrading, only the differential part of the new version and the old version needs to be upgraded, the same part of the two versions does not need to be upgraded, the same upgrading effect is realized by transmitting less data, the upgrading efficiency of the 5G communication module is improved, the network congestion is reduced, the upgrading success rate is improved, and the reliability of remote communication is ensured. Meanwhile, in order to further save the memory resource expenditure of the embedded equipment, the scheme of the invention also provides an optimized bsdiff algorithm, thereby ensuring the performability of the embedded equipment, saving the resource expenditure, and not causing interference to the use of a user while upgrading the module.
Fig. 2 is a system structural diagram of a communication module remote upgrade system according to an embodiment of the present invention. As shown in fig. 2, an embodiment of the present invention provides a system for remotely upgrading a communication module, where the system includes: the generating unit is used for responding to the upgrading instruction and generating a differential upgrading packet; the processing unit is used for reordering the operation sequence of the differential upgrade package based on the optimized bsdiff algorithm; the updating unit is used for directly replacing or inserting the original firmware in the communication module through the reordered differential upgrading packet, and judging an upgrading result after finishing the differential upgrading; and the transmission unit is used for reporting an upgrade completion confirmation signal after the upgrade result is that the upgrade is successful.
Preferably, the updating unit is further configured to: when the upgrading result is judged to be upgrading failure, the differential upgrading operation is executed again; and if the upgrade is still judged to be failed after the differential upgrade of the preset times is carried out again, generating alarm information.
Preferably, the system further comprises: and the alarm unit is used for outputting the alarm information.
Fig. 1 is a flowchart of a method for remotely upgrading a communication module according to an embodiment of the present invention. As shown in fig. 1, an embodiment of the present invention provides a method for remotely upgrading a communication module, where the method includes:
step S10: in response to the upgrade instruction, a differential upgrade package is generated.
Specifically, when module upgrading is performed, because modules of multiple terminals are often required to be upgraded, the step is often one-to-many synchronous upgrading, in order to facilitate upgrading management and control of the multiple terminals, a server is required to uniformly generate upgrading instructions, the upgrading instructions are issued to the terminals, and the terminals perform corresponding system upgrading based on the upgrading instructions. Based on the upgrading requirement of the user, the server generates a corresponding upgrading instruction and then correspondingly executes the upgrading instruction. The scheme of the invention utilizes differential upgrading, wherein the differential upgrading is a technology for reducing the size of transmitted codes by transmitting incremental files, differential files are generated by searching similarity areas in programs of different versions, only the differential files need to be transmitted when data synchronization is carried out, and the transmission of large-capacity complete files is avoided.
Therefore, before upgrading, a corresponding differential upgrade package needs to be generated first. Preferably, the scheme of the invention utilizes a bsdiff algorithm to generate the differential upgrade package, wherein the bsdiff algorithm is a file differential algorithm based on an approximate matching theory, and the algorithm is independent of the type and the platform of the firmware, so that the universal transplantation can be realized. Firstly, reading an old version firmware file by a bsdiff algorithm, performing dictionary sorting on suffixes of the file, calculating by using a suffix sorting algorithm, generating a suffix sorting array, traversing the new firmware by using the suffix sorting array to find a sequence which is completely the same as the old firmware, and expanding the completely same sequence to two sides according to the similarity between the new firmware and the old firmware. The direction of the identical sequence extension is a forward area and a backward area of the area where the firmware is located, and the similarity degree of specific areas of new and old firmware is evaluated through the percentage of the same code and the length of different codes. Preferably, in bsdiff, these parameters are set to 50% and 8 bytes, that is, at least 8 bytes of the completely matching region of the finally found similar sequence do not match with the forward extension of the previous similar sequence, and the forward and backward extensions of the similar sequence must satisfy more than half of the suffix mismatch condition. If there is a code section in the new firmware that does not match any section in the old firmware, it is treated as difference data and then stored in the difference packet.
Preferably, the differential upgrade package includes: a header area, a control area, a diff area (difference data area), and an extract area (insertion data area); the header area is an identity identification area of the differential upgrade package; the control area is an attribute information recording area of the differential upgrade patch; the difference data area is a difference data area of the new version file to be upgraded and the old version file; the inserted data area is a newly added data area of the new version file to be upgraded different from the old version file.
Step S20: and reordering the operation sequence of the differential upgrade package based on the optimized bsdiff algorithm.
Specifically, although the bsdiff algorithm is suitable for differential application of binary firmware files, the bsdiff algorithm also has certain problems in practical use. If stable operation of differential restore operation (bspatch) is required, four parts of storage area are prepared: the original firmware storage area, the differential packet received from the server, the new version firmware generated after differential reduction and the working interval of the equipment are not small memory overhead for some embedded equipment with short memory resources. The excessive upgrade of the firmware occupies the system memory, which not only affects the operation of other application programs, but also reduces the operation speed of the whole system.
The scheme of the invention needs to solve the problem that the firmware upgrading occupies too much memory, firstly, starting from the problem, after the differential file output by the file differential algorithm is transmitted to the embedded equipment, the embedded system can recover the new version of firmware by using the differential file and the old version of firmware in the system. For the bsdiff algorithm, two types of operations are mainly performed in the process of recovering the new firmware version by the system. The first is a copy operation, i.e., a data block generated by adding a diff data block to an old version of a corresponding area is copied to a designated area. The second type of operation is an insert operation, i.e., an extract data block is inserted into a specified area, i.e., replacement and insertion in the conventional sense.
For example, an old firmware has three areas, block a, block B, and block C, which are required to be an area to be updated, and the corresponding differential upgrade package is diff1, diff2, and diff3, and when upgrading is performed, the three area data of the old version and the three data of the differential upgrade package need to be added to obtain similar area data blocks new block a, new block B, and new block C in the new firmware. Since the three data blocks belong to a similar sequence, their size and length are the same, and the address copied to the new firmware after addition is determined by the control area parameter in the differential upgrade package. After the addition and copy operations of each block area are performed, an insertion operation is performed, and the difference sequence extract in the new firmware and the old firmware is inserted into the newly generated firmware to complete the restoration operation. For reasons of data size and execution requirement, after the data blocks in the old firmware version are subjected to addition and copy operations, a new storage space needs to be opened up for storing the data blocks of the new firmware version. The differential file is usually much smaller than the new and old firmware, so in the process of generating the new firmware, the memory occupation mainly comes from the new and old firmware.
Based on the above problems, if the system can realize "in-situ update", that is, the new firmware is generated by only directly modifying the contents of the old firmware, the system does not need to separately open a section of memory space for the new firmware, and this way can effectively reduce the memory overhead. However, when the system is directly and differentially restored on an old version of file, a new problem exists, that is, a read-write conflict problem may be involved, so that the upgrade fails.
Based on the above example, after the firmware completes the addition copy operation for the block B unit according to the restore operation of the bsdiff algorithm, after the extract1 area is inserted, the pointer is placed at the designated position and collides with the block C area data, so that an error occurs in the copy operation for block C because the content of block C has been changed. Similarly, a read-write conflict problem may occur between subsequent block D and block E units.
Further, in order to solve the above problems, the scheme of the present invention reorders the copy operation sequence in the bsdiff algorithm by using a directed graph and a topological sort, thereby solving the read-write conflict problem in the differential reduction process.
Specifically, first, a directed graph is created for all copy operations
Figure 139717DEST_PATH_IMAGE001
Wherein the vertex set
Figure 122716DEST_PATH_IMAGE002
The operations "add and copy" or "insert" correspond to, respectively, that is, all blocks and extracts in the above-mentioned reduction process are taken as a node in G. G has an arc from u to v if and only if the modification operation corresponding to a certain node v reads the part written by the copy modification operation corresponding to node u. In order to solve the read-write conflict problem, the read-write conflict directed graph can be solved by reverse topological sorting, and the reverse topological order of the nodes in the G provides a read-write conflict-free order of the restoration updating operation. Special handling of the copy and add operation is required if the copy operation reads the memory space of the old firmware overlapping the memory space of the new firmware written by the operation.
The special processing for the copy and add operation is the additional file pointer control operation processing. As is known, the old firmware is generally stored in a flash application program area ROM, in the original bspatch algorithm, a file pointer is located in a memory space where the old firmware is located, the pointer moves forward according to a parameter z in each triplet (x, y, z) in the control module, and the number of bytes in the old firmware which is specifically needed can be obtained according to the parameter x. Based on the principle, the recovery operation designed by the scheme of the invention copies x bytes from the current pointed position of the old firmware pointer into the memory RAM, adds a field for recording a file pointer in front of the original data packet, records the read start address, then reads x bytes of data from diff data of a differential file and adds the x bytes of data to the old firmware fragment read into the memory RAM, and then reads y bytes of extra data and adds the y bytes of data to the tail. When the update of a new file segment is completed, the segment is written into a corresponding address, and the added field is used for recording the initial address of the additional write of the new file segment, which is the same as that when the old firmware is read. Each time a new file segment generation is performed, the original pointer is offset by the parameter z. Therefore, the old firmware fragments are continuously swapped in the memory, and the generated new files are swapped out of the memory, so that the occupation of the memory can be greatly reduced.
In the embodiment of the invention, the linear path obtained by utilizing the reverse topological sorting is a copy operation sequence which can not generate read-write conflict. The bsdiff algorithm needs to place the approximate matching regions in this order while putting the transformed approximate matching regions and all other completely unmatched regions to the end when packing the differential file.
Step S30: and directly replacing or inserting the original firmware in the communication module through the reordered differential upgrade package.
Specifically, based on the reordering, the in-situ updating of the system is realized, the problem of read-write conflict is avoided, and the stable and accurate upgrading of the module is ensured. The module upgrading can be directly and smoothly completed based on the operation sequence, and because the occupation of the memory is small, the failure probability in the module upgrading process is also low.
Step S40: and after the differential upgrading packet is processed, judging an upgrading result, and reporting an upgrading completion confirmation signal after upgrading is successful.
Specifically, after the upgrade is completed, it is necessary to determine whether the upgrade is successful, so as to ensure effective upgrade. Preferably, the version identity information of the old version file is acquired; after the module is upgraded, acquiring the identity information of the version file after the upgrading is finished; and comparing the version identity information of the old version file with the identity information of the version file after the upgrade is finished, and judging that the upgrade is finished when the version identity information of the old version file and the identity information of the version file after the upgrade are different.
In another possible implementation mode, after module upgrading is completed, identity information of a version file after upgrading is completed is obtained; and comparing the identity information of the upgraded version file with the identity information of the preset new version file, and judging that the upgrade is finished when the identity information of the upgraded version file is the same as the identity information of the preset new version file.
Preferably, when the upgrading result is judged to be failed, the system automatically tries to perform second upgrading, performs second upgrading try according to the same upgrading method, continues to judge the upgrading result after finishing second upgrading, and finishes module upgrading if the upgrading is judged to be successful. If the upgrade still is an error, the third upgrade attempt is continued until the upgrade is successful. However, if the upgrade is not possible to be successful anyway due to the module itself, and the module continuously attempts to upgrade, it is preferable to preset the number of re-upgrade attempts, for example, 3 times, and when the upgrade is still unsuccessful after 3 times of upgrade is completed, the upgrade attempt is stopped, and the alarm information is directly output.
In the embodiment of the invention, the scheme of the invention is upgraded based on a differential upgrade package mode, only the difference part between the new version and the old version needs to be upgraded, and the same part in the two versions does not need to be upgraded, so that the same upgrade effect is realized by transmitting less data, the upgrade efficiency of the communication module is improved, the network congestion is reduced, the upgrade success rate is improved, and the reliability of remote communication is ensured. In the scheme of the invention, the digraph and the reverse topological sorting are utilized to reorder the copying operation sequence in the bsdiff algorithm, a field for recording a file pointer is added in front of the original data packet, and the read initial address is recorded, so that the read-write conflict problem in the differential reduction process is solved, and the upgrade success rate is improved.
Example 1
The method comprises the following steps: firstly, obtaining a required differential upgrade package on a server by using a bsdiff differential algorithm;
step two: the server sends an upgrading instruction to the terminal, and the terminal reads and records the software version of the current module after receiving the upgrading instruction;
step three: the terminal responds to an upgrading instruction sent by the server, and the server starts to send an upgrading packet; after the upgrade package is downloaded, the terminal replies confirmation to the server to confirm that the download is completed;
step four: the terminal sends an AT command to the module, starts software upgrading and informs the module of the size of an upgrading packet;
step five: the module responds to the AT command, and the terminal transmits an upgrade package to the module;
step six: after the module finishes receiving the upgrade package, directly updating the old version program by using the optimized bsdiff algorithm, and automatically restarting after upgrading is finished;
step seven: after the module is restarted, sending an upgrade completion prompt to the terminal; the terminal inquires the current version information of the module and compares the current version information with the version information recorded before upgrading, and if the information is different, the upgrading is successful;
step eight: and the terminal sends module upgrading completion confirmation to the server.
The embodiment of the present invention also provides a computer-readable storage medium, which stores instructions that, when executed on a computer, cause the computer to execute the above method for remotely upgrading a communication module.
Those skilled in the art will appreciate that all or part of the steps in the method for implementing the above embodiments may be implemented by a program, which is stored in a storage medium and includes several instructions to enable a single chip, a chip, or a processor (processor) to execute all or part of the steps in the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk, and various media capable of storing program codes.
While the embodiments of the present invention have been described in detail with reference to the accompanying drawings, the embodiments of the present invention are not limited to the details of the above embodiments, and various simple modifications can be made to the technical solution of the embodiments of the present invention within the technical idea of the embodiments of the present invention, and the simple modifications are within the scope of the embodiments of the present invention. It should be noted that the various features described in the above embodiments may be combined in any suitable manner without departing from the scope of the invention. In order to avoid unnecessary repetition, the embodiments of the present invention will not be described separately for the various possible combinations.
In addition, any combination of the various embodiments of the present invention is also possible, and the same should be considered as disclosed in the embodiments of the present invention as long as it does not depart from the spirit of the embodiments of the present invention.

Claims (16)

1. A method for remote upgrade of a communication module, the method comprising:
generating a differential upgrade package in response to the upgrade instruction;
reordering the operation sequence of the differential upgrade package based on the optimized bsdiff algorithm;
carrying out differential upgrade on original firmware in the communication module through the reordered differential upgrade packet;
and after the differential upgrading is completed, judging an upgrading result, and reporting an upgrading completion confirmation signal after the upgrading result is successful.
2. The method of claim 1, wherein the differentially upgrading the original firmware in the communication module by the reordered differential upgrade package comprises:
and directly replacing or inserting the old version file in the communication module through the reordered differential upgrade package.
3. The method of claim 1, wherein the differential upgrade package comprises:
a header region, a control region, a difference data region, and an insertion data region;
the head area is an identity identification area of the differential upgrade package;
the control area is an attribute information recording area of the differential upgrade package;
the difference data area is a difference data area of the new version file to be upgraded and the old version file;
the inserted data area is a newly added data area of the new version file to be upgraded different from the old version file.
4. The method of claim 1, wherein generating the differential upgrade package comprises:
obtaining a differential upgrade package based on a bsdiff algorithm, comprising:
reading firmware information of an old version of file before upgrading, and performing dictionary training on suffixes of the firmware information to obtain a suffix sequencing array;
traversing the new version file to be upgraded based on the suffix sorting array, and positioning the completely same sequence between the new version file to be upgraded and the old version file before upgrading;
and taking the completely same sequence as a reference, expanding two ends of the reference in the new edition file according to a fixed region range, and storing a region into a differential upgrade package of the file to be upgraded correspondingly when the region which is not matched with the old edition file is identified until all the new edition files are traversed by expansion to obtain the differential upgrade package.
5. The method of claim 1, wherein the optimized bsdiff algorithm is:
reordering the operation sequence in the original bsdiff algorithm according to a preset directed graph and topological ordering; the reordering rule is as follows:
sequencing the operation sequence without read-write conflict, and then sequencing the operation sequence with read-write conflict;
directly carrying out corresponding operation processing on the operation sequence without read-write conflict;
and adding a file pointer to control operation processing to the operation sequence with read-write conflict.
6. The method of claim 5, wherein the file pointer control operation processing comprises:
determining the pointed position of the current file pointer, copying a preset number of bytes from the pointed position to a memory, and adding a field for recording the pointed position in front of a data packet of an old version of file;
adding or inserting the bytes of the preset number of copied bytes and the differential upgrade package at the pointed position of the old version file to finish a new file fragment updating step, and performing a file pointer offset step according to a file pointer offset rule;
and repeating the new file fragment updating step and the file pointer offsetting step until the file pointer traverses the file, and finishing the updating of the operation sequence of the differential upgrade package.
7. The method of claim 1, wherein the determining an upgrade result comprises:
acquiring version identity information of an old version file;
after the communication module is upgraded, acquiring the identity information of the upgraded version file;
and comparing the identity information of the old version file with the identity information of the version file after the upgrade is finished, and if the identity information of the old version file is different from the identity information of the version file after the upgrade is finished, judging that the upgrade result is the upgrade success.
8. The method of claim 1, wherein the determining an upgrade result comprises:
after the communication module is upgraded, acquiring the identity information of the upgraded version file;
and comparing the identity information of the upgraded version file with the identity information of the preset new version file, and if the identity information of the upgraded version file is the same as the identity information of the preset new version file, judging that the upgrade result is successful.
9. The method of claim 1, further comprising:
when the upgrading result is judged to be upgrading failure, the differential upgrading operation is executed again;
and if the upgrade is still judged to be failed after the differential upgrade for the preset times, outputting alarm information.
10. A communication module remote upgrade system, the system comprising:
the generating unit is used for responding to the upgrading instruction and generating a differential upgrading packet;
the processing unit is used for reordering the operation sequence of the differential upgrade package based on the optimized bsdiff algorithm;
the updating unit is used for carrying out differential updating on the original firmware in the communication module through the reordered differential updating packet, and judging an updating result after the differential updating is finished;
and the transmission unit is used for reporting an upgrade completion confirmation signal after the upgrade result is that the upgrade is successful.
11. The system of claim 10, wherein the generating the differential upgrade package comprises:
obtaining a differential upgrade package based on a bsdiff algorithm, comprising:
reading firmware information of an old version of file before upgrading, and performing dictionary training on suffixes of the firmware information to obtain a suffix sequencing array;
traversing the new version file to be upgraded based on the suffix sorting array, and positioning a sequence of the new version file to be upgraded and the old version file before upgrading which are completely the same;
and expanding the files at two ends of the reference in the new edition file according to the fixed region range by taking the completely same sequence as the reference, and correspondingly storing the region into a differential upgrade package of the file to be upgraded when a region which is not matched with the old edition file is identified until the expansion traverses all the new edition files to obtain the differential upgrade package.
12. The system of claim 10, wherein said determining an upgrade result comprises:
acquiring version identity information of an old version file;
after the communication module is upgraded, acquiring the identity information of the upgraded version file;
and comparing the identity information of the old version file with the identity information of the version file after the upgrade is finished, and if the identity information of the old version file is different from the identity information of the version file after the upgrade is finished, judging that the upgrade result is the upgrade success.
13. The system of claim 10, wherein said determining an upgrade result comprises:
after the communication module is upgraded, acquiring the identity information of the upgraded version file;
and comparing the identity information of the upgraded version file with the identity information of the preset new version file, and if the identity information of the upgraded version file is the same as the identity information of the preset new version file, judging that the upgrade result is successful.
14. The system of claim 10, wherein the update unit is further configured to:
when the upgrading result is judged to be upgrading failure, the differential upgrading operation is executed again;
and if the upgrade is still judged to be failed after the differential upgrade of the preset times is carried out again, generating alarm information.
15. The system of claim 14, further comprising:
and the alarm unit is used for outputting the alarm information.
16. A computer-readable storage medium having instructions stored thereon, which when executed on a computer, cause the computer to perform the method of remote upgrade of a communication module according to any of claims 1-9.
CN202210413878.2A 2022-04-20 2022-04-20 Remote upgrading method and system for communication module Pending CN114518897A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210413878.2A CN114518897A (en) 2022-04-20 2022-04-20 Remote upgrading method and system for communication module

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210413878.2A CN114518897A (en) 2022-04-20 2022-04-20 Remote upgrading method and system for communication module

Publications (1)

Publication Number Publication Date
CN114518897A true CN114518897A (en) 2022-05-20

Family

ID=81600276

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210413878.2A Pending CN114518897A (en) 2022-04-20 2022-04-20 Remote upgrading method and system for communication module

Country Status (1)

Country Link
CN (1) CN114518897A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115242633A (en) * 2022-06-23 2022-10-25 惠州华阳通用电子有限公司 Vehicle-mounted equipment upgrading method and device based on USB Ethernet
CN116302030A (en) * 2023-03-09 2023-06-23 上海对外经贸大学 Safe embedded system firmware block differential upgrading method and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111258620A (en) * 2018-11-30 2020-06-09 中兴通讯股份有限公司 Method, device and equipment for generating differential upgrade package
CN113094077A (en) * 2019-12-23 2021-07-09 深圳Tcl数字技术有限公司 System differential upgrading method and device, intelligent terminal and storage medium
CN113495735A (en) * 2021-06-30 2021-10-12 东风商用车有限公司 Upgrade package installation method, device, equipment and readable storage medium
WO2022048511A1 (en) * 2020-09-02 2022-03-10 上海飞奥燃气设备有限公司 Differential upgrade method for intelligent gas meter firmware
CN114356386A (en) * 2021-12-28 2022-04-15 杭州涂鸦信息技术有限公司 Block differential upgrading method, terminal equipment and computer readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111258620A (en) * 2018-11-30 2020-06-09 中兴通讯股份有限公司 Method, device and equipment for generating differential upgrade package
CN113094077A (en) * 2019-12-23 2021-07-09 深圳Tcl数字技术有限公司 System differential upgrading method and device, intelligent terminal and storage medium
WO2022048511A1 (en) * 2020-09-02 2022-03-10 上海飞奥燃气设备有限公司 Differential upgrade method for intelligent gas meter firmware
CN113495735A (en) * 2021-06-30 2021-10-12 东风商用车有限公司 Upgrade package installation method, device, equipment and readable storage medium
CN114356386A (en) * 2021-12-28 2022-04-15 杭州涂鸦信息技术有限公司 Block differential upgrading method, terminal equipment and computer readable storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
不上班行不行: "bsdiff差分算法", 《HTTPS://WWW.CNBLOGS.COM/STARTKEY/P/10678173.HTML》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115242633A (en) * 2022-06-23 2022-10-25 惠州华阳通用电子有限公司 Vehicle-mounted equipment upgrading method and device based on USB Ethernet
CN115242633B (en) * 2022-06-23 2024-04-09 惠州华阳通用电子有限公司 Vehicle-mounted equipment upgrading method and device based on USB Ethernet
CN116302030A (en) * 2023-03-09 2023-06-23 上海对外经贸大学 Safe embedded system firmware block differential upgrading method and system

Similar Documents

Publication Publication Date Title
CN111212121B (en) Aerial firmware upgrading method and system for Internet of things equipment
CN114518897A (en) Remote upgrading method and system for communication module
US11531535B2 (en) Firmware upgrade method and apparatus, and terminal
CN109284073B (en) Data storage method, device, system, server, control node and medium
CN107820603A (en) A kind of firmware update and controller
CN103875229A (en) Asynchronous replication method, device and system
US10469620B2 (en) Method for transferring a new software version to at least one electricity meter via a communication network
CN101984406A (en) Method and system for upgrading terminal through wireless local area network
CN113721967A (en) Differential packet generation method, differential packet generation device, and upgrade method
CN105450682A (en) Method, device, and system for data synchronous storage and synchronizing data to client
CN108664255B (en) Software upgrading method and device
CN113282250B (en) Method, device and equipment for cloud volume expansion and readable medium
CN113315797A (en) Method, system and node for remote upgrading of local area network in batches
CN113986313A (en) Software upgrading method and device, electronic equipment and storage medium
CN113641676A (en) Time sequence processing method and device
CN114265613A (en) Method and system for differentially upgrading firmware of all electric control units of whole vehicle
CN117201038A (en) Data transmission verification method, system, electronic equipment and storage medium
CN113112786B (en) Multi-data reading method, medium and electronic equipment for ammeter
CN112231150B (en) Method and device for recovering fault database in database cluster
CN108874592B (en) Data cold standby method and system for Log-structured storage engine
CN114968963A (en) File overwriting method and device and electronic equipment
CN111221556B (en) Remote upgrade RSU mirror image method and system
CN113535482A (en) Cloud backup chain data backup and management method and device, equipment and readable medium
CN114579662A (en) Memory database synchronization method, system, equipment and storage medium
Zhen et al. Research on lightweight firmware update method of distribution IoT terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination