Method and apparatus for generating basic input / output system file
By modifying and concatenating the reference compilation files to generate the target basic input/output system files, the problem of low generation efficiency in the prior art is solved, and efficient BIOS file generation and debugging operations are achieved.
Patent Information
- Application Number
- CN202310763157.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-26
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2043-06-26
AI Technical Summary
The existing technology for generating basic input/output system files is inefficient, requiring the redevelopment and compilation of BIOS code, which is complex and inefficient.
By obtaining the reference compilation file, modifying it according to the target debugging requirements, generating the target compilation file, and concatenating it with the target control file, the target basic input/output system files are generated, avoiding code development and compilation operations.
It improves the efficiency of generating basic input/output system files, simplifies the operation process, reduces the probability of errors, and enables flexible configuration of debugging needs and efficient file generation.
Smart Images

Figure CN116795375B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, and more specifically, to a method and apparatus for generating basic input / output system files. Background Technology
[0002] BIOS (Basic Input Output System) is a program embedded in a chip on the computer's motherboard. Its main function is to provide the lowest-level and most direct hardware settings and control for the computer. Currently, BIOS files running on computers can be divided into two versions based on their function: a control BIOS file that controls device operation, and a debug BIOS file used by verification engineers for debugging devices. In the current UEFI motherboard development and maintenance process, if the motherboard malfunctions after the control BIOS file is updated, and further troubleshooting is required, the control BIOS file may not meet the debugging needs. Therefore, a debug BIOS file matching the control BIOS file is needed to support problem analysis and localization. Simultaneously, at different development stages, verification engineers also have the need to debug and verify the motherboard; therefore, a debug BIOS file matching the control BIOS file is required to meet the debugging needs of engineers in various scenarios.
[0003] Currently, after programmers develop a version of the control BIOS code in the code development environment, they compile the code into a control BIOS file that can run on the device. Simultaneously, to obtain a debug BIOS file that matches this version of the control BIOS file, programmers need to compile debug BIOS code that matches this version of the control BIOS code in the code development environment, and then compile the developed debug BIOS code to obtain a debug BIOS file that can run on the device. However, this method of generating debug BIOS files requires redeveloping the BIOS code and compiling the developed code into a file that can run on the device. It is equivalent to redeveloping a new version of the BIOS file, which is complex and inefficient. Summary of the Invention
[0004] This application provides a method and apparatus for generating a basic input / output system file, which at least solves the problem of low generation efficiency of basic input / output system files in related technologies.
[0005] According to one embodiment of this application, a method for generating a Basic Input / Output System (PIS) file is provided, comprising: obtaining a reference compiled file, wherein the reference compiled file is obtained by compiling reference PIS code according to the language format of a target device, and the reference PIS code has the function of controlling the operation of the target device; modifying the reference compiled file according to target debugging requirements to obtain a target compiled file, wherein the target debugging requirements are used to instruct the execution of target debugging operations on the target device, and the target compiled file is a file with the function of implementing the target debugging operations; and generating a target PIS file for running on the target device based on the target compiled file, wherein the target PIS file is used to implement the execution of the target debugging operations on the target device.
[0006] As an optional embodiment, modifying the reference compilation file according to the target debugging requirements to obtain the target compilation file includes: determining a reference string in the reference compilation file corresponding to the target debugging operation, wherein the reference string is a string used to characterize the debugging operation; and modifying the reference string according to the target debugging requirements to obtain the target compilation file.
[0007] As an optional embodiment, modifying the reference string according to the target debugging requirements to obtain the target compiled file includes: performing a conversion process on the reference string to obtain candidate files corresponding one-to-one with multiple substrings, wherein the candidate files are used to indicate the operation type of the debugging operation represented by the corresponding substring, and the reference string includes multiple substrings; filtering out the target substring that matches the operation type of the target debugging operation from the multiple substrings according to the candidate files; importing the target string into the reference compiled file at the character position corresponding to the target substring to obtain the target compiled file, wherein the target string is obtained by using a code generation script to generate target operation code for executing the target debugging operation, and compiling the target operation code according to the language format of the target device.
[0008] As an optional embodiment, determining the reference string corresponding to the target debugging operation in the reference compilation file includes: determining a target index corresponding to the target debugging operation from indexes and debugging operations with corresponding relationships, wherein the target index is used to characterize the position of the reference string in the reference compilation file; and extracting the reference string from the reference compilation file using the target index.
[0009] As an optional embodiment, generating a target basic input / output system file for running on the target device based on the target compiled file includes: obtaining a target control file, wherein the target control file is used to manage the southbridge resources of the motherboard deployed on the target device; and concatenating the target control file and the target compiled file according to the target concatenation order to obtain the target basic input / output system file.
[0010] As an optional embodiment, obtaining the target control file includes: obtaining a control file template, wherein the control file module records the management logic for managing the southbridge resources; modifying the control file template according to the target debugging requirements to obtain the target control file.
[0011] As an optional embodiment, after generating a target basic input / output system file for running on the target device based on the target compilation file, the method further includes: signing the target basic input / output system file using target signature information, wherein the target signature information is used to characterize the device attributes of the target device running the target basic input / output system file.
[0012] According to another embodiment of this application, a device for generating a Basic Input / Output System (PIOS) file is provided, comprising: an acquisition module for acquiring a reference compilation file, wherein the reference compilation file is obtained by compiling reference PIOS code according to the language format of a target device, and the reference PIOS code has the function of controlling the operation of the target device; a modification module for modifying the reference compilation file according to target debugging requirements to obtain a target compilation file, wherein the target debugging requirements are used to instruct the execution of target debugging operations on the target device, and the target compilation file is a file with the function of implementing the target debugging operations; and a generation module for generating a target PIOS file for running on the target device based on the target compilation file, wherein the target PIOS file is used to implement the execution of the target debugging operations on the target device.
[0013] According to yet another embodiment of this application, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and the computer program is configured to perform the steps in any of the above method embodiments when it is run.
[0014] According to yet another embodiment of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0015] This application obtains a reference compiled file corresponding to the reference basic input / output system code used for operating and controlling a target device. By modifying the reference compiled file according to the debugging requirements for device debugging, a target compiled file with debugging operation functions is obtained. Then, the target compiled file is used to generate the target basic input / output system file running on the device. In other words, the target basic input / output system file used for device debugging is obtained by modifying the reference compiled file used for controlling device operation, avoiding the code development and code compilation operations performed in generating the target basic input / output system file. This solves the problem of low generation efficiency of basic input / output system files and achieves the effect of improving the generation efficiency of basic input / output system files. Attached Figure Description
[0016] Figure 1 This is a hardware structure block diagram of a mobile terminal for a method of generating basic input / output system files according to an embodiment of this application.
[0017] Figure 2 This is a flowchart illustrating the generation of a basic input / output system file according to an embodiment of this application;
[0018] Figure 3 This is a flowchart of the process for generating basic input / output system files in related technologies;
[0019] Figure 4 This is an optional flowchart for generating basic input / output system files according to an embodiment of this application;
[0020] Figure 5 This is a schematic diagram illustrating the compilation of an optional basic input / output system file according to an embodiment of this application;
[0021] Figure 6 This is an optional string import diagram according to an embodiment of this application;
[0022] Figure 7 This is an optional document signature diagram according to an embodiment of this application;
[0023] Figure 8 This is a structural block diagram of a basic input / output system file generation apparatus according to an embodiment of this application. Detailed Implementation
[0024] The embodiments of this application will be described in detail below with reference to the accompanying drawings and examples.
[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0026] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for a method of generating basic input / output system files according to an embodiment of this application. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0027] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the method for generating basic input / output system files in this embodiment. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, thus implementing the aforementioned method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0028] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0029] Figure 2 This is a flowchart illustrating the generation of a basic input / output system file according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps:
[0030] Step S202: Obtain a reference compilation file, wherein the reference compilation file is obtained by compiling the reference basic input / output system code according to the language format of the target device, and the reference basic input / output system code has the function of controlling the operation of the target device;
[0031] Step S204: Modify the reference compilation file according to the target debugging requirements to obtain the target compilation file, wherein the target debugging requirements are used to instruct the target device to perform target debugging operations, and the target compilation file is a file that has the function of implementing the target debugging operations;
[0032] Step S206: Generate a target basic input / output system file for running on the target device based on the target compilation file, wherein the target basic input / output system file is used to implement the target debugging operation on the target device.
[0033] Through the above steps, a reference compiled file corresponding to the reference basic input / output system code used for operating and controlling the target device is obtained. By modifying the reference compiled file according to the debugging requirements for debugging the device, a target compiled file with debugging operation functions is obtained. Then, the target basic input / output system file running on the device is generated through this target compiled file. In other words, the target basic input / output system file used for debugging the device is obtained by modifying the reference compiled file used for controlling the operation of the device. This avoids the code development and code compilation operations performed in generating the target basic input / output system file, which can solve the problem of low generation efficiency of basic input / output system files and achieve the effect of improving the generation efficiency of basic input / output system files.
[0034] The entity performing the above steps can be a device, server, or other device used to generate basic input / output system files, but is not limited to these.
[0035] The method for generating basic input / output system files provided in this application embodiment can be a method that runs during the process of generating a reference basic input / output system file for operating control of a target device, or it can be a method that runs after the generation of the reference basic input / output system file is completed. For example, a generation process for generating a target basic input / output system file can be added after the compilation process of the generation process of the reference basic input / output system file, so that the target basic input / output system file is generated at the same time as the reference basic input / output system file is generated. That is, two basic input / output system files with different functions are generated through the same generation process.
[0036] In the embodiment provided in step S202 above, the reference basic input output system (BIOS) code is a code file developed in a code development environment. It has the function of controlling the operation of the device. However, the reference basic input output system code needs to be compiled into a reference compiled file that matches the language format of the target device before the function of controlling the operation of the device by the reference basic input output system code can run on the device.
[0037] Optionally, in this embodiment, the language format of the target device is a language format that the program can be recognized by the target device and run on the target device. It may include, but is not limited to, binary machine language format, assembly language format that symbolizes machine language, etc. This solution does not limit this.
[0038] In the embodiment provided in step S204 above, the modification of the reference compilation file may include, but is not limited to, adding a string for implementing the target debugging operation to the reference compilation file, or replacing an existing string in the reference operation file with a string for implementing the target debugging operation. This solution does not limit this in this way.
[0039] In the embodiment provided in step S206 above, the target compiled file is a file that has the function of implementing target debugging operations. However, the target compiled file cannot directly debug and control the hardware on the target device. It is necessary to bind the target compiled file with the hardware information of the hardware on the target device to obtain the target input / output system file. Only the target input / output system file can be used to debug and control the hardware on the target device. Therefore, the target basic input / output file can be generated by adding the device information of the device to be debugged to the character position corresponding to the debugging function in the target compiled file, thereby obtaining the target basic input / output system file. Alternatively, the target basic input / output system file can be obtained by concatenating the target compiled file and the ME (Manage Engine, firmware module used to manage various resources of the southbridge) file of the target device according to the target concatenation method.
[0040] In related technologies, the generation of the target basic input / output system file for performing target debugging operations on the target device and the generation of the reference basic input / output system file for operating control of the target device are performed separately. That is, a series of operations are performed separately: writing basic input / output system code, compiling the code into a compiled file that can be recognized by the device, and generating the final basic input / output system file from the compiled file. Figure 3 It is a flowchart of the process for generating basic input / output system files in related technologies, such as Figure 3As shown: Two compilations are required for both the reference and the matching target basic input / output (PIO) system files. Furthermore, code modifications are necessary before the second compilation. The specific steps are as follows:
[0041] 1) First, develop a reference basic input / output system code in the code development environment.
[0042] 2) Compile the reference basic input / output system code to obtain a reference compiled file that can be recognized by the target device.
[0043] 3) Use the Fit tool to stitch the static ME (Manage Engine, the firmware module used by Intel to manage various resources of the Southbridge) XML file with the reference compilation file to generate the reference basic input / output system file.
[0044] 4) Sign the reference basic input / output system files and package them with the update tool.
[0045] 5) In the stage of generating the target basic input / output system files, modify the relevant options in the code and compile the modified code to obtain the target compiled file.
[0046] 6) Use the fit tool to stitch the ME XML file with the target compiled file to obtain the target basic input / output system file.
[0047] As can be seen from the above steps, the relevant technologies require compiling the BIOS code twice and repackaging the BIOS update package when generating the reference BIOS file and the corresponding target BIOS file. This is inefficient and requires manually modifying BIOS options and ME XML settings in the code.
[0048] The method for generating basic input / output system files provided in this application embodiment can be a method that runs during the process of generating a reference basic input / output system file for operating control of a target device, or it can be a method that runs after the generation of the reference basic input / output system file is completed. For example, a generation process for generating a target basic input / output system file can be added after the compilation process of the generation process of the reference basic input / output system file, so that the target basic input / output system file is generated at the same time as the reference basic input / output system file is generated. That is, two basic input / output system files with different functions are generated through the same generation process.
[0049] Figure 4 This is an optional flowchart for generating basic input / output system files according to an embodiment of this application, such as... Figure 4 As shown, it includes at least the following steps:
[0050] 1) Develop reference basic input / output system code in the code development environment.
[0051] 2) Compile the reference basic input / output system code to obtain a reference compiled file that can be recognized by the target device. Simultaneously, a process for generating the target basic input / output system file is added to the process of generating the reference basic input / output system file; that is, a branch for generating the target compiled file is added to the compilation path, thus obtaining the target compiled file based on the compiled reference compiled file.
[0052] 3) Use the fit tool to stitch the static ME XML file with the reference compilation file to generate the reference basic input / output system file. At the same time, use the fit tool to modify the ME XML file corresponding to the target basic input / output system file in advance, and stitch it with the target basic input / output system file to obtain the reference basic input / output system file and the target basic input / output system file.
[0053] 4) Sign the target basic input / output system file in the same way as signing the reference basic input / output system file.
[0054] In this embodiment, no code modification is performed during the generation of the target BIOS file, changing the traditional method of manually changing BIOS code and ME options. By setting compilation path branches, the possibility of errors is reduced and compilation efficiency is optimized. The reference BIOS file and the target BIOS file are generated and released simultaneously, changing the traditional method of requesting and occupying R&D resources when a demand arises. With this method, the demand side can update the BIOS as needed at any time. By modifying and regenerating the reference compilation file, the time for recompilation is saved, the power consumption required during compilation is reduced, and the green and sustainable energy and environmental protection concept is practiced.
[0055] Figure 5 This is a schematic diagram illustrating an optional basic input / output system file compilation according to an embodiment of this application, such as... Figure 5 As shown, this application adds a branch to the process of generating a reference basic input / output system (PIS) file from the reference PIS code to generate a target PIS file. Specifically, after compiling the reference compiled file, the reference compiled file is modified to obtain the target compiled file, which in turn yields the target PIS file. This embodiment of the application achieves the generation of two types of PIS files through a single PIS file generation process.
[0056] As an optional embodiment, modifying the reference compilation file according to the target debugging requirements to obtain the target compilation file includes:
[0057] Determine the reference string in the reference compilation file that corresponds to the target debugging operation, wherein the reference string is a string used to characterize the debugging operation;
[0058] The reference string is modified according to the target debugging requirements to obtain the target compiled file.
[0059] Optionally, in this embodiment, since the reference compilation file is text obtained by compiling the code in the language format of the target device, and the strings in the reference compilation file text are strings in a computer language format (such as binary data strings) that the target device can recognize, the strings in the target compilation file can be parsed to convert the strings into descriptive information that describes the string execution operation function, and then the string corresponding to the descriptive information that represents the function of debugging operation is determined as the reference string.
[0060] Optionally, in this embodiment, the method for determining the reference string corresponding to the target debugging operation in the reference compiled file can also be to match the reference compiled file with candidate strings, and determine the string with a similarity greater than the target similarity as the reference string. Here, the candidate string is a pre-set string used to represent the debugging operation. Furthermore, considering that the code content written in the code development environment may differ, the code that implements the same debugging operation function may differ, which in turn leads to differences in some characters in the string after code compilation. Therefore, weight values can be set for characters at different positions in the string, and a more accurate similarity between a certain string in the reference compiled file and the reference string can be obtained by weighted summation of the characters. Alternatively, the string may include multiple substrings, each substring representing the operation attribute of a debugging operation. Then, a corresponding weight value is set according to the position of each substring, and a more accurate similarity between a certain string in the reference compiled file and the reference string can be obtained by weighted summation of multiple substrings. In this embodiment, the reference string is quickly and accurately determined in the reference compilation file by similarity matching, instead of the method of adding annotations or setting indexes in the code development environment or during the compilation of the reference compilation file as used in related technologies. This avoids the complicated pre-set operations in related technologies and also enables flexible extension of the method of determining the reference string in different versions of the reference compilation file.
[0061] As an optional embodiment, modifying the reference string according to the target debugging requirements to obtain the target compiled file includes:
[0062] The reference string is converted to obtain candidate files that correspond one-to-one with multiple substrings. The candidate files are used to indicate the operation type of the debugging operation represented by the corresponding substring. The reference string includes multiple substrings.
[0063] Based on the candidate files, a target substring matching the operation type of the target debugging operation is selected from a plurality of substrings;
[0064] The target string is imported into the reference compilation file at the character position corresponding to the target substring to obtain the target compilation file. The target string is obtained by generating target operation code for performing the target debugging operation using a code generation script, and then compiling the target operation code according to the language format of the target device.
[0065] Optionally, in this embodiment, the file representing the operation type of the debugging operation of the string by converting the reference string can be obtained by parsing the string using a character parser (such as an SCE string parser), or it can be generated using a target generation model. This target generation model is used to extract the vector relationship between characters in the input string and generate a description file corresponding to the vector relationship (used to describe the operation type of the debugging operation corresponding to the input string). This target generation model can be a network model trained on the initial generation model using string samples labeled with description information. This solution does not limit this.
[0066] Optionally, in this embodiment, the code generation script can obtain the target operation code by modifying the code template according to the target debugging operation. The code template records the operation code used to implement the basic operation functions of the debugging operation. The code generation script obtains the target operation code by obtaining the target code parameters corresponding to the target debugging operation and adding the target code parameters to the corresponding position in the code template.
[0067] Optionally, in this embodiment, the code generation script can also be a target code generation model for generating code. The description statement used to describe the target debugging operation is input into the code generation model, and the code generation model is used to extract the vector features of the description statement and generate the target operation code corresponding to the vector features.
[0068] Figure 6 This is an optional string import diagram according to an embodiment of this application, such as... Figure 6As shown, the reference string consists of four substrings: "1011101", "0110001", "1100011", and "0001111". By converting the reference string, candidate files corresponding to each substring are obtained. Then, based on the candidate files, the substring "1100011" is determined as the target substring. Finally, the target substring "1110001" is used to replace the target substring to obtain the target compiled file.
[0069] In this embodiment, the target operation code for the target debugging operation is generated by using a code generation script, thereby realizing the function of flexibly generating target operation code according to needs and improving the flexibility of code generation. Furthermore, after the code is generated, the target operation code is compiled to obtain the target string, and the target compiled file is obtained by replacing the target substring in the reference compiled file with the target string. This improves the generation efficiency of the target compiled file while ensuring the accuracy of the string in the target compiled file.
[0070] As an optional embodiment, determining the reference string in the reference compilation file corresponding to the target debugging operation includes:
[0071] The target index corresponding to the target debugging operation is determined from the corresponding indexes and debugging operations, wherein the target index is used to characterize the position of the reference string in the reference compilation file;
[0072] The reference string is extracted from the reference compiled file using the target index.
[0073] Optionally, in this embodiment, the basic input / output system files have different functions. Therefore, when developing code in the code development environment, code modules for implementing different functions are developed. These code modules are then concatenated to obtain reference basic input / output system code. In this reference basic input / output system code, the operation functions implemented by different regions of the code are different. Consequently, the reference compiled file obtained by compiling the reference basic input / output system code also includes a number of string regions. Different string regions are used to implement different operation functions. Therefore, this application improves the efficiency of extracting reference strings by setting an index to quickly locate the strings that implement the corresponding functions in the reference compiled file.
[0074] As an optional embodiment, generating a target BIOS file for operation on the target device based on the target compilation file includes:
[0075] Obtain the target control file, wherein the target control file is used to manage the southbridge resources of the motherboard deployed on the target device;
[0076] The target control file and the target compilation file are concatenated according to the target concatenation order to obtain the target basic input / output system file.
[0077] Optionally, in this embodiment, the target control file may be an ME (Manage Engine, a firmware module used by Intel to manage various resources of the southbridge) file. The target control file may be obtained by pre-setting the options related to the target debugging operation in the initial ME file using the fit tool. The file may be, but is not limited to, an XML format file.
[0078] Optionally, in this embodiment, the target concatenation order is used to characterize the order in which the target compiled file and the target control file are concatenated. For example, it can be the order in which the target compiled file comes first and the control file comes second, or it can be the order in which the control file comes first and the compiled file comes second. This solution does not limit this.
[0079] Optionally, in this embodiment, the repeated attempts to concatenate the target compiled file and the control file can be made by using the fit tool to concatenate the target compiled file and the target control file.
[0080] As an optional embodiment, obtaining the target control file includes:
[0081] Obtain a control file template, wherein the control file module records the management logic for managing the southbridge resources;
[0082] The control file template is modified according to the target debugging requirements to obtain the target control file.
[0083] Optionally, in this embodiment, modifying the control file template according to the target debugging requirements can be done by adding the parameters corresponding to the target debugging requirements to the corresponding positions in the control file template.
[0084] In this embodiment, a control file template is set, and the control file template is modified according to the target debugging requirements. This achieves the goal of automatically generating the corresponding target control file according to the debugging requirements, avoiding the complex operation of pre-setting the corresponding control file in related technologies, and improving the configuration efficiency of configuring the corresponding target control file for the target debugging requirements.
[0085] As an optional embodiment, after generating a target basic input / output system file for operation on the target device based on the target compilation file, the method further includes:
[0086] The target basic input / output system file is signed using target signature information, wherein the target signature information is used to characterize the device attributes of the target device running the target basic input / output system file.
[0087] Optionally, in this embodiment, the target signature information may include, but is not limited to, the device identifier, device name, etc. of the target device, and this solution does not limit this.
[0088] Optionally, in this embodiment, signing the target basic input / output system file can be done separately, or it can be done simultaneously with signing the reference basic input / output system file (the file corresponding to the reference compilation file, used to implement operation control of the target device). For example, the target basic input / output system file and the reference input / output system file can be packaged together, and the packaged file can be signed using the target signature information. Figure 7 This is an optional document signature illustration according to an embodiment of this application, such as... Figure 7 As shown, the generated reference basic input / output system file and target basic input / output system file can be taken, and the two files can be packaged and the packaged file can be signed. This allows the two files to be signed in one signing step, simplifying the number of signing steps.
[0089] In this embodiment, after the target basic input / output system file is generated, the generated target basic input / output system file is automatically signed using target signature information. This avoids the problem of low signing efficiency caused by manually signing the target basic input / output system in related technologies, thus improving signing efficiency. Furthermore, signing the target basic input / output system by means of signature can also ensure the accuracy of the deployment of the target basic input / output system file, thereby avoiding debugging failures caused by mismatch between the device and the file when maintenance personnel perform device maintenance.
[0090] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0091] This embodiment also provides a basic input / output system file generation apparatus, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0092] Figure 8 This is a structural block diagram of a basic input / output system file generation apparatus according to an embodiment of this application, such as... Figure 8 As shown, the device includes: an acquisition module 82, used to acquire a reference compilation file, wherein the reference compilation file is obtained by compiling reference basic input / output system code according to the language format of the target device, and the reference basic input / output system code has the function of controlling the operation of the target device;
[0093] Modification module 84 is used to modify the reference compilation file according to the target debugging requirements to obtain the target compilation file, wherein the target debugging requirements are used to instruct the target device to perform target debugging operations, and the target compilation file is a file that has the function of implementing the target debugging operations;
[0094] The generation module 86 is configured to generate a target basic input / output system file for running on the target device based on the target compilation file, wherein the target basic input / output system file is used to implement the target debugging operation on the target device.
[0095] Based on the above, a reference compiled file corresponding to the reference basic input / output system code used for operating and controlling the target device is obtained. By modifying the reference compiled file according to the debugging requirements for device debugging, a target compiled file with debugging operation functions is obtained. Then, the target basic input / output system file running on the device is generated using this target compiled file. In other words, the target basic input / output system file used for device debugging is obtained by modifying the reference compiled file used for controlling device operation. This avoids the code development and code compilation operations performed in generating the target basic input / output system file, which can solve the problem of low generation efficiency of basic input / output system files and achieve the effect of improving the generation efficiency of basic input / output system files.
[0096] As an optional embodiment, the modification module includes: a determining unit, configured to determine a reference string in the reference compilation file corresponding to the target debugging operation, wherein the reference string is a string used to characterize the debugging operation; and a modification unit, configured to modify the reference string according to the target debugging requirements to obtain the target compilation file.
[0097] As an optional embodiment, the modification unit is configured to: perform conversion processing on the reference string to obtain candidate files corresponding one-to-one with multiple substrings, wherein the candidate files are used to indicate the operation type of the debugging operation represented by the corresponding substring, and the reference string includes multiple substrings; filter out the target substring that matches the operation type of the target debugging operation from the multiple substrings according to the candidate files; import the target string into the reference compilation file at the character position corresponding to the target substring to obtain the target compilation file, wherein the target string is obtained by using a code generation script to generate target operation code for executing the target debugging operation, and compiling the target operation code according to the language format of the target device.
[0098] As an optional embodiment, the determining unit is configured to: determine a target index corresponding to the target debugging operation from indexes and debugging operations with corresponding relationships, wherein the target index is used to characterize the position of the reference string in the reference compilation file; and extract the reference string from the reference compilation file using the target index.
[0099] As an optional embodiment, the generation module includes: an acquisition unit for acquiring a target control file, wherein the target control file is used to manage the southbridge resources of the motherboard deployed on the target device; and a splicing unit for splicing the target control file and the target compilation file according to a target splicing order to obtain the target basic input / output system file.
[0100] As an optional embodiment, the acquisition unit is configured to: acquire a control file template, wherein the control file module records the management logic for managing the southbridge resources; and modify the control file template according to the target debugging requirements to obtain the target control file.
[0101] As an optional embodiment, the apparatus further includes: a signature module, configured to sign the target basic input / output system file using target signature information after the target compilation file is generated for running on the target device, wherein the target signature information is used to characterize the device attributes of the target device running the target basic input / output system file.
[0102] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0103] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when run.
[0104] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0105] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0106] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0107] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0108] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0109] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims
1. A method for generating basic input / output system files, characterized in that, include: Obtain a reference compilation file, wherein the reference compilation file is obtained by compiling the reference basic input / output system code according to the language format of the target device, and the reference basic input / output system code has the function of controlling the operation of the target device; The reference compilation file is modified according to the target debugging requirements to obtain the target compilation file, wherein the target debugging requirements are used to instruct the target device to perform target debugging operations, and the target compilation file is a file that has the function of implementing the target debugging operations; Generate a target basic input / output system file for running on the target device based on the target compilation file, wherein the target basic input / output system file is used to implement the target debugging operation on the target device. The generation of the target basic input / output system file for running on the target device based on the target compilation file includes: adding the device information of the device to be debugged to the character position corresponding to the debugging function in the target compilation file. The step of modifying the reference compilation file according to the target debugging requirements to obtain the target compilation file includes: determining a reference string in the reference compilation file corresponding to the target debugging operation, wherein the reference string is a string used to characterize the debugging operation; and modifying the reference string according to the target debugging requirements to obtain the target compilation file. The step of modifying the reference string according to the target debugging requirements to obtain the target compiled file includes: performing a conversion process on the reference string to obtain candidate files corresponding one-to-one with multiple substrings, wherein the candidate files are used to indicate the operation type of the debugging operation represented by the corresponding substring, and the reference string includes multiple substrings; filtering out the target substring that matches the operation type of the target debugging operation from the multiple substrings according to the candidate files; and importing the target string into the reference compiled file at the character position corresponding to the target substring to obtain the target compiled file, wherein the target string is obtained by using a code generation script to generate target operation code for executing the target debugging operation, and compiling the target operation code according to the language format of the target device; Determining the reference string corresponding to the target debugging operation in the reference compilation file includes: parsing the string in the reference compilation file and converting the string into descriptive information that describes the operation function of the string; determining the string corresponding to the descriptive information that characterizes the modulation operation as the reference string.
2. The method according to claim 1, characterized in that, Determining the reference string in the reference compilation file corresponding to the target debugging operation includes: The target index corresponding to the target debugging operation is determined from the corresponding indexes and debugging operations, wherein the target index is used to characterize the position of the reference string in the reference compilation file; The reference string is extracted from the reference compiled file using the target index.
3. The method according to claim 1, characterized in that, The step of generating a target basic input / output system file for running on the target device based on the target compilation file includes: Obtain the target control file, wherein the target control file is used to manage the southbridge resources of the motherboard deployed on the target device; The target control file and the target compilation file are concatenated according to the target concatenation order to obtain the target basic input / output system file.
4. The method according to claim 3, characterized in that, The acquisition of the target control file includes: Obtain a control file template, wherein the control file module records the management logic for managing the southbridge resources; The control file template is modified according to the target debugging requirements to obtain the target control file.
5. The method according to claim 1, characterized in that, After generating a target basic input / output system file for operation on the target device based on the target compilation file, the method further includes: The target basic input / output system file is signed using target signature information, wherein the target signature information is used to characterize the device attributes of the target device running the target basic input / output system file.
6. A device for generating basic input / output system files, characterized in that, include: The acquisition module is used to acquire a reference compilation file, wherein the reference compilation file is obtained by compiling the reference basic input / output system code according to the language format of the target device, and the reference basic input / output system code has the function of controlling the operation of the target device; The modification module is used to modify the reference compilation file according to the target debugging requirements to obtain the target compilation file, wherein the target debugging requirements are used to instruct the target device to perform target debugging operations, and the target compilation file is a file that has the function of implementing the target debugging operations; A generation module is used to generate a target basic input / output system file for running on the target device based on the target compilation file, wherein the target basic input / output system file is used to implement the target debugging operation on the target device. Generating the target basic input / output system file for running on the target device based on the target compilation file includes: adding the device information of the device to be debugged to the character position corresponding to the debugging function in the target compilation file; The modification module includes: a determining unit, configured to determine a reference string in the reference compilation file corresponding to the target debugging operation, wherein the reference string is a string used to characterize the debugging operation; and a modification unit, configured to modify the reference string according to the target debugging requirements to obtain the target compilation file. The modification unit is configured to: perform conversion processing on the reference string to obtain candidate files corresponding one-to-one with multiple substrings, wherein the candidate files are used to indicate the operation type of the debugging operation represented by the corresponding substring, and the reference string includes multiple substrings; filter out the target substring that matches the operation type of the target debugging operation from the multiple substrings according to the candidate files; import the target string into the reference compilation file at the character position corresponding to the target substring to obtain the target compilation file, wherein the target string is obtained by using a code generation script to generate target operation code for executing the target debugging operation, and compiling the target operation code according to the language format of the target device; Determining the reference string corresponding to the target debugging operation in the reference compilation file includes: parsing the string in the reference compilation file and converting the string into descriptive information that describes the operation function of the string; determining the string corresponding to the descriptive information that characterizes the modulation operation as the reference string.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method described in any one of claims 1 to 5.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 5.
Citation Information
Patent Citations
BIOS default value modification method, system and device and computer medium
CN110109679A
