Firmware upgrading method and device, equipment and medium

By backing up and decompressing firmware files, using preset tools to perform upgrade actions, and retry and rollback on failure, it solves the problem of time-consuming and unupdated versions caused by BMC upgrade failure, and improves operation and maintenance efficiency and security .

CN119201185APending Publication Date: 2024-12-27INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411310605.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

The existing BMC firmware upgrade failure processing method takes a long time and may affect the progress of subsequent tasks, resulting in the BMC firmware version not being updated in time, affecting the normal operation of the device.

Method used

By obtaining the firmware installation package, we can determine whether the versions of the initial firmware file and the target firmware file are the same. If it is different, backup and decompress the target firmware file, use the preset installation tool to perform the firmware update action, and judge whether the update action is successful by checking the value; If it fails, get the system log to determine the cause and try the upgrade again after the system restarts to ensure version rollback and error logging.

Benefits of technology

Improves the security and operation and maintenance efficiency of firmware upgrades, avoids the time-consuming problems caused by meaningless retry, ensures that the BMC can run normally when the upgrade fails, and records the upgrade log for maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201185A_ABST
    Figure CN119201185A_ABST
Patent Text Reader

Abstract

The invention discloses a firmware upgrading method and device, equipment and a medium, and relates to the technical field of storage. When firmware upgrading is prepared, the initial firmware file is backed up, and version rollback can be achieved when firmware upgrading fails; when firmware upgrading is carried out, a preset installation tool is called based on the target firmware file to execute a firmware updating action, and whether the firmware updating action is executed successfully or not is judged; if it is confirmed that the firmware updating action is executed successfully, but the version of the current firmware file is not the version of the target firmware file, it is confirmed that firmware upgrading fails, and whether the current firmware upgrading fails for the first time or not is judged according to the flag bit file; if it is confirmed that the current firmware upgrade fails for the first time, retrying to upgrade after the system is restarted; and if it is confirmed that the current firmware upgrading is not failed for the first time, it is considered that firmware upgrading is failed for multiple times, the firmware upgrading process is directly exited, and alarm information is reported, so that the problem of long time consumption caused by meaningless firmware upgrading retry is avoided, and the operation and maintenance efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of storage technology, and in particular to a firmware upgrade method, device, equipment and medium. Background Art

[0002] The Baseboard Management Controller (BMC) is a small operating system independent of the server or storage system, used to remotely manage and monitor devices. Its firmware upgrade is usually completed together with the Basic Input Output System (BIOS) firmware upgrade during the boot phase. However, the upgrade process may be affected by various external factors, such as power outages, BIOS software errors, or firmware file errors, resulting in upgrade failures.

[0003] When the current software architecture handles BMC upgrade failures, it usually reports an alarm when the device starts after the upgrade, prompting the user to re-upgrade. However, this method has disadvantages, such as the user needs to restart the device and rebuild the firmware file, which takes a long time; and when performing automated tasks, if a probabilistic problem causes the upgrade to fail, the BMC firmware version may still be the old version, affecting the subsequent tasks.

[0004] In view of the above problems, how to solve the current processing method of BMC upgrade failure is time-consuming and may affect the subsequent tasks, which is an urgent problem to be solved by technical personnel in this field. Summary of the invention

[0005] The purpose of the present invention is to provide a firmware upgrade method, device, equipment and medium to solve the problem that the current processing method of BMC upgrade failure is time-consuming and may affect the subsequent tasks.

[0006] In order to solve the above technical problems, the present invention provides a firmware upgrade method, comprising:

[0007] Obtain the firmware installation package and determine whether the version of the current initial firmware file of the system is the same as the version of the target firmware file in the firmware installation package;

[0008] If it is confirmed that the version of the initial firmware file is different from the version of the target firmware file, the initial firmware file is backed up, and the firmware installation package is decompressed to obtain the target firmware file;

[0009] Calling a preset installation tool based on the target firmware file to perform a firmware update action, and determining whether the firmware update action is successfully executed;

[0010] If it is confirmed that the firmware update action is executed successfully, then determine whether the version of the current firmware file is the version of the target firmware file;

[0011] If it is confirmed that the version of the current firmware file is not the version of the target firmware file, it is confirmed that the firmware upgrade has failed, and it is determined whether the current firmware upgrade has failed for the first time based on the flag file;

[0012] If it is confirmed that the current firmware upgrade fails for the first time, the step of obtaining the firmware installation package is performed after the system is restarted;

[0013] If it is confirmed that this is not the first firmware upgrade failure, exit the firmware upgrade process and report an alarm.

[0014] On the one hand, the determining whether the firmware update action is successfully executed includes:

[0015] Obtaining a first verification value of the target firmware file before the firmware upgrade and a second verification value of the current firmware file after the firmware upgrade respectively according to a preset verification algorithm;

[0016] Determining whether the first check value is consistent with the second check value;

[0017] If it is confirmed that the first check value is consistent with the second check value, it is confirmed that the firmware update action is successfully executed;

[0018] If it is confirmed that the first verification value is inconsistent with the second verification value, it is confirmed that the firmware update action fails to execute.

[0019] On the other hand, if it is confirmed that the firmware update action fails, it also includes:

[0020] Get the system logs during the firmware update action;

[0021] Determine the reason why the firmware update action failed based on the system log;

[0022] The reasons for the failure of the firmware update action at least include system power failure, default installation tool error, CPU power failure and basic input and output system memory allocation error.

[0023] On the other hand, if it is confirmed that the firmware update action fails, it also includes:

[0024] Get the backed up initial firmware file;

[0025] Roll back the firmware file version based on the initial firmware file.

[0026] On the other hand, judging whether the current firmware upgrade fails for the first time according to the flag file includes:

[0027] Retrieving the flag file stored in the system; wherein the flag file is a file generated when the firmware file fails to be upgraded for the first time;

[0028] Determine whether the flag file is obtained;

[0029] If it is confirmed that the flag file is not obtained, it is confirmed that the current firmware upgrade fails for the first time;

[0030] Creating the flag file;

[0031] Controlling the system to execute a restart operation based on the restart instruction, and executing the step of obtaining the firmware installation package after the system restarts;

[0032] If it is confirmed that the flag file is obtained, it is confirmed that the current firmware upgrade is not failed for the first time, the firmware upgrade process is exited and the alarm information is reported;

[0033] Correspondingly, if it is confirmed that the version of the current firmware file is the version of the target firmware file, it also includes:

[0034] Confirm that the firmware upgrade was successful;

[0035] Retrieving the flag file stored in the system;

[0036] Determine whether the flag file is obtained;

[0037] If it is confirmed that the flag file is not obtained, then exit the firmware upgrade process;

[0038] If it is confirmed that the flag file is obtained, the flag file is cleared.

[0039] On the other hand, it also includes:

[0040] Generate a firmware upgrade log; wherein the firmware upgrade log contains all information of the system firmware upgrade process;

[0041] The firmware upgrade log is uploaded to the cloud platform.

[0042] On the other hand, if it is confirmed that the version of the current firmware file is the version of the target firmware file, it also includes:

[0043] Confirm that the firmware upgrade is successful, and obtain the firmware upgrade log generated this time;

[0044] Determine whether an abnormality occurs during the firmware upgrade process according to the firmware upgrade log;

[0045] If it is confirmed that an abnormality occurs during the firmware upgrade process, a prompt message indicating that the firmware upgrade process is abnormal is output.

[0046] In order to solve the above technical problems, the present invention further provides a firmware upgrade device, comprising:

[0047] The acquisition module is used to obtain the firmware installation package and determine whether the version of the current initial firmware file of the system is the same as the version of the target firmware file in the firmware installation package; if it is confirmed that the version of the initial firmware file is different from the version of the target firmware file, the backup decompression module is triggered;

[0048] The backup decompression module is used to back up the initial firmware file and decompress the firmware installation package to obtain the target firmware file;

[0049] A first judgment module is used to call a preset installation tool based on a target firmware file to perform a firmware update action, and to judge whether the firmware update action is successfully executed; if it is confirmed that the firmware update action is successfully executed, a second judgment module is triggered;

[0050] The second judgment module is used to judge whether the version of the current firmware file is the version of the target firmware file; if it is confirmed that the version of the current firmware file is not the version of the target firmware file, it is determined that the firmware upgrade fails, and the third judgment module is triggered;

[0051] The third judgment module is used to judge whether the current firmware upgrade fails for the first time according to the flag file; if it is confirmed that the current firmware upgrade fails for the first time, the acquisition module is triggered after the system is restarted; if it is confirmed that the current firmware upgrade fails for the first time, the alarm module is triggered;

[0052] The alarm module is used to exit the firmware upgrade process and report alarm information.

[0053] In order to solve the above technical problems, the present invention further provides a firmware upgrade device, comprising:

[0054] Memory for storing computer programs;

[0055] The processor is used to implement the steps of the above-mentioned firmware upgrade method when executing the computer program.

[0056] In order to solve the above technical problem, the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above firmware upgrade method are implemented.

[0057] The firmware upgrade method provided by the present invention specifically obtains a firmware installation package, determines whether the version of the current initial firmware file of the system is the same as the version of the target firmware file in the firmware installation package; if it is confirmed that the version of the initial firmware file is different from the version of the target firmware file, the initial firmware file is backed up, and the firmware installation package is decompressed to obtain the target firmware file; based on the target firmware file, a preset installation tool is called to perform a firmware update action, and it is determined whether the firmware update action is successfully executed; if it is confirmed that the firmware update action is successfully executed, it is determined whether the version of the current firmware file is the version of the target firmware file; if it is confirmed that the version of the current firmware file is not the version of the target firmware file, it is determined that the firmware upgrade has failed, and it is determined whether the current firmware upgrade has failed for the first time according to the flag file; if it is confirmed that the current firmware upgrade has failed for the first time, the step of obtaining the firmware installation package is executed after the system is restarted; if it is confirmed that the current firmware upgrade has not failed for the first time, the firmware upgrade process is exited and an alarm message is reported.

[0058] The beneficial effects of the present invention lie in that when preparing for a firmware upgrade, the initial firmware file is backed up, and version rollback can be achieved when the firmware upgrade fails, thereby improving security; when performing a firmware upgrade, a preset installation tool is called based on the target firmware file to execute a firmware update action, and determine whether the firmware update action is successfully executed; if it is confirmed that the firmware update action is successfully executed, but the version of the current firmware file is not the version of the target firmware file, the firmware upgrade is confirmed to have failed, and a determination is made based on a flag file whether the current firmware upgrade has failed for the first time; if it is confirmed that the current firmware upgrade has failed for the first time, the upgrade is retried after the system is restarted; if it is confirmed that the current firmware upgrade has not failed for the first time, it is considered that the firmware upgrade has failed for multiple times, and the firmware upgrade process is directly exited and an alarm message is reported, thereby avoiding the time-consuming problem caused by meaningless firmware upgrade retries and improving operation and maintenance efficiency.

[0059] On the other hand, the present invention specifically obtains the first check value of the target firmware file before the firmware upgrade and the second check value of the current firmware file after the firmware upgrade according to a preset check algorithm; determines whether the first check value is consistent with the second check value; if it is confirmed that the first check value is consistent with the second check value, then the firmware update action is confirmed to be executed successfully, otherwise it is confirmed that the firmware update action fails to execute, and whether the firmware update action is successfully executed is determined. When it is confirmed that the firmware update action fails to execute, the system log during the execution of the firmware update action is obtained; the reason for the failure of the firmware update action is determined according to the system log, so that the user can perform firmware upgrade maintenance according to the reason for the failure of the firmware update action. If it is confirmed that the firmware update action fails to execute, it is necessary to obtain the backed-up initial firmware file, and roll back the firmware file version based on the initial firmware file, so as to ensure that the BMC can operate normally even if the firmware upgrade fails.

[0060] In addition, the present invention also provides a firmware upgrade device, equipment and medium, with the same effects as above. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0062] Figure 1 A flowchart of a firmware upgrade method provided by an embodiment of the present invention;

[0063] Figure 2 A schematic diagram of a firmware upgrade device provided by an embodiment of the present invention;

[0064] Figure 3 A schematic diagram of a firmware upgrade device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0065] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0066] The core of the present invention is to provide a firmware upgrade method, device, equipment and medium to solve the problem that the current processing method of BMC upgrade failure is time-consuming and may affect the subsequent tasks.

[0067] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0068] BMC is a chip integrated on the motherboard. It contains an independent small operating system for remote management and monitoring of servers or storage devices. Since BMC software starts running when the device is started, BMC firmware upgrade is usually completed together with BIOS firmware upgrade at the boot stage. However, various problems may be encountered during the upgrade process, such as device power failure, memory allocation problems caused by BIOS software errors, or upgrade failures caused by firmware file errors.

[0069] When the current software architecture handles a BMC upgrade failure, it usually reports an alarm when the device starts after the upgrade is completed, prompting the user to re-upgrade the BMC firmware. However, this method has some disadvantages. First, if the BMC upgrade fails, the user needs to restart the device and rebuild the BMC firmware file, which may take a long time. Secondly, if the user is performing configuration and consistency checks or other automated tasks, and encounters probabilistic problems that cause the BMC upgrade to fail, such as device power failure or BIOS memory allocation errors, the BMC firmware version may still be the old version after the device starts because there is no retry mechanism. This may cause the software system to be unable to continue the automated task due to the alarm of the BMC upgrade failure. In view of the above problems, the present invention provides a firmware upgrade method.

[0070] It should be noted that the firmware upgrade method provided in the present invention is for upgrading the firmware of the BMC, but the firmware upgrade method is also applicable to the firmware upgrade of other devices, such as the firmware upgrade of the BIOS, etc., which is not limited in this embodiment and depends on the specific implementation situation.

[0071] Figure 1 A flowchart of a firmware upgrade method provided by an embodiment of the present invention. Figure 1 As shown, the method includes:

[0072] S10: Obtain a firmware installation package and determine whether the version of the current initial firmware file of the system is the same as the version of the target firmware file in the firmware installation package; if it is confirmed that the version of the initial firmware file is different from the version of the target firmware file, proceed to step S11.

[0073] In the specific implementation, in order to perform a firmware upgrade, first obtain the firmware installation package of the BMC, and determine whether the version of the current initial firmware file of the system is the same as the version of the target firmware file in the firmware installation package. If it is confirmed that the version of the initial firmware file is the same as the version of the target firmware file, it is considered that the firmware version of the current system is the latest version, and there is no need to upgrade the BMC. If it is confirmed that the version of the initial firmware file is not the same as the version of the target firmware file, it is considered that the BMC needs a firmware upgrade.

[0074] S11: Back up the initial firmware file and decompress the firmware installation package to obtain the target firmware file.

[0075] After confirming that the BMC needs to be upgraded, back up the initial firmware file of the BMC. It should be noted that the initial firmware file needs to be backed up and stored in a storage location that is not easily lost, so that the version can be rolled back when the firmware upgrade fails, which improves security. At the same time, decompress the BMC firmware installation package to obtain the target firmware file, so that the firmware can be upgraded based on the target firmware file.

[0076] S12: Based on the target firmware file, a preset installation tool is called to execute a firmware update action, and it is determined whether the firmware update action is successfully executed; if it is confirmed that the firmware update action is successfully executed, the process proceeds to step S13.

[0077] In order to perform firmware upgrade, the preset installation tool is specifically called based on the target firmware file to perform the firmware update action. It should be noted that the preset installation tool is not limited in this embodiment, for example, it can be YAFU or an intelligent platform management interface tool, depending on the specific implementation situation.

[0078] Further, determine whether the firmware update action is successfully executed. In this embodiment, there is no limitation on the specific method for determining whether the firmware update action is successfully executed. For example, the firmware update action can be determined based on the operation of the preset installation tool, or based on the consistency of the firmware files before and after the upgrade, depending on the specific implementation situation. If it is confirmed that the firmware update action fails to execute, exit the firmware upgrade process and end.

[0079] S13: Determine whether the version of the current firmware file is the version of the target firmware file; if it is confirmed that the version of the current firmware file is not the version of the target firmware file, proceed to step S14.

[0080] If the firmware update action is confirmed to be successful, it is necessary to further determine whether the version of the current firmware file is the version of the target firmware file. If the version of the current firmware file is confirmed to be the version of the target firmware file, the firmware upgrade is confirmed to be successful, and the firmware upgrade process is exited and ended.

[0081] S14: confirm that the firmware upgrade has failed, and determine whether this is the first firmware upgrade failure based on the flag file; if it is confirmed that this is the first firmware upgrade failure, proceed to step 15; if it is confirmed that this is not the first firmware upgrade failure, proceed to step S16.

[0082] S15: The system restarts and enters step S10.

[0083] S16: Exit the firmware upgrade process and report the alarm information.

[0084] If it is confirmed that the version of the current firmware file is not the version of the target firmware file, it is confirmed that the firmware upgrade has failed, and it is determined whether the current firmware upgrade has failed for the first time based on the flag file. It should be noted that the flag file is a file generated when the firmware file fails to upgrade for the first time. In this embodiment, the specific process of determining whether the current firmware upgrade has failed for the first time based on the flag file is not limited, and it depends on the specific implementation situation.

[0085] If it is confirmed that the current firmware upgrade has failed for the first time, it is considered that the firmware upgrade can be tried again, and the system is specifically restarted and the process of entering step S10 is executed to re-execute the firmware upgrade process. If it is confirmed that the current firmware upgrade has not failed for the first time, it is considered that the firmware upgrade has failed for many times, and it is meaningless and a waste of time and resources to try again. Specifically, the firmware upgrade process is exited and an alarm information is reported, so that the user can check it in time, thereby improving the efficiency of operation and maintenance.

[0086] In this embodiment, when preparing for a firmware upgrade, the initial firmware file is backed up, so that version rollback can be achieved when the firmware upgrade fails, thereby improving security; when performing a firmware upgrade, a preset installation tool is called based on the target firmware file to execute a firmware update action to determine whether the firmware update action is successfully executed; if it is confirmed that the firmware update action is successfully executed, but the version of the current firmware file is not the version of the target firmware file, the firmware upgrade is confirmed to have failed, and a determination is made based on the flag file whether this is the first firmware upgrade failure; if it is confirmed that this is the first firmware upgrade failure, the upgrade is retried after the system is restarted; if it is confirmed that this is not the first firmware upgrade failure, it is considered that the firmware upgrade has failed multiple times, and the firmware upgrade process is directly exited and an alarm message is reported, thereby avoiding the time-consuming problem caused by meaningless firmware upgrade retries and improving operation and maintenance efficiency.

[0087] Based on the above embodiments, in some embodiments, determining whether the firmware update action is successfully executed includes:

[0088] S121: Obtaining a first verification value of the target firmware file before the firmware upgrade and a second verification value of the current firmware file after the firmware upgrade respectively according to a preset verification algorithm;

[0089] S122: Determine whether the first verification value is consistent with the second verification value; if it is confirmed that the first verification value is consistent with the second verification value, proceed to step S123; if it is confirmed that the first verification value is inconsistent with the second verification value, proceed to step S124;

[0090] S123: confirming that the firmware update action is successfully executed;

[0091] S124: Confirm that the firmware update action has failed.

[0092] In a specific implementation, in order to determine whether the firmware update action is successfully executed, a first checksum value of the target firmware file before the firmware upgrade and a second checksum value of the current firmware file after the firmware upgrade are obtained respectively according to a preset checksum algorithm. In this embodiment, there is no limitation on the preset checksum algorithm, for example, it can be a message digest (Message Digest Algorithm5, MD5) algorithm, or a cyclic redundancy check (Cyclic Redundancy Check, CRC) algorithm, depending on the specific implementation situation.

[0093] After obtaining the first check value and the second check value, it is determined whether the first check value is consistent with the second check value. If it is confirmed that the first check value is consistent with the second check value, it is confirmed that the firmware update action is executed successfully; if it is confirmed that the first check value is inconsistent with the second check value, it is confirmed that the firmware update action fails.

[0094] In this way, it is possible to determine whether the firmware update action is successfully executed.

[0095] In order to determine the reason why the firmware update action fails to execute, based on the above embodiments, in some embodiments, if it is confirmed that the firmware update action fails to execute, the process further includes:

[0096] S17: Obtaining the system log during the firmware update operation;

[0097] S18: Determine the reason why the firmware update action failed to execute according to the system log;

[0098] The reasons for the failure of the firmware update action at least include system power failure, default installation tool error, CPU power failure and basic input and output system memory allocation error.

[0099] In a specific implementation, if it is confirmed that the firmware update action fails to execute, the system log during the execution of the firmware update action is obtained. It can be understood that the system log contains information about the execution of all system processes, and the system log during the execution of the firmware update action contains information about the operation of the preset installation tool and the firmware upgrade process. Therefore, in this embodiment, the reason for the failure of the firmware update action can be determined based on the system log.

[0100] It should be noted that the reasons for the failure of the firmware update action include at least system power failure, default installation tool error, CPU power failure and basic input and output system memory allocation error, and the specific reasons need to be determined based on the system log.

[0101] In this embodiment, when it is confirmed that the firmware update action fails, the system log during the execution of the firmware update action is obtained; the reason for the failure of the firmware update action is determined based on the system log, so that the user can perform firmware upgrade maintenance based on the reason for the failure of the firmware update action.

[0102] Based on the above embodiment, in some embodiments, if it is confirmed that the firmware update action fails to execute, the method further includes:

[0103] S19: Obtain the backed-up initial firmware file;

[0104] S20: Roll back the firmware file version based on the initial firmware file.

[0105] To ensure the normal operation of the BMC, if it is confirmed that the firmware update action fails, it is necessary to obtain the backed-up initial firmware file and roll back the firmware file version based on the initial firmware file, thereby ensuring that the BMC can operate normally even if the firmware upgrade fails.

[0106] Based on the above embodiments, in some embodiments, judging whether the current firmware upgrade fails for the first time according to the flag file includes:

[0107] S141: Retrieve a flag file stored in the system; wherein the flag file is a file generated when the firmware file fails to be upgraded for the first time;

[0108] S142: Determine whether the flag file is obtained; if it is confirmed that the flag file is not obtained, proceed to step S143; if it is confirmed that the flag file is obtained, proceed to step S146;

[0109] S143: confirming that the current firmware upgrade fails for the first time;

[0110] S144: Create a flag file;

[0111] S145: The control system performs a restart operation based on the restart instruction, and enters step S10 after the system restarts;

[0112] S146: Confirm that the current firmware upgrade is not the first failure, exit the firmware upgrade process and report an alarm message.

[0113] In a specific implementation, in order to determine whether the current firmware upgrade fails for the first time based on the flag file, the flag file stored in the system is specifically retrieved. It should be noted that the flag file is a file generated when the firmware file fails to upgrade for the first time, and is used to indicate the first firmware upgrade failure. Determine whether the flag file in the system can be obtained. If it is confirmed that the flag file is not obtained, it is confirmed that the firmware upgrade failure has not occurred before, and the current firmware upgrade failure is the first time. A flag file needs to be created to indicate that this is the first firmware upgrade failure; at the same time, the control system performs a restart operation based on the restart instruction, and executes the step of obtaining the firmware installation package after the system restarts to try the firmware upgrade again.

[0114] If it is confirmed that the flag file is obtained, it is confirmed that the firmware upgrade has failed before, and the current firmware upgrade is not the first time. There is no need to retry the meaningless firmware upgrade. The firmware upgrade process is exited and the alarm information is reported so that the user can handle the firmware upgrade failure in time according to the alarm information.

[0115] Correspondingly, if it is confirmed that the version of the current firmware file is the version of the target firmware file, it also includes:

[0116] S147: Confirm that the firmware upgrade is successful;

[0117] S148: Retrieving the flag file stored in the system;

[0118] S149: Determine whether the flag file is obtained; if it is confirmed that the flag file is not obtained, exit the firmware upgrade process; if it is confirmed that the flag file is obtained, enter step S150;

[0119] S150: Clear the flag file.

[0120] In addition, if the version of the current firmware file is confirmed to be the version of the target firmware file, it means that the firmware upgrade is successful. The flag file stored in the system is further retrieved to determine whether the flag file is obtained. If it is confirmed that the flag file is not obtained, the firmware upgrade process is directly exited; if it is confirmed that the flag file is obtained, since the firmware upgrade is successful, the flag file can be directly cleared.

[0121] Based on the above embodiments, in some embodiments, the following further includes:

[0122] S21: Generate a firmware upgrade log;

[0123] Among them, the firmware upgrade log contains all the information of the system firmware upgrade process;

[0124] S22: Upload the firmware upgrade log to the cloud platform.

[0125] In the specific implementation, after completing the firmware upgrade, a firmware upgrade log can also be generated. It should be noted that the firmware upgrade log contains all the information of the system firmware upgrade process, including the start and end time of the firmware upgrade, the firmware version number before the upgrade and the firmware version number after the upgrade, and the type of upgrade (such as full upgrade or incremental upgrade); key steps and status in the upgrade process, such as the status of the preparation stage, download stage, verification stage and application stage; if errors or warnings are encountered during the upgrade process, the error code, error description and possible causes are recorded in detail; finally, the final result of the upgrade, such as success or failure, and the specific reasons for failure. Uploading the firmware upgrade log to the cloud platform can better save the firmware upgrade log and prevent log loss.

[0126] Furthermore, based on the contents of the firmware upgrade log, users can perform troubleshooting. If the upgrade fails or an exception occurs, they can locate the problem by analyzing the error information and warnings in the log and take appropriate solutions. Perform upgrade verification. By comparing the version information and status before and after the upgrade, you can verify whether the upgrade is successful and confirm whether the device is running on the correct firmware version. Perform audits and compliance checks to ensure that the firmware upgrade process complies with relevant policies and regulations. Perform performance analysis. By analyzing the timestamps and status information during the upgrade process, you can evaluate the performance and efficiency of the upgrade and optimize the upgrade process.

[0127] Based on the above embodiment, in some embodiments, if it is confirmed that the version of the current firmware file is the version of the target firmware file, the method further includes:

[0128] S23: Confirm that the firmware upgrade is successful, and obtain the firmware upgrade log generated this time;

[0129] S24: judging whether the firmware upgrade process is abnormal according to the firmware upgrade log; if it is confirmed that the firmware upgrade process is abnormal, proceeding to step S25;

[0130] S25: Outputting a prompt message indicating that the firmware upgrade process is abnormal.

[0131] In a specific implementation, if it is confirmed that the version of the current firmware file is the version of the target firmware file, the firmware upgrade is confirmed to be successful, and the firmware upgrade log generated this time is obtained. It should be noted that in some cases, although the firmware upgrade is successful, there may be some abnormal problems that are not reflected in the firmware upgrade process. Therefore, it is necessary to determine whether the firmware upgrade process is abnormal based on the firmware upgrade log; if it is confirmed that the firmware upgrade process is abnormal, a prompt message indicating the abnormality of the firmware upgrade process is output, so that the user can troubleshoot the abnormal problem according to the prompt message, which can prevent the next firmware upgrade from failing.

[0132] In the above embodiments, the firmware upgrade method is described in detail. The present invention also provides a corresponding embodiment of the firmware upgrade device.

[0133] Figure 2 Schematic diagram of a firmware upgrade device provided by an embodiment of the present invention. Figure 2 As shown, the device comprises:

[0134] The acquisition module 10 is used to acquire the firmware installation package and determine whether the version of the current initial firmware file of the system is the same as the version of the target firmware file in the firmware installation package; if it is confirmed that the version of the initial firmware file is not the same as the version of the target firmware file, the backup decompression module 11 is triggered;

[0135] The backup decompression module 11 is used to back up the initial firmware file and decompress the firmware installation package to obtain the target firmware file;

[0136] The first judgment module 12 is used to call the preset installation tool based on the target firmware file to perform the firmware update action, and judge whether the firmware update action is successfully executed; if it is confirmed that the firmware update action is successfully executed, the second judgment module 13 is triggered;

[0137] The second judgment module 13 is used to judge whether the version of the current firmware file is the version of the target firmware file; if it is confirmed that the version of the current firmware file is not the version of the target firmware file, it is determined that the firmware upgrade fails, and the third judgment module 14 is triggered;

[0138] The third judgment module 14 is used to judge whether the current firmware upgrade fails for the first time according to the flag file; if it is confirmed that the current firmware upgrade fails for the first time, the acquisition module is triggered after the system is restarted; if it is confirmed that the current firmware upgrade fails for the first time, the alarm module 15 is triggered;

[0139] The alarm module 15 is used to exit the firmware upgrade process and report alarm information.

[0140] In some embodiments, the first determination module 12 includes:

[0141] A first acquisition submodule, used to obtain a first check value of the target firmware file before the firmware upgrade and a second check value of the current firmware file after the firmware upgrade according to a preset check algorithm;

[0142] The first judgment submodule is used to judge whether the first verification value is consistent with the second verification value; if it is confirmed that the first verification value is consistent with the second verification value, it is confirmed that the firmware update action is executed successfully; if it is confirmed that the first verification value is inconsistent with the second verification value, it is confirmed that the firmware update action fails.

[0143] In some embodiments, it also includes:

[0144] The second acquisition submodule is used to acquire the system log during the execution of the firmware update action if it is confirmed that the firmware update action fails to execute;

[0145] The first determination submodule is used to determine the reason for the failure of the firmware update action according to the system log;

[0146] The reasons for the failure of the firmware update action at least include system power failure, default installation tool error, CPU power failure and basic input and output system memory allocation error.

[0147] In some embodiments, it also includes:

[0148] The third acquisition submodule is used to acquire the backup initial firmware file if it is confirmed that the firmware update action fails to execute;

[0149] The version rollback submodule is used to roll back the firmware file version based on the initial firmware file.

[0150] In some embodiments, the third determination module 14 includes:

[0151] The first retrieval submodule is used to retrieve the flag file stored in the system; wherein the flag file is a file generated when the firmware file fails to be upgraded for the first time;

[0152] The second judgment submodule is used to judge whether the flag file is obtained; if it is confirmed that the flag file is not obtained, it is confirmed that the current firmware upgrade fails for the first time, and the creation submodule is triggered; if it is confirmed that the flag file is obtained, it is confirmed that the current firmware upgrade does not fail for the first time, and the alarm submodule is triggered;

[0153] Create a submodule to create a flag file;

[0154] A restart submodule, used to control the system to perform a restart operation based on the restart instruction, and trigger the acquisition module 10 after the system restarts;

[0155] The alarm submodule is used to exit the firmware upgrade process and report alarm information;

[0156] Correspondingly, it also includes:

[0157] A first confirmation submodule is used to confirm that the firmware upgrade is successful if the version of the current firmware file is confirmed to be the version of the target firmware file;

[0158] The second retrieval submodule is used to retrieve the flag file stored in the system;

[0159] The third judgment submodule is used to judge whether the flag file is obtained; if it is confirmed that the flag file is not obtained, the firmware upgrade process is exited; if it is confirmed that the flag file is obtained, the flag file is cleared.

[0160] In some embodiments, it also includes:

[0161] The log generation submodule is used to generate a firmware upgrade log; wherein the firmware upgrade log contains all the information of the system firmware upgrade process;

[0162] The log upload submodule is used to upload the firmware upgrade log to the cloud platform.

[0163] In some embodiments, it also includes:

[0164] The second confirmation submodule is used to confirm that the version of the current firmware file is the version of the target firmware file, confirm that the firmware upgrade is successful, and obtain the firmware upgrade log generated this time;

[0165] The fourth judgment submodule is used to judge whether an abnormality occurs in the firmware upgrade process according to the firmware upgrade log; if it is confirmed that an abnormality occurs in the firmware upgrade process, a prompt message indicating that the firmware upgrade process is abnormal is output.

[0166] In addition, the present invention also provides a computer program product, including a computer program / instruction, which implements the steps of the above firmware upgrade method when executed by a processor.

[0167] Figure 3 A schematic diagram of a firmware upgrade device provided by an embodiment of the present invention. Figure 3 As shown, the firmware upgrade equipment includes:

[0168] A memory 20, for storing computer programs;

[0169] The processor 21 is used to implement the steps of the firmware upgrade method mentioned in the above embodiment when executing the computer program.

[0170] The firmware upgrade device provided in this embodiment may include but is not limited to a smart phone, a tablet computer, a laptop computer, or a desktop computer.

[0171] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of a digital signal processor (DSP), a field programmable gate array (FPGA), and a programmable logic array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 21 may be integrated with a graphics processing unit (GPU), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.

[0172] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used to store the following computer program 201, wherein, after the computer program is loaded and executed by the processor 21, it can implement the relevant steps of the firmware upgrade method disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 202 may include Windows, Unix, Linux, etc. Data 203 may include but is not limited to data related to the firmware upgrade method.

[0173] In some embodiments, the firmware upgrade device may further include a display screen 22 , an input / output interface 23 , a communication interface 24 , a power supply 25 , and a communication bus 26 .

[0174] Those skilled in the art will understand that Figure 3 The structure shown in the figure does not constitute a limitation on the firmware upgrade device, and may include more or fewer components than shown in the figure.

[0175] Finally, the present invention also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps recorded in the above method embodiment are implemented.

[0176] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or 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 to execute 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), random access memory (RAM), disk or optical disk, etc. Various media that can store program codes.

[0177] The above is a detailed introduction to a firmware upgrade method, device, equipment and medium provided by the present invention. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referenced to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, the present invention can also be improved and modified in a number of ways, and these improvements and modifications also fall within the scope of protection of the present invention.

[0178] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

Claims

1. A firmware upgrade method, characterized in that: include: Obtain the firmware installation package and determine whether the version of the current initial firmware file of the system is the same as the version of the target firmware file in the firmware installation package; If it is confirmed that the version of the initial firmware file is different from the version of the target firmware file, the initial firmware file is backed up, and the firmware installation package is decompressed to obtain the target firmware file; Calling a preset installation tool based on the target firmware file to perform a firmware update action, and determining whether the firmware update action is successfully executed; If it is confirmed that the firmware update action is executed successfully, then determine whether the version of the current firmware file is the version of the target firmware file; If it is confirmed that the version of the current firmware file is not the version of the target firmware file, it is confirmed that the firmware upgrade has failed, and it is determined whether the current firmware upgrade has failed for the first time based on the flag file; If it is confirmed that the current firmware upgrade fails for the first time, the step of obtaining the firmware installation package is performed after the system is restarted; If it is confirmed that this is not the first firmware upgrade failure, exit the firmware upgrade process and report an alarm.

2. The firmware upgrade method according to claim 1, characterized in that: The step of determining whether the firmware update operation is successfully executed includes: Obtaining a first verification value of the target firmware file before the firmware upgrade and a second verification value of the current firmware file after the firmware upgrade respectively according to a preset verification algorithm; Determining whether the first check value is consistent with the second check value; If it is confirmed that the first check value is consistent with the second check value, it is confirmed that the firmware update action is successfully executed; If it is confirmed that the first verification value is inconsistent with the second verification value, it is confirmed that the firmware update action fails to execute.

3. The firmware upgrade method according to claim 2, characterized in that: If the firmware update operation fails, the following will be included: Get the system logs during the firmware update action; Determine the reason why the firmware update action failed based on the system log; The reasons for the failure of the firmware update action at least include system power failure, default installation tool error, CPU power failure and basic input and output system memory allocation error.

4. The firmware upgrade method according to claim 2, characterized in that: If the firmware update operation fails, the following will be included: Get the backed up initial firmware file; Roll back the firmware file version based on the initial firmware file.

5. The firmware upgrade method according to claim 1, characterized in that: The step of judging whether the current firmware upgrade fails for the first time according to the flag file includes: Retrieving the flag file stored in the system; wherein the flag file is a file generated when the firmware file fails to be upgraded for the first time; Determine whether the flag file is obtained; If it is confirmed that the flag file is not obtained, it is confirmed that the current firmware upgrade fails for the first time; Creating the flag file; Controlling the system to execute a restart operation based on the restart instruction, and executing the step of obtaining the firmware installation package after the system restarts; If it is confirmed that the flag file is obtained, it is confirmed that the current firmware upgrade is not failed for the first time, the firmware upgrade process is exited and the alarm information is reported; Correspondingly, if it is confirmed that the version of the current firmware file is the version of the target firmware file, it also includes: Confirm that the firmware upgrade was successful; Retrieving the flag file stored in the system; Determine whether the flag file is obtained; If it is confirmed that the flag file is not obtained, then exit the firmware upgrade process; If it is confirmed that the flag file is obtained, the flag file is cleared.

6. The firmware upgrade method according to any one of claims 1 to 5, characterized in that: Also includes: Generate a firmware upgrade log; wherein the firmware upgrade log contains all information of the system firmware upgrade process; The firmware upgrade log is uploaded to the cloud platform.

7. The firmware upgrade method according to claim 6, characterized in that: If the version of the current firmware file is confirmed to be the version of the target firmware file, it also includes: Confirm that the firmware upgrade is successful, and obtain the firmware upgrade log generated this time; Determine whether an abnormality occurs during the firmware upgrade process according to the firmware upgrade log; If it is confirmed that an abnormality occurs during the firmware upgrade process, a prompt message indicating that the firmware upgrade process is abnormal is output.

8. A firmware upgrade device, characterized in that: include: The acquisition module is used to obtain the firmware installation package and determine whether the version of the current initial firmware file of the system is the same as the version of the target firmware file in the firmware installation package; if it is confirmed that the version of the initial firmware file is different from the version of the target firmware file, the backup decompression module is triggered; The backup decompression module is used to back up the initial firmware file and decompress the firmware installation package to obtain the target firmware file; A first judgment module is used to call a preset installation tool based on a target firmware file to perform a firmware update action, and to judge whether the firmware update action is successfully executed; if it is confirmed that the firmware update action is successfully executed, a second judgment module is triggered; The second judgment module is used to judge whether the version of the current firmware file is the version of the target firmware file; if it is confirmed that the version of the current firmware file is not the version of the target firmware file, it is determined that the firmware upgrade fails, and the third judgment module is triggered; The third judgment module is used to judge whether the current firmware upgrade fails for the first time according to the flag file; If it is confirmed that the current firmware upgrade fails for the first time, the acquisition module is triggered after the system is restarted; If it is confirmed that the current firmware upgrade is not failed for the first time, the alarm module is triggered; The alarm module is used to exit the firmware upgrade process and report alarm information.

9. A firmware upgrade device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the firmware upgrade method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the firmware upgrade method according to any one of claims 1 to 7 are implemented.