A GPU firmware management method and storage medium

By using automated script initialization and IPMI command management, the cumbersome GPU firmware update process and the complexity caused by platform differences are resolved, enabling efficient and reliable GPU firmware updates.

CN120803501BActive Publication Date: 2025-12-16POWERLEADER COMPUTER SYST CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202511329871.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-17
Publication Date
2025-12-16
Estimated Expiration
2045-09-17

AI Technical Summary

Technical Problem

The existing GPU firmware update process is cumbersome and error-prone, especially since it requires manual code adjustments or selection of different script files across different hardware platforms, resulting in complex and inefficient operations.

Method used

The GPU firmware update environment is initialized automatically by script, which obtains the current version, identifies the hardware platform type, selects the corresponding predefined IPMI command list, disables write protection, compares the target with the current version, generates a list of updates to be performed, and executes the update operation.

Benefits of technology

It automates GPU firmware updates, reduces the probability of errors, improves update efficiency, and adapts to different hardware platforms without requiring manual code adjustments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120803501B_ABST
    Figure CN120803501B_ABST
Patent Text Reader

Abstract

The application relates to a GPU firmware management method and a storage medium, which initializes a running environment of GPU firmware updating through a script, creates a current version acquisition function, acquires a current version of a firmware component through the current version acquisition function, identifies a hardware platform type, selects a corresponding predefined IPMI command list according to the hardware platform type, executes an IPMI command in the predefined IPMI command list to disable write protection, acquires a target version of the firmware component, compares the target version of the firmware component with the current version of the firmware component, determines a firmware component to be updated, adds the firmware component to be updated to an updating list, and executes an updating firmware component operation on the updating list. The GPU firmware management method realizes automation through a script, reduces the possibility of errors, shortens the GPU firmware updating time, and improves work efficiency. According to the hardware platform type, a corresponding predefined IPMI command list is selected, manual code adjustment is not needed, and work efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of computers, in particular to a GPU firmware management method and a storage medium. BACKGROUND

[0002] A GPU (Graphics Processing Unit) is a processor designed specifically for handling graphics and parallel computing tasks. GPU firmware is a lightweight operating system running on a GPU, responsible for managing the hardware resources and executing tasks. Firmware components are software modules running on GPU hardware, responsible for managing hardware resources, task scheduling, error handling, and performance optimization.

[0003] In related technologies, the firmware update process requires manual execution of multiple operation steps, such as creating folders, modifying permissions, checking version numbers, etc. This process is not only prone to errors, but also tedious to operate. In addition, when there are differences in hardware platforms (e.g., Intel hardware platform and AMD hardware platform), the commands used for updating operations are also different, at which time manual code adjustment or selection of different script files is required to complete the update. SUMMARY

[0004] The present application provides a GPU firmware management method and a storage medium, aiming to at least solve one of the technical problems existing in the prior art.

[0005] The technical solution of the present application is a GPU firmware management method, comprising:

[0006] Initializing the running environment of GPU firmware update through a script;

[0007] Creating a current version acquisition function, and acquiring the current version of the firmware component through the current version acquisition function;

[0008] Identifying the hardware platform type and selecting the corresponding predefined IPMI command list according to the hardware platform type;

[0009] Executing IPMI commands in the predefined IPMI command list to disable write protection;

[0010] Acquiring the target version of the firmware component, comparing the target version of the firmware component with the current version of the firmware component, determining the firmware component to be updated, and adding the firmware component to be updated to the update list;

[0011] Performing an update firmware component operation on the update list.

[0012] According to some embodiments of the present application, initializing the running environment of GPU firmware update comprises:

[0013] A first command for creating a multi-level directory is invoked to create a GPU firmware directory;

[0014] A second command is used to traverse the files under the GPU firmware directory, filter out the configuration file and the script file for Unix system, invoke the external tool dos2unix to convert the configuration file and the script file for Unix system from Windows format to Unix format, and the second command is used to list the file and subdirectory names in the specified directory;

[0015] A third command is used to set the executable permission of the script file for Unix system, and the third command is used to change the permission of the file or directory;

[0016] A fourth command is used to open the configuration file, read and parse the key-value pairs of the configuration file line by line, and store the configuration information of the key-value pairs into a first global variable, and the fourth command is used to open and read the file.

[0017] According to some embodiments of the present application, a current version acquisition function is created, including:

[0018] The current version of the firmware component is acquired, and the current version is formatted into an acquisition component version command, wherein the firmware component is specified through a component parameter in the acquisition component version command;

[0019] A fifth command is used to execute the acquisition component version command to acquire the current version of the firmware component, and the fifth command is used to execute the external command and capture the standard output thereof;

[0020] If the current version of the firmware component fails to be extracted, a sixth command is used to capture the exception and record the error log, and a special value indicating that the current version of the firmware component is unknown is returned, so as to create the current version acquisition function, and the sixth command is used to capture and handle the error occurring in the process of program running.

[0021] According to some embodiments of the present application, the hardware platform type is identified, including:

[0022] A seventh command is used to read the processor information, and the seventh command is used to display the processor information;

[0023] The hardware platform type is determined by matching the hardware platform type keyword in the processor information;

[0024] The hardware platform type is returned in the form of a string, and the log is recorded.

[0025] According to some embodiments of the present application, executing the IPMI command in the predefined IPMI command list to disable the write protection comprises:

[0026] traversing the predefined IPMI command list, executing the IPMI command in the predefined IPMI command list by an eighth command to disable the write protection, the eighth command being used to execute an external command;

[0027] returning a command execution status code, checking the command execution status code;

[0028] if the command execution status code indicates that the IPMI command fails to execute, recording an error log and aborting the write protection disabling procedure.

[0029] According to some embodiments of the present application, the current version of the firmware component is obtained by the obtaining current version function, comprising:

[0030] traversing each firmware component in the component list, calling the obtaining current version function to obtain the current version of the firmware component;

[0031] storing the current version of the firmware component into a second global variable.

[0032] According to some embodiments of the present application, the target version of the firmware component is obtained, the target version of the firmware component is compared with the current version of the firmware component, the firmware component to be updated is determined, the firmware component to be updated is added to an update list, comprising:

[0033] traversing each firmware component in the component list, reading the target version of the firmware component from a configuration file, comparing the target version of the firmware component with the current version of the firmware component stored in the second global variable;

[0034] if the current version of the firmware component is lower than the target version of the firmware component, determining the firmware component to be updated, adding the firmware component to be updated to the update list, and recording the target version of the firmware component to be updated and the current version of the firmware component to be updated to the update list.

[0035] According to some embodiments of the present application, the update firmware component operation is performed on the update list, comprising:

[0036] checking whether the update list is empty;

[0037] if the update list is empty, the update firmware component operation does not need to be performed on the update list, and a log is recorded;

[0038] If the to-be-updated list is not empty, the update firmware component operation is performed on the to-be-updated list, and a log is recorded;

[0039] In the process of updating the to-be-updated firmware component, a sixth command is used to capture an exception and record an error log, terminate the updating process, and the sixth command is used to capture and handle errors occurring during program execution.

[0040] According to some embodiments of the present application, after the update firmware component operation is performed on the to-be-updated list, the GPU firmware management method further comprises:

[0041] After the to-be-updated firmware component is updated, a ninth command is used to regenerate the current version of the to-be-updated firmware component, a tenth command is used to dynamically read the target version of the to-be-updated firmware component, the current version of the to-be-updated firmware component is compared with the target version of the to-be-updated firmware component, if the versions match, a success log is recorded, otherwise a failure log is recorded and manual intervention is prompted, the ninth command is used to traverse firmware components and obtain version information of the firmware components, and the tenth command is used to obtain specific configuration values from a configuration file;

[0042] The write protection is restored through an IPMI tool;

[0043] A cleanup function for cleaning up resources is called to clean up temporary resources generated during the updating process, so as to release disk space.

[0044] The technical solution of the present application also relates to an electronic device, which comprises a memory and a processor, the memory stores a computer program, and the processor implements the GPU firmware management method as described above when executing the computer program.

[0045] The technical solution of the present application also relates to a storage medium, which stores a computer program, and the computer program is executed by a processor to implement the GPU firmware management method as described above.

[0046] The beneficial effects of the present application include: through the script, initializing the running environment of the GPU firmware update, creating a current version acquisition function, acquiring the current version of the firmware component through the current version acquisition function, then identifying the hardware platform type, selecting the corresponding predefined IPMI command list according to the hardware platform type, executing the IPMI command in the predefined IPMI command list to disable the write protection, acquiring the target version of the firmware component, comparing the target version of the firmware component with the current version of the firmware component, determining the firmware component to be updated, adding the firmware component to be updated to the update list, and executing the update firmware component operation on the update list. The GPU firmware management method realizes automation through the script, reduces the possibility of error, and shortens the GPU firmware update time, thereby improving the work efficiency. According to the hardware platform type, the corresponding predefined IPMI command list is selected, without the need for manual code adjustment, thereby improving the work efficiency.

[0047] In addition, additional aspects and advantages of the present application will be in part apparent and in part pointed out hereinafter in the description. BRIEF DESCRIPTION OF DRAWINGS

[0048] Fig. 1 is an optional flowchart of a GPU firmware management method in an embodiment of the present application.

[0049] Fig. 2 is an optional flowchart of initializing the running environment of the GPU firmware update in an embodiment of the present application.

[0050] Fig. 3 is an optional flowchart of acquiring the current version of the firmware component through the current version acquisition function in an embodiment of the present application. DETAILED DESCRIPTION

[0051] The concept, specific structure and generated technical effects of the present application will be described clearly and completely in combination with embodiments and drawings, so as to fully understand the purpose, scheme and effect of the present application. It should be noted that the embodiments and features in the embodiments in the present application can be combined with each other without conflict.

[0052] It should be noted that, unless otherwise specified, when a certain feature is referred to as being "fixed" or "connected" to another feature, it can be directly fixed or connected to the other feature, or indirectly fixed or connected to the other feature. In addition, the up, down, left, right, top, bottom and other descriptions used in the present application are only relative to the relative positions of the components of the present application in the drawings.

[0053] Furthermore, unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in this specification is for the purpose of describing particular embodiments only and not for limiting the invention. The term "and / or" as used herein includes any combination of one or more of the associated listed items.

[0054] It should be understood that although the terms first, second, third, etc., may be used to describe various elements in this invention, these elements should not be limited to these terms. These terms are only used to distinguish elements of the same type from each other. For example, a first element may also be referred to as a second element without departing from the scope of this invention, and similarly, a second element may also be referred to as a first element.

[0055] Reference Figs. 1 to 3 In some embodiments, the technical solution of the present invention is a GPU firmware management method, including but not limited to steps S101 to S106, which are described in turn below.

[0056] Step S101: Initialize the runtime environment for GPU firmware update using a script.

[0057] Understandably, automation through scripts reduces the possibility of errors and improves work efficiency.

[0058] In a specific embodiment, the GPU firmware management method is implemented through a script.

[0059] In one specific embodiment, before initializing the runtime environment for GPU firmware updates, the GPU firmware management method further includes loading a configuration file.

[0060] Reference Fig. 2 In some embodiments, the runtime environment for GPU firmware updates is initialized, including but not limited to the following steps S201 to S204.

[0061] Step S201: Call the first command used to create a multi-level directory to create the GPU firmware directory.

[0062] Step S202: Use the second command to traverse the files in the GPU firmware directory, filter out the configuration files and script files for Unix systems, and call the external tool dos2unix to convert the configuration files and script files for Unix systems from Windows format to Unix format. The second command is used to list the file and subdirectory names in the specified directory.

[0063] Step S203: Set executable permissions for script files used on Unix systems using a third command, which is used to change the permissions of files or directories.

[0064] Step S204: opening the configuration file using a fourth command, reading the key-value pairs of the configuration file line by line and parsing the key-value pairs, storing the configuration information of the key-value pairs into the first global variable, the fourth command being used for opening the file and reading the file.

[0065] In some embodiments, the running environment for initializing the GPU firmware update is initialized, including:

[0066] A first command os.makedirs for creating a multi-level directory is called to create the GPU firmware directory;

[0067] A second command os.listdir is used to traverse the files under the GPU firmware directory, and the config.txt file (i.e., the aforementioned configuration file) and the.sh script file (i.e., the aforementioned script file for Unix system) are screened out, and an external tool dos2unix is called to convert the config.txt file and the.sh script file from Windows format to Unix format, the second command being used to list the file and subdirectory names in the specified directory;

[0068] A third command os.chmod is used to set the executable permission for the.sh script file, the third command being used to change the permission of a file or directory;

[0069] A fourth command open is used to open the config.txt file, read the key-value pairs of the config.txt file line by line and parse the key-value pairs, and store the configuration information of the key-value pairs into the first global variable config, the fourth command being used to open the file and read the file.

[0070] The.sh script file is a script that can run under Linux. Specifically, dos2unix is a tool for converting text files from DOS / Windows format to Unix / Linux format. Unix is a powerful multi-user, multi-tasking operating system. Windows is a series of operating systems developed by Microsoft Corporation, widely used in personal computers, servers and mobile devices. os.makedirs is used to create a multi-level directory. os.listdir is used to list the file and subdirectory names in the specified directory. os.chmod is used to change the permission of a file or directory. open is a built-in function of Python, which is used to open a file and return a file object, which can be used to read or write a file.

[0071] It can be understood that initializing the running environment for the GPU firmware update is beneficial to ensure that the running environment of the update system is clean, standardized, and has execution permission, preventing subsequent firmware update scripts from failing due to path errors, insufficient permissions, and missing configurations.

[0072] It should be noted that the GPU firmware directory includes a log directory, a backup directory, and a configuration directory. The config.txt file is the configuration file.

[0073] In one specific embodiment, after calling os.makedirs to create the GPU firmware directory, the process also includes: recording the creation status of the GPU firmware directory via log_info.

[0074] Specifically, the `os.makedirs(directory, exist_ok=True)` function creates the log directory, backup directory, and configuration directories (such as `config / passwd` and `config / version`), and records the creation status of the GPU firmware directories using `log_info`. An example is shown below:

[0075] def create_directories():

[0076] # Define the list of directories to be created

[0077] directories = ["logs", "backups", "config / passwd", "config / version"]

[0078] For directory in directories:

[0079] # Use os.makedirs to create directories, with exist_ok=True to ensure the directory doesn't already exist and prevent errors.

[0080] os.makedirs(directory, exist_ok=True)

[0081] # Record directory creation status

[0082] log_info(f"Directory has been confirmed to exist: {directory}")

[0083] In one specific embodiment, the os.listdir is used to traverse the files in the GPU firmware directory, filter out the config.txt file and the .sh script file, and call the external tool dos2unix to convert the config.txt file and the .sh script file from Windows format to Unix format. Then, if the format conversion of the config.txt file and the .sh script file is successful, a success log is recorded; otherwise, a failure log is recorded.

[0084] Specifically, the os.listdir() function is used to traverse the files under the GPU firmware directory, and the config.txt file and.sh script file are filtered out. The external tool dos2unix is called to convert the config.txt file and.sh script file from Windows format to Unix format, avoiding script execution errors caused by newline character problems (^M). Log is recorded when conversion is successful or failed. For example:

[0085] def convert_file_formats():

[0086] # Filter out the files that need to be converted: config.txt and all.sh files

[0087] files_to_convert = ["config.txt"] + [f for f in os.listdir(".")if f.endswith(".sh")]

[0088] for file_name in files_to_convert:

[0089] if os.path.exists(file_name):# Check if the file exists

[0090] try:

[0091] # Use the dos2unix tool to convert the file to Unix format

[0092] subprocess.run(["dos2unix", file_name], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)

[0093] # Log file format conversion success

[0094] log_info(f"Converted to Unix format: {file_name}")

[0095] except Exception as e:

[0096] # If the conversion fails, record the error log

[0097] log_error(f"File format conversion failed: {file_name} - {e}")

[0098] In one specific embodiment, after setting executable permissions on.sh script files using os.chmod, further comprising: recording permission setting status through log_info.

[0099] Specifically, all.sh script files under the GPU firmware directory are filtered out using os.listdir, executable permissions are set on the.sh script files using os.chmod(script, 0o755), to ensure that these scripts can be normally called by subsequent processes, and permission setting status is recorded through log_info. For example:

[0100] def set_executable_permissions():

[0101] # Filter out all.sh script files

[0102] scripts = [f for f in os.listdir(".") if f.endswith(".sh")]

[0103] for script in scripts:

[0104] # Set executable permissions (0o755) for scripts

[0105] os.chmod(script, 0o755)

[0106] # Record permission setting status

[0107] log_info(f"Has set executable permissions: {script}")

[0108] In one specific embodiment, after opening the config.txt file using open, reading the key-value pairs of the config.txt file line by line and parsing the key-value pairs, and storing the configuration information of the key-value pairs into the global variable config, further comprising: if the config.txt file does not exist or fails to be parsed, then record an error log.

[0109] Specifically, the config.txt file is opened using open, the content of the config.txt file is read line by line and the key-value pairs are parsed, and the configuration information is stored into the global variable config. If the config.txt file does not exist or fails to be parsed, an error log is recorded. For example:

[0110] def load_config_file(file_path):

[0111] global config

[0112] # Initialize configuration dictionary

[0113] config = {}

[0114] try:

[0115] # Open configuration file and read line by line

[0116] with open(file_path, "r") as f:

[0117] for line in f:

[0118] if "=" in line: # Check if it contains key-value pair

[0119] key, value = line.strip().split("=", 1) # Split key-value pair

[0120] config[key.strip()] = value.strip() # Store in configuration dictionary

[0121] # Log configuration file loading success

[0122] log_info(f"Configuration file has been loaded: {file_path}")

[0123] except Exception as e:

[0124] # If loading fails, log error

[0125] log_error(f"Configuration file loading failed: {file_path} - {e}")

[0126] Specifically, the overall example of initializing the running environment for GPU firmware update is as follows:

[0127] import os

[0128] import subprocess

[0129] def log_info(msg):

[0130] print(f"[INFO] {msg}")

[0131] def log_error(msg):

[0132] print(f"[ERROR] {msg}")

[0133] def create_directories():

[0134] directories = ["logs", "backups", "config / passwd", "config / version"]

[0135] For directory in directories:

[0136] os.makedirs(directory, exist_ok=True)

[0137] log_info(f"Directory has been confirmed to exist: {directory}")

[0138] def convert_file_formats():

[0139] files_to_convert = ["config.txt"] + [f for f in os.listdir(".")if f.endswith(".sh")]

[0140] for file_name in files_to_convert:

[0141] if os.path.exists(file_name):

[0142] try:

[0143] subprocess.run(["dos2unix", file_name], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)

[0144] log_info(f"Converted to Unix format: {file_name}")

[0145] except Exception as e:

[0146] log_error(f"File format conversion failed: {file_name} - {e}")

[0147] def set_executable_permissions():

[0148] scripts = [f for f in os.listdir(".") if f.endswith(".sh")]

[0149] For scripts in scripts:

[0150] os.chmod(script, 0o755)

[0151] log_info(f"Execute permissions have been set: {script}")

[0152] def load_config_file(file_path):

[0153] global config

[0154] config = {}

[0155] try:

[0156] with open(file_path, "r") as f:

[0157] for line in f:

[0158] if "=" in line:

[0159] key, value = line.strip().split("=", 1)

[0160] config[key.strip()] = value.strip()

[0161] log_info(f"Configuration file loaded: {file_path}")

[0162] except Exception as e:

[0163] log_error(f"Configuration file loading failed: {file_path} - {e}")

[0164] def initialize_environment():

[0165] create_directories()

[0166] convert_file_formats()

[0167] set_executable_permissions()

[0168] load_config_file("config.txt")

[0169] Step S102: Create a get current version function, and obtain the current version of the firmware component through the get current version function.

[0170] It should be noted that the get current version function is denoted as the get_current_version function.

[0171] It can be understood that the firmware component includes a GPU Retimer, a VBIOS, an NVSwitch, and the like. A new firmware component name can be added in the components list to expand the range of supported firmware components.

[0172] In some embodiments, creating the get current version function includes:

[0173] The current version of the firmware component is formatted into a get component version command, where the firmware component is specified through a component parameter in the get component version command;

[0174] The get component version command is executed using a fifth command to obtain the current version of the firmware component, where the fifth command is used to execute an external command and capture the standard output thereof;

[0175] If the current version of the firmware component fails to be extracted, an exception is captured using a sixth command and an error log is recorded, and a special value indicating that the current version of the firmware component is unknown is returned, so as to create the get current version function, where the sixth command is used to capture and handle errors occurring in the process of program running.

[0176] In some embodiments, creating the get_current_version function (i.e., the aforementioned get current version function) includes:

[0177] The current version of the firmware component is formatted into a get_{component}_version command (i.e., the aforementioned get component version command), where the firmware component is specified through component (i.e., the aforementioned component parameter);

[0178] The get_{component}_version command is executed using a fifth command subprocess.check_output to obtain the current version of the firmware component, where the fifth command is used to execute an external command and capture the standard output thereof;

[0179] If the current version extraction of the firmware component fails, the sixth command try-except is used to capture exceptions and record error logs, and returns None (i.e. the special value mentioned above) to indicate that the current version of the firmware component is unknown, so as to create the get_current_version function, which is used to capture and handle errors occurring during program execution.

[0180] Specifically, try-except is a syntax structure in Python for handling exceptions. subprocess.check_output is a function in the subprocess module of Python, which is used to execute external commands and capture their standard output.

[0181] Specifically, the current version of the firmware component will be obtained and formatted into the get_{component}_version command, where the firmware component is specified by component. Formatting the current version of the firmware component into the get_{component}_version command is conducive to maintaining and extending the command for obtaining the current version of the firmware component.

[0182] It should be noted that the firmware component is Retimer, i.e. component is Retimer, and the command for obtaining the current version of the firmware component is represented as get_retimer_version. The firmware component is VBIOS, i.e. component is VBIOS, and the command for obtaining the current version of the firmware component is represented as get_vbios_version.

[0183] Specifically, subprocess.check_output() is used to execute external commands (such as get_retimer_version, get_vbios_version, etc.) to dynamically obtain the current version of the specified firmware component. If the current version extraction of the firmware component fails (for example, the command does not exist or execution error), the exception is captured and the error log is recorded, and None is returned to avoid subsequent process exceptions caused by null values. Where try-except is used to capture exceptions, ensuring that even if the version extraction of a certain firmware component fails, it will not affect the detection of other firmware components. Returning None indicates that the current version of the firmware component is unknown.

[0184] The get_current_version function is created, for example:

[0185] def get_current_version(component):

[0186] try:

[0187] # Dynamically generate command format: get_{component}_version

[0188] cmd = f"get_{component}_version"

[0189] # Execute the command and get the output result

[0190] result = subprocess.check_output(cmd, shell=True).decode().strip()

[0191] # Return the version information

[0192] return result

[0193] except Exception as e:

[0194] # Catch exceptions and log error

[0195] log_error(f"Failed to get {component} version: {e}")

[0196] # Return None if the version is unknown

[0197] return None

[0198] Refer to Fig. 3 , in some embodiments, the current version of a firmware component is obtained by a get_current_version function, including but not limited to the following steps S301-S302.

[0199] Step S301: Traverse each firmware component in the component list and call the get_current_version function to obtain the current version of the firmware component.

[0200] Step S302: Store the current version of the firmware component in the second global variable.

[0201] In some embodiments, the current version of a firmware component is obtained by a get_current_version function, including:

[0202] Traverse each firmware component in the components list (i.e., the aforementioned component list) and call the get_current_version function to obtain the current version of the firmware component.

[0203] The current version of the firmware component is stored in the second global variable firmware_info.

[0204] In one specific embodiment, after storing the current version of the firmware component in the global variable firmware_info, it further includes recording the firmware component information through log_info.

[0205] Specifically, each firmware component in the components list is traversed, and the get_current_version function is called to obtain the current version of the firmware component. The current version of the firmware component is stored in the global variable firmware_info, with the key name gpu_{component}_version (such as gpu_retimer_version, gpu_vbios_version, etc.). The firmware component information is recorded through log_info for debugging and verification. Among them, gpu_retimer_version is the key name of the firmware component Retimer, and gpu_vbios_version is the key name of the firmware component VBIOS.

[0206] It should be noted that for each firmware component in the components list, the get_current_version function is called to obtain the current version of the firmware component. The firmware component name and version information are stored in the global variable firmware_info, with the key f"gpu_{comp}_version", i.e. the firmware component name, and the value is the corresponding version information. For example:

[0207] def generate_firmware_info():

[0208] global firmware_info

[0209] # Define the list of components to be checked

[0210] components = ["retimer", "vbios", "nvswitch"]

[0211] # Traverse the component list and call get_current_version to obtain version information

[0212] firmware_info = {

[0213] f"gpu_{comp}_version": get_current_version(comp) for comp incomponents

[0214] }

[0215] # Record the generated firmware information for debugging and verification

[0216] log_info(f"Current firmware information: {firmware_info}")

[0217] Specifically, create the get_current_version function, through which the current version of the firmware component is obtained, for example:

[0218] def get_current_version(component):

[0219] try:

[0220] cmd = f"get_{component}_version"

[0221] result = subprocess.check_output(cmd, shell=True).decode().strip()

[0222] return result

[0223] except Exception as e:

[0224] log_error(f"Failed to get {component} version: {e}")

[0225] return None

[0226] def generate_firmware_info():

[0227] global firmware_info

[0228] components = ["retimer", "vbios", "nvswitch"]

[0229] firmware_info = {f"gpu_{comp}_version": get_current_version(comp)for comp in components}

[0230] log_info(f"Current firmware information: {firmware_info}")

[0231] Step S103: Identify the hardware platform type, and select the corresponding predefined IPMI command list according to the hardware platform type.

[0232] Specifically, IPMI (Intelligent Platform Management Interface) is an open standard for remotely monitoring and managing computer systems, allowing system administrators to remotely monitor hardware status such as temperature, voltage, fan speed, etc., and remotely control the system when problems occur.

[0233] In some embodiments, identifying the hardware platform type includes:

[0234] Reading the processor information using the seventh command, which is used to display the processor information;

[0235] Determining the hardware platform type by matching the hardware platform type keyword in the processor information;

[0236] Returning the hardware platform type in string form and recording the log.

[0237] In some embodiments, identifying the hardware platform type includes:

[0238] Reading the processor information using the dmidecode -t4 command (i.e., the aforementioned seventh command);

[0239] Determining the hardware platform type by matching the hardware platform type keyword in the processor information;

[0240] Returning the hardware platform type in string form and recording the log.

[0241] Wherein, the processor information represents the information of the CPU, and the information of the CPU is viewed using the dmidecode -t4 command, such as the manufacturer, version, voltage, and multi-level cache information. Specifically, the dmidecode -t4 command is used to obtain detailed information of the Processor in the system.

[0242] In one specific embodiment, the hardware platform type is determined by reading the system DMI information (dmidecode -t4).

[0243] In particular, the hardware platform type includes Intel and AMD. The hardware platform type keywords include amd and intel. If the processor information contains "AMD", the hardware platform type is determined as an AMD platform, otherwise the default hardware platform type is an Intel platform. The hardware platform type is returned as a string (such as "amd" or "intel") and a log is recorded. An example is as follows:

[0244] def detect_platform():

[0245] # Read processor-related information using the dmidecode -t4 command

[0246] result = subprocess.run(["dmidecode", "-t4"], capture_output=True, text=True)

[0247] # Check if the output contains the "AMD" keyword

[0248] # If it contains, return "amd"; otherwise, return "intel"

[0249] return "amd" if "AMD" in result.stdout else "intel"

[0250] Step S104: Execute IPMI commands in the predefined IPMI command list to disable write protection.

[0251] In particular, disabling write protection (Disable Write Protection) is to cancel the write restriction of a storage device or file, so that it can be modified or written data. Write protection is a security mechanism to prevent data from being accidentally modified or damaged. After disabling write protection, users can perform write operations on storage devices or files.

[0252] In some embodiments, executing IPMI commands in the predefined IPMI command list to disable write protection includes:

[0253] Iterate through the predefined IPMI command list, and execute IPMI commands in the predefined IPMI command list to disable write protection through an eighth command, the eighth command being used to execute external commands;

[0254] Return the command execution status code and check the command execution status code;

[0255] If the command execution status code indicates that the IPMI command execution fails, record an error log and abort the write protection disabling process.

[0256] In some embodiments, the IPMI commands in the predefined IPMI command list are executed to disable the write protection, including:

[0257] The IPMI commands in the predefined IPMI command list are executed by subprocess.run (i.e., the eighth command mentioned above) to disable the write protection by traversing the predefined IPMI command list;

[0258] The command execution status code is returned, and the command execution status code is checked;

[0259] If the command execution status code indicates that the IPMI command execution fails, an error log is recorded and the write protection disabling process is aborted.

[0260] Specifically, subprocess.run is a function in the subprocess module of Python, which is used to execute external commands.

[0261] In another possible implementation, the hardware platform type is identified, and the parameters of the IPMI commands in the predefined IPMI command list are uniformly called to match the IPMI commands of the corresponding hardware platform type, and the IPMI commands in the predefined IPMI command list are executed to disable the write protection.

[0262] In specific embodiments, according to the predefined IPMI command list, a series of IPMI raw commands (ipmitool raw) are sent to disable the write protection. The predefined IPMI command list includes multiple steps, each responsible for different write protection configuration operations. The specific parameters of the IPMI commands are related to the hardware platform, but a uniform logic is used in the code, and there is no need to manually distinguish the platform. Each command is executed by subprocess.run, and the return code is checked. If a command fails to execute (non-zero return value), an error log is recorded (for example: "Failed to execute command: ipmitool raw 0x12 0x07 0x42 0"), and the write protection disabling process is immediately aborted. If all commands are successfully executed, the next step is continued. An example is as follows:

[0263] def disable_write_protection():

[0264] # Call the detect_platform function to detect the hardware platform type

[0265] platform = detect_platform()

[0266] log_info(f"Detected platform: {platform.upper()}") # Log the detected platform type

[0267] # Predefined list of IPMI commands to disable write protection

[0268] commands = [

[0269] "ipmitool raw 0x12 0x07 0x42 0",

[0270] "ipmitool raw 0x6 0x40 0x66 0x70 0 0x45",

[0271] "ipmitool raw 0x6 0x40 0x66 0xa8 0 0x41", ]

[0273] # Iterate through the command list and execute each command one by one

[0274] for cmd in commands:

[0275] result = subprocess.run(cmd, shell=True) # Execute the IPMI command

[0276] if result.returncode!= 0: # Check the command execution status code

[0277] log_error(f"Failed to execute command: {cmd}") # Log an error if the command fails

[0278] return # Abort the process

[0279] # If all commands are successfully executed, log that write protection has been disabled

[0280] log_info(f"{platform.upper()} platform write protection has been disabled.")

[0281] In a specific embodiment, logs are recorded at key steps for debugging and verification. The detected hardware platform is logged (e.g., "Detected platform: INTEL"). If a command to disable write protection fails, the specific failed command and its context information are logged. Upon successful execution, the status of write protection being disabled is logged (e.g., "INTEL platform write protection has been disabled." or "AMD platform write protection has been disabled."). An example is as follows:

[0282] log_info(f"Detected platform: {platform.upper()}")

[0283] log_error(f"Failed to execute command: {cmd}")

[0284] log_info(f"Write protection on {platform.upper()} platform has been disabled.")

[0285] Specifically, identify the hardware platform type, select the corresponding predefined IPMI command list based on the hardware platform type, and execute the IPMI commands in the predefined IPMI command list to disable write protection, for example:

[0286] def detect_platform():

[0287] result = subprocess.run(["dmidecode", "-t4"], capture_output=True, text=True)

[0288] return "amd" if "AMD" in result.stdout else "intel"

[0289] def disable_write_protection():

[0290] platform = detect_platform()

[0291] log_info(f"Detected platform: {platform.upper()}")

[0292] commands = [

[0293] "ipmitool raw 0x12 0x07 0x42 0",

[0294] "ipmitool raw 0x6 0x40 0x66 0x70 0 0x45",

[0295] "ipmitool raw 0x6 0x40 0x66 0xa8 0 0x41", ]

[0297] for cmd in commands:

[0298] result = subprocess.run(cmd, shell=True)

[0299] if result.returncode != 0:

[0300] log_error(f"Command execution failed: {cmd}")

[0301] log_info(f"{platform.upper()} Platform write protection is disabled.")

[0302] The `detect_platform` function determines whether the hardware platform is AMD or x86 based on the installed hardware. Since AMD CPUs are manufactured by AMD, while x86 CPUs are typically manufactured by Intel, this method allows for accurate identification.

[0303] It should be understood that disabling write protection provides the necessary environment preparation for subsequent firmware update operations. At the same time, platform detection, command execution, and error handling mechanisms are integrated to ensure the entire process is automated and highly reliable.

[0304] Step S105: Obtain the target version of the firmware component, compare the target version of the firmware component with the current version of the firmware component, determine the firmware component to be updated, and add the firmware component to be updated to the update list.

[0305] It's important to note that initializing the GPU firmware update runtime environment prepares the necessary conditions for subsequent operations, including loading configurations and checking dependencies. Ensure all necessary tools (such as ipmitool and dmidecode) are ready and that the required configuration files are loaded. Firmware components include pex_retimer, vbios, and nvswitch. Use the get_current_version command or API to obtain the current version of these firmware components.

[0306] In some embodiments, the target version of the firmware component is obtained, the target version of the firmware component is compared with the current version of the firmware component, the firmware component to be updated is determined, and the firmware component to be updated is added to the update list, including:

[0307] Iterate through each firmware component in the list of components (i.e., the aforementioned list of components), read the target version of the firmware component from the configuration file, and compare the target version of the firmware component with the current version of the firmware component stored in the second global variable firmware_info.

[0308] If the current version of the firmware component is lower than the target version of the firmware component, the firmware component to be updated is determined, the firmware component to be updated is added to the to-be-updated list, and the target version of the firmware component to be updated and the current version of the firmware component to be updated are recorded to the to-be-updated list.

[0309] Specifically, a configuration file is a file used to store application or system settings. The main role of the configuration file is to allow users or developers to dynamically adjust the behavior and settings of the application without modifying the code.

[0310] Specifically, if the current version of the firmware component is lower than the target version of the firmware component, the firmware component to be updated is determined, the firmware component to be updated is added to the to-be-updated list components_to_update, and the target version of the firmware component to be updated and the current version of the firmware component to be updated are recorded to the to-be-updated list (for example: "pex_retimer needs to be updated: current version 1.0.0, target version 1.1.0").

[0311] Obtain the target version of the firmware component, compare the target version of the firmware component with the current version of the firmware component, determine the firmware component to be updated, add the firmware component to be updated to the to-be-updated list, and the example is as follows:

[0312] components = {

[0313] "pex_retimer": "gpu_retimer_version",

[0314] "vbios": "gpu_vbios_version",

[0315] "nvswitch": "gpu_nvswitch_version",

[0316] }

[0317] components_to_update = []

[0318] for component, key in components.items():

[0319] expected = config.get(f"def_{key.split('_')[1]}_ver")

[0320] current = firmware_info.get(key)

[0321] if current != expected:

[0322] components_to_update.append(component)

[0323] log_info(f"{component} needs updating: current version{current}, target version{expected}")

[0324] It should be understood that adding firmware components to be updated to the update list allows updates to be performed only on the firmware components that need them, avoiding unnecessary processing.

[0325] Step S106: Perform firmware component update operation on the list of items to be updated.

[0326] In some embodiments, performing an update firmware component operation on the list to be updated includes:

[0327] Check if the list to be updated is empty;

[0328] If the list of items to be updated is empty, there is no need to perform firmware component update operations on the list of items to be updated and to log the changes.

[0329] If the list of items to be updated is not empty, then perform the firmware component update operation on the list of items to be updated and record the log.

[0330] During the update of the firmware components to be updated, use try-except (i.e., the sixth command mentioned above) to catch exceptions and log errors, and terminate the update process. The sixth command is used to catch and handle errors that occur during program execution.

[0331] Specifically, check if the `components_to_update` list is empty. If it is, it means all firmware components are the latest version and do not need updating; log "All firmware components are the latest and do not need updating.". If the list is not empty, record the list of firmware components that need updating (e.g., "Start updating firmware components: ['pex_retimer', 'vbios']"), and proceed to the next step of the update process. Example follows:

[0332] if components_to_update:

[0333] log_info(f"Start updating components: {components_to_update}")

[0334] else:

[0335] log_info("All components are up to date, no update needed.")

[0336] In some embodiments, after performing the update firmware component operation on the list of components to be updated, the GPU firmware management method further comprises:

[0337] After the firmware component to be updated is updated, a current version of the firmware component to be updated is regenerated using a ninth command, a target version of the firmware component to be updated is dynamically read using a tenth command, the current version of the firmware component to be updated is compared with the target version of the firmware component to be updated, if the versions match, a success log is recorded, otherwise a failure log is recorded and manual intervention is prompted, the ninth command is used to traverse firmware components and obtain version information of the firmware components, and the tenth command is used to obtain specific configuration values from a configuration file;

[0338] write protection is restored through an IPMI tool;

[0339] A cleanup function for cleaning up resources is called to clean up temporary resources generated in the updating process, so as to release disk space.

[0340] In some embodiments, after performing the update firmware component operation on the list of components to be updated, the GPU firmware management method further comprises:

[0341] After the firmware component to be updated is updated, a current version of the firmware component to be updated is regenerated using generate_firmware_info (i.e., the ninth command described above), a target version of the firmware component to be updated is dynamically read using config.get (i.e., the tenth command described above), the current version of the firmware component to be updated is compared with the target version of the firmware component to be updated, if the versions match, a success log is recorded, otherwise a failure log is recorded and manual intervention is prompted, the ninth command is used to traverse firmware components and obtain version information of the firmware components, and the tenth command is used to obtain specific configuration values from a configuration file;

[0342] write protection is restored through an IPMI tool;

[0343] A cleanup function for cleaning up resources is called to clean up temporary resources generated in the updating process, so as to release disk space.

[0344] Specifically, the generate_firmware_info function is responsible for generating firmware information, which typically iterates through a set of firmware components, calling the get_current_version function to obtain version information for each firmware component. config.get is a method from the configparser module in Python used to retrieve specific configuration values from a configuration file. ipmitool is a command-line tool for managing hardware via the IPMI (Intelligent Platform Management Interface) protocol. The cleanup function is used to clean up resources or perform cleanup operations.

[0345] Specifically, to ensure that the state during the firmware component update process is correctly recorded, it can be output through a logging system or through a JSON-formatted state machine for subsequent verification and auditing. During the firmware component update process, for each firmware component that needs to be updated, an attempt is made to perform the update operation, and any exceptions that may occur are captured. Upon success, information about the completion of the update is recorded, and upon failure, error details are recorded and further update attempts are immediately stopped. After the update is complete, verify_updates is called to verify the update results, ensuring that all changes have been correctly applied, and finally, cleanup is called to clean up temporary resources or files. An example is as follows:

[0346] for component in components_to_update:

[0347] try:

[0348] update_component(component)

[0349] except Exception as e:

[0350] log_error(str(e))

[0351] break

[0352] verify_updates()

[0353] cleanup()

[0354] In particular, when any problem is encountered during the firmware component update process, an exception can be captured in time to prevent potential problems from spreading and ensure system security. During the update of each firmware component, a try-except structure is used to capture possible exceptions. If an exception occurs, detailed error logs are recorded (e.g., "update pex_retimer failed: error information xxx"), and the update process is immediately terminated to avoid affecting other firmware components. An example is as follows:

[0355] try:

[0356] update_component(component)

[0357] except Exception as e:

[0358] log_error(str(e))

[0359] break

[0360] In particular, the GPU firmware update process code example is as follows:

[0361] def main_update_process():

[0362] initialize_environment()

[0363] generate_firmware_info()

[0364] disable_write_protection():

[0365] components = {

[0366] "pex_retimer": "gpu_retimer_version",

[0367] "vbios": "gpu_vbios_version",

[0368] "nvswitch": "gpu_nvswitch_version",

[0369] }

[0370] components_to_update = []

[0371] for component, key in components.items():

[0372] expected = config.get(f"def_{key.split('_')[1]}_ver")

[0373] current = firmware_info.get(key)

[0374] if current != expected:

[0375] components_to_update.append(component)

[0376] log_info(f"{component} needs updating: current version{current}, target version{expected}")

[0377] if components_to_update:

[0378] log_info(f"Start updating components: {components_to_update}")

[0379] for component in components_to_update:

[0380] try:

[0381] update_component(component)

[0382] except Exception as e:

[0383] log_error(str(e))

[0384] break

[0385] verify_updates()

[0386] cleanup()

[0387] else:

[0388] log_info("All components are up to date and require no updates.")

[0389] Specifically, after the firmware component to be updated is updated, `generate_firmware_info` is used to regenerate the current version of the firmware component to be updated. `config.get` is used to dynamically read the target version of the firmware component to be updated, avoiding hardcoding and making the logging clear and easy to understand, facilitating subsequent troubleshooting. The current version of the firmware component to be updated is compared with the target version. If the versions match, a success log is recorded; otherwise, a failure log is recorded and manual intervention is prompted. An example is shown below:

[0390] def verify_updates():

[0391] generate_firmware_info() # Regenerate the current firmware version information

[0392] for key, actual_version in firmware_info.items(): # Iterate through the version information of each component.

[0393] expected_version = config.get(f"def_{key.split('_')[1]}_ver") # Get the expected version

[0394] if actual_version == expected_version: # Compare the actual version with the expected version

[0395] log_info(f"{key} verified successfully: {actual_version}") # Log success message

[0396] else:

[0397] log_error(f"{key} verification failed: current {actual_version} ≠ expected {expected_version}") # Log the failure.

[0398] Specifically, restore the system's write protection to prevent security risks caused by write protection not being enabled. Clean up temporary files or cached data that may be generated during firmware component updates to free up disk space. Execute the command to restore write protection using ipmitool to ensure hardware-level security. Example follows:

[0399] def cleanup():

[0400] subprocess.run("ipmitool raw 0x31 0x76 0xdf 1", shell=True) # Restore write protection

[0401] log_info("Write protection restored. Cleanup complete.") # Record cleanup completion log.

[0402] Specifically, it verifies the firmware component update results, restores write protection, and cleans up temporary resources generated during the update process. An example is shown below:

[0403] def verify_updates():

[0404] generate_firmware_info()

[0405] for key, actual_version in firmware_info.items():

[0406] expected_version = config.get(f"def_{key.split('_')[1]}_ver")

[0407] if actual_version == expected_version:

[0408] log_info(f"{key} verified successfully: {actual_version}")

[0409] else:

[0410] log_error(f"{key} validation failed: current {actual_version} ≠ expected {expected_version}")

[0411] def cleanup():

[0412] subprocess.run("ipmitool raw 0x31 0x76 0xdf 1", shell=True)

[0413] log_info("Write protection restored. Cleanup complete.")

[0414] It can be understood that the write protection control technology is provided, the write protection disabling is immediately stopped when the write protection disabling fails, and an error is recorded, so that device damage caused by forced writing is avoided. The extensible firmware component interface is provided: the version acquisition logic of GPU Retimer, VBIOS, NVSwitch and other heterogeneous components is uniformly encapsulated through the get_current_version function, and new components only need to extend the get_current_version function.

[0415] It can be seen that through the script, the running environment of the GPU firmware update is initialized, the current version function is created, the current version of the firmware component is acquired through the current version function, the hardware platform type is identified, the corresponding predefined IPMI command list is selected according to the hardware platform type, the IPMI command in the predefined IPMI command list is executed to disable the write protection, the target version of the firmware component is acquired, the target version of the firmware component is compared with the current version of the firmware component, the firmware component to be updated is determined, the firmware component to be updated is added to the update list, and the update firmware component operation is performed on the update list. The GPU firmware management method is realized through the script, the possibility of error is reduced, the time of GPU firmware update is shortened, and the work efficiency is improved. According to the hardware platform type, the corresponding predefined IPMI command list is selected, manual code adjustment is not required, and the work efficiency is improved.

[0416] The embodiment of the application further provides an electronic device, which comprises a memory and a processor, the memory stores a computer program, and the processor implements the GPU firmware management method when executing the computer program. The electronic device can be any intelligent terminal including a computer.

[0417] The embodiment of the application further provides a storage medium, which stores a computer program, and the computer program is executed by a processor to implement the GPU firmware management method.

[0418] It should be appreciated that the method steps in the embodiment of the application can be realized or implemented by computer hardware, a combination of hardware and software, or through computer instructions stored in a non-transitory computer readable storage. The method can use standard programming techniques. Each program can be implemented in a high-level procedural or object-oriented programming language to communicate with a computer system. However, if necessary, the program can be implemented in assembly or machine language. In any case, the language can be a compiled or interpreted language. In addition, the program can run on a programmed special integrated circuit for this purpose.

[0419] Further, operations of the processes described herein can be performed in any suitable order unless otherwise indicated herein or otherwise clearly contradicted by context. The processes described herein (or variations and / or combinations thereof) can be implemented under the control of one or more computer systems configured with executable instructions (e.g., computer programs, one or more computer programs, or one or more applications), by hardware, or combinations thereof, configured to perform the instructions. The computer programs include machine- readable instructions that can be executed by one or more processors.

[0420] Further, the methods can be implemented in any suitable type of computing platform operatively connected to, including but not limited to, a personal computer, mini-computer, mainframe, workstation, networked or distributed computing environment, separate or integrated computer platforms, or in communication with charged particle tools or other imaging devices, and the like. Aspects of the present application can be implemented in machine-readable code stored on a non-transitory storage medium or device, whether removable or integrated into a computing platform, such as a hard disk, optical read and / or write storage media, RAM, ROM, and the like, such that it can be read by a programmable computer to configure and operate the computer to perform the processes described herein when the storage medium or device is read by the computer. Further, the machine-readable code, or portions thereof, can be transmitted over wired or wireless networks. The present application described herein includes these and other different types of non-transitory computer-readable storage media when such media include instructions or programs that implement the steps described above in conjunction with a microprocessor or other data processor. The present application can also include the computer itself when programmed in accordance with the methods and techniques described herein.

[0421] The computer programs can be applied to input data to perform the functions described herein to transform the input data to generate output data that is stored to non-volatile memory. The output information can also be applied to one or more output devices, such as a display. In preferred embodiments of the present application, the transformed data represents a physical and tangible object, including a particular visual depiction of a physical and tangible object produced on a display.

[0422] The above description is only preferred embodiments of the present application, and the present application is not limited to the above-described embodiments, but any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application, as long as the same means achieve the technical effects of the present application, should be included in the scope of protection of the present application. The technical solutions and / or embodiments of the present application can have various modifications and changes within the scope of protection.

Claims

1. A GPU firmware management method, characterized by, Comprising: initializing a running environment for GPU firmware update through a script; creating a function for obtaining a current version, through which a current version of a firmware component is obtained; identifying a hardware platform type, and selecting a corresponding predefined IPMI command list according to the hardware platform type; executing an IPMI command in the predefined IPMI command list to disable write protection; obtaining a target version of the firmware component, comparing the target version of the firmware component with the current version of the firmware component to determine a firmware component to be updated, and adding the firmware component to be updated to a to-be-updated list; performing an update firmware component operation on the to-be-updated list; initializing a running environment for GPU firmware update, comprising: calling a first command for creating a multi-level directory to create a GPU firmware directory; recording a creation state of the GPU firmware directory through log_info; using a second command to traverse files under the GPU firmware directory, filtering out configuration files and script files for Unix systems, calling an external tool dos2unix to convert the configuration files and the script files for Unix systems from Windows format to Unix format, the second command being used to list file and subdirectory names in a specified directory; setting executable permissions for the script files for Unix systems through a third command, the third command being used to change permissions of a file or a directory; recording a permission setting state through the log_info; opening the configuration files using a fourth command, reading key-value pairs of the configuration files line by line and parsing the key-value pairs, and storing configuration information of the key-value pairs into a first global variable, the fourth command being used to open a file and read the file; creating a function for obtaining a current version, comprising: obtaining the current version of the firmware component, and formatting it into a get-component-version command, wherein a firmware component is specified through a component parameter in the get-component-version command; executing the get-component-version command using a fifth command to obtain the current version of the firmware component, the fifth command being used to execute an external command and capture a standard output thereof; if the current version of the firmware component fails to be extracted, using a sixth command to capture an exception and record an error log, and returning a special value indicating that the current version of the firmware component is unknown, to create the function for obtaining a current version, the sixth command being used to capture and handle errors occurring in a program running process.

2. The GPU firmware management method of claim 1, wherein, identifying a hardware platform type, comprising: reading processor information using a seventh command, the seventh command being used to display the processor information; determining the hardware platform type by matching a hardware platform type keyword in the processor information; returning the hardware platform type in a string form, and recording a log.

3. The method of claim 1, wherein, executing an IPMI command in the predefined IPMI command list to disable write protection, comprising: traversing the predefined IPMI command list, executing the IPMI command in the predefined IPMI command list by an eighth command for executing an external command to disable the write protection; returning a command execution status code, checking the command execution status code; if the command execution status code indicates that the IPMI command fails to execute, recording an error log and aborting the write protection disabling process.

4. The GPU firmware management method of claim 1, wherein, obtaining a current version of a firmware component through the current version obtaining function, comprising: traversing each firmware component in the component list, and calling the current version obtaining function to obtain the current version of the firmware component; storing the current version of the firmware component into a second global variable.

5. The method of claim 4, wherein, obtaining a target version of a firmware component, comparing the target version of the firmware component with the current version of the firmware component to determine a firmware component to be updated, and adding the firmware component to be updated to an update list, comprising: traversing each firmware component in the component list, reading the target version of the firmware component from a configuration file, and comparing the target version of the firmware component with the current version of the firmware component stored in the second global variable; if the current version of the firmware component is lower than the target version of the firmware component, determining the firmware component to be updated, adding the firmware component to be updated to the update list, and recording the target version of the firmware component to be updated and the current version of the firmware component to be updated in the update list.

6. The method of claim 1, wherein, performing an update firmware component operation on the update list, comprising: checking whether the update list is empty; if the update list is empty, not performing the update firmware component operation on the update list, and recording a log; if the update list is not empty, performing the update firmware component operation on the update list, and recording a log; in the process of updating the firmware component to be updated, using a sixth command to capture an exception and record an error log, and terminating the update process, the sixth command being used to capture and handle errors occurring during program execution.

7. The method of claim 1, wherein, after performing the update firmware component operation on the update list, the GPU firmware management method further comprises: after the firmware component to be updated is updated, using a ninth command to regenerate the current version of the firmware component to be updated, using a tenth command to dynamically read the target version of the firmware component to be updated, comparing the current version of the firmware component to be updated with the target version of the firmware component to be updated, if the versions match, recording a success log, otherwise recording a failure log and prompting manual intervention, the ninth command being used to traverse firmware components and obtain version information of the firmware components, and the tenth command being used to obtain specific configuration values from a configuration file; restoring the write protection through an IPMI tool; calling a cleaning function for cleaning resources to release disk space.

8. A storage medium storing a computer program, characterized by The computer program is executed by a processor to implement the GPU firmware management method in any one of claims 1 to 7. The computer program is executed by a processor to implement the GPU firmware management method in any one of claims 1 to 7.

Citation Information

Patent Citations

  • BIOS writing protection method, apparatus, device and storage medium

    CN109117640A

  • Special computer hard disk firmware upgrading method and device, equipment and medium

    CN115421760A

  • Configuration processing method and device of hyper-converged system, storage medium and electronic equipment

    CN120560708A