Firmware refreshing method and device, electronic equipment and storage medium
By judging the termination signal during the firmware refresh process and rolling back the original mirror file, the problem of inflexible firmware refresh in the prior art is solved, and efficient and reliable firmware refresh operations are achieved, reducing cost waste.
Patent Information
- Application Number
- CN202411216130.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-12-13
AI Technical Summary
In the prior art, the firmware refresh method is not flexible and cannot be terminated at any time during the refresh process without causing functional abnormalities, resulting in wasted labor and time costs.
When triggering the firmware refresh task, obtain the image file to be refreshed and write to the target storage medium, erase the original image file and write to the main flash memory, determine whether the termination signal has been received, and stop refreshing and rolling back if received, otherwise the refresh will be completed. .
It realizes the refreshing at any time during the firmware refresh without affecting the function, reduces waste of labor and time costs, and improves the flexibility, efficiency and reliability of firmware refresh.
Smart Images

Figure CN119127251A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a firmware refreshing method, device, electronic equipment and storage medium. Background Art
[0002] Firmware is an embedded software that is usually used to control, operate and manage hardware devices, including but not limited to Baseboard Management Controller (BMC), Basic Input / Output System (BIOS) and Unified Extensible Firmware Interface (UEFI). Firmware refresh is an important task in the maintenance of electronic equipment such as computers and servers. Firmware refresh can improve the performance, security and stability of electronic equipment.
[0003] The conventional firmware refresh method in the related art can perform firmware refresh on the firmware to be refreshed based on the image file. However, in the conventional firmware refresh method, after the firmware refresh of the firmware to be refreshed is started based on the image file, if the image file is found to be incorrect, the firmware refresh of the firmware to be refreshed cannot be stopped immediately. The firmware refresh of the firmware to be refreshed can only be replaced after the firmware refresh is completed, and the firmware to be refreshed can be refreshed again based on the replaced image file, resulting in a waste of manpower and time costs. Moreover, if the firmware refresh of the firmware to be refreshed is forcibly terminated after the firmware refresh of the firmware to be refreshed is started based on the image file, the firmware to be refreshed will cause functional abnormalities.
[0004] Therefore, how to improve the flexibility of firmware updating while ensuring that the firmware functions normally is a technical problem that needs to be solved urgently in this field. Summary of the invention
[0005] The present invention provides a firmware refresh method, device, electronic device and storage medium, which are used to solve the defect of low flexibility in firmware refresh in the prior art, and improve the flexibility of firmware refresh on the basis of ensuring normal firmware functions.
[0006] The present invention provides a firmware refreshing method, comprising the following steps.
[0007] In the case of triggering a firmware refresh task of the firmware to be refreshed, obtaining an image file to be refreshed of the firmware to be refreshed, and writing the original image file of the firmware to be refreshed into a target storage medium; In the case of determining that the original image file is successfully written into the target storage medium, erasing the original image file of the firmware to be refreshed, and writing the image file to be refreshed into the main flash memory of the firmware to be refreshed; In the process of erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory, it is determined whether a termination signal indicating the termination of the firmware refresh task is received; if the termination signal is received, erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory are stopped, the image file to be refreshed in the main flash memory is deleted, and the original image file in the target storage medium is rewritten into the main flash memory; if the termination signal is not received, after writing the image file to be refreshed into the main flash memory, the firmware refresh of the firmware to be refreshed is completed based on the image file to be refreshed in the main flash memory.
[0008] According to a firmware refresh method provided by the present invention, the step of writing the original image file of the firmware to be refreshed into a target storage medium comprises: Obtain the source storage medium where the original image file is located and the size of the original image file; Based on the size of the original image file, selecting a volatile medium as the target storage medium; Reading the original image file from the source storage medium, and writing the original image file to the target storage medium; Verify whether the original image file in the target storage medium is consistent with the original image file in the source storage medium. If it is determined that the original image file in the target storage medium is consistent with the original image file in the source storage medium, determine that the original image file is successfully written into the target storage medium.
[0009] According to a firmware refresh method provided by the present invention, erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory of the firmware to be refreshed comprises: Erasing the original image file from the source storage medium, and writing the image file to be refreshed into the main flash memory of the firmware to be refreshed according to sectors; In the process of writing the image file to be refreshed into the main flash memory, when the writing of the current block in the main flash memory is completed, a copy-back check is performed to check whether the original image file written in the current block is consistent with the original image file in the target storage medium. When it is determined that the original image file written in the current block is consistent with the original image file in the target storage medium, the writing of the next block in the main flash memory is performed.
[0010] According to a firmware refresh method provided by the present invention, the verifying whether the original image file in the target storage medium is consistent with the original image file in the source storage medium includes: Based on the hash value and / or the checksum, verify whether the original image file in the target storage medium is consistent with the original image file in the source storage medium.
[0011] According to a firmware refresh method provided by the present invention, the firmware refresh of the firmware to be refreshed is completed based on the image file to be refreshed in the main flash memory, including: Restarting the firmware to be refreshed; Writing the image file to be refreshed in the main flash memory into the backup flash memory of the firmware to be refreshed; In the case where it is determined that the image file to be refreshed is successfully written into the backup flash memory, it is determined that the firmware to be refreshed is refreshed successfully.
[0012] According to a firmware refresh method provided by the present invention, before obtaining the image file to be refreshed of the firmware to be refreshed, the method further includes: Establishing a communication link with the electronic device where the firmware to be refreshed is located according to the Internet Protocol address IP address of the electronic device where the firmware to be refreshed is located; The step of obtaining the image file to be updated of the firmware to be updated includes: Obtaining the original image file to be updated of the firmware to be updated; Obtaining the version number and identification information of the original image file to be updated; Based on the version number and identification information of the original image file to be refreshed, verify the integrity and legality of the original image file to be refreshed and whether it is compatible with the firmware to be refreshed; In the case where it is determined that the original image file to be refreshed passes the verification, the original image file to be refreshed is determined as the image file to be refreshed.
[0013] According to a firmware refresh method provided by the present invention, when there are multiple firmwares to be refreshed, in the process of erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory, it is determined whether a termination signal indicating termination of the firmware refresh task is received; when the termination signal is received, erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory are stopped, the image file to be refreshed in the main flash memory is deleted, and the original image file in the target storage medium is rewritten into the main flash memory; when the termination signal is not received, after writing the image file to be refreshed into the main flash memory, the firmware refresh of the firmware to be refreshed is completed based on the image file to be refreshed in the main flash memory, including: In the process of erasing the original image file of each firmware to be refreshed and writing the image file to be refreshed into the main flash memory of each firmware to be refreshed, determining whether a termination signal indicating termination of the firmware refresh task of any firmware to be refreshed is received; In the case of receiving the termination signal indicating the termination of the firmware refresh task of any firmware to be refreshed, stopping erasing the original image file of any firmware to be refreshed and writing the image file to be refreshed into the main flash memory of any firmware to be refreshed, deleting the image file to be refreshed in the main flash memory of any firmware to be refreshed, and rewriting the original image file in the target storage medium into the main flash memory of any firmware to be refreshed; in the case of not receiving the termination signal indicating the termination of the firmware refresh task of any firmware to be refreshed, after writing the image file to be refreshed into the main flash memory of any firmware to be refreshed, complete the firmware refresh of any firmware to be refreshed based on the image file to be refreshed in the main flash memory of any firmware to be refreshed.
[0014] The present invention also provides a firmware updating device, comprising the following modules: A data acquisition module, used for acquiring the image file to be refreshed of the firmware to be refreshed when a firmware refresh task of the firmware to be refreshed is triggered, and writing the original image file of the firmware to be refreshed into a target storage medium; A data backup module, configured to erase the original image file of the firmware to be refreshed and write the image file to be refreshed into the main flash memory of the firmware to be refreshed when it is determined that the original image file is successfully written into the target storage medium; A firmware refresh module is used to determine whether a termination signal indicating termination of the firmware refresh task is received during the process of erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory; if the termination signal is received, the module stops erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory, deletes the image file to be refreshed in the main flash memory, and rewrites the original image file in the target storage medium into the main flash memory; if the termination signal is not received, after writing the image file to be refreshed into the main flash memory, the module completes the firmware refresh of the firmware to be refreshed based on the image file to be refreshed in the main flash memory.
[0015] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, any of the above-mentioned firmware refreshing methods is implemented.
[0016] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the firmware refresh method described in any one of the above is implemented.
[0017] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the firmware refreshing method described above is implemented.
[0018] The firmware refresh method, device, electronic device and storage medium provided by the present invention obtain the image file to be refreshed of the firmware to be refreshed under the condition that the firmware refresh task of the firmware to be refreshed is triggered, and the original image file of the firmware to be refreshed is written into the target storage medium; when it is determined that the original image file is successfully written into the target storage medium, the original image file of the firmware to be refreshed is erased, and the image file to be refreshed is written into the main flash memory of the firmware to be refreshed; in the process of erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory, it is determined whether a termination signal indicating the termination of the firmware refresh task is received; when the termination signal is received, erasing the firmware to be refreshed is stopped. The original image file of the firmware and the image file to be refreshed are written into the main flash memory, and the original image file in the target storage medium is rewritten into the main flash memory. In the case where no termination signal is received, after the image file to be refreshed is written into the main flash memory, the firmware refresh of the firmware to be refreshed is completed based on the image file to be refreshed in the main flash memory. During the firmware refresh process, the firmware refresh can be terminated at any time without causing functional abnormalities in the firmware, the flexibility of the firmware refresh can be improved, the waste of labor cost and time cost caused by terminating the firmware refresh can be reduced, the efficiency of the firmware refresh is improved, the operation of the firmware refresh is simple, the scalability is strong, and the reliability is strong, and the firmware refresh has broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1 This is one of the flow charts of the firmware refresh method provided by the present invention.
[0021] Figure 2 This is the second flowchart of the firmware refresh method provided by the present invention.
[0022] Figure 3 It is a structural schematic diagram of the firmware refreshing device provided by the present invention.
[0023] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are 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 are within the scope of protection of the present invention.
[0025] In the description of the invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0026] In the description of the present application, the terms "first", "second", etc. are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are usually a class, and the number of objects is not limited. For example, the first object can be one or more. In addition, in the description of the present application, "and / or" represents at least one of the connected objects, and the character " / " generally represents that the front and back associated objects are in an "or" relationship.
[0027] It should be noted that with the continuous development and advancement of computer technology, users have higher and higher requirements for server performance. In order to reduce the space required for server layout and reduce server costs, servers including multiple nodes have emerged. For example, by inserting multiple card-type server units into a standard height rack chassis, a high-availability, high-density and low-cost blade server is formed.
[0028] As a server manufacturer, when a multi-node server leaves the factory, it is necessary to perform a firmware refresh test on the firmware in each node in the multi-node server to ensure that the multi-node server delivered to the user can normally refresh the firmware in each node in the multi-node server.
[0029] BMC firmware is an indispensable part of the server, and the BMC firmware must be tested for firmware refresh before the server leaves the factory. In the related art, when the BMC firmware in any node of a multi-node server is tested for firmware refresh, a refresh process creates a task and executes the refresh of the BMC firmware. When the BMC firmware is refreshed, the legitimacy and integrity of the image file used for the firmware refresh of the BMC firmware are first verified, as well as whether it matches the BMC firmware.
[0030] When it is determined that the image file passes the inspection, the BMC firmware may be refreshed based on the image file.
[0031] When the BMC firmware is refreshed based on the image file, it can be divided into synchronous refresh and asynchronous refresh. In synchronous refresh, when it is determined that the image file passes the inspection, the BMC firmware is directly refreshed based on the image file; while in asynchronous refresh, the BMC firmware needs to be restarted so that the image file takes effect, and then the BMC firmware is refreshed based on the image file.
[0032] Based on whether the BMC firmware successfully completes the firmware refresh, it can be determined whether the BMC firmware passes the firmware refresh test.
[0033] Before the BMC firmware is updated based on the image file, if the firmware update task of the BMC firmware is to be canceled, the firmware update task of the BMC firmware can be canceled through the Refish interface.
[0034] However, after the BMC firmware is refreshed based on the image file, if the image file is found to be incorrect, the firmware refresh of the firmware to be refreshed cannot be stopped immediately. The image file can only be replaced after the BMC firmware is refreshed based on the image file. The BMC firmware can then be refreshed again based on the replaced image file, resulting in a waste of manpower and time costs.
[0035] Furthermore, if the firmware refresh of the BMC firmware is forcibly terminated after the firmware refresh of the BMC firmware is started based on the image file, the original image file of the BMC firmware will be damaged. Once the image file in the BMC firmware is damaged, the BMC firmware cannot be used normally, thereby affecting the normal use of the multi-node server.
[0036] Moreover, when the BMC firmwares in multiple nodes in a multi-node server are refreshed based on the image file at the same time, after the firmware refresh of the BMC firmwares in the above nodes is started based on the image file, if the image file is found to be incorrect, the image file can only be replaced after the firmware refresh of the BMC firmware in each node based on the image file is completed, which will cause greater waste of manpower and time costs.
[0037] In this regard, the present invention provides a firmware refresh method. Based on the firmware refresh method provided by the present invention, after starting to refresh the firmware to be refreshed based on the image file, the firmware refresh of the firmware to be refreshed can be terminated at any time without causing abnormality in the firmware to be refreshed, which can improve the flexibility of firmware refresh.
[0038] Combine the following Figure 1-Figure 2 The firmware updating method of the present invention is described.
[0039] Figure 1 It is one of the flowcharts of the firmware refresh method provided by the present invention, such as Figure 1 As shown, the method includes the following: Step 101, when a firmware refresh task of the firmware to be refreshed is triggered, an image file to be refreshed of the firmware to be refreshed is obtained, and the original image file of the firmware to be refreshed is written into a target storage medium.
[0040] It should be noted that the execution subject of the embodiment of the present invention is a firmware refresh device. The above firmware refresh device can be configured in electronic devices such as computers and servers.
[0041] Specifically, the firmware to be refreshed is the refresh object of the firmware refreshing method provided by the present invention. Based on the firmware refreshing method provided by the present invention, the firmware to be refreshed can be refreshed.
[0042] It is understandable that the firmware to be refreshed in the embodiment of the present invention may be determined based on actual requirements. The firmware to be refreshed in the embodiment of the present invention is not specifically limited.
[0043] It should be noted that the firmware to be refreshed in the embodiment of the present invention may be BMC firmware, BIOS firmware, UEFI firmware, power firmware, backplane firmware, and mainboard firmware, etc. The specific type of the firmware to be refreshed in the embodiment of the present invention is not specifically limited.
[0044] When it is necessary to perform firmware refresh on the firmware to be refreshed, the firmware to be refreshed may be refreshed by initiating a firmware refresh task of the firmware to be refreshed.
[0045] Optionally, in the embodiment of the present invention, a firmware refresh task of the firmware to be refreshed may be triggered based on user input.
[0046] In the case of triggering a firmware refresh task of the firmware to be refreshed, the embodiment of the present invention can obtain the image file to be refreshed of the firmware to be refreshed in a variety of ways. For example, the image file to be refreshed of the firmware to be refreshed can be obtained based on the user's input, or the image file to be refreshed of the firmware to be refreshed sent by other electronic devices can also be received.
[0047] As an optional embodiment, before obtaining the image file to be refreshed of the firmware to be refreshed, the method further includes: establishing a communication link with the electronic device where the firmware to be refreshed is located according to the Internet Protocol address IP address of the electronic device where the firmware to be refreshed is located.
[0048] Acquiring the image file to be refreshed of the firmware to be refreshed includes: acquiring the original image file to be refreshed of the firmware to be refreshed.
[0049] In the case of triggering a firmware refresh task of the firmware to be refreshed, the embodiment of the present invention can obtain the original image file to be refreshed of the firmware to be refreshed in a variety of ways. For example, the original image file to be refreshed of the firmware to be refreshed can be obtained based on the user's upload, or the original image file to be refreshed of the firmware to be refreshed sent by other electronic devices can also be received.
[0050] Get the version number and identification information of the original image file to be updated.
[0051] After obtaining the original image file to be refreshed of the firmware to be refreshed, the version number and identification information of the original image file to be refreshed can be obtained through data query. The identification information of the original image file to be refreshed may include the model and identification information of the electronic device to which the original image file to be refreshed is adapted.
[0052] Based on the version number and identification information of the original image file to be refreshed, the integrity and legality of the original image file to be refreshed and whether it is compatible with the firmware to be refreshed are verified.
[0053] After obtaining the version number and identification information of the original image file to be refreshed, the original image file to be refreshed can be verified by calculating and comparing hash values based on the version number and identification information of the original image file to be refreshed. The legality of the original image file to be refreshed can be verified by checking the version number of the original image file to be refreshed. By checking the model and identification information of the electronic device to which the original image file to be refreshed is adapted in the identification information of the original image file to be refreshed, it is determined whether the original image file to be refreshed is adapted to the firmware to be refreshed.
[0054] When it is determined that the original image file to be refreshed passes the verification, the original image file to be refreshed is determined as the image file to be refreshed.
[0055] If it is determined that the original image file to be refreshed is complete, legal and adapted to the firmware to be refreshed, it can be determined that the original image file to be refreshed passes the verification, and then the original image file to be refreshed can be determined as the image file to be refreshed of the firmware to be refreshed.
[0056] In the embodiment of the present invention, by verifying the image file to be refreshed, the security of firmware refreshing can be ensured, the success rate of firmware refreshing can be improved, and the maintenance cost and time of firmware can be reduced, thereby improving user perception.
[0057] It is understandable that before the firmware to be refreshed is refreshed, the disk or flash memory stores the image file of the firmware to be refreshed. In the embodiment of the present invention, before the firmware to be refreshed is refreshed, the image file of the firmware to be refreshed stored in the disk or flash memory is determined as the original image file of the firmware to be refreshed.
[0058] In the case of triggering a firmware refresh task of the firmware to be refreshed, the original image file of the firmware to be refreshed may also be written into the target storage medium.
[0059] As an optional embodiment, writing the original image file of the firmware to be updated into the target storage medium includes: obtaining the source storage medium where the original image file is located and the size of the original image file.
[0060] Specifically, in the embodiment of the present invention, the storage medium where the original image file of the firmware to be updated is located can be determined as the source storage medium.
[0061] In the embodiment of the present invention, the source storage medium where the original image file of the firmware to be updated is located and the size of the original image file can be obtained by means of data query.
[0062] Based on the size of the original image file, select a volatile medium as the target storage medium.
[0063] After obtaining the size of the original image file of the firmware to be updated, a volatile medium with a storage capacity sufficient to store the original image file can be selected as a target storage medium from volatile media capable of storing data based on the size of the original image file.
[0064] It should be noted that the volatile medium in the embodiment of the present invention may include random access memory (RAM), cache and other forms of volatile memory. The specific type of the volatile medium is not limited in the embodiment of the present invention.
[0065] The original image file is read from the source storage medium and written to the target storage medium.
[0066] After determining the target storage medium based on the size of the original image file, the original image file of the firmware to be updated can be read from the source storage medium, and then the original image file can be written into the target storage medium.
[0067] Verify whether the original image file in the target storage medium is consistent with the original image file in the source storage medium. If it is determined that the original image file in the target storage medium is consistent with the original image file in the source storage medium, determine that the original image file is successfully written into the target storage medium.
[0068] After the original image file is written into the target storage medium, it can be verified in a variety of ways whether the original image file in the target storage medium is consistent with the original image file in the source storage medium.
[0069] As an optional embodiment, verifying whether the original image file in the target storage medium is consistent with the original image file in the source storage medium includes: verifying whether the original image file in the target storage medium is consistent with the original image file in the source storage medium based on a hash value and / or a checksum.
[0070] When it is determined that the original image file in the target storage medium is consistent with the original image file in the source storage medium, it can be determined that the original image file of the firmware to be updated is successfully written into the target storage medium.
[0071] Step 102: When it is determined that the original image file is successfully written into the target storage medium, the original image file of the firmware to be refreshed is erased, and the image file to be refreshed is written into the main flash memory of the firmware to be refreshed.
[0072] As an optional embodiment, erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the firmware to be refreshed includes: erasing the original image file from the source storage medium and writing the image file to be refreshed into the main flash memory of the firmware to be refreshed according to sectors.
[0073] Specifically, when it is determined that the original image file is successfully written into the target storage medium, the image file to be refreshed can be written into the main flash memory of the firmware to be refreshed while the original image file is erased from the source storage medium.
[0074] It should be noted that the main flash memory of the firmware to be refreshed in the embodiment of the present invention is the main flash memory on which the storage of the firmware to be refreshed depends.
[0075] In the process of writing the image file to be refreshed into the main flash memory, when the writing of the current block in the main flash memory is completed, a copy-back check is performed to check whether the original image file written in the current block is consistent with the original image file in the target storage medium. When it is determined that the original image file written in the current block is consistent with the original image file in the target storage medium, the writing of the next block in the main flash memory is performed.
[0076] Step 103: during the process of erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory, determine whether a termination signal indicating the termination of the firmware refresh task is received; if the termination signal is received, stop erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory, delete the image file to be refreshed in the main flash memory, and rewrite the original image file in the target storage medium into the main flash memory; if the termination signal is not received, after writing the image file to be refreshed into the main flash memory, complete the firmware refresh of the firmware to be refreshed based on the image file to be refreshed in the main flash memory.
[0077] As an optional embodiment, completing the firmware refresh of the firmware to be refreshed based on the image file to be refreshed in the main flash memory includes: restarting the firmware to be refreshed.
[0078] The image file to be refreshed in the main flash memory is written into the backup flash memory of the firmware to be refreshed.
[0079] When it is determined that the image file to be refreshed is successfully written into the backup flash memory, it is determined that the firmware to be refreshed is refreshed successfully.
[0080] It should be noted that, in the process of erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed to the main flash memory, if a termination signal is received, the original image file in the target storage medium can be deleted after stopping erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed to the main flash memory, deleting the image file to be refreshed in the main flash memory, and rewriting the original image file in the target storage medium to the main flash memory.
[0081] In the process of erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory, if no termination signal is received, the original image file in the target storage medium can be deleted after determining that the firmware to be refreshed is refreshed successfully.
[0082] As an optional embodiment, in the case where there are multiple firmwares to be refreshed, in the process of erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory, it is determined whether a termination signal indicating the termination of the firmware refresh task is received. In the case where the termination signal is received, erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory are stopped, the image file to be refreshed in the main flash memory is deleted, and the original image file in the target storage medium is rewritten into the main flash memory. In the case where the termination signal is not received, after writing the image file to be refreshed into the main flash memory, the firmware refresh of the firmware to be refreshed is completed based on the image file to be refreshed in the main flash memory, including: erasing each original image file of the firmware to be refreshed and writing the image file to be refreshed into each firmware to be refreshed In the process of writing the image file to the main flash memory of any firmware to be refreshed, it is determined whether a termination signal indicating the termination of the firmware refresh task of any firmware to be refreshed is received; when the termination signal indicating the termination of the firmware refresh task of any firmware to be refreshed is received, the erasing of the original image file of any firmware to be refreshed and the writing of the image file to be refreshed into the main flash memory of any firmware to be refreshed are stopped, the image file to be refreshed in the main flash memory of any firmware to be refreshed is deleted, and the original image file in the target storage medium is rewritten into the main flash memory of any firmware to be refreshed; when the termination signal indicating the termination of the firmware refresh task of any firmware to be refreshed is not received, after the image file to be refreshed is written into the main flash memory of any firmware to be refreshed, the firmware refresh of any firmware to be refreshed is completed based on the image file to be refreshed in the main flash memory of any firmware to be refreshed.
[0083] The embodiment of the present invention obtains the image file to be refreshed of the firmware to be refreshed under the condition of triggering the firmware refresh task of the firmware to be refreshed, and writes the original image file of the firmware to be refreshed into the target storage medium; when it is determined that the original image file is successfully written into the target storage medium, the original image file of the firmware to be refreshed is erased, and the image file to be refreshed is written into the main flash memory of the firmware to be refreshed; in the process of erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory, it is judged whether a termination signal indicating the termination of the firmware refresh task is received; when the termination signal is received, the erasing of the original image file of the firmware to be refreshed and the writing of the image file to be refreshed into the main flash memory are stopped, and the original image file in the target storage medium is rewritten into the main flash memory; when the termination signal is not received, after the image file to be refreshed is written into the main flash memory, the firmware refresh of the firmware to be refreshed is completed based on the image file to be refreshed in the main flash memory; during the firmware refresh process, the firmware refresh can be terminated at any time without causing the firmware to have a functional abnormality, the flexibility of the firmware refresh can be improved, the labor cost and time cost waste caused by terminating the firmware refresh can be reduced, the efficiency of the firmware refresh is improved, the operation of the firmware refresh is simple, the scalability is strong, and the reliability is strong, and the firmware refresh has broad application prospects.
[0084] In order to facilitate the understanding of the firmware refresh method provided by the present invention, the firmware refresh method provided by the present invention is described below by using an example. Figure 2 FIG. 2 is a flow chart of the firmware refresh method provided by the present invention. Figure 2 As shown, in the case of triggering the firmware refresh task of the firmware to be refreshed, based on the IP address of the electronic device where the firmware to be refreshed is located, the intelligent platform interface tool is used to try to establish a communication link between the firmware refresh device and the electronic device where the firmware to be refreshed is located, and it is determined whether the establishment of the above-mentioned communication link is successful.
[0085] When it is determined that the communication link between the firmware refreshing apparatus and the electronic device where the firmware to be refreshed is located is not successfully established, abnormal information indicating abnormal communication between the firmware refreshing apparatus and the electronic device where the firmware to be refreshed is located is issued.
[0086] When it is determined that the communication link between the firmware refreshing device and the electronic device where the firmware to be refreshed is located is successfully established, HTTPS connection is used to enter the WEB page of the firmware to be refreshed, the original image file to be refreshed of the firmware to be refreshed is uploaded, and it is determined whether the original image file to be refreshed of the firmware to be refreshed is uploaded successfully.
[0087] When it is determined that the original image file to be refreshed of the firmware to be refreshed has not been uploaded successfully, an exception message indicating that the original image file to be refreshed of the firmware to be refreshed has not been uploaded successfully is issued.
[0088] When it is determined that the original image file to be refreshed of the firmware to be refreshed is uploaded successfully, the version number and identification information of the original image file to be refreshed are obtained, and then based on the version number and identification information of the original image file to be refreshed, the integrity, legality and whether the original image file to be refreshed is compatible with the firmware to be refreshed are verified.
[0089] When it is determined that the original image file to be refreshed fails to pass the verification, an abnormal information indicating that the original image file to be refreshed of the firmware to be refreshed fails to pass the verification is issued.
[0090] When it is determined that the original image file to be refreshed passes the verification, the original image file to be refreshed is determined as the image file to be refreshed of the firmware to be refreshed, and then based on the size of the original image file of the firmware to be refreshed, a volatile medium is selected as the target storage medium.
[0091] The original image file of the firmware to be updated is read from the source storage medium where the original image file is located, and the original image file is written into the target storage medium.
[0092] Verify that the original image file in the target storage medium is consistent with the original image file in the source storage medium.
[0093] When it is determined that the original image file in the target storage medium is inconsistent with the original image file in the source storage medium, an abnormal information indicating that the backup of the original image file of the firmware to be refreshed fails is issued.
[0094] When it is determined that the original image file in the target storage medium is consistent with the original image file in the source storage medium, it is determined that the original image file is successfully written into the target storage medium.
[0095] When it is determined that the original image file is successfully written into the target storage medium, the original image file is erased from the source storage medium, and the image file to be refreshed is written into the main flash memory of the firmware to be refreshed according to sectors.
[0096] During the process of erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory, it is determined whether a termination signal indicating termination of the firmware refresh task is received.
[0097] When the termination signal is received, erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory are stopped, and the original image file in the target storage medium is rewritten into the main flash memory.
[0098] When no termination signal is received, after the image file to be refreshed is written into the main flash memory, the firmware to be refreshed is restarted, and the image file to be refreshed in the main flash memory is written into the backup flash memory of the firmware to be refreshed. Then, when it is determined that the image file to be refreshed is successfully written into the backup flash memory, it is determined that the firmware to be refreshed is refreshed successfully.
[0099] The present invention aims at the technical problem that the firmware refresh cannot be terminated during the firmware refresh process, and provides a method that can terminate the firmware refresh on the basis of not damaging the original image file of the firmware, thereby reducing the waste of manpower, resources and time costs caused by incorrectly flashing or wrongly flashing the firmware image file, ensuring the normal operation of the electronic equipment business, and reducing the maintenance cost of the electronic equipment. The present invention adds a refresh termination in the firmware refresh process, and adds an operation of rolling back the original image file, which can ensure the normal operation of the firmware function to the greatest extent.
[0100] The firmware refresh method provided by the present invention, during the firmware refresh process, informs the refresh process to terminate the firmware refresh task by means of a trigger signal, and the new task supervises the re-flash of the original image file. After the re-flash of the original image file is completed, the firmware is re-flashed to the original version to ensure that the firmware can be used normally, and at the same time deletes the wrong image file to prevent affecting the next firmware refresh task.
[0101] The original image file is stored in a volatile medium for recovery when an error occurs during flashing. After the flashing is completed, the firmware image in the volatile medium is deleted to release the memory in the volatile medium.
[0102] When the firmware in multiple nodes in a multi-node server is refreshed, the normal execution of other refresh tasks is not affected, ensuring the high efficiency of simultaneous refresh of multiple firmwares. At the same time, it has the flexibility to terminate the firmware refresh task at any time, and can be used in more application scenarios, meeting the humanized and convenient firmware refresh test needs.
[0103] Figure 3 This is a schematic diagram of the structure of the firmware refresh device provided by the present invention. Figure 3 The firmware refresh device provided by the present invention is described. The firmware refresh device described below and the firmware refresh method provided by the present invention described above can be referred to each other. Figure 3 As shown, the device includes: a data acquisition module 301, a data backup module 302 and a firmware refresh module 303.
[0104] The data acquisition module 301 is used to acquire the image file to be refreshed of the firmware to be refreshed when the firmware refresh task of the firmware to be refreshed is triggered, and write the original image file of the firmware to be refreshed into the target storage medium.
[0105] The data backup module 302 is used to erase the original image file of the firmware to be refreshed and write the image file to be refreshed into the main flash memory of the firmware to be refreshed when it is determined that the original image file is successfully written into the target storage medium.
[0106] The firmware refresh module 303 is used to determine whether a termination signal indicating the termination of the firmware refresh task is received during the process of erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory. If the termination signal is received, the module stops erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory, deletes the image file to be refreshed in the main flash memory, and rewrites the original image file in the target storage medium into the main flash memory. If the termination signal is not received, after writing the image file to be refreshed into the main flash memory, the firmware refresh of the firmware to be refreshed is completed based on the image file to be refreshed in the main flash memory.
[0107] Specifically, the data acquisition module 301, the data backup module 302 and the firmware refresh module 303 are electrically connected.
[0108] The firmware refresh device in the embodiment of the present invention obtains the image file to be refreshed of the firmware to be refreshed under the condition of triggering the firmware refresh task of the firmware to be refreshed, and writes the original image file of the firmware to be refreshed into the target storage medium; when it is determined that the original image file is successfully written into the target storage medium, the original image file of the firmware to be refreshed is erased, and the image file to be refreshed is written into the main flash memory of the firmware to be refreshed; in the process of erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory, it is determined whether a termination signal indicating the termination of the firmware refresh task is received; when the termination signal is received, erasing the original image file of the firmware to be refreshed is stopped; The method can write the image file to be refreshed into the main flash memory, write the image file to be refreshed into the main flash memory, and rewrite the original image file in the target storage medium into the main flash memory. When no termination signal is received, after writing the image file to be refreshed into the main flash memory, the firmware refresh of the firmware to be refreshed is completed based on the image file to be refreshed in the main flash memory. The firmware refresh can be terminated at any time during the firmware refresh process without causing functional abnormalities in the firmware. The flexibility of the firmware refresh can be improved, the waste of labor cost and time cost caused by terminating the firmware refresh can be reduced, and the efficiency of the firmware refresh is improved. The operation of the firmware refresh is simple, the scalability is strong, and the reliability is strong, and the firmware refresh has broad application prospects.
[0109] Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4As shown, the electronic device may include: a processor (processor) 410 , a communication interface (Communications Interface) 420 , a memory (memory) 430 and a communication bus 440 , wherein the processor 410 , the communication interface 420 , and the memory 430 communicate with each other through the communication bus 440 . The processor 410 can call the logic instructions in the memory 430 to execute the firmware refresh method, which includes: in the case of triggering the firmware refresh task of the firmware to be refreshed, obtaining the image file to be refreshed of the firmware to be refreshed, and writing the original image file of the firmware to be refreshed to the target storage medium; in the case of determining that the original image file is successfully written into the target storage medium, erasing the original image file of the firmware to be refreshed, and writing the image file to be refreshed into the main flash memory of the firmware to be refreshed; in the process of erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory, judging whether a termination signal indicating the termination of the firmware refresh task is received, and in the case of receiving the termination signal, stopping erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory, deleting the image file to be refreshed in the main flash memory, and rewriting the original image file in the target storage medium into the main flash memory, and in the case of not receiving the termination signal, after writing the image file to be refreshed into the main flash memory, completing the firmware refresh of the firmware to be refreshed based on the image file to be refreshed in the main flash memory.
[0110] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0111] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the firmware refresh method provided by the above methods, which method includes: in the case of triggering a firmware refresh task of the firmware to be refreshed, obtaining the image file to be refreshed of the firmware to be refreshed, and writing the original image file of the firmware to be refreshed to the target storage medium; in the case of determining that the original image file is successfully written into the target storage medium, erasing the original image file of the firmware to be refreshed, and writing the image file to be refreshed into the main flash memory of the firmware to be refreshed; in the process of erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory, determining whether a termination signal indicating the termination of the firmware refresh task is received, and in the case of receiving the termination signal, stopping erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory, deleting the image file to be refreshed in the main flash memory, and rewriting the original image file in the target storage medium into the main flash memory, and in the case of not receiving the termination signal, after writing the image file to be refreshed into the main flash memory, completing the firmware refresh of the firmware to be refreshed based on the image file to be refreshed in the main flash memory.
[0112] On the other hand, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it is implemented to execute the firmware refresh method provided by the above methods, the method comprising: in the case of triggering a firmware refresh task of the firmware to be refreshed, obtaining the image file to be refreshed of the firmware to be refreshed, and writing the original image file of the firmware to be refreshed to the target storage medium; in the case of determining that the original image file is successfully written into the target storage medium, erasing the original image file of the firmware to be refreshed, and writing the image file to be refreshed to the main flash memory of the firmware to be refreshed; in the process of erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed to the main flash memory, determining whether a termination signal indicating the termination of the firmware refresh task is received, in the case of receiving the termination signal, stopping erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed to the main flash memory, deleting the image file to be refreshed in the main flash memory, and rewriting the original image file in the target storage medium to the main flash memory, in the case of not receiving the termination signal, after writing the image file to be refreshed to the main flash memory, completing the firmware refresh of the firmware to be refreshed based on the image file to be refreshed in the main flash memory.
[0113] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0114] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0115] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A firmware refresh method, characterized in that: include: In the case of triggering a firmware refresh task of the firmware to be refreshed, obtaining an image file to be refreshed of the firmware to be refreshed, and writing the original image file of the firmware to be refreshed into a target storage medium; In the case of determining that the original image file is successfully written into the target storage medium, erasing the original image file of the firmware to be refreshed, and writing the image file to be refreshed into the main flash memory of the firmware to be refreshed; In the process of erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory, it is determined whether a termination signal indicating the termination of the firmware refresh task is received; if the termination signal is received, erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory are stopped, the image file to be refreshed in the main flash memory is deleted, and the original image file in the target storage medium is rewritten into the main flash memory; if the termination signal is not received, after writing the image file to be refreshed into the main flash memory, the firmware refresh of the firmware to be refreshed is completed based on the image file to be refreshed in the main flash memory.
2. The firmware updating method according to claim 1, characterized in that: The step of writing the original image file of the firmware to be updated into a target storage medium comprises: Obtain the source storage medium where the original image file is located and the size of the original image file; Based on the size of the original image file, selecting a volatile medium as the target storage medium; Reading the original image file from the source storage medium, and writing the original image file to the target storage medium; Verify whether the original image file in the target storage medium is consistent with the original image file in the source storage medium. If it is determined that the original image file in the target storage medium is consistent with the original image file in the source storage medium, determine that the original image file is successfully written into the target storage medium.
3. The firmware updating method according to claim 2, characterized in that: The step of erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory of the firmware to be refreshed comprises: Erasing the original image file from the source storage medium, and writing the image file to be refreshed into the main flash memory of the firmware to be refreshed according to sectors; In the process of writing the image file to be refreshed into the main flash memory, when the writing of the current block in the main flash memory is completed, a copy-back check is performed to check whether the original image file written in the current block is consistent with the original image file in the target storage medium. When it is determined that the original image file written in the current block is consistent with the original image file in the target storage medium, the writing of the next block in the main flash memory is performed.
4. The firmware updating method according to claim 2, characterized in that: The verifying whether the original image file in the target storage medium is consistent with the original image file in the source storage medium includes: Based on the hash value and / or the checksum, verify whether the original image file in the target storage medium is consistent with the original image file in the source storage medium.
5. The firmware updating method according to claim 1, characterized in that: The step of completing the firmware refresh of the firmware to be refreshed based on the image file to be refreshed in the main flash memory includes: Restarting the firmware to be refreshed; Writing the image file to be refreshed in the main flash memory into the backup flash memory of the firmware to be refreshed; In the case where it is determined that the image file to be refreshed is successfully written into the backup flash memory, it is determined that the firmware to be refreshed is refreshed successfully.
6. The firmware updating method according to claim 1, characterized in that: Before obtaining the image file to be updated of the firmware to be updated, the method further includes: Establishing a communication link with the electronic device where the firmware to be refreshed is located according to the Internet Protocol address IP address of the electronic device where the firmware to be refreshed is located; The step of obtaining the image file to be updated of the firmware to be updated includes: Obtaining the original image file to be updated of the firmware to be updated; Obtaining the version number and identification information of the original image file to be updated; Based on the version number and identification information of the original image file to be refreshed, verify the integrity and legality of the original image file to be refreshed and whether it is compatible with the firmware to be refreshed; In the case where it is determined that the original image file to be refreshed passes the verification, the original image file to be refreshed is determined as the image file to be refreshed.
7. The firmware updating method according to any one of claims 1 to 6, characterized in that: In the case that there are multiple firmwares to be refreshed, in the process of erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory, judging whether a termination signal indicating termination of the firmware refresh task is received, and in the case of receiving the termination signal, stopping erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory, deleting the image file to be refreshed in the main flash memory, and rewriting the original image file in the target storage medium into the main flash memory, and in the case of not receiving the termination signal, after writing the image file to be refreshed into the main flash memory, completing the firmware refresh of the firmware to be refreshed based on the image file to be refreshed in the main flash memory, including: In the process of erasing the original image file of each firmware to be refreshed and writing the image file to be refreshed into the main flash memory of each firmware to be refreshed, determining whether a termination signal indicating termination of the firmware refresh task of any firmware to be refreshed is received; In the case of receiving the termination signal indicating the termination of the firmware refresh task of any firmware to be refreshed, stopping erasing the original image file of any firmware to be refreshed and writing the image file to be refreshed into the main flash memory of any firmware to be refreshed, deleting the image file to be refreshed in the main flash memory of any firmware to be refreshed, and rewriting the original image file in the target storage medium into the main flash memory of any firmware to be refreshed; in the case of not receiving the termination signal indicating the termination of the firmware refresh task of any firmware to be refreshed, after writing the image file to be refreshed into the main flash memory of any firmware to be refreshed, complete the firmware refresh of any firmware to be refreshed based on the image file to be refreshed in the main flash memory of any firmware to be refreshed.
8. A firmware updating device, characterized in that: include: A data acquisition module, used for acquiring the image file to be refreshed of the firmware to be refreshed when a firmware refresh task of the firmware to be refreshed is triggered, and writing the original image file of the firmware to be refreshed into a target storage medium; A data backup module, configured to erase the original image file of the firmware to be refreshed and write the image file to be refreshed into the main flash memory of the firmware to be refreshed when it is determined that the original image file is successfully written into the target storage medium; A firmware refresh module is used to determine whether a termination signal indicating termination of the firmware refresh task is received during the process of erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory; if the termination signal is received, the module stops erasing the original image file of the firmware to be refreshed and writing the image file to be refreshed into the main flash memory, deletes the image file to be refreshed in the main flash memory, and rewrites the original image file in the target storage medium into the main flash memory; if the termination signal is not received, after writing the image file to be refreshed into the main flash memory, the module completes the firmware refresh of the firmware to be refreshed based on the image file to be refreshed in the main flash memory.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the firmware refreshing method according to any one of claims 1 to 7 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the firmware refreshing method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Multi-firmware refreshing method and device, electronic equipment and storage medium
CN120335844A
