Method and system for automatically upgrading batch firmware before delivery of network equipment
By adding bootp protocol support to the router's bootloader, and using preset key monitoring and server-side feedback to achieve an automated upgrade process, the problem of inefficient router firmware upgrade in the existing technology is solved, and efficient and automated firmware upgrade is achieved .
Patent Information
- Application Number
- CN202411663045.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-02-14
AI Technical Summary
The prior art is inefficient when a router is upgraded before leaving the factory, requiring manual operation, and cannot achieve automated and asynchronous parallel processing.
By adding bootp protocol support to the router's bootloader, and monitoring in real time whether the preset button is continuously pressed and held, broadcasting the first message to trigger the upgrade process, receiving the second message feedback from the server to obtain the upgrade file, And automatically perform the upgrade.
It realizes automated and asynchronous parallel processing of firmware upgrades before the router leaves the factory, improves upgrade efficiency, reduces labor costs, and enhances the reliability and monitoring of the upgrade process.
Smart Images

Figure CN119449606A_ABST
Abstract
Description
Technical Field
[0001] The embodiment of the present invention relates to the technical field of network equipment upgrade, and in particular to a system for automatically upgrading batch firmware of network equipment before delivery. Background Art
[0002] Routers are indispensable terminal communication products in modern life and have been deployed in tens of millions of households. With the popularization of WIFI6 and WIFI7 technologies, old 802.11n and 802.11ac terminal devices cannot adapt to the current gigabit network environment due to old technology and low speed. Driven by the Ministry of Industry and Information Technology and operators, millions of home WIFI routers are upgraded, replaced or deployed every year. Under such large-scale demand, factory batch production often needs to be upgraded to a specified version before it can be shipped due to version updates, patch repairs or function customization. It is no longer possible to remove the Flash of finished routers one by one and burn new firmware.
[0003] If you use the router runtime environment to upgrade via WEB, Telnet, SSH, etc., you will not only need to wait for the router to start up normally before you can proceed, but you may also upgrade the wrong version of firmware due to human error. This is not only time-consuming and labor-intensive, but also inefficient. Summary of the invention
[0004] The embodiment of the present invention provides a method and system for automatically upgrading batch firmware of routers before leaving the factory, which realizes the automatic and asynchronous parallel processing of firmware upgrading of routers before leaving the factory, improves the upgrading efficiency and reduces the labor cost.
[0005] To achieve the above-mentioned purpose, in a first aspect, the present invention provides a method for automatically upgrading batch firmware of a network device before it leaves the factory, which is applied to a network device, wherein the network device is connected to a server through a switch, and the method for automatically upgrading batch firmware of the network device before it leaves the factory comprises:
[0006] Real-time monitoring of whether the preset button is continuously pressed for the preset time;
[0007] If the preset button is continuously pressed for the preset time, broadcasting and sending a first message;
[0008] receiving a second message fed back by the server, and acquiring a corresponding preset upgrade file from the server based on the second message;
[0009] Execute the preset upgrade file to complete the upgrade.
[0010] In one embodiment of the present invention, the real-time monitoring of whether the preset button is continuously pressed for a preset time further includes:
[0011] The bootp protocol support is added to the boot loader, wherein after the router is powered on, the hardware self-checks and starts to execute the boot loader.
[0012] In one embodiment of the present invention, the real-time monitoring of whether the preset button is continuously pressed for a preset time further includes:
[0013] If the preset button is not pressed continuously for the preset time, the system environment is entered.
[0014] In one embodiment of the present invention, the receiving of the second message fed back by the server, and obtaining the corresponding preset upgrade file from the server based on the second message includes:
[0015] receiving the second message fed back by the server;
[0016] Parse the second message to obtain the local IP address, subnet mask, version information, and server IP address;
[0017] Compare the current firmware version with the version information to determine whether an upgrade is required;
[0018] If an upgrade is required, determine the best upgrade path;
[0019] Configuring the router based on the IP address of the entity and the subnet mask;
[0020] Based on the server IP address and the optimal upgrade path, the corresponding preset upgrade file is obtained from the server, wherein the indicator light of the router continues to flash.
[0021] In one embodiment of the present invention, the receiving of the second message fed back by the server, and obtaining the corresponding preset upgrade file from the server based on the second message further includes:
[0022] Verifying the integrity of the preset upgrade file;
[0023] If the verification is successful, the preset upgrade file is written into the Flash.
[0024] In the second aspect, the present invention provides a system for automatically upgrading the batch firmware of network equipment before it leaves the factory, which is applied to the network equipment, and the network equipment is connected to the server end through a switch. The system for automatically upgrading the batch firmware of the network equipment before it leaves the factory includes: a monitoring module, a sending module, an acquisition module and an execution module. The monitoring module is used to monitor in real time whether the preset button is continuously pressed for a preset time. The sending module is used to broadcast a first message if the preset button is continuously pressed for the preset time. The acquisition module is used to receive a second message fed back by the server end, and obtain the corresponding preset upgrade file from the server end based on the second message. And the execution module is used to execute the preset upgrade file to complete the upgrade.
[0025] In one embodiment of the present invention, the network device batch firmware automatic upgrade system before leaving the factory also includes an adding module for adding bootp protocol support to the boot loader, wherein after the router is powered on, the hardware self-checks and starts executing the boot loader.
[0026] In one embodiment of the present invention, the network device pre-shipment batch firmware automatic upgrade system further includes a boot module for booting into a system environment if the preset button is not continuously pressed for the preset time.
[0027] In a third aspect, the present invention provides an electronic device, comprising:
[0028] at least one processor; and
[0029] a memory communicatively coupled to the at least one processor;
[0030] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned method for automatically upgrading batch firmware of network devices before leaving the factory.
[0031] In a fourth aspect, the present invention provides a computer-readable storage medium, including a computer program and instructions. When the computer program or the instructions are executed on a computer, the computer executes the method for automatic batch firmware upgrade of network devices before shipment as described above.
[0032] Compared with the prior art, the method and system for automatically upgrading batch firmware of network devices before delivery according to the present invention has the following beneficial effects:
[0033] 1. The process from powering on the router to entering the automatic upgrade process is extremely fast. It only takes about 6 seconds in actual measurement, and there is no need to wait for the system to fully start;
[0034] 2. The entire upgrade process can be carried out without the assistance of a PC, and as soon as the indicator light of the router starts flashing, the next power-on upgrade can be started, and the upgrade operation can be performed asynchronously and in parallel;
[0035] 3. Added the Reset button detection function to prevent accidental upgrades;
[0036] 4. It realizes the automation and asynchronous parallel processing of router firmware upgrade before leaving the factory, which improves the upgrade efficiency and reduces labor costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is a flowchart of a method for automatically upgrading batch firmware of network devices before leaving the factory in the first embodiment of the present invention;
[0038] Figure 2 This is a structural diagram of a system for automatically upgrading batch firmware of network devices before they leave the factory in Embodiment 2 of the present invention;
[0039] Figure 3 is a schematic diagram of the network architecture in Embodiment 1 and Embodiment 2 of the present invention;
[0040] Figure 4 It is a logical flow diagram of a method for automatically upgrading batch firmware of network devices before leaving the factory according to a specific embodiment of the present invention;
[0041] Figure 5 It is a structural schematic diagram of an electronic device in Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0042] The embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the embodiments of the present invention, rather than to limit the embodiments of the present invention. It is also necessary to explain that, for ease of description, only parts related to the embodiments of the present invention are shown in the accompanying drawings, rather than all structures.
[0043] To facilitate understanding, the main implementation concepts of the embodiments of the present invention are first briefly described.
[0044] When a factory produces routers, it is often necessary to perform one or more firmware upgrades before they leave the factory due to version updates, patch repairs, or function customization. Generally, there are two most common solutions for upgrading router firmware. One is to open the WEB management interface to upload the firmware file for upgrading when the router is running, and the other is to interrupt the kernel boot when the router is powered on, enter the bootloader environment and enter the upgrade command for TFTP upgrade.
[0045] Routers generally have TFTP upgrade functions in the bootloader environment and WEB upgrade functions in the runtime environment, or they can be upgraded in the runtime environment such as Telnet and SSH. However, due to communication security reasons, normal mass-produced routers are not allowed to open Telnet and SSH permissions, and can only be upgraded through TFTP or WEB upgrade interfaces. However, in the scenario where a large number of routers need to be upgraded, the following problems will be encountered:
[0046] 1. TFTP upgrade: It requires manual execution of commands with the help of a PC, which is labor-intensive and inefficient, and cannot be executed asynchronously in parallel. Since the kernel needs to be booted through the serial port interrupt bootloader, the upgrade command needs to be sent manually, so only one machine can be upgraded before the next one can be upgraded;
[0047] 2. Web upgrade: Although multiple routers can be powered on and wait together, you still need to manually unplug the network cables and plug them into each router one by one, and open the web interface in the browser to upload the firmware for upgrading. This is also extremely inefficient, and the upgrade behavior cannot be automated.
[0048] The inventor discovered the technical defects as described in the previous background technology.
[0049] Embodiment 1
[0050] Figure 1 The present invention is a method for automatically upgrading batch firmware of network devices before delivery, which is applied to network devices such as Figure 3 As shown, the network device is connected to the server through a switch; wherein the network device may be, for example, a router, a network camera, etc. wherein the number of the network devices may be multiple, that is, multiple network devices are connected to the server through a switch, thereby automatically upgrading the multiple network devices.
[0051] The method for automatically upgrading batch firmware of network devices before leaving the factory includes:
[0052] Step S100, real-time monitoring of whether a preset button is continuously pressed for a preset time;
[0053] Specifically, a monitoring mechanism is set in the bootloader of the router through programming logic. The mechanism will continuously check whether a specific button (such as the reset button) is pressed and held by the user for a preset time threshold. This preset time can be set according to actual needs, such as 3 seconds. If the button is pressed and held for a preset time, the router will trigger the subsequent firmware upgrade process; if it is not reached, the router will boot into the system environment normally without performing the upgrade operation. This design not only ensures the flexibility of the upgrade, but also avoids accidental upgrades caused by accidentally touching the button, improving the reliability and user-friendliness of the entire upgrade process.
[0054] Step S200, if the preset button is continuously pressed for the preset time, broadcasting a first message;
[0055] Specifically, after the router is powered on and the bootloader is started, the system will monitor in real time whether a preset button (such as the reset button) is continuously pressed for a preset time threshold. If the condition is met, that is, the button is continuously pressed for a preset time, the router will broadcast and send a first message. This first message is usually a bootp boot request message, which is used to communicate with the server in the network to obtain key information such as the IP address, subnet mask, version information, and IP address of the server required for the upgrade. The implementation of this step enables the router to automatically trigger the upgrade process without manual intervention, and obtain the upgrade file from the server through the network, thereby realizing the automation and asynchronous parallel processing of the firmware upgrade of the router before leaving the factory, greatly improving the upgrade efficiency and reducing labor costs.
[0056] Step S300, receiving a second message fed back by the server, and acquiring a corresponding preset upgrade file from the server based on the second message;
[0057] Specifically, after sending the first message (bootp request message), the router will wait for and receive feedback from the server, i.e., the second message. This second message contains important information required for the router to upgrade its firmware, such as the local IP address, subnet mask, version information, and the IP address of the server. The router obtains this key information by parsing the second message, and downloads the corresponding preset upgrade file from the server based on this information. This process enables the router to automatically and efficiently obtain the upgrade file before leaving the factory, preparing for subsequent firmware upgrades.
[0058] Step S400, executing the preset upgrade file to complete the upgrade;
[0059] Specifically, the router will first verify the upgrade file to ensure its integrity and correctness, and then write the upgrade file to the router's Flash memory to replace the original firmware version. After completing these operations, the router will reset, restart and load the new firmware version to complete the entire upgrade process. The implementation of this step enables the router to automatically and efficiently upgrade to the specified firmware version before leaving the factory, improving production efficiency and product quality.
[0060] In this embodiment, the real-time monitoring of whether the preset button is continuously pressed for a preset time further includes: adding bootp protocol support to the boot loader, wherein after the router is powered on, the hardware self-checks and starts to execute the boot loader;
[0061] Specifically, by adding bootp protocol support to the boot loader, the router can communicate with the server using the bootp protocol when the hardware self-checks and starts executing the boot loader after power-on. This step lays the foundation for the subsequent automatic upgrade process, allowing the router to obtain the upgrade file from the server through the network and automatically perform the upgrade operation. Therefore, before real-time monitoring of whether the preset button is continuously pressed for a preset time, first ensure that the router has established a communication connection with the server through the bootp protocol, which is a key step in realizing automated, asynchronous and parallel processing of firmware upgrades.
[0062] In this embodiment, the real-time monitoring of whether the preset button is continuously pressed for a preset time further includes: if the preset button is not continuously pressed for the preset time, guiding to enter the system environment;
[0063] Specifically, in the process of real-time monitoring whether the preset button is continuously pressed for the preset time, if the preset button is not continuously pressed for the preset time length, the system will not enter the firmware upgrade process, but will boot into the system environment normally. This design is to prevent the upgrade process from accidentally entering the upgrade process due to accidental pressing of the button when the firmware upgrade is not required, thereby ensuring the stability of the system and the normal user experience. Through this mechanism, it can be ensured that the upgrade process can only be triggered by continuously pressing the preset button when a firmware upgrade is clearly required.
[0064] In this embodiment, step S300 includes:
[0065] Step S301, receiving the second message fed back by the server;
[0066] Specifically, after broadcasting the first message, the router waits for and receives a response from the server. The second message fed back by the server usually contains key information required for the router to upgrade the firmware, such as the local IP address, subnet mask, version information, and the IP address of the server. Receiving this message is the prerequisite for the router to obtain the upgrade file and configuration information, and is also the basis for subsequent upgrade operations. Through this step, the router can establish a communication connection with the server and prepare for the subsequent firmware download and upgrade process.
[0067] Step S302, parsing the second message to obtain a local IP address, a subnet mask, version information, and a server IP address;
[0068] Specifically, after receiving the second message fed back by the server, the router will parse the message to extract key information. This information includes the local IP address (i.e., the unique identifier of the router in the network), the subnet mask (used to divide the network address and the host address), the version information (indicating the currently available firmware version), and the server IP address (i.e., the network address of the server that provides the upgrade file). By parsing this information, the router can configure its own network settings, determine whether the firmware needs to be upgraded, and know which server to obtain the upgrade file from.
[0069] Step S303, comparing the current firmware version with the version information to determine whether an upgrade is required;
[0070] Specifically, the router will compare its current firmware version with the version information obtained from the server. If the current firmware version is lower than the version on the server, the router needs to be upgraded to obtain the latest features or fix known problems. This step ensures that the firmware is upgraded only when necessary, avoiding unnecessary upgrade operations, thereby improving upgrade efficiency and accuracy. Through this comparison, the router can intelligently determine whether it needs to be upgraded, thereby realizing automated firmware management.
[0071] Step S304, if an upgrade is required, determine the optimal upgrade path;
[0072] Specifically, during the process of automatic batch firmware upgrade of the router before leaving the factory, when the router determines that an upgrade is required after comparing the current firmware version with the version information provided by the server, this step is responsible for finding the optimal upgrade path. This usually means selecting the most direct, efficient or stable upgrade method to ensure that the upgrade process is completed smoothly and quickly. The selection of the optimal upgrade path can be based on a variety of factors, such as network conditions, the size of the upgrade file, the complexity of the upgrade process, and the hardware configuration of the router. By determining the optimal upgrade path, the present invention can further improve the upgrade efficiency and reduce the problems that may occur during the upgrade process, thereby ensuring that the router can be quickly and accurately upgraded to the specified firmware version. Among them, the network condition is used to evaluate the stability and speed of the current network connection, which can be quantified by measuring parameters such as network delay, jitter and bandwidth. Among them, the size of the upgrade file directly affects the download time, and larger files may take longer to download. Among them, the upgrade process may involve multiple steps, such as decompression, verification, writing, etc. The higher the complexity, the more likely it is that problems will occur during the upgrade process. Among them, the hardware configuration of the router, such as the processing power and memory size, will also affect the speed and stability of the upgrade process. Among them, according to actual experience and needs, a weight value is assigned to each factor to indicate its importance in selecting the optimal upgrade path. The weight value can be a floating point number between 0 and 1, and the sum of the weight values of all factors should be 1. For each possible upgrade path, its score is calculated based on the above factors. The score can be the sum of the product of the quantitative value of each factor and the corresponding weight. Compare the scores of all upgrade paths and select the path with the highest score as the optimal upgrade path. For example, let P i represents the i-th upgrade path, NC i 、UFS i 、UPC i and RHC i They represent the network status, upgrade file size, upgrade process complexity and router hardware configuration corresponding to the path, respectively. N C.w U FS, w U PC and w R HC represents the weight values of these factors. Then the score S of the i-th upgrade path is i It can be calculated as:
[0073] S i =w N C*NC i +w U FS*UFS i +w U PC*UPC i +w R HC*RHC i
[0074] Optimal upgrade path P o pt is:
[0075] P o pt=argmax(S i ).
[0076] The network status can be evaluated in real time by pinging the server, measuring the download speed, etc., and a quantitative value can be given; the upgrade file size can directly obtain the upgrade file size information from the server. The complexity of the upgrade process can be evaluated based on factors such as the number of upgrade steps and the time required, and a quantitative value can be given. The router hardware configuration can read the router's hardware configuration information, such as CPU speed, memory size, etc., and evaluate its impact on the upgrade process based on this information.
[0077] Step S305, configuring the router based on the main body IP address and the subnet mask;
[0078] Specifically, the router sets its own network configuration according to the local IP address and subnet mask parsed from the second message received from the server. This is necessary because the router needs to establish network communication with the server in order to download the firmware upgrade file from the server. By configuring the main body IP address and subnet mask, the router can correctly identify its position in the network and perform effective data transmission with the server. This step ensures that the router can successfully obtain the upgrade file, laying the foundation for the subsequent firmware upgrade process.
[0079] Step S306, based on the server IP address and the optimal upgrade path, obtaining the corresponding preset upgrade file from the server, wherein the indicator light of the router continues to flash;
[0080] Specifically, during this process, the indicator light of the router continues to flash. This design is mainly to provide visual feedback, indicating that the router is in the stage of obtaining the upgrade file. This flashing can not only help on-site operators intuitively understand the upgrade status of the router, but also can quickly identify which routers are being upgraded and which may have been completed or encountered problems during the batch upgrade process through the flashing state of the indicator light, thereby improving the monitorability and management efficiency of the upgrade process. In addition, this real-time visual feedback is also an important auxiliary means to realize asynchronous parallel processing of upgrade tasks, allowing operators to effectively monitor and manage the upgrade process without interrupting the upgrade process.
[0081] In this embodiment, the step S300 further includes:
[0082] Step S307, verifying the integrity of the preset upgrade file;
[0083] Specifically, this step involves, for example, calculating a checksum (such as MD5, SHA-1, SHA-256, etc.) on the upgrade file, and comparing the calculated checksum with the checksum provided by the server. If the two are consistent, it means that the upgrade file is intact and you can continue with the subsequent upgrade operation; if they are inconsistent, it means that the file may have an error or been tampered with during the transmission process. At this time, the upgrade process should be terminated and an attempt should be made to obtain the upgrade file from the server again. This step is crucial to ensure the reliability and security of the upgrade.
[0084] Step S308, if the verification is successful, write the preset upgrade file into Flash;
[0085] Specifically, after obtaining the preset upgrade file from the server and verifying its integrity, if the verification result shows that the file is complete, the system will execute this step, that is, write the verified upgrade file into the router's Flash memory. This step is the final execution stage of the firmware upgrade, which ensures that the new firmware can be correctly installed on the router, thereby updating or optimizing the router's functions. By automating this process, the upgrade efficiency can be significantly improved, and the errors and time costs caused by human operations can be reduced.
[0086] Figure 4 FIG. 1 is a logic flow diagram of a method for automatically upgrading batch firmware of network devices before delivery according to a specific embodiment of the present invention. Figure 4 As shown, in a specific embodiment of the present invention, the router device has a bootloader program, which is responsible for booting and loading the system kernel and performing runtime initialization. The first program to run after the device is powered on is the bootloader program. The current bootloader program generally has a TFTP upgrade function. The present invention mainly adds bootp protocol support to the TFTP upgrade function of the bootloader program, and at the same time assists with key detection, indicator light flashing, etc., so that the upgrade process can be separated from the PC to achieve asynchronous and batch automation. The main functional changes are as follows: adding bootp protocol support to the bootloader program; adding indicator light flashing reminder to the bootloader upgrade function; adding long press reset key trigger to the bootloader upgrade function.
[0087] In this embodiment, the router of the present invention performs hardware self-check when powered on and starts to execute the bootloader program; the bootloader program initializes peripheral devices such as PHY, GPIO, Flash, etc.; and the bootloader program cyclically detects whether the reset key is pressed (the cycle duration is 3 seconds, and the detection interval is 100 milliseconds).
[0088] If reset is not pressed, the kernel boot process will be entered; the bootp protocol interaction process will be entered, and the indicator light will continue to flash. After the interaction is completed, the indicator light will go out. After entering the bootp protocol interaction process, the router broadcasts and sends the bootp boot request message, and receives the server boot response message. It parses the IP address and subnet mask assigned by the bootp server from the message and applies them to the interface, and then parses the server IP, boot file name and other required parameters. Among them, if the protocol interaction times out or encounters other exceptions, the kernel boot process will be entered. Execute the tftp protocol interaction, download the file indicated by the boot file name from the server and store it in the router's memory. During this process, all indicator lights will continue to flash and go out after completion. If the protocol interaction times out or encounters other exceptions, the kernel boot process will be entered.
[0089] In this embodiment, the file data downloaded by tftp in the memory is used to update the Flash. The indicator light is always on to remind the update process. After the update is completed, the CPU is reset, the router is restarted, all the indicators are off, and the upgrade is completed. Among them, the upgrade server can be built using programs such as Deepin Remote Boot Manager, tftpd, and dnsmasq. Among them, the most widely used application of the bootp protocol is the booting of diskless workstations. In the present invention, it is mainly used for the bootloader to obtain the assigned IP address and the upgrade file name from the server. Except for the manual operation of powering on the router and pressing the reset button, the rest are program automated behaviors.
[0090] Embodiment 2
[0091] Figure 2 FIG. 1 is a schematic diagram of a system for automatically upgrading batch firmware of network devices before delivery in Embodiment 2 of the present invention. Figure 2 As shown, the second embodiment provides a system for automatically upgrading batch firmware of network equipment before leaving the factory, which is applied to network equipment, such as Figure 3As shown, the network device is connected to the server through a switch, and the automatic batch firmware upgrade system of the network device before leaving the factory includes: a monitoring module 201, a sending module 202, an acquisition module 203 and an execution module 204. The monitoring module 201 is used to monitor in real time whether the preset button is continuously pressed for a preset time. The sending module 202 is used to broadcast a first message if the preset button is continuously pressed for the preset time. The acquisition module 203 is used to receive a second message fed back by the server, and obtain a corresponding preset upgrade file from the server based on the second message. And the execution module 204 is used to execute the preset upgrade file to complete the upgrade.
[0092] In this embodiment, the network device batch firmware automatic upgrade system before leaving the factory also includes an adding module for adding bootp protocol support to the boot loader, wherein after the router is powered on, the hardware self-checks and starts executing the boot loader.
[0093] In this embodiment, the network device pre-shipment batch firmware automatic upgrade system further includes a boot module, which is used to boot into the system environment if the preset button is not continuously pressed for the preset time.
[0094] In this embodiment, the acquisition module 203 includes: a receiving unit, a parsing unit, a configuration unit and an acquisition unit. The receiving unit is used to receive the second message fed back by the server. The parsing unit is used to parse the second message to obtain a local IP address, a subnet mask and a server IP address. The configuration unit is used to configure the router based on the main body IP address and the subnet mask. The acquisition unit is used to obtain the corresponding preset upgrade file from the server based on the server IP address, wherein the indicator light of the router continues to flash.
[0095] In one embodiment of the present invention, the acquisition module 203 further includes: a verification unit and a writing unit. The verification unit is used to verify the integrity of the preset upgrade file. The writing unit is used to write the preset upgrade file into Flash if the verification is successful.
[0096] The various variations and specific examples of the method for automatic batch firmware upgrade of network devices before leaving the factory provided in Example 1 are also applicable to the system for automatic batch firmware upgrade of network devices before leaving the factory provided in this embodiment. Through the above detailed description of a method for automatic batch firmware upgrade of network devices before leaving the factory, those skilled in the art can clearly understand the implementation method of a system for automatic batch firmware upgrade of network devices before leaving the factory in this embodiment. Therefore, for the sake of brevity of the specification, it will not be described in detail here.
[0097] Embodiment 3
[0098] Figure 5 is a schematic diagram of the structure of an electronic device in Embodiment 3 of the present invention, such as Figure 5 As shown, the third embodiment further provides an electronic device 500 , which may include: a processor 501 and a memory 502 .
[0099] The memory 502 is used to store programs; the memory 502 may include volatile memory (English: volatile memory), such as random-access memory (English: random-access memory, abbreviated: RAM), such as static random-access memory (English: static random-access memory, abbreviated: SRAM), double data rate synchronous dynamic random access memory (English: Double Data Rate Synchronous Dynamic Random Access Memory, abbreviated: DDR SDRAM), etc.; the memory may also include non-volatile memory (English: non-volatile memory), such as flash memory (English: flash memory). The memory 502 is used to store computer programs (such as applications, functional modules, etc. that implement the above method), computer instructions, etc., and the above computer programs, computer instructions, etc. can be partitioned and stored in one or more memories 502. And the above computer programs, computer instructions, data, etc. can be called by the processor 501.
[0100] The above-mentioned computer programs, computer instructions, etc. may be stored in partitions in one or more memories 502 . And the above-mentioned computer programs, computer instructions, etc. may be called by the processor 501 .
[0101] The processor 501 is used to execute the computer program stored in the memory 502 to implement the various steps in the method involved in the above embodiment.
[0102] For details, please refer to the relevant description in the previous method embodiment.
[0103] The processor 501 and the memory 502 may be independent structures or integrated structures. When the processor 501 and the memory 502 are independent structures, the memory 502 and the processor 501 may be coupled and connected via a bus 503 .
[0104] The electronic device of this embodiment can execute the technical solution in the above method, and its specific implementation process and technical principle are the same, which will not be repeated here.
[0105] Embodiment 4
[0106] Embodiment 4 also provides a computer-readable storage medium, including a computer program and instructions. When the computer program or instructions are executed on a computer, the computer executes the method for automatically upgrading batch firmware of network devices before shipment according to any embodiment of the present invention.
[0107] Computer-readable storage media include: USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical disks, and other media that can store program codes.
[0108] This embodiment also provides a computer program product, which includes: a computer program, which is stored in a readable storage medium. At least one processor of an electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device executes the solution provided by any of the above embodiments.
[0109] 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 disclosure of the present invention can be performed in parallel, sequentially or in different orders, as long as the desired results of the technical solution disclosed in the present invention can be achieved, and this document does not limit this.
[0110] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A method for automatically upgrading batch firmware of network equipment before leaving the factory, applied to network equipment, wherein the network equipment is connected to the server through a switch, characterized in that: The method for automatically upgrading batch firmware of network devices before leaving the factory includes: Real-time monitoring of whether the preset button is continuously pressed for the preset time; If the preset button is continuously pressed for the preset time, broadcasting and sending a first message; receiving a second message fed back by the server, and acquiring a corresponding preset upgrade file from the server based on the second message; Execute the preset upgrade file to complete the upgrade.
2. The method for automatically upgrading batch firmware of network equipment before delivery as claimed in claim 1, characterized in that: The real-time monitoring of whether the preset button is continuously pressed for a preset time also includes: The bootp protocol support is added to the boot loader, wherein after the router is powered on, the hardware self-checks and starts to execute the boot loader.
3. The method for automatically upgrading batch firmware of network equipment before delivery as claimed in claim 1, characterized in that: The real-time monitoring of whether the preset button is continuously pressed for a preset time further includes: If the preset button is not pressed continuously for the preset time, the system environment is entered.
4. The method for automatically upgrading batch firmware of network equipment before delivery as claimed in claim 1, characterized in that: The receiving a second message fed back by the server, and acquiring a corresponding preset upgrade file from the server based on the second message includes: receiving the second message fed back by the server; Parse the second message to obtain the local IP address, subnet mask, version information, and server IP address; Compare the current firmware version with the version information to determine whether an upgrade is required; If an upgrade is required, determine the best upgrade path; Configuring the router based on the IP address of the entity and the subnet mask; Based on the server IP address and the optimal upgrade path, the corresponding preset upgrade file is obtained from the server, wherein the indicator light of the router continues to flash.
5. The method for automatically upgrading batch firmware of network equipment before delivery as claimed in claim 4, characterized in that: The receiving of the second message fed back by the server, and acquiring the corresponding preset upgrade file from the server based on the second message further includes: Verifying the integrity of the preset upgrade file; If the verification is successful, the preset upgrade file is written into the Flash.
6. A system for automatically upgrading batch firmware of network equipment before leaving the factory, applied to network equipment, wherein the network equipment is connected to the server through a switch, characterized in that: The network equipment batch firmware automatic upgrade system before leaving the factory includes: A monitoring module, used to monitor in real time whether a preset button is continuously pressed for a preset time; A sending module, configured to broadcast and send a first message if the preset button is continuously pressed for the preset time; an acquisition module, configured to receive a second message fed back by the server, and acquire a corresponding preset upgrade file from the server based on the second message; and The execution module is used to execute the preset upgrade file to complete the upgrade.
7. The automatic batch firmware upgrade system for network equipment before shipment as claimed in claim 6, characterized in that: The network equipment batch firmware automatic upgrade system before leaving the factory also includes: The adding module is used to add the support of the bootp protocol in the boot loader, wherein after the router is powered on, the hardware self-checks and starts to execute the boot loader.
8. The automatic batch firmware upgrade system for network equipment before shipment as claimed in claim 6, characterized in that: The network equipment batch firmware automatic upgrade system before leaving the factory also includes: The boot module is used to boot into the system environment if the preset button is not pressed continuously for the preset time.
9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively coupled to the at least one processor; The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for automatic batch firmware upgrade of network equipment before shipment according to any one of claims 1-5.
10. A computer-readable storage medium, characterized in that: The method comprises a computer program and instructions. When the computer program or the instructions are executed on a computer, the computer is enabled to execute the method for automatically upgrading batch firmware of network devices before shipment according to any one of claims 1 to 5.