Movatterモバイル変換


[0]ホーム

URL:


CN116679968A - Firmware upgrading method, system and device of storage device and storage medium - Google Patents

Firmware upgrading method, system and device of storage device and storage medium
Download PDF

Info

Publication number
CN116679968A
CN116679968ACN202310530269.XACN202310530269ACN116679968ACN 116679968 ACN116679968 ACN 116679968ACN 202310530269 ACN202310530269 ACN 202310530269ACN 116679968 ACN116679968 ACN 116679968A
Authority
CN
China
Prior art keywords
upgrade
firmware
firmware upgrade
package
directory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310530269.XA
Other languages
Chinese (zh)
Inventor
王玉萍
刘迎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co LtdfiledCriticalSuzhou Inspur Intelligent Technology Co Ltd
Priority to CN202310530269.XApriorityCriticalpatent/CN116679968A/en
Publication of CN116679968ApublicationCriticalpatent/CN116679968A/en
Pendinglegal-statusCriticalCurrent

Links

Classifications

Landscapes

Abstract

The invention provides a firmware upgrading method, a system, a device and a storage medium of storage equipment, wherein the method comprises the following steps: acquiring the name of a firmware upgrade package and equipment information to be upgraded, and extracting an upgrade keyword from the name of the firmware upgrade package; logging in the equipment to be upgraded, and starting a subprocess for automatically executing the file transmission downloading function; cleaning files in a storage catalog of a firmware upgrading packet, and downloading the firmware upgrading packet into the storage catalog by running a subprocess; judging whether the firmware upgrade package is downloaded successfully; if the firmware upgrade package is successfully downloaded, creating a firmware upgrade catalog, and moving the firmware upgrade package into the firmware upgrade catalog; acquiring an upgrade command, and executing an upgrade process by using a firmware upgrade package; and after the upgrading process is finished, judging an upgrading result by reading the upgrading process data. The invention realizes that the firmware upgrade package is automatically downloaded and uploaded without user interaction, and the upgrade instruction is automatically executed to detect the upgrade result.

Description

Translated fromChinese
一种存储设备的固件升级方法、系统、装置及存储介质Firmware upgrade method, system, device and storage medium of a storage device

技术领域technical field

本发明涉及计算机技术领域,更具体的说是涉及一种存储设备的固件升级方法、系统、装置及存储介质。The present invention relates to the technical field of computers, and more specifically relates to a firmware upgrade method, system, device and storage medium of a storage device.

背景技术Background technique

存储设备包括硬件物理设备和上层应用管理软件,在这两者之间,还必须有一些管理软件,即嵌入在硬件中的软件,这类软件就是我们所说的固件(firmware),固件用来管理或驱动某些特定硬件的软件,如BMC,CPLD,BBU,BIOS等。在项目前期的一些单元测试中,除了对硬件的测试外,经常需要对固件进行升降级的工作;甚至在项目成熟后,为兼容一些硬件的变化,或修改一些应用中的版本缺陷,也需要对固件进行升级。Storage devices include hardware physical devices and upper-layer application management software. Between the two, there must be some management software, that is, software embedded in the hardware. This type of software is what we call firmware. Firmware is used to Software that manages or drives some specific hardware, such as BMC, CPLD, BBU, BIOS, etc. In some unit tests in the early stage of the project, in addition to testing the hardware, it is often necessary to upgrade and downgrade the firmware; Upgrade the firmware.

通常,固件升级的流程包括:首先获取固件升级包和升级工具;然后将升级包放在要升级的存储控制器的固定目录下;此时,选择对应的升级包执行相应的升级命令;升级完成后,检测固件版本是否正确。Usually, the firmware upgrade process includes: first obtain the firmware upgrade package and upgrade tool; then place the upgrade package in the fixed directory of the storage controller to be upgraded; at this time, select the corresponding upgrade package and execute the corresponding upgrade command; the upgrade is completed After that, check whether the firmware version is correct.

相关技术中,采用ftp命令进行固件升级包的自动下载,甚至在ftp命令中增加prompt参数来取消用户交互,以提高固件升级降级测试的效率。但是,某些存储设备由于安全考虑,禁用了ftp命令,只保留了更为安全的sftp命令,而sftp本身就是一个交互式的命令,在固件升级包的下载和固件升级过程中,需要手动操作,不但占用了大量的人力和时间,还会影响测试效率。In related technologies, the ftp command is used to automatically download the firmware upgrade package, and even the prompt parameter is added to the ftp command to cancel user interaction, so as to improve the efficiency of the firmware upgrade and downgrade test. However, due to security considerations, some storage devices disable the ftp command, and only retain the more secure sftp command, and sftp itself is an interactive command, and manual operations are required during the download and firmware upgrade process of the firmware upgrade package , not only takes up a lot of manpower and time, but also affects the test efficiency.

发明内容Contents of the invention

针对以上问题,本发明的目的在于提供一种存储设备的固件升级方法、系统、装置及存储介质,实现了在无需用户交互的情况下,自动下载上传固件升级包,并自动执行升级指令,检测升级结果。In view of the above problems, the purpose of the present invention is to provide a firmware upgrade method, system, device and storage medium of a storage device, which can automatically download and upload firmware upgrade packages without user interaction, and automatically execute upgrade instructions, detect Upgrade results.

本发明为实现上述目的,通过以下技术方案实现:In order to achieve the above object, the present invention is achieved through the following technical solutions:

第一方面,本发明公开了一种存储设备的固件升级方法,包括:In a first aspect, the present invention discloses a method for upgrading firmware of a storage device, including:

获取固件升级包的名称和待升级的设备信息,并从固件升级包的名称中提取升级关键字;Obtain the name of the firmware upgrade package and the device information to be upgraded, and extract the upgrade keyword from the name of the firmware upgrade package;

登录待升级的设备,并在其主进程中开启一个自动执行sftp下载功能的子进程;Log in to the device to be upgraded, and start a sub-process that automatically executes the sftp download function in its main process;

根据升级关键字清理固件升级包的存储目录中的文件,通过运行子进程将固件升级包下载到所述存储目录中;Clean up the files in the storage directory of the firmware upgrade package according to the upgrade keyword, and download the firmware upgrade package to the storage directory by running a subprocess;

判断固件升级包是否下载成功;Determine whether the firmware upgrade package is downloaded successfully;

如果固件升级包下载成功,创建固件升级目录,并将固件升级包移动到固件升级目录中;If the firmware upgrade package is downloaded successfully, create a firmware upgrade directory and move the firmware upgrade package to the firmware upgrade directory;

获取升级命令,并利用固件升级包执行升级进程;Obtain the upgrade command, and use the firmware upgrade package to execute the upgrade process;

升级进程结束后,通过读取升级进程数据判断升级结果。After the upgrade process ends, the upgrade result is judged by reading the upgrade process data.

进一步,所述获取固件升级包的名称和待升级的设备信息,并从固件升级包的名称中提取升级关键字,包括:Further, said obtaining the name of the firmware upgrade package and the device information to be upgraded, and extracting the upgrade keyword from the name of the firmware upgrade package, including:

获取固件升级包的名称、以及待升级设备的IP地址、端口号、登录用户名和密码;Obtain the name of the firmware upgrade package, as well as the IP address, port number, login user name and password of the device to be upgraded;

从固件升级包的名称中提取升级关键字,并将升级关键字写入pkg变量中。Extract the upgrade keyword from the name of the firmware upgrade package, and write the upgrade keyword into the pkg variable.

进一步,所述登录待升级的设备,并在其主进程中开启一个自动执行sftp下载功能的子进程,包括:Further, the log in the device to be upgraded, and start a sub-process that automatically executes the sftp download function in its main process, including:

利用待升级设备的IP地址、端口号、登录用户名和密码登录待升级的设备;在主进程中开启subprocess子进程;Use the IP address, port number, login user name and password of the device to be upgraded to log in to the device to be upgraded; start the subprocess in the main process;

当subprocess子进程运行时,自动执行与sftp进程的send-expect交互命令,并利用sftp进程进行文件的下载。When the subprocess subprocess is running, it automatically executes the send-expect interactive command with the sftp process, and uses the sftp process to download files.

进一步,所述根据升级关键字清理固件升级包的存储目录中的文件,通过运行子进程将固件升级包下载到所述存储目录中,包括:Further, said cleaning up the files in the storage directory of the firmware upgrade package according to the upgrade keyword, and downloading the firmware upgrade package to the storage directory by running a sub-process, including:

读取pkg变量中记录的升级关键字;Read the upgrade keyword recorded in the pkg variable;

删除/tmp目录下所有含有升级关键字的文件;Delete all files containing upgrade keywords in the /tmp directory;

将pkg变量和固件升级包的存放信息注入subprocess子进程中,通过运行subprocess子进程将固件升级包下载到/tmp目录下。Inject the pkg variable and the storage information of the firmware upgrade package into the subprocess, and download the firmware upgrade package to the /tmp directory by running the subprocess.

进一步,所述判断固件升级包是否下载成功,包括:Further, said judging whether the firmware upgrade package is successfully downloaded includes:

当主进程中接收到sftp_download.sh文件后,获取返回的关键字;After receiving the sftp_download.sh file in the main process, get the returned keywords;

如果返回的关键字为bye,则下载成功;否则下载失败,并进行报错。If the returned keyword is bye, the download is successful; otherwise, the download fails and an error is reported.

进一步,所述创建固件升级目录,并将固件升级包移动到固件升级目录中,包括:Further, the creation of a firmware upgrade directory, and move the firmware upgrade package to the firmware upgrade directory, including:

读取pkg变量,识别出固件关键字中包含的固件类型;Read the pkg variable to identify the firmware type contained in the firmware keyword;

根据固件类型创建相应的固件升级目录;Create the corresponding firmware upgrade directory according to the firmware type;

使用mv命令将固件升级包从/tmp目录中移动到固件升级目录中,并根据固件类型对固件升级包进行重命名。Use the mv command to move the firmware upgrade package from the /tmp directory to the firmware upgrade directory, and rename the firmware upgrade package according to the firmware type.

进一步,所述通过读取升级进程数据判断升级结果,包括:Further, the judging the upgrade result by reading the upgrade process data includes:

读取升级进程的输出信息和错误信息;Read the output and error messages of the upgrade process;

如果所述输出信息中的记录固件版本符合升级要求,且错误信息中未记录升级错误,则升级成功;否则,升级失败。If the recorded firmware version in the output information meets the upgrade requirements, and no upgrade error is recorded in the error information, the upgrade is successful; otherwise, the upgrade fails.

第二方面,本发明还公开了一种存储设备的固件升级系统,包括:In the second aspect, the present invention also discloses a storage device firmware upgrade system, including:

信息获取模块,用于获取固件升级包的名称和待升级的设备信息,并从固件升级包的名称中提取升级关键字;The information acquisition module is used to obtain the name of the firmware upgrade package and the device information to be upgraded, and extract the upgrade keyword from the name of the firmware upgrade package;

功能配置模块,用于登录待升级的设备,并在其主进程中开启一个自动执行sftp下载功能的子进程;The function configuration module is used to log in the device to be upgraded, and start a sub-process that automatically executes the sftp download function in its main process;

下载模块,用于根据升级关键字清理固件升级包的存储目录中的文件,通过运行子进程将固件升级包下载到所述存储目录中;The download module is used to clean up the files in the storage directory of the firmware upgrade package according to the upgrade keyword, and download the firmware upgrade package to the storage directory by running a sub-process;

判断模块,用于判断固件升级包是否下载成功;A judging module, configured to judge whether the firmware upgrade package is downloaded successfully;

升级准备模块,用于当固件升级包下载成功后,创建固件升级目录,并将固件升级包移动到固件升级目录中;The upgrade preparation module is used to create a firmware upgrade directory when the firmware upgrade package is downloaded successfully, and move the firmware upgrade package to the firmware upgrade directory;

升级模块,用于获取升级命令,并利用固件升级包执行升级进程;An upgrade module, configured to obtain an upgrade command, and execute an upgrade process using a firmware upgrade package;

验证模块,用于升级进程结束后,通过读取升级进程数据判断升级结果。The verification module is used for judging the upgrade result by reading the upgrade process data after the upgrade process ends.

进一步,所述信息获取模块具体用于:获取固件升级包的名称、以及待升级设备的IP地址、端口号、登录用户名和密码;从固件升级包的名称中提取升级关键字,并将升级关键字写入pkg变量中。Further, the information acquisition module is specifically used to: obtain the name of the firmware upgrade package, and the IP address, port number, login user name and password of the device to be upgraded; extract the upgrade keyword from the name of the firmware upgrade package, and convert the upgrade key The word is written to the pkg variable.

进一步,所述功能配置模块具体用于:利用待升级设备的IP地址、端口号、登录用户名和密码登录待升级的设备;在主进程中开启subprocess子进程;当subprocess子进程运行时,自动执行与sftp进程的send-expect交互命令,并利用sftp进程进行文件的下载。Further, the function configuration module is specifically used to: use the IP address, port number, login user name and password of the device to be upgraded to log in to the device to be upgraded; open the subprocess subprocess in the main process; when the subprocess subprocess is running, automatically execute Interact with the send-expect command of the sftp process, and use the sftp process to download files.

进一步,所述下载模块具体用于:读取pkg变量中记录的升级关键字;删除/tmp目录下所有含有升级关键字的文件;将pkg变量和固件升级包的存放信息注入subprocess子进程中,通过运行subprocess子进程将固件升级包下载到/tmp目录下。Further, the download module is specifically used to: read the upgrade keyword recorded in the pkg variable; delete all files containing the upgrade keyword under the /tmp directory; inject the storage information of the pkg variable and the firmware upgrade package into the subprocess, Download the firmware upgrade package to the /tmp directory by running the subprocess.

进一步,所述判断模块具体用于:当主进程中接收到sftp_download.sh文件后,获取返回的关键字;如果返回的关键字为bye,则下载成功;否则下载失败,并进行报错。Further, the judging module is specifically used to: obtain the returned keyword after receiving the sftp_download.sh file in the main process; if the returned keyword is bye, the download is successful; otherwise, the download fails and an error is reported.

进一步,所述升级准备模块具体用于:读取pkg变量,识别出固件关键字中包含的固件类型;根据固件类型创建相应的固件升级目录;使用mv命令将固件升级包从/tmp目录中移动到固件升级目录中,并根据固件类型对固件升级包进行重命名。Further, the upgrade preparation module is specifically used to: read the pkg variable to identify the firmware type contained in the firmware keyword; create a corresponding firmware upgrade directory according to the firmware type; use the mv command to move the firmware upgrade package from the /tmp directory to Firmware upgrade directory, and rename the firmware upgrade package according to the firmware type.

进一步,所述验证模块具体用于:读取升级进程的输出信息和错误信息;如果所述输出信息中的记录固件版本符合升级要求,且错误信息中未记录升级错误,则升级成功;否则,升级失败。Further, the verification module is specifically used to: read the output information and error information of the upgrade process; if the recorded firmware version in the output information meets the upgrade requirements, and no upgrade error is recorded in the error information, the upgrade is successful; otherwise, Upgrade failed.

第三方面,本发明还公开了一种存储设备的固件升级装置,包括:In the third aspect, the present invention also discloses a device for upgrading firmware of a storage device, including:

存储器,用于存储存储设备的固件升级程序;The memory is used to store the firmware upgrade program of the storage device;

处理器,用于执行所述存储设备的固件升级程序时实现如上文任一项所述存储设备的固件升级方法的步骤。The processor is configured to implement the steps of the method for upgrading the firmware of the storage device as described in any one of the above when executing the firmware upgrade program of the storage device.

第四方面,本发明还公开了一种可读存储介质,所述可读存储介质上存储有存储设备的固件升级程序,所述存储设备的固件升级程序被处理器执行时实现如上文任一项所述存储设备的固件升级方法的步骤。In the fourth aspect, the present invention also discloses a readable storage medium, on which a firmware upgrade program of a storage device is stored, and when the firmware upgrade program of the storage device is executed by a processor, any one of the above The steps of the method for upgrading the firmware of the storage device described in the item.

对比现有技术,本发明有益效果在于:本发明公开了一种存储设备的固件升级方法、系统、装置及存储介质,实现了在禁用ftp命令的存储设备上根据用户提供的关键字,在无需用户交互与手动登录存储设备的情况下,自动下载上传升级包,并自动执行升级指令,检测升级结果。本发明通过在python主程序中开启子进程,向子进程中传递参数,并在子进程中通过linux的命令send-expect自动实现sftp的交互下载;在固件升级比较频繁,存储设备繁多的情况下,简化了人为操作流程,提升了测试效率。Compared with the prior art, the beneficial effect of the present invention lies in that: the present invention discloses a firmware upgrade method, system, device and storage medium of a storage device, which realizes the keyword provided by the user on the storage device where the ftp command is disabled, without the need for In the case of user interaction and manual login to the storage device, the upgrade package is automatically downloaded and uploaded, and the upgrade command is automatically executed to detect the upgrade result. The present invention starts the sub-process in the python main program, transfers parameters to the sub-process, and automatically realizes the interactive download of sftp through the command send-expect of linux in the sub-process; in the case of frequent firmware upgrades and numerous storage devices , Simplify the manual operation process and improve the test efficiency.

本发明实现了自动进行升级的预处理、升级的进行及升级完成后的检查,所有过程不需要人为干预;只需要在自动化执行机上按照设备类型封装好远程执行命令,避免了每次升级都人为操作的繁琐。The present invention realizes automatic upgrading preprocessing, upgrading and inspection after upgrading, and all processes do not require human intervention; only the remote execution command needs to be packaged on the automatic execution machine according to the type of equipment, avoiding the need for human-made upgrades every time The operation is cumbersome.

由此可见,本发明与现有技术相比,具有突出的实质性特点和显著的进步,其实施的有益效果也是显而易见的。It can be seen that, compared with the prior art, the present invention has outstanding substantive features and remarkable progress, and the beneficial effects of its implementation are also obvious.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only It is an embodiment of the present invention, and those skilled in the art can also obtain other drawings according to the provided drawings without creative work.

图1是本发明具体实施方式的方法流程图。Fig. 1 is a flow chart of a method of a specific embodiment of the present invention.

图2是本发明具体实施方式的固件升级包下载的准备和执行过程流程图。Fig. 2 is a flow chart of the preparation and execution process for downloading the firmware upgrade package according to the specific embodiment of the present invention.

图3是本发明具体实施方式的固件升级准备过程流程图。Fig. 3 is a flow chart of the firmware upgrade preparation process in the specific embodiment of the present invention.

图4是本发明具体实施方式的系统结构图。Fig. 4 is a system structure diagram of a specific embodiment of the present invention.

图中,1、信息获取模块;2、功能配置模块;3、下载模块;4、判断模块;5、升级准备模块;6、升级模块;7、验证模块。In the figure, 1. information acquisition module; 2. function configuration module; 3. download module; 4. judgment module; 5. upgrade preparation module; 6. upgrade module; 7. verification module.

具体实施方式Detailed ways

本发明的核心是提供一种存储设备的固件升级方法,相关技术中,采用ftp命令进行固件升级包的自动下载,甚至在ftp命令中增加prompt参数来取消用户交互,以提高固件升级降级测试的效率。但是,某些存储设备由于安全考虑,禁用了ftp命令,只保留了更为安全的sftp命令,而sftp本身就是一个交互式的命令,在固件升级包的下载和固件升级过程中,需要手动操作,不但占用了大量的人力和时间,还会影响测试效率。The core of the present invention is to provide a firmware upgrade method for storage devices. In related technologies, the ftp command is used to automatically download the firmware upgrade package, and even the prompt parameter is added to the ftp command to cancel user interaction, so as to improve the efficiency of the firmware upgrade and downgrade test. efficiency. However, due to security considerations, some storage devices disable the ftp command, and only retain the more secure sftp command, and sftp itself is an interactive command, and manual operations are required during the download and firmware upgrade process of the firmware upgrade package , not only takes up a lot of manpower and time, but also affects the test efficiency.

而本发明提供的存储设备的固件升级方法,首先,获取固件升级包的名称和待升级的设备信息,并从固件升级包的名称中提取升级关键字。然后,登录待升级的设备,并在其主进程中开启一个自动执行sftp下载功能的子进程。此时,根据升级关键字清理固件升级包的存储目录中的文件,通过运行子进程将固件升级包下载到所述存储目录中,并判断固件升级包是否下载成功。如果固件升级包下载成功,创建固件升级目录,并将固件升级包移动到固件升级目录中。最后,获取升级命令,并利用固件升级包执行升级进程。另外,在升级进程结束后,通过读取升级进程数据判断升级结果。由此可见,本发明实现了在无需用户交互的情况下,自动下载上传固件升级包,并自动执行升级指令,检测升级结果。In the firmware upgrade method of the storage device provided by the present invention, firstly, the name of the firmware upgrade package and the information of the device to be upgraded are obtained, and the upgrade keyword is extracted from the name of the firmware upgrade package. Then, log in to the device to be upgraded, and start a subprocess that automatically executes the sftp download function in its main process. At this point, the files in the storage directory of the firmware upgrade package are cleaned up according to the upgrade keyword, the firmware upgrade package is downloaded to the storage directory by running a sub-process, and it is judged whether the firmware upgrade package is downloaded successfully. If the firmware upgrade package is downloaded successfully, create a firmware upgrade directory and move the firmware upgrade package to the firmware upgrade directory. Finally, get the upgrade command and execute the upgrade process with the firmware upgrade package. In addition, after the upgrade process ends, the upgrade result is judged by reading the upgrade process data. It can be seen that the present invention realizes automatic downloading and uploading of firmware upgrade packages, automatic execution of upgrade instructions, and detection of upgrade results without user interaction.

除非另有定义,本文所使用的所有的技术和科学术语与属于本发明的技术领域的技术人员通常理解的含义相同。本文中在本发明的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本发明。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the technical field of the invention. The terms used herein in the description of the present invention are for the purpose of describing specific embodiments only, and are not intended to limit the present invention.

为了使本技术领域的人员更好地理解本发明方案,下面结合附图和具体实施方式对本发明作进一步的详细说明。显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to enable those skilled in the art to better understand the solution of the present invention, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. Apparently, the described embodiments are only some of the embodiments of the present invention, but not all of them. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

参见图1所示,本实施例提供了一种存储设备的固件升级方法,包括如下步骤:Referring to Fig. 1, the present embodiment provides a method for upgrading firmware of a storage device, including the following steps:

S1:获取固件升级包的名称和待升级的设备信息,并从固件升级包的名称中提取升级关键字。S1: Obtain the name of the firmware upgrade package and the information of the device to be upgraded, and extract the upgrade keyword from the name of the firmware upgrade package.

在具体实施方式中,首先获取固件升级包的名称、以及待升级设备的IP地址(host_ip)、端口号(host_port)、登录用户名(host_user)和密码(host_pwd);然后从固件升级包的名称中提取升级关键字,并将升级关键字写入pkg变量中。In a specific embodiment, first obtain the name of the firmware upgrade package, and the IP address (host_ip), port number (host_port), login user name (host_user) and password (host_pwd) of the device to be upgraded; then from the name of the firmware upgrade package Extract the upgrade keyword from , and write the upgrade keyword into the pkg variable.

需要特别说明的是,在本步骤之前,可以将固件升级包和升级工具统一放置在一个ftp服务器中,这样,可以支持多人共享下载且方便维护。It should be noted that before this step, the firmware upgrade package and the upgrade tool can be placed in an ftp server, so that multiple people can share the download and facilitate maintenance.

S2:登录待升级的设备,并在其主进程中开启一个自动执行sftp下载功能的子进程。S2: Log in to the device to be upgraded, and start a sub-process that automatically executes the sftp download function in its main process.

由于本发明的应用场景是:某些存储控制器系统由于安全性问题禁用掉了FTP命令,这让我们无法简单执行ftp命令、添加上prompt off参数来关闭用户交互,自动实现升级包下载;控制器保留的更为安全的sftp下载命令,本身就是一个交互性的命令,不能像ftp一样,通过改变参数来取消用户交互。Because the application scenario of the present invention is: some storage controller systems have disabled the FTP command due to security issues, which makes us unable to simply execute the ftp command, add the prompt off parameter to close user interaction, and automatically realize the upgrade package download; control The more secure sftp download command reserved by the server is itself an interactive command, and user interaction cannot be canceled by changing parameters like ftp.

基于上述情况,首先利用待升级设备的IP地址、端口号、登录用户名和密码登录待升级的设备;然后在此设备的主进程中开启subprocess子进程。当subprocess子进程运行时,自动执行与sftp进程的send-expect交互命令,并利用sftp进程进行文件的下载。Based on the above situation, first use the IP address, port number, login user name and password of the device to be upgraded to log in to the device to be upgraded; then start the subprocess in the main process of the device. When the subprocess subprocess is running, it automatically executes the send-expect interactive command with the sftp process, and uses the sftp process to download files.

本步骤的目的在于,将sftp下载部分,独立开启一个子进程,子进程转去执行sftp下载的部分,考虑到expect是linux系统中可以和子进程进行交互的一个命令,可以将sftp需要交互的部分提取到一个shell脚本中,在该shell脚本中,通过send-expect的回应方式,取代人为交互。The purpose of this step is to independently start a sub-process for the sftp download part, and transfer the sub-process to execute the sftp download part. Considering that expect is a command that can interact with the sub-process in the linux system, the part that sftp needs to interact with can be Extracted into a shell script in which human interaction is replaced by a send-expect response.

S3:根据升级关键字清理固件升级包的存储目录中的文件,通过运行子进程将固件升级包下载到所述存储目录中。S3: Clean up files in the storage directory of the firmware upgrade package according to the upgrade keyword, and download the firmware upgrade package to the storage directory by running a subprocess.

在具体实施方式中,如图2所示,在本步骤中,可通过以下子步骤实现固件升级包下载的准备和执行过程:In a specific embodiment, as shown in Figure 2, in this step, the preparation and execution process of downloading the firmware upgrade package can be realized through the following sub-steps:

S31:读取pkg变量中记录的升级关键字;S31: read the upgrade keyword recorded in the pkg variable;

S32:删除/tmp目录下所有含有升级关键字的文件;S32: delete all files containing the upgrade keyword under the /tmp directory;

S33:将pkg变量和固件升级包的存放信息注入subprocess子进程中,通过运行subprocess子进程将固件升级包下载到/tmp目录下。S33: Inject the pkg variable and storage information of the firmware upgrade package into the subprocess, and download the firmware upgrade package to the /tmp directory by running the subprocess.

需要特别说明的是,上述固件升级包下载的准备过程可适用于BMC、CPLD和BIOS等无需识别设备型号的固件。当固件升级包为BBU固件升级包时,还需要对BBU板的型号进行识别,并写入pkg变量中。具体的,上述步骤S32之后还包括:首先判断升级关键字中是否包括BBU,若否,则直接转到步骤S33;若是,则获取BBU板的型号,并将BBU板的型号写入pkg变量中。It should be noted that the above-mentioned preparation process for downloading the firmware upgrade package is applicable to firmware that does not need to identify the device model, such as BMC, CPLD, and BIOS. When the firmware upgrade package is a BBU firmware upgrade package, it is also necessary to identify the model of the BBU board and write it into the pkg variable. Specifically, after the above step S32, it also includes: first judge whether the upgrade keyword includes the BBU, if not, then directly go to step S33; if so, then obtain the model of the BBU board, and write the model of the BBU board into the pkg variable .

S4:判断固件升级包是否下载成功。S4: Determine whether the firmware upgrade package is downloaded successfully.

在具体实施方式中,当主进程中接收到sftp_download.sh文件后,获取返回的关键字;如果返回的关键字为bye,即为程序执行成功,说明下载过程没有出错,默认将升级包放置到了带升级设备的/tmp目录下;如果没有捕获到该关键字,则说明由于某些错误,下载过程中断了;则需要根据报错人为分析原因;In a specific implementation, after receiving the sftp_download.sh file in the main process, the returned keyword is obtained; if the returned keyword is bye, the program execution is successful, indicating that there is no error in the download process, and the upgrade package is placed in the belt by default. In the /tmp directory of the upgrade device; if this keyword is not captured, it means that the download process is interrupted due to some errors; you need to manually analyze the reason according to the error report;

S5:如果固件升级包下载成功,创建固件升级目录,并将固件升级包移动到固件升级目录中。S5: If the firmware upgrade package is downloaded successfully, create a firmware upgrade directory, and move the firmware upgrade package to the firmware upgrade directory.

在具体实施方式中,如图3所示,通过以下步骤进行固件升级准备:In a specific embodiment, as shown in Figure 3, the firmware upgrade preparation is carried out through the following steps:

S51:读取pkg变量,识别出固件关键字中包含的固件类型。S51: Read the pkg variable, and identify the firmware type included in the firmware keyword.

S52:根据固件类型创建相应的固件升级目录。S52: Create a corresponding firmware upgrade directory according to the firmware type.

作为示例的,可通过命令mkdir–p/dumps/fw/BBU为BBU固件创建固件升级目录,该处需要使用参数-p,即该目录不存在时,则创建。As an example, you can use the command mkdir–p/dumps/fw/BBU to create a firmware upgrade directory for the BBU firmware, where the parameter -p is required, that is, if the directory does not exist, it will be created.

S53:使用mv命令将固件升级包从/tmp目录中移动到固件升级目录中,并根据固件类型对固件升级包进行重命名。S53: Use the mv command to move the firmware upgrade package from the /tmp directory to the firmware upgrade directory, and rename the firmware upgrade package according to the firmware type.

作为示例的,通过命令mv-f/tmp/*_BBU_*A*/upgrade/BBU_a.bin对BBU固件升级包进行重命名As an example, rename the BBU firmware upgrade package by command mv-f /tmp/*_BBU_*A*/upgrade/BBU_a.bin

S6:获取升级命令,并利用固件升级包执行升级进程。S6: Obtain an upgrade command, and use the firmware upgrade package to execute the upgrade process.

在具体实施方式中,可利用封装好的升级命令,在执行机上远程向待升级设备发送升级命令,指定固件升级包,并执行相应的升级命令。In a specific implementation, the packaged upgrade command can be used to remotely send the upgrade command to the device to be upgraded on the execution machine, specify the firmware upgrade package, and execute the corresponding upgrade command.

S7:升级进程结束后,通过读取升级进程数据判断升级结果。S7: After the upgrade process ends, the upgrade result is judged by reading the upgrade process data.

首先,读取升级进程的输出信息和错误信息;如果所述输出信息中的记录固件版本符合升级要求,且错误信息中未记录升级错误,则升级成功;否则,升级失败。First, read the output information and error information of the upgrade process; if the recorded firmware version in the output information meets the upgrade requirements, and no upgrade error is recorded in the error information, the upgrade is successful; otherwise, the upgrade fails.

作为示例的,升级验证方式可通过多种方式实现。待升级进程结束后,首先检查固件版本,查看是否满足最终的版本要求;然后通过主程序根据命令的返回,判定升级成功与否;其中,升级命令可依具体设备而定。也可采用远程连接并执行命令的验证方法,具体如下:通过判断输出信息str_stdout和错误信息str_stderr来判断最终的升级结果;As an example, the upgrade verification method may be implemented in various ways. After the upgrade process is over, first check the firmware version to see if it meets the final version requirements; then judge whether the upgrade is successful or not according to the return of the command through the main program; among them, the upgrade command can be determined according to the specific device. The verification method of remotely connecting and executing commands can also be used, as follows: judge the final upgrade result by judging the output information str_stdout and error information str_stderr;

由此可见,本发明提供了一种存储设备的固件升级方法,实现了在禁用ftp命令的存储设备上根据用户提供的关键字,在无需用户交互与手动登录存储设备的情况下,自动下载上传升级包,并自动执行升级指令,检测升级结果。本发明通过在python主程序中开启子进程,向子进程中传递参数,并在子进程中通过linux的命令send-expect自动实现sftp的交互下载;在固件升级比较频繁,存储设备繁多的情况下,简化了人为操作流程,提升了测试效率。It can be seen that the present invention provides a method for upgrading the firmware of a storage device, which realizes automatic download and upload on a storage device that disables the ftp command according to keywords provided by the user without user interaction and manual login to the storage device. Upgrade the package, and automatically execute the upgrade command to detect the upgrade result. The present invention starts the sub-process in the python main program, transfers parameters to the sub-process, and automatically realizes the interactive download of sftp through the command send-expect of linux in the sub-process; in the case of frequent firmware upgrades and numerous storage devices , Simplify the manual operation process and improve the test efficiency.

参见图4所示,本发明还公开了一种存储设备的固件升级系统,包括:信息获取模块1、功能配置模块2、下载模块3、判断模块4、升级准备模块5、升级模块6和验证模块7。Referring to Fig. 4, the present invention also discloses a firmware upgrade system for storage devices, including: an information acquisition module 1, a function configuration module 2, a download module 3, a judgment module 4, an upgrade preparation module 5, an upgrade module 6 and a verification Module 7.

信息获取模块1,用于获取固件升级包的名称和待升级的设备信息,并从固件升级包的名称中提取升级关键字。The information obtaining module 1 is used to obtain the name of the firmware upgrade package and the information of the device to be upgraded, and extract the upgrade keyword from the name of the firmware upgrade package.

在具体实施方式中,信息获取模块1具体用于:获取固件升级包的名称、以及待升级设备的IP地址、端口号、登录用户名和密码;从固件升级包的名称中提取升级关键字,并将升级关键字写入pkg变量中。In a specific embodiment, the information acquisition module 1 is specifically used to: obtain the name of the firmware upgrade package and the IP address, port number, login user name and password of the device to be upgraded; extract the upgrade keyword from the name of the firmware upgrade package, and Write the upgrade keyword into the pkg variable.

功能配置模块2,用于登录待升级的设备,并在其主进程中开启一个自动执行sftp下载功能的子进程。The function configuration module 2 is used to log in the device to be upgraded, and start a sub-process that automatically executes the sftp download function in its main process.

在具体实施方式中,功能配置模块2具体用于:利用待升级设备的IP地址、端口号、登录用户名和密码登录待升级的设备;在主进程中开启subprocess子进程;当subprocess子进程运行时,自动执行与sftp进程的send-expect交互命令,并利用sftp进程进行文件的下载。In a specific embodiment, the function configuration module 2 is specifically used to: utilize the IP address, port number, login user name and password of the device to be upgraded to log in to the device to be upgraded; open the subprocess subprocess in the main process; when the subprocess subprocess runs , automatically execute the send-expect interactive command with the sftp process, and use the sftp process to download files.

下载模块3,用于根据升级关键字清理固件升级包的存储目录中的文件,通过运行子进程将固件升级包下载到所述存储目录中。The download module 3 is used to clean up the files in the storage directory of the firmware upgrade package according to the upgrade keyword, and download the firmware upgrade package to the storage directory by running a sub-process.

在具体实施方式中,下载模块3具体用于:读取pkg变量中记录的升级关键字;删除/tmp目录下所有含有升级关键字的文件;将pkg变量和固件升级包的存放信息注入subprocess子进程中,通过运行subprocess子进程将固件升级包下载到/tmp目录下。In a specific embodiment, the download module 3 is specifically used to: read the upgrade keyword recorded in the pkg variable; delete all files containing the upgrade keyword under the /tmp directory; inject the storage information of the pkg variable and the firmware upgrade package into the subprocess subprocess In the process, the firmware upgrade package is downloaded to the /tmp directory by running the subprocess subprocess.

判断模块4,用于判断固件升级包是否下载成功。Judging module 4, used to judge whether the firmware upgrade package is downloaded successfully.

在具体实施方式中,判断模块4具体用于:当主进程中接收到sftp_download.sh文件后,获取返回的关键字;如果返回的关键字为bye,则下载成功;否则下载失败,并进行报错。In a specific embodiment, the judging module 4 is specifically used to: obtain the returned keyword after receiving the sftp_download.sh file in the main process; if the returned keyword is bye, the download is successful; otherwise, the download fails and an error is reported.

升级准备模块5,用于当固件升级包下载成功后,创建固件升级目录,并将固件升级包移动到固件升级目录中。The upgrade preparation module 5 is configured to create a firmware upgrade directory after the firmware upgrade package is successfully downloaded, and move the firmware upgrade package to the firmware upgrade directory.

在具体实施方式中,升级准备模块5具体用于:读取pkg变量,识别出固件关键字中包含的固件类型;根据固件类型创建相应的固件升级目录;使用mv命令将固件升级包从/tmp目录中移动到固件升级目录中,并根据固件类型对固件升级包进行重命名。In a specific embodiment, the upgrade preparation module 5 is specifically used to: read the pkg variable to identify the firmware type contained in the firmware keyword; create a corresponding firmware upgrade directory according to the firmware type; use the mv command to upload the firmware upgrade package from /tmp directory to the firmware upgrade directory, and rename the firmware upgrade package according to the firmware type.

升级模块6,用于获取升级命令,并利用固件升级包执行升级进程。The upgrade module 6 is configured to obtain an upgrade command, and execute an upgrade process using a firmware upgrade package.

在具体实施方式中,升级模块6具体用于:利用封装好的升级命令,在执行机上远程向待升级设备发送升级命令,指定固件升级包,并执行相应的升级命令。In a specific embodiment, the upgrade module 6 is specifically used to: use the packaged upgrade command to remotely send the upgrade command to the device to be upgraded on the execution machine, specify the firmware upgrade package, and execute the corresponding upgrade command.

验证模块7,用于升级进程结束后,通过读取升级进程数据判断升级结果。The verification module 7 is used for judging the upgrade result by reading the upgrade process data after the upgrade process ends.

在具体实施方式中,验证模块7具体用于:读取升级进程的输出信息和错误信息;如果所述输出信息中的记录固件版本符合升级要求,且错误信息中未记录升级错误,则升级成功;否则,升级失败。In a specific embodiment, the verification module 7 is specifically used to: read the output information and error information of the upgrade process; if the recorded firmware version in the output information meets the upgrade requirements, and the upgrade error is not recorded in the error information, the upgrade is successful ; Otherwise, the upgrade fails.

由此可见,本发明提供了一种存储设备的固件升级系统,能够根据升级关键字,在无需用户交互与手动登录存储设备的情况下,自动下载上传升级包,并自动执行升级指令,检测升级结果。本系统通过在python主程序中开启子进程,向子进程中传递参数,并在子进程中通过linux的命令send-expect自动实现sftp的交互下载;在固件升级比较频繁,存储设备繁多的情况下,简化了人为操作流程,提升了测试效率。It can be seen that the present invention provides a firmware upgrade system for storage devices, which can automatically download and upload upgrade packages, automatically execute upgrade instructions, and detect upgrades without user interaction and manual login to the storage device according to the upgrade keywords. result. This system starts the sub-process in the python main program, passes parameters to the sub-process, and automatically realizes the interactive download of sftp through the linux command send-expect in the sub-process; in the case of frequent firmware upgrades and a large number of storage devices , Simplify the manual operation process and improve the test efficiency.

本发明还公开了一种存储设备的固件升级装置,包括处理器和存储器;其中,所述处理器执行所述存储器中保存的存储设备的固件升级程序时实现以下步骤:The present invention also discloses a firmware upgrade device for a storage device, including a processor and a memory; wherein, when the processor executes the firmware upgrade program of the storage device stored in the memory, the following steps are implemented:

1、获取固件升级包的名称和待升级的设备信息,并从固件升级包的名称中提取升级关键字。1. Obtain the name of the firmware upgrade package and the information of the device to be upgraded, and extract the upgrade keyword from the name of the firmware upgrade package.

2、登录待升级的设备,并在其主进程中开启一个自动执行sftp下载功能的子进程。2. Log in to the device to be upgraded, and start a sub-process that automatically executes the sftp download function in its main process.

3、根据升级关键字清理固件升级包的存储目录中的文件,通过运行子进程将固件升级包下载到所述存储目录中。3. Clean up the files in the storage directory of the firmware upgrade package according to the upgrade keyword, and download the firmware upgrade package to the storage directory by running a sub-process.

4、判断固件升级包是否下载成功。4. Determine whether the firmware upgrade package is downloaded successfully.

5、如果固件升级包下载成功,创建固件升级目录,并将固件升级包移动到固件升级目录中。5. If the firmware upgrade package is successfully downloaded, create a firmware upgrade directory and move the firmware upgrade package to the firmware upgrade directory.

6、获取升级命令,并利用固件升级包执行升级进程。6. Get the upgrade command, and use the firmware upgrade package to execute the upgrade process.

7、升级进程结束后,通过读取升级进程数据判断升级结果。7. After the upgrade process ends, judge the upgrade result by reading the upgrade process data.

本实施例提供的存储设备的固件升级装置可以包括但不限于智能手机、平板电脑、笔记本电脑或台式电脑等。The firmware upgrade apparatus of the storage device provided in this embodiment may include, but not limited to, a smart phone, a tablet computer, a notebook computer or a desktop computer, and the like.

其中,处理器可以包括一个或多个处理核心,比如4核心处理器、8核心处理器等。处理器可以采用数字信号处理(Digital Signal Processor,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable LogicArray,PLA)中的至少一种硬件形式来实现。处理器也可以包括主处理器和协处理器,主处理器是用于对在唤醒状态下的数据进行处理的处理器,也称中央处理器(CentralProcessing Unit,CPU);协处理器是用于对在待机状态下的数据进行处理的低功耗处理器。在一些实施例中,处理器可以在集成有图像处理器(Graphics Processing Unit,GPU),GPU用于负责显示屏所需要显示的内容的渲染和绘制。一些实施例中,处理器还可以包括人工智能(Artificial Intelligence,AI)处理器,该AI处理器用于处理有关机器学习的计算操作。Wherein, the processor may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor may be implemented in at least one hardware form of Digital Signal Processor (Digital Signal Processor, DSP), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), and Programmable Logic Array (Programmable Logic Array, PLA). The processor can also include a main processor and a coprocessor, the main processor is a processor for processing data in the wake-up state, also called a central processing unit (Central Processing Unit, CPU); the coprocessor is used for A low-power processor that processes data during standby. In some embodiments, the processor may be integrated with a graphics processor (Graphics Processing Unit, GPU), and the GPU is used for rendering and drawing the content that needs to be displayed on the display screen. In some embodiments, the processor may further include an artificial intelligence (Artificial Intelligence, AI) processor, where the AI processor is used to process computing operations related to machine learning.

存储器可以包括一个或多个计算机可读存储介质,该计算机可读存储介质可以是非暂态的。存储器还可包括高速随机存取存储器,以及非易失性存储器,比如一个或多个磁盘存储设备、闪存存储设备。本实施例中,存储器至少用于存储以下计算机程序,其中,该计算机程序被处理器加载并执行之后,能够实现前述任一实施例公开的存储设备的固件升级方法的相关步骤。另外,存储器所存储的资源还可以包括操作系统和数据等,存储方式可以是短暂存储或者永久存储。其中,操作系统可以包括Windows、Unix、Linux等。数据可以包括但不限于上述存储设备的固件升级方法中涉及的数据等。The memory may include one or more computer-readable storage media, which may be non-transitory. Memory may also include high-speed random access memory, and non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In this embodiment, the memory is at least used to store the following computer program, wherein, after the computer program is loaded and executed by the processor, relevant steps of the method for upgrading the firmware of the storage device disclosed in any of the foregoing embodiments can be implemented. In addition, the resources stored in the memory may also include an operating system and data, etc., and the storage method may be temporary storage or permanent storage. Wherein, the operating system may include Windows, Unix, Linux and so on. The data may include, but is not limited to, the data involved in the above method for upgrading the firmware of the storage device, and the like.

在具体实施方式中,所述处理器执行所述存储器中保存的计算机程序时,可以具体实现以下步骤:。In a specific implementation manner, when the processor executes the computer program stored in the memory, the following steps may be specifically implemented: .

在具体实施方式中,所述处理器执行所述存储器中保存的计算机程序时,可以具体实现以下步骤:获取固件升级包的名称、以及待升级设备的IP地址、端口号、登录用户名和密码;从固件升级包的名称中提取升级关键字,并将升级关键字写入pkg变量中。In a specific implementation manner, when the processor executes the computer program stored in the memory, the following steps may be specifically implemented: obtaining the name of the firmware upgrade package, and the IP address, port number, login user name and password of the device to be upgraded; Extract the upgrade keyword from the name of the firmware upgrade package, and write the upgrade keyword into the pkg variable.

在具体实施方式中,所述处理器执行所述存储器中保存的计算机程序时,可以具体实现以下步骤:利用待升级设备的IP地址、端口号、登录用户名和密码登录待升级的设备;在主进程中开启subprocess子进程;当subprocess子进程运行时,自动执行与sftp进程的send-expect交互命令,并利用sftp进程进行文件的下载。In a specific implementation manner, when the processor executes the computer program stored in the memory, the following steps may be specifically implemented: using the IP address, port number, login user name and password of the device to be upgraded to log in to the device to be upgraded; Start the subprocess subprocess in the process; when the subprocess subprocess is running, it automatically executes the send-expect interactive command with the sftp process, and uses the sftp process to download files.

在具体实施方式中,所述处理器执行所述存储器中保存的计算机程序时,可以具体实现以下步骤:读取pkg变量中记录的升级关键字;删除/tmp目录下所有含有升级关键字的文件;将pkg变量和固件升级包的存放信息注入subprocess子进程中,通过运行subprocess子进程将固件升级包下载到/tmp目录下。In a specific implementation manner, when the processor executes the computer program stored in the memory, the following steps can be specifically implemented: read the upgrade keyword recorded in the pkg variable; delete all files containing the upgrade keyword under the /tmp directory ; Inject the storage information of the pkg variable and the firmware upgrade package into the subprocess, and download the firmware upgrade package to the /tmp directory by running the subprocess.

在具体实施方式中,所述处理器执行所述存储器中保存的计算机程序时,可以具体实现以下步骤:当主进程中接收到sftp_download.sh文件后,获取返回的关键字;如果返回的关键字为bye,则下载成功;否则下载失败,并进行报错。In a specific implementation manner, when the processor executes the computer program stored in the memory, the following steps can be specifically implemented: after receiving the sftp_download.sh file in the main process, obtain the returned keyword; if the returned keyword is bye, the download is successful; otherwise, the download fails and an error is reported.

在具体实施方式中,所述处理器执行所述存储器中保存的计算机程序时,可以具体实现以下步骤:读取pkg变量,识别出固件关键字中包含的固件类型;根据固件类型创建相应的固件升级目录;使用mv命令将固件升级包从/tmp目录中移动到固件升级目录中,并根据固件类型对固件升级包进行重命名。In a specific embodiment, when the processor executes the computer program stored in the memory, the following steps can be specifically implemented: read the pkg variable, identify the firmware type contained in the firmware keyword; create corresponding firmware according to the firmware type Upgrade directory; use the mv command to move the firmware upgrade package from the /tmp directory to the firmware upgrade directory, and rename the firmware upgrade package according to the firmware type.

在具体实施方式中,所述处理器执行所述存储器中保存的计算机程序时,可以具体实现以下步骤:读取升级进程的输出信息和错误信息;如果所述输出信息中的记录固件版本符合升级要求,且错误信息中未记录升级错误,则升级成功;否则,升级失败。In a specific implementation manner, when the processor executes the computer program stored in the memory, the following steps may be specifically implemented: reading the output information and error information of the upgrade process; if the recorded firmware version in the output information conforms to the upgrade requirements, and no upgrade error is recorded in the error message, the upgrade is successful; otherwise, the upgrade fails.

进一步的,本实施例中的存储设备的固件升级装置,还可以包括:Further, the device for upgrading the firmware of the storage device in this embodiment may also include:

输入接口,用于获取外界导入的存储设备的固件升级程序,并将获取到的存储设备的固件升级程序保存至所述存储器中,还可以用于获取外界终端设备传输的各种指令和参数,并传输至处理器中,以便处理器利用上述各种指令和参数展开相应的处理。本实施例中,所述输入接口具体可以包括但不限于USB接口、串行接口、语音输入接口、指纹输入接口、硬盘读取接口等。The input interface is used to obtain the firmware upgrade program of the storage device imported from the outside world, and save the obtained firmware upgrade program of the storage device into the memory, and can also be used to obtain various instructions and parameters transmitted by the external terminal device, And transmit it to the processor, so that the processor can use the above-mentioned various instructions and parameters to carry out corresponding processing. In this embodiment, the input interface may specifically include, but not limited to, a USB interface, a serial interface, a voice input interface, a fingerprint input interface, a hard disk reading interface, and the like.

输出接口,用于将处理器产生的各种数据输出至与其相连的终端设备,以便于与输出接口相连的其他终端设备能够获取到处理器产生的各种数据。本实施例中,所述输出接口具体可以包括但不限于USB接口、串行接口等。The output interface is used to output various data generated by the processor to a terminal device connected to it, so that other terminal devices connected to the output interface can obtain various data generated by the processor. In this embodiment, the output interface may specifically include but not limited to a USB interface, a serial interface, and the like.

通讯单元,用于在服务器运行业务优化配置装置和外部服务器之间建立远程通讯连接,以便于存储设备的固件升级装置能够将镜像文件挂载到外部服务器中。本实施例中,通讯单元具体可以包括但不限于基于无线通讯技术或有线通讯技术的远程通讯单元。The communication unit is used to establish a remote communication connection between the server operation optimization configuration device and the external server, so that the firmware upgrade device of the storage device can mount the image file to the external server. In this embodiment, the communication unit may specifically include, but is not limited to, a remote communication unit based on wireless communication technology or wired communication technology.

键盘,用于获取用户通过实时敲击键帽而输入的各种参数数据或指令。The keyboard is used to obtain various parameter data or instructions input by the user by tapping the keycaps in real time.

显示器,用于对运行存储设备的固件升级过程的相关信息进行实时显示。The display is used to display in real time information related to the firmware upgrade process of the running storage device.

鼠标,可以用于协助用户输入数据并简化用户的操作。The mouse can be used to assist the user to input data and simplify the user's operation.

本发明还公开了一种可读存储介质,这里所说的可读存储介质包括随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动硬盘、CD-ROM或技术领域内所公知的任意其他形式的存储介质。可读存储介质中存储有存储设备的固件升级程序,所述存储设备的固件升级程序被处理器执行时实现以下步骤:The invention also discloses a readable storage medium. The readable storage medium mentioned here includes random access memory (RAM), memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, register , hard disk, removable hard disk, CD-ROM or any other form of storage medium known in the technical field. The firmware upgrade program of the storage device is stored in the readable storage medium, and the firmware upgrade program of the storage device is executed by the processor to implement the following steps:

1、获取固件升级包的名称和待升级的设备信息,并从固件升级包的名称中提取升级关键字。1. Obtain the name of the firmware upgrade package and the information of the device to be upgraded, and extract the upgrade keyword from the name of the firmware upgrade package.

2、登录待升级的设备,并在其主进程中开启一个自动执行sftp下载功能的子进程。2. Log in to the device to be upgraded, and start a sub-process that automatically executes the sftp download function in its main process.

3、根据升级关键字清理固件升级包的存储目录中的文件,通过运行子进程将固件升级包下载到所述存储目录中。3. Clean up the files in the storage directory of the firmware upgrade package according to the upgrade keyword, and download the firmware upgrade package to the storage directory by running a sub-process.

4、判断固件升级包是否下载成功。4. Determine whether the firmware upgrade package is downloaded successfully.

5、如果固件升级包下载成功,创建固件升级目录,并将固件升级包移动到固件升级目录中。5. If the firmware upgrade package is successfully downloaded, create a firmware upgrade directory and move the firmware upgrade package to the firmware upgrade directory.

6、获取升级命令,并利用固件升级包执行升级进程。6. Get the upgrade command, and use the firmware upgrade package to execute the upgrade process.

7、升级进程结束后,通过读取升级进程数据判断升级结果。7. After the upgrade process ends, judge the upgrade result by reading the upgrade process data.

综上所述,本发明实现了在无需用户交互的情况下,自动下载上传固件升级包,并自动执行升级指令,检测升级结果。In summary, the present invention realizes automatic downloading and uploading of firmware upgrade packages, automatic execution of upgrade instructions, and detection of upgrade results without user interaction.

本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。对于实施例公开的方法而言,由于其与实施例公开的系统相对应,所以描述的比较简单,相关之处参见方法部分说明即可。Each embodiment in this specification is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same or similar parts of each embodiment can be referred to each other. As for the method disclosed in the embodiment, since it corresponds to the system disclosed in the embodiment, the description is relatively simple, and for related parts, please refer to the description of the method part.

专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Professionals can further realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software or a combination of the two. In order to clearly illustrate the possible For interchangeability, in the above description, the composition and steps of each example have been generally described according to their functions. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present invention.

在本发明所提供的几个实施例中,应该理解到,所揭露的系统、系统和方法,可以通过其它的方式实现。例如,以上所描述的系统实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,系统或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided by the present invention, it should be understood that the disclosed system, system and method can be implemented in other ways. For example, the system embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of systems or units may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

另外,在本发明各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个单元中。In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, or each module may physically exist separately, or two or more modules may be integrated into one unit.

同理,在本发明各个实施例中的各处理单元可以集成在一个功能模块中,也可以是各个处理单元物理存在,也可以两个或两个以上处理单元集成在一个功能模块中。Similarly, each processing unit in each embodiment of the present invention may be integrated into one functional module, or each processing unit may exist physically, or two or more processing units may be integrated into one functional module.

结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of the methods or algorithms described in connection with the embodiments disclosed herein may be directly implemented by hardware, software modules executed by a processor, or a combination of both. Software modules can be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other Any other known storage medium.

最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。Finally, it should also be noted that in this text, relational terms such as first and second etc. are only used to distinguish one entity or operation from another, and do not necessarily require or imply that these entities or operations, any such actual relationship or order exists. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.

以上对本发明所提供的存储设备的固件升级方法、系统、装置及可读存储介质进行了详细介绍。本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想。应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以对本发明进行若干改进和修饰,这些改进和修饰也落入本发明权利要求的保护范围内。The firmware upgrade method, system, device and readable storage medium of the storage device provided by the present invention have been introduced in detail above. In this paper, specific examples are used to illustrate the principle and implementation of the present invention, and the descriptions of the above embodiments are only used to help understand the method and core idea of the present invention. It should be pointed out that for those skilled in the art, without departing from the principle of the present invention, some improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.

Claims (10)

Translated fromChinese
1.一种存储设备的固件升级方法,其特征在于,包括:1. A method for upgrading firmware of a storage device, comprising:获取固件升级包的名称和待升级的设备信息,并从固件升级包的名称中提取升级关键字;Obtain the name of the firmware upgrade package and the device information to be upgraded, and extract the upgrade keyword from the name of the firmware upgrade package;登录待升级的设备,并在其主进程中开启一个自动执行文件传输下载功能的子进程;Log in to the device to be upgraded, and start a sub-process in its main process that automatically executes the file transfer and download function;根据升级关键字清理固件升级包的存储目录中的文件,通过运行子进程将固件升级包下载到所述存储目录中;Clean up the files in the storage directory of the firmware upgrade package according to the upgrade keyword, and download the firmware upgrade package to the storage directory by running a subprocess;判断固件升级包是否下载成功;Determine whether the firmware upgrade package is downloaded successfully;如果固件升级包下载成功,创建固件升级目录,并将固件升级包移动到固件升级目录中;If the firmware upgrade package is downloaded successfully, create a firmware upgrade directory and move the firmware upgrade package to the firmware upgrade directory;获取升级命令,并利用固件升级包执行升级进程;Obtain the upgrade command, and use the firmware upgrade package to execute the upgrade process;升级进程结束后,通过读取升级进程数据判断升级结果。After the upgrade process ends, the upgrade result is judged by reading the upgrade process data.2.根据权利要求1所述的存储设备的固件升级方法,其特征在于,所述获取固件升级包的名称和待升级的设备信息,并从固件升级包的名称中提取升级关键字,包括:2. The method for upgrading firmware of a storage device according to claim 1, wherein said obtaining the name of the firmware upgrade package and the device information to be upgraded, and extracting the upgrade keyword from the name of the firmware upgrade package comprises:获取固件升级包的名称、以及待升级设备的IP地址、端口号、登录用户名和密码;Obtain the name of the firmware upgrade package, as well as the IP address, port number, login user name and password of the device to be upgraded;从固件升级包的名称中提取升级关键字,并将升级关键字写入软件包配置变量中。Extract the upgrade keyword from the name of the firmware upgrade package, and write the upgrade keyword into the package configuration variable.3.根据权利要求2所述的存储设备的固件升级方法,其特征在于,所述登录待升级的设备,并在其主进程中开启一个自动执行文件传输下载功能的子进程,包括:3. The method for upgrading firmware of a storage device according to claim 2, wherein said logging in to the device to be upgraded, and starting a sub-process that automatically executes the file transfer and download function in its main process includes:利用待升级设备的IP地址、端口号、登录用户名和密码登录待升级的设备;Use the IP address, port number, login user name and password of the device to be upgraded to log in to the device to be upgraded;在主进程中开启管理子进程;Start the management subprocess in the main process;当管理子进程运行时,自动执行与文件传输进程的交互命令,并利用文件传输进程进行文件的下载。When the management sub-process is running, it automatically executes the interactive command with the file transfer process, and uses the file transfer process to download files.4.根据权利要求3所述的存储设备的固件升级方法,其特征在于,所述根据升级关键字清理固件升级包的存储目录中的文件,通过运行子进程将固件升级包下载到所述存储目录中,包括:4. The method for upgrading firmware of a storage device according to claim 3, wherein the file in the storage directory of the firmware upgrade package is cleaned up according to the upgrade keyword, and the firmware upgrade package is downloaded to the storage device by running a sub-process. directory, including:读取软件包配置变量中记录的升级关键字;Read upgrade keywords recorded in package configuration variables;删除固件升级包的存储目录下所有含有升级关键字的文件;Delete all files containing upgrade keywords in the storage directory of the firmware upgrade package;将软件包配置变量和固件升级包的存放信息注入管理子进程中,通过运行管理子进程将固件升级包下载到存储目录下。Inject the software package configuration variable and the storage information of the firmware upgrade package into the management subprocess, and download the firmware upgrade package to the storage directory by running the management subprocess.5.根据权利要求1所述的存储设备的固件升级方法,其特征在于,所述判断固件升级包是否下载成功,包括:5. The firmware upgrade method of the storage device according to claim 1, wherein said judging whether the firmware upgrade package is successfully downloaded comprises:当主进程中接收到文件传输下载脚本文件后,获取返回的关键字;After receiving the file transfer download script file in the main process, get the returned keyword;如果返回的关键字为bye,则下载成功;否则下载失败,并进行报错。If the returned keyword is bye, the download is successful; otherwise, the download fails and an error is reported.6.根据权利要求4所述的存储设备的固件升级方法,其特征在于,所述创建固件升级目录,并将固件升级包移动到固件升级目录中,包括:6. The firmware upgrade method of the storage device according to claim 4, wherein said creating a firmware upgrade directory and moving the firmware upgrade package to the firmware upgrade directory comprises:读取软件包配置变量,识别出固件关键字中包含的固件类型;Read software package configuration variables to identify the firmware type contained in the firmware keyword;根据固件类型创建相应的固件升级目录;Create the corresponding firmware upgrade directory according to the firmware type;使用mv命令将固件升级包从存储目录中移动到固件升级目录中,并根据固件类型对固件升级包进行重命名。Use the mv command to move the firmware upgrade package from the storage directory to the firmware upgrade directory, and rename the firmware upgrade package according to the firmware type.7.根据权利要求1所述的存储设备的固件升级方法,其特征在于,所述通过读取升级进程数据判断升级结果,包括:7. The method for upgrading firmware of a storage device according to claim 1, wherein said judging the upgrade result by reading the upgrade process data comprises:读取升级进程的输出信息和错误信息;Read the output and error messages of the upgrade process;如果所述输出信息中的记录固件版本符合升级要求,且错误信息中未记录升级错误,则升级成功;否则,升级失败。If the recorded firmware version in the output information meets the upgrade requirements, and no upgrade error is recorded in the error information, the upgrade is successful; otherwise, the upgrade fails.8.一种存储设备的固件升级系统,其特征在于,包括:8. A firmware upgrade system for a storage device, comprising:信息获取模块,用于获取固件升级包的名称和待升级的设备信息,并从固件升级包的名称中提取升级关键字;The information acquisition module is used to obtain the name of the firmware upgrade package and the device information to be upgraded, and extract the upgrade keyword from the name of the firmware upgrade package;功能配置模块,用于登录待升级的设备,并在其主进程中开启一个自动执行文件传输下载功能的子进程;The function configuration module is used to log in the device to be upgraded, and start a sub-process in its main process that automatically executes the file transfer and download function;下载模块,用于根据升级关键字清理固件升级包的存储目录中的文件,通过运行子进程将固件升级包下载到所述存储目录中;The download module is used to clean up the files in the storage directory of the firmware upgrade package according to the upgrade keyword, and download the firmware upgrade package to the storage directory by running a sub-process;判断模块,用于判断固件升级包是否下载成功;A judging module, configured to judge whether the firmware upgrade package is downloaded successfully;升级准备模块,用于当固件升级包下载成功后,创建固件升级目录,并将固件升级包移动到固件升级目录中;The upgrade preparation module is used to create a firmware upgrade directory when the firmware upgrade package is downloaded successfully, and move the firmware upgrade package to the firmware upgrade directory;升级模块,用于获取升级命令,并利用固件升级包执行升级进程;An upgrade module, configured to obtain an upgrade command, and execute an upgrade process using a firmware upgrade package;验证模块,用于升级进程结束后,通过读取升级进程数据判断升级结果。The verification module is used for judging the upgrade result by reading the upgrade process data after the upgrade process ends.9.一种存储设备的固件升级装置,其特征在于,包括:9. A firmware upgrade device for a storage device, comprising:存储器,用于存储存储设备的固件升级程序;The memory is used to store the firmware upgrade program of the storage device;处理器,用于执行所述存储设备的固件升级程序时实现如权利要求1至7任一项权利要求所述的存储设备的固件升级方法的步骤。The processor is configured to implement the steps of the method for upgrading the firmware of the storage device according to any one of claims 1 to 7 when executing the firmware upgrade program of the storage device.10.一种可读存储介质,其特征在于:所述可读存储介质上存储有存储设备的固件升级程序,所述存储设备的固件升级程序被处理器执行时实现如权利要求1至7任一项权利要求所述的存储设备的固件升级方法的步骤。10. A readable storage medium, characterized in that: a firmware upgrade program of a storage device is stored on the readable storage medium, and when the firmware upgrade program of the storage device is executed by a processor, any of claims 1 to 7 can be realized. The steps of the method for upgrading the firmware of the storage device according to one claim.
CN202310530269.XA2023-05-112023-05-11Firmware upgrading method, system and device of storage device and storage mediumPendingCN116679968A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202310530269.XACN116679968A (en)2023-05-112023-05-11Firmware upgrading method, system and device of storage device and storage medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202310530269.XACN116679968A (en)2023-05-112023-05-11Firmware upgrading method, system and device of storage device and storage medium

Publications (1)

Publication NumberPublication Date
CN116679968Atrue CN116679968A (en)2023-09-01

Family

ID=87788126

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202310530269.XAPendingCN116679968A (en)2023-05-112023-05-11Firmware upgrading method, system and device of storage device and storage medium

Country Status (1)

CountryLink
CN (1)CN116679968A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN118656840A (en)*2024-08-192024-09-17中汽数据(天津)有限公司 A method for extracting firmware from smart connected vehicles

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN118656840A (en)*2024-08-192024-09-17中汽数据(天津)有限公司 A method for extracting firmware from smart connected vehicles

Similar Documents

PublicationPublication DateTitle
CN109933521A (en) Automatic testing method, device, computer equipment and storage medium based on BDD
CN113360379B (en) Program test environment creation method and program test environment creation device
CN108563579B (en)White box testing method, device and system and storage medium
CN110457218A (en) Game engine testing method, device, storage medium and electronic device
WO2023092942A1 (en)Data storage method and apparatus, and electronic device and readable storage medium
CN109144525A (en)A kind of software installation method and system of network self-adapting
WO2017020459A1 (en)Method and apparatus for configuring plugin package for host
CN116610336A (en) A firmware upgrade method, system, device and readable storage medium
CN117076227A (en) Simulation test system, method, device and medium for hard disk backplane monitoring function
CN116679968A (en)Firmware upgrading method, system and device of storage device and storage medium
CN111949285B (en) A firmware upgrade method, device, equipment and storage medium for an extended chip
CN113608996B (en) A mirror compilation test method, system, device and readable storage medium
CN112241373A (en) Automated test method, test apparatus, processor and test system
CN116166525A (en) A method and device for generating a test script
CN111399871B (en)System updating method, device, equipment and medium of HBA card
CN115774662A (en)Business process testing method, device, equipment and storage medium
CN109522174B (en)Method, device, terminal and storage medium for controlling adb enabling
CN113722212B (en) A CPLD upgrade test method, device, equipment and medium
CN113655846B (en)OpenPOWER server time synchronization method and system
CN112885403B (en) Functional testing method, device and equipment of a flash controller
CN115454673A (en) A data collection method, device and medium for a baseboard management controller
CN116089124A (en)Communication method, device and medium of simulation system
CN115145634A (en) A system management software self-adapting method, device and medium
CN115114212B (en)VPD (virtual private digital) refreshing method, device, equipment and medium
CN113569182B (en) Data processing method, device, storage medium and electronic device

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
CB02Change of applicant information

Country or region after:China

Address after:215100 Building 9, No.1 guanpu Road, Guoxiang street, Wuzhong Economic Development Zone, Suzhou City, Jiangsu Province

Applicant after:Suzhou Yuannao Intelligent Technology Co.,Ltd.

Address before:215100 Building 9, No.1 guanpu Road, Guoxiang street, Wuzhong Economic Development Zone, Suzhou City, Jiangsu Province

Applicant before:SUZHOU LANGCHAO INTELLIGENT TECHNOLOGY Co.,Ltd.

Country or region before:China


[8]ページ先頭

©2009-2025 Movatter.jp