A network device initialization method and device

By merging the Bootloader and BIN programs of multiple hardware versions into a single file, and loading the corresponding programs according to the hardware information, the problem of maintenance difficulty and configuration errors of multiple hardware versions of network equipment is solved, and efficient device initialization and maintenance are achieved.

CN113703853BActive Publication Date: 2024-09-24NEW H3C INTELLIGENCE TERMINAL CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110975942.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-24
Publication Date
2024-09-24
Estimated Expiration
2041-08-24

AI Technical Summary

Technical Problem

In the existing technology, when a network device corresponds to multiple hardware versions, it is necessary to maintain a Bootloader program and a BIN program corresponding to the multiple hardware versions, resulting in inconvenient production and maintenance and error-prone.

Method used

Merge Bootloader programs corresponding to multiple hardware versions into the same Bootloader file, merge multiple BIN programs into the same BIN file, and when the network device is powered on, search and load the corresponding program from the file header based on its own hardware information. to complete initialization.

Benefits of technology

While ensuring normal initialization of network equipment, only one software version is maintained, which improves production and maintenance efficiency and reduces the probability of configuration errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113703853B
    Figure CN113703853B
Patent Text Reader

Abstract

The present application provides a method and device for initializing a network device. In this method, multiple Bootloader programs corresponding to multiple hardware versions of the network device are merged into the same Bootloader file, and multiple BIN programs corresponding to multiple hardware versions are merged into the same BIN file, and then configured into the network device. When the network device is powered on, it can search for the Bootloader program and BIN program that match its own hardware information from the configured Bootloader file and BIN file, load and run them, and complete the initialization of the network device. While ensuring the normal initialization of the network device, the present application only needs to maintain one software version for network devices corresponding to multiple hardware versions. Therefore, it can effectively improve production and maintenance efficiency while reducing the probability of configuration errors.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method and apparatus for initializing a network device. Background Art

[0002] When network devices leave the factory, they are usually configured with a boot program (hereinafter referred to as the Bootloader program) and a specified running program (hereinafter referred to as the BIN program). After the network device is powered on, the Bootloader program is first run to initialize the hardware, such as initializing the CPU and initializing the memory; then, the BIN program (mainly including the network management system program and other hardware drivers) is loaded through the Bootloader program, and after loading, the network management system (also known as the operating system) is started to complete the initialization of the network device.

[0003] The Bootloader program and the BIN program are hardware-dependent. When a network device corresponds to multiple hardware versions, it is necessary to maintain the software versions (Bootloader program and BIN program) corresponding to the multiple hardware versions. In addition, during production, it is necessary to accurately configure the corresponding software version for the current hardware version of the network device to ensure the normal operation of the network device, which brings inconvenience to production and maintenance and is prone to errors. Summary of the invention

[0004] In view of this, the present application proposes a network device initialization method and apparatus to improve production and maintenance efficiency and reduce the probability of configuration errors.

[0005] In order to achieve the above application purpose, this application provides the following technical solutions:

[0006] In a first aspect, the present application provides a network device initialization method, which is applied to a network device, wherein the network device corresponds to multiple hardware versions, and the network device is pre-configured with a Bootloader file, a BIN file, and a Bootloader configuration file, wherein the Bootloader file includes multiple Bootloader programs corresponding to the multiple hardware versions, respectively, and the BIN file includes multiple BIN programs corresponding to the multiple hardware versions, respectively, and the method includes:

[0007] Obtain hardware information of the target hardware version of the network device from the Bootloader configuration file;

[0008] Searching a first offset corresponding to the hardware information of the target hardware version from a file header of the Bootloader file, wherein the first offset is used to identify a position of a Bootloader program corresponding to the target hardware version in the Bootloader file, and loading and running the Bootloader program at a position corresponding to the first offset;

[0009] Search the file header of the BIN file for a second offset corresponding to the hardware information of the target hardware version, where the second offset is used to identify the position of the BIN program corresponding to the target hardware version in the BIN file, and load and run the BIN program at the position corresponding to the second offset.

[0010] Optionally, the file header of the Bootloader file and the file header of the BIN file both include sub-file headers corresponding to the multiple hardware versions, each sub-file header is used to record the correspondence between the hardware information of the hardware version and the offset, and searching the first offset corresponding to the hardware information of the target hardware version from the file header of the Bootloader file includes:

[0011] Traversing each sub-file header included in the file header of the Bootloader file in turn, and searching for the first sub-file header containing the hardware information of the target hardware version;

[0012] Acquire a first offset corresponding to the hardware information of the target hardware version from the first sub-file header;

[0013] The searching the file header of the BIN file for the second offset corresponding to the hardware information of the target hardware version includes:

[0014] Traversing the sub-file headers included in the file header of the BIN file in sequence, and searching for the second sub-file header containing the hardware information of the target hardware version;

[0015] A second offset corresponding to the hardware information of the target hardware version is obtained from the second sub-file header.

[0016] Optionally, the file header of the Bootloader file further includes a total file header, the total file header includes a file type field, and the acquiring hardware information of the target hardware version of the network device from the Bootloader configuration file includes:

[0017] Get the value of the file type field;

[0018] If the value of the file type field indicates that the Bootloader file includes a plurality of Bootloader programs, hardware information of the target hardware version to which the network device belongs is obtained from the Bootloader configuration file.

[0019] Optionally, the hardware information consists of a hardware type of at least one hardware that represents a hardware version difference, the hardware type of the at least one hardware is arranged in a preset order, and each hardware type of the hardware is represented by at least one binary bit.

[0020] Optionally, after loading and running the BIN program at the position corresponding to the second offset, the method further includes:

[0021] If there is hardware whose driver has not been successfully installed, a driver request is sent to the server, wherein the driver request includes hardware information of the target hardware version to which the network device belongs;

[0022] A driver program returned by the server based on the driver request is received and loaded, wherein the returned driver program is the latest driver program retrieved by the server according to the hardware information carried in the driver request.

[0023] In a second aspect, the present application provides a network device initialization device, which is applied to a network device, wherein the network device corresponds to multiple hardware versions, and the network device is pre-configured with a Bootloader file, a BIN file, and a Bootloader configuration file, wherein the Bootloader file includes multiple Bootloader programs corresponding to the multiple hardware versions, respectively, and the BIN file includes multiple BIN programs corresponding to the multiple hardware versions, respectively, and the device includes:

[0024] A hardware information acquisition unit, used to acquire hardware information of a target hardware version of the network device from the Bootloader configuration file;

[0025] A Bootloader program loading unit, configured to search a first offset corresponding to the hardware information of the target hardware version from a file header of the Bootloader file, wherein the first offset is used to identify a position of the Bootloader program corresponding to the target hardware version in the Bootloader file, and load and run the Bootloader program at the position corresponding to the first offset;

[0026] A BIN program loading unit is used to search for a second offset corresponding to the hardware information of the target hardware version from the file header of the BIN file, wherein the second offset is used to identify the position of the BIN program corresponding to the target hardware version in the BIN file, and load and run the BIN program at the position corresponding to the second offset.

[0027] Optionally, the file header of the Bootloader file and the file header of the BIN file both include sub-file headers corresponding to the multiple hardware versions, each sub-file header is used to record the correspondence between the hardware information of the hardware version and the offset, and the Bootloader program loading unit searches the file header of the Bootloader file for the first offset corresponding to the hardware information of the target hardware version, including:

[0028] Traversing each sub-file header included in the file header of the Bootloader file in turn, and searching for the first sub-file header containing the hardware information of the target hardware version;

[0029] Acquire a first offset corresponding to the hardware information of the target hardware version from the first sub-file header;

[0030] The BIN program loading unit searches for a second offset corresponding to the hardware information of the target hardware version from a file header of the BIN file, including:

[0031] Traversing the sub-file headers included in the file header of the BIN file in sequence, and searching for the second sub-file header containing the hardware information of the target hardware version;

[0032] A second offset corresponding to the hardware information of the target hardware version is obtained from the second sub-file header.

[0033] Optionally, the file header of the Bootloader file further includes a total file header, the total file header includes a file type field, and the hardware information acquisition unit acquires hardware information of a target hardware version of the network device from the Bootloader configuration file, including:

[0034] Get the value of the file type field;

[0035] If the value of the file type field indicates that the Bootloader file includes a plurality of Bootloader programs, hardware information of the target hardware version to which the network device belongs is obtained from the Bootloader configuration file.

[0036] Optionally, the hardware information consists of a hardware type of at least one hardware that represents a hardware version difference, the hardware type of the at least one hardware is arranged in a preset order, and each hardware type of the hardware is represented by at least one binary bit.

[0037] Optionally, the device further comprises:

[0038] a request sending unit, configured to send a driver request to a server after the BIN program loading unit loads and runs the BIN program at the position corresponding to the second offset, if there is hardware for which a driver has not been successfully installed, wherein the driver request includes hardware information of a target hardware version to which the network device belongs;

[0039] The driver receiving unit is used to receive and load the driver program returned by the server based on the driver request, wherein the returned driver program is the latest driver program retrieved by the server according to the hardware information carried in the driver request.

[0040] It can be seen from the above description that in the embodiment of the present application, for network devices with multiple hardware versions, multiple Bootloader programs corresponding to the multiple hardware versions are merged into the same Bootloader file, and multiple BIN programs corresponding to the multiple hardware versions are merged into the same BIN file, and then configured into the network device. When the network device is powered on, it can search for the Bootloader program and BIN program that match its own hardware information from the configured Bootloader file and BIN file, load and run them, and complete the initialization of the network device. It can be seen that in the embodiment of the present application, while ensuring the normal initialization of the network device, only one software version (Bootloader file and BIN file) needs to be maintained for network devices corresponding to multiple hardware versions. Therefore, it can effectively improve production and maintenance efficiency while reducing the probability of configuration errors. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0042] Figure 1 is a flow chart of a network device initialization method shown in an embodiment of the present application;

[0043] Figure 2 It is an example of a file format shown in the embodiment of the present application;

[0044] Figure 3 It is a structural diagram of a network device initialization device shown in an embodiment of the present application. DETAILED DESCRIPTION

[0045] Here, exemplary embodiments are described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application.

[0046] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the embodiments of the present application. The singular forms of "a", "said" and "the" used in the embodiments of the present application are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in this article refers to and includes any or all possible combinations of one or more associated listed items.

[0047] It should be understood that although the terms first, second, third, etc. may be used to describe various information in the embodiments of the present application, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the embodiments of the present application, the negotiation information may also be referred to as the second information, and similarly, the second information may also be referred to as the negotiation information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determination".

[0048] The present application provides a network device initialization method, in which the network device pre-configures a Bootloader file containing multiple Bootloader programs and a BIN file containing multiple BIN programs. When the network device is powered on, it can search for the Bootloader program and BIN program that match its own hardware information from the configured Bootloader file and BIN file, load and run them, and complete the network device initialization. It can be seen that the present application only needs to maintain one software version (Bootloader file and BIN file) for network devices corresponding to multiple hardware versions, therefore, it can effectively improve production and maintenance efficiency while reducing the probability of configuration errors.

[0049] In order to make the purpose, technical solution and advantages of the present application clearer, the present application is described in detail below with reference to the accompanying drawings and specific embodiments:

[0050] See also Figure 1 , is a flow chart of a network device initialization method shown in an embodiment of the present application.

[0051] In actual production, in order to avoid equipment shutdown due to component shortages, equipment manufacturers usually use different types of components for alternative production of key functional modules in network equipment.

[0052] For example, the flash memory of a wireless router can be produced using different types of Flash such as NorFlash, NandFlash, eMMC, USF, etc.; for another example, the RF front-end modules (FEM) of a wireless router can be produced using modules from different suppliers such as Skyworks, Richwave, QORVO, etc.

[0053] This makes it possible for the same network device to correspond to multiple hardware versions. At present, for multiple hardware versions of the same network device, it is necessary to maintain multiple software versions (including Bootloader programs and BIN programs) corresponding to the multiple hardware versions, which brings inconvenience to production and maintenance.

[0054] To this end, the embodiment of the present application merges multiple Bootloader programs corresponding to multiple hardware versions into the same Bootloader file, merges multiple BIN programs corresponding to multiple hardware versions into the same BIN file, and then configures the merged Bootloader file and BIN file into the network device. This allows network devices corresponding to multiple hardware versions to maintain only one software version (merged Bootloader file and BIN file), thus simplifying the difficulty of production and maintenance.

[0055] Based on the combined Bootloader file and BIN file, the network device can execute Figure 1 Follow the process shown to complete device initialization. Figure 1 As shown, the process may include the following steps:

[0056] Step 101: Obtain hardware information of a target hardware version of a network device from a Bootloader configuration file.

[0057] Here, it should be noted that the Bootloader configuration file also needs to be pre-configured into the network device. Before configuration, the hardware information of the hardware version of the network device can be added to the file header of the Bootloader configuration file. In this way, when the network device is powered on, the hardware information of the hardware version of the network device can be obtained from the configured Bootloader configuration file through this step.

[0058] Here, the hardware version of the current network device is referred to as the target hardware version. It is understandable that the target hardware version is named for the convenience of distinction and is not used for limitation.

[0059] Step 102: searching a file header of the Bootloader file for a first offset corresponding to the hardware information of the target hardware version, and loading and running the Bootloader program at a position corresponding to the first offset.

[0060] A complete file consists of a file header and file content (also referred to as the data portion of the file). In the embodiment of the present application, multiple Bootloader programs are sequentially arranged in the data portion of the file, and the description information corresponding to each Bootloader program is located in the file header.

[0061] Specifically, the file header of the Bootloader file may include multiple sub-file headers, and each sub-file header is used to record description information of a Bootloader program corresponding to a hardware version.

[0062] See also Figure 2 , is an example of a file format shown in an embodiment of the present application. The file includes a file header and a data part. The data part includes multiple Bootloader programs corresponding to multiple hardware versions; the file header includes a total file header and each sub-file header, and the number of sub-file headers is equal to the number of Bootloader programs in the file.

[0063] The total file header is used to record the relevant information of the entire file, such as the total length of the file, the total number of segments included in the file (in the embodiment of the present application, the data corresponding to each bootloader program is divided into a data segment, so the total number of segments is the number of bootloader programs in the file), and the total message-digest algorithm 5 (English: message-digest algorithm 5, abbreviated: MD5) value of all bootloader programs in the file.

[0064] The sub-file header is used to record the relevant information of the Bootloader program. For example, it is used to identify the offset of the Bootloader program in the file; it is used to identify the hardware information of the hardware version applicable to the Bootloader program; it is used to identify the segment length of the Bootloader program; it is used to identify the segment MD5 value of the Bootloader program.

[0065] Based on the above file structure, the embodiment of the present application can sequentially traverse each sub-file header included in the Bootloader file until the sub-file header including the hardware information of the target hardware version is found. Here, the sub-file header including the hardware information of the target hardware version in the Bootloader file is referred to as the first sub-file header. It can be understood that the reason why it is called the first sub-file header is just a name for the convenience of distinction and is not used for limitation.

[0066] Get the offset and segment length included in the first sub-file header. Here, the offset included in the first sub-file header is called the first offset; the segment length included in the first sub-file header is called the first segment length. The first offset is used to identify the position of the Bootloader program applicable to the target hardware version in the Bootloader file (usually the starting position); the first segment length is used to identify the length of the Bootloader program. It can be understood that the first offset and the first segment length are named only for the convenience of distinction and are not used for limitation.

[0067] The network device can intercept the corresponding Bootloader program data from the data portion of the Bootloader file according to the first offset and the first segment length, and calculate the MD5 value of the Bootloader program data. If the MD5 value is the same as the segment MD5 value included in the first sub-file header, it means that the Bootloader program data is legal, and then the Bootloader program is loaded and run to complete the basic hardware initialization.

[0068] Step 103: searching the file header of the BIN file for a second offset corresponding to the hardware information of the target hardware version, and loading the BIN program at a position corresponding to the second offset.

[0069] Here, it should be noted that the file format of the BIN file is the same as the file format of the Bootloader file. The only difference is that the data part of the BIN file includes multiple BIN programs corresponding to multiple hardware versions; each sub-file header is used to record the description information of the BIN program corresponding to a hardware version. Please refer to the description of the Bootloader file format in step 102 for details, which will not be repeated here.

[0070] In this step, the network device can sequentially traverse each sub-file header included in the BIN file to find the sub-file header including the hardware information of the target hardware version. Here, the sub-file header including the hardware information of the target hardware version in the BIN file is referred to as the second sub-file header. It can be understood that the second sub-file header is named only for the convenience of distinction and is not used for limitation.

[0071] Get the offset and segment length included in the second sub-file header. Here, the offset included in the second sub-file header is called the second offset; the segment length included in the second sub-file header is called the second segment length. The second offset is used to identify the position of the BIN program applicable to the target hardware version in the BIN file (usually the starting position); the second segment length is used to identify the length of the BIN program. It can be understood that the second offset and the second segment length are named only for the convenience of distinction and are not used for limitation.

[0072] The network device can intercept the corresponding BIN program data from the data part of the BIN file according to the second offset and the second segment length, and calculate the MD5 value of the BIN program data. If the MD5 value is the same as the segment MD5 value included in the second sub-file header, it means that the BIN program data is legal, and then the BIN program (including the hardware driver and the network management system program) is loaded and run to complete the initialization of the network device.

[0073] So far, completed Figure 1 The process shown.

[0074] pass Figure 1 It can be seen from the shown process that in the embodiment of the present application, while ensuring the normal initialization of the network device, only one software version (Bootloader file and BIN file) needs to be maintained for network devices corresponding to multiple hardware versions. Compared with maintaining multiple software versions for multiple hardware versions, it can effectively improve production maintenance efficiency and reduce the probability of configuration errors.

[0075] As an embodiment, the total file header of the Bootloader file may also include a file type field ( Figure 2 Before executing step 101, the network device may obtain the value of the file type field. If the value of the file type field indicates that the Bootloader file includes multiple Bootloader programs, steps 101 to 103 are executed; otherwise, it indicates that the current Bootloader file is a file corresponding to a single Bootloader program. Accordingly, the BIN file configured by the network device is also a file corresponding to a single BIN program. Both the Bootloader file and the BIN file only include a total file header, which follows the existing file header format. Therefore, the network device can be initialized using the existing initialization method.

[0076] Here, it should be noted that the file type field can select an unused field in the existing file header format. When the Bootloader file includes multiple Bootloader programs, the value of the file type field can be set to a non-default value, and the network device can determine the use of the non-default value. Figure 1The initialization method shown; when the Bootloader file includes only one Bootloader program, the value of the file type field is the default value, and the network device can determine to adopt the existing initialization method based on the default value.

[0077] As an embodiment, the hardware information in the present application may be composed of the hardware type of at least one hardware that characterizes the hardware version difference. For example, the difference (difference) between different hardware versions is: different Flash types and different FEM models (types), then the hardware information may be composed of the hardware types of these two hardware.

[0078] As an example, the hardware type of each hardware may be represented by at least one binary bit. See Table 1 for an example of a Flash type represented by at least one binary bit.

[0079]

[0080]

[0081] Table 1

[0082] See Table 2 for examples of FEM types represented by at least one binary bit.

[0083] Binary digit (3 digits) FEM Type 000 Without external FEM 100 Skyworks 85333 101 Skyworks 85728 110 Richwave RTC5631 111 QORVOQPF4005

[0084] Table 2

[0085] The hardware type of at least one hardware included in the hardware information is arranged in a preset order. For example, the preset order is Flash first and FEM last. When the hardware information of the hardware version is 00111, it can be determined that the Flash selected by the hardware version is NorFlash and the FEM is QORVOQPF400; for another example, when the hardware information of the hardware version is 01100, it can be determined that the Flash selected by the hardware version is NandFlash and the FEM is Skyworks 85333. It can be seen that the hardware differences of different hardware versions can be clearly identified through the hardware information.

[0086] As an embodiment, after executing step 103, if the network device still has hardware whose driver has not been successfully installed, a driver request may be sent to a server (eg, a cloud server), and the driver request includes hardware information of the target hardware version of the network device.

[0087] The server can retrieve the latest driver corresponding to the hardware information carried in the driver request and return the latest driver to the network device.

[0088] The network device receives and loads the driver returned by the server to complete the driver installation.

[0089] Of course, in order to ensure the security of access between the network device and the server, the network device may send an authentication request to the server before sending a drive request to the server, and then send a drive request to the server after the authentication is passed.

[0090] In addition, it should be noted that the BIN file of the network device configuration also includes the configuration data required by each hardware, such as the wireless gain configuration of the FEM, including but not limited to the power ratio (Power Rate), receiving (Rx) gain value, transmitting (Tx) gain value, etc.

[0091] The configuration data of the same hardware (eg, FEM) in different hardware versions may be different. See Table 3 for an example of FEM configuration data shown in an embodiment of the present application.

[0092]

[0093] Table 3

[0094] Taking the first item in Table 3 as an example, it indicates that in the hardware version with hardware information of 01100 (Flash is NandFlash, FEM is Skyworks 85333), the Power Rate of FEM is set to the check value 1, the Rx gain value is set to +1dBm, and the Tx gain value is set to +0dBm.

[0095] In order to distinguish the configuration data of different hardware versions, in the embodiment of the present application, the BIN program and configuration data belonging to the same hardware version are located in the same data segment of the BIN file. Therefore, when the BIN program corresponding to the target hardware version is found from the BIN file through step 103, the configuration data corresponding to the target hardware version located in the same data segment is also found. After the BIN program (including the driver) is loaded and run, the configuration data of each hardware can be set.

[0096] The method provided in the embodiment of the present application is described above. The network device initialization device provided in the embodiment of the present application is described below:

[0097] See also Figure 3, is a structural diagram of a network device initialization device provided in an embodiment of the present application, which is applied to a network device, the network device corresponds to multiple hardware versions, the network device is pre-configured with a Bootloader file, a BIN file and a Bootloader configuration file, the Bootloader file includes multiple Bootloader programs corresponding to the multiple hardware versions, the BIN file includes multiple BIN programs corresponding to the multiple hardware versions, the device includes: a hardware information acquisition unit 301, a Bootloader program loading unit 302 and a BIN program loading unit 303, wherein:

[0098] The hardware information acquisition unit 301 is used to acquire the hardware information of the target hardware version of the network device from the Bootloader configuration file;

[0099] A Bootloader program loading unit 302 is configured to search a first offset corresponding to the hardware information of the target hardware version from a file header of the Bootloader file, wherein the first offset is used to identify a position of the Bootloader program corresponding to the target hardware version in the Bootloader file, and load and run the Bootloader program at the position corresponding to the first offset;

[0100] The BIN program loading unit 303 is used to search for a second offset corresponding to the hardware information of the target hardware version from the file header of the BIN file, where the second offset is used to identify the position of the BIN program corresponding to the target hardware version in the BIN file, and load and run the BIN program at the position corresponding to the second offset.

[0101] As an embodiment, the file header of the Bootloader file and the file header of the BIN file both include sub-file headers corresponding to the multiple hardware versions, each sub-file header is used to record the correspondence between the hardware information of the hardware version and the offset, and the Bootloader program loading unit 302 searches the file header of the Bootloader file for the first offset corresponding to the hardware information of the target hardware version, including:

[0102] Traversing each sub-file header included in the file header of the Bootloader file in turn, and searching for the first sub-file header containing the hardware information of the target hardware version;

[0103] Acquire a first offset corresponding to the hardware information of the target hardware version from the first sub-file header;

[0104] The BIN program loading unit 303 searches the file header of the BIN file for a second offset corresponding to the hardware information of the target hardware version, including:

[0105] Traversing the sub-file headers included in the file header of the BIN file in sequence, and searching for the second sub-file header containing the hardware information of the target hardware version;

[0106] A second offset corresponding to the hardware information of the target hardware version is obtained from the second sub-file header.

[0107] As an embodiment, the file header of the Bootloader file also includes a total file header, the total file header includes a file type field, and the hardware information acquisition unit 301 acquires the hardware information of the target hardware version of the network device from the Bootloader configuration file, including:

[0108] Get the value of the file type field;

[0109] If the value of the file type field indicates that the Bootloader file includes a plurality of Bootloader programs, hardware information of the target hardware version to which the network device belongs is obtained from the Bootloader configuration file.

[0110] As an embodiment, the hardware information consists of a hardware type of at least one hardware that represents a hardware version difference, the hardware type of the at least one hardware is arranged in a preset order, and each hardware type of the hardware is represented by at least one binary bit.

[0111] As an embodiment, the device further includes:

[0112] a request sending unit, configured to send a driver request to a server after the BIN program loading unit 303 loads and runs the BIN program at the position corresponding to the second offset, if there is hardware for which a driver has not been successfully installed, wherein the driver request includes hardware information of a target hardware version to which the network device belongs;

[0113] The driver receiving unit is used to receive and load the driver program returned by the server based on the driver request, wherein the returned driver program is the latest driver program retrieved by the server according to the hardware information carried in the driver request.

[0114] So far, completed Figure 3Description of the device shown. In an embodiment of the present application, for network devices with multiple hardware versions, multiple Bootloader programs corresponding to multiple hardware versions are merged into the same Bootloader file, and multiple BIN programs corresponding to multiple hardware versions are merged into the same BIN file, and then configured into the network device. When the network device is powered on, it can search for the Bootloader program and BIN program that match its own hardware information from the configured Bootloader file and BIN file, load and run them, and complete the initialization of the network device. While ensuring the normal initialization of the network device, the present application only needs to maintain one software version for network devices corresponding to multiple hardware versions. Therefore, it can effectively improve production and maintenance efficiency while reducing the probability of configuration errors.

[0115] The above description is only a preferred embodiment of the embodiments of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the scope of protection of the present application.

Claims

1. A network device initialization method, characterized in that: Applied to a network device, the network device corresponds to multiple hardware versions, the network device is pre-configured with a boot Bootloader file, a specified running BIN file and a Bootloader configuration file, the Bootloader file includes Bootloader programs corresponding to the multiple hardware versions respectively, the BIN file includes BIN programs corresponding to the multiple hardware versions respectively, the file header of the Bootloader file records the description information of the Bootloader program corresponding to each hardware version, and the data part of the Bootloader file records the Bootloader program corresponding to each hardware version; the file header of the BIN file records the description information of the BIN program corresponding to each hardware version, and the data part of the BIN file records the BIN program corresponding to each hardware version, and the method includes: Obtain hardware information of the target hardware version of the network device from the Bootloader configuration file; Searching a first offset corresponding to the hardware information of the target hardware version from a file header of the Bootloader file, wherein the first offset is used to identify a position of a Bootloader program corresponding to the target hardware version in the Bootloader file, and loading and running the Bootloader program at a position corresponding to the first offset; Search the file header of the BIN file for a second offset corresponding to the hardware information of the target hardware version, where the second offset is used to identify the position of the BIN program corresponding to the target hardware version in the BIN file, and load and run the BIN program at the position corresponding to the second offset.

2. The method according to claim 1, characterized in that The file header of the Bootloader file and the file header of the BIN file both include sub-file headers corresponding to the multiple hardware versions, each sub-file header is used to record the corresponding relationship between the hardware information of the hardware version and the offset, and searching the first offset corresponding to the hardware information of the target hardware version from the file header of the Bootloader file includes: Traversing each sub-file header included in the file header of the Bootloader file in turn, and searching for the first sub-file header containing the hardware information of the target hardware version; Acquire a first offset corresponding to the hardware information of the target hardware version from the first sub-file header; The searching the file header of the BIN file for the second offset corresponding to the hardware information of the target hardware version includes: Traversing each sub-file header included in the file header of the BIN file in turn, and searching for a second sub-file header containing hardware information of the target hardware version; A second offset corresponding to the hardware information of the target hardware version is obtained from the second sub-file header.

3. The method according to claim 1, characterized in that The file header of the Bootloader file also includes a total file header, and the total file header includes a file type field. The obtaining hardware information of the target hardware version of the network device from the Bootloader configuration file includes: Get the value of the file type field; If the value of the file type field indicates that the Bootloader file includes a plurality of Bootloader programs, hardware information of the target hardware version to which the network device belongs is obtained from the Bootloader configuration file.

4. The method according to claim 1, characterized in that The hardware information consists of at least one hardware type representing hardware version differences, the at least one hardware type is arranged in a preset order, and each hardware type is represented by at least one binary bit.

5. The method according to claim 1, characterized in that After loading and running the BIN program at the position corresponding to the second offset, the method further includes: If there is hardware whose driver has not been successfully installed, a driver request is sent to the server, wherein the driver request includes hardware information of the target hardware version to which the network device belongs; A driver program returned by the server based on the driver request is received and loaded, wherein the returned driver program is the latest driver program retrieved by the server according to the hardware information carried in the driver request.

6. A network device initialization device, characterized in that: Applied to a network device, the network device corresponds to multiple hardware versions, the network device is pre-configured with a boot Bootloader file, a specified running BIN file and a Bootloader configuration file, the Bootloader file includes multiple Bootloader programs corresponding to the multiple hardware versions respectively, the BIN file includes multiple BIN programs corresponding to the multiple hardware versions respectively, the file header of the Bootloader file records the description information of the Bootloader program corresponding to each hardware version, and the data part of the Bootloader file records the Bootloader program corresponding to each hardware version; the file header of the BIN file records the description information of the BIN program corresponding to each hardware version, and the data part of the BIN file records the BIN program corresponding to each hardware version, and the device includes: A hardware information acquisition unit, used to acquire hardware information of a target hardware version of the network device from the Bootloader configuration file; A Bootloader program loading unit, configured to search a first offset corresponding to the hardware information of the target hardware version from a file header of the Bootloader file, wherein the first offset is used to identify a position of the Bootloader program corresponding to the target hardware version in the Bootloader file, and load and run the Bootloader program at the position corresponding to the first offset; A BIN program loading unit is used to search for a second offset corresponding to the hardware information of the target hardware version from the file header of the BIN file, wherein the second offset is used to identify the position of the BIN program corresponding to the target hardware version in the BIN file, and load and run the BIN program at the position corresponding to the second offset.

7. The device according to claim 6, characterized in that The file header of the Bootloader file and the file header of the BIN file both include sub-file headers corresponding to the multiple hardware versions, each sub-file header is used to record the corresponding relationship between the hardware information of the hardware version and the offset, and the Bootloader program loading unit searches the file header of the Bootloader file for the first offset corresponding to the hardware information of the target hardware version, including: Traversing each sub-file header included in the file header of the Bootloader file in turn, and searching for the first sub-file header containing the hardware information of the target hardware version; Acquire a first offset corresponding to the hardware information of the target hardware version from the first sub-file header; The BIN program loading unit searches for a second offset corresponding to the hardware information of the target hardware version from a file header of the BIN file, including: Traversing the sub-file headers included in the file header of the BIN file in sequence, and searching for the second sub-file header containing the hardware information of the target hardware version; A second offset corresponding to the hardware information of the target hardware version is obtained from the second sub-file header.

8. The device according to claim 6, characterized in that The file header of the Bootloader file also includes a total file header, and the total file header includes a file type field. The hardware information acquisition unit acquires hardware information of a target hardware version of the network device from the Bootloader configuration file, including: Get the value of the file type field; If the value of the file type field indicates that the Bootloader file includes a plurality of Bootloader programs, hardware information of the target hardware version to which the network device belongs is obtained from the Bootloader configuration file.

9. The device according to claim 6, characterized in that The hardware information consists of at least one hardware type representing hardware version differences, the at least one hardware type is arranged in a preset order, and each hardware type is represented by at least one binary bit.

10. The device according to claim 6, characterized in that The device also includes: a request sending unit, configured to send a driver request to a server after the BIN program loading unit loads and runs the BIN program at the position corresponding to the second offset, if there is hardware for which a driver has not been successfully installed, wherein the driver request includes hardware information of a target hardware version to which the network device belongs; The driver receiving unit is used to receive and load the driver program returned by the server based on the driver request, wherein the returned driver program is the latest driver program retrieved by the server according to the hardware information carried in the driver request.