[go: up one dir, main page]

CN113326069B - Operating system startup method, device, electronic device and storage medium - Google Patents

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

Info

Publication number
CN113326069B
CN113326069B CN202010131076.3A CN202010131076A CN113326069B CN 113326069 B CN113326069 B CN 113326069B CN 202010131076 A CN202010131076 A CN 202010131076A CN 113326069 B CN113326069 B CN 113326069B
Authority
CN
China
Prior art keywords
target
controller
hard disk
firmware
kernel
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010131076.3A
Other languages
Chinese (zh)
Other versions
CN113326069A (en
Inventor
霍栋博
田永光
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Longxin Zhongke Electronic Technology Co ltd
Original Assignee
Guangdong Longxin Zhongke Electronic Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Longxin Zhongke Electronic Technology Co ltd filed Critical Guangdong Longxin Zhongke Electronic Technology Co ltd
Priority to CN202010131076.3A priority Critical patent/CN113326069B/en
Publication of CN113326069A publication Critical patent/CN113326069A/en
Application granted granted Critical
Publication of CN113326069B publication Critical patent/CN113326069B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4406Loading of operating system
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4411Configuring for operating with peripheral devices; Loading of device drivers

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

本发明实施例提供了一种操作系统启动方法、装置、电子设备及存储介质,涉及计算机技术领域。该方法包括:运行固件;通过固件读取预存的目标变量;在通过固件进行至第一PCI扫描时,将目标变量指示的目标控制器作为首位进行扫描;通过固件将目标控制器的标识信息向待启动的内核进行传递;通过固件加载并启动目标控制器对应的目标硬盘的内核;根据标识信息,通过内核启动目标硬盘的操作系统。本发明中,固件可通过目标变量获得用户所需的目标硬盘的控制器信息,进而在完成PCI扫描后,可以启动目标硬盘的内核。另外,固件还可以在启动内核前,将目标控制器的标识信息传参给内核,进而内核便能够根据该标识信息,启动目标硬盘的操作系统。

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.

Description

Operating system starting method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to an operating system startup method, an operating system startup device, an electronic device, and a storage medium.
Background
The processor is one of the main components of an electronic computer, and is a core assembly in the electronic computer, and its function is mainly to interpret computer instructions and process data in computer software. The processor has wide market application prospect in products such as servers, high-performance computers, low-energy-consumption data centers, personal high-performance computers, high-end desktop applications, high-throughput computing applications, industrial control, digital signal processing, high-end embedded applications and the like, and plays a significant role in more aspects such as economic development and the like.
In the use process of the processor board card, a plurality of hard disks are often needed, for example, when an operating system needs to be added, the hard disk corresponding to the operating system needs to be added. In many cases, however, even with the addition of a hard disk, there is still a need to first boot up the original system disk. At present, when a new hard disk is added, the main starting process of an operating system is that firstly, a system boot file corresponding to which hard disk can be manually specified and read, if an original system disk before the new hard disk is not inserted needs to be started, the identification of the original system disk can be specified, then, the firmware can read and analyze the boot file of the original system disk according to the specified identification of the original system disk, the boot options in the boot file can indicate which hard disk needs to load a kernel from and which hard disk corresponds to the operating system is started, and the boot options indicate the hard disk through the hard disk identification.
The firmware can read the guide file of the correct hard disk because the hard disk identifier corresponding to the guide file is specified, but the hard disk identifier can change along with the plugging position or the plugging sequence of each hard disk, so that under the condition of adding a new hard disk, the identifier of the original system disk can possibly indicate other hard disks, the hard disk identifier in the guide file of the original system disk is unchanged, and therefore, the correct kernel cannot be loaded and the correct operating system cannot be started after the kernel is loaded according to the hard disk identifier in the guide file and the operating system is started.
Disclosure of Invention
In view of the foregoing, embodiments of the present invention are provided to provide an operating system booting method that overcomes the foregoing problems or at least partially solves the foregoing problems, so as to enable a normal booting of an original system disk operating system of a processor board card when a hard disk accessing the processor board card is increased or decreased.
Correspondingly, the embodiment of the invention also provides an operating system starting device, electronic equipment and a storage medium, which are used for ensuring the realization and application of the method.
In order to solve the above problems, an embodiment of the present invention discloses an operating system startup method, including:
Running firmware;
The firmware reads a pre-stored target variable, wherein the target variable is used for indicating the controller information of a target controller corresponding to a target hard disk;
when the firmware scans interconnection to a first external device, the target controller indicated by the target variable is used as a first hard disk controller for scanning;
Transmitting the identification information of the target controller to a kernel to be started through the firmware;
loading and starting a kernel corresponding to the target hard disk through the firmware;
and starting an operating system corresponding to the target hard disk through the kernel according to the identification information.
Optionally, the scanning, as the first hard disk controller of the scanning, the target controller indicated by the target variable when the scanning is performed to the first external device interconnection through the firmware includes:
When the firmware performs interconnection scanning to a first external device, exchanging the scanning sequence of the target controller indicated by the target variable with the scanning sequence of the first hard disk controller in a first preset scanning sequence;
And taking the target controller indicated by the target variable as a first hard disk controller for interconnection scanning of the first external equipment, and scanning through the firmware.
Optionally, when the identification information includes a ranking of the target controller in a second preset scan sequence, the transmitting, by the firmware, the identification information of the target controller to the kernel to be started includes:
The firmware replaces a first parameter with the ranking of the target controller in a second preset scanning sequence, wherein the first parameter is used for indicating a hard disk controller corresponding to a hard disk where an operating system to be started is located;
Transmitting the replaced first parameter to a kernel to be started through the firmware;
and starting an operating system corresponding to the target hard disk through the kernel according to the identification information, wherein the operating system comprises:
Performing a second external device interconnection scan by the kernel according to the second preset scan order;
selecting the target controller from scanned hard disk controllers through the kernel according to the arrangement of the target controller in the second preset scanning sequence;
Determining the target hard disk corresponding to the target controller;
and starting an operating system corresponding to the target hard disk through the kernel.
Optionally, when the identification information includes the controller information, the transmitting, by the firmware, the identification information of the target controller to a kernel to be started includes:
The controller information is used as a second parameter, and the second parameter is transmitted to a kernel to be started through the firmware, wherein the second parameter is different from the first parameter in attribute;
and starting an operating system corresponding to the target hard disk through the kernel according to the identification information, wherein the operating system comprises:
When the interconnection scanning is carried out to the second external equipment through the kernel, the target controller corresponding to the controller information is exchanged with the scanning sequence of the first hard disk controller in a second preset scanning sequence;
the target controller corresponding to the controller information is used as a first hard disk controller for interconnection scanning of the second external equipment, and scanning is carried out through the kernel;
And starting an operating system corresponding to the target hard disk corresponding to the first hard disk controller of the second external equipment interconnection scanning through the kernel.
Optionally, before the running firmware, the method further includes:
under the condition that a new hard disk is inserted into or removed from the processor board card, starting and operating the firmware;
When receiving a selection instruction of the target hard disk through the firmware, acquiring controller information of a target controller corresponding to the target hard disk;
saving the controller information to the target variable;
Restarting the firmware to validate the saved controller information.
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.
The embodiment of the invention also discloses an operating system starting device, which comprises:
The operation module is used for operating the firmware;
the reading module is used for reading a pre-stored target variable through the firmware, wherein the target variable is used for indicating the controller information of a target controller corresponding to a target hard disk;
The scanning module is used for scanning the target controller indicated by the target variable as a first hard disk controller of scanning when the first external equipment interconnection scanning is performed through the firmware;
the parameter transmission module is used for transmitting the identification information of the target controller to the kernel to be started through the firmware;
The kernel starting module is used for loading and starting the kernel corresponding to the target hard disk through the firmware;
and the system starting module is used for starting the operating system corresponding to the target hard disk through the kernel according to the identification information.
Optionally, the scanning module includes:
The first interchange sub-module is used for interchanging the scanning sequence of the target controller indicated by the target variable and the first hard disk controller in a first preset scanning sequence when the firmware performs interconnection scanning to the first external device;
And the first scanning sub-module is used for taking the target controller indicated by the target variable as a first hard disk controller for interconnection scanning of the first external equipment and scanning through the firmware.
Optionally, when the identification information includes a ranking of the target controller in a second preset scanning order, the parameter transferring module includes:
The replacing sub-module is used for replacing a first parameter with the arrangement of the target controller in a second preset scanning sequence through the firmware, wherein the first parameter is used for indicating a hard disk controller corresponding to a hard disk where an operating system to be started is located;
The first parameter transmission sub-module is used for transmitting the replaced first parameter to the kernel to be started through the firmware;
The system start module comprises:
The second scanning submodule is used for carrying out interconnection scanning of second external equipment through the kernel according to the second preset scanning sequence;
The selecting sub-module is used for selecting the target controller from scanned hard disk controllers through the kernel according to the arrangement of the target controller in the second preset scanning sequence;
the determining submodule is used for determining the target hard disk corresponding to the target controller;
and the first promoter module is used for starting an operating system corresponding to the target hard disk through the kernel.
Optionally, when the identification information includes the controller information, the parameter transmission module includes:
The second parameter transmission sub-module is used for transmitting the controller information to the kernel to be started through the firmware, wherein the second parameter is different from the first parameter in attribute;
The system start module comprises:
The second interchange sub-module is used for interchanging the scanning sequence of the target controller corresponding to the controller information and the first hard disk controller in a second preset scanning sequence when the interconnection scanning is carried out from the inner core to the second external equipment;
The third scanning sub-module is used for taking the target controller corresponding to the controller information as a first hard disk controller for interconnection scanning of the second external equipment and scanning through the kernel;
and the second starting sub-module is used for starting an operating system corresponding to the target hard disk corresponding to the first hard disk controller of the interconnection scanning of the second external equipment through the kernel.
Optionally, the apparatus further comprises:
The firmware starting module is used for starting and running the firmware under the condition that a new hard disk is inserted into or removed from the processor board card;
the acquisition module is used for acquiring the controller information of the target controller corresponding to the target hard disk when receiving the selection instruction of the target hard disk through the firmware;
The storage module is used for storing the controller information to the target variable;
And the firmware restarting module is used for restarting the firmware so as to enable the saved controller information to be effective.
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.
The embodiment of the invention also discloses an electronic device which 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, and the one or more programs comprise instructions for:
Running firmware;
The firmware reads a pre-stored target variable, wherein the target variable is used for indicating the controller information of a target controller corresponding to a target hard disk;
when the firmware scans interconnection to a first external device, the target controller indicated by the target variable is used as a first hard disk controller for scanning;
Transmitting the identification information of the target controller to a kernel to be started through the firmware;
loading and starting a kernel corresponding to the target hard disk through the firmware;
and starting an operating system corresponding to the target hard disk through the kernel according to the identification information.
The embodiment of the invention also discloses a readable storage medium, and when the instructions in the storage medium are executed by a processor of the electronic device, the electronic device can execute one or more of the operating system starting methods in the embodiment of the invention.
The embodiment of the invention has the following advantages:
In the embodiment of the invention, under the condition that the firmware runs, the firmware can read a pre-stored target variable, wherein the target variable is used for indicating the controller information of a target controller corresponding to a target hard disk which a user wants to start. When the firmware performs the process of interconnection scanning to the first external device, the target controller indicated by the target variable can be used as a first hard disk controller for scanning, so that the kernel corresponding to the target hard disk can be loaded and started after the firmware, namely, the kernel can be started to the correct kernel required by the user. In addition, the firmware can also transmit the identification information of the target controller to the kernel to be started before starting the kernel, and the kernel can start the operating system corresponding to the target hard disk according to the identification information. Thus, the electronic device can start the correct kernel required by the user, and further can start the correct operating system required by the user.
Drawings
FIG. 1 is a flowchart illustrating steps of an embodiment of an operating system boot method of the present invention;
FIG. 2 is a flowchart illustrating steps of another operating system boot embodiment of the present invention;
FIG. 3 is a block diagram of an embodiment of an operating system boot device of the present invention;
FIG. 4 is a block diagram illustrating a configuration of an electronic device for booting an operating system, according to an example embodiment.
Detailed Description
In order that the above-recited objects, features and advantages of the present invention will become more readily apparent, a more particular description of the invention will be rendered by reference to the appended drawings and appended detailed description.
Before describing embodiments of the present invention in detail, related concepts and the main flow of the prior art will be described first.
Hard disk is the most important storage device of a computer, wherein the hard disk fixed on a processor board card is called an on-board hard disk, one computer usually has only one on-board hard disk, and in addition, the processor board card can also be provided with other hard disk slots for inserting new hard disks. Each hard disk stores a related function, a file, etc. for starting an operating system, and thus, if a certain operating system is used, the corresponding hard disk needs to be started. In the embodiment of the present invention, the on-board hard disk is referred to as a system disk (i.e., hereinafter referred to as an original system disk), and the new hard disk newly inserted into the processor board is referred to as a hard disk.
The hard disk controller is an integrated hard disk information conversion element on the processor board card, can be understood as a management interface for accessing the hard disk into the processor board card, and controls the hard disk and distributes resources. When a hard disk is inserted into a hard disk slot, the hard disk can be managed by a corresponding hard disk controller. In the embodiment of the invention, the hard disk controller refers to PCI (PERIPHERAL COMPONENT INTERCONNECT, external device interconnection) equipment, and the hard disk interface is generally a SATA (SERIAL ADVANCED Technology Attachment ) slot. When PCI scanning is carried out, the hard disk controller is searched, and the hard disk controller can judge whether a corresponding hard disk interface has a hard disk or not. In addition, different hard disk slots have different priorities, and correspondingly, different hard disk controllers and inserted different hard disks also have different starting priorities, and when one hard disk is inserted into one hard disk slot with low priority, the starting priority of the hard disk is also low.
Firmware, i.e., software that is solidified in hardware, is used to boot the operation of the hardware. In practical applications, because of various technical limitations or commercial reasons, hardware manufacturers want their own hardware to be used by more software manufacturers, and thus some packaging is needed on top of the hardware to make their own hardware easier to handle, firmware is needed at this time, which can simplify the interaction of software (e.g., an operating system) with the hardware. Common firmware is a BIOS (Basic Input Output System ) program, etc.
The kernel is an internal kernel program of the operating system, which provides core management call to the computer to enable the user to operate in the interface of the operating system.
In the prior art, if other hard disks are newly inserted in the processor board except for the system disk, the system disk and the other hard disks each contain an operating system program, which represents that at least two operating systems exist in the computer currently, and when the user starts the computer, the user 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 computer generally logic starts 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 the PCI (or called PCI device scanning), and the PCI scanning is performed according to the priority of the hard disk controller, so that the first hard disk controller scanned by the PCI, that is, the hard disk controller with the highest priority at present.
However, in practical applications, the insertion or removal of a new hard disk by hot plug or non-hot plug may cause a change in the identifier of the original hard disk, that is, the identifier of the hard disk may be redistributed along with the insertion position or the insertion sequence of each hard disk. For example, the identifier a indicates that the hard disk with the highest priority, that is, the hard disk corresponding to the first hard disk controller performing the PCI scan, the identifier of the original system disk is a before inserting or removing the new hard disk, and the identifier of the original system disk may be B after inserting or removing the new hard disk, and the identifier a may correspond to the new hard disk P at this time, so that the new hard disk P becomes the hard disk corresponding to the first hard disk controller being scanned when performing the PCI scan according to the identifier a.
However, since it is possible to manually specify which of the hard disks corresponds to the boot file to be read, it is possible to specify that the computer reads the boot file of the original system disk, but not the boot file of the new hard disk P, regardless of the scanning order of the PCI scan, so that the computer can read the correct boot file. However, since the boot file of the original system disk only considers that only one hard disk exists during writing, in the boot option of the boot file, the disk identifier of the original system disk is written as the disk identifier a, that is, the parameter in the boot file indicating which hard disk the firmware loads the kernel from is the disk identifier a, and the parameter indicating which hard disk the kernel starts the operating system corresponding to is the disk identifier a. However, since the drive letter a already corresponds to the new hard disk P, this will cause the computer to load the corresponding kernel from the new hard disk P according to the 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 transmit the parameters indicating which hard disk the kernel starts the operating system corresponding to, namely the 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 the drive letter a.
Of course, the above procedure and principle explanation are equally applicable to the case where the user wants to boot an operating system corresponding to a hard disk whose current priority is not the highest, and hereinafter the hard disk whose current priority is not the highest that the user wants to boot is referred to as a target hard disk.
One of the core ideas of the embodiments of the present invention is that, by using a target variable, the controller information corresponding to the target hard disk that the user wants to start is pre-stored in the firmware, so that the firmware can read the target variable during operation, and according to the target variable, the scan sequence of the hard disk controller when the firmware performs PCI scan is adjusted, so that the target controller corresponding to the controller information stored in the target variable is used as the first scanned controller, that is, the target controller corresponding to the target hard disk is used as the first scanned controller, so that the kernel corresponding to the target hard disk can be loaded and started after the firmware, that is, the kernel can be started to the correct kernel. In addition, the firmware can also transmit the identification information of the target controller to the kernel to be started before the kernel is started. Since the target controller corresponds to the hard disk slot, the target controller does not change with the newly inserted hard disk, and the hard disk managed by the target controller does not change with the newly inserted hard disk, and is always the target hard disk, the correct target hard disk can be uniquely determined by storing the identification information that can determine the target controller in the firmware in advance. The kernel can start up a correct operating system (an operating system corresponding to the target hard disk) according to the identification information of the target controller stored in advance by the firmware. Thus, the electronic device can start the correct kernel, and further can start the correct operating system.
It should be noted that, the operating system starting method provided by the embodiment of the invention can be suitable for adding a new hard disk on a processor board card of a MIPS (Microprocessor without interlocked PIPED STAGES, microprocessor without internal interlocking pipeline level) architecture, or removing a hard disk when a plurality of hard disks exist, and can be applied to an electronic device of a processor of a MIPS architecture as a CPU (Central Processing Unit ).
Referring to fig. 1, a flowchart illustrating steps of an embodiment of an operating system boot method of the present invention may specifically include the following steps:
step 101, running firmware.
In the embodiment of the invention, under the condition that a new hard disk is inserted or removed from the processor board card (at least two hard disks are inserted into the processing board card before removal), a user can store the controller information of a target controller corresponding to the target hard disk to be started in firmware through a target variable, specifically, the assigned value of the target variable is the controller information.
After that, when the electronic device is powered up again, firmware in the electronic device may start up and run. In general, after the firmware runs, the CPU, the bridge, the PCI device, the interrupt, etc. are initialized, where the PCI device is a device accessed through a PCI interface, for example, each hard disk in the embodiment of the present invention. The firmware initializes the PCI device in the middle and late stages of the initialization, wherein the PCI scanning step comprises the step of PCI scanning, namely loading the drive corresponding to the accessed PCI device, and each piece of software in the electronic device controls the PCI device through the drive.
And 102, reading a pre-stored target variable through the firmware, wherein the target variable is used for indicating the controller information of a target controller corresponding to the target hard disk.
In the embodiment of the invention, before the firmware performs PCI scanning, the firmware can read a pre-stored target variable to obtain the value of the target variable, namely the controller information of the target controller corresponding to the target hard disk, namely the firmware can obtain the controller information corresponding to the target hard disk which the user wants to start from the target variable.
And step 103, when the first external equipment interconnection scanning is performed through the firmware, the target controller indicated by the target variable is used as a first hard disk controller for scanning.
In the embodiment of the present invention, the first PCI (peripheral component interconnect) scan, that is, the PCI scan performed by the firmware, may find, from among the hard disk controllers to be scanned, the target controller corresponding to the target hard disk according to the controller information stored in the target variable when the firmware performs the first PCI scan, that is, the first PCI scan, and adjust the scan order of the hard disk controllers, and set the target controller as the first scanned hard disk controller for scanning.
And 104, transmitting the identification information of the target controller to the kernel to be started through the firmware.
In the embodiment of the invention, when the kernel starts the operating system, the firmware needs to start the system according to the parameter which is transmitted by the firmware and is used for indicating which hard disk is started, so that before the kernel starts, the firmware can transmit the identification information of the target controller to the kernel to be started.
And 105, loading and starting the kernel corresponding to the target hard disk through the firmware.
In the embodiment of the 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 is the kernel of the hard disk corresponding to the first controller for performing the PCI scan, when the target controller corresponding to the target hard disk is used as the first bit of the firmware PCI scan, the firmware can load and start the kernel corresponding to the target hard disk by default, that is, can start the correct kernel.
And step 106, starting an operating system corresponding to the target hard disk through the kernel according to the identification information.
In the embodiment of the invention, the identification information of the target controller corresponding to the target hard disk is transmitted to the kernel corresponding to the target hard disk by the firmware, so that after the kernel corresponding to the target hard disk is started, the operating system to be started is determined to be the operating system corresponding to the target hard disk according to the identification information, and the correct operating system can be started.
In the embodiment of the invention, under the condition that the firmware runs, the firmware can read a pre-stored target variable, wherein the target variable is used for indicating the controller information of a target controller corresponding to a target hard disk which a user wants to start. When the firmware performs the process of interconnection scanning to the first external device, the target controller indicated by the target variable can be used as a first hard disk controller for scanning, so that the kernel corresponding to the target hard disk can be loaded and started after the firmware, namely, the kernel can be started to the correct kernel required by the user. In addition, the firmware can also transmit the identification information of the target controller to the kernel to be started before starting the kernel, and the kernel can start the operating system corresponding to the target hard disk according to the identification information. Thus, the electronic device can start the correct kernel required by the user, and further can start the correct operating system required by the user.
Referring to FIG. 2, a flowchart illustrating steps of another embodiment of an operating system boot method of the present invention may specifically include the steps of:
in step 201, the firmware is started and run in case of inserting or removing a new hard disk on the processor board.
In the embodiment of the invention, after a user inserts a new hard disk into a processor board card or removes the new hard disk, the electronic device starts and runs the firmware first time when the electronic device is started for the first time.
Step 202, when receiving a selection instruction of the target hard disk through the firmware, obtaining controller information of a target controller corresponding to the target hard disk.
In the embodiment of the invention, after the firmware is operated, a hard disk selection interface can be displayed, and a user can select a target hard disk to be started in the hard disk selection interface, so that the firmware can receive a selection instruction of the target hard disk. After one hard disk is mounted on the PCI bus, the electronic device can acquire the controller information of the hard disk controller corresponding to the hard disk, so that when the firmware receives a selection instruction of a target hard disk, the firmware can acquire the controller information of the target controller corresponding to the target hard disk accessed to the bus.
In practical applications, optionally, the controller information may include a bus number, a device number, and a function number of the target controller corresponding to the target hard disk. In general, there are 256 PCI buses, each of which can be configured with 32 multifunction devices, and each of which can be equipped with 8 function sub-devices, so that a hard disk controller can be uniquely identified by a bus number, a device number, and a function number, and accordingly, a hard disk can be uniquely determined.
And 203, saving the controller information to the target variable, wherein the target variable is used for indicating the controller information of a target controller corresponding to the target hard disk.
In the embodiment of the invention, the controller information of the target controller corresponding to the target hard disk to be started can be stored in the firmware through a preset target variable, specifically, the value of the target variable can be assigned, and the assigned value is the controller information.
Step 204, restarting the firmware to validate the saved controller information.
In the embodiment of the invention, after the controller information is stored to the target variable, in order to enable the assigned value to be effective, the electronic equipment can be restarted, so that the firmware can be restarted correspondingly, after the restart, the controller information stored by the target variable can be effective, and under the condition that the accessed hard disk is unchanged, the controller information stored by the target variable is effective after each time of starting.
Step 205, running firmware.
In the embodiment of the invention, after restarting the firmware, the firmware can start to run.
Step 206, reading a pre-stored target variable through the firmware.
For the specific implementation of this step, reference may be made to step 102, which is not described herein.
Step 207, when the first external device interconnection scanning is performed through the firmware, the target controller indicated by the target variable is used as a first hard disk controller of the scanning to perform scanning.
In the embodiment of the invention, the method can be realized by the following steps that when the first external equipment interconnection scanning is performed through the firmware, the target controller indicated by the target variable is exchanged with the scanning sequence of the first hard disk controller in a first preset scanning sequence, and the target controller indicated by the target variable is used as the first hard disk controller of the first external equipment interconnection scanning and is scanned through the firmware.
The first PCI scan, that is, the PCI scan process executed by the firmware, is performed by the firmware, where the original sequence of the first PCI scan is a first preset scan sequence, and in the first preset scan sequence, the first scanned hard disk controller is not necessarily the target controller corresponding to the target hard disk, so that when the firmware proceeds to the first PCI scan, the firmware can exchange the scan sequence of the target controller indicated by the target variable with the first hard disk controller in the first preset scan sequence, so that the target controller can be set as the first scanned hard disk controller corresponding to the first PCI scan process.
It should be noted that, the first scanned is for all hard disk controllers, not for all controllers, that is, after the scan sequence is adjusted, the target controller is the first scanned of all hard disk controllers, and in all controllers including the hard disk controller, the target controller is not necessarily the first scanned.
And step 208, transmitting the identification information of the target controller to the kernel to be started through the firmware.
In the embodiment of the present invention, after the kernel is started, a PCI scan is performed, that is, a second PCI scan, that is, a PCI scan process performed by the kernel, and an original sequence in which the kernel performs the second PCI scan is a second preset scan sequence. Generally, the second preset scan order is the same as the first preset scan order.
In the prior art, the firmware may transmit a first parameter of an operating system for indicating which hard disk the kernel starts to the kernel to be started, so that the kernel may start the corresponding operating system according to the first parameter, but since the boot file of each hard disk is not changed in the case of inserting or removing a new hard disk, the hard disk indicated by the first parameter is not the hard disk indicated before inserting or removing the new hard disk, and therefore, the kernel may start the wrong operating system according to the first parameter. Only the scanning sequence of the target controller and the original first hard disk controller is exchanged, so that the scanning change amplitude is minimized, and other hard disk controllers and other non-hard disk controllers are prevented from being influenced.
Therefore, in an alternative implementation manner, when the identification information includes the ranking of the target controller in the second preset scanning sequence, the method can be implemented by replacing a first parameter with the ranking of the target controller in the second preset scanning sequence through the firmware, wherein the first parameter is used for indicating a hard disk controller corresponding to a hard disk where an operating system to be started is located, and the replaced first parameter is transmitted to a kernel to be started through the firmware.
That is, the firmware may replace the first parameter analyzed in the boot file with the ranking of the target controller in the second preset scanning sequence, and then the firmware may transfer the replaced first parameter to the kernel to be started, so that the kernel may determine, after the second PCI scanning, the target controller from the scanned hard disk controller according to the first parameter, and the kernel may start the operating system of the target controller for the target hard disk. In practical applications, the ranking of the target controller in the second preset scanning sequence may be represented by the current drive of the target hard disk, that is, the identification information may be the current drive of the target hard disk.
In another alternative implementation manner, when the identification information includes the controller information, the step may be implemented by using the controller information as a second parameter, and transmitting the second parameter to a kernel to be started through the firmware, where the second parameter is different from the first parameter in attribute.
That is, the second parameter is different from the first parameter, and the second parameter may 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 may transmit the controller information of the target controller as a second parameter to the kernel to be started. In actual use, in one implementation, the processing logic of the firmware may be modified to pass both the first parameter and the second parameter, but the processing logic of the kernel may be modified to boot the operating system based only on the second parameter. In another implementation, the processing logic of the firmware may be modified to pass only the second parameter, but not the first parameter, and the processing logic of the kernel may be modified to boot the operating system according to the second parameter, which is not specifically limited in the embodiments of the present invention.
After the firmware starts the kernel, the subsequent process is taken over by the kernel, so that the firmware needs to prepare parameters to be transferred to the kernel to be started through a parameter transfer instruction before starting the kernel, so that the kernel started later obtains the parameters through the parameter transfer instruction. Because the mechanism of the firmware for starting the kernel is to start the kernel of the hard disk corresponding to the first hard disk controller of the PCI scanning, in the embodiment of the invention, the first hard disk controller of the PCI scanning is the target controller corresponding to the target hard disk, so that after the firmware transfers the parameters required by the kernel, the kernel corresponding to the target hard disk can be started, and the transferred parameters are also acquired by the kernel correspondingly.
Step 209, loading and starting the kernel corresponding to the target hard disk through the firmware.
In the embodiment of the 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 is the kernel of the hard disk corresponding to the first controller for performing the PCI scan, when the target controller corresponding to the target hard disk is used as the first bit of the firmware PCI scan, the firmware can load and start the kernel corresponding to the target hard disk by default, that is, can start the correct kernel.
Step 210, starting an operating system corresponding to the target hard disk through the kernel according to the identification information.
In the embodiment of the present invention, corresponding to the two implementation manners in step 209, this step may also be implemented in two manners.
In an alternative implementation manner, when the identification information includes the ranking of the target controller in a second preset scanning sequence, the method includes the steps of performing second external equipment interconnection scanning according to the second preset scanning sequence through the kernel, selecting the target controller from scanned hard disk controllers through the kernel according to the ranking of the target controller in the second preset scanning sequence, determining the target hard disk corresponding to the target controller, and starting an operating system corresponding to the target hard disk through the kernel.
When the identification information includes the ranking of the target controller in the second preset scanning sequence, the kernel can still perform the second PCI scanning according to the original second preset scanning sequence, after the kernel scanning is completed, the kernel can select the target controller from all scanned hard disk controllers according to the ranking of the target controller in the second preset scanning sequence, and then determine the target hard disk corresponding to the target controller, and the kernel can start the operating system corresponding to the target hard disk.
In another optional implementation manner, when the identification information includes the controller information, the method includes exchanging the target controller corresponding to the controller information with a scanning sequence of a first hard disk controller in a second preset scanning sequence when the kernel performs interconnection scanning to a second external device, using the target controller corresponding to the controller information as the first hard disk controller of the interconnection scanning of the second external device, scanning the first hard disk controller through the kernel, and starting an operating system corresponding to the target hard disk corresponding to the first hard disk controller of the interconnection scanning of the second external device through the kernel.
When the identification information includes the controller information, the kernel may not scan according to the original second preset scan sequence, but may adjust the second preset scan sequence according to the controller information of the target controller when proceeding to the PCI scan process. That is, the target controller corresponding to the controller information is exchanged with the scanning sequence of the first hard disk controller in the second preset scanning sequence, so that the target controller can be set as the first scanned hard disk controller corresponding to the second PCI scanning process. Then, the kernel can directly start the operating system of the hard disk corresponding to the first scanned hard disk controller, and the kernel starts the system corresponding to the target hard disk because the first scanned hard disk controller is the controller corresponding to the target hard disk.
In addition, the embodiment of the invention also provides a method for starting the operating system corresponding to the system disk on board after the hard disk is added or deleted, namely, the system disk can be mounted on the hard disk controller with the highest priority, namely, the hard disk controller which can be scanned first in the design stage of the processor board, so that 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.
However, when the processor board is not designed according to the method, or after the processor board is designed according to the method, the user changes the default starting system disk, the system starting method of the operating system provided by the embodiment of the invention can be applied to start the system, so that the electronic equipment can still start the correct kernel, and further start the correct operating system.
In the embodiment of the invention, under the condition that the firmware runs, the firmware can read a pre-stored target variable, wherein the target variable is used for indicating the controller information of a target controller corresponding to a target hard disk which a user wants to start. When the firmware performs the process of interconnection scanning to the first external device, the target controller indicated by the target variable can be used as a first hard disk controller for scanning, so that the kernel corresponding to the target hard disk can be loaded and started after the firmware, namely, the kernel can be started to the correct kernel required by the user. In addition, the firmware can also transmit the identification information of the target controller to the kernel to be started before starting the kernel, and the kernel can start the operating system corresponding to the target hard disk according to the identification information. Thus, the electronic device can start the correct kernel required by the user, and further can start the correct operating system required by the user.
It should be noted that, for simplicity of description, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred embodiments, and that the acts are not necessarily required by the embodiments of the invention.
Referring to FIG. 3, which illustrates a block diagram of an embodiment of an operating system boot device of the present invention, the device 300 may include the following modules:
An operation module 301, configured to operate firmware;
the reading module 302 is configured to read a pre-stored target variable through the firmware, where the target variable is used to indicate controller information of a target controller corresponding to a target hard disk;
A scanning module 303, configured to scan, when performing interconnection scanning to a first external device through the firmware, the target controller indicated by the target variable as a first hard disk controller of the scanning;
the parameter transmission module 304 is configured to transmit, by using the firmware, identification information of the target controller to a kernel to be started;
the kernel starting module 305 is configured to load and start a kernel corresponding to the target hard disk through the firmware;
And the system starting module 306 is configured to start, according to the identification information, an operating system corresponding to the target hard disk through the kernel.
Optionally, the scanning module includes:
The first interchange sub-module is used for interchanging the scanning sequence of the target controller indicated by the target variable and the first hard disk controller in a first preset scanning sequence when the firmware performs interconnection scanning to the first external device;
And the first scanning sub-module is used for taking the target controller indicated by the target variable as a first hard disk controller for interconnection scanning of the first external equipment and scanning through the firmware.
Optionally, when the identification information includes a ranking of the target controller in a second preset scanning order, the parameter transferring module includes:
The replacing sub-module is used for replacing a first parameter with the arrangement of the target controller in a second preset scanning sequence through the firmware, wherein the first parameter is used for indicating a hard disk controller corresponding to a hard disk where an operating system to be started is located;
The first parameter transmission sub-module is used for transmitting the replaced first parameter to the kernel to be started through the firmware;
The system start module comprises:
The second scanning submodule is used for carrying out interconnection scanning of second external equipment through the kernel according to the second preset scanning sequence;
The selecting sub-module is used for selecting the target controller from scanned hard disk controllers through the kernel according to the arrangement of the target controller in the second preset scanning sequence;
the determining submodule is used for determining the target hard disk corresponding to the target controller;
and the first promoter module is used for starting an operating system corresponding to the target hard disk through the kernel.
Optionally, when the identification information includes the controller information, the parameter transmission module includes:
The second parameter transmission sub-module is used for transmitting the controller information to the kernel to be started through the firmware, wherein the second parameter is different from the first parameter in attribute;
The system start module comprises:
The second interchange sub-module is used for interchanging the scanning sequence of the target controller corresponding to the controller information and the first hard disk controller in a second preset scanning sequence when the interconnection scanning is carried out from the inner core to the second external equipment;
The third scanning sub-module is used for taking the target controller corresponding to the controller information as a first hard disk controller for interconnection scanning of the second external equipment and scanning through the kernel;
and the second starting sub-module is used for starting an operating system corresponding to the target hard disk corresponding to the first hard disk controller of the interconnection scanning of the second external equipment through the kernel.
Optionally, the apparatus further comprises:
The firmware starting module is used for starting and running the firmware under the condition that a new hard disk is inserted into or removed from the processor board card;
the acquisition module is used for acquiring the controller information of the target controller corresponding to the target hard disk when receiving the selection instruction of the target hard disk through the firmware;
The storage module is used for storing the controller information to the target variable;
And the firmware restarting module is used for restarting the firmware so as to enable the saved controller information to be effective.
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.
In the embodiment of the invention, under the condition that the firmware runs, the firmware can read a pre-stored target variable, wherein the target variable is used for indicating the controller information of a target controller corresponding to a target hard disk which a user wants to start. When the firmware performs the process of interconnection scanning to the first external device, the target controller indicated by the target variable can be used as a first hard disk controller for scanning, so that the kernel corresponding to the target hard disk can be loaded and started after the firmware, namely, the kernel can be started to the correct kernel required by the user. In addition, the firmware can also transmit the identification information of the target controller to the kernel to be started before starting the kernel, and the kernel can start the operating system corresponding to the target hard disk according to the identification information. Thus, the electronic device can start the correct kernel required by the user, and further can start the correct operating system required by the user.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
Fig. 4 is a block diagram illustrating a configuration of an electronic device 400 for booting an operating system, according to an example embodiment. For example, electronic device 400 may be a mobile phone, computer, digital broadcast terminal, messaging device, game console, tablet device, medical device, exercise device, personal digital assistant, or the like.
Referring to FIG. 4, an electronic device 400 may include one or more of a processing component 402, a memory 404, a power supply 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.
The processing component 402 generally controls overall operation of the electronic device 400, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing element 402 may include one or more processors 420 to execute instructions to perform all or part of the steps of the methods described above. Further, the processing component 402 can include one or more modules that facilitate interaction between the processing component 402 and other components. For example, the processing component 402 may include a multimedia module to facilitate interaction between the multimedia component 408 and the processing component 402.
Memory 404 is configured to store various types of data to support operations at device 400. Examples of such data include instructions for any application or method operating on electronic device 400, contact data, phonebook data, messages, pictures, videos, and the like. The memory 404 may be implemented by any type or combination of volatile or nonvolatile memory devices 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 or optical disk.
The power supply component 406 provides power to the various components of the electronic device 400. The power components 406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 400.
The multimedia component 408 includes a screen between the electronic device 400 and the user that provides an output interface. 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 a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or slide action, but also 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 operational mode, such as a shooting mode or a video mode, the front-facing camera and/or the rear-facing camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
The audio component 410 is configured to output and/or input audio signals. For example, the audio component 410 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 400 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may be further stored in the memory 404 or transmitted via the communication component 416. In some embodiments, audio component 410 further includes a speaker for outputting audio signals.
The I/O interface 412 provides an interface between the processing component 402 and peripheral interface modules, which may be a keyboard, click wheel, buttons, etc. These buttons may include, but are not limited to, a home button, a volume button, an activate button, and a lock button.
The sensor assembly 414 includes one or more sensors for providing status assessment of various aspects of the electronic device 400. For example, the sensor assembly 414 may detect an on/off state of the device 400, a relative positioning of components, such as a display and keypad of the electronic device 400, a change in position of the electronic device 400 or a component of the electronic device 400, the presence or absence of a user's contact with the electronic device 400, an orientation or acceleration/deceleration of the electronic device 400, and a change in temperature of the electronic device 400. The sensor assembly 414 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact. The sensor assembly 414 may also include a light 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 gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 416 is configured to facilitate communication between the electronic device 400 and other devices, either wired or wireless. The electronic device 400 may access a wireless network based on a communication standard, such as WiFi,2G, or 3G, or a combination thereof. In one exemplary embodiment, the communication component 416 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 416 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
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 elements for executing the methods described above.
In an exemplary embodiment, a non-transitory computer-readable storage medium is also provided, such as memory 404, that includes instructions executable by processor 420 of electronic device 400 to perform the above-described method. For example, the non-transitory computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
A non-transitory computer readable storage medium, which when executed by a processor of an electronic device, causes the electronic device to perform a method of operating system booting, the method comprising:
Running firmware;
The firmware reads a pre-stored target variable, wherein the target variable is used for indicating the controller information of a target controller corresponding to a target hard disk;
when the firmware scans interconnection to a first external device, the target controller indicated by the target variable is used as a first hard disk controller for scanning;
Transmitting the identification information of the target controller to a kernel to be started through the firmware;
loading and starting a kernel corresponding to the target hard disk through the firmware;
and starting an operating system corresponding to the target hard disk through the kernel according to the identification information.
Optionally, the scanning, as the first hard disk controller of the scanning, the target controller indicated by the target variable when the scanning is performed to the first external device interconnection through the firmware includes:
When the firmware performs interconnection scanning to a first external device, exchanging the scanning sequence of the target controller indicated by the target variable with the scanning sequence of the first hard disk controller in a first preset scanning sequence;
And taking the target controller indicated by the target variable as a first hard disk controller for interconnection scanning of the first external equipment, and scanning through the firmware.
Optionally, when the identification information includes a ranking of the target controller in a second preset scan sequence, the transmitting, by the firmware, the identification information of the target controller to the kernel to be started includes:
The firmware replaces a first parameter with the ranking of the target controller in a second preset scanning sequence, wherein the first parameter is used for indicating a hard disk controller corresponding to a hard disk where an operating system to be started is located;
Transmitting the replaced first parameter to a kernel to be started through the firmware;
and starting an operating system corresponding to the target hard disk through the kernel according to the identification information, wherein the operating system comprises:
Performing a second external device interconnection scan by the kernel according to the second preset scan order;
selecting the target controller from scanned hard disk controllers through the kernel according to the arrangement of the target controller in the second preset scanning sequence;
Determining the target hard disk corresponding to the target controller;
and starting an operating system corresponding to the target hard disk through the kernel.
Optionally, when the identification information includes the controller information, the transmitting, by the firmware, the identification information of the target controller to a kernel to be started includes:
The controller information is used as a second parameter, and the second parameter is transmitted to a kernel to be started through the firmware, wherein the second parameter is different from the first parameter in attribute;
and starting an operating system corresponding to the target hard disk through the kernel according to the identification information, wherein the operating system comprises:
When the interconnection scanning is carried out to the second external equipment through the kernel, the target controller corresponding to the controller information is exchanged with the scanning sequence of the first hard disk controller in a second preset scanning sequence;
the target controller corresponding to the controller information is used as a first hard disk controller for interconnection scanning of the second external equipment, and scanning is carried out through the kernel;
And starting an operating system corresponding to the target hard disk corresponding to the first hard disk controller of the second external equipment interconnection scanning through the kernel.
Optionally, before the running firmware, the method further includes:
under the condition that a new hard disk is inserted into or removed from the processor board card, starting and operating the firmware;
When receiving a selection instruction of the target hard disk through the firmware, acquiring controller information of a target controller corresponding to the target hard disk;
saving the controller information to the target variable;
Restarting the firmware to validate the saved controller information.
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.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
It will be apparent to those skilled in the art that embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the invention may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article or terminal device comprising the element.
The foregoing describes in detail a method and apparatus for starting an operating system, an electronic device and a storage medium, wherein specific examples are provided herein to illustrate the principles and embodiments of the present invention, and the above examples are provided to assist in understanding the method and core ideas of the present invention, and meanwhile, to those skilled in the art, there are variations in the specific embodiments and application scope according to the ideas of the present invention, so the disclosure should not be construed as limiting the present invention.

Claims (14)

1. An operating system boot method, comprising:
Running firmware;
The firmware reads a pre-stored target variable, wherein the target variable is used for indicating the controller information of a target controller corresponding to a target hard disk;
when the firmware scans interconnection to a first external device, the target controller indicated by the target variable is used as a first hard disk controller for scanning;
Transmitting the identification information of the target controller to a kernel to be started through the firmware;
loading and starting a kernel corresponding to the target hard disk through the firmware;
and starting an operating system corresponding to the target hard disk through the kernel according to the identification information.
2. The method of claim 1, wherein the scanning the target controller indicated by the target variable as a scanned head hard disk controller while the scanning is performed to a first external device interconnect by the firmware, comprises:
When the firmware performs interconnection scanning to a first external device, exchanging the scanning sequence of the target controller indicated by the target variable with the scanning sequence of the first hard disk controller in a first preset scanning sequence;
And taking the target controller indicated by the target variable as a first hard disk controller for interconnection scanning of the first external equipment, and scanning through the firmware.
3. The method of claim 1, wherein when the identification information includes a ranking of the target controller in a second preset scan order, the communicating, by the firmware, the identification information of the target controller to a kernel to be booted includes:
The firmware replaces a first parameter with the ranking of the target controller in a second preset scanning sequence, wherein the first parameter is used for indicating a hard disk controller corresponding to a hard disk where an operating system to be started is located;
Transmitting the replaced first parameter to a kernel to be started through the firmware;
and starting an operating system corresponding to the target hard disk through the kernel according to the identification information, wherein the operating system comprises:
Performing a second external device interconnection scan by the kernel according to the second preset scan order;
selecting the target controller from scanned hard disk controllers through the kernel according to the arrangement of the target controller in the second preset scanning sequence;
Determining the target hard disk corresponding to the target controller;
and starting an operating system corresponding to the target hard disk through the kernel.
4. The method of claim 3, wherein when the identification information includes the controller information, the passing, by the firmware, the identification information of the target controller to a kernel to be booted includes:
The controller information is used as a second parameter, and the second parameter is transmitted to a kernel to be started through the firmware, wherein the second parameter is different from the first parameter in attribute;
and starting an operating system corresponding to the target hard disk through the kernel according to the identification information, wherein the operating system comprises:
When the interconnection scanning is carried out to the second external equipment through the kernel, the target controller corresponding to the controller information is exchanged with the scanning sequence of the first hard disk controller in a second preset scanning sequence;
the target controller corresponding to the controller information is used as a first hard disk controller for interconnection scanning of the second external equipment, and scanning is carried out through the kernel;
And starting an operating system corresponding to the target hard disk corresponding to the first hard disk controller of the second external equipment interconnection scanning through the kernel.
5. The method of claim 1, wherein prior to running the firmware, further comprising:
under the condition that a new hard disk is inserted into or removed from the processor board card, starting and operating the firmware;
When receiving a selection instruction of the target hard disk through the firmware, acquiring controller information of a target controller corresponding to the target hard disk;
saving the controller information to the target variable;
Restarting the firmware to validate the saved controller information.
6. The method of any of claims 1-5, wherein the controller information includes a bus number, a device number, and a function number of the target controller corresponding to the target hard disk.
7. An operating system boot device, comprising:
The operation module is used for operating the firmware;
the reading module is used for reading a pre-stored target variable through the firmware, wherein the target variable is used for indicating the controller information of a target controller corresponding to a target hard disk;
The scanning module is used for scanning the target controller indicated by the target variable as a first hard disk controller of scanning when the first external equipment interconnection scanning is performed through the firmware;
the parameter transmission module is used for transmitting the identification information of the target controller to the kernel to be started through the firmware;
The kernel starting module is used for loading and starting the kernel corresponding to the target hard disk through the firmware;
and the system starting module is used for starting the operating system corresponding to the target hard disk through the kernel according to the identification information.
8. The apparatus of claim 7, wherein the scanning module comprises:
The first interchange sub-module is used for interchanging the scanning sequence of the target controller indicated by the target variable and the first hard disk controller in a first preset scanning sequence when the firmware performs interconnection scanning to the first external device;
And the first scanning sub-module is used for taking the target controller indicated by the target variable as a first hard disk controller for interconnection scanning of the first external equipment and scanning through the firmware.
9. The apparatus of claim 7, wherein when the identification information includes a ranking of the target controller in a second preset scan order, the parameter-transferring module comprises:
The replacing sub-module is used for replacing a first parameter with the arrangement of the target controller in a second preset scanning sequence through the firmware, wherein the first parameter is used for indicating a hard disk controller corresponding to a hard disk where an operating system to be started is located;
The first parameter transmission sub-module is used for transmitting the replaced first parameter to the kernel to be started through the firmware;
The system start module comprises:
The second scanning submodule is used for carrying out interconnection scanning of second external equipment through the kernel according to the second preset scanning sequence;
The selecting sub-module is used for selecting the target controller from scanned hard disk controllers through the kernel according to the arrangement of the target controller in the second preset scanning sequence;
the determining submodule is used for determining the target hard disk corresponding to the target controller;
and the first promoter module is used for starting an operating system corresponding to the target hard disk through the kernel.
10. The apparatus of claim 9, wherein when the identification information includes the controller information, the parameter transmission module comprises:
The second parameter transmission sub-module is used for transmitting the controller information to the kernel to be started through the firmware, wherein the second parameter is different from the first parameter in attribute;
The system start module comprises:
The second interchange sub-module is used for interchanging the scanning sequence of the target controller corresponding to the controller information and the first hard disk controller in a second preset scanning sequence when the interconnection scanning is carried out from the inner core to the second external equipment;
The third scanning sub-module is used for taking the target controller corresponding to the controller information as a first hard disk controller for interconnection scanning of the second external equipment and scanning through the kernel;
and the second starting sub-module is used for starting an operating system corresponding to the target hard disk corresponding to the first hard disk controller of the interconnection scanning of the second external equipment through the kernel.
11. The apparatus of claim 7, wherein the apparatus further comprises:
The firmware starting module is used for starting and running the firmware under the condition that a new hard disk is inserted into or removed from the processor board card;
the acquisition module is used for acquiring the controller information of the target controller corresponding to the target hard disk when receiving the selection instruction of the target hard disk through the firmware;
The storage module is used for storing the controller information to the target variable;
And the firmware restarting module is used for restarting the firmware so as to enable the saved controller information to be effective.
12. The apparatus of any of claims 7-11, wherein the controller information includes a bus number, a device number, and a function number of the target controller corresponding to the target hard disk.
13. An electronic device comprising a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by one or more processors, the one or more programs comprising instructions for:
Running firmware;
The firmware reads a pre-stored target variable, wherein the target variable is used for indicating the controller information of a target controller corresponding to a target hard disk;
when the firmware scans interconnection to a first external device, the target controller indicated by the target variable is used as a first hard disk controller for scanning;
Transmitting the identification information of the target controller to a kernel to be started through the firmware;
loading and starting a kernel corresponding to the target hard disk through the firmware;
and starting an operating system corresponding to the target hard disk through the kernel according to the identification information.
14. A readable storage medium, characterized in that instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the operating system boot method according to any one of claims 1-6.
CN202010131076.3A 2020-02-28 2020-02-28 Operating system startup method, device, electronic device and storage medium Active CN113326069B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010131076.3A CN113326069B (en) 2020-02-28 2020-02-28 Operating system startup method, device, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010131076.3A CN113326069B (en) 2020-02-28 2020-02-28 Operating system startup method, device, electronic device and storage medium

Publications (2)

Publication Number Publication Date
CN113326069A CN113326069A (en) 2021-08-31
CN113326069B true CN113326069B (en) 2024-12-24

Family

ID=77412924

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010131076.3A Active CN113326069B (en) 2020-02-28 2020-02-28 Operating system startup method, device, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN113326069B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114020681B (en) * 2021-10-25 2023-11-10 苏州浪潮智能科技有限公司 Method, device and system for distributing logical drive letter, electronic equipment and storage medium
CN114385335B (en) * 2021-12-23 2025-07-04 龙芯中科技术股份有限公司 Method, device, equipment and storage medium for using interrupt resources
CN119473406A (en) * 2024-09-30 2025-02-18 北京智芯微电子科技有限公司 Device initialization method, device, system and electronic device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101364305A (en) * 2007-08-07 2009-02-11 索尼株式会社 Electronic apparatus, motion vector detecting method, and program therefor
CN103246534A (en) * 2013-04-12 2013-08-14 深信服网络科技(深圳)有限公司 Method and device for migrating operating system

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6779016B1 (en) * 1999-08-23 2004-08-17 Terraspring, Inc. Extensible computing system
US8386704B2 (en) * 2006-10-25 2013-02-26 HGST Netherlands B.V. Techniques for improving hard disk drive efficiency
CN102567051B (en) * 2011-12-14 2015-03-25 中标软件有限公司 Method and device for preparing graphical installation system of Loongson platform
CN104572139B (en) * 2013-10-10 2019-01-08 腾讯科技(深圳)有限公司 A kind of method and apparatus of accelerating application starting
CN104199751A (en) * 2014-08-27 2014-12-10 山东超越数控电子有限公司 System identification method of backup redundant hard disk in blade servers
CN109918096A (en) * 2019-03-20 2019-06-21 浪潮商用机器有限公司 Installation method, system and related components of a server operating system
CN110569106B (en) * 2019-08-27 2022-11-15 Oppo广东移动通信有限公司 Code loading method and device, electronic equipment and computer readable medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101364305A (en) * 2007-08-07 2009-02-11 索尼株式会社 Electronic apparatus, motion vector detecting method, and program therefor
CN103246534A (en) * 2013-04-12 2013-08-14 深信服网络科技(深圳)有限公司 Method and device for migrating operating system

Also Published As

Publication number Publication date
CN113326069A (en) 2021-08-31

Similar Documents

Publication Publication Date Title
JP6072362B2 (en) Application program processing method, apparatus, program, and storage medium
EP2991275B1 (en) Making router management application compatible with router firmware
CN113326069B (en) Operating system startup method, device, electronic device and storage medium
US20170150290A1 (en) Method and device for information push
CN111966410B (en) Start-up processing method and device, electronic equipment and storage medium
CN111198706B (en) Method for updating system functions, device for updating system functions and storage medium
EP2818971B1 (en) Electronic device, method for controlling electronic device, and program
CN104281478A (en) Method and device for updating application programs
CN114885322B (en) Switch module, terminal control method and device, equipment and storage medium
US9781198B2 (en) Information processing method and electronic device
CN107169060A (en) Image processing method, device and terminal in terminal
CN112181406B (en) Sharing method and device of rendering engine
CN106547705A (en) USB (universal serial bus) operating mode control method and device
CN107135362A (en) Image quality processing method and device of split TV and split TV
KR20130107844A (en) Apparatus and method for controlling auto focus function in electronic device
CN112083981B (en) Page view component creation method and device
CN110221813B (en) Application data connection establishment method and device, storage medium and electronic equipment
CN117687700A (en) Video memory information processing method, device and storage medium
US20060282658A1 (en) Boot systems and methods and related devices
CN116737329A (en) Interrupt setting method and device, electronic equipment and storage medium
CN116257290A (en) Startup display method and device, electronic equipment and storage medium
CN108334357B (en) Smart terminal flashing method and smart terminal
CN113296720B (en) Display mode switching method and device, electronic equipment and storage medium
CN114115025B (en) Method, device and equipment for storing fault information based on automatic driving system
CN110990068B (en) Display method, display device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant