CN114489865A - Method for realizing BIOS configuration modification at OS level - Google Patents

Method for realizing BIOS configuration modification at OS level Download PDF

Info

Publication number
CN114489865A
CN114489865A CN202210400929.8A CN202210400929A CN114489865A CN 114489865 A CN114489865 A CN 114489865A CN 202210400929 A CN202210400929 A CN 202210400929A CN 114489865 A CN114489865 A CN 114489865A
Authority
CN
China
Prior art keywords
bios
configuration
address
smi
layer
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
Application number
CN202210400929.8A
Other languages
Chinese (zh)
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.)
Chengdu Wanchuang Technology Co ltd
Original Assignee
Chengdu Wanchuang 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 Chengdu Wanchuang Technology Co ltd filed Critical Chengdu Wanchuang Technology Co ltd
Priority to CN202210400929.8A priority Critical patent/CN114489865A/en
Publication of CN114489865A publication Critical patent/CN114489865A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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; CALCULATING OR 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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services

Landscapes

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

Abstract

The invention discloses a method for realizing BIOS configuration modification at OS level, belonging to the technical field of computers and comprising the following steps: selecting proper starting equipment to start a system, opening an application tool on an application layer, acquiring a drive access interface, and sending a BIOS configuration command; the driving layer carries out the conversion between a virtual address and a physical address and triggers SMI soft interrupt; the BIOS layer enters an SMM mode and modifies BIOS menu configuration; the application tool is adopted to act on the OS, the configuration of the BIOS can be realized, meanwhile, the drive interface is called through the webpage background, deeper customization can be realized, the HII framework can be not depended on, the system can support all display libraries, and the interface to be displayed can be customized according to the requirements of the user.

Description

Method for realizing BIOS configuration modification at OS level
Technical Field
The invention relates to the technical field of computers, in particular to a method for realizing BIOS configuration modification at an OS level.
Background
At present, the mainstream configuration modification modes provided by BIOS (basic input output system) vendors are all to provide UI interfaces in UEFI (unified extensible firmware interface) environment, and manually adjust configuration parameters by users, but the operation mode is simple, but the mode still has disadvantages: configuration modification cannot be implemented; the UI configuration interface has high modification difficulty and low portability.
SMM is a standard architectural feature that is uniform across all Intel processors. This mode provides a transparent mechanism for the OS to implement platform-specific functions such as power management or system security. When an external SMI is activated or receives an SMI from an APIC (Advanced Programming Interrupt Controller), the processor enters SMM. In SMM, the processor switches to a separate address space while saving the entire Context (Context) of the currently running program. The SMM-specified code may then be executed transparently. When returning from SMM, the processor will return to the state prior to being interrupted by system management.
System Management Mode (SMM) provides the same execution environment as the System Management Interrupt (SMI) handler in the conventional IA-32 architecture. SMM supports one mode to another mode of operation (including IA-32e and legacy mode translations). An SMI handler is capable of handling any physical memory page by a general purpose PSE machine, but does not support PAE (physical Address extension). The SMM environment does not support 64-bit linear addresses. Thus, the transaction submitted to the SMI, the processor will transition to SMM and store the state of the memory in SMRAM (system management memory) according to the SMM memory map (save map). Thus, an SMI handler will execute in the same environment as in the conventional IA-32 architecture.
The selection of device start-up is the basic capability of the BIOS, and the configuration menu of the BIOS is not needed in most scenes, but the selection of the start-up device is different, and the functions of selecting the start-up device are needed by installing a system or starting a mobile system from a USB flash disk. However, the above applications can only occur at the system level, which means that before booting to the system or when the motherboard is not equipped with the system, we have no ability to modify the BIOS configuration and select the boot device, which will cause a big problem that if the first boot device defaults to the usb disk, we have no way to boot the system from other devices.
Disclosure of Invention
The invention aims to overcome the defects that the current BIOS configuration modification mode in the prior art can not realize configuration modification, the UI configuration interface modification difficulty is high, the portability is low, and the invention provides a method for realizing BIOS configuration modification at an OS level.
In order to achieve the above purpose, the invention provides the following technical scheme:
a method for realizing BIOS configuration modification at OS level comprises the following steps:
s1: selecting proper starting equipment to start a system, opening an application tool on an application layer, acquiring a drive access interface, and sending a command for reading or writing the BIOS configuration;
s2: the driving layer carries out the conversion between a virtual address and a physical address and triggers SMI soft interrupt;
s3: the BIOS layer enters SMM mode and modifies the BIOS menu configuration.
By adopting the technical scheme, the modification of the BIOS configuration is realized, and the system can be started by selecting proper starting equipment.
As a preferable embodiment of the present invention, the step S1 includes the steps of:
s11: powering on the mainboard and starting up;
s12: checking the state of GPIO (general purpose input/output port);
s13: and selecting a starting device according to the state of the GPIO.
As a preferable embodiment of the present invention, the step S13 includes: the mainboard selects 3 GPIOs to be set as input states, and selects the type of the starting device according to different combinations of the input states of the 3 GPIOs.
By adopting the technical scheme, the output level of the GPIO can be changed only by short-circuiting the GPIO by using the jumper wire, so that the modification of the starting device is realized, and the method is simple and efficient.
As a preferable embodiment of the present invention, the step S13 further includes: and changing the input level of the GPIO by using jumper short-circuit GPIO, and selecting the matched starting device by default according to a self-defined truth table.
As a preferred solution of the present invention, in step S1, the application layer is allocated with a space of a size allocated according to the application tool, where the space is used to store address information of a menu item and data corresponding to the menu item, and then transfers a physical address to the SMM mode for use.
By adopting the technical scheme, as the menus under the BIOS are numerous and cannot be transmitted by using a CPU register, the transmission of all the menus of the BIOS can be realized by distributing a section of space with a specified size on an application layer for storing the address information of the menu items and the data corresponding to the menu items.
As a preferred solution of the present invention, in the SMM mode, the used address mode is a physical address, and the application layer and the driver layer use a virtual address, and before triggering an SMI soft interrupt, the virtual address needs to be converted into a physical address.
By adopting the technical scheme, the SMM acquires the configuration of the SMI soft interrupt source and the menu item through the transmitted address parameter.
As a preferred scheme of the invention, in the BIOS POST stage, a handler of SMI soft interrupt needs to be registered.
By adopting the technical scheme, the method does not depend on an HII (infrastructure for managing user input) framework, enables the system to support all display libraries, and prepares the interface to be displayed according to the requirements of the user.
Compared with the prior art, the invention has the beneficial effects that: the application tool is adopted to act on the OS, the BIOS configuration can be modified, the system can be started through other starting equipment, meanwhile, the drive interface is called through the webpage background, deeper customization can be achieved, the HII framework can be not depended on, the system can support all display libraries, and the interface to be displayed is customized according to the requirements of the user.
Drawings
Fig. 1 is a flowchart of a method for implementing BIOS configuration modification at OS level according to embodiment 1 of the present invention;
fig. 2 is a flowchart of the motherboard boot process of the method for implementing BIOS configuration modification at OS level according to embodiment 1 of the present invention.
Detailed Description
The present invention will be described in further detail with reference to test examples and specific embodiments. It should be understood that the scope of the above-described subject matter is not limited to the following examples, and any techniques implemented based on the disclosure of the present invention are within the scope of the present invention.
Example 1
A method for implementing BIOS configuration modification at OS level, as shown in fig. 1, includes the following steps:
s1: selecting proper starting equipment to start a system, opening an application tool at an application layer, acquiring a drive access interface, wherein the interface is an API (application programming interface) opened to the application layer by a driver, and sending a command for reading or writing BIOS configuration;
s2: the driving layer carries out the conversion between a virtual address and a physical address and triggers SMI soft interrupt;
s3: the BIOS layer enters SMM mode and modifies the BIOS menu configuration.
As shown in fig. 2, the step S1 includes:
s11: powering on the mainboard and starting up;
s12: checking the state of GPIO;
s13: and selecting a starting device according to the state of the GPIO, wherein the starting device is provided with a disk for starting an operating system.
The step S13 includes: and the mainboard selects 3 GPIOs to be set as input states, and selects different combinations of the input states of the 3 GPIOs as the types of the starting devices.
The step S13 further includes: and changing the output level of the GPIO by using jumper short-circuit GPIO, and selecting the matched starting device by default according to a self-defined truth table.
The truth table is as follows:
Figure DEST_PATH_IMAGE001
specifically, the device driver creates a device driver interface for communicating the configuration menu to be modified and the contents of the menu items.
And the driver layer realizes the creation of a driver interface, selects SMI soft interrupt needing to be triggered according to the parameters transmitted by the application layer and enters an SMM space.
Since the SMRAM State Save Map register data comes from the CPU registers, software code needs to have the authority to operate the CPU registers to pass parameters to the SMI Handler for execution through the SMRAM State Save Map. The application layer does not have the capability to directly manipulate the CPU registers, but the driver can, because it works at the Ring0 level, so the driver exists as an intermediate layer between the application layer and the SMI Handler. Since there are many menu items under the BIOS and it is obviously not feasible to use the CPU register to transfer all the menu items, it is more reasonable to allocate a space of a specified size to the application layer for storing address information of all the menu items and data corresponding to the menu items, and finally transfer the address to SMM for use.
In step S1, the application layer is allocated a space with a size allocated according to the application tool, and is used to store address information of the menu item and data corresponding to the menu item, and then transfer the physical address to the SMM mode for use.
In the SMM mode, the used address mode is a physical address, the application layer and the driver layer use a virtual address, and before the SMI soft interrupt is triggered, the virtual address needs to be converted into a physical address, otherwise, the SMM cannot acquire the configuration of the SMI soft interrupt source and the menu item through the transferred address parameters.
After the interrupt is triggered, the SMRAM State Save Map carries the interrupt source and the menu item data to enter the SMM. Because of the registers needed to operate the CPU, the triggering of all interrupts must be implemented using assembly code, as exemplified below:
ReadBiosConfiguration PROC
push rax
push rcx
push rdi
mov rdi, rcx// rcx bearing parameter associated address
mov eax, 00000055 h// rcx saves SMI soft interrupt number to trigger
out 0B2H, al// trigger SMI soft interrupt
pop rdi
pop rcx
pop rax
ret
ReadBiosConfiguration ENDP
SMM needs to perform a lookup of the SMI Handler and modify certain BIOS menu items based on parameters passed by the driver.
First, the BIOS POST phase needs to register the Handler of the SMI soft interrupt, as follows:
SwContext.SwSmiInputValue = 0x55;
Status = SwDispatch->Register (
SwDispatch,
VtSmiDemoCallback,
&SwContext,
&mSmiHandle
);
vtsmidemocalback is triggered to be called when the driver layer triggers the SMI soft interrupt source 0x55, Demo implemented by vtsmidemocalback, core code showing how the Handler modifies the BIOS configuration according to the parameters:
EFI_STATUS EFIAPI VtSmiDemoCallback (
IN EFI_HANDLE DispatchHandle,
IN CONST VOID *Context OPTIONAL,
IN OUT VOID *CommBuffer OPTIONAL,
IN OUT UINTN *CommBufferSize OPTIONAL)
{
UINT8 i = 0;
VtConfiguration *Data = NULL;
CHIPSET_CONFIGURATION*SetupVariable = NULL;
UINTN SetupBufferSize = 0;
EFI_STATUS Status = EFI_SUCCESS;
UINT64 Rdi = 0;
rdi = (UINT64) (UINTN) mH2OIhisi- > ReadCpureg32 (EFI _ SMM _ SAVE _ STATE _ REGISTER _ RDI);/get to the physical address where the application layer delivery parameters are located
Data = (VtConfiguration *) (UINTN) Rdi;
if ( (Rcx != _ECX__07H_) || (Data == NULL)) {
return EFI_INVALID_PARAMETER;
}
Status = CommonGetVariableDataAndSize (SETUP_VARIABLE_NAME,
&gSystemConfigurationGuid,
&SetupBufferSize,
(VOID**) &SetupVariable
);
if (EFI_ERROR (Status)) {
}
if ( (SetupVariable == NULL) || (SetupBufferSize == 0)) {
Status = EFI_NOT_READY;
}
The BIOS configuration modification is used only as a demo example, and other BIOS configuration menu items may be modified according to the actual application
SetupVariable- > AcPiVer = Data- > AcPiVer// modifying ACPI version
SetupVariable- > BootType = Data- > BootType;/modifying the system boot type
SetupVariable- > network protocol = Data- > network protocol;/modifying network protocol
SetupVariable- > PxeBootToLan = Data- > PxeBootToLan// modified PXE boot
SetupVariable- > QuickBoot = Data- > QuickBoot;/modifying BIOS boot types
SetupVariable->QuietBoot = Data->QuietBoot;
Setup variable- > Timeout = Data- > Timeout, modify BIOS LOGO display time
for(i=0;i<6;i++)
{
SetupVariable- > PceiRootPortEn [ i ] = Data- > PceiRootPortEn [ i ],/modify the switch state of PCIE interface
}
Status = CommonSetVariable (SETUP_VARIABLE_NAME,
&gSystemConfigurationGuid,
BS_RT_NV_VAR_ATTR,
SetupBufferSize,
(VOID *) SetupVariable
);
if (EFI_ERROR (Status)) {
}
SafeFreePoolM (SetupVariable);
return Status;
}
Specifically, VtSmiDemoCallback is triggered to be called when the driver layer triggers SMI soft interrupt source 0x 55.
The application tool is adopted to act on the OS, the configuration of the BIOS can be realized, meanwhile, the drive interface is called through the webpage background, deeper customization can be realized, the HII framework can be not depended on, the system can support all display libraries, and the interface to be displayed can be customized according to the requirements of the user.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.

Claims (7)

1. A method for realizing BIOS configuration modification at OS level is characterized by comprising the following steps:
s1: selecting proper starting equipment to start a system, opening an application tool on an application layer, acquiring a drive access interface, and sending a command for reading or writing the BIOS configuration;
s2: the driving layer carries out the conversion between a virtual address and a physical address and triggers SMI soft interrupt;
s3: the BIOS layer enters SMM mode and modifies the BIOS menu configuration.
2. The method of claim 1, wherein the step S1 comprises the steps of:
s11: powering on the mainboard and starting up;
s12: checking the state of GPIO;
s13: and selecting a starting device according to the state of the GPIO.
3. The method of claim 2, wherein the step S13 comprises: the mainboard selects 3 GPIOs to be set as input states, and selects the type of the starting device according to different combinations of the input states of the 3 GPIOs.
4. The method of claim 2, wherein the step S13 further comprises: and changing the output level of the GPIO by using jumper short-circuit GPIO, and selecting the matched starting device by default according to a self-defined truth table.
5. The method of claim 1, wherein in step S1, the application layer allocates a space with a size allocated according to the application tool, for storing address information of menu items and data corresponding to the menu items, and then passes the physical address to the SMM mode for use.
6. The method of claim 5, wherein in SMM mode, the address mode used is physical address, and the application layer and the driver layer use virtual address, and wherein before triggering SMI soft interrupt, the virtual address needs to be converted to physical address.
7. The method of claim 6 wherein the handler for SMI soft interrupt is registered during BIOS POST phase.
CN202210400929.8A 2022-04-18 2022-04-18 Method for realizing BIOS configuration modification at OS level Pending CN114489865A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210400929.8A CN114489865A (en) 2022-04-18 2022-04-18 Method for realizing BIOS configuration modification at OS level

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210400929.8A CN114489865A (en) 2022-04-18 2022-04-18 Method for realizing BIOS configuration modification at OS level

Publications (1)

Publication Number Publication Date
CN114489865A true CN114489865A (en) 2022-05-13

Family

ID=81489346

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210400929.8A Pending CN114489865A (en) 2022-04-18 2022-04-18 Method for realizing BIOS configuration modification at OS level

Country Status (1)

Country Link
CN (1) CN114489865A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115543055A (en) * 2022-11-28 2022-12-30 苏州浪潮智能科技有限公司 Power management control right transfer method, device, equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101187882A (en) * 2006-11-15 2008-05-28 乐金电子(昆山)电脑有限公司 Computer system for supporting multi-operation system and method for supporting multi-operation system
CN107479931A (en) * 2017-08-18 2017-12-15 郑州云海信息技术有限公司 A kind of method that Linux system application layer refreshes BIOS
CN110688263A (en) * 2019-09-30 2020-01-14 中国工程物理研究院计算机应用研究所 FPGA-based hard disk automatic switching device and application method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101187882A (en) * 2006-11-15 2008-05-28 乐金电子(昆山)电脑有限公司 Computer system for supporting multi-operation system and method for supporting multi-operation system
CN107479931A (en) * 2017-08-18 2017-12-15 郑州云海信息技术有限公司 A kind of method that Linux system application layer refreshes BIOS
CN110688263A (en) * 2019-09-30 2020-01-14 中国工程物理研究院计算机应用研究所 FPGA-based hard disk automatic switching device and application method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
一个编程的小渣渣: ""Linux之ARM(MX6U)裸机之 MX6ULL 启动方式详解"", 《BLOG.CSDN.NET/WEIXIN_47932709/ARTICLE/DETAILS/108019352》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115543055A (en) * 2022-11-28 2022-12-30 苏州浪潮智能科技有限公司 Power management control right transfer method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
US7934209B2 (en) Method for firmware variable storage with eager compression, fail-safe extraction and restart time compression scan
US20030110369A1 (en) Firmware extensions
US6484309B2 (en) Enabling software designed for one operating system to operate on another operating system
US7134007B2 (en) Method for sharing firmware across heterogeneous processor architectures
US6128731A (en) Advanced boot sequence for an +86 computer system that maintains expansion card device compatibility
US6718463B1 (en) System, method and apparatus for loading drivers, registry settings and application data onto a computer system during a boot sequence
US8407396B2 (en) Providing block data access for an operating system using solid-state memory
US5896534A (en) Operating system independent apparatus and method for supporting input/output devices unsupported by executing programs
US6457099B1 (en) Programmable dedicated application card
US8661235B2 (en) Firmware storage medium with customized image
US20100017796A1 (en) Input/output transaction management during platform initiation
US8539214B1 (en) Execution of a program module within both a PEI phase and a DXE phase of an EFI firmware
CA2556683A1 (en) Network terminal operated by downloadable operating system and operating method thereof
US7640553B2 (en) Mechanisms to support use of software running on platform hardware employing different endianness
US6961848B2 (en) System and method for supporting legacy operating system booting in a legacy-free system
US7017034B2 (en) System and method for using a firmware interface table to dynamically load multiple ACPI SSDT tables
EP3633507B1 (en) Technologies for secure and efficient native code invocation for firmware services
CN114489865A (en) Method for realizing BIOS configuration modification at OS level
CN111338699A (en) Computer mainboard initialization method and device, computer equipment and storage medium
US7117353B2 (en) Methods and apparatus to enable console redirection in a multiple execution environment
KR100534613B1 (en) apparatus and method for booting system using flash memory
US20160328277A1 (en) Storage and application intercommunication using acpi
Banik et al. Understanding the BIOS and Minimalistic Design
US20240256286A1 (en) Device tree runtime mechanism
KR101211673B1 (en) Binary compatibility system for executing program of external terminal with different system environment in user terminal and method thereof

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20220513