Method and device for adjusting startup order of startup items, storage medium and electronic device
By automatically adjusting the priority of startup items and utilizing network card address matching, the problem of low startup efficiency under multi-network card configuration is solved, achieving a fast and efficient boot process.
Patent Information
- Application Number
- CN202311616658.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-29
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2043-11-29
AI Technical Summary
Adjusting the boot order of boot items in existing technologies is inefficient, especially in multi-NIC configurations, where manual modification of the boot order or sequential polling leads to wasted time.
By obtaining the network card address of the target device and the network card address in the memory, the priority of the boot items is automatically adjusted to ensure that the boot item matching the valid network card address has the highest priority, thus achieving fast boot.
It improves the efficiency of adjusting the startup order of startup items, shortens the boot time, and reduces the need for manual adjustment.
Smart Images

Figure CN117742800B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, and more specifically, to a method, apparatus, storage medium, and electronic device for adjusting the startup order of startup items. Background Technology
[0002] PXE is a network boot protocol, short for Preboot Execution Environment. It allows a computer to boot an operating system from a remote server over a network. PXE is commonly used for large-scale deployments of computer systems, such as batch installation of operating systems in enterprise environments or remote computer management. Installing multiple network interface cards (NICs) on a server can provide advantages such as higher network bandwidth, redundancy and high availability, traffic offloading, and support for virtualization and containerization. This is crucial for servers handling high traffic, high availability, and network optimization. With the development of customer technology and the demands of customer business, more and more data centers are starting to use IB cards + NIC configurations, or multiple NIC configurations. Therefore, multiple PXE boot entries are generated during the boot process, but often only one NIC can successfully boot the PXE boot entry.
[0003] In related technologies, startup items can be sequentially polled according to their generated order until a network card capable of booting PXE is found, at which point the system boots. Alternatively, the customer can manually modify the startup order of a network card in the setup process to prioritize its startup. The default polling method, when network cards capable of booting PXE are located later in the default order, will poll all preceding PXE instances before executing the PXE instance on a valid network card, a slow and time-consuming process. Manually modifying the startup item order or using other methods requires adjustments during configuration changes.
[0004] This indicates that the relevant technologies suffer from low efficiency in adjusting the startup order of startup items.
[0005] There is currently no effective solution to the aforementioned problems in the relevant technologies. Summary of the Invention
[0006] This application provides a method, apparatus, storage medium, and electronic device for adjusting the startup order of startup items, so as to at least solve the problem of low efficiency in adjusting the startup order of startup items in related technologies.
[0007] According to one embodiment of this application, a device startup method is provided, comprising: upon receiving a power-on command for starting a target device, acquiring startup items included in a target system required to start the target device, and startup item attributes of the startup items, wherein the startup items include PXE startup items; determining a first network interface card (NIC) address for a first NIC used to boot each startup item included in the startup items based on the startup item attributes; acquiring a second NIC address stored in a target memory included in the target device; and adjusting the priority of the startup items based on the first NIC address and the second NIC address, wherein the priority is used to indicate the startup order of the startup items.
[0008] In an exemplary embodiment, adjusting the priority of the boot item based on the first network interface card (NIC) address and the second NIC address includes: determining a target NIC address included in the first NIC address that is the same as the second NIC address; determining a target boot item corresponding to the target NIC address; and adjusting the priority of the target boot item to be higher than the priority of other boot items, wherein the other boot items are boot items included in the boot items other than the target boot item.
[0009] In an exemplary embodiment, determining a target network interface address that is the same as the second network interface address included in the first network interface address includes: polling the first network interface address to determine the target network interface address that is the same as the second network interface address; the method further includes: exiting the polling after determining the target network interface address.
[0010] In an exemplary embodiment, before obtaining the startup items included in the target system required to start the target device, the method further includes: obtaining all startup items included in the target system and all startup item attributes; determining the valid startup items included in all startup items based on the attributes of all startup items; and determining the valid startup items as the startup items.
[0011] In one exemplary embodiment, determining the valid launch items included in all launch items based on all launch item attributes includes: determining a first launch item whose attribute is a hidden attribute; determining a second launch item whose attribute is a deleted attribute; and determining the launch items included in all launch items other than the first launch item and the second launch item as the valid launch items.
[0012] In an exemplary embodiment, after adjusting the priority of the boot item based on the first network interface card (NIC) address and the second NIC address, the method further includes: polling the target boot item included in the boot order according to the priority; obtaining the NIC address corresponding to the target boot item and writing it into a target memory; and executing a target boot to boot the target boot item through the NIC corresponding to the NIC address stored in the target memory.
[0013] In one exemplary embodiment, obtaining the second network interface card (NIC) address stored in a target memory included in the target device includes: if the target memory includes a NIC address, determining the NIC address included in the target memory as the second NIC address; if the target memory does not include a NIC address, determining an empty address as the second NIC address.
[0014] According to another embodiment of this application, a device startup apparatus is provided, comprising: a first acquisition module, configured to, upon receiving a power-on command for starting a target device, acquire startup items included in a target system required to start the target device, and startup item attributes of the startup items, wherein the startup items include PXE startup items; a determination module, configured to, based on the startup item attributes, determine a first network interface card (NIC) address for booting each startup item included in the startup items; a second acquisition module, configured to acquire a second NIC address stored in a target memory included in the target device; and an adjustment module, configured to, based on the first NIC address and the second NIC address, adjust the priority of the startup items, wherein the priority is used to indicate the startup order of the startup items.
[0015] According to yet another embodiment of this application, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and the computer program is configured to perform the steps in any of the above method embodiments when it is run.
[0016] According to yet another embodiment of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0017] This application, upon receiving a power-on command to power on a target device, obtains the startup items included in the target system required to power on the target device, and the startup item attributes of these startup items; determines the first network interface card (NIC) address of the first NIC used to boot each startup item based on the startup item attributes; obtains the second NIC address stored in the target memory included in the target device; and adjusts the priority of the startup items based on the first NIC address and the second NIC address, where the priority is used to indicate the boot order of the startup items. Since the first NIC address of the first NIC of each startup item and the second NIC address stored in the target memory can be determined, the priority of the startup items is automatically adjusted according to the first NIC address and the second NIC address. Therefore, the problem of low efficiency in adjusting the boot order of startup items in related technologies can be solved, achieving the effect of improving the efficiency of adjusting the boot order of startup items. Attached Figure Description
[0018] Figure 1 This is a hardware structure block diagram of a server device for a device startup method according to an embodiment of this application;
[0019] Figure 2 This is a flowchart of a device startup method according to an embodiment of this application;
[0020] Figure 3 This is a hardware topology diagram of a server with multiple network interface cards according to an embodiment of this application;
[0021] Figure 4 This is a flowchart illustrating the adjustment of the priority of startup items based on the first network card address and the second network card address according to a specific embodiment of the present invention;
[0022] Figure 5 This is a flowchart illustrating the process of booting the target startup item through the network card corresponding to the network card address stored in the target memory, according to a specific embodiment of the present invention.
[0023] Figure 6 This is a structural block diagram of a device for adjusting the startup order of startup items according to an embodiment of this application. Detailed Implementation
[0024] The embodiments of this application will be described in detail below with reference to the accompanying drawings and examples.
[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0026] The methods and embodiments provided in this application can be executed on a server device or a similar computing device. Taking running on a server device as an example, Figure 1 This is a hardware structure block diagram of a server device for a device startup method according to an embodiment of this application. For example... Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The server device may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the server equipment described above. For example, the server equipment may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0027] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the device startup method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thus implementing the above-described method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to server devices via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0028] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider for the server device. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0029] This embodiment provides a device startup method. Figure 2 This is a flowchart of a device startup method according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps:
[0030] Step S202: Upon receiving a power-on command for powering on the target device, obtain the startup items included in the target system required to power on the target device, and the startup item attributes of the startup items, wherein the startup items include PXE startup items.
[0031] Step S204: Determine the first network card address of the first network card used to boot each of the boot items included in the boot item based on the boot item attributes;
[0032] Step S206: Obtain the address of the second network card stored in the target memory included in the target device;
[0033] Step S208: Adjust the priority of the boot items based on the first network card address and the second network card address, wherein the priority is used to indicate the boot order of the boot items.
[0034] In the above embodiments, the target device can be a server, computer, or other similar device. This embodiment will use a server as an example to illustrate the concept. A server can have multiple network interface cards (NICs) installed to provide higher network bandwidth, redundancy and high availability, traffic offloading, and support for virtualization and containerization. When a server includes multiple NICs, a hardware topology diagram of a multi-NIC server can be found in the appendix. Figure 3 ,like Figure 3 As shown, the basic topology uses OCP network cards for network links, with multiple IB cards (which also support PXE functionality; IB cards are included in the subsequent descriptions) used in high-performance computing clusters, supercomputers, and data centers to provide efficient data transmission and communication capabilities. Furthermore, for some machines requiring high bandwidth and large traffic volumes, multiple network cards are also necessary to meet the actual needs of the business. For example... Figure 3 As shown, each network card contains an IB card, and those with two MICs can generate 18 IPv4 boot entries and 18 IPv6 boot entries. Some network cards also have four NICs, which will generate even more PXE boot entries. Furthermore, some customers are starting to require support for HTTP boot, which will generate even more network boot entries. If the last boot entry is processed in the normal order, the time it takes for the last PXE boot entry to successfully boot can be very long. Therefore, the boot order can be adjusted by changing the priority of the boot entries to save boot time.
[0035] In the above embodiments, both the first and second network interface cards (NICs) can be InfiniBand (IB) cards. IB cards are a high-performance computing and data center networking technology used to build low-latency and high-bandwidth interconnect networks. IB cards use the InfiniBand protocol for data transmission, supporting point-to-point and multicast communication, and feature very low transmission latency and high bandwidth. IB cards are commonly used in high-performance computing clusters, supercomputers, and data centers, providing efficient data transmission and communication capabilities.
[0036] In the above embodiments, the target system can be a Basic Input / Output System (BIOS). BIOS is an abbreviation for Basic Input / Output System, a type of firmware in a computer system. It is located in a chip on the computer motherboard and is responsible for hardware initialization and self-test during computer startup, as well as providing basic input / output functions. The boot entry can be a PXE boot entry. PXE is a network boot protocol, short for Preboot Execution Environment. It allows a computer to boot an operating system from a remote server over a network. PXE is commonly used for large-scale deployment of computer systems, such as batch installation of operating systems in enterprise environments or remote computer management. The first network card address can be a MAC address, and the second network card address can also be a MAC address. A MAC address (Media Access Control) is a physical address used to uniquely identify network devices in a network. Each network device has a unique MAC address, consisting of 48 bits of binary digits, usually represented in hexadecimal.
[0037] In the above embodiments, the target memory can be NVRAM (Non-Volatile Random Access Memory), a type of non-volatile random access memory that can retain data even when power is off. Unlike traditional random access memory (RAM), which loses its data after power is off, NVRAM can persistently store data. The target memory can store the address of the second network interface card (NIC), which can be the address of the NIC that was booted from the previous startup item when the target device was first started.
[0038] In the above embodiment, key information such as the MAC address of the network interface card (NIC) during a normal PXE boot can be recorded. Upon the next boot, the recorded MAC address (i.e., the second NIC address) is used to match the corresponding PXE boot entry, and this boot entry is prioritized to the highest level for PXE types and saved. This ensures that the device will boot from this network port every time it boots thereafter.
[0039] Specifically, upon receiving the boot command, all valid PXE boot entries in the system can be obtained through all PCIe network cards. The MAC address of the last booted PXE entry, such as the address of the second network card, is matched from the target memory, such as NVRAM. The boot entry with the matching MAC address in the current PXE is then prioritized as the highest priority. During normal boot, PXEs are polled according to their priority, and the MAC address of the corresponding network card of the currently successfully polled PXE is written into NVRAM.
[0040] This application, upon receiving a power-on command to power on a target device, obtains the startup items included in the target system required to power on the target device, and the startup item attributes of these startup items; determines the first network interface card (NIC) address of the first NIC used to boot each startup item based on the startup item attributes; obtains the second NIC address stored in the target memory included in the target device; and adjusts the priority of the startup items based on the first NIC address and the second NIC address, where the priority is used to indicate the boot order of the startup items. Since the first NIC address of the first NIC of each startup item and the second NIC address stored in the target memory can be determined, the priority of the startup items is automatically adjusted according to the first NIC address and the second NIC address. Therefore, the problem of low efficiency in adjusting the boot order of startup items in related technologies can be solved, achieving the effect of improving the efficiency of adjusting the boot order of startup items.
[0041] The entity performing the above steps can be a server, but is not limited to this.
[0042] In an exemplary embodiment, adjusting the priority of the startup item based on the first network interface card (NIC) address and the second NIC address includes: determining a target NIC address included in the first NIC address that is identical to the second NIC address; determining a target startup item corresponding to the target NIC address; and adjusting the priority of the target startup item to be higher than the priority of other startup items, wherein the other startup items are startup items included in the startup items excluding the target startup item. In this embodiment, the startup item attributes of each startup item include the MAC address of the startup item. Therefore, the first NIC address may include multiple MAC addresses. A target NIC address identical to the second NIC address among the multiple MAC addresses can be determined, and the target startup item corresponding to the target NIC address can be determined, and the priority of the target startup item can be adjusted to the highest level.
[0043] In the above embodiments, by adjusting the priority of the target startup item to the highest level, the target startup item can be prioritized during boot, so that the target startup item is the first to be booted and thus the boot is the first to be successfully started, shortening the boot time.
[0044] In one exemplary embodiment, determining a target network interface card (NIC) address included in the first NIC address that is identical to the second NIC address includes: polling the first NIC address to determine the target NIC address identical to the second NIC address; the method further includes: exiting the polling after determining the target NIC address. In this embodiment, each NIC address included in the first NIC address can be polled to determine the target NIC address identical to the second NIC address, and the polling can be exited after the target NIC address is determined. That is, the polling exits as soon as the target NIC address is determined, without needing to determine whether each NIC address included in the first NIC address is identical to the second NIC address.
[0045] In the above embodiments, by polling the first network card address and exiting the polling after determining the target network card address, it is possible to exit the polling once the target address is found when the target network card address is not the last address included in the first network card address, thus shortening the time for determining the target network card address.
[0046] In an exemplary embodiment, before obtaining the startup items included in the target system required to power on the target device, the method further includes: obtaining all startup items included in the target system, and all startup item attributes; determining valid startup items among all startup items based on the attributes of all startup items; and determining the valid startup items as the startup items. In this embodiment, valid startup items can be determined from all startup items based on their attributes, and the valid startup items can be determined as startup items. The attributes of all startup items may include hidden attributes, deleted attributes, etc.
[0047] In an exemplary embodiment, determining the valid launchers among all launcher attributes based on all launcher attributes includes: determining a first launcher whose attribute among all launcher attributes is a hidden attribute; determining a second launcher whose attribute among all launcher attributes is a deleted attribute; and determining the launchers among all launchers other than the first and second launchers as the valid launchers. In this embodiment, all PXE launchers can be polled to determine whether the attribute of the current launcher is a hidden or deleted launcher. If the attribute is a hidden or deleted launcher, the launcher corresponding to that attribute is determined as an invalid launcher, and the launchers other than the invalid launchers are determined as valid launchers.
[0048] In the above embodiments, all startup items are filtered based on their attributes, invalid startup items are deleted, and valid startup items are retained. Adjusting the priority of only valid startup items significantly reduces the adjustment time compared to adjusting the priority of all startup items.
[0049] In an exemplary embodiment, after adjusting the priority of the boot items based on the first network interface card (NIC) address and the second NIC address, the method further includes: polling the target boot items included in the boot order according to the priority; obtaining the NIC address corresponding to the target boot item and writing it into the target memory; executing the target boot to boot the target boot item through the NIC corresponding to the NIC address stored in the target memory. All PXE boot items can be polled, but only the target boot items executable in the boot order are polled. The MAC address is obtained from the PXE boot item and written into NVRAM for storage. Normal PXE booting is then performed. If booting is successful, the system enters the PXE system normally. If booting fails, the steps of "obtaining the MAC address from the PXE boot item and writing it into NVRAM for storage" are repeated until the system enters or all PXE boot items are polled. Then, the loop is exited according to the code logic.
[0050] In the above embodiment, the PXE boot entry that was successfully booted in the current system will have the highest priority on the next boot. This ensures that, without any configuration changes by the customer, the highest-priority PXE boot entry will always be a valid boot entry on every subsequent boot, except for the first boot. It also allows for automatic adjustment of PXE boot priorities and optimal boot order after configuration changes, without requiring any modifications from the customer; a normal boot will automatically achieve this.
[0051] In one exemplary embodiment, obtaining the second network interface card (NIC) address stored in the target memory included in the target device includes: if the target memory includes a NIC address, determining the NIC address included in the target memory as the second NIC address; if the target memory does not include a NIC address, determining an empty address as the second NIC address. In this embodiment, the MAC address of the NIC that last successfully booted PXE, i.e., the second NIC address, can be obtained from NVRAM. If obtaining it fails, an empty MAC address, i.e., an empty address, is created and stored back in NVRAM.
[0052] In one exemplary embodiment, upon receiving a power-on command to power on the target device, the status information of each network interface card (NIC) included in the target device can be obtained. This status information may be information configured for the NICs after the previous startup of the target device. The target NIC address is determined based on the NIC status information. The target startup item corresponding to the address identical to the target NIC address is determined from the startup items. The target NIC is controlled to boot the target startup item to load the target system and complete the initialization work before powering on the target device. Here, the target NIC's status information indicates it is in an available state, while the status information of other NICs indicates it is in a disabled state. The target NIC is the NIC that booted the startup item during the previous startup of the target device. The other NICs are NICs other than the target NIC. After the target NIC starts working, the status of the other NICs is adjusted to an available state.
[0053] The following describes the method for adjusting the startup order of startup items, with reference to specific implementation methods:
[0054] Figure 4 This is a flowchart illustrating how to adjust the priority of startup items based on the first network interface card (NIC) address and the second NIC address according to a specific embodiment of the present invention. Figure 4 As shown, the process includes:
[0055] ① Retrieve the MAC address of the network card that last successfully booted PXE (corresponding to the second network card address) stored in NVRAM (corresponding to the target memory mentioned above). If the retrieval fails, create an empty MAC address (corresponding to the empty address mentioned above) and store it back in NVRAM. If the retrieval is successful, proceed directly to the next step. The current MAC address is denoted as A.
[0056] ② Obtain the names, startup priorities, and other attributes of all PXE boot entries generated during the current startup from the code.
[0057] ③ Poll all PXE startup items, determine whether the current startup item is a hidden or deleted startup item. If it is a valid startup item, proceed to step ④. If it is a hidden or deleted invalid startup item, jump to the next startup item and repeat the current step.
[0058] ④ Obtain the MAC address of the current startup item from its properties, and denote this MAC address as B (corresponding to the first network card address mentioned above).
[0059] ⑤ Compare MAC address A and MAC address B. If the two MAC addresses are exactly the same, adjust the boot priority of this boot item to the highest and exit this round of testing. If the MAC addresses are different, skip this loop and continue testing the next PXE boot item, jumping to step ③, until an exactly the same MAC address is found, or until all PXE boot items have been tested, then exit this loop.
[0060] Figure 5 This is a flowchart illustrating the process of booting the target system from the network card address stored in the target memory according to a specific embodiment of the present invention. Figure 5 As shown, the process includes:
[0061] ② Poll all PXE boot entries, but only poll the boot entries that can be executed in the boot order.
[0062] ② Obtain the MAC address from the PXE boot entry and write this MAC address into NVRAM for storage (corresponding to the MAC address A read from NVRAM in the above steps).
[0063] ③ Perform PXE booting normally. If booting is successful, the user will enter the PXE system normally. If booting fails, repeat step ② until the user enters the system or all PXE boot entries have been polled. Then, exit the loop according to the code logic.
[0064] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0065] This embodiment also provides a device for adjusting the startup order of startup items. This device is used to implement the above embodiments and preferred embodiments, and will not be repeated as already described. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0066] Figure 6 This is a structural block diagram of a device for adjusting the startup order of startup items according to an embodiment of this application, such as... Figure 6As shown, the device includes:
[0067] The first acquisition module 62 is used to acquire, upon receiving a power-on command for powering on the target device, the startup items included in the target system required to power on the target device, and the startup item attributes of the startup items, wherein the startup items include PXE startup items.
[0068] The determining module 64 is used to determine, based on the boot item attributes, the first network card address of the first network card used to boot each boot item included in the boot item;
[0069] The second acquisition module 66 is used to acquire the address of the second network card stored in the target memory included in the target device;
[0070] The adjustment module 68 is used to adjust the priority of the boot items based on the first network card address and the second network card address, wherein the priority is used to indicate the boot order of the boot items.
[0071] In an exemplary embodiment, the adjustment module 68 can adjust the priority of the boot item based on the first network card address and the second network card address in the following manner: determining a target network card address that is the same as the second network card address included in the first network card address; determining a target boot item corresponding to the target network card address; and adjusting the priority of the target boot item to be higher than the priority of other boot items, wherein the other boot items are boot items other than the target boot item included in the boot items.
[0072] In an exemplary embodiment, the adjustment module 68 can determine the target network interface address that is the same as the second network interface address included in the first network interface address by polling the first network interface address to determine the target network interface address that is the same as the second network interface address; the device is further configured to exit polling after determining the target network interface address.
[0073] In an exemplary embodiment, the apparatus may be configured to, before acquiring all startup items included in the target system and all startup item attributes, based on the startup item attributes, determine the valid startup items included in the target system, and determine the valid startup items as the startup items.
[0074] In an exemplary embodiment, the apparatus may determine the valid launch items included in all launch items based on all launch item attributes by: determining a first launch item whose attribute is a hidden attribute; determining a second launch item whose attribute is a deleted attribute; and determining the launch items included in all launch items other than the first launch item and the second launch item as the valid launch items.
[0075] In an exemplary embodiment, the apparatus may further be configured to, after adjusting the priority of the boot items based on the first network interface card address and the second network interface card address, poll the target boot items included in the boot order according to the priority; obtain the network interface card address corresponding to the target boot item and write it into the target memory; and execute the target boot to boot the target boot item through the network interface card corresponding to the network interface card address stored in the target memory.
[0076] In an exemplary embodiment, the second acquisition module 66 can acquire the second network card address stored in the target memory included in the target device in the following manner: if the target memory includes a network card address, the network card address included in the target memory is determined as the second network card address; if the target memory does not include a network card address, an empty address is determined as the second network card address.
[0077] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0078] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when run.
[0079] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0080] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0081] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0082] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0083] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0084] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims
1. A method for adjusting the startup order of startup items, characterized in that, include: Upon receiving a power-on command to power on the target device, the system obtains the startup items included in the target system required to power on the target device, as well as the startup item attributes of the startup items, wherein the startup items include PXE startup items. Based on the boot item attributes, determine the first network card address of the first network card used to boot each boot item included in the boot item; Obtain the address of the second network interface card stored in the target memory included in the target device; The priority of the startup items is adjusted based on the first network card address and the second network card address, wherein the priority is used to indicate the startup order of the startup items; Adjusting the priority of the boot item based on the first network card address and the second network card address includes: determining a target network card address included in the first network card address that is the same as the second network card address; determining a target boot item corresponding to the target network card address; and adjusting the priority of the target boot item to be higher than the priority of other boot items, wherein the other boot items are boot items included in the boot items other than the target boot item. After adjusting the priority of the boot items based on the first network card address and the second network card address, the method further includes: polling the target boot items included in the boot order according to the priority; obtaining the network card address corresponding to the target boot item and writing it into the target memory; and executing the target boot to boot the target boot item through the network card corresponding to the network card address stored in the target memory. The second network card address is the address of the network card that normally booted the startup item when the target device was previously started.
2. The method according to claim 1, characterized in that, Determining the target network interface address (NIC) that is the same as the second NIC address included in the first NIC address includes: Poll the first network interface card (NIC) address to determine the target NIC address that is the same as the second NIC address; The method further includes: after determining the target network card address, exiting polling.
3. The method according to claim 1, characterized in that, Before obtaining the startup items included in the target system required to enable the target device, the method further includes: Obtain all startup items and their attributes included in the target system; Based on the attributes of all startup items, determine the valid startup items included in all startup items; The valid startup item is determined as the boot startup item.
4. The method according to claim 3, characterized in that, Based on all the startup item attributes, the valid startup items included in all startup items are determined, including: The first startup item whose attribute is a hidden attribute is identified from all startup item attributes. Identify the second startup item whose attributes among all startup item attributes are those that have been deleted; The startup items other than the first startup item and the second startup item are identified as the valid startup items.
5. The method according to claim 1, characterized in that, Obtain the address of the second network interface card (NIC) stored in the target memory of the target device, including: If the target memory includes a network card address, the network card address included in the target memory shall be determined as the second network card address; If the target memory does not contain a network card address, the empty address will be determined as the second network card address.
6. A device for adjusting the startup sequence of startup items, characterized in that, include: The first acquisition module is used to acquire, upon receiving a power-on command for powering on the target device, the startup items included in the target system required to power on the target device, and the startup item attributes of the startup items, wherein the startup items include PXE startup items. The determination module is used to determine, based on the boot item attributes, the first network card address of the first network card used to boot each boot item included in the boot item; The second acquisition module is used to acquire the address of the second network card stored in the target memory included in the target device; An adjustment module is used to adjust the priority of the startup items based on the first network card address and the second network card address, wherein the priority is used to indicate the startup order of the startup items; The adjustment module adjusts the priority of the startup item based on the first network card address and the second network card address in the following way: determining a target network card address that is the same as the second network card address included in the first network card address; determining a target startup item corresponding to the target network card address; and adjusting the priority of the target startup item to be higher than the priority of other startup items, wherein the other startup items are startup items included in the startup items other than the target startup item. The device is further configured to: after adjusting the priority of the boot items based on the first network card address and the second network card address, poll the target boot items included in the boot order according to the priority; obtain the network card address corresponding to the target boot item and write it into the target memory; execute the target boot to boot the target boot item through the network card corresponding to the network card address stored in the target memory; The second network card address is the address of the network card that normally booted the startup item when the target device was previously started.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method described in any one of claims 1 to 5.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 5.
Citation Information
Patent Citations
Method and device for installing operating system, computer equipment and storage medium
CN112860330A
PXE-based operating system installation method, computing device and communication system
CN115576613A
