Data updating method and device, equipment, storage medium and program product

By using the TFTP protocol in an embedded system to transmit and update the firmware and recover through the SPI bus when the update fails, the cumbersome problem of the embedded system update process is solved, and an efficient and reliable data update process is achieved.

CN119960782APending Publication Date: 2025-05-09JILUO TECH (SHANGHAI) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411750859.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-05-09

AI Technical Summary

Technical Problem

Existing embedded systems are usually fixed after loading firmware during manufacturing, and the update process is cumbersome and difficult to achieve efficient data updates.

Method used

The installation package to be updated is transferred to the target switch via Simple File Transfer Protocol (TFTP), and after the transfer is successful, it is written to flash memory for firmware update. In case of update failure, firmware recovery is performed via the SPI bus.

Benefits of technology

An efficient data update process is realized, manual intervention is reduced, operating costs and error rates are reduced, and system reliability and maintainability are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119960782A_ABST
    Figure CN119960782A_ABST
Patent Text Reader

Abstract

The invention provides a data updating method and device, equipment, a storage medium and a program product, and relates to the technical field of data processing, and the method comprises the steps: transmitting a to-be-updated first installation package to a target switch through a simple file transfer protocol under the condition that a processor receives the to-be-updated first installation package; under the condition that the simple file transfer protocol successfully transmits the first installation package to the target switch, the first installation package is written into a flash memory corresponding to the target switch, and the target switch performs firmware updating according to the first installation package; and under the condition that the firmware updating of the target switch fails, the processor recovers the firmware of the target switch through an SPI (Serial Peripheral Interface) bus.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a data updating method, device, equipment, storage medium and program product. Background Art

[0002] Embedded systems, such as the NXP SJA1110 network switch, are typically loaded with firmware once during the manufacturing process and then are typically fixed and not updated, or can only be updated manually at a service center using special equipment, which is a cumbersome process.

[0003] Therefore, how to update data more efficiently has become a problem that needs to be solved urgently in the industry. Summary of the invention

[0004] The present invention provides a data updating method, device, equipment, storage medium and program product, which are used to solve the problem of how to update data more efficiently in the prior art.

[0005] The present invention provides a data updating method, comprising: When the processor receives the first installation package to be updated, the processor transmits the first installation package to the target switch through a simple file transfer protocol; When the simple file transfer protocol successfully transfers the first installation package to the target switch, the first installation package is written into a flash memory corresponding to the target switch, and the target switch performs a firmware update according to the first installation package; In the case that the firmware update of the target switch fails, the processor restores the firmware of the target switch through the SPI bus.

[0006] According to a data updating method provided by the present invention, when the firmware update of the target switch fails, the processor restores the firmware of the target switch through the SPI bus, including: In the case where the firmware update of the target switch fails, the processor downloads a recovery installation package of the target switch from the root file system, and transmits the recovery installation package to a flash memory corresponding to the target switch through the SPI bus; The target switch performs firmware recovery according to the recovery installation package.

[0007] According to a data updating method provided by the present invention, after the step of restoring the firmware of the target switch according to the recovery installation package, the method further includes: The processor again transmits the first installation package to the flash memory corresponding to the target switch through the simple file transfer protocol.

[0008] According to a data updating method provided by the present invention, writing the first installation package into a flash memory corresponding to the target switch, and the target switch performing a firmware update according to the first installation package, comprises: After the target switch successfully loads the first installation package, the processor sends a restart instruction to the target switch through a general input and output; After the target switch is restarted, further detecting the working state, network state and firmware state of the target switch; When the working state, network state and firmware state of the target switch are all normal, it is determined that the firmware update of the target switch is successful.

[0009] According to a data updating method provided by the present invention, after the target switch is restarted, after the step of further detecting the working state, network state and firmware state of the target switch, the method further includes: When the working state, network state or firmware state of the target switch is abnormal, it is determined that the firmware update of the target switch fails.

[0010] According to a data updating method provided by the present invention, when a processor receives a first installation package to be updated, after the step of transmitting the first installation package to a target switch through a simple file transfer protocol, the method further includes: In the case where the simple file transfer protocol fails to successfully transmit the first installation package to the target switch, recording the number of transmission failures; When the number of transmission failures is less than a first preset threshold, the processor recovers the firmware of the target switch through the SPI bus; When the number of transmission failures is greater than or equal to a first preset threshold, network fault information is generated.

[0011] The present invention also provides a data updating device, comprising: a transmission module, configured to transmit the first installation package to be updated to a target switch through a simple file transfer protocol when the processor receives the first installation package to be updated; An update module, configured to write the first installation package into a flash memory corresponding to the target switch when the first installation package is successfully transferred to the target switch by the simple file transfer protocol, so that the target switch performs a firmware update according to the first installation package; The recovery module is used for enabling the processor to recover the firmware of the target switch through the SPI bus when the firmware update of the target switch fails.

[0012] According to a data updating device provided by the present invention, the device is also used for: In the case where the firmware update of the target switch fails, the processor downloads a recovery installation package of the target switch from the root file system, and transmits the recovery installation package to a flash memory corresponding to the target switch through the SPI bus; The target switch performs firmware recovery according to the recovery installation package.

[0013] According to a data updating device provided by the present invention, the device is also used for: The processor again transmits the first installation package to the flash memory corresponding to the target switch through the simple file transfer protocol.

[0014] According to a data updating device provided by the present invention, the device is also used for: After the target switch successfully loads the first installation package, the processor sends a restart instruction to the target switch through a general input and output; After the target switch is restarted, further detecting the working state, network state and firmware state of the target switch; When the working state, network state and firmware state of the target switch are all normal, it is determined that the firmware update of the target switch is successful.

[0015] According to a data updating device provided by the present invention, the device is also used for: When the working state, network state or firmware state of the target switch is abnormal, it is determined that the firmware update of the target switch fails.

[0016] According to a data updating device provided by the present invention, the device is also used for: In the case where the simple file transfer protocol fails to successfully transmit the first installation package to the target switch, recording the number of transmission failures; When the number of transmission failures is less than a first preset threshold, the processor recovers the firmware of the target switch through the SPI bus; When the number of transmission failures is greater than or equal to a first preset threshold, network fault information is generated.

[0017] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the above-mentioned data updating methods is implemented.

[0018] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the data updating method described in any one of the above is implemented.

[0019] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned data updating methods.

[0020] The data update method, device, equipment, storage medium and program product provided by the present invention first successfully transfer the first installation package to the target switch for installation through a simple file transfer protocol, and in the event of installation failure, select the SPI bus to restore the firmware of the target switch, which improves the reliability of the system because even if problems occur during the update process, the system can be quickly restored. Secondly, the automated update process reduces manual intervention, reduces operating costs and error rates. In addition, by remotely updating the firmware, security patches and performance improvements can be deployed more quickly, improving the security and performance of the system. Finally, this method also improves the maintainability of the system because the update and recovery process can be remotely controlled by software without physical contact with the device. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0022] Figure 1 A schematic diagram of a data updating method flow chart provided in an embodiment of the present application; Figure 2 An update and sorting flow chart provided for the embodiments of the present application; Figure 3 A schematic diagram of the structure of a data updating device provided in an embodiment of the present application; Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0023] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0024] Figure 1 A schematic diagram of a data updating method flow provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, including: Step 110: When the processor receives the first installation package to be updated, the processor transmits the first installation package to the target switch through a simple file transfer protocol; In the embodiment of the present application, the processor may specifically refer to the LX2160A processor in the Layerscape series of NXP, which is a high-performance processor for network and communication applications. It has multiple processor cores, high-speed memory interfaces and rich communication interfaces, and is suitable for building high-performance network devices such as routers, switches, gateways, etc.

[0025] In the embodiment of the present application, the target switch may refer to NXP SJA1110, an automotive Ethernet switch, which is used to provide data exchange functions in the automotive network. SJA1110 supports multiple Ethernet standards and can provide high-speed and reliable communication between various electronic control units (ECUs) of the car. It is usually used to achieve network connection of on-board diagnostic systems, infotainment systems, safety systems, etc.

[0026] Before the update process begins, the processor may receive or prepare a first installation package to be updated from the cloud server. This installation package usually contains new firmware or software updates for the switch.

[0027] Once the processor receives the installation package, it sends it to the target switch via the Trivial File Transfer Protocol (TFTP). TFTP is a lightweight file transfer protocol that is often used in simplified network environments, such as embedded systems or device updates in a LAN.

[0028] The transfer process involves the flow of data from the processor to the target switch. The TFTP protocol simplifies the transfer process because it does not require complex authentication or error recovery mechanisms, which makes it ideal for use on resource-constrained devices.

[0029] Step 120, when the first installation package is successfully transferred to the target switch by the simple file transfer protocol, the first installation package is written into a flash memory corresponding to the target switch, and the target switch performs a firmware update according to the first installation package; In the embodiment of the present application, after the processor successfully transfers the first installation package to the target switch via TFTP, a mechanism is required to confirm the success of the transfer. Once it is confirmed that the installation package has been successfully transferred, the installation package will be further written into the flash memory of the target switch.

[0030] The writing process may include formatting data, managing storage space, and ensuring that data is written correctly to the intended storage area.

[0031] After the installation package is written to the flash memory, the target switch will perform the firmware update according to this installation package. After the firmware update is completed, the switch may need to be restarted to apply the new firmware. The restart process should ensure that all new firmware components are loaded correctly and the system configuration is updated.

[0032] After restarting, the system will perform a self-test to confirm that the new firmware has been loaded and is running correctly. This may include running built-in diagnostics or returning status information to the server.

[0033] Step 130: When the firmware update of the target switch fails, the processor restores the firmware of the target switch through the SPI bus.

[0034] In the embodiment of the present application, once a firmware update failure is detected, the processor will immediately trigger a recovery process, which usually involves communication from the processor to the target switch to notify the switch that firmware recovery is required.

[0035] The processor communicates with the flash memory of the target switch through the Serial Peripheral Interface (SPI) bus. The SPI bus is a high-speed serial communication protocol suitable for data transmission between the processor and various peripherals. During the recovery process, the processor will obtain a backup copy or recovery image of the firmware from its internal storage or through other reliable data sources.

[0036] After the firmware restore is complete, the target switch needs to reboot to apply the new firmware image. The reboot process should ensure that the new firmware is loaded correctly and all system configurations are updated.

[0037] After a reboot, the processor verifies that the switch has successfully recovered and is running on the recovered firmware. This may be done through status information, performance metrics, or other health checks returned by the switch.

[0038] In an embodiment of the present application, the first installation package is first successfully transferred to the target switch for installation through a simple file transfer protocol, and in the event of installation failure, the SPI bus is selected to restore the firmware of the target switch, which improves the reliability of the system because the system can be quickly restored even if problems occur during the update process. Secondly, the automated update process reduces manual intervention, reduces operating costs and error rates. In addition, by remotely updating the firmware, security patches and performance improvements can be deployed more quickly, improving the security and performance of the system. Finally, this method also improves the maintainability of the system because the update and recovery process can be remotely controlled by software without physical contact with the device.

[0039] Optionally, when the firmware update of the target switch fails, the processor recovers the firmware of the target switch through the SPI bus, including: In the case where the firmware update of the target switch fails, the processor downloads a recovery installation package of the target switch from the root file system, and transmits the recovery installation package to a flash memory corresponding to the target switch through the SPI bus; The target switch performs firmware recovery according to the recovery installation package.

[0040] In the embodiment of the present application, when the firmware update of the target switch fails, the processor will take a series of measures to restore the firmware of the switch to a stable and reliable state. This process begins when the processor detects that the firmware update has not been successfully completed, whether due to a file transfer error, firmware incompatibility with hardware, or any other reason that causes the update to fail.

[0041] Once an update failure is detected, the processor retrieves a pre-prepared recovery package from its root file system. This recovery package contains the previous stable version of the switch firmware, or a firmware image specifically for recovery. The processor transfers the recovery package to the flash memory of the target switch via the SPI bus, a high-speed and reliable serial communication protocol.

[0042] The SPI bus allows the processor to communicate directly with the switch's flash memory, ensuring that the recovery package can be accurately and securely written to the switch's storage. Once the transfer is complete, the target switch will update its firmware based on the recovery package, a process that usually involves erasing old, potentially corrupted firmware data and writing a new, verified firmware image.

[0043] The firmware recovery process is automated and is designed to minimize service interruption time due to firmware issues and ensure that the switch can be quickly restored to normal operation. Once the recovery process is complete, the switch will reboot, load the new firmware image, and continue its network communication tasks.

[0044] In the embodiment of the present application, the recovery mechanism is an important part of the firmware update process, which provides a safeguard to ensure that even if problems are encountered during the update process, the system can be automatically restored to a safe and stable state. This not only improves the reliability of the system, but also reduces the manual intervention required by maintenance personnel, thereby reducing maintenance costs and improving overall system efficiency.

[0045] Optionally, after the step of restoring the firmware of the target switch according to the recovery installation package, the method further includes: The processor again transmits the first installation package to the flash memory corresponding to the target switch through the simple file transfer protocol.

[0046] In the embodiment of the present application, the purpose of retransmitting the first installation package is to try to update the firmware again. In some cases, the initial update may fail due to temporary problems (such as network instability, power outage, etc.), and these problems may have been resolved after recovery.

[0047] The processor will again obtain the first installation package from a reliable source or storage area and prepare to send it to the target switch. This ensures the integrity and up-to-dateness of the installation package.

[0048] Once the transfer is complete, the first installation package is stored in the flash memory of the switch, awaiting further update instructions. This allows system administrators or automated update systems to perform firmware updates at the appropriate time. Depending on the needs and configuration of the system, the processor may initiate the update process immediately or wait for specific trigger conditions (such as when the system is idle, during a maintenance window, etc.) to perform the update.

[0049] In the embodiment of the present application, by transmitting the first installation package again, it is ensured that the target switch always has the ability to update to the latest firmware, and even if problems are encountered during the update process, it can quickly recover and be ready to try again. This method improves the flexibility and robustness of the system and ensures the continuous update and maintenance of network equipment.

[0050] Optionally, writing the first installation package into a flash memory corresponding to the target switch, and the target switch performing a firmware update according to the first installation package, includes: After the target switch successfully loads the first installation package, the processor sends a restart instruction to the target switch through a general input and output; After the target switch is restarted, further detecting the working state, network state and firmware state of the target switch; When the working state, network state and firmware state of the target switch are all normal, it is determined that the firmware update of the target switch is successful.

[0051] In the embodiment of the present application, writing a first installation package into the flash memory of the target switch is a preliminary step of the update process. This installation package contains a new version of firmware, which is ready to replace the existing firmware.

[0052] Once the first installation package is successfully loaded into the target switch, the processor sends a reboot command to the target switch via the general purpose input and output (GPIO). GPIO is a widely used hardware interface that allows the processor to directly transmit control signals to the switch. Rebooting is a critical part of the update process because it allows the new firmware to be properly loaded and initialized.

[0053] In the embodiment of the present application, after the target switch is restarted, the processor further detects the working status, network status and firmware status of the switch. These detections ensure that the switch is not only successfully started, but also that its network functions and firmware are running as expected.

[0054] A health check might include CPU and memory usage, a network status check might involve verifying that packets are being sent and received, and a firmware status check confirms that the new firmware is loaded and running correctly.

[0055] In the embodiment of the present application, if the working status, network status and firmware status of the target switch are all normal, it can be determined that the firmware update is successful. This determination is based on the switch being able to operate stably without errors or abnormal behavior.

[0056] Optionally, when the processor receives the first installation package to be updated, after the step of transmitting the first installation package to the target switch through a simple file transfer protocol, the method further includes: In the case where the simple file transfer protocol fails to successfully transmit the first installation package to the target switch, recording the number of transmission failures; When the number of transmission failures is less than a first preset threshold, the processor recovers the firmware of the target switch through the SPI bus; When the number of transmission failures is greater than or equal to a first preset threshold, network fault information is generated.

[0057] In the embodiment of the present application, during the automated firmware update process, the processor first attempts to transfer the first installation package to be updated to the target switch via Trivial File Transfer Protocol (TFTP). However, due to network problems, hardware failures or other unforeseen factors, the transmission may fail.

[0058] In order to effectively manage the transmission failure, the system will record the number of each transmission failure. By setting a preset threshold, the system can decide under what circumstances further action needs to be taken. This threshold is a pre-defined number that represents the maximum acceptable number of transmission failures.

[0059] If the number of failed transfers is less than this preset threshold, the processor will attempt to recover the target switch's firmware via the SPI bus. The SPI bus is a serial communication protocol that allows the processor to communicate directly with the switch's flash memory to perform firmware recovery. This recovery operation typically involves reading a known good firmware image from the processor's storage and writing it to the switch's flash memory via the SPI bus to replace the firmware that may be corrupted or incomplete.

[0060] Conversely, if the number of transmission failures reaches or exceeds a preset threshold, this may indicate a deeper network problem or hardware failure. In this case, the system will generate a network failure message.

[0061] Through this strategy, the system can not only automatically handle some common transmission problems, but also promptly notify technicians when encountering more serious problems, thereby ensuring that network devices can quickly and reliably update firmware while minimizing the risk of service interruption caused by update failures. This approach reflects the emphasis on automation, fault detection, and timely response in modern network device management.

[0062] Take the OTA update involving NXP SJA1110 switch chip and LX2160 processor as an example. Figure 2 The update flow chart provided in the embodiment of the present application is as follows: Figure 2 As shown, it includes: The new SJA1110 OTA image is transferred from the cloud to the LX2160Linux: The new firmware image is downloaded from the cloud server to the LX2160 processor running the Linux operating system.

[0063] LX2160 Linux starts the OTA process and transfers the OTA image to SJA1110 via TFTP protocol: LX2160 starts the OTA update process and sends the firmware image to SJA1110 using TFTP protocol.

[0064] The TFTP server on the SJA1110 software receives the image and writes it to the flash chip: The TFTP server on the SJA1110 receives the firmware image and stores it to the internal or external flash chip.

[0065] LX2160 resets SJA1110 to boot from the newly loaded image: LX2160 sends a reset signal to SJA1110, causing it to restart and boot from the newly written firmware image.

[0066] LX2160 verifies that SJA1110 is up and running properly: LX2160 checks that the SJA1110 is successfully up and running with the new firmware.

[0067] If the startup fails, the LX2160 starts the recovery process via the SPI bus: If the SJA1110 cannot start normally, the LX2160 will perform fault recovery via the SPI bus.

[0068] LX2160 downloads a recovery image from its root file system to the SJA1110 memory: LX2160 downloads a recovery image from its root file system (rootfs) to the SJA1110 memory.

[0069] SJA1110 runs from recovery image: The SJA1110 starts to boot and run from the recovery image to facilitate troubleshooting or recovery operations.

[0070] LX2160 sends the recovery image to the TFTP server of SJA1110 again to be written into the flash chip: LX2160 sends the recovery image again through the TFTP protocol. After receiving it, the TFTP server of SJA1110 writes it into the flash chip for use at the next startup.

[0071] The data updating device provided by the present invention is described below. The data updating device described below and the data updating method described above can be referenced to each other.

[0072] Figure 3 A schematic diagram of the structure of a data updating device provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, including: The transmission module 310 is used for transmitting the first installation package to be updated to the target switch through the simple file transfer protocol when the processor receives the first installation package to be updated; The update module 320 is used for writing the first installation package into the flash memory corresponding to the target switch when the first installation package is successfully transferred to the target switch by the simple file transfer protocol, and the target switch performs firmware update according to the first installation package; The recovery module 330 is used for, when the firmware update of the target switch fails, the processor recovers the firmware of the target switch through the SPI bus.

[0073] According to a data updating device provided by the present invention, the device is also used for: In the case where the firmware update of the target switch fails, the processor downloads a recovery installation package of the target switch from the root file system, and transmits the recovery installation package to a flash memory corresponding to the target switch through the SPI bus; The target switch performs firmware recovery according to the recovery installation package.

[0074] According to a data updating device provided by the present invention, the device is also used for: The processor again transmits the first installation package to the flash memory corresponding to the target switch through the simple file transfer protocol.

[0075] According to a data updating device provided by the present invention, the device is also used for: After the target switch successfully loads the first installation package, the processor sends a restart instruction to the target switch through a general input and output; After the target switch is restarted, further detecting the working state, network state and firmware state of the target switch; When the working state, network state and firmware state of the target switch are all normal, it is determined that the firmware update of the target switch is successful.

[0076] According to a data updating device provided by the present invention, the device is also used for: When the working state, network state or firmware state of the target switch is abnormal, it is determined that the firmware update of the target switch fails.

[0077] According to a data updating device provided by the present invention, the device is also used for: In the case where the simple file transfer protocol fails to successfully transmit the first installation package to the target switch, recording the number of transmission failures; When the number of transmission failures is less than a first preset threshold, the processor recovers the firmware of the target switch through the SPI bus; When the number of transmission failures is greater than or equal to a first preset threshold, network fault information is generated.

[0078] In an embodiment of the present application, the first installation package is first successfully transferred to the target switch for installation through a simple file transfer protocol, and in the event of installation failure, the SPI bus is selected to restore the firmware of the target switch, which improves the reliability of the system because the system can be quickly restored even if problems occur during the update process. Secondly, the automated update process reduces manual intervention, reduces operating costs and error rates. In addition, by remotely updating the firmware, security patches and performance improvements can be deployed more quickly, improving the security and performance of the system. Finally, this method also improves the maintainability of the system because the update and recovery process can be remotely controlled by software without physical contact with the device.

[0079] Figure 4 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 4 As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430 and a communication bus 440, wherein the processor 410, the communication interface 420 and the memory 430 communicate with each other through the communication bus 440. The processor 410 may call the logic instructions in the memory 430 to execute the data update method, which includes: when the processor receives a first installation package to be updated, transmitting the first installation package to the target switch through a simple file transfer protocol; When the simple file transfer protocol successfully transfers the first installation package to the target switch, the first installation package is written into a flash memory corresponding to the target switch, and the target switch performs a firmware update according to the first installation package; In the case that the firmware update of the target switch fails, the processor restores the firmware of the target switch through the SPI bus.

[0080] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0081] On the other hand, the present invention further provides a computer program product, the computer program product includes a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the data update method provided by the above methods, the method comprising: when the processor receives a first installation package to be updated, transmitting the first installation package to a target switch through a simple file transfer protocol; When the simple file transfer protocol successfully transfers the first installation package to the target switch, the first installation package is written into a flash memory corresponding to the target switch, and the target switch performs a firmware update according to the first installation package; In the case that the firmware update of the target switch fails, the processor restores the firmware of the target switch through the SPI bus.

[0082] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, the computer program being implemented when executed by a processor to execute the data updating method provided by the above methods, the method comprising: in a case where the processor receives a first installation package to be updated, transmitting the first installation package to a target switch through a simple file transfer protocol; When the simple file transfer protocol successfully transfers the first installation package to the target switch, the first installation package is written into a flash memory corresponding to the target switch, and the target switch performs a firmware update according to the first installation package; In the case that the firmware update of the target switch fails, the processor restores the firmware of the target switch through the SPI bus.

[0083] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0084] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0085] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A data updating method, characterized in that: include: When the processor receives the first installation package to be updated, the processor transmits the first installation package to the target switch through a simple file transfer protocol; When the simple file transfer protocol successfully transfers the first installation package to the target switch, the first installation package is written into a flash memory corresponding to the target switch, and the target switch performs a firmware update according to the first installation package; In the case that the firmware update of the target switch fails, the processor restores the firmware of the target switch through the SPI bus.

2. The data updating method according to claim 1, characterized in that: In the case that the firmware update of the target switch fails, the processor recovers the firmware of the target switch through the SPI bus, including: In the case where the firmware update of the target switch fails, the processor downloads a recovery installation package of the target switch from the root file system, and transmits the recovery installation package to a flash memory corresponding to the target switch through the SPI bus; The target switch performs firmware recovery according to the recovery installation package.

3. The data updating method according to claim 2, characterized in that: After the target switch performs the step of restoring the firmware according to the recovery installation package, the method further includes: The processor again transmits the first installation package to the flash memory corresponding to the target switch through the simple file transfer protocol.

4. The data updating method according to claim 1, characterized in that: Writing the first installation package into a flash memory corresponding to the target switch, and updating the firmware of the target switch according to the first installation package, includes: After the target switch successfully loads the first installation package, the processor sends a restart instruction to the target switch through a general input and output; After the target switch is restarted, further detecting the working state, network state and firmware state of the target switch; When the working state, network state and firmware state of the target switch are all normal, it is determined that the firmware update of the target switch is successful.

5. The data updating method according to claim 4, characterized in that: After the target switch is restarted, after the step of further detecting the working state, network state and firmware state of the target switch, the method further includes: When the working state, network state or firmware state of the target switch is abnormal, it is determined that the firmware update of the target switch fails.

6. The data updating method according to claim 1, characterized in that: In the case where the processor receives the first installation package to be updated, after the step of transmitting the first installation package to the target switch through the simple file transfer protocol, the method further includes: In the case where the simple file transfer protocol fails to successfully transmit the first installation package to the target switch, recording the number of transmission failures; When the number of transmission failures is less than a first preset threshold, the processor recovers the firmware of the target switch through the SPI bus; When the number of transmission failures is greater than or equal to a first preset threshold, network fault information is generated.

7. A data updating device, characterized in that: include: a transmission module, configured to transmit the first installation package to be updated to a target switch through a simple file transfer protocol when the processor receives the first installation package to be updated; An update module, configured to write the first installation package into a flash memory corresponding to the target switch when the first installation package is successfully transferred to the target switch by the simple file transfer protocol, so that the target switch performs a firmware update according to the first installation package; The recovery module is used for enabling the processor to recover the firmware of the target switch through the SPI bus when the firmware update of the target switch fails.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the data updating method according to any one of claims 1 to 6 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the data updating method according to any one of claims 1 to 6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the data updating method according to any one of claims 1 to 6 is implemented.

Citation Information

Cited By

  • Firmware recovery method and device in switching equipment interconnection scene, product and medium

    CN120743319A