CN115016850B - UEFI firmware starting mode switching method based on domestic processor platform - Google Patents

UEFI firmware starting mode switching method based on domestic processor platform Download PDF

Info

Publication number
CN115016850B
CN115016850B CN202210529970.5A CN202210529970A CN115016850B CN 115016850 B CN115016850 B CN 115016850B CN 202210529970 A CN202210529970 A CN 202210529970A CN 115016850 B CN115016850 B CN 115016850B
Authority
CN
China
Prior art keywords
serial port
firmware
printing
output
mode
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
CN202210529970.5A
Other languages
Chinese (zh)
Other versions
CN115016850A (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.)
Beijing Institute of Computer Technology and Applications
Original Assignee
Beijing Institute of Computer Technology and Applications
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 Beijing Institute of Computer Technology and Applications filed Critical Beijing Institute of Computer Technology and Applications
Priority to CN202210529970.5A priority Critical patent/CN115016850B/en
Publication of CN115016850A publication Critical patent/CN115016850A/en
Application granted granted Critical
Publication of CN115016850B publication Critical patent/CN115016850B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/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/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)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to a UEFI firmware starting mode switching method based on a domestic processor platform, and belongs to the field of computers. The invention judges the starting mode required by the user by using the zone bit of the fixed address arranged on the Flash, the serial port does not output printing information during normal use, enters the BIOS setting interface when abnormal conditions occur, opens the serial port output, fills the setting at the moment back to the position on the Flash through the SPI, and records the subsequent serial port printing output mode. Finally, the firmware is burnt once, and the switching between the two serial port printing modes can be dynamically controlled when the firmware is started. The invention designs a serial port printing mode switching method for starting up which can be set by an operator aiming at the instability of a domestic computer during starting up, so that a user can obtain starting log information of computer firmware through simple setting no matter in a development test stage before product delivery or in a use maintenance stage after product delivery.

Description

UEFI firmware starting mode switching method based on domestic processor platform
Technical Field
The invention belongs to the field of computers, and particularly relates to a UEFI firmware starting mode switching method based on a domestic processor platform.
Background
The basic input output system firmware (BIOS) of a computer takes the task of booting the motherboard and initializing the hardware devices. With the rapid development of domestic computing platforms, devices on a main board are increasingly abundant, and various problems related to a processor, a memory, peripheral equipment and the like can be encountered when the whole machine is started. In this case, the firmware is required to provide print information such as serial ports for diagnosis and positioning. The version with detailed serial print information may be referred to as Debug version firmware; however, the product level firmware will close the serial port printing, called release, due to the overall machine start-up speed and customer experience.
The serial port on the main board can print and record the initialization condition of each hardware device and some burst abnormal information in the starting process of the firmware. In the existing firmware start mode, the output mode of serial port printing at the start is fixed, and only one of the output print information (Debug) mode and the non-output print information (Release) mode can be adopted. The former can output effective printing information, so that a developer can analyze problems conveniently, and the latter does not output printing information, so that starting time can be saved.
Thus, there are two problems with this serial print out mode. Firstly, in the research and development stage, if the Release mode is burned in order to save time, once a problem occurs, firmware of the Debug mode needs to be burned again, the operation is time-consuming and the prior abnormal phenomenon is easy to lose, and the development efficiency is reduced. Secondly, when the product is shipped, the serial port is often selected not to output printing information so as to improve the starting speed, so that when the product is in a problem or fails in a production site or a customer site, the serial port cannot output printing information at the moment, and a developer cannot acquire a log.
Disclosure of Invention
First, the technical problem to be solved
The invention aims to provide a UEFI firmware starting mode switching method based on a domestic processor platform, so as to solve the problems caused by the fact that the existing firmware starting mode, the output mode of serial port printing in starting is fixed, and only a printing information (Debug) mode or a printing information (Release) mode can be selected and output, and dynamic switching cannot be performed.
(II) technical scheme
In order to solve the technical problems, the invention provides a UEFI firmware starting mode switching method based on a domestic processor platform, which comprises the following steps:
s101, declaring an address in a file fdf defining the size of the firmware as a mark for judging whether serial port printing is needed when the firmware is started;
S102, endowing an address defined in S101 with an initial value of a DATA type, wherein the value of the DATA content is statically determined during compiling of the firmware, and dynamically modifying a corresponding position of Flash through erasing and writing in a firmware setting interface during system starting; the initial value is used for providing a default value for whether the serial port outputs printing information or not so as to determine a default output mode of a stage before the manual modification setting is not performed before the serial port is started to enter the BIOS setting interface;
S103, designating a serial port output library file DualDebugPrintLib called by firmware;
s104, declaring a pointer in a specific serial port printing related function DualDebugPrintMarker in DualDebugPrintLib, pointing to an address of Flash corresponding to the DATA type initial value in S102, and reading hexadecimal numerical content; hexadecimal values correspond to different serial port printing operation modes D and R;
s105, in the firmware starting process, when a certain place is called for printing, if the pointer content in S104 is analyzed to be in a D mode, the printing information is normally output from the serial port; in the starting process of the firmware, when a certain place calls printing, if the pointer content in S104 is analyzed to be in an R mode, the serial port has no printing output;
S106, modifying serial port printing library file call in the inf for all files needing to be called for serial port printing and all information needing to be added to serial port printing, and replacing the original library file with the library file DualDebugPrintLib;
s107, when the serial port printout mode needs to be modified, entering a BIOS setting interface, and modifying the starting default value described in S102 through options;
S108, when the BIOS setting is selected to be saved, executing Flash writing operation through SPI in a callback function associated with the option setting while the option is recorded, and writing a printing information output mode corresponding to the option to the address defined in S101.
Further, fdf the file is decided to participate in the compiled file or data content, and the binary firmware is generated through compiling, and finally burnt into Flash.
Further, the firmware Layout defined by fdf is certain, so that the address of Flash corresponding to the declared address can be determined.
Further, fdf may define that the DATA types include firmware volume type FV, hexadecimal DATA type DATA, UEFI drive type INF, and compiled binary file FILE FREEFORM.
Further, the DATA type initial value in the step S102 is a hexadecimal DATA type.
Further, in step S103, the two serial printout modes of Debug and Release call the same serial output library file DualDebugPrintLib.
Further, in the step S104, hexadecimal values are "0x44" and "0x52", the "0x44" corresponds to the D mode, the "0x52" corresponds to the R mode, and corresponding serial port printing operations are respectively executed according to the hexadecimal values of "0x44" or "0x 52": and when the serial port is D, the serial port is normally called for printing output, and when the serial port is R, the serial port is not operated to jump out for execution.
Further, in the step S106, the original library file DebugPrintLib or DebugPrintNullLib is replaced with the library file DualDebugPrintLib.
Further, the option in step S107 can change the contents written in the address in the definition file in S101 at compile time and take effect immediately with the change.
Further, the method is applied to a domestic processor platform Feiteng S2500, D2000 or FT2000plus.
(III) beneficial effects
The invention provides a UEFI firmware starting mode switching method based on a domestic processor platform, and in combination with the background technology, the invention designs a serial port printing mode switching method capable of being set by an operator during starting aiming at the instability of a domestic computer during starting. The method has the advantages that a user can obtain the starting log information of the computer firmware through simple setting no matter in a development test stage before product delivery or in a use maintenance stage after product delivery, and the method has important significance for field fault diagnosis and remote support.
Drawings
Fig. 1 is a flowchart of a UEFI firmware initiation mode switching method based on a domestic processor platform according to the present invention.
Detailed Description
To make the objects, contents and advantages of the present invention more apparent, the following detailed description of the present invention will be given with reference to the accompanying drawings and examples.
The invention judges the starting mode required by the user by using the zone bit of the fixed address arranged on the Flash, the serial port does not output printing information during normal use, enters the BIOS setting interface when abnormal conditions occur, opens the serial port output, fills the setting at the moment back to the position on the Flash through the SPI, and records the subsequent serial port printing output mode. Finally, the firmware is burnt once, and the switching between the two serial port printing modes can be dynamically controlled when the firmware is started.
The invention aims at a domestic processor platform, and utilizes the characteristics that Flash is readable and writable and is mapped to a fixed memory address after being started, and a flag bit for judging the serial port output mode is stored in a certain fixed address. When the yes/no print information is selected to be set, the flag bit of the corresponding mode is written to Flash. Before the serial port output in the printing function is called each time, the content of the marker bit is read out by using a pointer pointing to the address of the marker bit, and the mode corresponding to the current marker bit is judged to determine whether to execute the related function of serial port printing. The following description is made for the embodiments of the present invention:
S101, declaring an address in a file fdf defining the size of the firmware as a mark for judging whether serial port printing is needed when the firmware is started, wherein fdf files are decided to participate in compiled files or data contents, and binary firmware is generated through compiling and finally burnt in Flash. Since the firmware Layout defined by fdf is certain, the address of Flash corresponding to the declared address can be determined. The address has exclusivity: firstly, the address can not be allocated when the application uses the memory space, and secondly, the address can not be allocated when the application uses the memory space;
s102, assigning an initial value of a DATA type to the address defined in S101 (the type fdf definable includes a firmware volume type FV, a hexadecimal DATA type DATA, a UEFI driver type INF, a compiled binary file FILE FREEFORM, and the like, and is selected as hexadecimal DATA type DATA here), where the value of the DATA content is statically determined at the time of compiling the firmware, and can be dynamically modified at the firmware setting interface by erasing the Flash corresponding location at the time of system startup. The initial value stated in S102 is used for providing a default value for whether the serial port outputs the printing information or not, so as to determine the default output mode of the stage before the manual modification setting is not performed before the serial port is started to enter the BIOS setting interface;
S103, designating a serial port output library file DualDebugPrintLib called by firmware, wherein the method is different from the prior art in that two serial port printout modes of Debug and Release call the same serial port output library file DualDebugPrintLib;
S104, a pointer is declared in a specific serial port printing related function DualDebugPrintMarker in DualDebugPrintLib, points to an address of Flash corresponding to the DATA type initial value in S102, and hexadecimal numerical content is read. The corresponding serial port printing operation is respectively executed according to the value of "0x44" (corresponding to the ASCII value of D, debug) or "0x52" (corresponding to the ASCII value of R, release): when the serial port is D, the serial port is normally called for printing output, and when the serial port is R, the serial port is not operated to jump out for execution;
S105, in the firmware starting process, when a certain place is called for printing, if the pointer content in S104 is analyzed to be 0x44, the printing information is normally output from the serial port; in the firmware starting process, when a certain place calls printing, if the pointer content in S104 is analyzed to be 0x52, the serial port has no printing output;
S106, modifying serial port printing library file call in inf for all files needing to call serial port printing and all information needing to be added to serial port printing, and replacing original DebugPrintLib or DebugPrintNullLib with library file DualDebugPrintLib to ensure that the finally called serial port output function is from library file DualDebugPrintLib in S103;
S107, when the serial port printout mode needs to be modified, entering a BIOS setting interface, and modifying the starting default value described in S102 through an option, wherein the option can fill in the content on the address in the definition file in S101 when the compiling is changed, and the option takes effect immediately along with the changing;
the saving method in S108 and S107 is that when the BIOS setting is selected to be saved, the Flash write operation is performed through the SPI in the callback function associated with the option setting while the option is recorded, and the print information output mode corresponding to the option is written to the address defined in S101.
Since the UEFI firmware of the domestic processor platform has no EFI early initialization (PEI) phase, such as the futile S2500, D2000, FT2000plus, etc., specified by the UEFI specification at boot-up, the variables stored on NvRam cannot be used, nor can the PEI phase be used to provide services of PPI service acquisition variables (GetVariable) and setup variables (SetVariable) in the EFI specification until the driver execution environment (DXE) phase is available. Therefore, if the serial port output print mode switching control is performed by adopting the method, two problems exist, namely, the serial port print output mode of the system cannot be determined in the period from the start of the firmware to the time before the service of acquiring the variable and setting the variable is available, and the serial port print cannot be completely controlled, so that the Release mode during setting possibly occurs, but the output is still in the Debug mode.
Therefore, the invention aims at the instability problem existing in the domestic computer when starting, and utilizes the characteristic that the BIOS Flash content is mapped to the fixed memory address, and the output switching of the serial port printing information is designed to be controllable through options in the BIOS configuration interface. When the computer is started, the serial port printing can be opened under the BIOS to collect log information in time, and the method is very helpful for equipment field maintenance personnel or remote support developers to analyze the problems.
In combination with the background technology, the invention designs a serial port printing mode switching method capable of being set by an operator during starting aiming at the instability of a domestic computer during starting. The method has the advantages that a user can obtain the starting log information of the computer firmware through simple setting no matter in a development test stage before product delivery or in a use maintenance stage after product delivery, and the method has important significance for field fault diagnosis and remote support.
The foregoing is merely a preferred embodiment of the present invention, and it should be noted that modifications and variations could be made by those skilled in the art without departing from the technical principles of the present invention, and such modifications and variations should also be regarded as being within the scope of the invention.

Claims (10)

1. The UEFI firmware starting mode switching method based on the domestic processor platform is characterized by comprising the following steps of:
s101, declaring an address in a file fdf defining the size of the firmware as a mark for judging whether serial port printing is needed when the firmware is started;
S102, endowing an address defined in S101 with an initial value of a DATA type, wherein the value of the DATA content is statically determined during compiling of the firmware, and dynamically modifying a corresponding position of Flash through erasing and writing in a firmware setting interface during system starting; the initial value is used for providing a default value for whether the serial port outputs printing information or not so as to determine a default output mode of a stage before the manual modification setting is not performed before the serial port is started to enter the BIOS setting interface;
S103, designating a serial port output library file DualDebugPrintLib called by firmware;
s104, declaring a pointer in a specific serial port printing related function DualDebugPrintMarker in DualDebugPrintLib, pointing to an address of Flash corresponding to the DATA type initial value in S102, and reading hexadecimal numerical content; hexadecimal values correspond to different serial port printing operation modes D and R;
s105, in the firmware starting process, when a certain place is called for printing, if the pointer content in S104 is analyzed to be in a D mode, the printing information is normally output from the serial port; in the starting process of the firmware, when a certain place calls printing, if the pointer content in S104 is analyzed to be in an R mode, the serial port has no printing output;
S106, modifying serial port printing library file call in the inf for all files needing to be called for serial port printing and all information needing to be added to serial port printing, and replacing the original library file with the library file DualDebugPrintLib;
s107, when the serial port printout mode needs to be modified, entering a BIOS setting interface, and modifying the starting default value described in S102 through options;
S108, when the BIOS setting is selected to be saved, executing Flash writing operation through SPI in a callback function associated with the option setting while the option is recorded, and writing a printing information output mode corresponding to the option to the address defined in S101.
2. The method for switching modes of UEFI firmware initiation based on a domestic processor platform according to claim 1, wherein fdf files are decided to participate in the compiled file or data content, and the binary firmware is generated by compiling and finally burnt into Flash.
3. The UEFI firmware-initiated mode switching method of claim 1, wherein the firmware Layout defined by fdf is defined so as to determine the Flash address to which the asserted address corresponds.
4. The UEFI firmware-initiated mode switching method of claim 1, wherein the fdf definable DATA types comprise a firmware volume type FV, a hexadecimal DATA type DATA, a UEFI driver type INF, and a compiled binary file FILE FREEFORM.
5. The UEFI firmware-initiated mode switching method of claim 1, wherein the DATA type initial value in step S102 is a hexadecimal DATA type.
6. The UEFI firmware-initiated mode switching method based on a domestic processor platform of any of claims 1-5, wherein in step S103, the two serial print output modes of Debug and Release call the same serial output library file DualDebugPrintLib.
7. The method for switching the startup mode of the UEFI firmware based on the domestic processor platform according to claim 6, wherein in the step S104, hexadecimal values are "0x44" and "0x52", the "0x44" corresponds to the D mode, the "0x52" corresponds to the R mode, and the corresponding serial port printing operation is performed according to the value of "0x44" or "0x52", respectively: and when the serial port is D, the serial port is normally called for printing output, and when the serial port is R, the serial port is not operated to jump out for execution.
8. The UEFI firmware-initiated mode switching method of the home processor platform of claim 6, wherein in step S106, the original library file DebugPrintLib or DebugPrintNullLib is replaced with the library file DualDebugPrintLib.
9. The UEFI firmware-initiated mode switching method of claim 6, wherein the option in step S107 is capable of changing the contents written at compile time at the address in the definition file in S101 and effecting immediately upon change.
10. The UEFI firmware-initiated mode switching method of claim 1, wherein the method is applied to a domestic processor platform, futile S2500, D2000, or FT2000plus.
CN202210529970.5A 2022-05-16 2022-05-16 UEFI firmware starting mode switching method based on domestic processor platform Active CN115016850B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210529970.5A CN115016850B (en) 2022-05-16 2022-05-16 UEFI firmware starting mode switching method based on domestic processor platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210529970.5A CN115016850B (en) 2022-05-16 2022-05-16 UEFI firmware starting mode switching method based on domestic processor platform

Publications (2)

Publication Number Publication Date
CN115016850A CN115016850A (en) 2022-09-06
CN115016850B true CN115016850B (en) 2024-04-19

Family

ID=83068198

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210529970.5A Active CN115016850B (en) 2022-05-16 2022-05-16 UEFI firmware starting mode switching method based on domestic processor platform

Country Status (1)

Country Link
CN (1) CN115016850B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB0130008D0 (en) * 2001-07-30 2002-02-06 Inventec Corp Debugging method through serial port under system shutdown and standby conditions
CN103455455A (en) * 2012-05-30 2013-12-18 鸿富锦精密工业(深圳)有限公司 Serial switching system, server and serial switching method
CN110515853A (en) * 2019-08-30 2019-11-29 苏州浪潮智能科技有限公司 A kind of dual serial ports Debug adjustment method and equipment
CN112948157A (en) * 2021-01-29 2021-06-11 苏州浪潮智能科技有限公司 Server fault positioning method, device and system and computer readable storage medium
CN114356383A (en) * 2022-01-10 2022-04-15 深圳中微电科技有限公司 Firmware upgrading method and system of Bootloader architecture

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI480802B (en) * 2013-11-18 2015-04-11 Insyde Software Corp Platform system, universal extension firmware interface Basic input and output system Support for hardware configuration changes, recording media and computer program products

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB0130008D0 (en) * 2001-07-30 2002-02-06 Inventec Corp Debugging method through serial port under system shutdown and standby conditions
CN103455455A (en) * 2012-05-30 2013-12-18 鸿富锦精密工业(深圳)有限公司 Serial switching system, server and serial switching method
CN110515853A (en) * 2019-08-30 2019-11-29 苏州浪潮智能科技有限公司 A kind of dual serial ports Debug adjustment method and equipment
CN112948157A (en) * 2021-01-29 2021-06-11 苏州浪潮智能科技有限公司 Server fault positioning method, device and system and computer readable storage medium
CN114356383A (en) * 2022-01-10 2022-04-15 深圳中微电科技有限公司 Firmware upgrading method and system of Bootloader architecture

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
何国锋 ; 李月婷 ; 刘宇红 ; .基于模拟BIOS的可穿戴设备固件在线升级实现.电子技术应用.2017,(第03期),全文. *
杜振龙 ; 沙光侠 ; 李晓丽 ; 王庆川 ; 沈钢纲 ; .MIPS架构计算机平台的支持固件研究.兰州理工大学学报.2013,(第05期),全文. *

Also Published As

Publication number Publication date
CN115016850A (en) 2022-09-06

Similar Documents

Publication Publication Date Title
JP4878715B2 (en) Method, computer system and computer readable recording medium for patching applications that do not conform to operating system
US6948164B2 (en) Method and system for modifying executable code to add additional functionality
CN101763279B (en) BootLoader architectural design method
US7310801B2 (en) Servicing a component-based software product throughout the software product lifecycle
KR102084816B1 (en) Layout and execution of software applications using bpram
US7146512B2 (en) Method of activating management mode through a network for monitoring a hardware entity and transmitting the monitored information through the network
KR100311582B1 (en) Soft read-only stroage(ros)
KR102136906B1 (en) Layout and execution of operating systems using bpram
US7032213B1 (en) Fixing incompatible applications using a light debugger
WO1999066399A9 (en) Method to reflect bios setup changes into acpi machine language
US20050228516A1 (en) System, method and computer program product for providing an interface for instantiating additional programmable logic controller functionality
US20110126179A1 (en) Method and System for Dynamic Patching Software Using Source Code
US6901583B1 (en) Method for testing of a software emulator while executing the software emulator on a target machine architecture
US20220244931A1 (en) Image file obtaining method and apparatus
CN111984263A (en) Method, device, equipment and medium for running second system application on first system
CN110895518A (en) GPIO (general purpose input/output) interface configuration method and system
CN107423093B (en) Control method and apparatus, computer apparatus, and computer-readable storage medium
CN115016850B (en) UEFI firmware starting mode switching method based on domestic processor platform
CN101840337B (en) Method for customizing reducing system applied to packet capture application
US20040153580A1 (en) Component based operation system dynamic device drive method
CN113031964A (en) Management method, device, equipment and storage medium for big data application
KR101113342B1 (en) Boot-loader version managing method for mobile communication terminal
CN117632222A (en) Data processing method and device
CN116991485A (en) Operating system starting method and device, electronic equipment and readable storage medium
CN116560594A (en) Method, device and equipment for controlling serial port terminal to print based on hardware state

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