Method, device and equipment for firmware upgrade of power end device and medium

By hierarchically dividing the firmware files of power-side devices and generating differential firmware packages, the problems of excessively large traditional firmware update packages and unnecessary updates are solved, achieving efficient firmware upgrades and improved device stability.

CN119718394BActive Publication Date: 2026-01-23GUANGZHOU KETENG INFORMATION TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411860127.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2026-01-23
Estimated Expiration
2044-12-17

AI Technical Summary

Technical Problem

Traditional power edge device firmware update packages are too large, resulting in wasted network bandwidth and storage space, and unnecessary update modules increase transmission and deployment time.

Method used

By dividing the firmware file into hierarchical structures and using data comparison methods with different comparison granularities, differential firmware packages are generated for upgrades, reducing unnecessary comparisons and transmissions.

Benefits of technology

The size of the update package has been reduced, saving network bandwidth and storage space, improving firmware upgrade efficiency, and ensuring stable device operation in the event of upgrade failure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718394B_ABST
    Figure CN119718394B_ABST
Patent Text Reader

Abstract

The application discloses a firmware upgrading method and device of a power terminal device, equipment and a medium. The method comprises the following steps: obtaining a current firmware file and an upgrading firmware package of a target device, and determining the file types of each upgrading firmware file in the current firmware file and the upgrading firmware package; determining a hierarchical structure to which the current firmware file and the upgrading firmware file belong according to the file types and the file contents; determining a data comparison mode of the hierarchical structure, comparing the current firmware file and the upgrading firmware file under the hierarchical structure based on the data comparison mode to obtain firmware difference information; generating a differential firmware package according to the firmware difference information, and upgrading the firmware of the target device based on the differential firmware package. According to the scheme, different data comparison modes can be set for the hierarchical structures to which different firmware files belong, and the firmware of the equipment is upgraded based on the differential firmware package determined by the file comparison, so that the volume of the updating package is reduced, the network bandwidth and the storage space are saved, and the firmware upgrading efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of equipment upgrade technology, and in particular to a firmware upgrade method, apparatus, device, and medium for power end-edge equipment. Background Technology

[0002] As power end-edge devices (such as smart meters, distribution terminals, and automated switches) 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 typically require pushing out a complete firmware package provided by the device manufacturer. This firmware package may contain all functional modules of the device (such as the operating system, applications, drivers, configuration files, etc.), while actual upgrade needs often only require optimization or fixes for certain functional modules. This leads to the following problems:

[0004] 1. Update package is too large: Since update packages are usually complete firmware packages, the transmission and deployment time is long and may consume 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 wasted bandwidth and storage. Summary of the Invention

[0006] This invention provides a firmware upgrade method, apparatus, device, and medium for power edge devices. It can set different data comparison methods for different firmware files according to their hierarchical structure, and upgrade the device firmware based on the differential firmware package determined by file data comparison. This reduces the size of the update package, saves network bandwidth and storage space, and improves firmware upgrade efficiency.

[0007] According to one aspect of the present invention, a firmware upgrade method for a power supply end-side device is provided, the method comprising:

[0008] Obtain the current firmware file and 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;

[0009] The hierarchical structure to which the current firmware file and the upgrade firmware file belong is determined based on the file type and file content; wherein, the hierarchical structure includes a core layer, a configuration layer and an application layer;

[0010] Determine the data comparison method for the hierarchical structure, and compare the current firmware file and the upgraded firmware file under the hierarchical structure based on the data comparison method to obtain firmware difference information;

[0011] A differential firmware package is generated based on the firmware difference information, and the target device is upgraded based on the differential firmware package.

[0012] According to another aspect of the present invention, a firmware upgrade apparatus for a power supply terminal device is provided, the apparatus comprising:

[0013] The file type determination module is used to obtain the current firmware file and 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] The hierarchical structure determination module is used to determine the hierarchical structure to which the current firmware file and the upgrade firmware file belong based on the file type and file content; wherein, the hierarchical structure includes a core layer, a configuration layer and an application layer;

[0015] The file comparison module is used to determine the data comparison method of 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;

[0016] The firmware upgrade module is used to generate a differential firmware package based on the firmware difference information, and to upgrade the firmware of 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, which enables the at least one processor to perform the firmware upgrade method for the power end-side device according to any embodiment of the present invention.

[0021] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the firmware upgrade method for a power end-side device according to any embodiment of the present invention.

[0022] The technical solution of this invention involves obtaining the current firmware file and upgrade firmware package of the target device, determining the file type of each upgrade firmware file in the current firmware file and upgrade firmware package, determining the hierarchical structure to which the current firmware file and upgrade firmware file belong based on the file type and file content, wherein the hierarchical structure includes a core layer, a configuration layer, and an application layer, determining the data comparison method of the hierarchical structure, comparing the current firmware file and upgrade firmware file under the hierarchical structure based on the data comparison method to obtain firmware difference information, generating a differential firmware package based on the firmware difference information, and performing firmware upgrade on the target device based on the differential firmware package. This technical solution can set different data comparison methods for different firmware file hierarchical structures and perform device firmware upgrades based on differential firmware packages determined through file data comparison, thereby reducing the size of the update package, saving network bandwidth and storage space, and improving firmware upgrade efficiency.

[0023] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0024] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0025] Figure 1 This is a flowchart of a firmware upgrade method for a power terminal device according to Embodiment 1 of the present invention;

[0026] Figure 2 This is a flowchart of a firmware upgrade method for a power supply terminal device according to Embodiment 2 of the present invention;

[0027] Figure 3 This is a flowchart of a firmware upgrade method for a power supply terminal device according to Embodiment 3 of the present invention;

[0028] Figure 4 This is a schematic diagram of the structure of a firmware upgrade device for a power terminal device according to Embodiment 4 of the present invention;

[0029] Figure 5 This is a schematic diagram of the structure of an electronic device that implements a firmware upgrade method for a power end-side device according to an embodiment of the present invention. Detailed Implementation

[0030] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0031] It should be noted that the terms "first," "second," "target," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0032] Example 1

[0033] Figure 1 This is a flowchart of a firmware upgrade method for a power edge device according to Embodiment 1 of the present invention. This embodiment is applicable to situations requiring efficient and accurate firmware upgrades for power edge devices. The method can be executed by a firmware upgrade device for the power edge device, which can be implemented in hardware and / or software. This firmware upgrade device can be configured in an electronic device with data processing capabilities. Figure 1 As shown, the method includes:

[0034] S110, obtain the current firmware file and upgrade firmware package of the target device, and determine the file type of each upgrade firmware file in the current firmware file and upgrade firmware package.

[0035] The target device can refer to a power-side device that requires firmware upgrades. For example, the target device could be a smart meter, distribution terminal, or automated switch. The current firmware file can refer to the firmware file of the current version. The upgrade firmware package can refer to the firmware package corresponding to the upgrade version, and this upgrade firmware package includes multiple upgrade firmware files. For example, file types can 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 upgrade firmware package of the target device are first obtained. The upgrade firmware package is typically in a compressed format (such as ZIP or a manufacturer-specific compression format), therefore, a suitable decompression algorithm is needed to parse the upgrade firmware package to obtain multiple upgrade firmware files. For example, standard decompression libraries such as 7z, unzip, and tar can be used, 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 and each upgrade firmware file in the upgrade firmware package, file type identification can be performed on both the current firmware file and the upgrade firmware file to determine their file types. For example, a file type identification tool (such as the `file` command) or file type identification can be performed using the file extension.

[0037] S120 determines the hierarchical structure of the current firmware file and the upgrade firmware file based on the file type and file content.

[0038] In this embodiment, after determining the file types of the current firmware file and the upgrade firmware file, the hierarchical structure to which the current firmware file and the upgrade firmware file belong can be determined based on the file type and file content. The hierarchical structure can include a core layer, a configuration layer, and an application layer. For example, the core layer can include the operating system kernel, drivers, important system service files, etc.; the configuration layer can include device configuration files, initialization scripts, etc.; and the application layer can include log files, user settings, database files, etc. Specifically, a preliminary hierarchical structure can be determined based on the firmware file name or directory structure, or by analyzing the file content (e.g., automatic classification based on file header information or features).

[0039] Furthermore, after determining the hierarchical structure of the current firmware file and the upgrade firmware file, a difference data model can be constructed to provide a data foundation for subsequent multi-level comparisons. For example, by generating summary information and metadata of the upgrade firmware package, the difference characteristics between each hierarchy can be captured, and a difference data model can be constructed based on these characteristics. Specifically, firstly, for each hierarchy, a hash algorithm (such as SHA256, MD5) can be used to generate a file summary, helping to efficiently locate differences in the subsequent comparison process. Tools such as sha256sum and md5sum can be used to generate hash values. Then, basic information (i.e., metadata) for each file is generated, such as file size, modification date, file type, and data content. This metadata can provide necessary auxiliary information for subsequent difference feature analysis, such as combining file system metadata or using custom scripts to analyze file characteristics. Finally, the file data 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 retrieval and updates. The database can use a relational database (such as MySQL or PostgreSQL) or a NoSQL database (such as MongoDB) to store the standardized processing results.

[0040] S130, determine the data comparison method of the hierarchical structure, and compare the current firmware file and the upgraded firmware file under the hierarchical structure based on the data comparison method to obtain firmware difference information.

[0041] It should be noted that different hierarchical structures have different update frequencies and importance. Therefore, when comparing firmware files, different comparison granularities can be adopted according to the characteristics of different hierarchical structures. For example, the priority of each hierarchical structure can be determined based on its update frequency and importance. Then, different comparison granularities can be set for each hierarchical structure based on its priority, and the data comparison method for each hierarchical structure can be determined based on the comparison granularity. For example, for the core layer, its update frequency is low and its importance is high, corresponding to high priority. Therefore, a finer comparison granularity is needed to focus on minor changes in file content to ensure the stability of core components. In this case, a byte-level comparison method can be used. For the configuration layer, its update frequency and importance are medium, corresponding to medium priority. Therefore, a medium comparison granularity can be used to compare only the differences in file content. In this case, an incremental comparison method can be used. For the application layer, its update frequency is high and its importance is low, corresponding to low priority. Therefore, a coarser comparison granularity can be used to focus on newly added files and large file changes to avoid large-scale comparisons. In this case, a hash comparison method (comparison based on hash value calculation) can be used. 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 These represent the contents of the firmware file to be upgraded and the current firmware file, respectively, calculated using a hash algorithm (such as SHA-256) to produce a fixed-length hash value. `Hash(file)` represents the file content converted into a fixed-length value through hash calculation, serving as the file's unique identifier. It's important to note that if the firmware file changes, the hash value will also change accordingly. That is, 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 methods for 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 methods to obtain firmware difference information. The firmware difference information can be used to describe the data differences between the current firmware file and the upgraded firmware file. It should be noted that, unlike traditional full-scale comparison methods, this solution employs multi-level intelligent comparison technology, setting different comparison granularities for different hierarchical structures, and performing data comparison between the current firmware file and the upgraded firmware file according to the data comparison method determined based on the comparison granularity. This reduces unnecessary calculations and effectively improves file comparison efficiency.

[0045] S140 generates a differential firmware package based on the firmware difference information and performs a 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 files corresponding to the firmware difference information to generate differential firmware packages, thereby reducing the amount of data transmission. After generating the differential firmware packages, they can be transmitted to the target device. After the target device successfully receives the differential firmware packages, they are decompressed and reassembled to finally complete the firmware upgrade of the target device. Furthermore, a suitable differential firmware package transmission method can be set based on the network status of the target device. For example, for a large group of devices, a segmented transmission mechanism can be used to divide large files into multiple smaller files for transmission, avoiding network congestion caused by transmitting too large a file at once. When the network is unstable, the differential firmware package can be resumed from interruption, ensuring that the target device can resume the normal upgrade process even if it loses connection midway.

[0047] The technical solution of this invention involves obtaining the current firmware file and upgrade firmware package of the target device, determining the file type of each upgrade firmware file in the current firmware file and upgrade firmware package, determining the hierarchical structure to which the current firmware file and upgrade firmware file belong based on the file type and file content, wherein the hierarchical structure includes a core layer, a configuration layer, and an application layer, determining the data comparison method of the hierarchical structure, comparing the current firmware file and upgrade firmware file under the hierarchical structure based on the data comparison method to obtain firmware difference information, generating a differential firmware package based on the firmware difference information, and performing firmware upgrade on the target device based on the differential firmware package. This technical solution can set different data comparison methods for different firmware file hierarchical structures and perform device firmware upgrades based on differential firmware packages determined through file data comparison, thereby reducing the size of the update package, saving network bandwidth and storage space, and improving firmware upgrade efficiency.

[0048] In this embodiment, optionally, after upgrading the target device based on the differential firmware package, the method further includes: determining the firmware upgrade result of the target device; wherein the firmware upgrade result includes successful upgrade or failed upgrade; if the firmware upgrade result is a failed upgrade, the firmware file that failed to upgrade is determined 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's important to note that if the target device encounters an anomaly during the upgrade process (such as a malfunction or inability to boot), the firmware upgrade may fail, affecting the device's normal operation. Therefore, when the firmware upgrade fails, an automatic rollback to the previous stable version can be configured to ensure the device's operation remains unaffected. Specifically, first, identify the failed firmware file as the target firmware file. Then, determine the hierarchical structure of the target firmware file and perform a rollback based on that structure. For example, for low-risk hierarchical structures like the configuration layer (e.g., configuration files) and application layer (e.g., log files), only the corresponding files need to be rolled back. However, for high-risk hierarchical structures like the core layer (e.g., core components or drivers), a full rollback is required to ensure the stable operation of the target device.

[0050] This solution, through this configuration, rolls back the failed firmware file based on the corresponding hierarchical structure when a firmware upgrade fails, thereby ensuring the normal and stable operation of the target device.

[0051] Example 2

[0052] Figure 2This is a flowchart of a firmware upgrade method for a power supply end-edge device provided in Embodiment 2 of the present invention. This embodiment is based on the above embodiment and optimized. Specifically, the optimization includes: determining the data comparison method of the hierarchical structure, including: acquiring the hardware performance information and historical upgrade information of the target device, determining the update frequency and importance of the hierarchical structure; performing a weighted summation of the hardware performance information, historical upgrade information, update frequency, and importance to obtain a comparison granularity score; and determining the data comparison method of the hierarchical structure based on the comparison granularity score and a preset threshold.

[0053] like Figure 2 As shown, the method in this embodiment specifically includes the following steps:

[0054] S210, obtain the current firmware file and upgrade firmware package of the target device, and determine the file type of each upgrade firmware file in the current firmware file and upgrade firmware package.

[0055] S220 determines the hierarchical structure of the current firmware file and the upgrade firmware file based on the file type and file content.

[0056] The hierarchical structure includes a core layer, a configuration layer, and an application layer.

[0057] S230: Obtain hardware performance information and historical upgrade information of the target device to determine the update frequency and importance of the hierarchical structure.

[0058] Hardware performance information can include CPU, memory, and storage. Historical upgrade information describes the target device's behavior during previous firmware upgrades, specifically including failure, success, and fault information. The importance of the hierarchical structure can be determined by the target device's dependency on that structure; for example, the core layer is more important than the application layer. It should be noted that this solution employs an intelligent optimization comparison method, which automatically selects the most suitable comparison method based on the target device's hardware performance information, historical upgrade information, and the update frequency and importance of the hierarchical structure, thereby reducing unnecessary comparison operations and improving comparison efficiency.

[0059] S240 calculates a weighted sum of hardware performance information, historical upgrade information, update frequency, and importance to obtain a comparison granularity score.

[0060] For example, the comparison granularity 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 The comparison granularity score is represented by: Update Frequency, Module Importance, Device Performance, Historical Behavior, and ω1, ω2, ω3, and ω4. ω1, ω2, ω3, and ω4 represent different weighting factors pre-set based on historical experience.

[0063] S250 determines the hierarchical data comparison method based on the comparison granularity score and preset threshold.

[0064] The preset threshold can refer to a reference value for the comparison granularity score set in advance according to actual needs, which can serve as an important basis for determining the data comparison method for different hierarchical structures. For example, if the calculated comparison granularity score is greater than or equal to the preset threshold, a finer data comparison method (such as byte-level comparison) can be selected as the data comparison method for that hierarchical structure; if the calculated comparison granularity score is less than the preset threshold, a coarser data comparison method (such as incremental comparison or hash comparison) can be selected as the data comparison method for that hierarchical structure.

[0065] In this embodiment, optionally, the preset threshold includes a first threshold and a second threshold, wherein the first threshold is greater than the second threshold; determining the data comparison method of the hierarchical structure based on the comparison granularity score and the preset threshold includes: 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, suppose the alignment granularity score is S compare The first threshold and the second threshold are T, respectively. high and T low Then we have:

[0067] If S compare ≥T high This byte-level comparison method is suitable for situations with high importance, high update frequency, and good device performance. In this case, the most refined comparison strategy is needed to compare the differences of each byte.

[0068] If T low ≤S compare <T highIncremental comparison is a data comparison method suitable for situations with low device performance or moderate update frequency. It reduces resource consumption by comparing only the modified or added parts.

[0069] If S compare <T low Data comparison using hash matching is suitable for situations with low device performance and infrequent updates. Hash matching is a fast and efficient comparison method suitable for most situations.

[0070] S260 uses a data comparison method to compare the current firmware file and the upgrade firmware file in the hierarchical structure to obtain firmware difference information.

[0071] S270 generates a differential firmware package based on firmware difference information and performs firmware upgrade on the target device based on the differential firmware package.

[0072] The technical solution of this invention, when determining the data comparison method for the hierarchical structure, first acquires the hardware performance information and historical upgrade information of the target device to determine the update frequency and importance of the hierarchical structure; then, it performs a weighted summation of the hardware performance information, historical upgrade information, update frequency, and importance to obtain a comparison granularity score; finally, it determines the data comparison method for the hierarchical structure based on the comparison granularity score and a preset threshold. This technical solution comprehensively considers the device's hardware performance and historical information, as well as the update frequency and importance of the hierarchical structure, to determine the data comparison method for the hierarchical structure. It can determine appropriate data comparison methods for different device performance and hierarchical structure characteristics, effectively improving data comparison efficiency while ensuring accuracy.

[0073] Example 3

[0074] Figure 3 This is a flowchart of a firmware upgrade method for a power supply end-edge device provided in Embodiment 3 of the present invention. This embodiment is based on the above embodiment and optimized. Specifically, the optimization is as follows: generating a differential firmware package based on 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 based on the storage capacity information, hardware performance information, and network bandwidth information; and compressing the file corresponding to the firmware difference information according to the target file size to obtain the differential firmware package.

[0075] like Figure 3 As shown, the method in this embodiment specifically includes the following steps:

[0076] S310: Obtain the current firmware file and upgrade firmware package of the target device, and determine the file type of each upgrade firmware file in the current firmware file and upgrade firmware package.

[0077] S320 determines the hierarchical structure of the current firmware file and the upgrade firmware file based on the file type and file content.

[0078] The hierarchical structure includes a core layer, a configuration layer, and an application layer.

[0079] S330: Determine the data comparison method for the hierarchical structure, and compare the current firmware file and the upgraded firmware file under the hierarchical structure based on the data comparison method to obtain firmware difference information.

[0080] S340 obtains the target device's storage capacity information, hardware performance information, and network bandwidth information.

[0081] It should be noted that existing technologies typically employ fixed firmware update strategies for different types of devices, which cannot be flexibly adjusted according to device hardware and network conditions (poor flexibility). This can easily lead to device performance bottlenecks or upgrade failures due to insufficient hardware resources. This solution, however, can generate suitable differential firmware packages based on the device's hardware, network, and storage characteristics, ensuring high efficiency in transmission and storage, and adapting to the upgrade needs of different devices.

[0082] The S350 determines the target file size based on storage capacity information, hardware performance information, and network bandwidth information.

[0083] Specifically, the target file size can be represented as follows: Optimal Package Size = f(DeviceStorage, Device Performance, Network Bandwidth). Here, Optimal Package Size represents the target file size; Device Storage represents the target device's storage capacity, affecting the maximum size of the differential firmware package; Device Performance represents the target device's hardware performance; and Network Bandwidth represents the target device's network bandwidth, affecting the transmission efficiency of the differential firmware package. Devices with lower bandwidth require smaller differential firmware packages to reduce data transmission time and resource consumption. For example, for target devices with smaller storage capacity, a smaller differential firmware package with a 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 data transmission time and resource consumption; for target devices with lower hardware performance, a smaller differential firmware package or a differential firmware package with a higher compression ratio is required to reduce computational burden.

[0084] In this embodiment, optionally, the target file size is determined based on storage capacity information, hardware performance information, and network bandwidth information, including: determining a first parameter based on the product of a preset weighting factor and hardware performance information; determining a second parameter based on the difference between storage capacity information and the first parameter; determining a third parameter based on the ratio of the second parameter to hardware performance information; determining a fourth parameter based on the reciprocal of network bandwidth information; and determining the target file size based on the product of the third parameter and the fourth parameter.

[0085] For example, the target file size can be represented as follows: Where ω represents the preset weighting factor, ω·Device Performance represents the first parameter, and Device Storage - ω·Device Performance represents the second parameter. Indicates the third parameter. This indicates the fourth parameter.

[0086] S360 compresses the files corresponding to the firmware difference information according to the target file size to obtain the differential firmware package.

[0087] S370 performs firmware upgrades on target devices based on differential firmware packages.

[0088] The technical solution of this invention, when generating a differential firmware package based on firmware difference information, first obtains the target device's storage capacity information, hardware performance information, and network bandwidth information; then, based on the storage capacity information, hardware performance information, and network bandwidth information, determines the target file size; and finally, 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 suitable differential firmware packages based on the device's hardware, network, and storage characteristics, ensuring the efficiency of differential firmware packages in transmission and storage, improving the flexibility of firmware updates, and adapting to the upgrade needs of different devices.

[0089] In this embodiment, optionally, after determining the target file size based on storage capacity information, hardware performance information, and network bandwidth information, the method further includes: determining a target compression ratio based on the file size corresponding to the firmware difference information and the target file size; updating the target file size based on the target compression ratio; and correspondingly, compressing the file corresponding to the firmware difference information based on the target file size to obtain a differential firmware package, including: compressing the file corresponding to the firmware difference information based on the updated target file size to obtain a differential firmware package.

[0090] For example, the target compression ratio can be determined based on the following formula:

[0091]

[0092] Where Compression Ratio represents the target compression ratio; Size original Size indicates the file size corresponding to the firmware difference information; Compressed This indicates the size of the target file. Further, the updated target file size can be represented as follows:

[0093]

[0094] This solution, through such configuration, further reduces the size of the differential firmware package by combining compression algorithms with the hardware, network, and storage characteristics of the device, thereby further improving the efficiency of differential firmware package transmission and storage.

[0095] Example 4

[0096] Figure 4 This is a schematic diagram of a firmware upgrade device for a power supply edge device according to Embodiment 4 of the present invention. This device can execute the firmware upgrade method for a power supply edge device provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the method. For example... Figure 4 As shown, the device includes:

[0097] The file type determination module 410 is used to obtain the current firmware file and 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] The hierarchical structure determination module 420 is used to determine the hierarchical structure to which the current firmware file and the upgrade firmware file belong based on the file type and file content; wherein, the hierarchical structure includes a core layer, a configuration layer and an application layer;

[0099] The file comparison module 430 is used to determine the data comparison method of 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] Firmware upgrade module 440 is used to generate a differential firmware package based on the firmware difference information, and to upgrade the firmware of the target device based on the differential firmware package.

[0101] Optionally, the file comparison module 430 includes:

[0102] The device and hierarchical structure information determination unit is used to obtain the hardware performance information and historical upgrade information of the target device, and determine the update frequency and importance of the hierarchical structure;

[0103] The comparison granularity scoring determination unit is used to perform a weighted summation of the hardware performance information, the historical upgrade information, the update frequency, and the importance to obtain a comparison granularity score;

[0104] The data comparison method determination unit is used to determine the data comparison method of the hierarchical structure based on the comparison granularity score and the preset threshold.

[0105] Optionally, the preset threshold includes a first threshold and a second threshold, wherein the first threshold is greater than the second threshold;

[0106] The data comparison method determination unit is specifically used for:

[0107] 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;

[0108] 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;

[0109] 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.

[0110] Optionally, the firmware upgrade module 440 includes:

[0111] The device information acquisition unit is used to acquire the storage capacity information, hardware performance information, and network bandwidth information of the target device.

[0112] The target file size determination unit is used to determine the target file size based on 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 for:

[0115] The first parameter is determined by multiplying a preset weighting factor by the hardware performance information.

[0116] The second parameter is determined based on the difference between the storage capacity information and the first parameter;

[0117] The third parameter is determined based on the ratio of the second parameter to the hardware performance information;

[0118] The fourth parameter is determined based on the reciprocal of the network bandwidth information, and the target file size is determined based on the product of the third parameter and the fourth parameter.

[0119] Optionally, the firmware upgrade module 440 further includes:

[0120] The target compression ratio determination unit is used to determine the target compression ratio based on the file size corresponding to the firmware difference information and the target file size after determining the target file size according to the storage capacity information, the hardware performance information and the network bandwidth information;

[0121] The target file size update unit is used to update the target file size according to the target compression ratio;

[0122] Accordingly, the file compression unit is used for:

[0123] The files corresponding to the firmware difference information are compressed according to the updated target file size to obtain a differential firmware package.

[0124] Optionally, the device further includes: a firmware upgrade failure handling module, used for:

[0125] After upgrading the firmware of the target device based on the differential firmware package, the firmware upgrade result of the target device is determined; wherein, the firmware upgrade result includes upgrade success or upgrade failure;

[0126] If the firmware upgrade result is an upgrade failure, then the firmware file that failed to upgrade will be identified 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] The firmware upgrade device for a power end-edge device provided in this embodiment of the invention can execute the firmware upgrade method for a power end-edge device provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method.

[0129] Example 5

[0130] Figure 5 A schematic diagram of an electronic device 10 that can be used to implement embodiments 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 processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0131] like Figure 5 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0132] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0133] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as firmware upgrade methods for power-side devices.

[0134] In some embodiments, the firmware upgrade method for the power end-edge device can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as 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 ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the firmware upgrade method for the power end-edge device described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the firmware upgrade method for the power end-edge device by any other suitable means (e.g., by means of firmware).

[0135] Various embodiments 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-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0136] Computer programs used to implement 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, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0137] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0138] To provide interaction with a user, the systems and techniques described herein can 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 pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0139] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0140] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0141] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0142] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A firmware upgrade method for a power supply terminal device, characterized in that, The method includes: Obtain the current firmware file and 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; The hierarchical structure to which the current firmware file and the upgrade firmware file belong is determined based on the file type and file content; wherein, the hierarchical structure includes a core layer, a configuration layer and an application layer; Determine the data comparison method for the hierarchical structure, and compare the current firmware file and the upgraded firmware file under the hierarchical structure based on the data comparison method to obtain firmware difference information; A differential firmware package is generated based on the firmware difference information, and the target device is upgraded based on the differential firmware package; The method for determining the data comparison of the hierarchical structure includes: Obtain the hardware performance information and historical upgrade information of the target device to determine the update frequency and importance of the hierarchical structure; the importance of the hierarchical structure is determined by the target device's dependence on the hierarchical structure. The hardware performance information, the historical upgrade information, the update frequency, and the importance are weighted and summed to obtain a comparison granularity score; The data comparison method of the hierarchical structure is determined based on the comparison granularity score and the preset threshold. The generation of differential firmware packages based on the firmware difference information includes: Obtain the storage capacity information, hardware performance information, and network bandwidth information of the target device; The target file size is determined based on the storage capacity information, the hardware performance information, and the network bandwidth information. The files corresponding to the firmware difference information are compressed according to the target file size to obtain the differential firmware package; Determining the target file size based on the storage capacity information, the hardware performance information, and the network bandwidth information includes: The first parameter is determined by multiplying a preset weighting factor by the hardware performance information. The second parameter is determined based on the difference between the storage capacity information and the first parameter; The third parameter is determined based on the ratio of the second parameter to the hardware performance information; The fourth parameter is determined based on the reciprocal of the network bandwidth information, and the target file size is determined based on the product of the third parameter and the fourth parameter.

2. The method according to claim 1, characterized in that, The preset threshold includes a first threshold and a second threshold, wherein the first threshold is greater than the second threshold; The data comparison method for the hierarchical structure is determined based on the comparison granularity score and a 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.

3. The method according to claim 1, characterized in that, After determining the target file size based on the storage capacity information, the hardware performance information, and the network bandwidth information, the method further includes: The target compression ratio is determined based on the file size corresponding to the firmware difference information and the target file size; Update the target file size according to the target compression ratio; Accordingly, the files corresponding to the firmware difference information are compressed according to the target file size to obtain a differential firmware package, including: The files corresponding to the firmware difference information are compressed according to the updated target file size to obtain a differential firmware package.

4. The method according to claim 1, characterized in that, After upgrading the firmware of the target device based on the differential firmware package, the process further includes: Determine the 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, then the firmware file that failed to upgrade will be identified 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.

5. A firmware upgrade device for power supply end-side equipment, characterized in that, The device includes: The file type determination module is used to obtain the current firmware file and 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. The hierarchical structure determination module is used to determine the hierarchical structure to which the current firmware file and the upgrade firmware file belong based on the file type and file content; wherein, the hierarchical structure includes a core layer, a configuration layer and an application layer; The file comparison module is used to determine the data comparison method of 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 firmware upgrade module is used to generate a differential firmware package based on the firmware difference information, and to upgrade the firmware of the target device based on the differential firmware package; The file comparison module includes: The device and hierarchical structure information determination unit is used to acquire the hardware performance information and historical upgrade information of the target device, and determine the update frequency and importance of the hierarchical structure; the importance of the hierarchical structure is determined by the target device's dependence on the hierarchical structure; The comparison granularity scoring determination unit is used to perform a weighted summation of the hardware performance information, the historical upgrade information, the update frequency, and the importance to obtain a comparison granularity score; A data comparison method determination unit is used to determine the data comparison method of the hierarchical structure based on the comparison granularity score and a preset threshold. The firmware upgrade module includes: The device information acquisition unit is used to acquire the storage capacity information, hardware performance information, and network bandwidth information of the target device. The target file size determination unit is used to determine the target file size based on the storage capacity information, the hardware performance information, and the network bandwidth information. The file compression unit is used to compress the file corresponding to the firmware difference information according to the target file size to obtain the differential firmware package; The target file size determination unit is specifically used for: The first parameter is determined by multiplying a preset weighting factor by the hardware performance information. The second parameter is determined based on the difference between the storage capacity information and the first parameter; The third parameter is determined based on the ratio of the second parameter to the hardware performance information; The fourth parameter is determined based on the reciprocal of the network bandwidth information, and the target file size is determined based on the product of the third parameter and the fourth parameter.

6. An electronic device, characterized in that, The electronic device includes: 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, the computer program being executed by the at least one processor to enable the at least one processor to perform the firmware upgrade method for the power end-side device according to any one of claims 1-4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the firmware upgrade method for the power end-side device according to any one of claims 1-4.

Citation Information

Patent Citations

  • Application updating method and device based on RN

    CN114398073A

  • Differential upgrading method and device, equipment, storage medium and program product

    CN118227186A