Firmware upgrading method and device, electronic equipment and storage medium

By broadcasting device exception messages in the LAN and selecting the target device for firmware acquisition, the firmware upgrade problem caused by abnormal power outage of the device is solved, and stability and efficient recovery without increasing device and labor costs are achieved.

CN118939457APending Publication Date: 2024-11-12ZHEJIANG UNIVIEW TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310535001.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-10
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

During the process of upgrading the firmware of the shooting device, the equipment is powered off abnormally, etc., the lack of backup firmware space causes the equipment to not work properly. The existing technology requires increasing the equipment or labor costs, and the network cannot be restored when the network is abnormal.

Method used

By determining the exception partition of the abnormal device, generating device exception messages, broadcasting on the local area network, selecting the appropriate target device for firmware acquisition requests, realizing firmware upgrade exception recovery without increasing device and labor costs.

Benefits of technology

Improves the stability of equipment operation, avoids the inability to download firmware due to network abnormalities, and improves the efficiency and efficiency of firmware upgrade and recovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939457A_ABST
    Figure CN118939457A_ABST
Patent Text Reader

Abstract

The invention discloses a firmware upgrading method and device, electronic equipment and a storage medium. The method comprises the following steps: determining at least one abnormal partition of abnormal equipment, and generating an equipment abnormal message according to the abnormal partition; broadcasting the equipment exception message in a local area network where the abnormal equipment is located, wherein the equipment exception message is used for enabling other equipment in the local area network to judge whether firmware upgrading assistance can be provided or not; according to a received response message of the device exception message, at least one target device is determined in the devices sending the response message, and the response message comprises at least one of the following items: a firmware source, a network utilization rate and a transmission frequency; and sending a firmware acquisition request to the target device, and performing firmware upgrading on the abnormal partition according to the received firmware sent by the target device. By means of the technical scheme, firmware upgrading exception recovery is completed on the premise that the cost is not increased, and the stability of equipment operation is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Firmware upgrade of camera equipment is an important means of maintaining camera equipment. When upgrading the firmware, the camera equipment needs to erase the stored FLASH unit. If the camera equipment has abnormal power failure during the erasing process, the device will not work properly because the FLASH unit has no space reserved for backup firmware.

[0003] In order to solve the problem that the device cannot start due to abnormal conditions during the firmware upgrade process, the prior art can first reserve a firmware backup in the FLASH space, and obtain the firmware from the backup space for upgrading when the firmware upgrade fails. Second, the device can be upgraded manually, but these two firmware upgrade abnormal recovery methods require additional equipment or labor costs. Third, the firmware version can be downloaded from the network for firmware upgrade for the abnormal space in the FLASH. However, this firmware upgrade abnormal recovery method cannot recover the firmware upgrade by downloading the firmware version when the network is abnormal. Summary of the invention

[0004] The present invention provides a firmware upgrade method, device, electronic device and storage medium, so as to complete abnormal recovery of firmware upgrade without increasing equipment and labor costs, thereby improving the stability of equipment operation.

[0005] In a first aspect, an embodiment of the present invention provides a firmware upgrade method, the method comprising:

[0006] Determine at least one abnormal partition of the abnormal device, and generate a device abnormality message according to the abnormal partition;

[0007] Broadcasting the device abnormality message in the local area network where the abnormal device is located, wherein the device abnormality message is used to enable other devices in the local area network to determine whether to provide firmware upgrade assistance;

[0008] Determining at least one target device among the devices that sent the response message according to the received response message to the device abnormality message, wherein the response message includes at least one of the following: firmware source, network usage rate, and number of transmissions;

[0009] A firmware acquisition request is sent to the target device, and firmware is upgraded for the abnormal partition according to the received firmware sent by the target device.

[0010] In a second aspect, an embodiment of the present invention further provides a firmware upgrade device, the device comprising:

[0011] A device abnormality message generating module, used to determine at least one abnormal partition of the abnormal device, and generate a device abnormality message according to the abnormal partition;

[0012] A device abnormality message broadcasting module, used for broadcasting the device abnormality message in the local area network where the abnormal device is located, and the device abnormality message is used to enable other devices in the local area network to determine whether to provide firmware upgrade assistance;

[0013] A target device determination module, configured to determine at least one target device from among the devices that sent the response message according to the received response message to the device abnormality message, wherein the response message includes at least one of the following: firmware source, network usage rate, and number of transmissions;

[0014] The firmware acquisition module is used to send a firmware acquisition request to the target device, and upgrade the firmware of the abnormal partition according to the firmware sent by the target device.

[0015] In a third aspect, an embodiment of the present invention further 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, a firmware upgrade method as described in any one of the embodiments of the present invention is implemented.

[0016] In a fourth aspect, an embodiment of the present invention further provides a storage medium storing computer executable instructions, wherein the computer executable instructions, when executed by a computer processor, are used to execute a firmware upgrade method as described in any one of the embodiments of the present invention.

[0017] The technical solution of the embodiment of the present invention determines the abnormal partition in the abnormal device, generates a device abnormal message according to the abnormal partition, and broadcasts the device abnormal message in the local area network. After receiving the device abnormal message, other devices in the local area network can determine whether to provide firmware upgrade assistance to the abnormal device and feedback a response message. The abnormal device determines the target device to obtain firmware according to each response message received, and performs a firmware upgrade according to the obtained firmware. The problem of the abnormal recovery method of firmware upgrade in the prior art, which requires additional equipment or labor costs and is limited by network conditions, is solved, and the abnormal recovery of firmware upgrade is completed without increasing equipment and labor costs, thereby improving the stability of device operation.

[0018] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0020] Figure 1 is a flowchart of a firmware upgrade method provided by Embodiment 1 of the present invention;

[0021] Figure 2 is a flowchart of a firmware upgrade method provided by Embodiment 2 of the present invention;

[0022] Figure 3 It is a structural diagram of a firmware upgrade device provided by Embodiment 3 of the present invention;

[0023] Figure 4 It is a structural schematic diagram of an electronic device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION

[0024] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0026] Embodiment 1

[0027] Figure 1A flowchart of a firmware upgrade method is provided for the first embodiment of the present invention. This embodiment is applicable to the situation where, during a firmware upgrade of a device, the firmware upgrade is restored after a device abnormality occurs. The method can be executed by a firmware upgrade device, which can be implemented in the form of hardware and / or software. The firmware upgrade device can be configured in a terminal device, especially a shooting device, which is deployed in a local area network.

[0028] like Figure 1 As shown, the method includes:

[0029] S110. Determine at least one abnormal partition of an abnormal device, and generate a device abnormality message according to the abnormal partition.

[0030] When the device upgrades the firmware, it needs to erase the FLASH to ensure that the latest version of the firmware can take effect normally. The FLASH space can be partitioned according to the actual needs of the business, for example, it can be set to Env partition, Uboot partition, Kernel partition, Program partition, Config partition, and other user-defined partitions. Among them, the Env partition is used to store fixed environment variable information, FLASH type information, etc., and usually there is no need to upgrade the firmware of the Env partition. The Uboot partition is used to boot the system kernel, and usually there is no need to upgrade the firmware of the Uboot partition. The Kernel partition is used to store system kernel information and file systems. When there is a problem with the system kernel, the Kernel partition can be upgraded with firmware. The Program partition is used to store device business information. When the business function of the device is updated, the Program partition can be upgraded with firmware. The Config partition is used to store device configuration files, device models, serial numbers and other information. Usually there is no need to upgrade the firmware of the Config partition. On this basis, users can also customize the partition name and function according to the business needs of the device, and this embodiment does not limit this.

[0031] When the firmware of a device is updated, the device receives the latest version of the firmware sent by the firmware server through the network, and erases the FLASH. During the erasing process, if the device encounters an abnormal power outage, the erasing process is terminated, and the device is now an abnormal device. For abnormal devices, after they are powered on again, it is necessary to determine which specific partition or partitions are damaged, and re-acquire the firmware of the abnormal partition to restart the abnormal device. Specifically, according to the partition type and function of the above-mentioned FLASH space, usually only the Kernel partition, Program partition and some custom partitions can be upgraded for firmware. Therefore, it is necessary to determine whether the Kernel partition, Program partition and custom partition (if there is a custom partition) are abnormal.

[0032] Furthermore, determining at least one abnormal partition of the abnormal device may include: if it is determined that the kernel partition in the flash memory space of the abnormal device is abnormal, then determining the kernel partition and other upgradeable partitions as abnormal partitions; wherein the other upgradeable partitions include business partitions, or business partitions and custom partitions; if it is determined that the kernel partition in the flash memory space of the abnormal device is started normally, then determining the abnormal partition according to the file system.

[0033] Specifically, if the abnormal device occurs when erasing the kernel partition (also known as the Kernel partition), the kernel partition is damaged, and after the device is powered on again, the Kernel partition cannot be booted and started through the Uboot partition. Therefore, if the Uboot partition detects that the Kernel partition cannot be started normally, it is determined that the Kernel partition is abnormal. At this time, since it is only when the Kernel partition is started normally that it can be confirmed whether the Program partition and the custom partition are normal, therefore, when an abnormality occurs in the Kernel partition, the Kernel partition, the Program partition and the custom partition (if a custom partition exists) are taken as abnormal partitions, and the corresponding firmware is obtained separately, so as to avoid the situation where the Program partition and the custom partition are found to be abnormal again after the firmware corresponding to the Kernel partition is upgraded, thereby improving the stability of the firmware upgrade.

[0034] If the Kernel partition starts normally, the file system mounted on the Kernel partition starts normally. It is possible to determine which partition is abnormal based on the file system, and treat the partition with the abnormality as an abnormal partition.

[0035] S120: Broadcast the device abnormality message in the local area network where the abnormal device is located.

[0036] The device abnormality message is used to enable other devices in the local area network to determine whether they can provide firmware upgrade assistance.

[0037] In this embodiment, the abnormal device forms a local area network through a wired network port and other devices, and the abnormal device can communicate with other devices in the local area network through the wired network. The abnormal device broadcasts the device abnormality message in the local area network, and other devices in the local area network receive the device abnormality message. Since the device abnormality message contains the abnormal partition of the abnormal device, other devices in the local area network can determine that the firmware upgrade of the abnormal partition of the abnormal device has failed based on the device abnormality message, and determine whether to provide the abnormal device with firmware upgrade assistance for the abnormal partition.

[0038] Specifically, other devices in the local area network can determine whether they can provide firmware upgrade assistance for the abnormal partition of the abnormal device by judging whether the firmware required for upgrading the abnormal partition of the abnormal device is stored locally, or judging whether the firmware required for upgrading the abnormal partition of the abnormal device can be downloaded.

[0039] S130. Determine at least one target device among the devices that send the response message according to the received response message to the device abnormality message.

[0040] The response message includes at least one of the following: firmware source, network usage rate, and transmission times.

[0041] Furthermore, the firmware source includes local storage and network download; the network usage rate is the network bandwidth usage rate for downloading the firmware through the network when the device sending the response message determines that the firmware source is network download; the number of transmissions is calculated based on the current remaining memory and firmware size when the device sending the response message determines that the firmware source is network download.

[0042] It is understandable that when the device has firmware stored locally, it is faster to transfer the firmware to the abnormal device. Therefore, devices with firmware stored locally are preferred for firmware upgrade assistance. For devices that require network downloads, the lower the network usage, the less impact the firmware transfer will have on other normal services of the device providing firmware upgrade assistance. Therefore, devices with low network usage are preferred for firmware upgrade assistance. The fewer the number of transmissions, the shorter the time required to transfer the firmware, and the less impact the firmware transfer will be on network fluctuations. Therefore, devices with a small number of transmissions are preferred for firmware upgrade assistance.

[0043] In this embodiment, if other devices in the local area network determine that they can provide firmware upgrade assistance for the abnormal partition to the abnormal device after receiving the device abnormality message, a response message is fed back to the abnormal device. The abnormal device determines the target device that actually provides firmware upgrade assistance for the abnormal partition based on each response message received within a preset time period.

[0044] Specifically, the abnormal device screens each response message received within a preset time period according to the abnormal partition. Based on the response message, the abnormal partitions for which each device sending the response message can provide firmware upgrade assistance are determined, and each device sending the response message is classified. If there is only one device that provides firmware upgrade assistance for a certain abnormal partition, then the device is determined to be the target device corresponding to the abnormal partition. If there are multiple devices that provide firmware upgrade assistance for a certain abnormal partition, for each device that can provide firmware upgrade assistance for the abnormal partition, the target device corresponding to the abnormal partition can be determined in each device based on the firmware source, network usage, and number of firmware transmissions. This setting can improve the efficiency of other devices in transmitting firmware to abnormal devices, thereby increasing the speed of firmware upgrade recovery.

[0045] For example, the abnormal partitions are the Kernel partition and the Program partition. If a response message 1 sent by device 1, a response message 2 sent by device 2, and a response message 3 sent by device 3 are received within a preset time period, wherein response message 1 indicates that device 1 can provide firmware upgrade assistance for the Kernel partition, response message 2 indicates that device 2 can provide firmware upgrade assistance for the Kernel partition, and response message 3 indicates that device 3 can provide firmware upgrade assistance for both the Kernel partition and the Program partition. It can be seen that only device 3 can provide firmware upgrade assistance for the Program partition, and therefore, device 3 is determined to be the target device corresponding to the Program partition. If devices 1, 2, and 3 can all provide firmware upgrade assistance for the Kernel partition, then the target device corresponding to the Kernel partition is determined among devices 1, 2, and 3 based on the firmware sources, network usage, and firmware transmission times of devices 1, 2, and 3.

[0046] S140: Send a firmware acquisition request to the target device, and upgrade the firmware of the abnormal partition according to the received firmware sent by the target device.

[0047] In this embodiment, after the abnormal device determines the target device corresponding to the abnormal partition, it sends a firmware acquisition request to the target device. After receiving the firmware acquisition request, the target device sends the firmware corresponding to the abnormal partition stored locally or the firmware corresponding to the abnormal partition downloaded from the firmware server to the abnormal device. After the abnormal device receives the firmware corresponding to the abnormal partition sent by the target device, it re-upgrades the firmware of the abnormal partition according to the firmware.

[0048] The technical solution of this embodiment, since the abnormal device can communicate with other devices in the local area network through a wired network, therefore, by determining the target device that can provide assistance for the abnormal partition firmware upgrade, and obtaining the firmware corresponding to the abnormal partition through communication with the target device, it can avoid the situation where the firmware cannot be downloaded due to network anomalies between the abnormal device and the firmware server, and improve the self-recovery ability of the device after the device upgrade fails due to abnormal conditions during the firmware upgrade. At the same time, when there are multiple abnormal partitions, if the corresponding target devices are different, it is possible to establish a connection with the target devices corresponding to each abnormal partition at the same time, and obtain the corresponding firmware from multiple target devices at the same time, thereby improving the recovery efficiency of the abnormal device.

[0049] The technical solution of the embodiment of the present invention determines the abnormal partition in the abnormal device, generates a device abnormal message according to the abnormal partition, and broadcasts the device abnormal message in the local area network. After receiving the device abnormal message, other devices in the local area network can determine whether to provide firmware upgrade assistance to the abnormal device and feedback a response message. The abnormal device determines the target device to obtain firmware according to each response message received, and performs a firmware upgrade according to the obtained firmware. The problem of the abnormal recovery method of firmware upgrade in the prior art, which requires additional equipment or labor costs and is limited by network conditions, is solved, and the abnormal recovery of firmware upgrade is completed without increasing equipment and labor costs, thereby improving the stability of device operation.

[0050] Furthermore, the method also includes: if it is determined that no response message to the device abnormality message is received, receiving address resolution protocol request messages from other devices in the local area network where the abnormal device is located; determining a network segment that matches the local area network where the abnormal device is located based on each address resolution protocol request message; modifying the Internet Protocol address of the abnormal device based on the network segment that matches the local area network where the abnormal device is located; based on the modified Internet Protocol address, sending a firmware download request to a firmware server, and performing a firmware upgrade based on the firmware received from the firmware server.

[0051] The address resolution protocol request message is also known as an ARP (Address Resolution Protocol) request message, and the Internet Protocol address is also known as an IP (Internet Protocol) address.

[0052] In this embodiment, if the abnormal device does not receive a response message to the device abnormality message within a preset time period, the IP address of the firmware server is obtained based on the Config partition of the abnormal device, and a firmware download request is sent to the firmware server. After the firmware server receives the firmware download request, the firmware corresponding to the abnormal partition is sent to the local area network. The abnormal device can obtain the firmware corresponding to the abnormal partition for firmware upgrade.

[0053] Specifically, since the IP address of the device in the LAN is usually a private address, it cannot communicate directly with the firmware server. Therefore, the abnormal device monitors the ARP request message in the LAN. The ARP request message is a message sent by the device in the LAN after the device is started or at a fixed time. The abnormal device can obtain the current network segment of the LAN by parsing the ARP request message. The private IP address of the abnormal device is modified to the network segment of the LAN, and the LAN egress gateway can send the firmware download request of the abnormal device to the firmware server.

[0054] Embodiment 2

[0055] Figure 2 A flowchart of a firmware upgrade method provided for Embodiment 2 of the present invention. Based on the above embodiments, this embodiment of the present invention further specifies the process of determining abnormal partitions, the specific composition of device abnormality messages and response messages, the process of determining the target device based on the received response message, and the process of sending a firmware acquisition request to the target device.

[0056] like Figure 2 As shown, the method includes:

[0057] S210, determining whether the kernel partition in the flash memory space of the abnormal device is abnormal, if so, executing S220, otherwise executing S230.

[0058] S220: Determine that the kernel partition and other upgradeable partitions are abnormal partitions.

[0059] S230: Determine the abnormal partition according to the file system.

[0060] Specifically, if the Uboot partition detects that the Kernel partition cannot be started normally, the Kernel partition is abnormal, and the kernel partition and other upgradeable partitions are abnormal partitions. If the Kernel partition is started normally and the file system is mounted, the abnormal partition can be determined based on the file system.

[0061] S240: Generate a device abnormality message according to the abnormal partition.

[0062] The device abnormality message includes the device model, device serial number and abnormal partition information of the abnormal device. The device model is used to enable other devices in the local area network to determine whether they match the device model of the abnormal device; the abnormal partition information is used to enable other devices that match the device model to determine whether they can provide firmware that matches the abnormal partition.

[0063] Table 1 provides a format diagram of a device abnormality message. As shown in Table 1, the device abnormality message includes: message type, command word, device model, device serial number, and partition information. Since the abnormal device needs to broadcast the device abnormality message in the local area network, the message type of the device abnormality message is broadcast, and the command word is used to instruct other devices in the local area network to respond according to the device abnormality message. The device model of the abnormal device is IPC-TYPEA, the device serial number is DEVSNA, and the abnormal partitions of the abnormal device are Kernel partition and Program partition.

[0064] Table 1

[0065] Message Type Command word Device Model Device serial number Partition information broadcast FirmRecovery IPC-TYPEA DEVSNA Kernel / Program

[0066] S250: Broadcast the device abnormality message in the local area network where the abnormal device is located.

[0067] The device abnormality message will be broadcast to all devices in the LAN. When other devices in the LAN (such as DevB) receive the device abnormality message, they will parse the content of the device abnormality message.

[0068] S260: Screen each response message according to the device serial number of each response message and the device serial number of the abnormal device.

[0069] The response message also includes the device serial number and the abnormal partition corresponding to the firmware.

[0070] Among them, the device serial number in the response message is used to enable the abnormal device to compare the device serial number with its own device serial number. If they are consistent, it means that the response message is a response message that matches the device abnormal message. If they are inconsistent, the response message will be screened out. Table 2 provides a format diagram of a response message. As shown in Table 2, the response message includes: message type, command word, device serial number, partition name, firmware source, network usage, number of transmissions, and device IP. Taking Table 1 and Table 2 as an example, the device serial number of the abnormal device is DEVSNA, and the device serial number in the response message is also DEVSNA. Therefore, it is determined that the response message is a valid response message that matches the device abnormal message and does not need to be screened out.

[0071] Table 2

[0072]

[0073] In this embodiment, if other devices in the local area network receive a device exception message, they will parse the device model and abnormal partition information in the device exception message, and determine whether the device model in the device exception message is consistent with the model of the device itself. If they are consistent, they will continue to determine whether the device locally stores the firmware corresponding to the abnormal partition, or whether the firmware corresponding to the abnormal partition can be downloaded.

[0074] If the device has the firmware corresponding to the abnormal partition stored locally, the source of the firmware is local storage. If the device does not have the firmware corresponding to the abnormal partition stored locally, continue to determine whether the current network status of the device can support the download of the firmware corresponding to the abnormal partition. If the firmware corresponding to the abnormal partition can be downloaded, the source of the firmware is network download. When the source of the firmware is network download, the device also needs to feedback the current network bandwidth usage of the device.

[0075] When the device determines that it can provide firmware upgrade assistance, it also needs to obtain the memory usage of the device itself, and calculate the number of firmware transmissions based on the current remaining memory of the device and the size of the firmware to be downloaded. Specifically, when the device downloads the firmware, it can only store the firmware in the memory, so it is necessary to obtain the current memory usage. Since the device is assisting abnormal devices in firmware upgrades, the device's firmware download cannot affect the normal operation of its own business, so it is necessary to reserve some memory to avoid abnormal business operation. Therefore, the number of transmissions is calculated by first calculating the difference between the current remaining memory and the business reserved memory, then dividing the firmware size by the difference, and rounding up the obtained value to obtain the number of transmissions. For example, the current remaining memory is 12MB, the firmware size is 14MB, and the business reserved memory is 6MB. Then the number of transmissions required = 14 / (12-6) = 2.33, rounded up to 3, so the number of transmissions is 3 times.

[0076] The device also needs to send its IP address to the abnormal device so that the abnormal device can communicate with the device point-to-point based on the IP address and obtain the firmware sent by the device.

[0077] S270: Classify the filtered response messages according to the abnormal partitions corresponding to the firmware.

[0078] In this embodiment, each response message is classified according to the abnormal partition corresponding to the firmware that can be provided by other devices in the response message, that is, for different abnormal partitions, the corresponding target device is determined according to the corresponding response message.

[0079] S280. Determine a target response message corresponding to the target abnormal partition according to the firmware source, network usage rate, and number of transmissions of each response message corresponding to the target abnormal partition.

[0080] In this embodiment, when there are multiple response messages corresponding to the target abnormal partition, a sending device of the response message whose firmware source is local storage, has low network usage and few transmission times is preferentially selected as the target device.

[0081] Further, S280 may include: determining the target response message among the response messages corresponding to the target abnormal partition based on the firmware source, network usage and transmission times, firmware source weight, network usage weight and transmission times weight of each response message corresponding to the target abnormal partition.

[0082] Specifically, weights may be assigned to the firmware source, network usage rate, and number of transmissions, respectively, and the index value of the firmware source may be determined according to the type of the firmware source, the index value of the network usage rate may be determined according to the range in which the network usage rate is located, and the index value of the number of transmissions may be determined according to different values ​​of the number of transmissions. The evaluation value of the response message may be calculated based on the sum of the product of the weight of the firmware source and the index value, the product of the weight of the network usage rate and the index value, and the product of the weight of the number of transmissions and the index value, and the device sending the response message with the highest evaluation value may be selected as the target device.

[0083] Taking the device abnormality message as the device abnormality message in Table 1 as an example, Table 3 provides a schematic table of response messages received by the abnormal device within a preset time period. As shown in Table 3, the serial number of each response message is DEVSNA, so it is confirmed that each response message is a response message that matches the device abnormality message.

[0084] Table 3

[0085]

[0086] For the Kernel partition, the target device corresponding to the Kernel partition is determined based on the firmware source, network usage rate, and transmission times of response message 1 and response message 2. For the Program partition, the target device corresponding to the Program partition is determined based on the firmware source, network usage rate, and transmission times of response message 1, response message 3, and response message 4.

[0087] S290. The device that sends the target response message is used as the target device corresponding to the target abnormal partition.

[0088] S2100. Modify the Internet Protocol address of the abnormal device according to the Internet Protocol address in the response message corresponding to the target device.

[0089] The response message also includes an Internet Protocol address of a device that sends the response message.

[0090] In this embodiment, after the target device is determined, the IP address of the abnormal device is modified to the IP address of the network segment corresponding to the IP address of the target device, so that point-to-point communication between the abnormal device and the target device can be achieved through unicast communication.

[0091] S2110: Send a firmware acquisition request to the target device in a unicast communication manner.

[0092] Table 4 provides a format diagram of a firmware acquisition request. As shown in Table 4, the firmware acquisition request is used to request the target device to send the firmware corresponding to the abnormal partition to the abnormal device.

[0093] Table 4

[0094] Message Type Command word Device IP Required partition firmware Unicast FirmGet 192.168.1.12 kernel

[0095] S2120. Perform a firmware upgrade on the abnormal partition according to the firmware received from the target device.

[0096] After receiving the firmware acquisition request, the target device can first feedback the firmware size and the number of transmissions to the abnormal device, so that the abnormal device can determine whether the firmware is completely received. If the source of the firmware is local storage, the target device directly feeds back the locally stored firmware to the abnormal device. If the source of the firmware is downloaded from the network, the target device downloads the firmware corresponding to the abnormal partition required by the abnormal device from the firmware server and transmits it to the abnormal device in a timely manner. When the number of transmissions exceeds 2 times, it means that the current remaining memory of the target device is not enough to store all the downloaded firmware. Therefore, when the abnormal device has received part of the firmware transmitted in the previous time, the target device needs to release the firmware in the memory in time, and then download part of the firmware required for the next transmission from the firmware server until the download and transmission of all the firmware are completed.

[0097] The abnormal device determines whether the firmware transfer is complete based on the firmware size and transfer times fed back by the target device. After the abnormal device determines that all the firmware corresponding to the abnormal partition has been received, the firmware upgrade command is used to restore the firmware upgrade of the abnormal device.

[0098] Embodiment 3

[0099] Figure 3 This is a schematic diagram of the structure of a firmware upgrade device provided by Embodiment 3 of the present invention. Figure 3 As shown, the device includes: a device abnormality message generating module 310, a device abnormality message broadcasting module 320, a target device determining module 330 and a firmware obtaining module 340. Among them:

[0100] The device abnormality message generating module 310 is used to determine at least one abnormal partition of the abnormal device and generate a device abnormality message according to the abnormal partition;

[0101] The device abnormality message broadcast module 320 is used to broadcast the device abnormality message in the local area network where the abnormal device is located, and the device abnormality message is used to enable other devices in the local area network to determine whether to provide firmware upgrade assistance;

[0102] The target device determination module 330 is used to determine at least one target device from each device that sends a response message according to a received response message to the device abnormality message, wherein the response message includes at least one of the following: firmware source, network usage rate, and transmission times;

[0103] The firmware acquisition module 340 is used to send a firmware acquisition request to the target device, and perform firmware upgrade on the abnormal partition according to the firmware sent by the target device.

[0104] The technical solution of the embodiment of the present invention determines the abnormal partition in the abnormal device, generates a device abnormal message according to the abnormal partition, and broadcasts the device abnormal message in the local area network. After receiving the device abnormal message, other devices in the local area network can determine whether to provide firmware upgrade assistance to the abnormal device and feedback a response message. The abnormal device determines the target device to obtain firmware according to each response message received, and performs a firmware upgrade according to the obtained firmware. The problem of the abnormal recovery method of firmware upgrade in the prior art, which requires additional equipment or labor costs and is limited by network conditions, is solved, and the abnormal recovery of firmware upgrade is completed without increasing equipment and labor costs, thereby improving the stability of device operation.

[0105] Based on the above embodiment, the device abnormality message generating module 310 includes:

[0106] A first abnormal partition determining unit, configured to determine the kernel partition and other upgradeable partitions as abnormal partitions if it is determined that the kernel partition in the flash memory space of the abnormal device is abnormal;

[0107] Wherein, the other upgradeable partitions include business partitions, or business partitions and custom partitions;

[0108] The second abnormal partition determining unit is configured to determine the abnormal partition according to the file system if it is determined that the kernel partition in the flash memory space of the abnormal device is started normally.

[0109] Based on the above embodiment, the device abnormality message includes the device model, device serial number and abnormal partition information of the abnormal device;

[0110] The device model is used to enable other devices in the local area network to determine whether the device model matches the device model of the abnormal device;

[0111] The abnormal partition information is used to enable other devices matching the device model to determine whether they can provide firmware matching the abnormal partition.

[0112] Based on the above embodiment, the response message further includes the device serial number and the abnormal partition corresponding to the firmware;

[0113] The target device determination module 330 includes:

[0114] A device serial number comparison unit, used to screen each response message according to the device serial number of each response message and the device serial number of the abnormal device;

[0115] A response message classification unit, used for classifying each filtered response message according to the abnormal partition corresponding to the firmware;

[0116] A target response message determination unit, configured to determine a target response message corresponding to a target abnormal partition according to a firmware source, a network usage rate, and a number of transmissions of each response message corresponding to the target abnormal partition;

[0117] The target device determining unit is used to determine the device that sends the target response message as the target device corresponding to the target abnormal partition.

[0118] On the basis of the above embodiment, the firmware source includes local storage and network download; the network usage rate is the network bandwidth usage rate of the device sending the response message for downloading the firmware through the network when the device determines that the firmware source is network download; the number of transmissions is calculated according to the current remaining memory and the firmware size when the device sending the response message determines that the firmware source is network download;

[0119] The target response message determination unit is specifically used to:

[0120] According to the firmware source, network usage rate and transmission times, firmware source weight, network usage rate weight and transmission times weight of each response message corresponding to the target abnormal partition, the target response message is determined in each response message corresponding to the target abnormal partition.

[0121] Based on the above embodiment, the response message further includes an Internet Protocol address of a device sending the response message;

[0122] The firmware acquisition module 340 includes:

[0123] An Internet Protocol address modification unit, configured to modify the Internet Protocol address of the abnormal device according to the Internet Protocol address in the response message corresponding to the target device;

[0124] The firmware acquisition request sending unit is used to send a firmware acquisition request to the target device in a unicast communication manner.

[0125] Based on the above embodiment, the device further includes:

[0126] An address resolution protocol request message receiving module, configured to receive address resolution protocol request messages from other devices in the local area network where the abnormal device is located if it is determined that no response message to the device abnormal message has been received;

[0127] A network segment determination module, used to determine a network segment matching the local area network where the abnormal device is located according to each address resolution protocol request message;

[0128] An Internet Protocol address modification module, used to modify the Internet Protocol address of the abnormal device according to the network segment matching the local area network where the abnormal device is located;

[0129] The firmware download request sending module is used to send a firmware download request to a firmware server based on the modified Internet Protocol address, and perform firmware upgrade according to the firmware received from the firmware server.

[0130] The firmware upgrade device provided in the embodiment of the present invention can execute the firmware upgrade method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0131] Embodiment 4

[0132] Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0133] like Figure 4As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0134] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0135] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a firmware upgrade method.

[0136] In some embodiments, the firmware upgrade method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the firmware upgrade method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the firmware upgrade method in any other appropriate manner (e.g., by means of firmware).

[0137] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0138] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0139] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0140] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0141] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0142] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0143] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0144] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A firmware upgrade method, It is characterized in that include: Determine at least one abnormal partition of the abnormal device, and generate a device abnormality message according to the abnormal partition; Broadcasting the device abnormality message in the local area network where the abnormal device is located, wherein the device abnormality message is used to enable other devices in the local area network to determine whether to provide firmware upgrade assistance; Determining at least one target device among the devices that sent the response message according to the received response message to the device abnormality message, wherein the response message includes at least one of the following: firmware source, network usage rate, and number of transmissions; A firmware acquisition request is sent to the target device, and firmware is upgraded for the abnormal partition according to the received firmware sent by the target device.

2. The method according to claim 1, It is characterized in that Determining at least one abnormal partition of the abnormal device includes: If it is determined that the kernel partition in the flash memory space of the abnormal device is abnormal, the kernel partition and other upgradeable partitions are determined to be abnormal partitions; Wherein, the other upgradeable partitions include business partitions, or business partitions and custom partitions; If it is determined that the kernel partition in the flash memory space of the abnormal device is started normally, the abnormal partition is determined according to the file system.

3. The method according to claim 1, It is characterized in that The device abnormality message includes the device model, device serial number and abnormal partition information of the abnormal device; The device model is used to enable other devices in the local area network to determine whether the device model matches the device model of the abnormal device; The abnormal partition information is used to enable other devices matching the device model to determine whether they can provide firmware matching the abnormal partition.

4. The method according to claim 3, It is characterized in that The response message also includes the device serial number and the abnormal partition corresponding to the firmware; According to the received response message to the device abnormality message, a target device is determined among the devices that sent the response message, including: Screening each response message according to the device serial number of each response message and the device serial number of the abnormal device; Classify the filtered response messages according to the abnormal partitions corresponding to the firmware; Determine a target response message corresponding to the target abnormal partition according to the firmware source, network usage rate, and transmission times of each response message corresponding to the target abnormal partition; The device that sends the target response message is regarded as the target device corresponding to the target abnormal partition.

5. The method according to claim 4, It is characterized in that The firmware source includes local storage and network download; The network usage rate is the network bandwidth usage rate of the device sending the response message for downloading the firmware through the network when the device determines that the source of the firmware is downloaded from the network; The number of transmissions is calculated based on the current remaining memory and the size of the firmware when the device sending the response message determines that the source of the firmware is downloaded from the network; According to the firmware source, network usage rate and transmission times of each response message corresponding to the target abnormal partition, determining the target response message corresponding to the target abnormal partition includes: According to the firmware source, network usage rate and transmission times, firmware source weight, network usage rate weight and transmission times weight of each response message corresponding to the target abnormal partition, the target response message is determined in each response message corresponding to the target abnormal partition.

6. The method according to claim 3, It is characterized in that The response message also includes an Internet Protocol address of a device sending the response message; Sending a firmware acquisition request to the target device includes: Modify the Internet Protocol address of the abnormal device according to the Internet Protocol address in the response message corresponding to the target device; A firmware acquisition request is sent to the target device in a unicast communication manner.

7. The method according to claim 1, It is characterized in that The method further comprises: If it is determined that no response message to the device abnormality message has been received, receiving an address resolution protocol request message from other devices in the local area network where the abnormal device is located; Determine, according to each address resolution protocol request message, a network segment matching the local area network where the abnormal device is located; Modify the Internet Protocol address of the abnormal device according to the network segment matching the local area network where the abnormal device is located; Based on the modified Internet Protocol address, a firmware download request is sent to the firmware server, and the firmware is upgraded according to the firmware received from the firmware server.

8. A firmware upgrade device, It is characterized in that include: A device abnormality message generating module, used for determining at least one abnormal partition of the abnormal device, and generating a device abnormality message according to the abnormal partition; A device abnormality message broadcasting module, used for broadcasting the device abnormality message in the local area network where the abnormal device is located, and the device abnormality message is used to enable other devices in the local area network to determine whether to provide firmware upgrade assistance; a target device determination module, configured to determine at least one target device from among the devices that sent the response message according to the received response message to the device abnormality message, wherein the response message includes at least one of the following: firmware source, network usage rate, and number of transmissions; The firmware acquisition module is used to send a firmware acquisition request to the target device, and upgrade the firmware of the abnormal partition according to the firmware sent by the target device.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the firmware upgrade method as described in any one of claims 1 to 7 is implemented.

10. A storage medium storing computer executable instructions, It is characterized in that The computer executable instructions are used to execute the firmware upgrade method as described in any one of claims 1 to 7 when executed by a computer processor.