BIOS (Basic Input / Output System) hardware adaptation method
By extracting and processing keywords of BIOS configuration items from hardware adaptation documents, generating and inserting BIOS code, the existing BIOS hardware adaptation problems of long time-consuming and configuration errors are solved, achieving a more efficient adaptation process and more flexibility. configuration method.
Patent Information
- Application Number
- CN202410722582.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-08-30
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing BIOS hardware adaptation method requires manual checking and modification of a large amount of code, which is time-consuming and prone to configuration errors, resulting in a waste of manpower and time.
By extracting and processing keywords of BIOS configuration items from hardware adaptation documents, C language code statements that comply with BIOS code specifications are generated and inserted into the corresponding configuration files to reduce labor costs and error probabilities.
It greatly reduces the manpower and time consumption in the BIOS hardware adaptation process, improves adaptation efficiency, reduces the possibility of configuration errors, and provides a more flexible configuration method.
Smart Images

Figure CN118567729A
Abstract
Description
Technical Field
[0001] The invention relates to BIOS settings in the computer field, and in particular to a BIOS hardware adaptation method. Background Art
[0002] BIOS is a set of programs fixed on a ROM chip on the computer's motherboard. It stores the most important basic input and output programs of the computer, the self-test program after powering on, and the system self-starting program. It can read and write specific information of system settings from CMOS. Its function is to provide the lowest-level and most direct hardware settings and control for the computer. In addition, BIOS also provides some system parameters to the operating system.
[0003] BIOS is responsible for initializing various hardware devices, and the relationship between BIOS and hardware is very close. In the development process of the server, the hardware of the motherboard is often different for different models or different stages of development. At this time, BIOS needs to be adapted for different motherboards. The current method of BIOS adaptation is: according to the hardware and software interface files provided by the hardware engineer, identify the configuration information such as GPIO configuration, bandwidth allocation configuration, USB configuration, CPU Pcie HotPlug configuration and silk screen name, and then modify each configuration in the BIOS code. These adaptation configurations correspond to the BIOS code, and hundreds of codes need to be checked or modified, which is a lot of work and wastes a lot of time. At the same time, the manual configuration and verification method is highly dependent on the personal BIOS engineer, and configuration errors often occur due to engineer negligence. After a configuration error occurs, re-checking the configuration items will waste a lot of manpower and time.
[0004] At present, some hardware engineers write hardware configuration parameters into the hardware XML configuration file through the XML parsing module, replacing the original "Hardware Adaptation Guide" document. Faced with various configurations of models, BIOS engineers do not need to manually adapt and verify. Hardware engineers only need to update the hardware XML configuration file, thus realizing automatic adaptation of BIOS to hardware. However, hardware engineers are required to add the contents of the "Hardware Adaptation Guide" to the XML file. Summary of the invention
[0005] In view of the above problems, the present invention provides a BIOS hardware adaptation method suitable for BIOS settings of servers, personal computers, etc., which directly extracts information related to BIOS adaptation from hardware adaptation documents provided by hardware engineers, and then directly writes it into a code file after processing and compiles it. This method can greatly reduce the manpower waste in the adaptation process, save adaptation time, and reduce the probability of problems occurring in the adaptation process.
[0006] The present invention is implemented by the following scheme: a BIOS hardware adaptation method, comprising the following steps: Step 1: Select the hardware adaptation file corresponding to this adaptation, and then select the path of the code to be adapted; Step 2: Retrieve keywords of BIOS configuration items in the hardware adaptation document, extract and classify the information corresponding to these keywords, and test whether the code path is valid; Step 3: Process the extracted and classified information according to the BIOS code writing specification to generate statements in the BIOS C language code format, and insert these statements into the specified position of the configuration file corresponding to each configuration item written into the BIOS code file package. Since the configuration items during BIOS adaptation are not configured in the same code file, each configuration item has its own corresponding configuration file; Step 4: Call the compilation environment and command to compile the code.
[0007] In step 2, the configuration items include GPIO, USB, PCIE, silk screen, IIO and other texts that can identify that the content is the information required for BIOS adaptation.
[0008] In step 2, the data in the adaptation document is first preprocessed, and then keywords related to BIOS configuration items are found in the preprocessed data, and finally information is extracted and classified. Among them, text preprocessing includes data cleaning, case conversion, word segmentation, and stop word removal, which are used to remove invalid information and convert the hardware adaptation document into a format that can be processed by the computer; When extracting and classifying information, information used in configuration development in the BIOS code is further extracted and synthesized from the extracted keywords, and classified according to different configuration categories.
[0009] When extracting and classifying, the software and hardware interface documents are searched. If configuration item keywords such as GPIO, USB, PCIE, silk screen, IIO, etc. are detected, each configuration information under the configuration item is further searched in detail according to different configuration parameters, and the same type of configuration parameters are classified.
[0010] In step three, the writing specification of the BIOS code uses a code template obtained from different hardware adaptation parts in the BIOS code. Combined with the string processing function, the information extracted in step two can be used to generate a new code statement based on the code template. After the generation of this type of hardware adaptation code statement is completed, the location of the adaptation file is found through the path set in step one, and the adaptation code segment of this type is replaced. The code template is the code segment used to perform the adaptation task in the corresponding code file under the path set in step one. There may be multiple code files under the same path, so it is necessary to find the code file corresponding to this adaptation.
[0011] The code writing specification is an algorithm for writing C language statements of specified functions. The algorithm traverses the configuration items and configuration parameters classified in step 2, starting from the first record of a configuration item until the last record of the configuration item, and finally generates a code segment that conforms to the BIOS code file; the algorithm has imported the code templates corresponding to different configuration items, and when it is judged to be a certain configuration item, the configuration parameters will be filled into the code template. This includes adding arrays, creating structures, changing judgment statements, etc.
[0012] In step 2, if the adapted keyword is not found, the prompt "Hardware adaptation information extraction error, please check whether the adaptation file is valid" will be displayed and step 1 will be repeated; in step 2, if the BIOS code file cannot be successfully opened, the prompt "Code path is invalid, please re-enter" will be displayed and step 1 will be repeated.
[0013] From the above description, it can be seen that this solution does not need to be converted into XML format, and key information can be directly extracted from the hardware adaptation document, which saves the labor cost of conversion and avoids possible errors in the conversion process; this solution directly generates code based on the configuration information and writes it into the source file. Engineers can read, check and modify it, and the configuration method is more flexible. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to explain the present invention more clearly, the drawings required for use in the specific implementation manner will be introduced below.
[0015] Figure 1 It is a flow chart of a specific implementation mode of the present invention. DETAILED DESCRIPTION
[0016] The following will be combined with the drawings in the specific embodiments of the present invention to clearly and completely describe the technical solutions in the specific embodiments of the present invention. Obviously, the specific embodiments described are only part of the specific embodiments of the present invention, not all of the specific embodiments. Based on the specific embodiments of the present invention, all other specific embodiments obtained by ordinary technicians in this field belong to the scope of protection of the specific embodiments of the present invention. Unless otherwise defined, all technical and scientific terms used in this article have the same meaning as those commonly understood by technicians belonging to the present invention.
[0017] As can be seen from the accompanying drawings, this specific implementation provides a BIOS hardware adaptation method, including the following steps: Step 1: Select the hardware adaptation file corresponding to this adaptation, and then select the path of the code to be adapted.
[0018] Step 2. Retrieve keywords for BIOS configuration items in the hardware adaptation document. Configuration items include GPIO, USB, PCIE, silk screen, IIO, and other texts that can identify that the content is information required for BIOS adaptation. Further search based on the different adaptation item keywords retrieved above to find the corresponding configuration parameters, and put the same type of configuration parameters together. For example, when adapting GPIO, first retrieve the GPIO keyword, then find the parameters of the GPP_C_1 pin, record the pull-up / pull-down status, I / O Type, voltage status, default function and other configuration parameters that the GPIO needs to adapt, and put this information together as a record. Then, extract and classify the information corresponding to these keywords, and test whether the code path is valid.
[0019] During the extraction and separation process, the data in the adaptation document is first preprocessed, and then the keywords related to the BIOS configuration items are found in the preprocessed data. Finally, information extraction and classification are performed. Among them, text preprocessing includes data cleaning, case conversion, word segmentation, and stop word removal, which are used to remove invalid information and convert the hardware adaptation document into a format that can be processed by the computer after processing; during information extraction and classification, the information used for configuration development in the BIOS code is further extracted and synthesized from the extracted keywords, and classified according to different configuration categories. When performing extraction and classification, the software and hardware interface documents are searched. If the GPIO, USB, PCIE, silk screen, and IIO configuration item keywords are detected, each configuration information under the configuration item is further searched in detail according to different configuration parameters, and the same type of configuration parameters are classified.
[0020] If the adapted keyword is not found, the prompt "Hardware adaptation information extraction error, please check whether the adaptation file is valid" will be displayed and step one will be repeated; in step two, if the BIOS code file cannot be successfully opened, the prompt "Code path is invalid, please re-enter" will be displayed and step one will be repeated.
[0021] Step 3: Process the processed information according to the writing specifications of the BIOS code, generate statements in the BIOS C language code format, and insert these statements into the specified position of the configuration file corresponding to each configuration item written into the BIOS code file package. Because the configuration items during BIOS adaptation are not configured in the same code file, each configuration item has its own corresponding configuration file. There are many files with BIOS configuration functions, such as *.c, *.h, *.xml, etc. The adaptation method can be C language code, elements in XML, etc., and according to different code styles, the configuration files of a certain type of configuration items may be placed in different files in the same folder, or may be distributed in multiple different folders. They need to be identified and located by file path, file name and code segment during adaptation.
[0022] In step three, the writing specification of the BIOS code uses a code template summarized from different hardware adaptation parts in the BIOS code. Combined with the string processing function, the information extracted in step two can be used to generate a new code statement based on the code template. After the generation of this type of hardware adaptation code statement is completed, the location of the adaptation file is found through the path set in step one, and the adaptation code segment is replaced; the code template refers to the code segment used to perform a specific adaptation task in the corresponding code file under the path set in step one. For example, the GPIO_CONFIG structure is defined in the GpioConfig.c file in the BIOS code, and the structure contains configuration parameters such as GpioName, PadMode, Direction, Power, and OutputState. The configuration of the GPIO_CONFIG structure can be used as a code template, that is, the final generated code must comply with the format and requirements in the source code. The string processing function is a specific implementation method for realizing the generation of the final code from step two. The function input is the configuration parameter and the output is the code segment. Taking the GPIO configuration as an example, the processing function will sort out the configuration parameters in step two and generate a structure in the format of GPIO_CONFIG.
[0023] The code writing specification is an algorithm for writing C language statements of specified functions. The algorithm traverses the configuration items and configuration parameters classified in step 2, starting from the first record of a configuration item until the last record of the configuration item, and finally generates a code segment that conforms to the BIOS code file; the code templates corresponding to different configuration items have been imported into the algorithm, and when it is determined to be a certain configuration item, the configuration parameters will be filled into the code template.
[0024] Step 4: Call the compilation environment and command to compile the code.
[0025] When in use, the user selects the hardware adaptation file corresponding to this adaptation, then selects the path to be coded, and then clicks the Start Adaptation button. At this time, the system will retrieve keywords of configuration items such as GPIO, USB, PCIE, silk screen, IIO, etc. in the hardware adaptation document, and extract and classify the corresponding information of these keywords. Subsequently, the processed information will be further matched according to the writing rules of the BIOS code, and statements in the C language code format will be generated. Finally, these statements will be written into the specified location of the specific file of the BIOS code file package.
[0026] The specific implementation methods described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned specific implementation methods, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned specific implementation methods can still be modified, or some of the technical features therein can be replaced by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the specific implementation methods of the present application, and should all be included in the protection scope of the present application.
Claims
1. A BIOS hardware adaptation method, characterized in that The steps include: Step 1: Select the hardware adaptation file corresponding to this adaptation, and then select the path of the code to be adapted; Step 2: Retrieve keywords of BIOS configuration items in the hardware adaptation document, extract and classify the information corresponding to these keywords, and test whether the code path is valid; Step 3: Process the extracted and classified information according to the BIOS code writing specification to generate statements in the BIOSC language code format, and insert these statements into the specified position of the configuration file corresponding to each configuration item written into the BIOS code file package; Step 4: Call the compilation environment and command to compile the code.
2. The BIOS hardware adaptation method according to claim 1, characterized in that: In step 2, the configuration items include GPIO, USB, PCIE, silk screen, and IIO.
3. The BIOS hardware adaptation method according to claim 2, characterized in that: In step 2, the data in the adaptation document is first preprocessed, and then keywords related to BIOS configuration items are found in the preprocessed data, and finally information is extracted and classified. Among them, text preprocessing includes data cleaning, case conversion, word segmentation, and stop word removal, which are used to remove invalid information and convert the hardware adaptation document into a format that can be processed by the computer; When extracting and classifying information, information used in configuration development in the BIOS code is further extracted and synthesized from the extracted keywords, and classified according to different configuration categories.
4. The BIOS hardware adaptation method according to claim 3, characterized in that: When extracting and classifying, the software and hardware interface documents are searched. If the GPIO, USB, PCIE, silk screen, and IIO configuration item keywords are detected, each configuration information under the configuration item is further searched in detail according to different configuration parameters, and the same type of configuration parameters are classified.
5. The BIOS hardware adaptation method according to claim 4, characterized in that: In step three, the writing specification of the BIOS code uses a code template obtained from different hardware adaptation parts in the BIOS code. Combined with the string processing function, the information extracted in step two can be used to generate a new code statement based on the code template. After the generation of this type of hardware adaptation code statement is completed, the location of the adaptation file is found through the path set in step one, and the adaptation code segment of this type is replaced; the code template is the code segment in the corresponding code file under the path set in step one for performing the adaptation task.
6. The BIOS hardware adaptation method according to claim 5, characterized in that: The code writing specification is an algorithm for writing C language statements of specified functions. The algorithm traverses the configuration items and configuration parameters classified in step 2, starting from the first record of a configuration item until the last record of the configuration item, and finally generates a code segment that conforms to the BIOS code file; the code templates corresponding to different configuration items have been imported into the algorithm, and when it is determined to be a certain configuration item, the configuration parameters will be filled into the code template.
7. The BIOS hardware adaptation method according to claim 1, characterized in that: In step 2, if the adapted keyword is not found, the message "Error in extracting hardware adaptation information, please check whether the adaptation file is valid" will be displayed and step 1 will be repeated.
8. The BIOS hardware adaptation method according to claim 1, characterized in that: In step 2, if the BIOS code file cannot be opened successfully, it will prompt "Invalid code path, please re-enter" and repeat step 1.
