Firmware upgrading and downgrading method and device, medium and program product
By performing two-way authentication on the server and the firmware upgrade and upgrade device, determining the upgrade and upgrade mode and generating instructions, the problem of manual operation required for firmware upgrade and upgrade in the existing technology is solved, the automation and reliability of firmware updates are achieved, and the flexibility of automatic and manual modes is provided.
Patent Information
- Application Number
- CN202511115763.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-11
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2045-08-11
AI Technical Summary
Existing server firmware upgrade and downgrade methods require manual operation and have a low degree of automation.
By performing two-way authentication on the server and the firmware upgrade and downgrade device, the upgrade and downgrade mode is determined, and upgrade or downgrade instructions are generated according to the current version number or running status to achieve automatic or manual firmware upgrade and downgrade operations.
Improves the automation level of firmware updates to ensure the reliability and accuracy of firmware updates, while also providing a manual mode to meet specific needs.
Smart Images

Figure CN120631409A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of server technology, and in particular to a firmware upgrade and downgrade method, device, medium, and program product. Background Art
[0002] Firmware is the underlying, underlying code that serves as the foundation of a system and is crucial to server functionality and performance. Currently, most server firmware upgrades and upgrades rely on engineers using a burner fixture or system commands to individually upgrade and downgrade the firmware of each board and component. For example, in one approach, the corresponding chip, already soldered to the printed circuit board (PCB), is removed. The firmware upgrade and downgrade is then performed using specific software and hardware, and the chip is re-soldered to the PCB. In another approach, when the server can access the operating system normally, specific software and commands are used within the operating system to complete the firmware upgrade and downgrade. In another approach, when the server can access the operating system normally and the baseboard management controller (BMC) is connected to the internet, a third-party computer or server within the same network segment as the BMC is used to log in to the BMC network of the server to be upgraded and complete the firmware upgrade and downgrade on the web interface. All three of these approaches require manual operation and have a low degree of automation. Summary of the Invention
[0003] The present application provides a firmware upgrade and downgrade method, device, medium and program product to at least solve the problem in the related art that updating firmware requires manual operation and has a low degree of automation.
[0004] The present application provides a firmware upgrade and downgrade method, which is applied to a firmware upgrade and downgrade device, wherein the firmware upgrade and downgrade device is connected to a server, and the firmware upgrade and downgrade method includes: determining whether the server is in a powered-on state; in response to the server being in a powered-on state, performing two-way authentication on the server and the firmware upgrade and downgrade device to obtain a two-way authentication result; in response to the two-way authentication result being successful, determining the upgrade and downgrade mode of the firmware upgrade and downgrade device, wherein the upgrade and downgrade modes include at least an automatic mode and a manual mode; in response to the upgrade and downgrade mode being the automatic mode, obtaining the current version number of the firmware, and generating an upgrade instruction for the firmware based on the current version number, or determining the current running state of the firmware, and generating a downgrade instruction for the firmware based on the current running state, wherein the upgrade instruction and the downgrade instruction include at least a target version number of the firmware; in response to the upgrade and downgrade mode being the manual mode, receiving a user instruction, and generating a firmware upgrade instruction or a firmware downgrade instruction based on the user instruction; performing a corresponding upgrade operation or downgrade operation on the firmware based on the firmware upgrade instruction or the firmware downgrade instruction to change the current version number of the firmware to the target version number.
[0005] The present application also provides an electronic device, comprising: a memory for storing a computer program; a processor for implementing, when executing the computer program, a firmware upgrade method comprising at least the following steps: determining whether a server is in a powered-on state; in response to the server being in a powered-on state, performing bidirectional authentication on the server and a firmware upgrade device to obtain a bidirectional authentication result; in response to the bidirectional authentication result being successful, determining an upgrade mode of the firmware upgrade device, wherein the upgrade mode includes at least an automatic mode and a manual mode; in response to the upgrade mode being the automatic mode, obtaining a current version number of the firmware and generating an upgrade instruction for the firmware based on the current version number, or determining a current running state of the firmware and generating a downgrade instruction for the firmware based on the current running state, wherein the upgrade instruction and the downgrade instruction include at least a target version number of the firmware; in response to the upgrade mode being the manual mode, receiving a user instruction and generating a firmware upgrade instruction or a firmware downgrade instruction based on the user instruction; and performing a corresponding upgrade operation or downgrade operation on the firmware based on the firmware upgrade instruction or the firmware downgrade instruction to change the current version number of the firmware to the target version number.
[0006] The present application also provides a computer-readable storage medium, which stores a computer program, wherein when the computer program is executed by a processor, it implements at least the following steps of a firmware upgrade and downgrade method: determining whether the server is in a powered-on state; in response to the server being in a powered-on state, performing two-way authentication on the server and the firmware upgrade and downgrade device to obtain a two-way authentication result; in response to the two-way authentication result being successful, determining the upgrade and downgrade mode of the firmware upgrade and downgrade device, wherein the upgrade and downgrade modes include at least an automatic mode and a manual mode; in response to the upgrade and downgrade mode being the automatic mode, obtaining the current version number of the firmware and generating an upgrade instruction for the firmware based on the current version number, or determining the current running state of the firmware and generating a downgrade instruction for the firmware based on the current running state, wherein the upgrade instruction and the downgrade instruction include at least a target version number of the firmware; in response to the upgrade and downgrade mode being the manual mode, receiving a user instruction and generating a firmware upgrade instruction or a firmware downgrade instruction based on the user instruction; performing a corresponding upgrade operation or downgrade operation on the firmware based on the firmware upgrade instruction or the firmware downgrade instruction to change the current version number of the firmware to the target version number.
[0007] The present application also provides a computer program product, including a computer program, which, when executed by a processor, implements at least the following steps of a firmware upgrade and downgrade method: determining whether a server is in a powered-on state; in response to the server being in a powered-on state, performing two-way authentication on the server and a firmware upgrade and downgrade device to obtain a two-way authentication result; in response to the two-way authentication result being successful, determining an upgrade and downgrade mode of the firmware upgrade and downgrade device, wherein the upgrade and downgrade modes include at least an automatic mode and a manual mode; in response to the upgrade and downgrade mode being the automatic mode, obtaining the current version number of the firmware, and generating an upgrade instruction for the firmware based on the current version number, or determining the current running state of the firmware, and generating a downgrade instruction for the firmware based on the current running state, wherein the upgrade instruction and the downgrade instruction include at least a target version number of the firmware; in response to the upgrade and downgrade mode being the manual mode, receiving a user instruction, and generating a firmware upgrade instruction or a firmware downgrade instruction based on the user instruction; performing a corresponding upgrade operation or downgrade operation on the firmware based on the firmware upgrade instruction or the firmware downgrade instruction to change the current version number of the firmware to the target version number.
[0008] Through this application, two-way authentication is performed on the server and the firmware upgrading and downgrading device to ensure the authenticity of the identities of the server and the firmware upgrading and downgrading device, and to ensure that both parties are trustworthy; when the upgrading and downgrading mode of the firmware upgrading and downgrading device is automatic mode, the firmware upgrade instruction or downgrade instruction is generated according to the current version number or current running status of the firmware, which solves the technical problem of low automation level of firmware update and achieves the technical effect of improving the automation level of firmware update; when the upgrading and downgrading mode of the firmware upgrading and downgrading device is manual mode, the firmware upgrade instruction or downgrade instruction is generated according to the user instruction, so that the firmware can be updated even when the automatic upgrading and downgrading is not triggered. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0010] Figure 1 1 is a flow chart of a firmware upgrade and downgrade method according to an embodiment; Figure 2 1 is a timing diagram of a firmware upgrade / downgrade method according to an embodiment; Figure 3 A structural block diagram of a firmware upgrade and downgrade system in one embodiment; Figure 4 A structural block diagram of a firmware upgrade / downgrade device in another embodiment; Figure 5Schematic diagram of the operation of a power module in a firmware upgrade / downgrade device according to an embodiment; Figure 6 FIG. 1 is a diagram showing the internal structure of an electronic device in one embodiment. DETAILED DESCRIPTION
[0011] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0012] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.
[0013] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0014] In the first embodiment, if Figure 1 As shown, a firmware upgrade method is provided, which is applied to a firmware upgrade device, wherein the firmware upgrade device is connected to a server, and the firmware upgrade method includes: determining whether the server is in a powered-on state; in response to the server being in a powered-on state, performing bidirectional authentication on the server and the firmware upgrade device to obtain a bidirectional authentication result; in response to the bidirectional authentication result being successful, determining an upgrade mode of the firmware upgrade device, wherein the upgrade mode includes at least an automatic mode and a manual mode; in response to the upgrade mode being the automatic mode, obtaining the current version number of the firmware and generating an upgrade instruction for the firmware based on the current version number, or determining the current running state of the firmware and generating a downgrade instruction for the firmware based on the current running state, wherein the upgrade instruction and the downgrade instruction include at least a target version number of the firmware; in response to the upgrade mode being the manual mode, receiving a user instruction and generating a firmware upgrade instruction or a firmware downgrade instruction based on the user instruction; and performing a corresponding upgrade operation or downgrade operation on the firmware based on the firmware upgrade instruction or the firmware downgrade instruction to change the current version number of the firmware to the target version number.
[0015] Specifically, two-way authentication is performed on the server and the firmware upgrading and downgrading device to ensure the authenticity of the identities of the server and the firmware upgrading and downgrading device, and to ensure that both parties are trustworthy; when the upgrading and downgrading mode of the firmware upgrading and downgrading device is automatic mode, an upgrade instruction or a downgrade instruction of the firmware is generated according to the current version number or the current running status of the firmware, which solves the technical problem of the low degree of automation of firmware updates and achieves the technical effect of improving the degree of automation of firmware updates; when the upgrading and downgrading mode of the firmware upgrading and downgrading device is manual mode, an upgrade instruction or a downgrade instruction of the firmware is generated according to the user's instructions, so that the firmware can be updated without triggering automatic upgrading and downgrading.
[0016] In specific implementation, Figure 2 As shown, in response to the server being powered on, a connection is established between the firmware upgrade device and the server baseboard management controller via the integrated circuit bus. In response to the successful connection establishment, the baseboard management controller performs a two-way authentication of the server and the firmware upgrade device, and then performs a firmware update operation. The two-way authentication of the server and the firmware upgrade device can be performed using an elliptic curve digital signature algorithm.
[0017] Furthermore, determining whether the server is in a powered-on state includes: obtaining a current voltage value of the server, and comparing the current voltage value with a preset voltage range, wherein the preset voltage range includes at least a first voltage range, a second voltage range, and a third voltage range; in response to the current voltage value being within the first voltage range, determining that the server is in a powered-on state; in response to the current voltage value being within the second voltage range, determining that the server is in a standby state; and in response to the current voltage value being within the third voltage range, determining that the server is in a powered-off state or a fault state.
[0018] In a specific implementation, for example, if the current voltage value is within 11.4V~12.6V; 4.75V~5.25V; 3.14V~3.46V, the server is in a powered-on state; if the current voltage value is within 4.75V~5.25V, the server is in a standby state; if the current voltage value is less than 1V, the server is in a powered-off state or a faulty state, for example, the power supply is not connected, the power supply is faulty, the mainboard short-circuit protection is triggered, or the baseboard management controller detects a serious abnormality, such as overvoltage / undervoltage.
[0019] Furthermore, bidirectional authentication is performed on the server and the firmware upgrade and upgrading device to obtain a bidirectional authentication result, including: generating a server authentication instruction, and sending the server authentication instruction to the server, while receiving a device authentication instruction generated by the server; performing authentication according to the device authentication instruction, obtaining a device authentication result, and returning the device authentication result to the server, while receiving a server authentication result returned by the server; in response to both the device authentication result and the server authentication result being successfully verified, determining that the bidirectional authentication result is a successful verification; in response to the device authentication result and / or the server authentication result failing to be verified, determining that the bidirectional authentication result is a failed verification.
[0020] Specifically, by performing two-way authentication on the server and the firmware upgrade device, the authenticity of the identities of the server and the firmware upgrade device is ensured, ensuring that both parties are trustworthy and establishing an end-to-end trust chain.
[0021] Furthermore, determining the upgrading and downgrading mode of the firmware upgrading and downgrading device includes: obtaining an upgrading and downgrading mode flag in the firmware upgrading and downgrading device, wherein the value of the upgrading and downgrading mode flag includes at least a first target value and a second target value; in response to the value of the upgrading and downgrading mode flag being the first target value, determining that the upgrading and downgrading mode of the firmware upgrading and downgrading device is an automatic mode; in response to the value of the upgrading and downgrading mode flag being the second target value, determining that the upgrading and downgrading mode of the firmware upgrading and downgrading device is a manual mode.
[0022] Specifically, by setting the upgrade mode flag of the firmware upgrade device to a first target value, the upgrade mode is automatic; and when the value is a second target value, the upgrade mode is manual. This allows for the generation of firmware upgrade instructions while also covering manual upgrades when automatic upgrades are not triggered and the firmware upgrade is required based on user needs.
[0023] In a specific implementation, the first target value is 0 and the second target value is 1.
[0024] Furthermore, the current version number of the firmware is obtained, and an upgrade instruction for the firmware is generated based on the current version number, including: obtaining the current version number of the firmware in the server, and a version information library of the firmware in the firmware upgrade and downgrade device, wherein the version information library includes at least multiple firmware files of the firmware and an upgrade policy flag of the firmware, and the value of the upgrade policy flag includes at least a first target value and a second target value; determining a target version number based on the current version number and the upgrade policy flag, wherein the target version number is greater than the current version number; comparing the target version number with the version numbers corresponding to the multiple firmware files to obtain a target firmware file corresponding to the target version number; and generating an upgrade instruction for the firmware based on the target firmware file.
[0025] Furthermore, based on the current version number and the upgrade policy flag, the target version number is determined, including: in response to the value of the upgrade policy flag being a first target value, determining that the version upgrade policy of the firmware is a step-by-step upgrade, and determining the new first-level version number of the current version number of the firmware as the target version number; in response to the value of the upgrade policy flag being a second target value, determining that the version upgrade policy of the firmware is a cross-level upgrade, and determining the latest version number of the firmware as the target version number.
[0026] Specifically, by setting the upgrade policy flag, the target version number satisfies the upgrade policy of the firmware corresponding manufacturer, thereby preventing the upgraded firmware from not being able to run normally.
[0027] In a specific implementation, if the firmware version upgrade strategy is step-by-step upgrade, and the firmware version number is v1.0 - v1.3 - v1.8 - v2.0, and the current version number is v1.3, the target version number is v1.8.
[0028] Furthermore, the current running state of the firmware is determined, and a firmware downgrade instruction is generated based on the current running state, including: determining the current running state of the firmware; in response to a compatibility error or a stability problem occurring in the current running state, obtaining the current version number of the firmware in the server, and a version information library of the firmware in the firmware upgrading and downgrading device, wherein the version information library includes at least multiple firmware files of the firmware and a downgrade policy flag of the firmware, and the value of the downgrade policy flag includes at least a first target value and a second target value; determining a target version number based on the current version number and the downgrade policy flag, wherein the target version number is smaller than the current version number; comparing the target version number with the version numbers corresponding to the multiple firmware files to obtain a target firmware file corresponding to the target version number; and generating a firmware downgrade instruction based on the target firmware file.
[0029] Furthermore, based on the current version number and the downgrade policy flag, the target version number is determined, including: in response to the value of the downgrade policy flag being the first target value, determining that the firmware version downgrade policy is a step-by-step downgrade, and determining the old version number of the current version number of the firmware as the target version number; in response to the value of the downgrade policy flag being the second target value, determining that the firmware version downgrade policy is a prohibition of downgrade, and generating an alarm message that a compatibility error or stability problem occurs on the server.
[0030] Specifically, by setting the downgrade policy flag, the target version number satisfies the downgrade policy of the firmware corresponding manufacturer, thereby preventing the downgraded firmware from not being able to operate normally.
[0031] Furthermore, the value of the downgrade policy flag also includes at least a third target value, and the firmware downgrade and upgrade method also includes: in response to the value of the downgrade policy flag being the third target value, determining that the firmware version downgrade policy is cross-level downgrade, and determining the old first-level version number of the current version number of the firmware as the first intermediate version number; performing a downgrade operation on the firmware according to the first intermediate version number, and determining the current running state of the firmware; in response to a compatibility error or a stability problem occurring in the current running state, determining the old first-level version number of the first intermediate version number of the firmware as the second intermediate version number; performing a downgrade operation on the firmware according to the second intermediate version number, and determining the current running state of the firmware; in response to the current running state being a normal state, determining the second intermediate version number as the target version number; in response to a compatibility error or a stability problem occurring in the current running state, determining the old first-level version number of the second intermediate version number of the firmware as the third intermediate version number, and performing a downgrade operation on the firmware according to the third intermediate version number until the current running state of the firmware is a normal state.
[0032] Specifically, downgrading is mainly to make the firmware version compatible with other firmware versions of the server. Therefore, when the value of the downgrade policy flag includes the third target value, and the value of the downgrade policy flag is the third target value, indicating that the firmware version downgrade policy is cross-level downgrade, the incompatibility between the downgraded firmware and other firmware of the server can be avoided by downgrading step by step.
[0033] In a specific implementation, the third target value is 2.
[0034] Furthermore, the firmware is downgraded according to the first intermediate version number, including: comparing the first intermediate version number with the version numbers corresponding to multiple firmware files to obtain a first intermediate firmware file corresponding to the first intermediate version number; generating a first downgrade instruction for the firmware according to the first intermediate firmware file; and performing a corresponding downgrade operation on the firmware according to the first downgrade instruction of the firmware to change the current version number of the firmware to the first intermediate version number.
[0035] Furthermore, generating a firmware upgrade instruction or a firmware downgrade instruction according to a user instruction includes: obtaining a target version number in the user instruction and a version information library of the firmware in the firmware upgrade and downgrade device, wherein the version information library includes at least multiple firmware files of the firmware; comparing the target version number with the version numbers corresponding to the multiple firmware files to obtain a target firmware file corresponding to the target version number; and generating a firmware upgrade instruction or a firmware downgrade instruction according to the target firmware file.
[0036] Furthermore, based on the target firmware file, a firmware upgrade instruction or a firmware downgrade instruction is generated, including: obtaining the current version number of the firmware and comparing the current version number with the target version number; in response to the current version number being less than the target version number, generating a firmware upgrade instruction based on the target firmware file; in response to the current version number being greater than the target version number, generating a firmware downgrade instruction based on the target firmware file.
[0037] In addition, the upgrade instruction and the downgrade instruction also include at least an expected update time period, and the firmware upgrade and downgrade method also includes: obtaining the size of the target firmware file, and determining the expected update time period of the target firmware file based on the size of the target firmware file; obtaining multiple idle time periods of the firmware, and calculating multiple corresponding idle time periods based on the multiple idle time periods; comparing the multiple idle time periods with the expected update time periods; in response to the current idle time period being greater than the expected update time period, determining the idle time period corresponding to the current idle time period as the pending update time period; sorting the multiple pending update time periods from large to small according to the idle time period, and determining the expected update time period based on the pending update time period ranked first, wherein the pending update time period ranked first includes the expected update time period; in response to the multiple idle time periods being less than or equal to the expected update time period, determining the start update time in the expected update time period of the firmware according to the user's selection.
[0038] Specifically, updating the firmware while the user is using it will interrupt the tasks the user is currently working on. Therefore, in order to make the firmware update more user-friendly, the firmware update time period is arranged during the firmware's idle time period, or the firmware is updated starting from the update start time selected by the user.
[0039] In a specific implementation, the idle time period of the firmware can be the idle time period of each day. For example, generally 0:00-4:00, 12:00-13:00, and 23:00-24:00 every day, and the estimated update time of the firmware is 2 hours, then 0:00-4:00 is determined as the estimated update time period; the estimated update time of the firmware is 4.5 hours, and the update cannot be completed within one day. Considering that 23:00-24:00 on the first day and 0:00-4:00 on the second day are continuous time periods, 23:00-4:00 can also be determined as the estimated update time period.
[0040] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. In addition, Figure 1At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0041] In a second embodiment, a firmware upgrade and downgrade device is provided, which is applied to a firmware upgrade and downgrade system. The firmware upgrade and downgrade system includes a server, such as Figure 3 As shown, the firmware upgrade and downgrade device is connected to the server via a universal serial bus interface provided on the server, as shown in FIG. Figure 4 As shown, the firmware upgrade and downgrade device includes: a core controller module, which is used to establish a connection between the firmware upgrade and downgrade device and the server through the integrated circuit bus signal in the universal serial bus interface, and is used to monitor the server information fed back by the integrated circuit bus in real time, wherein the server information includes voltage information, which is used to convert the server information obtained in real time and transmit the server information to the graphic data controller; a graphic data controller module, which is used to receive the server information transmitted by the core controller module, and transmit the server information to the graphic data display module after conversion; a graphic data display module, which is used to display the server information transmitted by the graphic data controller; a universal serial bus interface on the firmware upgrade and downgrade device side, which is used to output the server information obtained by the core controller module to an external receiving end or local storage space in real time, so as to troubleshoot the core controller module, debug the driver and burn it; a universal serial bus module, which is used to convert the asynchronous serial signal of the core controller into a universal serial signal, and report the core controller information to the server through the universal serial bus interface; as shown Figure 5As shown, the power module is used to convert the voltage obtained through the universal serial bus connector into the working voltage of other modules of the firmware upgrading and downgrading device; the first storage module is used to store multiple firmware files corresponding to the firmware; the second storage module is used to cache the working data in real time when the core controller module is in the working state, and is used to store the firmware files obtained by the core controller module from the first storage module during the firmware upgrading and downgrading process, so that the server baseboard management controller can upgrade and downgrade according to the firmware files in the second storage module; the button module is used to switch the upgrading and downgrading mode of the core controller module; the light group module is used to display the current status of the firmware upgrading and downgrading device, wherein, when the firmware upgrading and downgrading device is working, green represents that the firmware upgrading and downgrading device is working normally, red represents that the firmware upgrading and downgrading device has an abnormality, when the firmware upgrade is completed, green represents that the firmware upgrade is successful, and red represents that the firmware upgrade fails, when the firmware upgrading and downgrading device is only used to display server information, green represents that the server is working, red represents that the server has a fault, and off represents that the firmware upgrading and downgrading device is in standby state or non-powered state.
[0042] Table 1 Configuration information in the first storage module
[0043] ①The Head field and Magic Num field are the beginning and end of the configuration information. The 4-byte detection ensures that the first storage module has been correctly burned with the firmware information. ②Version field: The version information of the configuration information. The baseboard management controller program will check the version in the configuration information. When the configuration information space changes, it adapts and is compatible with the lower version configuration space through the version information. ③Type field: The firmware information is further identified through the Type field to achieve accurate adaptation to various firmware scenarios.
[0044] Table 2 Meaning of different bit positions in the Type field
[0045] Bit0: Checks whether the firmware has been signed. If so, the validity of the signature needs to be verified again. Bit1: The internal storage module of the baseboard management controller uses the low byte by default. This bit is used to adjust the byte order of the information read by the firmware. Bit2: The baseboard management controller has both primary and backup storage modules. This bit is used to determine the target storage module location for firmware upgrade. Bit3: Used to confirm whether to restart the system after the firmware upgrade.
[0046] ④Chip field: By configuring this information, the baseboard management controller is notified which memory chip in the basic input and output system, baseboard management controller, and programmable logic controller to upgrade; ⑤Public Key field and Md5 field, through the public key and information digest algorithm to complete the legality and integrity verification of the firmware; ⑥Data Loc field and Data Length field, these two fields are used to locate the position and size of the firmware in the storage module.
[0047] In the specific implementation, after the baseboard management controller completes the mounting of the first storage module through the universal serial link, it reads the first 46 bytes of the first storage module as configuration information. The baseboard management controller program completes the initialization operation before the firmware upgrade by reading and parsing the configuration information; the baseboard management controller reads the firmware content through the firmware location information, decrypts the firmware through the public key to ensure that the source of the data is normal, and decrypts the firmware again through the baseboard management controller's secret key to ensure that the firmware has not been illegally tampered with and to ensure the legitimacy of the firmware; by performing information summary algorithm verification on the firmware and comparing it with the standard value in the configuration information, the integrity of the firmware data is ensured to avoid data burning abnormalities during the firmware burning process.
[0048] For the specific definition of the firmware upgrade and downgrade device, please refer to the definition of the firmware upgrade and downgrade method above, which will not be repeated here. Each module in the above-mentioned firmware upgrade and downgrade device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the electronic device in the form of hardware, or can be stored in the memory of the electronic device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0049] In a third embodiment, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program: determining whether a server is in a powered-on state; in response to the server being in a powered-on state, performing bidirectional authentication on the server and a firmware upgrading and downgrading device to obtain a bidirectional authentication result; in response to the bidirectional authentication result being successful, determining an upgrade and downgrading mode of the firmware upgrading and downgrading device, wherein the upgrade and downgrading modes include at least an automatic mode and a manual mode; in response to the upgrade and downgrading mode being the automatic mode, obtaining a current version number of the firmware, and generating an upgrade instruction for the firmware based on the current version number, or determining a current running state of the firmware, and generating a downgrade instruction for the firmware based on the current running state, wherein the upgrade instruction and the downgrade instruction include at least a target version number of the firmware; in response to the upgrade and downgrading mode being the manual mode, receiving a user instruction, and generating a firmware upgrade instruction or a firmware downgrade instruction based on the user instruction; and performing a corresponding upgrade operation or downgrade operation on the firmware based on the firmware upgrade instruction or the firmware downgrade instruction to change the current version number of the firmware to the target version number.
[0050] When the program instructions are read and executed by one or more processors, they can also perform operations corresponding to the various steps in the above method embodiments. Please refer to the above description and will not be repeated here. Figure 6 , which exemplarily shows the architecture of an electronic device, which may specifically include a processor 610, a video display adapter 611, a disk drive 612, an input / output interface 613, a network interface 614, and a memory 620. The processor 610, video display adapter 611, disk drive 612, input / output interface 613, network interface 614, and memory 620 may be communicatively connected via a communication bus 630.
[0051] Among them, the processor 610 can be implemented by a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in this application.
[0052] The memory 620 can be implemented in the form of a read-only memory (ROM), a random access memory (RAM), a static storage device, a dynamic storage device, etc. The memory 620 can store an operating system 621 for controlling the operation of the electronic device 600, and a basic input and output system (BIOS) 622 for controlling the low-level operations of the electronic device 600. In addition, a web browser 623, a data storage management 624, and an icon font processing system 625, etc. can also be stored. The above-mentioned icon font processing system 625 can be an application program that specifically implements the operations of the aforementioned steps in the embodiment of the present application. In short, when the technical solution provided by the present application is implemented by software or firmware, the relevant program code is stored in the memory 620 and is called and executed by the processor 610.
[0053] The input / output interface 613 is used to connect to input / output modules to enable information input and output. The input / output modules can be configured as components within the device (not shown) or externally connected to the device to provide corresponding functions. Input devices may include a keyboard, mouse, touch screen, microphone, and various sensors, while output devices may include a display, speaker, vibrator, indicator light, and the like.
[0054] The network interface 614 is used to connect to a communication module (not shown) to enable communication between the device and other devices. The communication module can communicate via wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, Wi-Fi, Bluetooth, etc.).
[0055] The bus 630 comprises a pathway for transmitting information between the various components of the device (eg, the processor 610 , the video display adapter 611 , the disk drive 612 , the input / output interface 613 , the network interface 614 , and the memory 620 ).
[0056] In addition, the electronic device 600 can also obtain information on specific collection conditions from a virtual resource object collection condition information database (not shown in the figure) for use in condition judgment.
[0057] It should be noted that although the electronic device 600 shown above only includes a processor 610, a video display adapter 611, a disk drive 612, an input / output interface 613, a network interface 614, a memory 620, a bus 630, etc., in a specific implementation, the electronic device may also include other components necessary for normal operation. In addition, it will be understood by those skilled in the art that the above device may only include the components necessary to implement the solution of the present application, and does not necessarily include all the components shown in the figure.
[0058] Through the description of the above implementation methods, it can be seen that those skilled in the art can clearly understand that the present application can be implemented by means of software plus the necessary general hardware platform. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling an electronic device (which can be a personal computer, a cloud server, or a network device, etc.) to execute the methods of each embodiment of the present application or certain parts of the embodiments.
[0059] In a fourth embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: determining whether the server is in a power-on state; in response to the server being in a power-on state, performing two-way authentication on the server and the firmware upgrade and downgrade device to obtain a two-way authentication result; in response to the two-way authentication result being successful verification, determining the upgrade and downgrade mode of the firmware upgrade and downgrade device, wherein the upgrade and downgrade modes include at least an automatic mode and a manual mode; in response to the upgrade and downgrade mode being the automatic mode, obtaining the current version number of the firmware, and generating an upgrade instruction for the firmware based on the current version number, or determining the current running state of the firmware, and generating a downgrade instruction for the firmware based on the current running state, wherein the upgrade instruction and the downgrade instruction include at least a target version number of the firmware; in response to the upgrade and downgrade mode being the manual mode, receiving a user instruction, and generating a firmware upgrade instruction or a firmware downgrade instruction based on the user instruction; performing a corresponding upgrade operation or downgrade operation on the firmware based on the firmware upgrade instruction or the firmware downgrade instruction to change the current version number of the firmware to the target version number.
[0060] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0061] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0062] The above embodiments merely illustrate several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make numerous variations and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application.
[0063] In a fifth embodiment, a computer program product is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: determining whether a server is in a power-on state; in response to the server being in a power-on state, performing two-way authentication on the server and the firmware upgrade and downgrade device to obtain a two-way authentication result; in response to the two-way authentication result being successful verification, determining an upgrade and downgrade mode of the firmware upgrade and downgrade device, wherein the upgrade and downgrade modes include at least an automatic mode and a manual mode; in response to the upgrade and downgrade mode being the automatic mode, obtaining the current version number of the firmware, and generating an upgrade instruction for the firmware based on the current version number, or determining the current running state of the firmware, and generating a downgrade instruction for the firmware based on the current running state, wherein the upgrade instruction and the downgrade instruction include at least a target version number of the firmware; in response to the upgrade and downgrade mode being the manual mode, receiving a user instruction, and generating a firmware upgrade instruction or a firmware downgrade instruction based on the user instruction; performing a corresponding upgrade operation or downgrade operation on the firmware based on the firmware upgrade instruction or the firmware downgrade instruction to change the current version number of the firmware to the target version number.
[0064] In a fifth embodiment, a computer program product is also provided, including a non-volatile computer-readable storage medium, the non-volatile computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, implementing the following steps: determining whether the server is in a powered-on state; in response to the server being in a powered-on state, performing two-way authentication on the server and the firmware upgrading and downgrading device to obtain a two-way authentication result; in response to the two-way authentication result being successful verification, determining an upgrade and downgrading mode of the firmware upgrading and downgrading device, wherein the upgrade and downgrading modes include at least an automatic mode and a manual mode; in response to the upgrade and downgrading mode being the automatic mode, obtaining the current version number of the firmware, and generating an upgrade instruction for the firmware based on the current version number, or determining the current running state of the firmware, and generating a downgrade instruction for the firmware based on the current running state, wherein the upgrade instruction and the downgrade instruction include at least a target version number of the firmware; in response to the upgrade and downgrading mode being the manual mode, receiving a user instruction, and generating a firmware upgrade instruction or a firmware downgrade instruction based on the user instruction; performing a corresponding upgrade operation or downgrade operation on the firmware based on the firmware upgrade instruction or the firmware downgrade instruction to change the current version number of the firmware to the target version number.
[0065] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing related hardware through a computer program. The computer program can be stored in a computer program product. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods.
[0066] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0067] The above embodiments merely illustrate several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make numerous variations and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application.
Claims
1. A firmware upgrade method, applied to a firmware upgrade device, wherein the firmware upgrade device is connected to a server, characterized in that: The method comprises: Determining whether the server is in a powered-on state; In response to the server being in a powered-on state, performing bidirectional authentication on the server and the firmware upgrade / downgrade device to obtain a bidirectional authentication result; In response to the bidirectional identity authentication result being successful, determining an upgrade / downgrade mode of the firmware upgrade / downgrade device, wherein the upgrade / downgrade mode includes at least an automatic mode and a manual mode; In response to the upgrade / downgrade mode being the automatic mode, obtaining a current version number of the firmware and generating an upgrade instruction for the firmware according to the current version number, or determining a current operating state of the firmware and generating a downgrade instruction for the firmware according to the current operating state, wherein the upgrade instruction and the downgrade instruction include at least a target version number of the firmware; In response to the upgrade / downgrade mode being the manual mode, receiving a user instruction, and generating an upgrade instruction of the firmware or a downgrade instruction of the firmware according to the user instruction; According to the firmware upgrade instruction or the firmware downgrade instruction, a corresponding upgrade operation or downgrade operation is performed on the firmware to change the current version number of the firmware to the target version number.
2. The method according to claim 1, characterized in that The determining whether the server is in a powered-on state includes: Obtaining a current voltage value of the server, and comparing the current voltage value with a preset voltage range, wherein the preset voltage range includes at least a first voltage range, a second voltage range, and a third voltage range; In response to the current voltage value being within a first voltage range, determining that the server is in a powered-on state; In response to the current voltage value being within a second voltage range, determining that the server is in a standby state; In response to the current voltage value being within a third voltage range, it is determined that the server is in a power-off state or a fault state.
3. The method according to claim 1, characterized in that The performing bidirectional authentication on the server and the firmware upgrade / downgrade device to obtain a bidirectional authentication result includes: generating a server authentication instruction and sending the server authentication instruction to the server, and simultaneously receiving a device authentication instruction generated by the server; Performing identity authentication according to the device identity authentication instruction, obtaining a device identity authentication result, returning the device identity authentication result to the server, and receiving a server identity authentication result returned by the server; In response to both the device identity authentication result and the server identity authentication result being successful, determining that the two-way identity authentication result is successful; In response to the device identity authentication result and / or the server identity authentication result failing to be authenticated, the two-way identity authentication result is determined to be a authentication failure.
4. The method according to claim 1, characterized in that The determining the upgrade / downgrade mode of the firmware upgrade / downgrade device includes: Acquire an upgrade / downgrade mode flag in the firmware upgrade / downgrade device, wherein the value of the upgrade / downgrade mode flag includes at least a first target value and a second target value; In response to the value of the upgrade / downgrade mode flag being a first target value, determining that the upgrade / downgrade mode of the firmware upgrade / downgrade device is an automatic mode; In response to the value of the upgrade / downgrade mode flag being the second target value, it is determined that the upgrade / downgrade mode of the firmware upgrade / downgrade apparatus is the manual mode.
5. The method according to claim 1, characterized in that: The obtaining of the current version number of the firmware and generating an upgrade instruction for the firmware according to the current version number includes: Obtaining a current version number of the firmware in the server and a version information library of the firmware in the firmware upgrade / downgrade device, wherein the version information library includes at least a plurality of firmware files of the firmware and an upgrade policy flag of the firmware, and the value of the upgrade policy flag includes at least a first target value and a second target value; Determine the target version number according to the current version number and the upgrade strategy flag, wherein the target version number is greater than the current version number; Comparing the target version number with the version numbers corresponding to the multiple firmware files to obtain a target firmware file corresponding to the target version number; An upgrade instruction for the firmware is generated according to the target firmware file.
6. The method according to claim 5, characterized in that Determining the target version number according to the current version number and the upgrade strategy flag includes: In response to the value of the upgrade strategy flag being the first target value, determining that the version upgrade strategy of the firmware is a level-by-level upgrade, and determining a new level version number of the current version number of the firmware as the target version number; In response to the value of the upgrade policy flag being the second target value, the version upgrade policy of the firmware is determined to be a cross-level upgrade, and the latest version number of the firmware is determined as the target version number.
7. The method according to claim 1, characterized in that: The determining the current running state of the firmware and generating a downgrade instruction of the firmware according to the current running state includes: determining a current operating state of the firmware; In response to a compatibility error or a stability problem occurring in the current running state, obtaining a current version number of the firmware in the server and a version information library of the firmware in the firmware upgrading and downgrading device, wherein the version information library includes at least a plurality of firmware files of the firmware and a downgrade policy flag of the firmware, and a value of the downgrade policy flag includes at least a first target value and a second target value; Determine the target version number according to the current version number and the downgrade policy flag, wherein the target version number is smaller than the current version number; Comparing the target version number with the version numbers corresponding to the multiple firmware files to obtain a target firmware file corresponding to the target version number; A firmware downgrade instruction is generated according to the target firmware file.
8. The method according to claim 7, characterized in that: The determining the target version number according to the current version number and the downgrade strategy flag includes: In response to the downgrade strategy flag being a first target value, determining that the version downgrade strategy of the firmware is step-by-step downgrade, and determining a version number one level older than the current version number of the firmware as the target version number; In response to the value of the downgrade policy flag being the second target value, it is determined that the version downgrade policy of the firmware is to prohibit downgrade, and an alarm message is generated indicating that a compatibility error or a stability problem occurs on the server.
9. The method according to claim 7, characterized in that: The value of the degradation strategy flag includes at least a third target value, and the method further includes: In response to the value of the downgrade strategy flag being a third target value, determining that the version downgrade strategy of the firmware is cross-level downgrade, and determining an older version number of the current version number of the firmware as a first intermediate version number; Performing a downgrade operation on the firmware according to the first intermediate version number, and determining a current running state of the firmware; In response to a compatibility error or a stability problem occurring in the current running state, determining an older level version number of the first intermediate version number of the firmware as a second intermediate version number; Performing a downgrade operation on the firmware according to the second intermediate version number, and determining a current running state of the firmware; In response to the current running state being a normal state, determining the second intermediate version number as the target version number; In response to a compatibility error or stability problem occurring in the current running state, the old first-level version number of the second intermediate version number of the firmware is determined as the third intermediate version number, and the firmware is downgraded according to the third intermediate version number until the current running state of the firmware is normal.
10. The method according to claim 9, characterized in that: The downgrading operation on the firmware according to the first intermediate version number includes: Comparing the first intermediate version number with version numbers corresponding to the multiple firmware files to obtain a first intermediate firmware file corresponding to the first intermediate version number; generating a first downgrade instruction for the firmware according to the first intermediate firmware file; According to the first downgrade instruction of the firmware, a corresponding downgrade operation is performed on the firmware to change the current version number of the firmware to the first intermediate version number.
11. The method according to claim 1, characterized in that: Generating the firmware upgrade instruction or the firmware downgrade instruction according to the user instruction includes: Obtaining the target version number in the user instruction and the version information library of the firmware in the firmware upgrade / downgrade device, wherein the version information library includes at least a plurality of firmware files of the firmware; Comparing the target version number with the version numbers corresponding to the multiple firmware files to obtain a target firmware file corresponding to the target version number; Generate an upgrade instruction for the firmware or a downgrade instruction for the firmware according to the target firmware file.
12. The method according to claim 11, characterized in that: Generating the firmware upgrade instruction or the firmware downgrade instruction according to the target firmware file includes: Obtaining a current version number of the firmware, and comparing the current version number with the target version number; In response to the current version number being less than the target version number, generating an upgrade instruction for the firmware according to the target firmware file; In response to the current version number being greater than the target version number, a firmware downgrade instruction is generated according to the target firmware file.
13. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the firmware upgrade and downgrade method according to any one of claims 1 to 12 when executing the computer program.
14. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the firmware upgrade and downgrade method according to any one of claims 1 to 12 are implemented.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the firmware upgrade and downgrade method according to any one of claims 1 to 12 are implemented.
Citation Information
Patent Citations
Firmware upgrading and downgrading testing method and device for double-control storage system
CN107992423A
Hard disk upgrading and downgrading test method and device, electronic equipment and storage medium
CN115658136A
Firmware upgrading method, system and device and medium
CN117453260A
Method and device for upgrading software version of power distribution network robot and electronic equipment
CN120447931A
Method and Apparatus for downgrading firmware in a controller
US20120317562A1