Method and device for starting operating system and computing equipment

By obtaining the hardware device information of computing device and automatically selecting the operating system based on mapping relationships, the complexity and compatibility issues of operating system selection are solved, and a fast and reliable startup process is achieved, improving user experience and system stability.

CN118939325APending Publication Date: 2024-11-12XFUSION DIGITAL TECH CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202410944142.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-12
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

During the startup stage of computing device, users need to choose one of multiple operating systems, and different operating systems have different support levels of hardware devices, resulting in startup efficiency and compatibility issues, increasing user operation complexity and error risks.

Method used

By obtaining the device information of the in-place hardware device in the computing device, the most suitable target operating system is automatically selected based on the preset mapping relationship, reducing manual selection and waiting time, and improving startup efficiency and stability.

Benefits of technology

It realizes fast and reliable operating system startup, reduces the risk of user operation errors, improves user experience and system compatibility, and adapts to different hardware environments and operating system versions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939325A_ABST
    Figure CN118939325A_ABST
Patent Text Reader

Abstract

The invention provides a method and device for starting an operating system and computing equipment, and relates to the technical field of computers. The method comprises the following steps: acquiring equipment information of in-place hardware equipment in the computing equipment in a starting stage of the computing equipment; based on a preset mapping relation, determining a target operating system corresponding to the equipment information; wherein the preset mapping relation in the computing device indicates the mapping relation between at least one operating system and the device information, and the at least one operating system comprises a target operating system; and starting the target operating system. Thus, the operation system compatible with the in-place hardware equipment can be selected to be started in the starting stage of the computing equipment, the maintainability and stability of the system are improved, and the problem that the operation system cannot be started due to improper manual selection of a user in the starting stage of the operation system is solved. Or a default starting operation system preset by the system is not compatible with hardware equipment in place in the starting stage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device and computing equipment for starting an operating system. Background Art

[0002] During the startup phase of a computing device, users are usually faced with the situation of selecting an operating system from multiple operating systems to start. These operating systems may include different system types or different versions of the same system. The computing device can be set to automatically display these operating system options when it starts. The user can select the operating system they want to start in the boot interface, or make no selection. If the user does not make a selection within a preset time, the system will automatically boot to the default operating system for startup.

[0003] However, the various hardware devices installed in computing devices, such as PCIe and PCI peripherals, are usually produced by different manufacturers. These devices may be optimized for specific operating systems and provide dedicated drivers and support. Therefore, they can provide better performance and stability on these operating systems. In addition, there are differences in the operating system's support for peripheral hardware. Some systems may have built-in driver support for devices from specific manufacturers, which can show better compatibility. For other systems, it may be necessary to install additional drivers or perform specific configurations to achieve full compatibility with these hardware devices. Summary of the invention

[0004] The embodiments of the present application provide a method, apparatus, computing device, computer storage medium, and computer program product for starting an operating system, which can realize the selection of an adapted operating system for startup.

[0005] In a first aspect, an embodiment of the present application provides a method for starting an operating system, the method comprising: in a startup phase of a computing device, obtaining device information of an in-place hardware device in the computing device; based on a preset mapping relationship, determining a target operating system corresponding to the device information; wherein the preset mapping relationship indicates a mapping relationship between at least one operating system and the device information, and the at least one operating system includes a target operating system; and starting the target operating system.

[0006] In the above example, in an electronic device, such as a server. During the startup phase of the server, if multiple operating systems are installed on the server, it is necessary to select one operating system from the multiple operating systems to start when a server startup event occurs. At the moment of the startup event, usually one of the multiple operating systems can match the hardware device in place at the startup moment. Hardware devices connected to the server, such as devices connected to the server system bus and / or devices directly connected to the server motherboard. By selecting an operating system that matches the hardware device to start, the operating system can better cooperate with the hardware device and improve the startup efficiency, stability and reliability of the system. An adapted operating system can give full play to the performance of the hardware device, thereby obtaining better system performance and response speed. An adapted operating system can reduce compatibility issues and conflicts, and improve the maintainability and stability of the system.

[0007] In one possible example, the computing device startup phase is a BIOS startup phase.

[0008] In one possible example, a mapping relationship between at least one operating system and device information has a sequence of precedence, and each entry in the mapping relationship is matched with the device information in turn according to the sequence of precedence, and the operating system that first matches the device information is selected as the target operating system; each entry in the mapping relationship indicates the correspondence between the operating system and the device information of the hardware device.

[0009] In the above example, by obtaining the device information of the hardware device and matching the mapping relationship according to the pre-set order, the most suitable target operating system can be quickly determined. This method reduces the time for manual selection of the operating system, reduces the waiting time during the startup process, quickly starts the system, and improves the efficiency of device startup. Through the automated mapping and matching process, the system can intelligently select the operating system that best suits the current hardware configuration, reducing the possibility of human intervention and errors, and improving the user experience. The automated matching process also reduces the need for users to manually select the operating system and reduces the risk of human error, especially in environments where different operating systems need to be frequently started. Administrators can adjust the order of mapping relationships as needed to adapt to different hardware environments or priority policies.

[0010] In a possible example, the mapping relationship between at least one operating system and device information supports dynamic update to adapt to hardware changes or new operating systems.

[0011] In the above example, the mapping relationship can be pre-set and updated as needed to adapt to different hardware configurations and operating system versions. This method is highly flexible and scalable and can be applied to various computing devices and operating system environments. By dynamically updating the mapping relationship, the system can be compatible with more new hardware devices and reduce startup problems caused by hardware device updates. With the continuous addition of device information and the expansion of mapping relationships, the system can gradually establish a device information knowledge base to provide more reliable data support for subsequent hardware device identification and operating system matching.

[0012] In a possible example, when the target operating system corresponding to the device information is not found based on the preset mapping relationship, the device information is added to the mapping relationship, and the corresponding operating system is provided.

[0013] In the above example, the system can self-learn and update the mapping relationship. With the introduction of device information of new hardware devices, the system can automatically expand the mapping relationship to improve its adaptability and intelligence. When the device information of the new hardware device is identified and added to the mapping relationship, the user does not need to manually configure or select the operating system again the next time it is started, which improves the convenience of user experience.

[0014] In a possible example, obtaining device information of a hardware device includes: sending a device information obtaining request to a baseboard management controller BMC; receiving and parsing data returned by the BMC to determine the device information of the hardware device in place.

[0015] In the above example, by requesting the device information of the hardware device in place from the BMC, it is ensured that the latest device information is obtained during the startup phase. BMC is usually used for centralized management and monitoring of server hardware. By obtaining device information through BMC, its existing management and monitoring capabilities can be used to simplify the process of obtaining information. By obtaining device information through BMC, complex device scanning at the system level can be avoided during the startup phase, thereby improving startup efficiency.

[0016] In a possible example, after obtaining the device information of the in-place hardware device, the method further includes: extracting at least one attribute of the device information, the attribute including one or more of the hardware device's address identifier bdf, the vendor identifier vendor_id, the hardware device identifier device_id, the sub-vendor identifier sub_vendor_id, and the sub-device identifier sub_device_id; constructing an identifier for representing the hardware device using at least one extracted attribute; and the identifier is used to find the operating system corresponding to the identifier in the mapping relationship.

[0017] In the above example, by constructing a unique identifier for the device information, the system can accurately identify the currently installed hardware device. The corresponding operating system can be quickly found in the mapping relationship, reducing the search and matching time and improving the overall matching efficiency. Using specific device attributes to construct identifiers can reduce mismatches and system conflicts caused by ambiguous or incomplete device information, and improve the reliability of the system startup process.

[0018] In one possible example, the request is sent through an Intelligent Platform Management Interface, where the interface uses an Intelligent Platform Management Interface IPMI protocol or a REDFISH protocol.

[0019] In the above examples, IPMI and REDFISH are industry standard protocols. This standardized interface ensures compatibility with various hardware and software platforms, improving the versatility and reliability of the system. Using standardized protocols such as IPMI and REDFISH ensures that device information of hardware devices from different manufacturers can be extracted.

[0020] In one possible example, based on a preset mapping relationship, determining a target operating system corresponding to the device information includes: if based on the preset mapping relationship, the target operating system corresponding to the device information is not found within a preset time, outputting an operating system selection interface; and upon receiving a user operation for the operating system selection interface, determining the target operating system based on the user operation.

[0021] In the above example, the preset time limits the system's waiting time for selecting an operating system, which helps reduce the user's waiting time, especially when the device information matches the preset mapping relationship slowly or fails. This improves user friendliness and avoids startup interruptions caused by automatic matching failures.

[0022] In a possible example, after the operating system selection interface is output, if no user operation directed to the operating system selection interface is received within a preset time, the target operating system is determined to be a preset default operating system.

[0023] In the above example, when the user does not perform any operation on the operating system selection interface within the preset time, the default operating system is automatically booted to ensure that the system can still run normally even if the user does not make a selection, providing a reliable automatic fallback mechanism.

[0024] In one possible example, if there is no operating system corresponding to the device information in the preset mapping relationship, the target operating system is determined to be a preset default operating system, or an operating system selection interface is output; when a user operation is received for the operating system selection interface, the target operating system is determined based on the user operation.

[0025] In the above example, when there is no operating system that matches the device information of the hardware device in place during the startup phase, the preset default operating system is started, or the user is allowed to select the operating system during the startup process, thereby improving the flexibility of the system and adapting to the needs and usage scenarios of different users.

[0026] In a possible example, the mapping relationship between the device information of at least one operating system and the hardware device is a one-to-one mapping relationship where one operating system corresponds to one device information, or a one-to-many mapping relationship where one operating system corresponds to multiple device information.

[0027] In the above example, one-to-one and one-to-many mapping relationships are supported, so that the system can flexibly adapt to various hardware configurations and operating system environments to meet the needs of different users and application scenarios.

[0028] In a possible example, the mapping relationship includes multiple entries, each entry specifies a corresponding relationship between an operating system and device information of one or more hardware devices.

[0029] In a possible example, the mapping relationship is stored in a configuration file of a boot loader, which defines a corresponding relationship between device information of a hardware device and at least one operating system.

[0030] In a possible example, during the startup phase of the computing device, a device discovery command line program is automatically executed to determine a target operating system; the device discovery command line program includes:

[0031] Send a request to the baseboard management controller BMC to obtain the device information of the currently installed hardware device; receive the device information returned by the BMC, receive and parse the data returned by the BMC; determine the target operating system corresponding to the device information based on a preset mapping relationship; wherein the preset mapping relationship indicates a mapping relationship between at least one operating system and the device information, and the at least one operating system includes a target operating system.

[0032] In the above example, the acquisition, parsing and operating system matching functions of device information are integrated into a command line tool or module, which simplifies system management and configuration and reduces system complexity. The integrated solution reduces the workload of management and maintenance. As an independent module, it can be easily integrated into the existing boot loader and expanded as needed.

[0033] In a second aspect, an embodiment of the present application provides a device for starting an operating system, the device comprising: a device information acquisition module, used to obtain device information of hardware devices in place in a computing device during the startup phase of the computing device; an operating system determination module, used to determine a target operating system corresponding to the device information based on a preset mapping relationship; wherein the preset mapping relationship indicates a mapping relationship between at least one operating system and device information, and at least one operating system includes a target operating system; and an operating system startup module, used to start the target operating system.

[0034] In a third aspect, an embodiment of the present application provides a computing device, including:

[0035] at least one memory for storing a program;

[0036] at least one processor, configured to execute the program stored in the memory;

[0037] When the program stored in the memory is executed, the processor is used to execute the method described in the first aspect or any possible implementation manner of the first aspect.

[0038] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a processor, the processor executes the method described in the first aspect or any possible implementation of the first aspect.

[0039] In a fifth aspect, an embodiment of the present application provides a computer program product, characterized in that when the computer program product runs on a processor, the processor executes the method described in the first aspect or any possible implementation of the first aspect.

[0040] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1A A schematic diagram of a multi-operating system startup;

[0042] Figure 1B A schematic diagram of an interface for selecting an additional operating system;

[0043] Figure 2 A schematic diagram of the structure of a computing device 100 for executing a startup solution provided in an embodiment of the present application;

[0044] Figure 3 A method for starting an operating system provided in an embodiment of the present application;

[0045] Figure 4Another method for starting an operating system provided in an embodiment of the present application;

[0046] Figure 5 A schematic diagram of an execution flow of a boot loader using an MBR partition table in a BIOS traditional mode provided in an embodiment of the present application;

[0047] Figure 6 A flowchart of a method for starting an operating system provided in an embodiment of the present application;

[0048] Figure 7 A flowchart of another method for starting an operating system provided in an embodiment of the present application;

[0049] Figure 8 A schematic diagram of a flow chart of an implementation of a device discovery command module provided in an embodiment of the present application;

[0050] Fig.9A A flowchart of another method of starting an operating system provided in an embodiment of the present application;

[0051] Fig. 9B A flowchart of another method of starting an operating system provided in an embodiment of the present application;

[0052] Fig.10 A schematic diagram of a computer network for starting an operating system using PXE provided in an embodiment of the present application;

[0053] Fig.11 It is a structural diagram of a device for starting an operating system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0054] The term "and / or" in this article is a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The symbol " / " in this article indicates that the associated objects are in an or relationship, for example, A / B means A or B.

[0055] The terms "first" and "second" in the specification and claims herein are used to distinguish different objects rather than to describe a specific order of the objects. For example, a first response message and a second response message are used to distinguish different response messages rather than to describe a specific order of the response messages.

[0056] In the description of this document, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "circumferential" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation.

[0057] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way. In order to facilitate understanding of the technical solutions of the present application, the relevant terms involved in this document are explained below.

[0058] 1. Intelligent Platform Management Interface (IPMI): It is an industrial standard that defines a message-based, general, standardized abstract interface for information technology (IT) equipment management, shielding the underlying hardware details so that management software can be used across platforms. IPMI can monitor the physical health information of each hardware device in the electronic device, such as temperature, voltage, fan working status, power status, etc.; at the same time, IPMI can also record the work log of each hardware device in the electronic device to prompt the user and locate the problem later; the working status data of the hardware device is sent to the management device in the form of IPMI data, and the management device can manage the hardware devices in the electronic device according to the received IPMI data.

[0059] 2. Basic input / output system (BIOS): It is responsible for setting various parameters of system hardware. In essence, it is a set of programs, that is, a set of codes, which are fixed on a ROM chip on the motherboard of the computer.

[0060] 3. Baseboard Management Controller (BMC) is an embedded microcontroller, usually integrated on the motherboard of a server or other computing device. It is a separate processing unit independent of the main processor, mainly responsible for monitoring, managing and controlling the system hardware, temperature, power supply, fan speed, etc. BMC usually has its own storage, processing power and network interface, can remotely monitor and manage computing devices, and provide remote diagnosis, fault recovery and remote control functions.

[0061] 4. Unified Extensible Firmware Interface (UEFI) is a firmware interface standard used for operating system startup and hardware initialization. It replaces the traditional BIOS (Basic Input / Output System) and provides more powerful and flexible startup and management functions for computer systems.

[0062] 5. Legacy BIOS Traditional BIOS is a traditional computer startup method that uses the basic input / output system in the firmware to boot the operating system.

[0063] When encountering a startup event, a computing device with multiple operating systems installed provides an option for the user to select on a boot interface, receives the user's selection input, and, based on the user's selection input, loads one of the multiple operating systems to start the computing device. If the user does not make a selection within a preset time, the system will automatically boot to the default operating system for startup.

[0064] Figure 1A This is a schematic diagram of multi-operating system startup. As shown in FIG1 , a computing device detects a startup event to boot the operating system. The boot process usually starts with the firmware (BIOS or UEFI), outputs a multi-operating system selection interface, receives an operating system selection instruction input by a user, and boots the target operating system according to the operating system selection instruction. The boot module starts the target operating system, including loading the target operating system kernel and other startup-related files into the memory for execution. The boot module includes a startup code, a boot loader, and other programs related to booting the operating system. The boot loader starts the target operating system by reading the boot loader configuration file.

[0065] Figure 1BThis is a schematic diagram of a multi-operating system selection interface. The operating system selection interface is displayed to the user. The interface includes displaying multi-operating system information to the user. The information indicates that there are multiple pre-installed operating systems. The interface lists the multiple operating systems, and the user can select a target operating system from the multiple operating systems (operating systems AD) to start. Load the selected system by selecting any entry. When the boot process starts, the boot loader will load the specified operating system kernel file and then start the boot process of the operating system. Alternatively, if the user does not make a selection within a preset time, the boot loader will start the default operating system. For example, if the default operating system is set to operating system B in the configuration file, operating system B will be started after the preset time.

[0066] However, different operating systems may have different levels of hardware support. Some operating systems may already have built-in drivers for devices from certain manufacturers, or have better compatibility, so they can better support these devices. For other operating systems, additional drivers or some configuration are required to be fully compatible with certain devices.

[0067] For example, some professional server network cards may provide optimized drivers for specific operating systems to achieve higher performance and more stable network connections. In this case, it may be more appropriate to choose an operating system that is compatible with these network cards. In addition, users may make mistakes or misselect operating systems when choosing their own operating systems.

[0068] The embodiment of the present application provides a method for starting an operating system. When selecting an operating system in the booting stage, the boot loader source code is modified to automatically identify hardware device information, match the corresponding target operating system according to the information of the hardware device, and boot the target operating system. The embodiment of the present application takes into account the compatibility factors of the hardware device and makes a more professional selection of the startup operating system, saving the user the step of looking up the hardware device manual to determine the operating system compatible with the hardware device.

[0069] Figure 2 A schematic diagram of a computing device 100 for executing a startup scheme provided in an embodiment of the present application. In some possible embodiments, the computing device 100 may be a physical machine, such as a server. The computing device 100 may be a virtual device, such as a virtual machine (VM).

[0070] like Figure 2 As shown, the computing device 100 includes a processor 110, a baseboard management controller BMC130, a hardware device 140, a memory 170, and a storage device 160. The storage device 160 includes a storage firmware module (such as BIOS / UEFI)

[0071] 120, booting module 150, etc. The booting module 150 includes a boot loader, etc.

[0072] The processor 110 is a device with data processing capabilities. The storage device 160 stores program instructions and data. The storage device 160 is a non-volatile memory, such as a storage medium such as a hard disk drive, an optical disk, a USB drive, or a network storage. The processor 110 and the storage device 160 are coupled to each other. The processor 110 reads the program instructions in the storage device 160 and performs the following operations:

[0073] After the computing device 100 detects a startup event, the processor 110 loads the firmware module 120 into the memory 170 for execution, and the firmware module 120 calls the boot startup module 150, which includes but is not limited to a boot loader, etc. The boot startup module 150 is used to load the boot loader and other necessary software components into the memory 170. The processor 110 executes these software to complete the boot process of the operating system. Among them, the firmware module 120 includes but is not limited to BIOS, UEFI, etc. The firmware module 120, for example, stores a BIOS startup code, and the BIOS startup code is solidified in the BIOS chip. When the computing device 100 starts, the BIOS startup code is executed to detect the hardware and initialize the hardware, thereby performing and completing the BIOS setting. For example, the BIOS chip enumerates the PCIE / PCI devices connected to the computing device 100 and initializes the PCIE / PCI devices.

[0074] The processor 110 can start and run the boot loader in the storage device 160. The processor 110 can be one or more processors (for example: one processor, two processors, three processors, etc.). The processor 110 can also be other forms of processors, such as a graphics processing unit (GPU), an artificial intelligence (AI) chip, etc. The embodiment of the present application does not limit the specific implementation form of the processor 110. It should be understood that when the storage device 160 is a network storage medium, the storage device 160 is connected to the computing device 100 via a network.

[0075] BMC130 is connected to hardware device 140. After computing device 100 is powered on, BMC is powered on synchronously, obtains device information of hardware device 140, and stores the device information of hardware device. The hardware 140 described in the embodiment of the present application includes peripheral hardware devices. Peripheral hardware devices are devices connected to the motherboard or internal bus of the computing device, including but not limited to PCIE and / or PCI devices, such as DPU card, IPU card, smart network card, acceleration card, etc.

[0076] It should be noted that different companies' computing devices 100 have different names for BMC 130, for example, some companies call it BMC, some companies call it integrated lights-out (iLO), and another company calls it integrated Dell remote access controller (iDRAC). Regardless of whether it is called BMC, iLO or iDRAC, it can be understood as BMC 130 in the embodiment of the present invention.

[0077] The boot module 150 is implemented to obtain the device information of the hardware device 140 stored in the BMC 130, parse the device information of the hardware device 140, and obtain the device information of the hardware device in place at the startup time. Select the operating system adapted to at least one hardware device in place as the target operating system. Load the kernel of the target operating system and the necessary startup files into the memory 170 to start the target operating system.

[0078] The boot module 150 includes a boot loader, which is a program for booting an operating system, such as grub, Clover, syslinux, etc. When the firmware module 120 is UEFI, the boot loader is, for example, grub (GRand Unified Bootloader), which is a multi-operating system boot manager or boot loader, used to boot different systems. After the target operating system is determined, the boot loader is responsible for extracting the kernel and necessary startup files of the target operating system from the storage device, loading them into the memory, and configuring the startup parameters so that the operating system takes over the execution and completes the remaining startup process, including initializing system services, mounting file systems, etc., until the target operating system is fully started. The boot loader allows the user to select the operating system to be run during the computer startup phase, and can be used to select different kernel files on the operating system partition, and can also be used to pass startup parameters to these kernel files. By adding a boot menu item to the configuration file of the boot loader, and displaying the boot menu item page when the user has corresponding keyboard input. According to the configuration file grub.cfg of the boot loader, the kernel of the system such as Linux is booted. After the kernel is loaded into the memory, the kernel can start the operating system according to the configuration in the boot loader configuration file, such as grub.cfg. For example, the types of operating systems may include Linux, UNIX, CentOS, Ubuntu, Debian, Gentoo, Fedora, etc. The preset time, the default operating system, and the system option list displayed to the user are written into the configuration file of the boot loader, and various configurations of the computing device are modified through the BIOS menu page including a variety of modifiable options. The boot loader implements providing a list of operating system options for the user to choose on the boot interface, and when the user does not make a choice, the default operating system is started after the preset time.

[0079] In the grub configuration file, menuentry is used to define entries in the boot menu. This entry is usually used to boot different operating systems or different versions of operating systems. For example, if you want to boot the Ubuntu operating system, you can name the menuentry "Ubuntu"; if you want to boot the Windows operating system, you can name the menuentry "Windows". Modifying the grub.cfg file and configuring multiple menuentries means defining multiple boot options, each corresponding to a different kernel or operating system installed in the system. Each menuentry contains a set of instructions that specify the kernel to load, initrd (initial RAM disk), and other boot parameters. The linux line specifies the path to the kernel file, and the initrd line specifies the path to the initrd file. initrd (initial RAM disk) is a temporary root file system that is usually loaded into memory when Linux starts. It contains key files and tools for booting and initializing the operating system. KERNEL is an instruction used to specify the kernel file loaded by the boot loader. Squash files usually contain part or all of the file system contents of the operating system, which can be dynamically loaded into memory. Squash files can contain various files required by the operating system, such as program files, library files, and configuration files. The menuentry of the configuration file grub.cfg is as follows:

[0080] Menuentry "GPU A100 Diagnosis" {

[0081] Linux / tiny / A100 / kernel / kernel squash= / tiny / A100 / squash_iso.bin

[0082] Initrd / tiny / A100 / intird

[0083] }

[0084] In the traditional BIOS, i.e., Legacy mode, the boot loader is, for example, Isolinux. The boot loader configuration file isolinux.cfg is written. By adding the "lable" keyword, the locations of files such as kernel, initrd, and squash are specified to specify the boot menu items and related boot parameters. The menuentry of the configuration file isolinux.cfg is shown as follows:

[0085] Label a100{

[0086] Menu label^GPU A100 Diagnosis

[0087] Linux / tiny / A100 / kernel / kernel squash= / tiny / A100 / squash_iso.binInitrd / tiny / A100 / intird

[0088] }

[0089] It should be understood that the components included in the computing device and the positional relationship between the components are only for illustration, and the computing device adapted to the technical solution of the embodiment of the present application is not limited to that shown in FIG1. ​​The components included in the computing device can also be replaced with other types of components with the same functions, and the system after the component replacement is also applicable to the technical solution provided in the embodiment of the present application. The computing device can also include more or fewer components, and as the included components change, the operating system startup process will also change accordingly.

[0090] The above examples introduce the computing device 100 . Figure 3 A method for starting an operating system is provided in an embodiment of the present application. Next, in combination with Figure 2 and Figure 3 The computing device 100 in the present application is used to introduce the startup solution provided in the embodiment of the present application.

[0091] S310: During the startup phase of the computing device, obtain device information of hardware devices in the computing device.

[0092] In a possible example, the hardware device is a peripheral hardware device connected to the computing device, and the peripheral hardware device is a device connected to a motherboard or an internal bus of the computing device.

[0093] In a possible example, the peripheral hardware device includes a PCIE and / or PCI device.

[0094] After the computing device 100 is powered on, the processor 110 loads the boot code in the firmware module 120 into the memory 170 for execution. The boot code performs operations such as hardware self-test (Power-On Self Test, referred to as POST), initializes hardware devices (such as memory, hard disk, graphics card, etc.), establishes an interrupt vector table, and attempts to load the boot loader from the storage device 160, that is, a predefined boot device (such as a hard disk, an optical disk, a USB drive, etc.). The processor 110 loads the boot loader into the memory 170 for execution.

[0095] In a possible example, a request is sent to BMC 130 to request device information of the hardware device in place at the time of this startup, and the device information of the hardware device is parsed to obtain the device information of the hardware device in a required format, for example, the device information includes configuration information and identification information of the hardware device.

[0096] In one possible example, the computing device startup phase is a BIOS startup phase.

[0097] In a possible example, the computing device startup phase is a UEFI startup phase.

[0098] S320. Determine a target operating system corresponding to the device information based on a preset mapping relationship; wherein the preset mapping relationship indicates a mapping relationship between at least one operating system and the device information, and the at least one operating system includes the target operating system.

[0099] In a possible example, the mapping relationship is stored in a configuration file of a boot loader, which defines a corresponding relationship between device information of a hardware device and at least one operating system.

[0100] In a possible example, the mapping relationship includes multiple entries, each entry specifies a corresponding relationship between an operating system and device information of one or more hardware devices.

[0101] In one possible example, the device information mapping relationship between at least one operating system and a hardware device is a one-to-one mapping relationship where one operating system corresponds to one device information, or a one-to-many mapping relationship where one operating system corresponds to multiple device information. Supporting one-to-one and one-to-many mapping relationships enables the system to flexibly adapt to various hardware configurations and operating system environments to meet the needs of different users and application scenarios.

[0102] In one possible example, the mapping relationship between at least one operating system and the device information of a hardware device can be changed, such as adding, deleting or changing the mapping relationship. The system can self-learn and update the mapping relationship. With the introduction of the device information of a new hardware device, the system can automatically expand the mapping relationship to improve its adaptability and intelligence. When the device information of the new hardware device is identified and added to the mapping relationship, the user does not need to manually configure or select the operating system again the next time the system is started, which improves the convenience of the user experience.

[0103] S330, start the target operating system.

[0104] In a possible example, starting the target operating system includes reading a kernel file of the operating system into a memory.

[0105] In a possible example, if there is no operating system corresponding to the device information in the preset mapping relationship, the target operating system is determined to be a preset default operating system. Or an operating system selection interface is output. When a user operation for the operating system selection interface is received, the target operating system is determined based on the user operation.

[0106] In a possible example, when no user operation directed to the operating system selection interface is received within a preset time, the target operating system is determined to be a preset default operating system.

[0107] In a possible example, based on a preset mapping relationship, if a target operating system corresponding to the device information is not found within a preset time, an operating system selection interface is output; when a user operation for the operating system selection interface is received, the target operating system is determined based on the user operation.

[0108] Figure 4 Another method for starting an operating system is provided in an embodiment of the present application. Figure 4 As shown, the method includes:

[0109] S410: During the startup phase of the computing device, obtain device information of hardware devices in the computing device.

[0110] S420: Based on the preset mapping relationship with a sequence, match each entry in the mapping relationship with the device information in sequence according to the sequence, and select the operating system that first matches the device information as the target operating system; each entry in the mapping relationship indicates the corresponding relationship between the operating system and the device information of the hardware device. The preset mapping relationship indicates the mapping relationship between at least one operating system and the device information, and the at least one operating system includes the target operating system.

[0111] By obtaining the device information of the hardware device and matching the mapping relationship according to the pre-set order, the most suitable target operating system can be quickly determined. This method reduces the time of manually selecting the operating system, reduces the waiting time during the startup process, and improves the efficiency of device startup. Through the automated mapping and matching process, the system can intelligently select the operating system that best suits the current hardware configuration, reducing the possibility of human intervention and errors, and improving the user experience. In addition, the automated matching process reduces the risk of human operational errors, especially in environments where different operating systems need to be frequently started. Administrators can adjust the order of mapping relationships as needed to adapt to different hardware environments or priority policies.

[0112] S430: Start the target operating system.

[0113] Among them, the execution principles of step S410 and step S430 are similar to those of steps S310 and S330 in the aforementioned embodiment. The specific process can be found in the aforementioned description of steps S310 and S330, which will not be repeated here.

[0114] Figure 5 A schematic diagram of the execution flow of a boot loader using an MBR partition table in a traditional BIOS mode provided in an embodiment of the present application is provided below in conjunction with Figure 5 The boot process is further described. Figure 5 As shown, the boot code is located in the firmware module 120. The first instruction executed by the processor 110 after the power-on points to the boot code. The processor 110 loads the boot code to the first address of the memory 170 (for example, the first address is 0x7c00), completes the power-on self-test and hardware initialization operations. Then, according to the preset boot sequence, the storage medium ranked first in the boot sequence, such as a disk, is read.

[0115] The boot record (Master Boot Record, MBR for short) of the boot sector of the disk is read to the second address of the memory 170. The MBR is usually located at the 0th track, 0th cylinder, and 0th sector of the hard disk. The MBR usually includes 512 bytes, of which the first 446 bytes store the boot loader, and the next 46 bytes are used to store the partition table, which describes the partition layout on the disk, including the location, size, and type of the partition. The last two bytes of the MBR are used to store the end mark, indicating that this sector is a valid MBR.

[0116] The boot loader is loaded into the memory 170 for execution, and the boot loader guides one of the multiple operating systems to start. The embodiment of the present application determines a target operating system from the multiple operating systems, and the target operating system is one of the multiple operating systems that matches the hardware device in place detected at the startup time. Compared with the default operating system selected by the user or specified by the system, it is more adaptable to the hardware environment of the computing device.

[0117] In the embodiment of the present application, it is assumed that multiple operating systems are installed in the server. In other words, for example, the disk may be divided into multiple independent storage spaces, each storage space corresponds to a partition. Different operating systems are installed in at least some of the storage spaces, such as operating system A, operating system B, operating system C, and operating system D. When the server is turned on, it needs to select one of the operating systems to be loaded and run.

[0118] For example, the system files of operating system A are stored in the first partition of the internal storage space, the system files of operating system B are stored in the second partition of the internal storage space, the system files of operating system C are stored in the third partition of the internal storage space, and the system files of operating system D are stored in the fourth partition of the internal storage space. The system files of the operating system include kernel files, initrd files, and other necessary files.

[0119] When the boot loader is loaded into the second address in the memory 170 for execution, the boot loader reads the information in the partition table, determines the type and location of each partition according to the information in the partition table, and locates and loads the corresponding operating system. For example, part of the boot loader is located in the MBR.

[0120] The embodiment of the present application determines a target operating system that matches the current hardware device information before loading the operating system to the third address space in the memory 170 for execution. Then, the kernel file of the target operating system is loaded to the third address space in the memory 170 for execution to complete the startup of the operating system.

[0121] The hardware device discovery method may be registered as a command module and executed by the boot loader.

[0122] Correspondingly, the same is true in UEFI mode. The current mainstream server BIOS generally adopts a unified extensible firmware interface. In UEFI mode, there are a variety of boot loaders (that is, the boot loaders mentioned in the embodiments of the present application) to choose from, such as Windows Boot Manager, Systemd-boot (also known as gummiboot), etc. The UEFI system is generally divided into 7 stages from power-on to shutdown: SEC (security verification) -> PEI (EFI early initialization) -> DXE (driver execution environment) -> BDS (boot device selection) -> TSL (operating system loading early stage) -> RT (Run Time) -> AL (system disaster recovery period). The implementation of the embodiments of the present application is mainly in the BDS stage.

[0123] In UEFI mode, UEFI uses the EFI System Partition (ESP), which is a special partition dedicated to storing boot loaders and related files. The boot loader is usually installed in ESP. During the startup phase of the computing device, the UEFI firmware is initialized and performs a self-test. The UEFI firmware loads the UEFI Bootmanager, and then the UEFI Boot manager loads the boot loader located in ESP. The boot loader communicates with the BMC to obtain the device information of the hardware device in place. Match the device information of the hardware device and the operating system mapping relationship. When there is a matching entry, find the kernel file address of the operating system from the partition table, and load the kernel file to the third address of memory 170.

[0124] Figure 6 A flowchart of a method for starting an operating system provided in an embodiment of the present application, wherein, in the firmware stage, such as Figure 6 As shown, the method comprises the following steps:

[0125] Step S610: Send a request to a baseboard management controller BMC to obtain device information of hardware devices in place when the computing device is started.

[0126] In one possible example, the request is sent through an Intelligent Platform Management Interface, where the interface uses an Intelligent Platform Management Interface IPMI protocol or a REDFISH protocol.

[0127] By requesting the device information of the hardware devices in place from the BMC, you can ensure that the latest device information is obtained during the startup phase. BMC is usually used to centrally manage and monitor server hardware. By obtaining device information through BMC, you can use its existing management and monitoring capabilities to simplify the process of obtaining information. By obtaining device information through BMC, you can avoid complex device scanning at the system level during the startup phase, thereby improving startup efficiency.

[0128] Step S620, extracting attributes of at least one hardware device in the device information, the attributes including one or more of the hardware device's address identifier bdf, vendor identifier vendor_id, hardware device identifier device_id, sub-vendor identifier sub_vendor_id, and sub-device identifier sub_device_id; constructing an identifier for representing the hardware device using at least one extracted attribute; the hardware device identifier is used to find an operating system corresponding to the identifier in a mapping relationship.

[0129] Obtain the device information of the hardware device in place at the time of startup from the BMC. The device information of the hardware device includes the configuration information and identification information of the hardware device. The hardware device includes a peripheral device connected to the computing device; the configuration information of the hardware device includes at least the device ID and manufacturer ID of the hardware device; the identification information of the hardware device includes at least the address identifier bdf of the hardware device; the address identifier of the hardware device is used to uniquely identify the device in the peripheral connection bus.

[0130] Take the acquisition of device information of PCIE devices as an example. PCIE is a high-speed serial point-to-point dual-channel high-bandwidth transmission. The connected devices are allocated exclusive channel bandwidth and do not share bus bandwidth. In complex computer systems, such as servers, PCIE devices are usually configured. Among them, common PCIE devices include: network cards, graphics cards, host bus adapters (HBA for short), etc. It should be noted that PCIE devices are not necessarily devices plugged into the server, but can also be PCIE devices that are independent of the server, powered on separately, and connected to the server via high-speed cables.

[0131] "BDF" usually refers to the bus, device, and function number of the device, which is a way to uniquely identify PCIE devices. On the PCIE bus, each device has a unique bdf number, which consists of the bus number (Bus), device number (Device), and function number (Function), expressed in hexadecimal. Bus Number: Indicates the bus number to which the PCIE device is connected. Each PCIE bus can connect multiple devices, and the bus number starts from 0 and increases. Device Number: Indicates the number of the PCIE device on a specific bus. Each PCIE device has a unique device number, which starts from 0 and increases, and there can be up to 32 devices. Function Number: Indicates the number of different functions on the PCIE device. For PCIE devices that support multi-function devices (such as PCIE-PCIE bridges), each function has a unique function number, which starts from 0 and increases, and there can be up to 8 functions.

[0132] For example, the bdf format is usually Bus:Device:Function, which indicates the location of the device on the PCIE bus. For example, 0000:50:00.0 indicates a device with bus number 0, device number 50, and function number 0.

[0133] Vendor Identifier: In the hardware field, the vendor identifier is usually used to uniquely identify the manufacturer or supplier. For hardware devices such as servers, processors, and motherboards, the vendor identifier can help identify the manufacturer of the device. For example, NVIDIA is a company that produces graphics cards, and its vendor ID may be 0x10DE (in hexadecimal).

[0134] "sub_vendor_id" refers to the sub-vendor identifier of a device, and is typically used to identify a specific manufacturer or a subsidiary or partner of a vendor for a device. In the context of PCI devices or USB devices, it is used to indicate a subsidiary or partner of the device manufacturer, or to distinguish between different device versions or configurations. The vendor ID (vendor_id) of a device uniquely identifies the primary manufacturer of the device, while the sub-vendor ID (sub_vendor_id) is used to further distinguish between different subsidiaries or partners of the device manufacturer.

[0135] "device_id" is usually a number or letter combination used to identify a specific PCIE device. For example, if a NVIDIA GeForce GTX 1080 graphics card is inserted into the graphics card slot, the device ID of this graphics card may be a specific number or letter combination such as 103e, which is used to uniquely identify this graphics card.

[0136] In a possible implementation, the device information of the PCIE device is combined, and the PCIE device identification includes at least: bdf information, manufacturer ID and device ID. For example, the following data formats are obtained: p_000050000_8090_103e and p_00003b000_8090_106e.

[0137] It is understandable that the PCIE device information can be connected to the bdf information, the manufacturer ID, the sub-manufacturer ID, the device ID and the sub-device ID in any specified combination order. The embodiment of the present application does not limit the combination order of the bdf information, the manufacturer ID, the sub-manufacturer ID, the device ID and the sub-device ID. After combining the bdf information, the manufacturer ID, the sub-manufacturer ID, the device ID and the sub-device ID, the device information identifier of at least one PCIE device is obtained.

[0138] According to the device information of the hardware device, the identifier of the hardware device is obtained, for example, device 01:

[0139] p_000050000_8090_103e, device 02: p_00003b000_8090_106e.

[0140] In p_000050000_8090_103e, 000050000: indicates the device bdf information, 8090: indicates the device vendor_id information, and 103e: indicates the device device_id information.

[0141] In p_00003b000_8090_106e, 00003b000: indicates the device bdf information, 8090: indicates the device vendor_id information, and 106e: indicates the device device_id information.

[0142] Whether hardware device 01 and device 02 exist, that is, whether device 01 and device 02 can be detected and identified.

[0143] Step S630: Determine a target operating system corresponding to the identifier of the hardware device based on a preset mapping relationship; wherein the preset mapping relationship indicates a mapping relationship between at least one operating system and device information, and the at least one operating system includes a target operating system.

[0144] In a possible example, the mapping relationship between the device information of the preset hardware device and the operating system is written into the configuration file of the boot loader. For example, the mapping relationship between the device information of the hardware device and the operating system is shown in Table 1:

[0145] Table 1 Mapping relationship between hardware device information and operating system

[0146]

[0147] As shown in Table 1, the operating system matched by the device information of device 01 is operating system A, the operating system matched by the device information of devices 02 and 03 is operating system B, and the operating system matched by the device information of device 04 is operating system C. The device information of device 01 is the device information of the first group of devices, the device information of devices 02 and 03 is the device information of the second group of devices, and the device information of device 04 is the device information of the third group of devices.

[0148] The mapping relationship between the device information of device 01 and device 04 and the operating system is one-to-one. The mapping relationship between the device information of device 02 and device 03 and the operating system is many-to-one. In other words, if the device information of device 02 and device 03 exists at the same time, the matching operating system is determined to be operating system B.

[0149] In a possible example, each entry in the mapping relationship indicates a correspondence between an operating system and device information of a hardware device. The mapping relationship has a sequence, and each entry in the mapping relationship is matched with the device information in sequence according to the sequence.

[0150] In a possible example, each entry in the mapping relationship associates an identifier of a hardware device with an operating system in the form of a variable and a value.

[0151] For example, in the mapping relationship between the hardware device identifier and the operating system, p_000050000_8090_103e=OS1, indicating that the hardware device identifier of device01 corresponds to operating system 1. p_00003b000_8090_106e=OS2, indicating that the hardware device identifier of device02 corresponds to operating system 2. p_000050000_8090_103e and

[0152] The combination of p_00003b000_8090_106e indicates that the hardware device identifiers of device01 and device02 correspond to operating system 3.

[0153] In a possible example, the mapping relationship between the identifier of the hardware device and the operating system may also be identified by configuring a json file.

[0154] For example, {“p_000050000_8090_103e”:”OS1”},

[0155] {“p_00003b000_8090_106e”:”OS2”} indicates that the identifier p_000050000_8090_103e of device01 corresponds to operating system 1, and the identifier p_00003b000_8090_106 of device02 corresponds to operating system 2.

[0156] Step S640: start the target operating system.

[0157] In a possible example, if the target operating system corresponding to the identifier of the hardware device is not found based on the preset mapping relationship, an operating system selection interface is output; when a user operation for the operating system selection interface is received, the target operating system is determined based on the user operation.

[0158] In a possible example, when no user operation directed to the operating system selection interface is received within a preset time, the target operating system is determined to be a preset default operating system.

[0159] The method sends a request to a baseboard management controller BMC to obtain device information of an in-place hardware device, extracts at least one hardware device attribute in the device information (including an address identifier bdf of the hardware device, a vendor identifier vendor_id, a hardware device identifier device_id, a sub-vendor identifier sub_vendor_id, and a sub-device identifier sub_device_id), and uses at least one extracted attribute to construct an identifier for representing the hardware device. The hardware device identifier is used to find an operating system corresponding to the identifier in a mapping relationship. Based on the identifier of the hardware device, a target operating system corresponding to the identifier is determined and started.

[0160] By sending a request to the BMC to obtain accurate device information and extracting detailed hardware device attributes, the hardware device identifier can be quickly constructed to ensure the accuracy and real-time nature of the hardware device information. The definition form of the mapping relationship (such as variables and values ​​or JSON object form) is flexible, easy to add and update, and can adapt to different hardware devices and operating system configuration requirements.

[0161] Figure 7 A schematic diagram of a device discovery method provided in an embodiment of the present application. Figure 7 As shown, the method comprises the following steps:

[0162] Step S710: Add and register a device discovery command line program / module.

[0163] During the startup phase, when the boot loader is executed, some necessary command modules need to be loaded. For example, the Filesystem module is used by the boot loader to identify and load a specific file system; the Terminal module is used to allow the boot loader to provide a command line terminal interface during the startup process; the insmod linux module is used to load the Linux kernel module and load the Linux kernel specified in the grub configuration file to boot the Linux operating system.

[0164] The embodiment of the present application provides a device discovery command module, which is registered in the configuration file of the boot loader and executed before the boot loader starts the operating system to load the operating system that matches the current hardware environment.

[0165] The device discovery command line module is used to send a request to the baseboard management controller BMC to obtain the device information of the currently installed hardware device; receive and parse the data returned by the BMC, and determine the target operating system corresponding to the device information based on a preset mapping relationship; wherein the preset mapping relationship indicates a mapping relationship between at least one operating system and the device information, and at least one operating system includes a target operating system.

[0166] The embodiment of the present application does not limit the method of obtaining PCIE / PCI device information from the BMC.

[0167] In a possible implementation, when the BIOS is started in the legacy mode, the IPMI / Redfish command is used to communicate with the BMC to obtain device information.

[0168] In a possible implementation, when the UEFI mode is started, the communication with the BMC to obtain device information usually utilizes the relevant protocols and interfaces provided by UEFI, such as Simple Network Protocol (SNP), EFI System Management Protocol (ESMP), etc. Through these protocols and interfaces, the UEFI firmware can communicate with the BMC to obtain information about PCIe devices, etc. The device discovery command line module can be placed in a specific directory of the ESP, such as

[0169] / boot / efi / EFI / grub / .

[0170] In a possible implementation, the function name of the PCIE and / or PCI device discovery command module is defined as getdev. Step S720: Execute the device discovery command line program / module during the computing device startup phase.

[0171] Execute the device discovery command line module getdev, determine the target operating system, and start the target operating system.

[0172] The embodiment of the present application automatically acquires and parses hardware device information by adding and registering a device discovery command line module in the boot loader, and starts up by matching an adapted operating system based on a preset mapping relationship. The method automatically executes the device discovery command line module during the startup phase of the computing device, ensuring that the system can dynamically identify and adapt to the current hardware environment during the startup process, thereby improving startup efficiency and system compatibility. Reduce manual intervention and improve the efficiency and accuracy of the startup process. Integrating the acquisition, parsing and operating system matching functions of device information into a command line tool or module simplifies system management and configuration and reduces system complexity. The integrated solution reduces the workload of management and maintenance. As an independent module, it can be easily integrated into an existing boot loader and expanded as needed.

[0173] Figure 8 A schematic diagram of a process for obtaining hardware device information by a device discovery command module provided in an embodiment of the present application. Figure 8As shown, the method includes: steps S810-S860. It can be understood that in the embodiment of the present application, the CPU, as the core processing unit of the computing device, is responsible for executing key programs in the startup phase including BIOS and boot loader. Figure 8 The information flow between BIOS, boot loader, BMC and PCIE devices is shown in Figure 1.

[0174] Step S810, BMC and BIOS are powered on, BIOS performs hardware device initialization and self-test, and then BIOS loads the boot loader into the memory for execution. During the server power-on process, BMC is also powered on synchronously. When PCIE and / or PCI devices are deployed on the server, during the server startup process, according to the PCIE / PCI protocol, the BIOS chip enumerates all PCIE / PCI devices connected to the server and initializes the PCIE / PCI devices.

[0175] Step S820: The BMC sends a request to read device information of at least a PCIE and / or PCI device to the PCIE / PCI device.

[0176] Step S830: The PCIE / PCI device returns the device information to the BMC, and the BMC stores the PCIE / PCI device information.

[0177] Step S840: The boot loader sends first information to the BMC, where the first information indicates the device information of the PCIE / PCI device requested to be stored by the BMC.

[0178] Step S850: The BMC returns data corresponding to the first information.

[0179] In a possible implementation, if the BMC returns data, the process proceeds to step S860 to parse the first information. If the BMC does not return data or the returned data is incomplete, which is understandable, the process attempts to resend the first information.

[0180] Step S860: the boot loader parses the data.

[0181] After receiving the response from the BMC, the bootloader parses the response and processes the device information of the PCIE / PCI device therein, including parsing the format of the response and extracting the required device information to obtain the device information of the PCIE / PCI device in place.

[0182] For example, when the server is powered on, the BMC starts to monitor the hardware status. Subsequently, the BIOS starts and performs initialization and self-test of the hardware devices, and loads the boot loader into the memory for execution. If the server is deployed with PCIe and / or PCI devices, the BIOS enumerates and initializes these devices according to the corresponding protocols, and the BMC sends a request to read and store the device information of at least the PCIe and / or PCI devices. Upon receiving the request for the device information, the BMC returns the requested device information data. If the BMC successfully returns the data, the boot loader enters the parsing stage; if the data is not returned or is incomplete, the request is resent. The boot loader parses the returned data to identify and match the hardware device information with the operating system.

[0183] The embodiment of the present application realizes the automatic acquisition and management of the device information of the hardware device through the collaborative work of the BMC and the boot loader, reducing manual intervention. By checking the integrity of the data returned by the BMC and resending the request when necessary, it is ensured that the data used in the startup process is accurate and complete. The hardware identification process is optimized through a standardized information exchange process between the BMC and the boot loader.

[0184] Fig.9A This is another flowchart of starting an operating system provided in an embodiment of the present application. Fig.9A As shown, the method includes the following steps S910-S980:

[0185] Step S910, configuring the operating system boot menu entry.

[0186] For example, the operating system boot menu entry is pre-configured information. The boot options for each operating system are defined in the boot loader configuration file. Usually, these options include information such as the name of the operating system, the location of the kernel file, and startup parameters. For example, in the grub configuration file, you can use menuentry to define the boot options for each operating system.

[0187] For example, an operating system configuration in the boot loader configuration file is as follows:

[0188] menuentry "OS1" {

[0189] linux / tiny / OS1 / kernel squash= / tiny / OS1 / squash_iso.bin

[0190] initrd / tiny / OS1 / initrd

[0191] }

[0192] Step S920: configure the operating system corresponding to the hardware device.

[0193] For example, the operating system corresponding to the hardware device is pre-configured information. In the mapping relationship between the hardware device and the operating system, as described above, for example, p_000050000_8090_103e=OS1, indicating that the identifier of device01 corresponds to operating system 1. p_00003b000_8090_106e=OS2, indicating that the identifier of device02 corresponds to operating system 2.

[0194] In a possible example, the mapping relationship between the hardware device and the operating system may be identified by configuring a json file.

[0195] For example, {“p_000050000_8090_103e”:”OS1”},

[0196] {"p_00003b000_8090_106e":"OS2"} indicates that the device identifier of device01 corresponds to p_000050000_8090_103e corresponding to the operating system OS1, and the identifier of device02 p_00003b000_8090_106 corresponds to the operating system 02.

[0197] It should be noted that step S910 and step S920 are executed in no particular order.

[0198] Step S930, during the startup phase of the computing device, multiple command modules are loaded.

[0199] During the startup phase of the computing device, a timeout period is usually set, and multiple registered command modules are loaded within this period. If the loading is successful, the startup process continues. If the loading fails, according to the system's pre-configured error handling strategy, it may jump to a specific error recovery step S980 to reload the module or perform other operations to ensure the stability and reliability of the system. Or it may jump to step S970, and according to the settings of the boot program configuration file, start the default operating system or output the operating system selection interface; when a user operation is received for the operating system selection interface, the target operating system is determined based on the user operation. This embodiment of the present application does not limit this.

[0200] For example, in the grub configuration file, you can use the insmod command to load multiple modules. For example, you can add multiple insmod commands in the configuration file to load multiple command modules to ensure that they are correctly loaded and executed during the boot loading process.

[0201] For example, the configuration diagram of the boot loader configuration file is as follows: wherein getdev is the device discovery command provided in an embodiment of the present application.

[0202] set timeout=60

[0203] insmod efi_gop

[0204] insmod efi_uga

[0205] insmod linux

[0206] insmod getdev

[0207] insmod test

[0208] Step S940: searching for device information through a device discovery command module.

[0209] If the target operating system corresponding to the device information exists in the mapping relationship, the process proceeds to step S950 to determine the operating system corresponding to the device information in the mapping relationship as the target operating system.

[0210] If the target operating system corresponding to the device information does not exist in the mapping relationship, then jump to step S970, start the default preset operating system or output the operating system selection interface.

[0211] Step S950: determine the operating system corresponding to the device information in the mapping relationship as the target operating system.

[0212] Step S960, starting the target operating system.

[0213] Step S970, starting a preset default operating system, or outputting an operating system selection interface; when receiving a user operation on the operating system selection interface, determining a target operating system based on the user operation.

[0214] Step S980, reloading the module or performing other operations.

[0215] The embodiment of the present application realizes intelligent selection and adaptation during the system startup process by automatically acquiring the device information of the hardware device, effectively avoiding startup problems caused by manual operation or incompatibility between the default operating system and the hardware device in place in the operating system boot interface, thereby significantly improving the startup efficiency and reliability of the system.

[0216] Fig. 9B This is another flowchart of starting an operating system provided in an embodiment of the present application. Fig. 9B As shown, the method includes steps S910-S980, steps S910-S980 and Fig.9A The steps are similar, except that the determination after step S940 is whether the target operating system is found within a preset time.

[0217] After step S940, in a possible example, if the device discovery command indicates that the device information of the hardware device in place is found in the mapping relationship, for example, when getdev returns a first value within a preset time, it is determined that the hardware device in place is found, and the operating system corresponding to the device information of the hardware device is determined to be the target operating system.

[0218] The preset time limits the system's waiting time for selecting an operating system, which helps reduce user waiting, especially when the device information is slow to match or fails to match the preset mapping relationship. It improves user friendliness and avoids startup interruptions caused by automatic matching failures.

[0219] In one possible example, if the device discovery command module indicates that the device information of the hardware device in place is not found in the mapping relationship, for example, when getdev returns a second value within a preset time (the second value is a value different from the first value). Then the operating system selection interface is output; when a user operation for the operating system selection interface is received, the target operating system is determined based on the user operation. When the automatic entry into the adapted operating system fails, the embodiment of the present application can also be entered by manually selecting the operating system. In one possible example, when no user operation for the operating system selection interface is received within a preset time, the target operating system is determined to be a preset default operating system.

[0220] In some computer networks, a Pre-boot Execution Environment (PXE) is used for booting. PXE booting means that a communication device (eg, a computing device) downloads an image from a remote server through a network and boots it. Fig.10 A computer network diagram for starting an operating system using PXE is provided in an embodiment of the present application. Fig.10 As shown, the computer network 1100 includes a computing device 1110, which is suitable for using PXE booting. The computing device 1110 includes a processor 1111, a memory 1112, a BMC 1113, a storage device 1117, a hardware device 1115 and a network adapter 1116. The storage device 1117 stores a firmware module 1114 and a boot module 1118, and the boot modules 1118 include a boot loader and the like.

[0221] The computing device 1110 boots from the PXE server 1120. The PXE boot process starts when the computing device 1110 starts up. First, the computing device 1110 transmits a request to be booted to the PXE server 1120, and the PXE server 1120 sends a boot loader.

[0222] The network adapter 1116 is connected to the PXE server 1120 as a communication interface, and the startup work before the PXE startup is performed by the firmware module 1114. The firmware module 1114 executes the startup code, which initializes the hardware and performs a self-test. At this stage, the firmware module 1114 also checks the system configuration, determines the bootable devices (such as hard disks, optical disks, USB drives, etc.) and their boot order. If it is a network boot method, the PXE firmware in the network adapter 1116 is used to send a PXE boot request to the PXE server 1120. After receiving the PXE boot request, the PXE server 1120 responds to the request and provides the location information of the boot loader and the operating system. The boot loader is downloaded according to the location information of the boot loader provided by the PXE server 1120. For example, the boot loader is downloaded and stored in the storage device 1117, and then the system loads the boot loader into the memory 1112 and is executed by the processor 1111. For example, the memory 1112 is a random access memory (RAM).

[0223] The boot loader obtains the hardware device in place from the BMC 1115, and based on the device information, determines the target operating system boot loader corresponding to the device information to load the target operating system. After the boot loader loads the operating system image, the operating system starts to start and run.

[0224] It should be noted that the boot loader of the embodiment of the present application can be started from a hard disk, PXE, or from an optical drive. The difference lies in the source and loading method of the boot loader. When starting from an optical drive, the BIOS or UEFI will first try to load the boot loader from the optical drive.

[0225] Based on the method of the above embodiment, the embodiment of the present application provides a device for entering the operating system. Fig.11 , Fig.11 It is a structural diagram of a device for starting an operating system provided in an embodiment of the present application. The device for starting an operating system 1100 includes: a device information acquisition module 1110, an operating system determination module 1120, and an operating system startup module 1130. The device information acquisition module 1110 is used to obtain device information of hardware devices in the computing device during the startup phase of the computing device; the operating system determination module 1120 is used to determine the target operating system corresponding to the device information based on a preset mapping relationship; the preset mapping relationship indicates a mapping relationship between at least one operating system and device information, and at least one operating system includes a target operating system; the operating system startup module 1130 is used to start the target operating system.

[0226] Based on the method in the above embodiment, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a processor, the processor executes the method in the above embodiment.

[0227] Based on the method in the above embodiment, an embodiment of the present application provides a computer program product, characterized in that when the computer program product runs on a processor, the processor executes the method in the above embodiment.

[0228] It should be understood that each step of the above method embodiment can be completed by a hardware-based logic circuit or a software-based instruction in a processor.

[0229] It is understandable that the size of the sequence number of each step in the above embodiment does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. In addition, in some possible implementations, each step in the above embodiment can be selectively executed according to actual conditions, and can be partially executed or fully executed, which is not limited here.

[0230] It is understood that the processor in the embodiments of the present application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.

[0231] The method steps in the embodiments of the present application can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.

[0232] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions may be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.

[0233] It should be understood that the various numerical numbers involved in the embodiments of the present application are only used for the convenience of description and are not used to limit the scope of the embodiments of the present application.

Claims

1. A method for starting an operating system, characterized in that: During the startup phase of the computing device, obtaining device information of the hardware devices in the computing device; Based on a preset mapping relationship, determining a target operating system corresponding to the device information; wherein the preset mapping relationship indicates a mapping relationship between at least one operating system and the device information, and the at least one operating system includes the target operating system; The target operating system is started.

2. The method according to claim 1, characterized in that The computing device startup phase is a BIOS startup phase.

3. The method according to claim 1 or 2, characterized in that: The mapping relationship between the at least one operating system and the device information has a sequence of precedence, and each entry in the mapping relationship is matched with the device information in turn according to the sequence of precedence, and the operating system that first matches the device information is selected as the target operating system; each entry in the mapping relationship indicates the correspondence between the operating system and the device information of the hardware device.

4. The method according to claim 1, characterized in that: The obtaining of device information of the hardware devices in the computing device includes: Send a device information acquisition request to the baseboard management controller BMC; Receive and parse the data returned by the BMC to obtain the device information of the hardware devices in place.

5. The method according to claim 4, characterized in that After obtaining the device information of the hardware devices in the computing device, the method further includes: Extracting the attributes of at least one hardware device in the device information, wherein the attributes include one or more of an address identifier bdf, a vendor identifier vendor_id, a hardware device identifier device_id, a sub-vendor identifier sub_vendor_id, and a sub-device identifier sub_device_id of the hardware device; An identifier for representing the hardware device is constructed using at least one extracted attribute; the identifier is used to search for an operating system corresponding to the identifier in the mapping relationship.

6. The method according to claim 4, characterized in that The request is sent through an intelligent platform management interface, wherein the interface uses an intelligent platform management interface IPMI protocol or a REDFISH protocol.

7. The method according to claim 1, characterized in that The determining, based on the preset mapping relationship, a target operating system corresponding to the device information includes: If the target operating system corresponding to the device information is not found within a preset time based on the preset mapping relationship, outputting an operating system selection interface; When a user operation directed to the operating system selection interface is received, a target operating system is determined based on the user operation.

8. The method according to claim 1, characterized in that The determining, based on the preset mapping relationship, a target operating system corresponding to the device information includes: If the preset mapping relationship does not contain an operating system corresponding to the device information, the target operating system is determined to be a preset default operating system.

9. A device for starting an operating system, characterized in that: The device comprises: A device information acquisition module, used to acquire device information of hardware devices in the computing device during the startup phase of the computing device; An operating system determination module, configured to determine a target operating system corresponding to the device information based on a preset mapping relationship; wherein the preset mapping relationship indicates a mapping relationship between at least one operating system and the device information, and the at least one operating system includes the target operating system; The operating system startup module is used to start the target operating system.

10. A computing device, characterized in that: include: at least one memory for storing a program; at least one processor, configured to execute the program stored in the memory; Wherein, when the program stored in the memory is executed, the processor is used to execute the method according to any one of claims 1-8.

Citation Information

Cited By

  • Hard disk partitioning method, device and equipment and computer readable storage medium

    CN120610665A

  • A hard disk partitioning method, device, equipment and computer readable storage medium

    CN120610665B

  • Firmware control method and device of processor, processor, equipment, storage medium and program product

    CN122331977A

  • A firmware control method and device of a processor, a processor, an equipment, a storage medium and a program product

    CN122331977B