CN115098170A - Computer booting method, apparatus, device and storage medium - Google Patents
Computer booting method, apparatus, device and storage medium Download PDFInfo
- Publication number
- CN115098170A CN115098170A CN202210541053.9A CN202210541053A CN115098170A CN 115098170 A CN115098170 A CN 115098170A CN 202210541053 A CN202210541053 A CN 202210541053A CN 115098170 A CN115098170 A CN 115098170A
- Authority
- CN
- China
- Prior art keywords
- computer
- stage
- bds
- pei
- boot
- 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.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/4401—Bootstrapping
- G06F9/4406—Loading of operating system
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/4401—Bootstrapping
- G06F9/4403—Processor initialisation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/4401—Bootstrapping
- G06F9/4411—Configuring 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
Description
技术领域technical field
本发明涉及计算机控制领域,尤其涉及一种计算机启动方法、装置、设备以及存储介质。The present invention relates to the field of computer control, and in particular, to a computer startup method, apparatus, device and storage medium.
背景技术Background technique
随着社会的不断发展以及科技水平的不断提高,64位CPU(Central ProcessingUnit,中央处理器)逐渐取代32位CPU,成为硬件市场的主流选择。BIOS(Basic InputOutput System,基本输入输出系统)基于汇编开发的特点使得其与硬件设备的耦合程度较高,这就导致BIOS的升级和扩增异常困难,难以适应64位处理器,无法满足市场需求。With the continuous development of society and the continuous improvement of scientific and technological level, 64-bit CPU (Central Processing Unit, central processing unit) gradually replaces 32-bit CPU and becomes the mainstream choice in the hardware market. The characteristics of BIOS (Basic InputOutput System, basic input output system) based on assembly development make it highly coupled with hardware devices, which makes the upgrade and expansion of BIOS extremely difficult, difficult to adapt to 64-bit processors, and unable to meet market demand .
在这种情况下,UEFI(Unified Extensible Firmware Interface,统一可扩展硬件接口)作为一种新的个人电脑系统规格,提供给系统关于启动服务的接口,并且定义了操作系统与系统固件之间的软件界面,能够改善BIOS对于64位操作系统的限制,已经成为BIOS的替代方案。In this case, UEFI (Unified Extensible Firmware Interface, Unified Extensible Hardware Interface), as a new personal computer system specification, provides the system with an interface for booting services, and defines the software between the operating system and the system firmware. The interface, which can improve the limitation of BIOS for 64-bit operating systems, has become an alternative to BIOS.
目前,UEFI在实现对于计算机启动的控制时,需要通过PEI(Pre-EFIInitialization,EFI前期初始化)阶段和DXE(Driver Execution Environment,驱动执行环境)阶段来加载驱动文件,从而为BDS(Boot Device Select,启动设备选择)阶段做准备。但是,在PEI阶段和DXE阶段,如果系统受到一些干扰输入(有界),就会影响系统在BDS阶段的启动选择时间,从而影响计算机启动的效率。At present, UEFI needs to load the driver file through the PEI (Pre-EFIIinitialization, EFI pre-initialization) stage and the DXE (Driver Execution Environment, driver execution environment) stage when implementing the control of computer startup, so as to be BDS (Boot Device Select, Start the device selection) stage to prepare. However, in the PEI stage and the DXE stage, if the system is subjected to some disturbance input (bounded), it will affect the startup selection time of the system in the BDS stage, thereby affecting the efficiency of computer startup.
因此,有必要提出一种减少UEFI启动时间的计算机启动方法。Therefore, it is necessary to propose a computer booting method that reduces UEFI boot time.
发明内容SUMMARY OF THE INVENTION
本发明的主要目的在于提供一种计算机启动方法、装置、计算机设备以及存储介质,旨在解决UEFI启动时间长的问题。The main purpose of the present invention is to provide a computer booting method, device, computer equipment and storage medium, aiming at solving the problem of long booting time of UEFI.
为实现上述目的,本发明提供一种计算机启动方法,所述计算机启动方法用于控制计算机启动系统,所述计算机启动系统包括:启动设备选择BDS阶段,所述计算机启动方法包括:In order to achieve the above object, the present invention provides a computer startup method, the computer startup method is used to control a computer startup system, the computer startup system includes: a startup device selection BDS stage, and the computer startup method includes:
获取所述BDS阶段的入口函数;Obtain the entry function of the BDS stage;
基于所述入口函数,通过预先设定的柔性控制器对所述BDS阶段进行调节,得到启动设备选择结果;Based on the entry function, the BDS stage is adjusted through a preset flexible controller to obtain a selection result of the starting device;
基于所述启动设备选择结果,加载计算机操作系统。Based on the boot device selection result, a computer operating system is loaded.
可选地,所述基于所述入口函数,通过预先设定的柔性控制器对所述BDS阶段进行调节,得到启动设备选择结果的步骤之前还包括:Optionally, before the step of adjusting the BDS stage through a preset flexible controller based on the entry function, and obtaining the result of starting the device selection, the step further includes:
设计所述柔性控制器,具体包括:Designing the flexible controller specifically includes:
构建连续选择变量;Build continuous selection variables;
基于所述连续选择变量,构建选择策略;constructing a selection strategy based on the continuous selection variable;
基于所述选择策略,设计所述柔性控制器。Based on the selection strategy, the flexible controller is designed.
可选地,所述获取所述BDS阶段的入口函数的步骤包括:Optionally, the step of obtaining the entry function of the BDS stage includes:
基于预先获取的交接块HOB结构列表,对系统驱动进行初始化;Based on the pre-acquired HOB structure list of the handover block, initialize the system driver;
对经过初始化后的系统驱动进行验证,得到验证结果;Verify the system driver after initialization, and get the verification result;
根据所述验证结果,计算得到所述BDS阶段的入口函数。According to the verification result, the entry function of the BDS stage is obtained by calculation.
可选地,所述计算机启动系统为统一可扩展固件接口UEFI系统,所述UEFI系统包括:安全验证SEC阶段、预处理PEI阶段,所述基于预先获取的HOB结构列表,对系统进行初始化的步骤之前还包括:Optionally, the computer booting system is a unified extensible firmware interface UEFI system, and the UEFI system includes: a security verification SEC stage, a preprocessing PEI stage, and the step of initializing the system based on the pre-acquired HOB structure list. Also included before:
构建所述HOB结构列表,具体包括:Build the HOB structure list, specifically including:
获取所述SEC阶段的系统信息;Obtain system information for said SEC phase;
将所述SEC阶段的系统信息传递给所述PEI阶段的入口函数;Pass the system information of the SEC stage to the entry function of the PEI stage;
基于所述PEI阶段的入口函数,执行所述PEI阶段,以构建所述HOB结构列表。Based on the entry function of the PEI stage, the PEI stage is executed to construct the HOB structure list.
可选地,所述基于所述PEI阶段的入口函数,执行所述PEI阶段,以构建所述HOB结构列表的步骤包括:Optionally, the step of executing the PEI stage to construct the HOB structure list based on the entry function of the PEI stage includes:
基于所述入口函数,加载PEI模块文件;Based on the entry function, load the PEI module file;
对所述PEI模块文件进行检索验证,得到所述PEI阶段的验证结果;The PEI module file is retrieved and verified to obtain the verification result of the PEI stage;
基于所述PEI阶段的验证结果,构建所述HOB结构列表。Based on the verification results of the PEI stage, the HOB structure list is constructed.
可选地,所述基于所述启动设备选择结果,加载计算机操作系统的步骤包括:Optionally, the step of loading a computer operating system based on the boot device selection result includes:
基于所述启动设备选择结果,加载计算机驱动程序;Loading a computer driver based on the boot device selection result;
基于所述计算机驱动程序,初始化控制台设备;Based on the computer driver, initialize the console device;
基于初始化的控制台设备,创建引导启动项;Create a boot entry based on the initialized console device;
基于所述引导启动项,加载所述计算机操作系统。Loading the computer operating system based on the booting item.
可选地,所述基于所述引导启动项,加载所述计算机操作系统的步骤包括:Optionally, the step of loading the computer operating system based on the booting item includes:
基于所述引导启动项,为计算机操作系统加载器准备执行环境;Prepare an execution environment for the computer operating system loader based on the booting item;
通过所述计算机操作系统加载器,加载所述计算机操作系统。The computer operating system is loaded by the computer operating system loader.
本发明实施例还提出一种计算机启动装置,所述计算机启动装置包括:An embodiment of the present invention further provides a computer starting device, and the computer starting device includes:
入口函数获取模块,用于获取所述BDS阶段的入口函数;an entry function acquisition module for acquiring the entry function of the BDS stage;
启动设备选择模块,用于基于所述入口函数,通过预先设定的柔性控制器对所述BDS阶段进行调节,得到设备选择结果;Start the device selection module, which is used to adjust the BDS stage through the preset flexible controller based on the entry function to obtain the device selection result;
启动模块,用于基于所述启动设备选择结果,加载计算机操作系统。A booting module, configured to load a computer operating system based on the booting device selection result.
本发明实施例还提出一种计算机设备,所述计算机设备包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机启动程序,所述计算机启动程序被所述处理器执行时实现如上所述的计算机启动方法的步骤。An embodiment of the present invention further provides a computer device, the computer device includes a memory, a processor, and a computer startup program stored on the memory and executable on the processor, the computer startup program being processed by the processor The steps of the computer startup method as described above are implemented when the computer is executed.
本发明实施例还提出一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机启动程序,所述计算机启动程序被处理器执行时实现如上所述的计算机启动方法的步骤。An embodiment of the present invention further provides a computer-readable storage medium, where a computer startup program is stored on the computer-readable storage medium, and when the computer startup program is executed by a processor, the steps of the computer startup method described above are implemented.
本发明实施例提出的计算机启动方法、装置、设备以及存储介质,通过获取BDS阶段的入口函数;基于所述入口函数,通过预先设定的柔性控制器对所述BDS阶段进行调节,得到启动设备选择结果;基于所述启动设备选择结果,加载计算机操作系统。本发明通过预先设计的柔性控制器,对计算机启动过程中的BDS阶段进行控制,能够屏蔽外界干扰输入,有效缩短计算机在BDS阶段的启动时间,进而减少计算机启动过程中所要花费的时间。The computer startup method, device, device and storage medium proposed by the embodiments of the present invention obtain the entry function of the BDS stage; based on the entry function, the BDS stage is adjusted by a preset flexible controller to obtain a startup device A selection result; based on the boot device selection result, a computer operating system is loaded. The invention controls the BDS stage in the computer startup process through the pre-designed flexible controller, which can shield the external interference input, effectively shorten the computer startup time in the BDS stage, and further reduce the time spent in the computer startup process.
附图说明Description of drawings
图1为本发明计算机设备的功能模块示意图;Fig. 1 is the functional module schematic diagram of the computer equipment of the present invention;
图2为本发明计算机启动方法第一实施例的流程示意图;2 is a schematic flowchart of a first embodiment of a computer startup method according to the present invention;
图3为本发明实现计算机启动的过程示意图;3 is a schematic diagram of the process of realizing computer startup according to the present invention;
图4为本发明计算机启动方法第一实施例关于步骤S30的细化流程示意图;FIG. 4 is a schematic flow chart of the refinement of step S30 according to the first embodiment of the computer startup method of the present invention;
图5为本发明计算机启动方法第二实施例的流程示意图;5 is a schematic flowchart of a second embodiment of a computer startup method according to the present invention;
图6为本发明计算机启动方法第三实施例的流程示意图;6 is a schematic flowchart of a third embodiment of a computer startup method according to the present invention;
图7为本发明计算机启动方法第四实施例的流程示意图;7 is a schematic flowchart of a fourth embodiment of a computer startup method according to the present invention;
图8为本发明计算机启动方法第四实施例关于步骤A030的细化流程示意图。FIG. 8 is a detailed flowchart of step A030 according to the fourth embodiment of the computer booting method of the present invention.
本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional characteristics and advantages of the present invention will be further described with reference to the accompanying drawings in conjunction with the embodiments.
具体实施方式Detailed ways
应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。It should be understood that the specific embodiments described herein are only used to explain the present invention, but not to limit the present invention.
本发明实施例的主要解决方案是:获取BDS阶段的入口函数;基于所述入口函数,通过预先设定的柔性控制器对所述BDS阶段进行调节,得到启动设备选择结果;基于所述启动设备选择结果,加载计算机操作系统。本发明预先设计的柔性控制器,能够有效控制BDS阶段进行自适应,从而屏蔽外界干扰输入,有效缩短BDS阶段启动时间,从而有效减少计算机启动时间。The main solutions of the embodiments of the present invention are: obtaining the entry function of the BDS stage; based on the entry function, adjusting the BDS stage through a preset flexible controller to obtain a selection result of a startup device; based on the startup device Select the result to load the computer operating system. The pre-designed flexible controller of the present invention can effectively control the BDS stage to perform self-adaptation, thereby shielding the external interference input, effectively shortening the BDS stage startup time, and thus effectively reducing the computer startup time.
本发明实施例涉及的技术术语:Technical terms involved in the embodiments of the present invention:
BIOS(Basic Input/Output System,基本输入输出系统),是存储子主板ROM(Read-Only Memory,只读存储器)里的一组代码。从按下开机键到进入到操作系统之前的系统初始化动作,即是BIOS run的过程。BIOS程序运行在实模式下,是模式下最大的寻址范围是1MB,0xC0000~0xFFFFF保留给BIOS使用。开机后,CPU跳转到0xFFFF0处执行,一般这里是一条跳转指令,跳转到真正的BIOS入口处执行。BIOS POST阶段执行完后,BIOS会将控制权交给引导程序,最终引导进入操作系统。BIOS (Basic Input/Output System, Basic Input/Output System) is a set of codes stored in the ROM (Read-Only Memory, read-only memory) of the sub-board. The system initialization action from pressing the power button to entering the operating system is the process of BIOS run. The BIOS program runs in real mode, and the maximum addressing range in this mode is 1MB, and 0xC0000 to 0xFFFFF is reserved for BIOS use. After booting, the CPU jumps to 0xFFFF0 for execution. Generally, this is a jump instruction that jumps to the real BIOS entry for execution. After the BIOS POST stage is executed, the BIOS will give control to the boot program, and finally boot into the operating system.
如今操作系统已经从枯燥的文本时代演化到丰富多彩的图形界面,而BIOS却一直延续着枯燥的过程,BIOS设置也一直是单调的蓝底白字格式。BIOS的坚持出于两个原因:其外因是BIOS基本能够满足市场需求;其内因是BIOS的设计使得BIOS的升级和扩增变得非常困难。Nowadays, the operating system has evolved from a boring text era to a colorful graphical interface, but the BIOS has continued the boring process, and the BIOS settings have always been in a monotonous blue-and-white format. The persistence of BIOS is for two reasons: the external reason is that the BIOS can basically meet the market demand; the internal reason is that the design of the BIOS makes it very difficult to upgrade and expand the BIOS.
UEFI(Unified Extensible Firmware Interface,统一可扩展固件接口)是一种个人电脑系统规格,用来定义操作系统与系统固件之间的软件界面,以作为BIOS的替代方案。其中,可扩展固件接口负责加电自检(POST)、联系操作系统以及提供连接操作系统与硬件的接口。UEFI (Unified Extensible Firmware Interface) is a personal computer system specification that defines the software interface between the operating system and system firmware as an alternative to BIOS. Among them, the extensible firmware interface is responsible for power-on self-test (POST), contacting the operating system, and providing an interface to connect the operating system and the hardware.
UEFI的前身是Intel在1998年开始开发的Intel Boot Initiative,后来被重命名为可扩展固件接口(interface,缩写EFI)。Intel在2005年将其交由统一可扩展固件接口论坛来推广与发展,为了凸显这一点,EFI也更名为UEFI(Unified EFI)。UEFI论坛的创始者是11家知名电脑公司,包括Intel、IBM等硬件厂商,软件厂商Microsoft,及BIOS厂商AMI、Insyde及Phoenix。The predecessor of UEFI is the Intel Boot Initiative, which was developed by Intel in 1998, and was later renamed as Extensible Firmware Interface (interface, abbreviated EFI). In 2005, Intel handed it over to the Unified Extensible Firmware Interface Forum for promotion and development. In order to highlight this, EFI was also renamed UEFI (Unified EFI). The founders of UEFI Forum are 11 well-known computer companies, including hardware manufacturers such as Intel and IBM, software manufacturer Microsoft, and BIOS manufacturers AMI, Insyde and Phoenix.
UEFI在概念上非常类似于一个低阶的操作系统,并且具有操控所有硬件资源的能力,因此不少人感觉它的不断发展将有可能代替现代的操作系统。事实上,EFI的缔造者们在第一版规范出台时就将EFI的能力限制于不足以威胁操作系统的统治地位:首先,它只是硬件和预启动软件间的接口规范;其次,UEFI环境下不提供中断的机制,也就是说每个EFI驱动程序必须用轮询(polling)的方式来检查硬件状态,并且需要以解释的方式运行,较操作系统下的机械码驱动效率更低;再则,UEFI系统不提供复杂的缓存器保护功能,它只具备简单的缓存器管理机制,具体来说就是指运行在x64或x86处理器的64位模式或保护模式下,以最大寻址能力为限把缓存器分为一个平坦的段(Segment),所有的程序都有权限访问任何一段位置,并不提供真实的保护服务。当UEFI所有组件加载完毕时,便会启动操作系统的启动程序,如果UEFI固件内置EFI Shell,也可以启动EFI Shell命令提示(部分UEFI固件内置EFI Shell),在这里,用户可以调入执行EFI应用程序,这些EFI程序可以是OEM提供的硬件检测软件,OEM提供的备份软件,引导管理软件,操作系统的启动程序等等,也可以加载EFI分区(ESP)中的EFI驱动程序(如文件系统驱动程序)。EFI应用程序和EFI驱动程序可以是PE格式的.efi文件,可用C语言编写。在UEFI引导模式下,操作系统的启动程序也是EFI应用程序,启动程序的EFI文件存储在EFI系统分区(ESP)上。理论上来说,对于EFI应用程序的功能并没有任何限制,任何人都可以编写这类软件,并且效果较以前MS-DOS下的软件更华丽,功能更强大。一旦引导软件将控制权交给操作系统,所有用于引导的服务代码将全部停止工作,部分运行时,代服务程序还可以继续工作,以便于操作系统一时无法找到特定设备的驱动程序时,该设备还可以继续被使用。UEFI is conceptually very similar to a low-level operating system and has the ability to manipulate all hardware resources, so many people feel that its continuous development will likely replace modern operating systems. In fact, the creators of EFI, when the first version of the specification came out, limited the capabilities of EFI to a point where it was not enough to threaten the dominance of the operating system: first, it was just an interface specification between hardware and pre-boot software; second, in the UEFI environment Does not provide an interrupt mechanism, that is to say, each EFI driver must use polling to check the hardware status, and it needs to run in an interpreted mode, which is less efficient than the mechanical code driver under the operating system; , UEFI system does not provide complex buffer protection function, it only has a simple buffer management mechanism, specifically refers to running in x64 or x86 processor 64-bit mode or protected mode, limited by the maximum addressing capability Divide the buffer into a flat segment (Segment), all programs have permission to access any segment, and do not provide real protection services. When all UEFI components are loaded, the boot program of the operating system will start. If the UEFI firmware has built-in EFI Shell, you can also start the EFI Shell command prompt (some UEFI firmware has built-in EFI Shell). Here, the user can call in to execute the EFI application These EFI programs can be hardware detection software provided by OEM, backup software provided by OEM, boot management software, operating system startup program, etc., or EFI drivers (such as file system drivers) in the EFI partition (ESP) can be loaded. program). EFI applications and EFI drivers can be .efi files in PE format, which can be written in C language. In UEFI boot mode, the startup program of the operating system is also an EFI application, and the EFI file of the startup program is stored on the EFI System Partition (ESP). In theory, there is no limit to the functions of EFI applications, anyone can write this kind of software, and the effect is more gorgeous and more powerful than the previous software under MS-DOS. Once the boot software gives control to the operating system, all the service code used for booting will stop working, and the proxy service program can continue to work when some are running, so that when the operating system cannot find the driver for a specific device temporarily, the The device can continue to be used.
UEFI固件区分架构,在UEFI引导模式下,通常只能运行特定架构的UEFI操作系统和特定架构的EFI应用程序(EBC程序除外)。比如,采用64位UEFI固件的PC,在UEFI引导模式下只能运行64位操作系统启动程序;而在Legacy引导模式(即BIOS兼容引导模式)下,通常不区分操作系统的比特数,既可以运行16位的操作系统(如DOS),也可以运行32位或64位的操作系统,和BIOS一样。UEFI firmware distinguishes between architectures. In UEFI boot mode, only a UEFI operating system of a specific architecture and an EFI application of a specific architecture (except EBC programs) can usually run. For example, a PC with 64-bit UEFI firmware can only run 64-bit operating system startup programs in UEFI boot mode; while in Legacy boot mode (ie, BIOS-compatible boot mode), the number of bits of the operating system is usually not distinguished, either. Run a 16-bit operating system (such as DOS), but also a 32-bit or 64-bit operating system, just like BIOS.
UEFI系统启动遵循UEFI平台初始化标准,分为7个阶段:SEC(Security,安全验证)--PEI(Pre-EFI Initialization,EFI前期初始化)--DXE(Driver ExecutionEnvironment,驱动执行环境)--BDS(Boot Device Select,启动设备选择)--TSL(Transient System Load,操作系统加载前期)--RT(Runtime,运行时)--AL(系统灾难恢复期)。UEFI system startup follows the UEFI platform initialization standard, which is divided into 7 stages: SEC (Security, security verification)--PEI (Pre-EFI Initialization, EFI pre-initialization)--DXE (Driver ExecutionEnvironment, driver execution environment)--BDS ( Boot Device Select, boot device selection)--TSL (Transient System Load, operating system loading early)--RT (Runtime, runtime)--AL (system disaster recovery period).
其中,前三个阶段是UEFI初始化阶段,DXE阶段结束后,UEFI环境已经准备好。BDS和TSL是操作系统加载器作为UEFI应用程序运行阶段,操作系统调用ExitBootServices()服务后进入RT阶段。一般地,在考虑计算机启动问题时,只需关注前四个阶段,即SEC、PRE、DXE、BDS。Among them, the first three stages are the UEFI initialization stage. After the DXE stage, the UEFI environment is ready. BDS and TSL are operating system loader as UEFI application running stage, operating system enters RT stage after calling ExitBootServices() service. Generally, when considering computer startup problems, only the first four stages are concerned, namely SEC, PRE, DXE, and BDS.
本发明实施例考虑到,针对计算机启动这一问题,在实际UEFI开发中,UEFI系统从上电到关机需要经历SEC、PEI、DXE、BDS、TSL、RT、AL这7个漫长的阶段,其中,在PEI阶段和DXE阶段会加载一些驱动文件,并且存储于内存中,是为BDS级阶段做准备。但是,由于加载驱动文件的过程存在不安全性,攻击者可以在PEI和DXE阶段进行干扰,传输一些干扰输入(有界)进而影响BDS阶段,延缓BDS启动选择时间,从而影响计算机整体启动时间。The embodiment of the present invention considers that, for the problem of computer startup, in actual UEFI development, the UEFI system needs to go through 7 long stages of SEC, PEI, DXE, BDS, TSL, RT, and AL from power-on to shutdown. , some driver files will be loaded in the PEI stage and the DXE stage, and stored in the memory, in preparation for the BDS stage. However, due to the insecurity in the process of loading driver files, attackers can interfere in the PEI and DXE stages, transmit some interfering input (bounded) and then affect the BDS stage, delay the BDS startup selection time, and thus affect the overall computer startup time.
因此,本发明实施例方案,从目前UEFI系统在BDS阶段所存在的实际问题出发,设计一种柔性控制器对BDS阶段进行调节,减少启动设备选择时间,从而有效减少计算机启动时间。Therefore, the solution of the embodiment of the present invention starts from the actual problems existing in the current UEFI system in the BDS stage, and designs a flexible controller to adjust the BDS stage to reduce the selection time of the startup device, thereby effectively reducing the computer startup time.
具体地,参照图1,图1为本发明计算机启动装置所属计算机设备的功能模块示意图。该计算机启动装置可以为独立于计算机设备的、能够生成计算机启动控制策略、进行计算机启动控制的装置,其可以通过硬件或软件的形式承载于计算机设备上。该计算机设备可以为手机、平板电脑等具有数据处理功能的智能移动终端,还可以为具有数据处理功能的固定终端设备或服务器等。Specifically, referring to FIG. 1 , FIG. 1 is a schematic diagram of functional modules of a computer device to which the computer startup apparatus of the present invention belongs. The computer startup device may be a device independent of the computer device, capable of generating a computer startup control strategy, and performing computer startup control, which may be carried on the computer device in the form of hardware or software. The computer equipment may be an intelligent mobile terminal with a data processing function such as a mobile phone or a tablet computer, or may be a fixed terminal device or a server with a data processing function.
在本实施例中,该计算机启动装置所属计算机设备至少包括输出模块110、处理器120、存储器130以及通信模块140。In this embodiment, the computer equipment to which the computer starting apparatus belongs at least includes an
存储器130中存储有计算机启动程序,计算机启动装置可以将获取的BDS阶段的入口函数、基于所述入口函数,通过预先设定的柔性控制器对所述BDS阶段进行调节,得到的启动设备选择结果等信息存储于该存储器130中;输出模块110可为显示屏等。通信模块140可以包括WIFI模块、移动通信模块以及蓝牙模块等,通过通信模块140与外部设备或服务器进行通信。A computer startup program is stored in the
其中,存储器130中的计算机启动程序被处理器执行时实现以下步骤:Wherein, when the computer startup program in the
获取所述BDS阶段的入口函数;Obtain the entry function of the BDS stage;
基于所述入口函数,通过预先设定的柔性控制器对所述BDS阶段进行调节,得到启动设备选择结果;Based on the entry function, the BDS stage is adjusted through a preset flexible controller to obtain a selection result of the starting device;
基于所述启动设备选择结果,加载计算机操作系统。Based on the boot device selection result, a computer operating system is loaded.
进一步地,存储器130中的计算机启动程序被处理器执行时还实现以下步骤:Further, when the computer startup program in the
设计所述柔性控制器,具体包括:Designing the flexible controller specifically includes:
构建连续选择变量;Build continuous selection variables;
基于所述连续选择变量,构建选择策略;constructing a selection strategy based on the continuous selection variable;
基于所述选择策略,设计所述柔性控制器。Based on the selection strategy, the flexible controller is designed.
进一步地,存储器130中的计算机启动程序被处理器执行时还实现以下步骤:Further, when the computer startup program in the
基于预先获取的交接块HOB结构列表,对系统驱动进行初始化;Based on the pre-acquired HOB structure list of the handover block, initialize the system driver;
对经过初始化后的系统驱动进行验证,得到验证结果;Verify the system driver after initialization, and get the verification result;
根据所述验证结果,计算得到所述BDS阶段的入口函数。According to the verification result, the entry function of the BDS stage is obtained by calculation.
进一步地,存储器130中的计算机启动程序被处理器执行时还实现以下步骤:Further, when the computer startup program in the
构建所述HOB结构列表,具体包括:Construct the HOB structure list, which specifically includes:
获取所述SEC阶段的系统信息;Obtain system information for said SEC stage;
将所述SEC阶段的系统信息传递给所述PEI阶段的入口函数;Pass the system information of the SEC stage to the entry function of the PEI stage;
基于所述PEI阶段的入口函数,执行所述PEI阶段,以构建所述HOB结构列表。Based on the entry function of the PEI stage, the PEI stage is executed to construct the HOB structure list.
进一步地,存储器130中的计算机启动程序被处理器执行时还实现以下步骤:Further, when the computer startup program in the
基于所述入口函数,加载PEI模块文件;Based on the entry function, load the PEI module file;
对所述PEI模块文件进行检索验证,得到所述PEI阶段的验证结果;The PEI module file is retrieved and verified to obtain the verification result of the PEI stage;
基于所述PEI阶段的验证结果,构建所述HOB结构列表。Based on the verification results of the PEI stage, the HOB structure list is constructed.
进一步地,存储器130中的计算机启动程序被处理器执行时还实现以下步骤:Further, when the computer startup program in the
基于所述启动设备选择结果,加载计算机驱动程序;Loading a computer driver based on the boot device selection result;
基于所述计算机驱动程序,初始化控制台设备;Based on the computer driver, initialize the console device;
基于所述控制台设备,创建引导启动项;Based on the console device, create a bootable startup item;
基于所述引导启动项,加载所述计算机操作系统。Loading the computer operating system based on the booting item.
进一步地,存储器130中的计算机启动程序被处理器执行时还实现以下步骤:Further, when the computer startup program in the
基于所述引导启动项,为计算机操作系统加载器准备执行环境;Prepare an execution environment for the computer operating system loader based on the booting item;
通过所述计算机操作系统加载器,加载所述计算机操作系统。The computer operating system is loaded by the computer operating system loader.
本实施例通过上述方案,具体通过获取BDS阶段的入口函数;基于所述入口函数,通过预先设定的柔性控制器对所述BDS阶段进行调节,得到启动设备选择结果;基于所述启动设备选择结果,加载计算机操作系统。基于本发明,针对目前UEFI系统的BDS阶段所存在的启动时间长的问题,设计了用于BDS阶段调节的柔性控制器,从而缩短了BDS阶段的启动选择时间,进而有效减少了计算机启动时间。This embodiment uses the above solution, specifically by acquiring the entry function of the BDS stage; based on the entry function, the BDS stage is adjusted by a preset flexible controller to obtain the selection result of the starting device; based on the starting device selection As a result, the computer operating system is loaded. Based on the present invention, aiming at the problem of long startup time in the BDS stage of the current UEFI system, a flexible controller for adjusting the BDS stage is designed, thereby shortening the startup selection time of the BDS stage and effectively reducing the computer startup time.
基于上述计算机设备架构但不限于上述架构,提出本发明方法实施例。Based on the above-mentioned computer equipment architecture but not limited to the above-mentioned architecture, the method embodiments of the present invention are proposed.
参照图2,图2为本发明计算机启动方法第一实施例的流程示意图。所述计算机启动方法包括:Referring to FIG. 2 , FIG. 2 is a schematic flowchart of a first embodiment of a computer startup method of the present invention. The computer startup method includes:
步骤S10,获取所述BDS阶段的入口函数;Step S10, obtaining the entry function of the BDS stage;
具体地,本发明计算机启动方法用于控制计算机启动系统,所述计算机启动系统包括BDS(Boot Device Select,启动设备选择)阶段,目前计算机启动时普遍使用UEFI系统,因此本发明实施例也将以UEFI系统为例进行说明。UEFI系统将计算机的启动过程划分为SEC、PEI、DXE以及BDS阶段,其中,在SEC阶段验证系统安全信息,在PEI和DXE阶段加载驱动文件,为BDS阶段做准备,本申请所提出的计算机启动方法主要对BDS阶段进行调节,需要获取BDS阶段的入口函数。Specifically, the computer booting method of the present invention is used to control a computer booting system. The computer booting system includes a BDS (Boot Device Select, boot device selection) stage. Currently, the UEFI system is generally used when a computer is booted. Therefore, the embodiment of the present invention will also be based on The UEFI system is taken as an example for description. The UEFI system divides the computer's startup process into SEC, PEI, DXE and BDS stages. The system security information is verified in the SEC stage, and the driver files are loaded in the PEI and DXE stages to prepare for the BDS stage. The computer startup proposed in this application The method mainly adjusts the BDS stage, and needs to obtain the entry function of the BDS stage.
更为具体地,通过执行UEFI系统的SEC、PEI以及DXE阶段,UEFI内核逐渐完成系统初始化,以获取计算机内存以及驱动的调度权,并通过EFI_BDS_ARCH_PROTOCOL函数找到并调用BDS阶段的入口函数,以执行BDS阶段的主函数。More specifically, by executing the SEC, PEI and DXE stages of the UEFI system, the UEFI kernel gradually completes the system initialization to obtain the computer memory and the scheduling rights of the driver, and finds and calls the entry function of the BDS stage through the EFI_BDS_ARCH_PROTOCOL function to execute the BDS. The main function of the stage.
步骤S20,基于所述入口函数,通过预先设定的柔性控制器对所述BDS阶段进行调节,得到启动设备选择结果;Step S20, based on the entry function, adjust the BDS stage through a preset flexible controller, and obtain a startup device selection result;
具体地,在计算机启动过程中,通过执行BDS阶段来执行启动策略,此时,通过PEI阶段和DXE阶段的加载,计算机的内存和驱动已经可以被完全使用。但是,在上述PEI和DXE阶段,如果系统接收了外界的干扰输入,就会对BDS阶段的启动造成干扰,进而影响BDS选择启动时间。因此,本发明预先设计了柔性控制器对BDS阶段进行调节,所述柔性控制器通过构建连续选择变量来生成选择策略,进而在驱动系统与开机系统之间进行调节,使得开机系统误差在尽可能短的时间内达到稳定,能够有效抑制外界对计算机启动的干扰,达到缩短计算机启动时间的目的。Specifically, during the computer startup process, the startup strategy is executed by executing the BDS phase. At this time, through the loading in the PEI phase and the DXE phase, the computer's memory and drivers can be fully used. However, in the above PEI and DXE stages, if the system receives external interference input, it will interfere with the start of the BDS stage, thereby affecting the BDS selection start time. Therefore, the present invention pre-designs a flexible controller to adjust the BDS stage, the flexible controller generates a selection strategy by constructing continuous selection variables, and then adjusts between the drive system and the start-up system, so that the start-up system error is as small as possible Stability is achieved within a short period of time, which can effectively suppress external interference on computer startup and achieve the purpose of shortening computer startup time.
步骤S30,基于所述启动设备选择结果,加载计算机操作系统。Step S30: Load a computer operating system based on the boot device selection result.
参照图3,图3为本发明实现计算机启动的过程示意图,如图3所示,本发明通过柔性控制器对BDS阶段进行调节,在完成BDS阶段后就可以进一步加载计算机操作系统,从而实现计算机的启动。Referring to FIG. 3, FIG. 3 is a schematic diagram of the process of realizing computer startup in the present invention. As shown in FIG. 3, the present invention adjusts the BDS stage through the flexible controller, and can further load the computer operating system after the BDS stage is completed, thereby realizing the computer operating system. start.
具体地,参照图4,图4为本实施例步骤S30的细化流程示意图,所述基于所述启动设备选择结果,加载计算机操作系统的步骤包括:Specifically, referring to FIG. 4 , FIG. 4 is a detailed schematic flow chart of step S30 in this embodiment. The step of loading a computer operating system based on the boot device selection result includes:
步骤S301,基于所述启动设备选择结果,加载计算机驱动程序;Step S301, loading a computer driver based on the boot device selection result;
更为具体地,在BDS的执行阶段,在引导操作系统之前,还需要加载计算机驱动程序,加载计算机驱动程序的目的是建立计算机系统与硬件之间的连接。计算机驱动程序中包含有关硬件设备的信息,此信息能够使计算机与相应的设备进行通信,如果不加载驱动程序,计算机的硬件就无法工作。More specifically, in the execution stage of the BDS, before booting the operating system, a computer driver needs to be loaded, and the purpose of loading the computer driver is to establish a connection between the computer system and the hardware. A computer driver contains information about a hardware device that enables the computer to communicate with the corresponding device. Without the driver loaded, the computer's hardware would not work.
步骤S302,基于所述计算机驱动程序,初始化控制台设备;Step S302, based on the computer driver, initialize the console device;
在上述步骤中,已经将计算机硬件的驱动程序加载到计算机系统中,这样一来,计算机就能够与相应的设备进行通信,获取这些设备的信息。此处的控制台设备包括但不限于如ConsoleIn/ConsoleOut、USB/PS2、键盘鼠标、VGA等,将控制台设备进行初始化之后,就能够接收用户对计算机的控制信号,进入下一阶段的计算机启动。In the above steps, the driver program of the computer hardware has been loaded into the computer system, so that the computer can communicate with the corresponding devices and obtain the information of these devices. The console devices here include but are not limited to such as ConsoleIn/ConsoleOut, USB/PS2, keyboard and mouse, VGA, etc. After the console device is initialized, it can receive the user's control signal to the computer and enter the next stage of computer startup. .
步骤S303,基于初始化后的控制台设备,加载引导启动项;Step S303, based on the initialized console device, load the boot boot item;
具体地,用户可以通过控制台设备输入信息来选中引导启动项(也可以通过系统默认选择的方式),如果加载引导启动项失败,那么系统会返回执行BDS阶段之前的准备工作,以加载更多的驱动文件,然后重新尝试加载启动项。在UEFI系统中,BDS策略通过全局NVRAM变量配置来实现,这些变量可以通过运行时服务的GetVariable()函数进行读取,通过SetVariable()函数进行设置。Specifically, the user can select the boot item by inputting information through the console device (or by default by the system). If the boot item fails to be loaded, the system will return to the preparatory work before executing the BDS stage to load more driver file, and then try loading the startup item again. In UEFI systems, BDS policies are implemented through global NVRAM variable configuration. These variables can be read through the GetVariable() function of the runtime service and set through the SetVariable() function.
步骤S304,基于所述引导启动项,加载所述计算机操作系统。Step S304: Load the computer operating system based on the booting item.
在用户选定启动项(或系统进入默认的启动项)后,OS loader(OPerating Systemloader,操作系统加载程序,以Linux操作系统为例,其OS loader就是GRUB就会开始运行,从而开始加载操作系统)。具体地,OS loader可以使用UEFI提供的服务,并且将计算机的资源逐渐转移到自己手中,这个过程也就是TSL(Transient System Loader)阶段。一般而言,在这个阶段结束之后,OS Loader会调用ExitBootServices()函数,结束BS并且回收BS占用的资源,然后进入RT阶段;再之后,OS loader才会去加载操作系统内核,逐渐进入OS。After the user selects the startup item (or the system enters the default startup item), the OS loader (OPerating Systemloader, operating system loader, taking the Linux operating system as an example, the OS loader is GRUB will start to run, thus starting to load the operating system ). Specifically, the OS loader can use the services provided by UEFI, and gradually transfer the computer's resources to its own hands. This process is also the TSL (Transient System Loader) stage. Generally speaking, after this stage, the OS Loader will call the ExitBootServices() function to end the BS and recycle the resources occupied by the BS, and then enter the RT stage; after that, the OS loader will load the operating system kernel and gradually enter the OS.
本实施例通过上述方案,具体通过获取BDS阶段的入口函数;基于所述入口函数,通过预先设定的柔性控制器对所述BDS阶段进行调节,得到启动设备选择结果;基于所述启动设备选择结果,加载计算机操作系统。基于本申请方案,针对目前UEFI系统的BDS阶段的不可控因素,设计了用于BDS阶段调节的柔性控制器,从而缩短了BDS阶段的启动选择时间,进而有效减少了计算机启动时间。This embodiment uses the above solution, specifically by acquiring the entry function of the BDS stage; based on the entry function, the BDS stage is adjusted by a preset flexible controller to obtain the selection result of the starting device; based on the starting device selection As a result, the computer operating system is loaded. Based on the solution of the present application, aiming at the uncontrollable factors in the BDS stage of the current UEFI system, a flexible controller for adjusting the BDS stage is designed, thereby shortening the startup selection time of the BDS stage, thereby effectively reducing the computer startup time.
进一步地,参照图5,图5为本发明第二实施例的流程示意图。基于上述图2所示实施例的步骤S20,所述基于所述入口函数,通过预先设定的柔性控制器对所述BDS阶段进行调节,得到启动设备选择结果的步骤之前还包括:Further, referring to FIG. 5 , FIG. 5 is a schematic flowchart of the second embodiment of the present invention. Based on the step S20 of the embodiment shown in FIG. 2, the step of adjusting the BDS stage through the preset flexible controller based on the entry function to obtain the selection result of the starting device further includes:
步骤A20,设计所述柔性控制器,具体包括:Step A20, designing the flexible controller, which specifically includes:
构建连续选择变量;Build continuous selection variables;
基于所述连续选择变量,构建选择策略;constructing a selection strategy based on the continuous selection variable;
基于所述选择策略,设计所述柔性控制器。Based on the selection strategy, the flexible controller is designed.
具体地,柔性控制器在BDS阶段进行调节的方式如下式(1)所示:Specifically, the way that the flexible controller adjusts in the BDS stage is shown in the following formula (1):
u=-(K+pl)Te (1)u=-(K+pl) T e (1)
其中,u为柔性控制器的控制决策,其控制指标可以通过上述公式(1)计算得到,k为与计算机系统状态相关的正定n维矩阵,T代表对矩阵(K+pl)进行转置运算,矩阵l满足:l+lT为正定矩阵,P为根据计算机系统状态所设计的连续选择变量,e为开机系统误差。Among them, u is the control decision of the flexible controller, and its control index can be calculated by the above formula (1), k is a positive definite n-dimensional matrix related to the state of the computer system, and T represents the transpose operation of the matrix (K+pl) , the matrix l satisfies: l+l T is a positive definite matrix, P is a continuous selection variable designed according to the state of the computer system, and e is the boot system error.
进一步地,在柔性控制器调节的过程中,若采取的选择策略为Dq,则Dq与变量连续选择变量P、开机系统误差e相关,其形式满足如下式(2):Further, in the process of flexible controller adjustment, if the selection strategy adopted is D q , then D q is related to the variable continuous selection variable P and the startup system error e, and its form satisfies the following formula (2):
Dq=g(p,e) (2)D q = g(p, e) (2)
其中,p为连续选择变量,e为开机系统误差,g(p,e)代表选择策略与连续选择变量p、开机系统误差e的关系函数,通过如式(1)所示柔性控制器的控制就可以使得开机系统误差在尽可能短的时间内达到稳定。Among them, p is the continuous selection variable, e is the startup system error, g(p, e) represents the relationship function between the selection strategy, the continuous selection variable p, and the startup system error e. The system error can be stabilized in the shortest possible time.
更为具体地,为了进一步说明计算机驱动系统与开机系统之间的误差,本发明给出了开机系统在柔性控制器u的控制下达到Mittag-Leffler稳定的条件为:More specifically, in order to further illustrate the error between the computer drive system and the start-up system, the present invention provides that the start-up system achieves Mittag-Leffler stability under the control of the flexible controller u as follows:
其中,Q1、k为正定对称矩阵,A为开机系统状态矩阵,通过关于Mittag-Leffler稳定性的满足条件可知,在满足式(3)的情况下,开机系统是稳定的Mittag-Leffler稳定的。Mittag-Leffler稳定是一种衡量分数阶非线性系统稳定性的方法,常用于数学、自动化控制、人工智能、工业、信息科学等领域内进行分析。考虑到UEFI系统在BDS阶段的不安全性(可能会获取来自外界的非线性的干扰),从而使得启动时间长,因此,本发明通过Mittag-Leffler稳定对柔性控制器的效果进行了检验,可以看出开机系统误差e在尽可能短的时间内达到稳定。Among them, Q 1 and k are positive definite symmetric matrices, and A is the state matrix of the startup system. From the satisfaction conditions of Mittag-Leffler stability, it can be known that the startup system is stable and Mittag-Leffler stable when equation (3) is satisfied. . Mittag-Leffler stability is a method to measure the stability of fractional-order nonlinear systems, which is often used for analysis in the fields of mathematics, automation control, artificial intelligence, industry, and information science. Considering the insecurity of the UEFI system in the BDS stage (it may acquire non-linear interference from the outside world), which makes the startup time long, therefore, the present invention tests the effect of the flexible controller through the Mittag-Leffler stabilization, which can be It can be seen that the start-up system error e stabilizes in the shortest possible time.
本实施例通过上述方案,具体通过构建连续选择变量;基于所述连续选择变量,构建选择策略;基于所述选择策略,设计所述柔性控制器。本实施例所提出的柔性控制器,能够使得开机系统误差在尽可能短的时间内达到稳定,从而达到了对计算机启动过程中BDS阶段的调节效果,能够缩短计算机在BDS阶段的启动时间。This embodiment adopts the above solution, specifically by constructing a continuous selection variable; building a selection strategy based on the continuous selection variable; and designing the flexible controller based on the selection strategy. The flexible controller proposed in this embodiment can stabilize the startup system error in the shortest possible time, thereby achieving the effect of adjusting the BDS stage during the computer startup process and shortening the computer startup time in the BDS stage.
进一步地,参照图6,提出本发明计算机启动方法第三实施例,图6为本发明第三实施例的流程示意图。基于上述图2所示的实施例的步骤S10,所述获取所述BDS阶段的入口函数的步骤包括:Further, referring to FIG. 6 , a third embodiment of the computer startup method of the present invention is proposed, and FIG. 6 is a schematic flowchart of the third embodiment of the present invention. Based on the step S10 of the embodiment shown in FIG. 2 above, the step of acquiring the entry function of the BDS stage includes:
步骤S101,基于预先获取的交接块HOB结构列表,对系统驱动进行初始化;Step S101, based on the pre-acquired handover block HOB structure list, initialize the system driver;
具体地,HOB(Hand-offblock,交接块)结构列表是在PEI(Pre-EFIInitialization,EFI前期初始化)阶段构建的,计算机启动过程中的PEI阶段所拥有的计算机资源十分有限,在PEI阶段中,将需要传递给下一阶段的系统信息组成HOB结构列表,并将控制权转交给DXE(Driver Execution Environment,驱动执行环境)阶段,UEFI系统内核以C语言为主要载体,因此,控制权的转交以及不同阶段的转换与执行通过不同阶段主函数的执行来实现。Specifically, the HOB (Hand-offblock, handover block) structure list is constructed in the PEI (Pre-EFIIinitialization, EFI pre-initialization) stage, and the computer resources possessed by the PEI stage in the computer startup process are very limited. In the PEI stage, The system information that needs to be passed to the next stage is composed of a HOB structure list, and the control is transferred to the DXE (Driver Execution Environment) stage. The UEFI system kernel uses the C language as the main carrier. Therefore, the transfer of control and The conversion and execution of different stages are realized through the execution of main functions in different stages.
步骤S102,对初始化后的系统驱动进行验证,得到验证结果;Step S102, verifying the initialized system driver to obtain a verification result;
具体地,在基于UEFI的计算机启动过程中,由DXE阶段执行大部分系统的初始化工作,此阶段内存已经可以被完全使用,因此在此阶段可以进行大量的复杂工作,从程序设计的角度,可以认为DXE阶段与PEI阶段的工作是类似的。由于UEFI采用了模块化的设计理念,因此在执行DXE阶段的DXE Dispatcher(DXE派遣)时,可以认为每个DXE Driver都是一个独立的模块,这样一来,整个DXE阶段就会遍历固件中的所有Driver,当所有Driver所依赖的资源都满足时,调度到执行队列执行,直到将所有的Driver都遍历验证结束。Specifically, in the UEFI-based computer startup process, most of the system initialization work is performed by the DXE stage, and the memory can be fully used at this stage, so a lot of complex work can be done at this stage. From the perspective of programming, it is possible to It is believed that the work in the DXE stage and the PEI stage are similar. Since UEFI adopts a modular design concept, when executing the DXE Dispatcher (DXE dispatch) in the DXE stage, it can be considered that each DXE Driver is an independent module. In this way, the entire DXE stage will traverse the firmware in the firmware. All drivers, when all the resources that all drivers depend on are satisfied, are dispatched to the execution queue for execution until all drivers are traversed and verified.
步骤S103,根据所述验证结果,调用所述BDS阶段的入口函数。Step S103, calling the entry function of the BDS stage according to the verification result.
当所有的DXE Drivers都执行完毕后,整个驱动系统就完成了初始化,这时,DXE阶段的控制函数就会通过EFI_BDS_ARCH_PROTOCEL找到BDS并调用BDS的入口函数,从而进入到BDS阶段,因此,从本质上来说,BDS阶段只是一种特殊的DXE阶段的应用程序(代码)。When all DXE Drivers are executed, the entire drive system is initialized. At this time, the control function of the DXE stage will find the BDS through EFI_BDS_ARCH_PROTOCEL and call the entry function of the BDS, thus entering the BDS stage. Therefore, in essence, That said, the BDS stage is just an application (code) of a special DXE stage.
本实施例通过上述方案,具体通过基于预先获取的交接块HOB结构列表,对系统驱动进行初始化;对经过初始化后的系统驱动进行验证,得到验证结果;根据所述验证结果,调用所述BDS阶段的入口函数。相比于上述实施例,本实施例还给出了获取BDS阶段入口函数的方法,进一步完善了整个计算机启动过程。This embodiment uses the above solution, specifically by initializing the system driver based on the pre-acquired HOB structure list of the handover block; verifying the initialized system driver to obtain a verification result; and calling the BDS stage according to the verification result entry function. Compared with the above-mentioned embodiment, this embodiment also provides a method for obtaining the entry function of the BDS stage, which further improves the entire computer startup process.
进一步地,参照图7,图7为本发明计算机启动方法第四实施例的流程示意图,基于上述图4所示实施例的步骤S101,所述基于预先获取的交接块HOB结构列表,对系统驱动进行初始化的步骤之前还包括:Further, referring to FIG. 7, FIG. 7 is a schematic flowchart of a fourth embodiment of a computer startup method according to the present invention. Based on step S101 of the embodiment shown in FIG. 4, the system driver is The steps for initialization also include:
构建所述HOB结构列表,具体包括:Build the HOB structure list, specifically including:
步骤A010,获取SEC阶段的系统信息;Step A010, obtain the system information of the SEC stage;
具体地,在计算机系统加电或重启后,会首先验证系统环境信息,只有系统信息安全的情况下,才会继续执行计算机启动的流程,因此,也就有了SEC(Security Phase,安全验证)阶段。计算机在SEC阶段的主要任务包括:接收并处理系统启动和重启信号;初始化临时存储区域;作为可信系统的根;传递系统参数给上述PEI阶段。系统在SEC阶段所做的一切工作都是为了PEI阶段做准备,把现阶段所得到的系统信息汇报给PEI阶段,并在系统信息传递结束之后将控制权交给PEI阶段。Specifically, after the computer system is powered on or restarted, the system environment information will be verified first, and only when the system information is secure will the computer startup process be continued. Therefore, there is also SEC (Security Phase, security verification) stage. The main tasks of the computer in the SEC stage include: receiving and processing system startup and restart signals; initializing the temporary storage area; acting as the root of the trusted system; passing system parameters to the above-mentioned PEI stage. All the work done by the system in the SEC stage is to prepare for the PEI stage, report the system information obtained at the current stage to the PEI stage, and transfer the control right to the PEI stage after the system information transfer is over.
步骤A020,将所述SEC阶段的系统信息传递给所述PEI阶段的入口函数;Step A020, passing the system information of the SEC stage to the entry function of the PEI stage;
具体地,当系统运行在SEC阶段时,仅CPU和CPU内部资源被初始化,各种外部设备和内存都还没被初始化,因此需要一些临时RAM区域用于代码和数据的存取(SEC最后及SEC之后的阶段都为C语言环境,C语言中的局部变量需要堆栈,这一步是为后续C语言环境做好准备),因此,就需要将关于这个临时RAM区域的信息和系统信息一起传递给下一阶段,所以需要传递给PEI阶段入口函数的信息包括:Specifically, when the system is running in the SEC stage, only the CPU and CPU internal resources are initialized, and various external devices and memory have not been initialized, so some temporary RAM areas are needed for code and data access (the SEC last and The stages after SEC are all in the C language environment, and the local variables in the C language require stacks, this step is to prepare for the subsequent C language environment), therefore, it is necessary to pass the information about this temporary RAM area and system information together to The next stage, so the information that needs to be passed to the entry function of the PEI stage includes:
系统当前状态(PEI阶段可根据这些状态进行驱动验证,以判断系统的健康状况);计算机可启动固件(Boot Firmware Volume,BFV)的地址和大小;临时RAM区域的地址和大小;栈的地址和大小。The current state of the system (the PEI stage can perform driver verification based on these states to determine the health of the system); the address and size of the computer's bootable firmware (Boot Firmware Volume, BFV); the address and size of the temporary RAM area; the address and size of the stack size.
步骤A030,基于所述PEI阶段的入口函数,执行所述PEI阶段,以构建所述HOB结构列表。Step A030, based on the entry function of the PEI stage, execute the PEI stage to construct the HOB structure list.
具体地,参照图8,图8为本实施例步骤A30的细化流程示意图,所述基于所述入口函数,执行所述PEI阶段,以构建所述HOB结构列表的步骤包括:Specifically, referring to FIG. 8, FIG. 8 is a schematic diagram of a detailed flow of step A30 in this embodiment. The step of executing the PEI stage based on the entry function to construct the HOB structure list includes:
步骤A031,基于所述入口函数,加载PEI模块文件;Step A031, based on the entry function, load the PEI module file;
具体地,PEI阶段可以分为两部分,即:PEI Core Services(PEI核心服务)、PEIMDispatch(PEI模块派遣)。整个UEFI系统都是基于模块化的设计,因此PEI阶段对系统的初始化也是由PEIM(PEI Module,PEI模块)来实现的,其中,PEIM Dispatch能够找出系统中所有PEIM,并根据PEIM之间的依赖关系按顺序加载执行PEIM,每个PEIM都是一个独立模块,通过传入参数,PEIM可以使用PEI阶段提供的系统服务以访问PEI Core,不同的PEIM之间通过PPI(PEIM-to-PEIM Interface,PEIM模块接口)来进行通信。Specifically, the PEI stage can be divided into two parts, namely: PEI Core Services (PEI core service) and PEIMDispatch (PEI module dispatch). The entire UEFI system is based on a modular design, so the initialization of the system in the PEI stage is also implemented by PEIM (PEI Module, PEI module). The dependencies are loaded and executed in order. Each PEIM is an independent module. By passing in parameters, PEIM can use the system services provided by the PEI stage to access the PEI Core, and between different PEIMs through the PPI (PEIM-to-PEIM Interface , PEIM module interface) to communicate.
步骤A032,对所述PEI模块文件进行检索验证,得到所述PEI阶段的验证结果;Step A032, retrieving and verifying the PEI module file, and obtaining the verification result of the PEI stage;
在加载PEI模块文件后,会通过PEM模块文件进行对系统的初始化,具体包括CPU初始化、Chipset(芯片组)初始化、IO控制器初始化以及内存初始化等,之后,会对PEI模块文件进行检索验证,获取关于系统初始化的信息,后续步骤可以根据这些信息来构建HOB结构列表。After loading the PEI module file, the system will be initialized through the PEM module file, including CPU initialization, Chipset (chipset) initialization, IO controller initialization, and memory initialization, etc. After that, the PEI module file will be retrieved and verified. Obtain information about system initialization from which subsequent steps can build a list of HOB structures.
步骤A033,基于所述PEI阶段的验证结果,构建所述HOB结构列表。Step A033, based on the verification result of the PEI stage, construct the HOB structure list.
具体地,HOB结构列表是PEI阶段向DXE阶段传递系统信息的手段,PEI阶段将HOB结构列表作为参数传给DXE阶段函数,DXE Core(DXE内核)会根据HOB结构列表来使用计算机的相关资源。HOB产生阶段必须在HOB列表中构建PHIT HOB(HOB列表的首地址)、内存分配HOB(描述永久内存的引导处理器堆栈所在的位置或描述永久内存的BSP存储位置)、描述物理内存范围的资源描述符(包含HOB产生阶段内存范围,其属性包括存在、初始化和测试三种)。Specifically, the HOB structure list is a means for the PEI stage to transmit system information to the DXE stage. The PEI stage passes the HOB structure list as a parameter to the DXE stage function, and the DXE Core (DXE kernel) uses the computer's related resources according to the HOB structure list. The HOB generation stage must build the PHIT HOB (the first address of the HOB list), the memory allocation HOB (the location of the boot processor stack that describes the persistent memory or the BSP storage location of the persistent memory), and the resources that describe the physical memory range in the HOB list. Descriptor (including the memory range of the HOB generation stage, and its attributes include three types of existence, initialization and testing).
本实施例通过上述方案,具体通过获取SEC阶段的系统信息;将所述SEC阶段的系统信息传递给所述PEI阶段的入口函数;基于所述入口函数,执行所述PEI阶段,以构建所述HOB结构列表。相比于上述实施例,本实施例还给出了执行PEI阶段,以构建HOB结构列表的方法,HOB结构列表是执行DXE阶段的基础,也是执行BDS阶段的基础,因此,本实施例在实现上述实施例有益效果的基础上,扩充了本发明的适用范围。This embodiment adopts the above solution, specifically by acquiring the system information of the SEC stage; passing the system information of the SEC stage to the entry function of the PEI stage; based on the entry function, the PEI stage is executed to construct the List of HOB structures. Compared with the above-mentioned embodiment, this embodiment also provides a method for executing the PEI stage to construct a HOB structure list. The HOB structure list is the basis for executing the DXE stage and also the basis for executing the BDS stage. On the basis of the beneficial effects of the above embodiments, the scope of application of the present invention is expanded.
此外,本发明实施例还提出一种计算机启动装置,所述计算机启动装置包括:In addition, an embodiment of the present invention also provides a computer startup device, where the computer startup device includes:
入口函数获取模块,用于获取所述BDS阶段的入口函数;an entry function acquisition module for acquiring the entry function of the BDS stage;
启动设备选择模块,用于基于所述入口函数,通过预先设定的柔性控制器对所述BDS阶段进行调节,得到启动设备选择结果;A startup device selection module, configured to adjust the BDS stage through a preset flexible controller based on the entry function to obtain a startup device selection result;
启动模块,用于基于所述启动设备选择结果,加载计算机操作系统。A booting module, configured to load a computer operating system based on the booting device selection result.
本实施例实现计算机启动的原理及实施过程,请参照上述各实施例,在此不再赘述。The principle and implementation process for realizing the computer startup in this embodiment can be referred to the above-mentioned embodiments, and details are not repeated here.
此外,本发明实施例还提出一种计算机设备,所述计算机设备包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机启动程序,所述计算机启动程序被所述处理器执行时实现如上所述的计算机启动方法的步骤。In addition, an embodiment of the present invention also provides a computer device, the computer device includes a memory, a processor, and a computer startup program stored on the memory and executable on the processor, the computer startup program being The steps of the above-mentioned computer startup method are realized when the processor is executed.
由于本计算机启动程序被处理器执行时,采用了前述所有实施例的全部技术方案,因此至少具有前述所有实施例的全部技术方案带来的所有有益效果,在此不再一一赘述。Since the computer startup program is executed by the processor, it adopts all the technical solutions of the foregoing embodiments, and therefore at least has all the beneficial effects brought by all the technical solutions of the foregoing embodiments, which will not be repeated here.
此外,本发明实施例还提出一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机启动程序,所述计算机启动程序被处理器执行时实现如上所述的计算机启动方法的步骤。In addition, an embodiment of the present invention also provides a computer-readable storage medium, where a computer startup program is stored on the computer-readable storage medium, and when the computer startup program is executed by a processor, the steps of the computer startup method described above are implemented .
由于本计算机启动程序被处理器执行时,采用了前述所有实施例的全部技术方案,因此至少具有前述所有实施例的全部技术方案带来的所有有益效果,在此不再一一赘述。Since the computer startup program is executed by the processor, it adopts all the technical solutions of the foregoing embodiments, and therefore at least has all the beneficial effects brought by all the technical solutions of the foregoing embodiments, which will not be repeated here.
相比现有技术,本发明实施例提出的计算机启动方法、装置、计算机设备以及存储介质,通过获取BDS阶段的入口函数;基于所述入口函数,通过预先设定的柔性控制器对所述BDS阶段进行调节,得到启动设备选择结果;基于所述启动设备选择结果,加载计算机操作系统。本发明通过预先设计的柔性控制器,对计算机启动过程中的BDS阶段进行控制,能够屏蔽外界干扰输入,有效缩短计算机在BDS阶段的启动时间,进而减少计算机启动过程所要花费的时间。Compared with the prior art, the computer startup method, device, computer device and storage medium proposed by the embodiments of the present invention obtain the entry function of the BDS stage; based on the entry function, the BDS is controlled by a preset flexible controller Steps are adjusted to obtain a boot device selection result; based on the boot device selection result, a computer operating system is loaded. The invention controls the BDS stage in the computer startup process through the pre-designed flexible controller, which can shield the external interference input, effectively shorten the computer startup time in the BDS stage, and further reduce the time spent in the computer startup process.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者系统中还存在另外的相同要素。It should be noted that, herein, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article or system comprising a series of elements includes not only those elements, It also includes other elements not expressly listed or inherent to such a process, method, article or system. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in the process, method, article or system that includes the element.
上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages or disadvantages of the embodiments.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,被控终端,或者网络设备等)执行本申请每个实施例的方法。From the description of the above embodiments, those skilled in the art can clearly understand that the method of the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is better implementation. Based on such understanding, the technical solutions of the present application can be embodied in the form of software products in essence or the parts that make contributions to the prior art, and the computer software products are stored in the above storage medium (such as ROM/RAM, magnetic CD, CD), including several instructions to make a terminal device (which may be a mobile phone, a computer, a server, a controlled terminal, or a network device, etc.) to execute the method of each embodiment of the present application.
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above are only the preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made by using the contents of the description and drawings of the present application, or directly or indirectly applied in other related technical fields , are similarly included within the scope of patent protection of this application.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210541053.9A CN115098170A (en) | 2022-05-18 | 2022-05-18 | Computer booting method, apparatus, device and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210541053.9A CN115098170A (en) | 2022-05-18 | 2022-05-18 | Computer booting method, apparatus, device and storage medium |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN115098170A true CN115098170A (en) | 2022-09-23 |
Family
ID=83289730
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202210541053.9A Pending CN115098170A (en) | 2022-05-18 | 2022-05-18 | Computer booting method, apparatus, device and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN115098170A (en) |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US10133654B1 (en) * | 2017-02-28 | 2018-11-20 | American Megatrends, Inc. | Firmware debug trace capture |
| CN111078303A (en) * | 2019-11-22 | 2020-04-28 | 苏州浪潮智能科技有限公司 | Method and device for optimizing UEFI (unified extensible firmware interface) boot startup |
| CN111159700A (en) * | 2019-12-03 | 2020-05-15 | 北京工业大学 | Computer remote safe starting method and system based on UEFI system |
-
2022
- 2022-05-18 CN CN202210541053.9A patent/CN115098170A/en active Pending
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US10133654B1 (en) * | 2017-02-28 | 2018-11-20 | American Megatrends, Inc. | Firmware debug trace capture |
| CN111078303A (en) * | 2019-11-22 | 2020-04-28 | 苏州浪潮智能科技有限公司 | Method and device for optimizing UEFI (unified extensible firmware interface) boot startup |
| CN111159700A (en) * | 2019-12-03 | 2020-05-15 | 北京工业大学 | Computer remote safe starting method and system based on UEFI system |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US7134007B2 (en) | Method for sharing firmware across heterogeneous processor architectures | |
| US8468332B2 (en) | Dynamic link loading in extensible firmware interface compliant systems | |
| US6816963B1 (en) | Platform level initialization using an image generated automatically by a remote server based upon description automatically generated and transmitted thereto by a processor-based system | |
| US7032108B2 (en) | System and method for virtualizing basic input/output system (BIOS) including BIOS run time services | |
| US7363482B2 (en) | Method and apparatus to support remote configuration code | |
| KR101251710B1 (en) | Boot negotiation among multiple boot-capable devices | |
| US7752428B2 (en) | System and method for trusted early boot flow | |
| RU2335798C2 (en) | Data justification between shared proprietary and non-proprietary data structures | |
| US20070260868A1 (en) | Booting an operating system in discrete stages | |
| US10430589B2 (en) | Dynamic firmware module loader in a trusted execution environment container | |
| US20040268113A1 (en) | Virtual out-of-band management controller | |
| EP2630566B1 (en) | Methods and apparatus for building system images and split booting | |
| CN111966470B (en) | Loading method and device of virtual machine monitor and electronic equipment | |
| US11755335B2 (en) | Bios variable-based application deployments | |
| US8539214B1 (en) | Execution of a program module within both a PEI phase and a DXE phase of an EFI firmware | |
| US6961848B2 (en) | System and method for supporting legacy operating system booting in a legacy-free system | |
| CN107506216A (en) | A kind of method that more disk startups are made by USB mobile devices | |
| US11907071B2 (en) | Storage failover protocol for secure and seamless extended firmware load | |
| US7680909B2 (en) | Method for configuration of a processing unit | |
| Rothman et al. | Harnessing the UEFI Shell: Moving the platform beyond DOS | |
| CN115098170A (en) | Computer booting method, apparatus, device and storage medium | |
| CN115291951A (en) | UEFI (unified extensible firmware interface) starting method and device, electronic equipment and storage medium | |
| US10635607B2 (en) | Methods, systems and apparatus to improve boot efficiency | |
| WO2022035426A1 (en) | Application status reporting via platform binary tables | |
| CN114253615B (en) | Method and device for setting bootstrap program, 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 | ||
| CB02 | Change of applicant information |
Address after: 518000 Room 301, building C, Chaojie Industrial Park, No. 1 Guanghui Road, Jinsha community, Kengzi street, Pingshan District, Shenzhen, Guangdong Province Applicant after: EMDOOR DIGITAL TECHNOLOGY Co.,Ltd. Address before: 901, building 1, No. 9, Jinxiu Middle Road, Laokeng community, Longtian street, Pingshan District, Shenzhen City, Guangdong Province Applicant before: EMDOOR DIGITAL TECHNOLOGY Co.,Ltd. |
|
| CB02 | Change of applicant information |