Operating system startup method, device, electronic device and storage medium

Through firmware reading and using controller information in the target variable, adjust the hard disk scanning order on the processor board to ensure that the target hard disk is scanned and loaded as the first hard disk, thus solving the operating system startup error caused by hard disk changes, and realizing The correct operating system boots up.

CN113326069BActive Publication Date: 2024-12-24GUANGZHOU LONGXIN ZHONGKE ELECTRONIC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010131076.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-02-28
Publication Date
2024-12-24
Estimated Expiration
2040-02-28

AI Technical Summary

Technical Problem

When adding or decreasing a processor board hard drive, the original system disk's identification may indicate an incorrect hard drive, resulting in the failure to start the operating system correctly.

Method used

Read the pre-stored target variables through firmware, indicate the controller information of the target hard disk, and set the target controller as the first hard disk controller when external devices are interconnected and scanned, load and start the kernel of the target hard disk to ensure that the kernel can be used according to the correct ones The identification information of the operating system is started.

Benefits of technology

Ensure that the electronic device can boot the original system disk operating system normally under the changes in the hard disk, and avoid loading the wrong kernel and operating system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113326069B_ABST
    Figure CN113326069B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides an operating system startup method, device, electronic device and storage medium, which relates to the field of computer technology. The method includes: running firmware; reading a pre-stored target variable through firmware; when the firmware performs the first PCI scan, scanning the target controller indicated by the target variable as the first place; passing the identification information of the target controller to the kernel to be started through the firmware; loading and starting the kernel of the target hard disk corresponding to the target controller through the firmware; starting the operating system of the target hard disk through the kernel according to the identification information. In the present invention, the firmware can obtain the controller information of the target hard disk required by the user through the target variable, and then after completing the PCI scan, the kernel of the target hard disk can be started. In addition, the firmware can also pass the identification information of the target controller to the kernel before starting the kernel, and then the kernel can start the operating system of the target hard disk according to the identification information.
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 an operating system startup method, an operating system startup device, an electronic device and a storage medium. Background Art

[0002] The processor is one of the main components of electronic computers and is the core component of electronic computers. Its main function is to interpret computer instructions and process data in computer software. The processor has broad market application prospects in products such as servers, high-performance computers, low-energy data centers, personal high-performance computers, high-end desktop applications, high-throughput computing applications, industrial control, digital signal processing, and high-end embedded applications, and plays a vital role in economic development.

[0003] During the use of the processor board, it is often necessary to have multiple hard disks. For example, when an operating system needs to be added, a hard disk corresponding to the operating system needs to be added. However, in many cases, even if a hard disk is added, there is still a need to start the original system disk first. At present, when a new hard disk is added, the main process of starting the operating system is: first, you can manually specify which hard disk to read the corresponding system boot file. If you need to start the original system disk before the new hard disk is inserted, you can specify the ID of the original system disk. Then the firmware will read and parse the boot file of the original system disk according to the specified ID of the original system disk. The boot options in the boot file can indicate which hard disk to load the kernel from and which hard disk corresponding to the operating system to start. In addition, the boot options indicate the hard disk through the hard disk ID.

[0004] Since the hard disk identifier corresponding to the boot file is specified, the firmware can read the boot file of the correct hard disk; however, since the hard disk identifier can change with the insertion position or insertion order of each hard disk, when a new hard disk is added, the identifier of the original system disk may indicate another hard disk, and the hard disk identifier in the boot file of the original system disk has not changed. Therefore, when the kernel is loaded and the operating system is started according to the hard disk identifier in the boot file, the correct kernel will not be loaded, and the correct operating system will not be started. Summary of the invention

[0005] In view of the above problems, an embodiment of the present invention is proposed to provide an operating system startup method that overcomes the above problems or at least partially solves the above problems, so that when adding or reducing hard disks connected to the processor board, the original system disk operating system of the processor board can be normally started.

[0006] Correspondingly, an embodiment of the present invention further provides an operating system startup device, an electronic device and a storage medium to ensure the implementation and application of the above method.

[0007] In order to solve the above problem, an embodiment of the present invention discloses an operating system startup method, including:

[0008] Run the firmware;

[0009] Reading a pre-stored target variable through the firmware; the target variable is used to indicate controller information of a target controller corresponding to the target hard disk;

[0010] When performing interconnection scanning to a first external device through the firmware, the target controller indicated by the target variable is scanned as a first hard disk controller to be scanned;

[0011] Passing the identification information of the target controller to the kernel to be started through the firmware;

[0012] Loading and starting the kernel corresponding to the target hard disk through the firmware;

[0013] According to the identification information, the operating system corresponding to the target hard disk is started through the kernel.

[0014] Optionally, when performing interconnection scanning to the first external device through the firmware, scanning the target controller indicated by the target variable as a first hard disk controller to be scanned, includes:

[0015] When performing interconnection scanning to a first external device through the firmware, exchanging the scanning order of the target controller indicated by the target variable with the first hard disk controller in the first preset scanning order;

[0016] The target controller indicated by the target variable is used as the first hard disk controller for the first external device interconnection scan, and is scanned by the firmware.

[0017] Optionally, when the identification information includes a rank of the target controller in a second preset scanning sequence, the transmitting, by the firmware, the identification information of the target controller to the kernel to be started includes:

[0018] The first parameter is replaced by the ranking of the target controller in the second preset scanning sequence through the firmware; the first parameter is used to indicate the hard disk controller corresponding to the hard disk where the operating system to be started is located;

[0019] Passing the replaced first parameter to the kernel to be started through the firmware;

[0020] The step of starting the operating system corresponding to the target hard disk through the kernel according to the identification information includes:

[0021] Performing a second external device interconnection scan by the kernel according to the second preset scan sequence;

[0022] According to the ranking of the target controller in the second preset scanning sequence, the kernel selects the target controller from the scanned hard disk controllers;

[0023] Determine the target hard disk corresponding to the target controller;

[0024] The operating system corresponding to the target hard disk is started through the kernel.

[0025] Optionally, when the identification information includes the controller information, the transmitting, by the firmware, the identification information of the target controller to the kernel to be started includes:

[0026] The controller information is used as a second parameter and transmitted to the kernel to be started through the firmware; the second parameter has a different attribute from the first parameter;

[0027] The step of starting the operating system corresponding to the target hard disk through the kernel according to the identification information includes:

[0028] When performing interconnection scanning to a second external device through the kernel, exchanging the scanning order of the target controller corresponding to the controller information with the first hard disk controller in the second preset scanning order;

[0029] The target controller corresponding to the controller information is used as the first hard disk controller for the second external device interconnection scan, and is scanned by the kernel;

[0030] The operating system corresponding to the target hard disk corresponding to the first hard disk controller scanned by the second external device interconnection is started through the kernel.

[0031] Optionally, before running the firmware, the method further includes:

[0032] When a new hard disk is inserted into or removed from the processor board, the firmware is started and run;

[0033] When a selection instruction of the target hard disk is received through the firmware, controller information of a target controller corresponding to the target hard disk is acquired;

[0034] Saving the controller information to the target variable;

[0035] Restart the firmware to make the saved controller information effective.

[0036] Optionally, the controller information includes a bus number, a device number and a function number of the target controller corresponding to the target hard disk.

[0037] The embodiment of the present invention further discloses an operating system startup device, including:

[0038] Running module, used to run firmware;

[0039] A reading module, used for reading a pre-stored target variable through the firmware; the target variable is used to indicate controller information of a target controller corresponding to the target hard disk;

[0040] A scanning module, used for scanning the target controller indicated by the target variable as a first hard disk controller to be scanned when performing interconnection scanning to the first external device through the firmware;

[0041] A parameter transmission module, used for transmitting the identification information of the target controller to the kernel to be started through the firmware;

[0042] A kernel startup module, used to load and start the kernel corresponding to the target hard disk through the firmware;

[0043] A system startup module is used to start the operating system corresponding to the target hard disk through the kernel according to the identification information.

[0044] Optionally, the scanning module includes:

[0045] A first interchange submodule, used for, when performing interconnection scanning to a first external device through the firmware, interchange the scanning order of the target controller indicated by the target variable with the first hard disk controller in the first preset scanning order;

[0046] The first scanning submodule is used to use the target controller indicated by the target variable as the first hard disk controller for the first external device interconnection scan, and scan it through the firmware.

[0047] Optionally, when the identification information includes the ranking of the target controller in the second preset scanning sequence, the parameter transmission module includes:

[0048] A replacement submodule, used to replace the first parameter with the ranking of the target controller in the second preset scanning sequence through the firmware; the first parameter is used to indicate the hard disk controller corresponding to the hard disk where the operating system to be started is located;

[0049] A first parameter transmission submodule, used for transmitting the replaced first parameter to the kernel to be started through the firmware;

[0050] The system startup module includes:

[0051] A second scanning submodule, configured to perform a second external device interconnection scan through the kernel according to the second preset scanning sequence;

[0052] A selection submodule, configured to select the target controller from the scanned hard disk controllers through the kernel according to the ranking of the target controller in the second preset scanning sequence;

[0053] A determination submodule, used to determine the target hard disk corresponding to the target controller;

[0054] The first startup submodule is used to start the operating system corresponding to the target hard disk through the kernel.

[0055] Optionally, when the identification information includes the controller information, the parameter transmission module includes:

[0056] A second parameter transmission submodule, used for transmitting the controller information as a second parameter to the kernel to be started through the firmware; the second parameter has a different attribute from the first parameter;

[0057] The system startup module includes:

[0058] A second interchange submodule is used to interchange the scanning order of the target controller corresponding to the controller information with the first hard disk controller in the second preset scanning order when performing interconnection scanning to the second external device through the kernel;

[0059] A third scanning submodule, configured to use the target controller corresponding to the controller information as the first hard disk controller for interconnection scanning of the second external device, and perform scanning through the kernel;

[0060] The second startup submodule is used to start the operating system corresponding to the target hard disk corresponding to the first hard disk controller scanned by the second external device interconnection through the kernel.

[0061] Optionally, the device further comprises:

[0062] A firmware startup module, used to start and run the firmware when a new hard disk is inserted into or removed from the processor board;

[0063] an acquisition module, configured to acquire controller information of a target controller corresponding to the target hard disk when receiving a selection instruction of the target hard disk through the firmware;

[0064] A saving module, used for saving the controller information to the target variable;

[0065] The firmware restart module is used to restart the firmware to make the saved controller information effective.

[0066] Optionally, the controller information includes a bus number, a device number and a function number of the target controller corresponding to the target hard disk.

[0067] The embodiment of the present invention further discloses an electronic device including a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors. The one or more programs include instructions for performing the following operations:

[0068] Run the firmware;

[0069] Reading a pre-stored target variable through the firmware; the target variable is used to indicate controller information of a target controller corresponding to the target hard disk;

[0070] When performing interconnection scanning to a first external device through the firmware, the target controller indicated by the target variable is scanned as a first hard disk controller to be scanned;

[0071] Passing the identification information of the target controller to the kernel to be started through the firmware;

[0072] Loading and starting the kernel corresponding to the target hard disk through the firmware;

[0073] According to the identification information, the operating system corresponding to the target hard disk is started through the kernel.

[0074] The embodiment of the present invention further discloses a readable storage medium. When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can execute one or more operating system startup methods described in the embodiment of the present invention.

[0075] The embodiments of the present invention include the following advantages:

[0076] In an embodiment of the present invention, when the firmware is running, the firmware can read a pre-stored target variable, which is used to indicate the controller information of the target controller corresponding to the target hard disk that the user wants to start. When the firmware is performing the process of interconnecting the first external device, the target controller indicated by the target variable can be scanned as the first hard disk controller to be scanned, so that the firmware can then load and start the kernel corresponding to the target hard disk, that is, it can start the correct kernel required by the user. In addition, before starting the kernel, the firmware can also pass the identification information of the target controller to the kernel to be started, and then the kernel can start the operating system corresponding to the target hard disk according to the identification information. In this way, the electronic device can start the correct kernel required by the user, and then can start the correct operating system required by the user. BRIEF DESCRIPTION OF THE DRAWINGS

[0077] Figure 1 is a flowchart of steps of an operating system startup method embodiment of the present invention;

[0078] Figure 2 is a flowchart of another operating system startup embodiment of the present invention;

[0079] Figure 3 It is a structural block diagram of an embodiment of an operating system startup device of the present invention;

[0080] Figure 4 The present invention is a structural block diagram of an electronic device for starting an operating system according to an exemplary embodiment. DETAILED DESCRIPTION

[0081] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0082] Before describing the embodiments of the present invention in detail, relevant concepts and main processes of the prior art are first introduced.

[0083] Hard disk: The hard disk is the most important storage device of the computer. The hard disk fixed on the processor board is called the onboard hard disk. A computer usually has only one onboard hard disk. In addition, the processor board usually provides other hard disk slots for inserting new hard disks. Each hard disk stores the functions and files related to starting an operating system. Therefore, if you want to use a certain operating system, you need to start the corresponding hard disk. In the embodiment of the present invention, the onboard hard disk is called the system disk (that is, the original system disk referred to below), and the new hard disk newly inserted into the processor board is collectively referred to as the hard disk.

[0084] Hard disk controller: The hard disk controller is a hard disk information conversion element integrated on the processor board, which can be understood as the management interface of the hard disk accessing the processor board. The hard disk controller controls the hard disk and allocates resources. When a hard disk is inserted into a hard disk slot, the hard disk can be managed by a corresponding hard disk controller. Among them, in the embodiment of the present invention, the hard disk controller refers to a PCI (Peripheral Component Interconnect) device; the hard disk interface is generally a SATA (Serial Advanced Technology Attachment) slot. When performing a PCI scan, the hard disk controller is found, and the hard disk controller driver can determine whether there is a hard disk on the corresponding hard disk interface. In addition, different hard disk slots have different priorities. Accordingly, different hard disk controllers and different inserted hard disks will also have different startup priorities. When a hard disk is inserted into a hard disk slot with a low priority, the startup priority of the hard disk is also low.

[0085] Firmware: Firmware is software that is fixed in the hardware and is used to guide the hardware. In actual applications, due to various technical limitations or commercial reasons, hardware manufacturers hope that their hardware can be used by more software manufacturers, so they need to do some packaging on the hardware to make their hardware easier to operate. At this time, firmware is needed, which can simplify the interaction between software (such as operating system) and hardware. Common firmware includes BIOS (Basic Input Output System) programs, etc.

[0086] Kernel: The kernel is the internal core program of the operating system. It provides core management calls to the computer to the outside world, enabling users to operate in the operating system interface.

[0087] In the prior art, if a new hard disk is inserted into the processor board in addition to the system disk, the system disk and the other hard disks contain operating system programs, which means that there are at least two operating systems in the computer, and when the user starts the computer, he needs to start one of the operating systems first, and usually the user wants to start the operating system corresponding to the original system disk. However, the usual logic of the computer is to start the operating system corresponding to the hard disk according to the boot file of the hard disk corresponding to the first hard disk controller scanned by PCI (or PCI device scanning), and the PCI scan is scanned according to the priority of the hard disk controller, so the first hard disk controller scanned by PCI is also the hard disk controller with the highest priority at present.

[0088] However, in actual applications, inserting or removing a new hard disk by hot-plugging or non-hot-plugging may cause the drive letter of the existing hard disk to change. In other words, the drive letter, which is a hard disk identifier, may be reallocated according to the plug-in position or plug-in order of each hard disk. For example, drive letter A indicates the hard disk with the highest priority, that is, the hard disk corresponding to the first hard disk controller to perform PCI scanning. Before inserting or removing the new hard disk, the drive letter of the original system disk is A, and after inserting or removing the new hard disk, the drive letter of the original system disk may be B, and drive letter A may correspond to the new hard disk P at this time. Therefore, when performing PCI scanning according to drive letter A, the new hard disk P becomes the hard disk corresponding to the first hard disk controller to be scanned.

[0089] However, since the boot file corresponding to the hard disk can be manually specified, no matter what the scanning order of the PCI scan is, the computer can be specified to read the boot file of the original system disk instead of the boot file of the new hard disk P, so that the computer can read the correct boot file. However, since the boot file of the original system disk was written with only one hard disk in mind, the drive letter of the original system disk is hard-coded as drive letter A in the boot options of the boot file, that is, the parameter in the boot file that indicates which hard disk the firmware loads the kernel from is drive letter A, and the parameter that indicates which hard disk the kernel starts the operating system corresponding to is also drive letter A. However, since drive letter A already corresponds to the new hard disk P at this time, this will cause the computer to load the corresponding kernel from the new hard disk P according to drive letter A and start the operating system corresponding to the new hard disk P, so that the computer cannot load the correct kernel (the kernel corresponding to the original system disk). The subsequent firmware will pass the parameter that indicates which hard disk the kernel starts the operating system corresponding to, that is, drive letter A, to the kernel, but the kernel still cannot enter the correct operating system (the operating system corresponding to the original system disk) according to drive letter A.

[0090] Of course, the above process and principle explanation also apply to the case where the user wants to start the operating system corresponding to the hard disk whose current priority is not the highest. Hereinafter, the hard disk whose current priority is not the highest that the user wants to start is referred to as the target hard disk.

[0091] One of the core concepts of the embodiment of the present invention is that the controller information corresponding to the target hard disk that the user wants to start can be pre-saved in the firmware through a target variable, so that the firmware can read the target variable when running, and adjust the scanning order of the hard disk controller when the firmware performs PCI scanning according to the target variable, so that the target controller corresponding to the controller information saved by the target variable is used as the first controller to be scanned, that is, the target controller corresponding to the target hard disk is used as the first controller to be scanned, so that the firmware can then load and start the kernel corresponding to the target hard disk, that is, it can start to the correct kernel. In addition, the firmware can also pass the identification information of the target controller to the kernel to be started before starting the kernel. Since the target controller corresponds to the hard disk slot, the target controller will not change with the newly inserted hard disk, and the hard disk managed by the target controller will not change with the newly inserted hard disk, and it is always the target hard disk. Therefore, by pre-saving the identification information of the target controller in the firmware, the correct target hard disk can be uniquely determined. Then the kernel can start the correct operating system (the operating system corresponding to the target hard disk) according to the identification information of the target controller pre-saved by the firmware. In this way, the electronic device can start the correct kernel and then start the correct operating system.

[0092] It should be noted that the operating system startup method provided in the embodiment of the present invention can be applicable to adding a new hard disk to a processor board with a MIPS (Microprocessor without interlocked piped stages) architecture, or to removing a hard disk when there are multiple hard disks, and can be applied to electronic devices with a MIPS architecture processor as a CPU (Central Processing Unit).

[0093] Reference Figure 1 , shows a flowchart of an operating system startup method embodiment of the present invention, which may specifically include the following steps:

[0094] Step 101, running the firmware.

[0095] In an embodiment of the present invention, when a new hard disk is inserted or removed from a processor board (at least two hard disks have been inserted into the processor board before removal), the user can save the controller information of the target controller corresponding to the target hard disk to be started in the firmware through a target variable. Specifically, the target variable can be assigned a value, and the assigned value is the controller information.

[0096] After that, when the electronic device is powered on again, the firmware in the electronic device can start and run. Usually, after the firmware runs, it will first initialize the CPU, bridge chip, PCI device, interrupt, etc., where the PCI device is the device connected through the PCI interface, such as the various hard disks in the embodiment of the present invention. The firmware will initialize the PCI device in the middle and late stages of initialization, which includes the step of PCI scanning. PCI scanning is to load the driver corresponding to the connected PCI device. The various software in the electronic device controls the PCI device through the driver.

[0097] Step 102, reading a pre-stored target variable through the firmware; the target variable is used to indicate controller information of a target controller corresponding to the target hard disk.

[0098] In an embodiment of the present invention, before the firmware performs a PCI scan, the firmware can read a pre-stored target variable to obtain the value of the target variable, that is, the controller information of the target controller corresponding to the target hard disk, that is, the firmware can obtain the controller information corresponding to the target hard disk that the user wants to start from the target variable.

[0099] Step 103, when performing interconnection scanning to the first external device through the firmware, the target controller indicated by the target variable is scanned as the first hard disk controller to be scanned.

[0100] In an embodiment of the present invention, the first PCI (peripheral component interconnect) scan is a PCI scan performed by the firmware. When the firmware proceeds to the first PCI scan, that is, the first PCI scan, the firmware can find the target controller corresponding to the target hard disk from the hard disk controllers to be scanned according to the controller information stored in the target variable, and adjust the scanning order of each hard disk controller, and set the target controller to be the first hard disk controller to be scanned.

[0101] Step 104: passing the identification information of the target controller to the kernel to be started through the firmware.

[0102] In an embodiment of the present invention, when the kernel starts the operating system, it is necessary to start the system according to the parameters transmitted by the firmware for indicating which hard disk's operating system to start. Therefore, before the kernel starts, the firmware can transmit the identification information of the target controller to the kernel to be started.

[0103] Step 105: Load and start the kernel corresponding to the target hard disk through the firmware.

[0104] In the embodiment of the present invention, after completing the parameter transmission and other necessary operations, the firmware can load and start the kernel corresponding to the target hard disk. Since the mechanism of the firmware itself is to start the kernel of the hard disk corresponding to the first controller that performs PCI scanning, when the target controller corresponding to the target hard disk is used as the first place in the firmware PCI scan, the firmware can load and start the kernel corresponding to the target hard disk by default, that is, it can start the correct kernel.

[0105] Step 106: boot the operating system corresponding to the target hard disk through the kernel according to the identification information.

[0106] In an embodiment of the present invention, the identification information of the target controller corresponding to the target hard disk has been transmitted by the firmware to the kernel corresponding to the target hard disk. Therefore, after the kernel corresponding to the target hard disk is started, it can determine that the operating system to be started is the operating system corresponding to the target hard disk based on the identification information, and then the correct operating system can be started.

[0107] In an embodiment of the present invention, when the firmware is running, the firmware can read a pre-stored target variable, which is used to indicate the controller information of the target controller corresponding to the target hard disk that the user wants to start. When the firmware is performing the process of interconnecting the first external device, the target controller indicated by the target variable can be scanned as the first hard disk controller to be scanned, so that the firmware can then load and start the kernel corresponding to the target hard disk, that is, it can start the correct kernel required by the user. In addition, before starting the kernel, the firmware can also pass the identification information of the target controller to the kernel to be started, and then the kernel can start the operating system corresponding to the target hard disk according to the identification information. In this way, the electronic device can start the correct kernel required by the user, and then can start the correct operating system required by the user.

[0108] Reference Figure 2 , shows a flowchart of another operating system startup method embodiment of the present invention, which may specifically include the following steps:

[0109] Step 201, when a new hard disk is inserted into or removed from the processor board, the firmware is started and run.

[0110] In the embodiment of the present invention, after the user inserts a new hard disk into the processor board or removes a new hard disk, when the electronic device is started for the first time, the electronic device will first start and run the firmware.

[0111] Step 202: When a selection instruction of the target hard disk is received through the firmware, controller information of a target controller corresponding to the target hard disk is obtained.

[0112] In the embodiment of the present invention, after the firmware is run, a hard disk selection interface can be displayed, and the user can select the target hard disk to be started in the hard disk selection interface, so that the firmware can receive the target hard disk selection instruction. After a hard disk is mounted on the PCI bus, the electronic device can obtain the controller information of the hard disk controller corresponding to the hard disk. Therefore, when the firmware receives the target hard disk selection instruction, it can obtain the controller information of the target controller corresponding to the target hard disk connected to the bus.

[0113] In practical applications, the controller information may optionally include the bus number, device number and function number of the target controller corresponding to the target hard disk. Usually, there are 256 PCI buses, each of which can be configured with 32 multi-function devices, and each multi-function device can be installed with 8 functional sub-devices. Therefore, a hard disk controller can be uniquely identified by the bus number, device number and function number, and accordingly, a hard disk can be uniquely identified.

[0114] Step 203, saving the controller information to the target variable; the target variable is used to indicate the controller information of the target controller corresponding to the target hard disk.

[0115] In an embodiment of the present invention, the controller information of the target controller corresponding to the target hard disk to be started can be saved in the firmware through a preset target variable. Specifically, the target variable can be assigned a value, and the assigned value is the controller information.

[0116] Step 204: restart the firmware to make the saved controller information effective.

[0117] In an embodiment of the present invention, after the controller information is saved to the target variable, in order to make the assigned value take effect, the electronic device can be restarted, so that the firmware will also be restarted accordingly. After the restart, the controller information saved by the target variable can take effect, and if the connected hard disk remains unchanged, the controller information saved by the target variable will be valid for each subsequent startup.

[0118] Step 205, running the firmware.

[0119] In the embodiment of the present invention, after the firmware is restarted, the firmware may start running.

[0120] Step 206: Read the pre-stored target variable through the firmware.

[0121] The specific implementation method of this step can refer to the above step 102 and will not be repeated here.

[0122] Step 207: When performing interconnection scanning to the first external device through the firmware, the target controller indicated by the target variable is scanned as the first hard disk controller to be scanned.

[0123] In an embodiment of the present invention, this step can be specifically implemented in the following manner, including: when performing an interconnection scan to the first external device through the firmware, exchanging the scanning order of the target controller indicated by the target variable with the first hard disk controller in the first preset scanning order; using the target controller indicated by the target variable as the first hard disk controller for the interconnection scan of the first external device, and scanning through the firmware.

[0124] Among them, the first PCI scan is the PCI scanning process executed by the firmware. The original order in which the firmware executes the first PCI scan is the first preset scanning order. In the first preset scanning order, the first hard disk controller scanned is not necessarily the target controller corresponding to the target hard disk. Therefore, when the firmware proceeds to the first PCI scan, the target controller indicated by the target variable is swapped with the scanning order of the first hard disk controller in the first preset scanning order, so that the target controller can be set to the first hard disk controller scanned corresponding to the first PCI scanning process.

[0125] It should be noted that the first scan here refers to all hard disk controllers, not all controllers. That is to say, after the scanning order is adjusted, the target controller is the first scanned among all hard disk controllers, but among all controllers including the hard disk controller, the target controller is not necessarily the first scanned.

[0126] Step 208: passing the identification information of the target controller to the kernel to be started through the firmware.

[0127] In the embodiment of the present invention, after the kernel is started, a PCI scan is performed, that is, a second PCI scan. The second PCI scan is also a PCI scan process performed by the kernel. The original order in which the kernel performs the second PCI scan is a second preset scan order. Usually, the second preset scan order is the same as the first preset scan order.

[0128] In the prior art, the firmware can pass the first parameter used to indicate which hard disk operating system the kernel starts to the kernel to be started, so that the kernel can start the corresponding operating system according to the first parameter. However, since the boot files of each hard disk are not changed when a new hard disk is inserted or removed, the hard disk indicated by the first parameter at this time is not the hard disk indicated before the new hard disk is inserted or removed. Therefore, according to the first parameter, the kernel will start the wrong operating system. Only exchanging the scanning order of the target controller and the original first hard disk controller can minimize the change in the scan and avoid affecting other hard disk controllers and other non-hard disk controllers.

[0129] Therefore, in an optional implementation method, when the identification information includes the ranking of the target controller in the second preset scanning order, this step can be implemented in the following manner, including: replacing the first parameter with the ranking of the target controller in the second preset scanning order through the firmware; the first parameter is used to indicate the hard disk controller corresponding to the hard disk where the operating system to be started is located; and passing the replaced first parameter to the kernel to be started through the firmware.

[0130] That is, the firmware can replace the first parameter parsed from the boot file with the ranking of the target controller in the second preset scan sequence, and then the firmware can pass the replaced first parameter to the kernel to be started, so that the kernel can determine the target controller from the scanned hard disk controllers according to the first parameter after the second PCI scan, and then the kernel can start the operating system of the target hard disk corresponding to the target controller. In actual applications, the ranking of the target controller in the second preset scan sequence can be represented by the current drive letter of the target hard disk, that is, the identification information can be the current drive letter of the target hard disk.

[0131] In another optional implementation, when the identification information includes the controller information, this step can also be implemented in the following manner, including: using the controller information as a second parameter, passing it to the kernel to be started through the firmware; the second parameter has different attributes from the first parameter.

[0132] That is, the second parameter is different from the first parameter, and the second parameter can be used to instruct the kernel to adjust the order of the second PCI scan to enter the operating system of the target hard disk indicated by the second parameter. The firmware can pass the controller information of the target controller as the second parameter to the kernel to be started. In actual application, in one implementation, the processing logic of the firmware can be modified to pass both the first parameter and the second parameter, but the processing logic of the kernel can be modified to start the operating system only according to the second parameter. In another implementation, the processing logic of the firmware can be modified to pass only the second parameter without passing the first parameter, and the processing logic of the kernel can be modified to start the operating system according to the second parameter, and the embodiment of the present invention does not specifically limit this.

[0133] After the firmware starts the kernel, the kernel will take over the subsequent processes. Therefore, the firmware needs to prepare the parameters that need to be passed to the kernel to be started through the parameter passing instruction before starting the kernel, so that the kernel started later can obtain the parameters through the parameter passing instruction. Since the mechanism of the firmware starting the kernel is to start the kernel of the hard disk corresponding to the first hard disk controller scanned by PCI, and in the embodiment of the present invention, the first hard disk controller scanned by PCI is the target controller corresponding to the target hard disk, therefore, after the firmware passes the parameters required by the kernel, it can start the kernel corresponding to the target hard disk, and accordingly, the passed parameters will be obtained by the kernel later.

[0134] Step 209: Load and start the kernel corresponding to the target hard disk through the firmware.

[0135] In the embodiment of the present invention, after completing the parameter transmission and other necessary operations, the firmware can load and start the kernel corresponding to the target hard disk. Since the mechanism of the firmware itself is to start the kernel of the hard disk corresponding to the first controller that performs PCI scanning, when the target controller corresponding to the target hard disk is used as the first place in the firmware PCI scan, the firmware can load and start the kernel corresponding to the target hard disk by default, that is, it can start the correct kernel.

[0136] Step 210: booting the operating system corresponding to the target hard disk through the kernel according to the identification information.

[0137] In the embodiment of the present invention, corresponding to the two implementation methods in step 209, this step can also be implemented in two ways.

[0138] In an optional implementation, when the identification information includes the ranking of the target controller in a second preset scanning order, this step includes: performing a second external device interconnection scan through the kernel in accordance with the second preset scanning order; selecting the target controller from the scanned hard disk controllers through the kernel according to the ranking of the target controller in the second preset scanning order; determining the target hard disk corresponding to the target controller; and starting the operating system corresponding to the target hard disk through the kernel.

[0139] When the identification information includes the ranking of the target controller in the second preset scanning order, the kernel can still perform the second PCI scan according to the original second preset scanning order. After the kernel scan is completed, the kernel can select the target controller from all the scanned hard disk controllers according to the ranking of the target controller in the second preset scanning order, and then determine the target hard disk corresponding to the target controller. The kernel can then start the operating system corresponding to the target hard disk.

[0140] In another optional implementation, when the identification information includes the controller information, this step includes: when performing an interconnection scan to a second external device through the kernel, exchanging the scan order of the target controller corresponding to the controller information with the first hard disk controller in a second preset scan order; using the target controller corresponding to the controller information as the first hard disk controller for the interconnection scan of the second external device, and scanning it through the kernel; and starting the operating system corresponding to the target hard disk corresponding to the first hard disk controller for the interconnection scan of the second external device through the kernel.

[0141] When the identification information includes the controller information, the kernel may not scan according to the original second preset scan order when performing the PCI scan process, but may adjust the second preset scan order according to the controller information of the target controller. That is, the target controller corresponding to the controller information is interchanged with the scan order of the first hard disk controller in the second preset scan order, so that the target controller can be set to the first hard disk controller scanned corresponding to the second PCI scan process. After that, the kernel can directly start the operating system of the hard disk corresponding to the first scanned hard disk controller. Since the first scanned hard disk controller is the controller corresponding to the target hard disk at this time, the kernel starts the system corresponding to the target hard disk.

[0142] In addition, an embodiment of the present invention can also provide a method for starting the operating system corresponding to the onboard system disk after adding or deleting a hard disk, that is, the system disk can be mounted to the hard disk controller with the highest priority during the design stage of the processor board, that is, the hard disk controller that will be scanned first. In this way, the firmware can start the correct kernel according to the original processing logic, and the kernel can start the correct operating system according to the original processing logic.

[0143] However, if the processor board is not designed according to the above method, or the user changes the default boot system disk after it is designed according to the above method, the above operating system boot method provided by the embodiment of the present invention can be applied to boot the system, so that the electronic device can still boot the correct kernel and then boot the correct operating system.

[0144] In an embodiment of the present invention, when the firmware is running, the firmware can read a pre-stored target variable, which is used to indicate the controller information of the target controller corresponding to the target hard disk that the user wants to start. When the firmware is performing the process of interconnecting the first external device, the target controller indicated by the target variable can be scanned as the first hard disk controller to be scanned, so that the firmware can then load and start the kernel corresponding to the target hard disk, that is, it can start the correct kernel required by the user. In addition, before starting the kernel, the firmware can also pass the identification information of the target controller to the kernel to be started, and then the kernel can start the operating system corresponding to the target hard disk according to the identification information. In this way, the electronic device can start the correct kernel required by the user, and then can start the correct operating system required by the user.

[0145] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0146] Reference Figure 3 , shows a structural block diagram of an operating system startup device embodiment of the present invention, the device 300 may specifically include the following modules:

[0147] An operation module 301 is used to operate the firmware;

[0148] The reading module 302 is used to read the pre-stored target variable through the firmware; the target variable is used to indicate the controller information of the target controller corresponding to the target hard disk;

[0149] A scanning module 303 is used to scan the target controller indicated by the target variable as the first hard disk controller to be scanned when performing interconnection scanning to the first external device through the firmware;

[0150] The parameter transmission module 304 is used to transmit the identification information of the target controller to the kernel to be started through the firmware;

[0151] A kernel startup module 305, used to load and start the kernel corresponding to the target hard disk through the firmware;

[0152] The system startup module 306 is used to start the operating system corresponding to the target hard disk through the kernel according to the identification information.

[0153] Optionally, the scanning module includes:

[0154] A first interchange submodule, used for, when performing interconnection scanning to a first external device through the firmware, interchange the scanning order of the target controller indicated by the target variable with the first hard disk controller in the first preset scanning order;

[0155] The first scanning submodule is used to use the target controller indicated by the target variable as the first hard disk controller for the first external device interconnection scan, and scan it through the firmware.

[0156] Optionally, when the identification information includes the ranking of the target controller in the second preset scanning sequence, the parameter transmission module includes:

[0157] A replacement submodule, used to replace the first parameter with the ranking of the target controller in the second preset scanning sequence through the firmware; the first parameter is used to indicate the hard disk controller corresponding to the hard disk where the operating system to be started is located;

[0158] A first parameter transmission submodule, used for transmitting the replaced first parameter to the kernel to be started through the firmware;

[0159] The system startup module includes:

[0160] A second scanning submodule, configured to perform a second external device interconnection scan through the kernel according to the second preset scanning sequence;

[0161] A selection submodule, configured to select the target controller from the scanned hard disk controllers through the kernel according to the ranking of the target controller in the second preset scanning sequence;

[0162] A determination submodule, used to determine the target hard disk corresponding to the target controller;

[0163] The first startup submodule is used to start the operating system corresponding to the target hard disk through the kernel.

[0164] Optionally, when the identification information includes the controller information, the parameter transmission module includes:

[0165] A second parameter transmission submodule, used for transmitting the controller information as a second parameter to the kernel to be started through the firmware; the second parameter has a different attribute from the first parameter;

[0166] The system startup module includes:

[0167] A second interchange submodule is used to interchange the scanning order of the target controller corresponding to the controller information with the first hard disk controller in the second preset scanning order when performing interconnection scanning to the second external device through the kernel;

[0168] A third scanning submodule, configured to use the target controller corresponding to the controller information as the first hard disk controller for interconnection scanning of the second external device, and perform scanning through the kernel;

[0169] The second startup submodule is used to start the operating system corresponding to the target hard disk corresponding to the first hard disk controller scanned by the second external device interconnection through the kernel.

[0170] Optionally, the device further comprises:

[0171] A firmware startup module, used to start and run the firmware when a new hard disk is inserted into or removed from the processor board;

[0172] an acquisition module, configured to acquire controller information of a target controller corresponding to the target hard disk when receiving a selection instruction of the target hard disk through the firmware;

[0173] A saving module, used for saving the controller information to the target variable;

[0174] The firmware restart module is used to restart the firmware to make the saved controller information effective.

[0175] Optionally, the controller information includes a bus number, a device number and a function number of the target controller corresponding to the target hard disk.

[0176] In an embodiment of the present invention, when the firmware is running, the firmware can read a pre-stored target variable, which is used to indicate the controller information of the target controller corresponding to the target hard disk that the user wants to start. When the firmware is performing the process of interconnecting the first external device, the target controller indicated by the target variable can be scanned as the first hard disk controller to be scanned, so that the firmware can then load and start the kernel corresponding to the target hard disk, that is, it can start the correct kernel required by the user. In addition, before starting the kernel, the firmware can also pass the identification information of the target controller to the kernel to be started, and then the kernel can start the operating system corresponding to the target hard disk according to the identification information. In this way, the electronic device can start the correct kernel required by the user, and then can start the correct operating system required by the user.

[0177] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0178] Figure 4 1 is a block diagram of an electronic device 400 for starting an operating system according to an exemplary embodiment. For example, the electronic device 400 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0179] Reference Figure 4 , the electronic device 400 may include one or more of the following components: a processing component 402 , a memory 404 , a power component 406 , a multimedia component 408 , an audio component 410 , an input / output (I / O) interface 412 , a sensor component 414 , and a communication component 416 .

[0180] The processing component 402 generally controls the overall operation of the electronic device 400, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 402 may include one or more processors 420 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 402 may include one or more modules to facilitate the interaction between the processing component 402 and other components. For example, the processing component 402 may include a multimedia module to facilitate the interaction between the multimedia component 408 and the processing component 402.

[0181] The memory 404 is configured to store various types of data to support operations on the device 400. Examples of such data include instructions for any application or method operating on the electronic device 400, contact data, phone book data, messages, pictures, videos, etc. The memory 404 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0182] The power supply component 406 provides power to the various components of the electronic device 400. The power supply component 406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 400.

[0183] The multimedia component 408 includes a screen that provides an output interface between the electronic device 400 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 408 includes a front camera and / or a rear camera. When the electronic device 400 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0184] The audio component 410 is configured to output and / or input audio signals. For example, the audio component 410 includes a microphone (MIC), and when the electronic device 400 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 404 or sent via the communication component 416. In some embodiments, the audio component 410 also includes a speaker for outputting audio signals.

[0185] I / O interface 412 provides an interface between processing component 402 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0186] The sensor assembly 414 includes one or more sensors for providing various aspects of status assessment for the electronic device 400. For example, the sensor assembly 414 can detect the open / closed state of the device 400, the relative positioning of components, such as the display and keypad of the electronic device 400, and the sensor assembly 414 can also detect the position change of the electronic device 400 or a component of the electronic device 400, the presence or absence of user contact with the electronic device 400, the orientation or acceleration / deceleration of the electronic device 400, and the temperature change of the electronic device 400. The sensor assembly 414 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 414 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 414 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0187] The communication component 416 is configured to facilitate wired or wireless communication between the electronic device 400 and other devices. The electronic device 400 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 416 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 416 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0188] In an exemplary embodiment, the electronic device 400 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0189] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 404 including instructions, and the instructions can be executed by a processor 420 of an electronic device 400 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0190] A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform a method for starting an operating system, the method comprising:

[0191] Run the firmware;

[0192] Reading a pre-stored target variable through the firmware; the target variable is used to indicate controller information of a target controller corresponding to the target hard disk;

[0193] When performing interconnection scanning to a first external device through the firmware, the target controller indicated by the target variable is scanned as a first hard disk controller to be scanned;

[0194] Passing the identification information of the target controller to the kernel to be started through the firmware;

[0195] Loading and starting the kernel corresponding to the target hard disk through the firmware;

[0196] According to the identification information, the operating system corresponding to the target hard disk is started through the kernel.

[0197] Optionally, when performing interconnection scanning to the first external device through the firmware, scanning the target controller indicated by the target variable as a first hard disk controller to be scanned, includes:

[0198] When performing interconnection scanning to a first external device through the firmware, exchanging the scanning order of the target controller indicated by the target variable with the first hard disk controller in the first preset scanning order;

[0199] The target controller indicated by the target variable is used as the first hard disk controller for the first external device interconnection scan, and is scanned by the firmware.

[0200] Optionally, when the identification information includes a rank of the target controller in a second preset scanning sequence, the transmitting, by the firmware, the identification information of the target controller to the kernel to be started includes:

[0201] The first parameter is replaced by the ranking of the target controller in the second preset scanning sequence through the firmware; the first parameter is used to indicate the hard disk controller corresponding to the hard disk where the operating system to be started is located;

[0202] Passing the replaced first parameter to the kernel to be started through the firmware;

[0203] The step of starting the operating system corresponding to the target hard disk through the kernel according to the identification information includes:

[0204] Performing a second external device interconnection scan by the kernel according to the second preset scan sequence;

[0205] According to the ranking of the target controller in the second preset scanning sequence, the kernel selects the target controller from the scanned hard disk controllers;

[0206] Determine the target hard disk corresponding to the target controller;

[0207] The operating system corresponding to the target hard disk is started through the kernel.

[0208] Optionally, when the identification information includes the controller information, the transmitting, by the firmware, the identification information of the target controller to the kernel to be started includes:

[0209] The controller information is used as a second parameter and transmitted to the kernel to be started through the firmware; the second parameter has a different attribute from the first parameter;

[0210] The step of starting the operating system corresponding to the target hard disk through the kernel according to the identification information includes:

[0211] When performing interconnection scanning to a second external device through the kernel, exchanging the scanning order of the target controller corresponding to the controller information with the first hard disk controller in the second preset scanning order;

[0212] The target controller corresponding to the controller information is used as the first hard disk controller for the second external device interconnection scan, and is scanned by the kernel;

[0213] The operating system corresponding to the target hard disk corresponding to the first hard disk controller scanned by the second external device interconnection is started through the kernel.

[0214] Optionally, before running the firmware, the method further includes:

[0215] When a new hard disk is inserted into or removed from the processor board, the firmware is started and run;

[0216] When a selection instruction of the target hard disk is received through the firmware, controller information of a target controller corresponding to the target hard disk is acquired;

[0217] Saving the controller information to the target variable;

[0218] Restart the firmware to make the saved controller information effective.

[0219] Optionally, the controller information includes a bus number, a device number and a function number of the target controller corresponding to the target hard disk.

[0220] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0221] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0222] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0223] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal device to operate in a predictable manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0224] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0225] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0226] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0227] The above is a detailed introduction to an operating system startup method and device, an electronic device and a storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for a person skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for starting an operating system, characterized in that: include: Run the firmware; Reading a pre-stored target variable through the firmware; The target variable is used to indicate the controller information of the target controller corresponding to the target hard disk; When performing interconnection scanning to a first external device through the firmware, the target controller indicated by the target variable is scanned as a first hard disk controller to be scanned; Passing the identification information of the target controller to the kernel to be started through the firmware; Loading and starting the kernel corresponding to the target hard disk through the firmware; According to the identification information, the operating system corresponding to the target hard disk is started through the kernel.

2. The method according to claim 1, characterized in that When performing interconnection scanning to the first external device through the firmware, scanning the target controller indicated by the target variable as the first hard disk controller to be scanned, including: When performing interconnection scanning to a first external device through the firmware, exchanging the scanning order of the target controller indicated by the target variable with the first hard disk controller in the first preset scanning order; The target controller indicated by the target variable is used as the first hard disk controller for the first external device interconnection scan, and is scanned by the firmware.

3. The method according to claim 1, characterized in that When the identification information includes the rank of the target controller in the second preset scanning sequence, the transmitting, by the firmware, the identification information of the target controller to the kernel to be started includes: The first parameter is replaced by the ranking of the target controller in the second preset scanning sequence through the firmware; the first parameter is used to indicate the hard disk controller corresponding to the hard disk where the operating system to be started is located; Passing the replaced first parameter to the kernel to be started through the firmware; The step of starting the operating system corresponding to the target hard disk through the kernel according to the identification information includes: Performing a second external device interconnection scan by the kernel according to the second preset scan sequence; According to the ranking of the target controller in the second preset scanning sequence, the kernel selects the target controller from the scanned hard disk controllers; Determine the target hard disk corresponding to the target controller; The operating system corresponding to the target hard disk is started through the kernel.

4. The method according to claim 3, characterized in that When the identification information includes the controller information, the transmitting, by the firmware, the identification information of the target controller to the kernel to be started includes: The controller information is used as a second parameter and transmitted to the kernel to be started through the firmware; the second parameter has a different attribute from the first parameter; The step of starting the operating system corresponding to the target hard disk through the kernel according to the identification information includes: When performing interconnection scanning to a second external device through the kernel, exchanging the scanning order of the target controller corresponding to the controller information with the first hard disk controller in the second preset scanning order; The target controller corresponding to the controller information is used as the first hard disk controller for the second external device interconnection scan, and is scanned by the kernel; The operating system corresponding to the target hard disk corresponding to the first hard disk controller scanned by the second external device interconnection is started through the kernel.

5. The method according to claim 1, characterized in that Before running the firmware, the method further includes: When a new hard disk is inserted into or removed from the processor board, the firmware is started and run; When a selection instruction of the target hard disk is received through the firmware, controller information of a target controller corresponding to the target hard disk is acquired; Saving the controller information to the target variable; Restart the firmware to make the saved controller information effective.

6. The method according to any one of claims 1 to 5, characterized in that: The controller information includes the bus number, device number and function number of the target controller corresponding to the target hard disk.

7. An operating system startup device, characterized in that: include: Running module, used to run firmware; A reading module, used for reading a pre-stored target variable through the firmware; The target variable is used to indicate the controller information of the target controller corresponding to the target hard disk; A scanning module, used for scanning the target controller indicated by the target variable as a first hard disk controller to be scanned when performing interconnection scanning to the first external device through the firmware; A parameter transmission module, used for transmitting the identification information of the target controller to the kernel to be started through the firmware; A kernel startup module, used to load and start the kernel corresponding to the target hard disk through the firmware; A system startup module is used to start the operating system corresponding to the target hard disk through the kernel according to the identification information.

8. The device according to claim 7, characterized in that The scanning module comprises: A first interchange submodule, used for, when performing interconnection scanning to a first external device through the firmware, interchange the scanning order of the target controller indicated by the target variable with the first hard disk controller in the first preset scanning order; The first scanning submodule is used to use the target controller indicated by the target variable as the first hard disk controller for the first external device interconnection scan, and scan it through the firmware.

9. The device according to claim 7, characterized in that When the identification information includes the ranking of the target controller in the second preset scanning sequence, the parameter transmission module includes: A replacement submodule, used to replace the first parameter with the ranking of the target controller in the second preset scanning sequence through the firmware; the first parameter is used to indicate the hard disk controller corresponding to the hard disk where the operating system to be started is located; A first parameter transmission submodule, used for transmitting the replaced first parameter to the kernel to be started through the firmware; The system startup module includes: A second scanning submodule, configured to perform a second external device interconnection scan through the kernel according to the second preset scanning sequence; A selection submodule, configured to select the target controller from the scanned hard disk controllers through the kernel according to the ranking of the target controller in the second preset scanning sequence; A determination submodule, used to determine the target hard disk corresponding to the target controller; The first startup submodule is used to start the operating system corresponding to the target hard disk through the kernel.

10. The device according to claim 9, characterized in that When the identification information includes the controller information, the parameter transmission module includes: A second parameter transmission submodule, used for transmitting the controller information as a second parameter to the kernel to be started through the firmware; the second parameter has a different attribute from the first parameter; The system startup module includes: A second interchange submodule is used to interchange the scanning order of the target controller corresponding to the controller information with the first hard disk controller in the second preset scanning order when performing interconnection scanning to the second external device through the kernel; A third scanning submodule, configured to use the target controller corresponding to the controller information as the first hard disk controller for interconnection scanning of the second external device, and perform scanning through the kernel; The second startup submodule is used to start the operating system corresponding to the target hard disk corresponding to the first hard disk controller scanned by the second external device interconnection through the kernel.

11. The device according to claim 7, characterized in that The device also includes: A firmware startup module, used to start and run the firmware when a new hard disk is inserted into or removed from the processor board; an acquisition module, configured to acquire controller information of a target controller corresponding to the target hard disk when receiving a selection instruction of the target hard disk through the firmware; A saving module, used for saving the controller information to the target variable; The firmware restart module is used to restart the firmware to make the saved controller information effective.

12. The device according to any one of claims 7 to 11, characterized in that: The controller information includes the bus number, device number and function number of the target controller corresponding to the target hard disk.

13. An electronic device, characterized in that: The system comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, wherein the one or more programs include instructions for performing the following operations: Run the firmware; Reading a pre-stored target variable through the firmware; the target variable is used to indicate controller information of a target controller corresponding to the target hard disk; When performing interconnection scanning to a first external device through the firmware, the target controller indicated by the target variable is scanned as a first hard disk controller to be scanned; Passing the identification information of the target controller to the kernel to be started through the firmware; Loading and starting the kernel corresponding to the target hard disk through the firmware; According to the identification information, the operating system corresponding to the target hard disk is started through the kernel.

14. A readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the operating system startup method corresponding to any one of claims 1-6.