Firmware upgrading method and device for power end edge equipment, equipment and medium
By setting different data comparison methods for the firmware file hierarchy of the power end edge device, differential firmware packages are generated, which solves the problem of excessive traditional firmware update packages and achieves more efficient firmware upgrades.
Patent Information
- Application Number
- CN202411860127.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-12-17
AI Technical Summary
The firmware update package of traditional power end-edge devices is too large, resulting in long transmission and deployment time, occupies a large amount of network bandwidth and storage space, and unnecessary update modules waste resources.
By setting different data comparison methods for the hierarchy to which different firmware files belong, differential firmware packages are generated and device firmware upgrades are performed based on differential firmware packages.
Reduces the volume of the update package, saves network bandwidth and storage space, and improves firmware upgrade efficiency.
Smart Images

Figure CN119718394A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of equipment updating, and in particular to a method, device, equipment and medium for upgrading the firmware of an electric power terminal device. Background Art
[0002] As power edge devices (such as smart meters, distribution terminals, automated switches, etc.) become increasingly intelligent and networked, firmware updates have become an important means of equipment maintenance and function expansion.
[0003] In traditional power edge devices, firmware updates usually need to be pushed through the complete firmware package provided by the device manufacturer. The entire firmware package may contain all functional modules of the device (such as operating system, application, driver, configuration file, etc.), but the actual upgrade requirements of the device often only require the optimization or repair of certain functional modules, which leads to the following problems:
[0004] 1. The update package is too large: Since the update package is usually a complete firmware package, it takes a long time to transmit and deploy, and may occupy a lot of network bandwidth and storage space;
[0005] 2. Unnecessary updates: Some modules or functions in the device have not changed in this update, but these modules are still included in the update package, resulting in a waste of bandwidth and storage. Summary of the invention
[0006] The present invention provides a method, apparatus, device and medium for firmware upgrade of power edge equipment, which can set different data comparison modes for the hierarchical structures to which different firmware files belong, and perform device firmware upgrade based on the differential firmware package determined by file data comparison, thereby reducing the size of the update package, saving network bandwidth and storage space, and improving the efficiency of firmware upgrade.
[0007] According to one aspect of the present invention, a method for upgrading the firmware of a power edge device is provided, the method comprising:
[0008] Obtaining a current firmware file and an upgrade firmware package of a target device, and determining a file type of each upgrade firmware file in the current firmware file and the upgrade firmware package;
[0009] Determine the hierarchical structure to which the current firmware file and the upgraded firmware file belong according to the file type and the file content; wherein the hierarchical structure includes a core layer, a configuration layer, and an application layer;
[0010] Determine a data comparison method for the hierarchical structure, and compare the current firmware file and the upgrade firmware file under the hierarchical structure based on the data comparison method to obtain firmware difference information;
[0011] A differential firmware package is generated according to the firmware difference information, and the firmware of the target device is upgraded based on the differential firmware package.
[0012] According to another aspect of the present invention, a device for upgrading the firmware of a power edge device is provided, the device comprising:
[0013] A file type determination module, used to obtain the current firmware file and the upgrade firmware package of the target device, and determine the file type of each upgrade firmware file in the current firmware file and the upgrade firmware package;
[0014] A hierarchical structure determination module, used to determine the hierarchical structure to which the current firmware file and the upgrade firmware file belong according to the file type and the file content; wherein the hierarchical structure includes a core layer, a configuration layer and an application layer;
[0015] A file comparison module, used for determining a data comparison method of the hierarchical structure, and comparing the current firmware file and the upgrade firmware file under the hierarchical structure based on the data comparison method to obtain firmware difference information;
[0016] The firmware upgrade module is used to generate a differential firmware package according to the firmware difference information, and perform firmware upgrade on the target device based on the differential firmware package.
[0017] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0018] at least one processor; and,
[0019] a memory communicatively connected to the at least one processor; wherein,
[0020] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the firmware upgrade method for the power edge device described in any embodiment of the present invention.
[0021] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the firmware upgrade method for the power edge device described in any embodiment of the present invention when executed.
[0022] The technical solution of the embodiment of the present invention obtains the current firmware file and the upgrade firmware package of the target device, determines the file type of each upgrade firmware file in the current firmware file and the upgrade firmware package; determines the hierarchical structure to which the current firmware file and the upgrade firmware file belong according to the file type and file content; wherein the hierarchical structure includes a core layer, a configuration layer, and an application layer; determines the data comparison method of the hierarchical structure, compares the current firmware file and the upgrade firmware file under the hierarchical structure based on the data comparison method to obtain firmware difference information; generates a differential firmware package according to the firmware difference information, and performs firmware upgrade on the target device based on the differential firmware package. This technical solution can set different data comparison methods for the hierarchical structures to which different firmware files belong, and perform device firmware upgrade based on the differential firmware package determined by file data comparison, thereby reducing the size of the update package, saving network bandwidth and storage space, and improving the efficiency of firmware upgrade.
[0023] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0025] Figure 1 This is a flowchart of a method for upgrading the firmware of a power edge device provided according to the first embodiment of the present invention;
[0026] Figure 2 This is a flowchart of a method for upgrading the firmware of a power edge device provided according to the second embodiment of the present invention;
[0027] Figure 3 This is a flowchart of a method for upgrading the firmware of a power edge device provided according to Embodiment 3 of the present invention;
[0028] Figure 4 2 is a schematic diagram of a firmware upgrade device for a power edge device according to a fourth embodiment of the present invention;
[0029] Figure 5 It is a structural schematic diagram of an electronic device for implementing a firmware upgrade method for a power edge device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0030] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0031] It should be noted that the terms "first", "second", "target", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0032] Embodiment 1
[0033] Figure 1 This is a flowchart of a method for upgrading the firmware of a power edge device provided in the first embodiment of the present invention. This embodiment can be applied to the case of efficiently and accurately upgrading the firmware of the power edge device. The method can be executed by a firmware upgrade device of the power edge device. The firmware upgrade device of the power edge device can be implemented in the form of hardware and / or software. The firmware upgrade device of the power edge device can be configured in an electronic device with data processing capabilities. Figure 1 As shown, the method includes:
[0034] S110, obtaining a current firmware file and an upgrade firmware package of a target device, and determining a file type of each upgrade firmware file in the current firmware file and the upgrade firmware package.
[0035] Among them, the target device may refer to an electric power end-side device that needs to perform a firmware upgrade. Exemplarily, the target device may be a smart meter, a distribution terminal, an automatic switch, etc. The current firmware file may refer to a firmware file under the current version. The upgrade firmware package may refer to a firmware package corresponding to the upgrade version, and the upgrade firmware package includes multiple upgrade firmware files. Exemplarily, file types may include binary files (such as firmware core code, drivers, etc.), text files (such as configuration files, log files, version description files, etc.) and database files (such as system configuration or device-specific database files, etc.).
[0036] In this embodiment, the current firmware file and the upgrade firmware package of the target device are first obtained. Among them, the upgrade firmware package is usually in a compressed format (such as ZIP or a compression format of a specific manufacturer), so it is necessary to use a suitable decompression algorithm to parse the upgrade firmware package to obtain multiple upgrade firmware files. Exemplarily, a standard decompression library, such as 7z, unzip, tar, etc., or a dedicated decompression tool for the manufacturer's firmware can be used to parse the upgrade firmware package. After obtaining the current firmware file of the target device and each upgrade firmware file in the upgrade firmware package, the current firmware file and the upgrade firmware file can be respectively identified by file type to obtain the file type of the current firmware file and the upgrade firmware file. Exemplarily, a file type identification tool (such as the file command) can be used or file type identification can be performed by file extension.
[0037] S120, determining the hierarchical structure to which the current firmware file and the upgrade firmware file belong according to the file type and the file content.
[0038] In this embodiment, after determining the file types of the current firmware file and the upgrade firmware file, it is possible to determine to which hierarchical structure the current firmware file and the upgrade firmware file belong according to the file type and the file content. The hierarchical structure may include a core layer, a configuration layer, and an application layer. Exemplarily, the core layer may include an operating system kernel, a driver, important system service files, etc.; the configuration layer may include device configuration files, initialization scripts, etc.; the application layer may include log files, user settings, database files, etc. Specifically, a preliminary division of the hierarchical structure may be performed based on the firmware file name or directory structure, or analysis may be performed in combination with the file content (for example, automatic classification based on file header information or features).
[0039] Further, after determining the hierarchical structure to which the current firmware file and the upgrade firmware file belong, a difference data model can be constructed to provide a data basis for subsequent multi-level comparison. Exemplarily, the difference features between each hierarchical structure can be captured by generating summary information and metadata of the upgrade firmware package, and a difference data model can be constructed based on the difference features. Specifically, first, for each hierarchical structure, a hash algorithm (such as SHA256, MD5) can be used to generate a summary of the file to help the subsequent comparison process efficiently locate the difference. Among them, tools such as sha256sum and md5sum can be used to generate hash values. Then generate basic information (i.e., metadata) for each file, such as file size, modification date, file type, data content, etc. These metadata can provide necessary auxiliary information for subsequent difference feature analysis, such as combining metadata of the file system, or custom scripts to analyze file features. Then, the data of each file is standardized to conform to a unified standard format (such as JSON, XML, Protobuf, etc.), and the standardized data is stored in a database or file system for subsequent calls and updates. The database may use a relational database (such as MySQL, PostgreSQL) or a NoSQL database (such as MongoDB) to store the standardized processing results.
[0040] S130, determining a data comparison method of the hierarchical structure, and comparing the current firmware file and the upgrade firmware file under the hierarchical structure based on the data comparison method to obtain firmware difference information.
[0041] It should be noted that the update frequency and importance corresponding to different hierarchical structures are different. Therefore, when performing data comparison of firmware files, different comparison granularities can be used according to the characteristics of different hierarchical structures. Exemplarily, the priority of each hierarchical structure can be determined according to the update frequency and importance of each hierarchical structure, and then different comparison granularities can be set for each hierarchical structure according to the priority, and then the data comparison method of each hierarchical structure is determined based on the comparison granularity. For example, for the core layer, its update frequency is low and its importance is high, corresponding to a high priority, so it is necessary to adopt a finer comparison granularity, pay attention to the slight changes in the file content, to ensure the stability of the core component, and a byte-level comparison method can be used at this time; for the configuration layer, its update frequency and importance are medium, corresponding to a medium priority, so a medium comparison granularity can be used, only comparing the content differences of the files, and an incremental comparison method can be used at this time; for the application layer, its update frequency is high and its importance is low, corresponding to a low priority, so a coarser comparison granularity can be used, mainly focusing on newly added files and large file changes, avoiding large-scale comparisons, and a hash comparison method (comparison based on hash value calculation) can be used at this time. The hash value is calculated as follows:
[0042] H new =Hash(new file); H old =Hash(old file).
[0043] Among them, H new and H old Respectively, they represent the contents of the upgraded firmware file and the current firmware file, and the hash value of a fixed length is calculated through a hash algorithm (such as SHA-256, etc.); Hash(file) means converting the file content into a fixed-length value through hash calculation as the unique identifier of the file. It should be noted that if any changes occur to the firmware file, the hash value will also change accordingly. In other words, different firmware files will generate different hash values, and any modification to the firmware file content will cause the hash value to change. Therefore, if H new With H old If they are different, it means that the firmware file has changed.
[0044] In this embodiment, after determining the data comparison method of different hierarchical structures, the current firmware file and the upgraded firmware file under the corresponding hierarchical structure can be compared based on the data comparison method to obtain firmware difference information. Among them, the firmware difference information can be used to describe the data difference between the current firmware file and the upgraded firmware file. It should be noted that, unlike the traditional full comparison method, this solution adopts multi-level intelligent comparison technology, sets different comparison granularities for different hierarchical structures, and performs data comparison between the current firmware file and the upgraded firmware file according to the data comparison method determined based on the comparison granularity, thereby reducing unnecessary calculations and effectively improving the efficiency of file comparison.
[0045] S140: Generate a differential firmware package according to the firmware difference information, and perform firmware upgrade on the target device based on the differential firmware package.
[0046] In this embodiment, after obtaining the firmware difference information, a compression algorithm (such as LZ4, Zlib, etc.) can be used to compress the file corresponding to the firmware difference information to generate a differential firmware package, thereby reducing the amount of data transmission. After the differential firmware package is generated, the differential firmware package can be transmitted to the target device, and after the target device successfully receives the differential firmware package, the differential firmware package is decompressed and synthesized to finally complete the firmware upgrade of the target device. Furthermore, a suitable differential firmware package transmission method can also be set based on the network status of the target device. Exemplarily, for a large-scale device group, a segmented transmission mechanism can be used to divide a large file into multiple small files for transmission to avoid network congestion caused by excessive transmission at one time; when the network is unstable, the breakpoint resumption of the differential firmware package can be supported to ensure that the target device can resume the normal upgrade process even if it is disconnected midway.
[0047] The technical solution of the embodiment of the present invention obtains the current firmware file and the upgrade firmware package of the target device, determines the file type of each upgrade firmware file in the current firmware file and the upgrade firmware package; determines the hierarchical structure to which the current firmware file and the upgrade firmware file belong according to the file type and file content; wherein the hierarchical structure includes a core layer, a configuration layer, and an application layer; determines the data comparison method of the hierarchical structure, compares the current firmware file and the upgrade firmware file under the hierarchical structure based on the data comparison method to obtain firmware difference information; generates a differential firmware package according to the firmware difference information, and performs firmware upgrade on the target device based on the differential firmware package. This technical solution can set different data comparison methods for the hierarchical structures to which different firmware files belong, and perform device firmware upgrade based on the differential firmware package determined by file data comparison, thereby reducing the size of the update package, saving network bandwidth and storage space, and improving the efficiency of firmware upgrade.
[0048] In this embodiment, optionally, after performing a firmware upgrade on the target device based on the differential firmware package, it also includes: determining a firmware upgrade result of the target device; wherein the firmware upgrade result includes an upgrade success or an upgrade failure; if the firmware upgrade result is an upgrade failure, determining the firmware file that failed to upgrade as the target firmware file; and performing a rollback operation on the target firmware file based on the hierarchical structure to which the target firmware file belongs.
[0049] It should be noted that if an abnormal situation occurs in the target device during the upgrade process (such as a failure or failure to start normally, etc.), the firmware upgrade will fail, thereby affecting the normal operation of the target device. Therefore, when it is determined that the firmware upgrade result of the target device is an upgrade failure, it can be set to automatically roll back to the last stable version to ensure that the operation of the target device is not affected. Specifically, the firmware file that failed to upgrade is first determined as the target firmware file, and then the hierarchical structure to which the target firmware file belongs is determined, and then the target firmware file is rolled back based on the hierarchical structure to which the target firmware file belongs. Exemplarily, for low-risk hierarchical structures such as configuration layers (such as configuration files, etc.) and application layers (such as log files, etc.), only the corresponding files need to be rolled back; while for high-risk hierarchical structures such as core layers (such as core components or drivers), a comprehensive rollback is required to ensure the stable operation of the target device.
[0050] Through such a setting, when the firmware upgrade fails, the solution performs a rollback operation on the firmware file that failed to upgrade based on the corresponding hierarchical structure, thereby ensuring the normal and stable operation of the target device.
[0051] Embodiment 2
[0052] Figure 2A flowchart of a method for upgrading the firmware of a power edge device provided in the second embodiment of the present invention, this embodiment is optimized based on the above embodiment. The specific optimization is: determining the data comparison method of the hierarchical structure, including: obtaining the hardware performance information and historical upgrade information of the target device, determining the update frequency and importance of the hierarchical structure; performing weighted summation of the hardware performance information, historical upgrade information, update frequency and importance to obtain a comparison granularity score; determining the data comparison method of the hierarchical structure according to the comparison granularity score and a preset threshold.
[0053] like Figure 2 As shown, the method of this embodiment specifically includes the following steps:
[0054] S210, obtaining a current firmware file and an upgrade firmware package of a target device, and determining a file type of each upgrade firmware file in the current firmware file and the upgrade firmware package.
[0055] S220: Determine the hierarchical structure to which the current firmware file and the upgrade firmware file belong according to the file type and the file content.
[0056] Among them, the hierarchical structure includes the core layer, configuration layer and application layer.
[0057] S230, obtaining hardware performance information and historical upgrade information of the target device, and determining the update frequency and importance of the hierarchical structure.
[0058] Among them, the hardware performance information may include CPU, memory, and storage, etc. The historical upgrade information can be used to describe the historical behavior of the target device in the previous firmware upgrade process, which may specifically include failure information, success information, and fault information, etc. Among them, the importance of the hierarchy can be determined by the target device's dependence on the hierarchy, such as the core layer is more important than the application layer. It should be noted that this solution adopts an intelligent optimization comparison method, which can automatically select the most appropriate comparison method based on the hardware performance information and historical upgrade information of the target device and the update frequency and importance of the hierarchy, thereby reducing unnecessary comparison operations and improving comparison efficiency.
[0059] S240, performing weighted summation on the hardware performance information, historical upgrade information, update frequency and importance to obtain a comparison granularity score.
[0060] Exemplarily, the comparison particle size score can be determined using the following formula:
[0061] S compare =ω 1 Update Frequency+ω 2 Module Importance+ω 3 DevicePerformance+ω4 Historical Behavior;
[0062] Among them, S compare Indicates the comparison granularity score, Update Frequency indicates the update frequency of the hierarchy; Module Importance indicates the importance of the hierarchy; Device Performance indicates the hardware performance information of the target device; Historical Behavior indicates the historical upgrade information of the target device; ω 1 ,ω 2 ,ω 3 ,ω 4 They respectively represent different weight factors pre-set based on historical experience.
[0063] S250, determining a hierarchical data comparison method according to the comparison granularity score and a preset threshold.
[0064] The preset threshold value may refer to a comparison granularity score reference value preset according to actual needs, which may serve as an important basis for determining the data comparison method of different hierarchical structures. For example, if the calculated comparison granularity score is greater than or equal to the preset threshold value, a more refined data comparison method (such as byte-level comparison) may be selected as the data comparison method of the hierarchical structure; if the calculated comparison granularity score is less than the preset threshold value, a coarser data comparison method (such as incremental comparison or hash comparison) may be selected as the data comparison method of the hierarchical structure.
[0065] In this embodiment, optionally, the preset threshold includes a first threshold and a second threshold, and the first threshold is greater than the second threshold; the data comparison method of the hierarchical structure is determined according to the comparison granularity score and the preset threshold, including: if the comparison granularity score is greater than or equal to the first threshold, then the data comparison method of the hierarchical structure is determined to be byte-level comparison; if the comparison granularity score is greater than or equal to the second threshold and less than the first threshold, then the data comparison method of the hierarchical structure is determined to be incremental comparison; if the comparison granularity score is less than the second threshold, then the data comparison method of the hierarchical structure is determined to be hash comparison.
[0066] For example, assuming that the comparison granularity score is S compare The first threshold and the second threshold are T high and T low , then:
[0067] If S compare ≥T high :Data comparison using byte-level comparison is suitable for situations with high importance, high update frequency and good device performance. At this time, the most sophisticated comparison strategy is needed to compare the differences of each byte.
[0068] If T low ≤S compare <T high :Incremental comparison is a data comparison method that is suitable for low-performance devices or medium-frequency updates. Incremental comparison reduces resource consumption by comparing only the modified or newly added parts.
[0069] If S compare <T low :Data comparison method using hash comparison, suitable for situations where device performance is low and update frequency is low. Hash comparison is a fast and efficient comparison method suitable for most situations.
[0070] S260: Compare the current firmware file and the upgrade firmware file in the hierarchical structure based on a data comparison method to obtain firmware difference information.
[0071] S270: Generate a differential firmware package according to the firmware difference information, and perform firmware upgrade on the target device based on the differential firmware package.
[0072] The technical solution of the embodiment of the present invention, when determining the data comparison method of the hierarchical structure, first obtains the hardware performance information and historical upgrade information of the target device, determines the update frequency and importance of the hierarchical structure; then performs weighted summation on the hardware performance information, historical upgrade information, update frequency and importance to obtain a comparison granularity score; and then determines the data comparison method of the hierarchical structure based on the comparison granularity score and a preset threshold. This technical solution comprehensively considers the hardware performance and historical information of the device and the update frequency and importance of the hierarchical structure to determine the data comparison method of the hierarchical structure, and can determine the appropriate data comparison method for different device performance and hierarchical structure characteristics, while ensuring the accuracy of data comparison, effectively improving the efficiency of data comparison.
[0073] Embodiment 3
[0074] Figure 3 A flowchart of a method for upgrading the firmware of a power edge device provided in the third embodiment of the present invention is provided. This embodiment is optimized based on the above embodiment. The specific optimization is as follows: generating a differential firmware package according to the firmware difference information, including: obtaining the storage capacity information, hardware performance information and network bandwidth information of the target device; determining the target file size according to the storage capacity information, hardware performance information and network bandwidth information; compressing the file corresponding to the firmware difference information according to the target file size to obtain a differential firmware package.
[0075] like Figure 3 As shown, the method of this embodiment specifically includes the following steps:
[0076] S310, obtaining a current firmware file and an upgrade firmware package of a target device, and determining a file type of each upgrade firmware file in the current firmware file and the upgrade firmware package.
[0077] S320: Determine the hierarchical structure to which the current firmware file and the upgrade firmware file belong according to the file type and the file content.
[0078] Among them, the hierarchical structure includes the core layer, configuration layer and application layer.
[0079] S330, determining a data comparison method of the hierarchical structure, and comparing the current firmware file and the upgrade firmware file under the hierarchical structure based on the data comparison method to obtain firmware difference information.
[0080] S340, obtaining storage capacity information, hardware performance information, and network bandwidth information of the target device.
[0081] It should be noted that for different types of devices, the existing technology usually adopts a fixed firmware package update strategy, which cannot be flexibly adjusted according to the device hardware and network conditions (poor flexibility), which easily causes device performance bottlenecks or upgrade failures due to insufficient hardware resources. This solution can generate a suitable differential firmware package based on the hardware, network, storage and other characteristics of the device to ensure the efficiency of the differential firmware package in transmission and storage, and can adapt to the upgrade needs of different devices.
[0082] S350, determining the target file size according to the storage capacity information, the hardware performance information and the network bandwidth information.
[0083] Specifically, the target file size can be expressed as follows: Optimal Package Size = f(DeviceStorage, Device Pefrormance, Network Bandwidth). Among them, Optimal Package Size represents the target file size; Device Storage represents the storage capacity of the target device, which affects the maximum size of the differential firmware package; Device Pefrormance represents the hardware performance of the target device; Network Bandwidth represents the network bandwidth of the target device, which affects the transmission efficiency of the differential firmware package. Devices with lower bandwidth require smaller differential firmware packages to reduce the time and resource consumption of data transmission. Exemplarily, for target devices with smaller storage capacity, a differential firmware package with a smaller size and higher compression ratio can be generated; for target devices with lower network bandwidth, a differential firmware package with a higher compression ratio can be generated, thereby reducing the time and resource consumption of data transmission; for target devices with lower hardware performance, a smaller differential firmware package is required or a differential firmware package with a higher compression ratio is selected to reduce the computational burden.
[0084] In this embodiment, optionally, the target file size is determined based on the storage capacity information, hardware performance information and network bandwidth information, including: determining a first parameter based on the product of a preset weight factor and the hardware performance information; determining a second parameter based on the difference between the storage capacity information and the first parameter; determining a third parameter based on the ratio of the second parameter to the hardware performance information; determining a fourth parameter based on the inverse of the network bandwidth information, and determining the target file size based on the product of the third parameter and the fourth parameter.
[0085] Exemplarily, the target file size can be expressed as follows: Wherein, ω represents a preset weight factor, ω·Device Performance represents a first parameter, and Device Storage-ω·Device Performance represents a second parameter. Represents the third parameter, Indicates the fourth parameter.
[0086] S360, compressing the file corresponding to the firmware difference information according to the target file size to obtain a differential firmware package.
[0087] S370: Perform firmware upgrade on the target device based on the differential firmware package.
[0088] The technical solution of the embodiment of the present invention, when generating a differential firmware package according to the firmware difference information, first obtains the storage capacity information, hardware performance information and network bandwidth information of the target device; then determines the target file size according to the storage capacity information, hardware performance information and network bandwidth information; and then compresses the file corresponding to the firmware difference information according to the target file size to obtain the differential firmware package. This technical solution can generate a suitable differential firmware package based on the hardware, network, storage and other characteristics of the device, ensures the high efficiency of the differential firmware package in transmission and storage, improves the flexibility of firmware updates, and can adapt to the upgrade requirements of different devices.
[0089] In this embodiment, optionally, after determining the target file size based on the storage capacity information, the hardware performance information and the network bandwidth information, it also includes: determining the target compression ratio based on the file size corresponding to the firmware difference information and the target file size; updating the target file size according to the target compression ratio; accordingly, compressing the file corresponding to the firmware difference information according to the target file size to obtain a differential firmware package, including: compressing the file corresponding to the firmware difference information according to the updated target file size to obtain a differential firmware package.
[0090] Exemplarily, the target compression ratio may be determined based on the following formula:
[0091]
[0092] Among them, Compression Ratio represents the target compression ratio; Size original Indicates the file size corresponding to the firmware difference information; Size Compressed Indicates the target file size. Further, the updated target file size can be expressed as follows:
[0093]
[0094] Through such a setting, this solution further reduces the size of the differential firmware package based on the hardware, network, storage and other characteristics of the device in combination with a compression algorithm, thereby further improving the efficiency of the differential firmware package in transmission and storage.
[0095] Embodiment 4
[0096] Figure 4 This is a schematic diagram of the structure of a firmware upgrade device for a power edge device provided in the fourth embodiment of the present invention. The device can execute the firmware upgrade method for a power edge device provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. Figure 4 As shown, the device comprises:
[0097] The file type determination module 410 is used to obtain the current firmware file and the upgrade firmware package of the target device, and determine the file type of each upgrade firmware file in the current firmware file and the upgrade firmware package;
[0098] A hierarchical structure determination module 420, configured to determine the hierarchical structure to which the current firmware file and the upgrade firmware file belong according to the file type and the file content; wherein the hierarchical structure includes a core layer, a configuration layer, and an application layer;
[0099] A file comparison module 430 is used to determine a data comparison method for the hierarchical structure, and compare the current firmware file and the upgrade firmware file under the hierarchical structure based on the data comparison method to obtain firmware difference information;
[0100] The firmware upgrade module 440 is used to generate a differential firmware package according to the firmware difference information, and perform firmware upgrade on the target device based on the differential firmware package.
[0101] Optionally, the file comparison module 430 includes:
[0102] A device and hierarchical structure information determination unit, used to obtain hardware performance information and historical upgrade information of the target device, and determine the update frequency and importance of the hierarchical structure;
[0103] A comparison granularity score determination unit, configured to perform a weighted summation on the hardware performance information, the historical upgrade information, the update frequency, and the importance to obtain a comparison granularity score;
[0104] A data comparison method determination unit is used to determine the data comparison method of the hierarchical structure according to the comparison granularity score and a preset threshold.
[0105] Optionally, the preset threshold includes a first threshold and a second threshold, and the first threshold is greater than the second threshold;
[0106] The data comparison mode determination unit is specifically used for:
[0107] If the comparison granularity score is greater than or equal to the first threshold, determining that the data comparison method of the hierarchical structure is byte-level comparison;
[0108] If the comparison granularity score is greater than or equal to the second threshold and less than the first threshold, determining that the data comparison mode of the hierarchical structure is incremental comparison;
[0109] If the comparison granularity score is less than the second threshold, it is determined that the data comparison method of the hierarchical structure is hash comparison.
[0110] Optionally, the firmware upgrade module 440 includes:
[0111] A device information acquisition unit, used to acquire storage capacity information, hardware performance information and network bandwidth information of the target device;
[0112] a target file size determining unit, configured to determine a target file size according to the storage capacity information, the hardware performance information and the network bandwidth information;
[0113] The file compression unit is used to compress the file corresponding to the firmware difference information according to the target file size to obtain a differential firmware package.
[0114] Optionally, the target file size determination unit is specifically used to:
[0115] Determine a first parameter according to the product of a preset weight factor and the hardware performance information;
[0116] Determine a second parameter according to a difference between the storage capacity information and the first parameter;
[0117] Determine a third parameter according to a ratio of the second parameter to the hardware performance information;
[0118] The fourth parameter is determined according to the inverse of the network bandwidth information, and the target file size is determined according to the product of the third parameter and the fourth parameter.
[0119] Optionally, the firmware upgrade module 440 further includes:
[0120] a target compression ratio determination unit, configured to determine a target compression ratio according to a file size corresponding to the firmware difference information and the target file size after determining a target file size according to the storage capacity information, the hardware performance information and the network bandwidth information;
[0121] A target file size updating unit, used for updating the target file size according to the target compression ratio;
[0122] Accordingly, the file compression unit is used to:
[0123] The file corresponding to the firmware difference information is compressed according to the updated target file size to obtain a differential firmware package.
[0124] Optionally, the device further includes: a firmware upgrade failure processing module, configured to:
[0125] After performing a firmware upgrade on the target device based on the differential firmware package, determining a firmware upgrade result of the target device; wherein the firmware upgrade result includes an upgrade success or an upgrade failure;
[0126] If the firmware upgrade result is an upgrade failure, the firmware file that failed to upgrade is determined as the target firmware file;
[0127] Based on the hierarchical structure to which the target firmware file belongs, a rollback operation is performed on the target firmware file.
[0128] A firmware upgrade device for an electric power edge device provided in an embodiment of the present invention can execute a firmware upgrade method for an electric power edge device provided in any embodiment of the present invention, and has functional modules and beneficial effects corresponding to the execution method.
[0129] Embodiment 5
[0130] Figure 5 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0131] like Figure 5 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0132] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0133] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 11 executes the various methods and processes described above, such as a firmware upgrade method for a power edge device.
[0134] In some embodiments, the firmware upgrade method of the power edge device can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the firmware upgrade method of the power edge device described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to execute the firmware upgrade method of the power edge device in any other appropriate manner (for example, by means of firmware).
[0135] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0136] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0137] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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 foregoing.
[0138] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0139] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0140] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0141] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0142] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for upgrading the firmware of a power edge device, characterized in that: The method comprises: Obtaining a current firmware file and an upgrade firmware package of a target device, and determining a file type of each upgrade firmware file in the current firmware file and the upgrade firmware package; Determine the hierarchical structure to which the current firmware file and the upgraded firmware file belong according to the file type and the file content; wherein the hierarchical structure includes a core layer, a configuration layer, and an application layer; Determine a data comparison method for the hierarchical structure, and compare the current firmware file and the upgrade firmware file under the hierarchical structure based on the data comparison method to obtain firmware difference information; A differential firmware package is generated according to the firmware difference information, and the firmware of the target device is upgraded based on the differential firmware package.
2. The method according to claim 1, characterized in that A data comparison method for determining the hierarchical structure includes: Obtaining hardware performance information and historical upgrade information of the target device, and determining the update frequency and importance of the hierarchical structure; Performing a weighted summation on the hardware performance information, the historical upgrade information, the update frequency, and the importance to obtain a comparison granularity score; The data comparison method of the hierarchical structure is determined according to the comparison granularity score and a preset threshold.
3. The method according to claim 2, characterized in that The preset threshold includes a first threshold and a second threshold, and the first threshold is greater than the second threshold; Determining the data comparison method of the hierarchical structure according to the comparison granularity score and a preset threshold includes: If the comparison granularity score is greater than or equal to the first threshold, determining that the data comparison method of the hierarchical structure is byte-level comparison; If the comparison granularity score is greater than or equal to the second threshold and less than the first threshold, determining that the data comparison mode of the hierarchical structure is incremental comparison; If the comparison granularity score is less than the second threshold, it is determined that the data comparison method of the hierarchical structure is hash comparison.
4. The method according to claim 1, characterized in that Generating a differential firmware package according to the firmware difference information includes: Obtaining storage capacity information, hardware performance information, and network bandwidth information of the target device; Determine the target file size according to the storage capacity information, the hardware performance information and the network bandwidth information; The file corresponding to the firmware difference information is compressed according to the target file size to obtain a differential firmware package.
5. The method according to claim 4, characterized in that Determining the target file size according to the storage capacity information, the hardware performance information, and the network bandwidth information includes: Determine a first parameter according to the product of a preset weight factor and the hardware performance information; Determine a second parameter according to a difference between the storage capacity information and the first parameter; Determine a third parameter according to a ratio of the second parameter to the hardware performance information; The fourth parameter is determined according to the inverse of the network bandwidth information, and the target file size is determined according to the product of the third parameter and the fourth parameter.
6. The method according to claim 4 or 5, characterized in that: After determining the target file size according to the storage capacity information, the hardware performance information and the network bandwidth information, the method further includes: Determining a target compression ratio according to a file size corresponding to the firmware difference information and a target file size; Updating the target file size according to the target compression ratio; Correspondingly, the file corresponding to the firmware difference information is compressed according to the target file size to obtain a differential firmware package, including: The file corresponding to the firmware difference information is compressed according to the updated target file size to obtain a differential firmware package.
7. The method according to claim 1, characterized in that After the target device is upgraded with the differential firmware package, the method further includes: Determine a firmware upgrade result of the target device; wherein the firmware upgrade result includes upgrade success or upgrade failure; If the firmware upgrade result is an upgrade failure, the firmware file that failed to upgrade is determined as the target firmware file; Based on the hierarchical structure to which the target firmware file belongs, a rollback operation is performed on the target firmware file.
8. A firmware upgrade device for power edge equipment, characterized in that: The device comprises: A file type determination module, used to obtain the current firmware file and the upgrade firmware package of the target device, and determine the file type of each upgrade firmware file in the current firmware file and the upgrade firmware package; A hierarchical structure determination module, used to determine the hierarchical structure to which the current firmware file and the upgrade firmware file belong according to the file type and the file content; wherein the hierarchical structure includes a core layer, a configuration layer and an application layer; A file comparison module, used for determining a data comparison method of the hierarchical structure, and comparing the current firmware file and the upgrade firmware file under the hierarchical structure based on the data comparison method to obtain firmware difference information; The firmware upgrade module is used to generate a differential firmware package according to the firmware difference information, and perform firmware upgrade on the target device based on the differential firmware package.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the firmware upgrade method of the power edge device described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the firmware upgrade method for the power edge device according to any one of claims 1 to 7 when executed.
Citation Information
Patent Citations
Method and device for generating differential packet
CN104267978A
Application updating method and device based on RN
CN114398073A
Differential upgrading method and device, equipment, storage medium and program product
CN118227186A
Service driven firmware upgrade methodology in bmc
US20240152344A1