CN115016850A - UEFI (unified extensible firmware interface) firmware starting mode switching method based on domestic processor platform - Google Patents

UEFI (unified extensible firmware interface) firmware starting mode switching method based on domestic processor platform Download PDF

Info

Publication number
CN115016850A
CN115016850A CN202210529970.5A CN202210529970A CN115016850A CN 115016850 A CN115016850 A CN 115016850A CN 202210529970 A CN202210529970 A CN 202210529970A CN 115016850 A CN115016850 A CN 115016850A
Authority
CN
China
Prior art keywords
serial port
firmware
printing
switching method
processor platform
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.)
Granted
Application number
CN202210529970.5A
Other languages
Chinese (zh)
Other versions
CN115016850B (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

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/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 utilizing the flag bit of the fixed address arranged on the Flash, the serial port does not output the printing information when in normal use, the serial port enters a BIOS setting interface when abnormal conditions occur, the output of the serial port is opened, the setting at the moment is filled back to the position on the Flash through the SPI, and the subsequent serial port printing output mode is recorded. Finally, the switching between the two serial port printing modes when the firmware is started can be dynamically controlled by burning the firmware once. Aiming at the instability of a home-made computer during starting, the invention designs the serial port printing mode switching method during starting, which can be set by an operator, so that a user can acquire the starting log information of the computer firmware through simple setting no matter in the development and test stage before product delivery or in the use and maintenance stage after product delivery.

Description

UEFI (unified extensible firmware interface) 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 (unified extensible firmware interface) firmware starting mode switching method based on a domestic processor platform.
Background
The basic input output system firmware (BIOS) of the computer assumes the tasks of starting the motherboard and initializing the hardware devices. With the rapid development of domestic computing platforms, devices on a mainboard are increasingly abundant, and various problems related to processors, memories, peripherals and the like can be encountered when the whole computer is started. At this time, the firmware is required to provide printing information such as serial ports and the like for diagnosis and positioning. The version with the detailed serial port printing information can be called Debug firmware; however, due to the starting speed of the whole computer and the customer experience, the serial port printing is closed by the product-level firmware, which is called a release version.
The serial port on the mainboard can print and record the initialization condition of each hardware device and some burst abnormal information in the process of starting the firmware. In the conventional firmware starting mode, the output mode of serial port printing at the starting time is fixed, and only one of a print information output (Debug) mode and a print information non-output (Release) mode can be selected. The former can output effective printing information to facilitate the analysis of the problem for the developer, and the latter does not output the printing information to save the starting time.
Thus, there are two problems associated with this serial printout mode. Firstly, in the development stage, if the Release mode is burned in order to save time, once a problem occurs, the firmware in the Debug mode needs to be burned again, the operation is time-consuming and the abnormal phenomenon before the loss is easy to occur, and the development efficiency is reduced. Secondly, when the product is shipped, the serial port is often selected not to output the printing information so as to improve the starting speed, so that when the product has a problem or a fault on a production site or a client site, the serial port cannot output the printing information, and developers cannot obtain the log.
Disclosure of Invention
Technical problem to be solved
The invention provides a UEFI firmware starting mode switching method based on a domestic processor platform, which aims to solve the problems that in the existing firmware starting mode, the output mode of serial port printing during starting is fixed, only the mode of outputting printing information (Debug) or the mode of not outputting printing information (Release) can be selected, and dynamic switching cannot be carried out.
(II) technical scheme
In order to solve the technical problem, 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 for defining the size of the firmware, wherein the address is used as a mark for judging whether serial port printing is needed or not when the firmware is started;
s102, giving an initial value of a DATA type to the address defined in the S101, wherein the value of the DATA content is statically determined during firmware compiling, and is dynamically modified at a corresponding position of an erasing Flash in a firmware setting interface when a system is started; the initial value 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 manual modification setting before starting 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 the DualDebugPrintLib, pointing to an address of Flash corresponding to the initial value of the DATA type in the S102, and reading the content of a hexadecimal numerical value; the hexadecimal numerical values correspond to different serial port printing operation modes D and R;
s105, in the starting process of the firmware, when printing is called at a certain position, if the content of the pointer in the 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 printing is called at a certain position, if the content of the pointer in the S104 is analyzed to be in an R mode, no printing output is carried out on the serial port;
s106, modifying the serial port printing library file in inf for all files needing to call the serial port printing and all information needing to be added to the serial port printing, and replacing the original library file with a library file DualDebugPrintLib;
s107, when the serial port printing output mode needs to be modified, entering a BIOS setting interface, and modifying the starting default value described in the S102 through options;
and S108, when the BIOS setting is selected to be saved, the options are recorded, and simultaneously, in a callback function associated with the option setting, Flash writing operation is executed through the SPI, and the printing information output mode corresponding to the options is written to the address defined in the S101.
Furthermore, the file fdf decides to participate in compiling the file or data content, generates binary firmware through compiling, and finally burns the binary firmware into Flash.
Further, firmware Layout defined by the software fdf is certain, so that the address of Flash corresponding to the declared address can be determined.
Further,. fdf may define the DATA types to include a firmware volume type FV, a hexadecimal DATA type DATA, a UEFI drive type INF, and a compiled binary FILE free.
Further, the initial value of the DATA type in step S102 is a hexadecimal DATA type.
Further, in step S103, the Debug and Release serial port print output modes call the same serial port output library file dualdebug printlib.
Further, in the step S104, the hexadecimal values are "0 x 44" and "0 x 52", "0 x 44" corresponds to the D mode, and "0 x 52" corresponds to the R mode, and according to the value of "0 x 44" or "0 x 52", the corresponding serial printing operation is respectively performed: and when the D value is D, the serial port is normally called to carry out printing output, and when the R value is R, the operation is not carried out and the execution is carried out.
Further, in the step S106, the original library file debugdprintlib or debugdprintnullib is replaced with the library file dualdibugdprintlib.
Further, the option in step S107 can change the contents filled in the address in the definition file in S101 at the time of compiling, and take effect immediately with the change.
Further, the method is applied to a domestic processor platform Feiteng S2500, D2000 or FT2000 plus.
(III) advantageous effects
The invention provides a UEFI firmware starting mode switching method based on a domestic processor platform, which is designed by an operator to set a serial port printing mode switching method during starting aiming at the instability of a domestic computer during starting. Therefore, no matter in the development and test stage before product delivery or in the use and maintenance stage after product delivery, a user can acquire the start log information of the computer firmware through simple setting, and the method has important significance for field fault diagnosis and remote support.
Drawings
FIG. 1 is a flowchart of a UEFI firmware boot mode switching method based on a domestic processor platform according to the present invention.
Detailed Description
In order to make the objects, contents and advantages of the present invention clearer, the following detailed description of the embodiments of the present invention will be made in conjunction with the accompanying drawings and examples.
The invention judges the starting mode required by the user by utilizing the flag bit of the fixed address arranged on the Flash, the serial port does not output the printing information when in normal use, the serial port enters a BIOS setting interface when abnormal conditions occur, the output of the serial port is opened, the setting at the moment is filled back to the position on the Flash through the SPI, and the subsequent serial port printing output mode is recorded. Finally, the switching between the two serial port printing modes when the firmware is started can be dynamically controlled by burning the firmware once.
Aiming at the domestic processor platform, the invention utilizes the characteristics that Flash can be read and written and is mapped to a fixed memory address after being started to judge that a flag bit of a serial port output mode has a certain fixed address. When the setting yes/no is selected to output the print information, the flag bit of the corresponding mode is written on Flash. In the library file of serial port output, before calling the serial port output in the printing function each time, the pointer pointing to the address of the flag bit is used to read out the content of the flag bit, and the mode corresponding to the current flag bit is judged to determine whether to execute the related function of serial port printing. The following description is made for embodiments of the present invention:
s101, declaring an address in a file fdf defining the size of the firmware, wherein the address is used as a mark for judging whether serial port printing is needed or not when the firmware is started, and a fdf file determines files or data contents participating in compiling, generates binary firmware through compiling, and finally burns the binary firmware into Flash. Since the firmware Layout defined in fdf is fixed, the address of Flash corresponding to the declared address can be determined. This address has exclusivity: one is not conflicted with other firmware driver statements, and the address can not be allocated when applying for using the memory space;
s102, assigning initial values of DATA types to the addresses defined in S101 (. fdf definable types including a firmware volume type FV, a hexadecimal DATA type DATA, a UEFI drive type INF, a compiled binary FILE FILE FREEFORM and the like, here selected as the hexadecimal DATA type DATA), the values of the DATA contents are statically determined at firmware compilation time, and can be dynamically modified at a firmware setting interface by erasing corresponding positions of Flash at system startup. The initial value stated in S102 is used for providing a default value for judging whether the serial port outputs printing information or not so as to determine that the default output mode is the default output mode before manual modification setting before starting to enter a BIOS setting interface;
s103, specifying a serial port output library file DualDebugPrintLib called by firmware, wherein the difference between the method and the prior art is that the same serial port output library file DualDebugPrintLib is called by two serial port printing output modes of Debug and Release;
s104, declaring a pointer in a specific serial port printing related function DualDebugPrintmarker in the DualDebugPrintLib, pointing to an address of Flash corresponding to the initial value of the DATA type in the S102, and reading the content of a hexadecimal numerical value. The corresponding serial port printing operation is executed according to the value of "0 x 44" (corresponding to D, namely the ASCII value of Debug) or "0 x 52" (corresponding to R, namely the ASCII value of Release): when the D value is D, the serial port is normally called to carry out printing output, and when the R value is R, no operation is carried out to jump out;
s105, in the firmware starting process, when printing is called at a certain position, if the content of the pointer in the S104 is analyzed to be 0x44, the printing information is normally output from the serial port; in the firmware starting process, when printing is called at a certain position, if the content of the pointer in the S104 is analyzed to be 0x52, no printing output is carried out on the serial port;
s106, for all files needing to call serial port printing and all information needing to be added to the serial port printing, modifying the serial port printing library file in inf, and replacing the original DebugPrintLib or DebugPrintNullLib with a library file DualDebugPrintLib to ensure that a finally called serial port output function comes from the library file DualDebugPrintLib in S103;
s107, when the serial port printing output mode needs to be modified, entering a BIOS setting interface, modifying the starting default value described in the S102 through an option, wherein the option can change the content filled in the address in the definition file in the S101 during compiling and can take effect immediately along with the change;
the saving method in S108 and S107 is that when the BIOS setting is selected to be saved, while the option is recorded, in the callback function associated with the option setting, Flash write operation is executed through the SPI, and the print information output mode corresponding to the option is written to the address defined in S101.
Since UEFI firmware of a domestic processor platform does not have a preinstalled initialization (PEI) phase of EFI specified in the UEFI specification, such as the femtos S2500, D2000, FT2000plus, etc., it is not possible to use variables stored on NvRam, nor to service the service get variable (GetVariable) and set variable (SetVariable) of PPI by the PEI phase in the EFI specification until the driver execution environment (DXE) phase. Therefore, if the method is adopted to carry out the switching control of the serial port output printing mode, two problems exist, namely, the serial port printing output mode of the system cannot be determined during the period from the start of the firmware to the time before the service for acquiring the variable and setting the variable is available, the serial port printing cannot be completely controlled, and the Release mode during setting is possible but the output is still in the Debug mode.
Therefore, the invention aims at the instability problem existing in the domestic computer during the starting process at present, and utilizes the characteristic that the BIOS Flash content is mapped to the fixed memory address to design the output switching of the serial port printing information to be controllable by options on a BIOS configuration interface. When the computer is started, the serial port can be opened under the BIOS to print, and the log information can be collected in time, so that the method is very helpful for analyzing problems by field maintenance personnel or remote support developers.
By combining the background technology, the invention designs the serial port printing mode switching method which can be set by an operator when the computer is started aiming at the instability of the domestic computer when the computer is started. Therefore, no matter in the development and test stage before product delivery or in the use and maintenance stage after product delivery, a user can acquire the start log information of the computer firmware through simple setting, and the method has important significance for field fault diagnosis and remote support.
The above description is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, several modifications and variations can be made without departing from the technical principle of the present invention, and these modifications and variations should also be regarded as the protection scope of the present invention.

Claims (10)

1. A UEFI firmware starting mode switching method based on a domestic processor platform is characterized by comprising the following steps:
s101, declaring an address in a file fdf for defining the size of the firmware, wherein the address is used as a mark for judging whether serial port printing is needed or not when the firmware is started;
s102, giving an initial value of a DATA type to the address defined in the S101, wherein the value of the DATA content is statically determined during firmware compiling, and is dynamically modified at a corresponding position of an erasing Flash in a firmware setting interface when a system is started; the initial value 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 manual modification setting before starting 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 the DualDebugPrintLib, pointing to an address of Flash corresponding to the initial value of the DATA type in the S102, and reading the content of a hexadecimal numerical value; the hexadecimal numerical values correspond to different serial port printing operation modes D and R;
s105, in the starting process of the firmware, when printing is called at a certain position, if the pointer content in the 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 printing is called at a certain position, if the content of the pointer in the S104 is analyzed to be in an R mode, no printing output is carried out on the serial port;
s106, modifying the serial port printing library file in inf for all files needing to call the serial port printing and all information needing to be added to the serial port printing, and replacing the original library file with a library file DualDebugPrintLib;
s107, when the serial port printing output mode needs to be modified, entering a BIOS setting interface, and modifying the starting default value described in the S102 through options;
and S108, when the BIOS setting is selected to be saved, the options are recorded, and simultaneously, in a callback function associated with the option setting, Flash writing operation is executed through the SPI, and the printing information output mode corresponding to the options is written to the address defined in the S101.
2. The UEFI firmware boot mode switching method based on a domestic processor platform as claimed in claim 1, wherein the. fdf file decides to participate in the compilation of the file or data content, generates binary firmware by compilation, and finally burns it into Flash.
3. The UEFI firmware boot mode switching method based on a domestic processor platform of claim 1, wherein firmware Layout defined by the name of. fdf is determined so that Flash addresses corresponding to declared addresses can be determined.
4. The domestic processor platform based UEFI firmware boot mode switching method of claim 1 wherein,. fdf may define DATA types including firmware volume type FV, hexadecimal DATA type DATA, UEFI driver type INF and compiled binary FILE free.
5. The UEFI firmware boot mode switching method based on a domestic processor platform according to claim 1, wherein the initial value of the DATA type in the step S102 is a hexadecimal DATA type.
6. The UEFI firmware boot mode switching method based on a domestic processor platform according to any one of claims 1 to 5, wherein in step S103, the two serial port printout modes of Debug and Release call the same serial port output library file DualDebugPrintLib.
7. The UEFI firmware boot mode switching method based on a domestic processor platform of claim 6, wherein in the step S104, the hexadecimal values are "0 x 44" and "0 x 52", "0 x 44" corresponds to D mode and "0 x 52" corresponds to R mode, and according to the value of "0 x 44" or "0 x 52", the corresponding serial printing operation is respectively executed: and when the D value is D, the serial port is normally called to carry out printing output, and when the R value is R, the operation is not carried out and the execution is carried out.
8. The UEFI firmware boot mode switching method based on a domestic processor platform according to claim 6, wherein in step S106, the original library file DebugPrintLib or DebugPrintNullLib is replaced with the library file DualDebugPrintLib.
9. The UEFI firmware boot mode switching method based on a domestic processor platform as claimed in claim 6, wherein the option in step S107 can change the contents filled in the address in the definition file in S101 at compile time and take effect immediately with the change.
10. The UEFI firmware boot mode switching method based on a domestic processor platform according to claim 1, wherein the method is applied to a domestic processor platform Feiteng S2500, D2000 or FT2000 plus.
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 true CN115016850A (en) 2022-09-06
CN115016850B 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 (6)

* 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
US20150186161A1 (en) * 2013-11-18 2015-07-02 Insyde Software Corp. Platform system, method for changing support hardware configuration of universal extensible firmware interface basic input output system and computer program product
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

Patent Citations (6)

* 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
US20150186161A1 (en) * 2013-11-18 2015-07-02 Insyde Software Corp. Platform system, method for changing support hardware configuration of universal extensible firmware interface basic input output system and computer program product
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的可穿戴设备固件在线升级实现", 电子技术应用, no. 03, 6 March 2017 (2017-03-06) *
杜振龙;沙光侠;李晓丽;王庆川;沈钢纲;: "MIPS架构计算机平台的支持固件研究", 兰州理工大学学报, no. 05, 15 October 2013 (2013-10-15) *

Also Published As

Publication number Publication date
CN115016850B (en) 2024-04-19

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
EP3491519B1 (en) Optimized uefi reboot process
JP4199923B2 (en) Mobile device application installation method
US6490723B1 (en) Method and system for installing files in a computing system
US6948164B2 (en) Method and system for modifying executable code to add additional functionality
KR102084816B1 (en) Layout and execution of software applications using bpram
US5652869A (en) System for executing and debugging multiple codes in a multi-architecture environment using jacketing means for jacketing the cross-domain calls
US7953996B2 (en) ACPI to firmware interface
US7146512B2 (en) Method of activating management mode through a network for monitoring a hardware entity and transmitting the monitored information through the network
US20030233534A1 (en) Enhanced computer start-up methods
US7032213B1 (en) Fixing incompatible applications using a light debugger
KR100311582B1 (en) Soft read-only stroage(ros)
KR102136906B1 (en) Layout and execution of operating systems using bpram
US8997049B1 (en) Method and system for debugging of compiled code using an interpreter
JPH0836488A (en) Method and device for checking run-time error using dynamic patching
US20060136134A1 (en) Information processing apparatus and method for obtaining software processing log
JPH11110194A (en) Connection method to external library function and recording medium in which the connection method is recorded and programmed
US5680584A (en) Simulator system for code execution and debugging within a multi-architecture environment
US20040111707A1 (en) Debugger for multiple processors and multiple debugging types
US6901583B1 (en) Method for testing of a software emulator while executing the software emulator on a target machine architecture
CN115016850B (en) UEFI firmware starting mode switching method based on domestic processor platform
US20040153580A1 (en) Component based operation system dynamic device drive method
CN114911541A (en) Configuration information processing method and device, electronic equipment and storage medium
CN113157432B (en) Firmware replacement method based on RISC processor
JP2001022560A (en) Method for revising library function

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