Data processing method

By separating the target program and driver in the BIOS system and loading the target program only when needed provides functions, the problem of excessive BIOS firmware is solved and the memory space optimization is achieved.

CN120335873APending Publication Date: 2025-07-18LENOVO (BEIJING) LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510397990.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-31
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

The existing BIOS firmware refers to the same functional function in different drivers, resulting in too large firmware and occupying memory space.

Method used

By separating the target program and drivers during the BIOS system, the target program is only loaded when needed to provide functions, reducing duplicate function compilation and saving memory space.

Benefits of technology

It effectively reduces the size of BIOS firmware, saves memory space, and optimizes the storage efficiency of firmware programs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120335873A_ABST
    Figure CN120335873A_ABST
Patent Text Reader

Abstract

The invention discloses a data processing method, which comprises the following steps of: in response to operation of a first system, obtaining a target program; the first system can be used for guiding an operating system to start; in the process of running at least one drive program in the first system, at least running part of the target program to provide corresponding functions for the at least one drive program; wherein the at least one drive program does not comprise the target program.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electronic technologies, and in particular, to a data processing method and an electronic device. Background Art

[0002] Currently, the Basic Input / Output System (BIOS) will reference the same functional functions in different drivers, resulting in an overly large BIOS firmware compiled. Summary of the Invention

[0003] In view of this, embodiments of this application at least provide a data processing method.

[0004] The technical solution of the embodiments of this application is implemented as follows:

[0005] In a first aspect, embodiments of this application provide a data processing method, which includes:

[0006] In response to the operation of a first system, obtain a target program; the first system can be used to boot the operating system.

[0007] During the process of running at least one driver program in the first system, at least run a part of the target program to provide corresponding functions for the at least one driver program.

[0008] Wherein, the at least one driver program does not include the target program.

[0009] In a second aspect, embodiments of this application provide a data processing method, which includes:

[0010] Obtain a description file of the first system.

[0011] Based on the description file, determine the function information required during the running of at least one driver program in the first system.

[0012] Based on the function information, generate a target program; the at least one driver program does not include the target program.

[0013] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and do not limit the technical solution of this application. Brief Description of the Drawings

[0014] The drawings here are incorporated into the description and form a part of this description. These drawings show embodiments that conform to this application and are used together with the description to explain the technical solution of this application.

[0015] Figure 1a It is a schematic diagram of the scenario in the related art;

[0016] Figure 1b Schematic diagram one of the implementation process of a data processing method provided by an embodiment of the present application;

[0017] Figure 2 Schematic diagram of the implementation process of a data processing method provided by an embodiment of the present application Figure 2 ;

[0018] Figure 3 Schematic diagram of the implementation process of a data processing method provided by an embodiment of the present application Figure 3 ;

[0019] Figure 4 Schematic diagram of the implementation process of a data processing method provided by an embodiment of the present application Figure 4 ;

[0020] Figure 5 Schematic diagram of the implementation process of a data processing method provided by an embodiment of the present application Figure 5 ;

[0021] Figure 6 Schematic diagram of the implementation process of a data processing method provided by an embodiment of the present application Figure 6 ;

[0022] Figure 7 Schematic diagram one of the composition structure of an electronic device provided by an embodiment of the present application;

[0023] Figure 8 Schematic diagram of the composition structure of an electronic device provided by an embodiment of the present application Figure 2 ;

[0024] Figure 9 Schematic diagram of a hardware entity of an electronic device in an embodiment of the present application. Detailed implementation manners

[0025] In order to make the objectives, technical solutions and advantages of the present application clearer, the technical solutions of the present application will be further described in detail below with reference to the accompanying drawings and embodiments. The described embodiments should not be construed as limiting the present application. All other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of the present application.

[0026] In the following description, reference is made to "some embodiments", which describe a subset of all possible embodiments. However, it can be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.

[0027] The terms "first / second / third" involved are only used to distinguish similar objects and do not represent a specific order for the objects. Understandably, "first / second / third" can be interchanged in a specific order or sequence when allowed, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0028] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which this application belongs. The terms used herein are only for the purpose of describing this application and are not intended to limit this application.

[0029] Currently, the BIOS will reference the same functional functions in different drivers, resulting in an overly large BIOS firmware compiled. Exemplarily, as Figure 1a shown, the BIOS firmware 11 includes Driver - 1, Driver - 2, Driver - 3... Driver - n; among them, Driver - 1, Driver - 2, Driver - 3... Driver - n all need to call Function - 1 and Function - n during operation. When compiling the drivers, Function - 1 and Function - n are both compiled into Driver - 1, Driver - 2, Driver - 3... Driver - n. In this way, the same functions exist in different drivers in the compiled BIOS firmware, resulting in an overly large BIOS firmware.

[0030] To solve the above technical problems, an embodiment of the present application provides a data processing method. This data processing method can be applied to an electronic device, and this electronic device can be an electronic device including a connection mechanism; Exemplarily, this electronic device includes but is not limited to a smart phone, a tablet computer, a wearable device, a personal computer (PC), a netbook, etc. The implementation form of the present application is not fixedly limited.

[0031] Figure 1b FIG. 1 is a schematic flowchart of the implementation of a data processing method provided by an embodiment of the present application. As Figure 1b shown, this data processing method can be implemented through step S101 and step S102:

[0032] Step S101, in response to the operation of the first system, obtain a target program; the first system can be used to boot the operating system.

[0033] Here, the first system can be software used to boot the operating system during the startup phase of an electronic device. In the embodiments of the present application, when the electronic device starts up, the first system can detect and initialize hardware such as the central processing unit (CPU), memory, hard disk, and graphics card of the electronic device, and can boot the operating system after completing the detection and initialization of the hardware. Exemplarily, the first system can be the Basic Input / Output System (BIOS) or the Unified Extensible Firmware Interface (UEFI).

[0034] In the embodiments of the present application, the running time of the first system can be when the power of the electronic device is turned on, or when the startup control related to the first system is triggered after the electronic device starts up. It can be understood that during the normal operation of the operating system after the electronic device starts up, the user can start the first system through the startup control related to the first system.

[0035] In the embodiments of the present application, the target program can refer to a program used to provide corresponding functions for the driver program in the first system. Among them, the target program and the driver program can be the firmware programs corresponding to the first system, or the target program can be a firmware program different from the driver program.

[0036] Step S102, during the process of running at least one driver program in the first system, at least run a part of the target program to provide corresponding functions for the at least one driver program.

[0037] Among them, the at least one driver program does not include the target program. That is to say, during the program compilation phase, the driver program and the target program are not compiled together to form one program. The driver program can be a program used to boot the operating system in the first system, and the at least one driver program belongs to the firmware program of the first system.

[0038] In the embodiments of the present application, the number of functions that the target program can provide can be greater than the number of functions required by the driver program during the running phase. At this time, a part of the target program can be used to provide corresponding functions for the at least one driver program. In some embodiments, the number of functions that the target program can provide can also be equal to the number of functions required by the driver program during the running phase. At this time, all of the target program can be used to provide corresponding functions for the at least one driver program.

[0039] It can be understood that the first system is used to boot the operating system through at least one of its own drivers. During the running process of the driver, it needs to complete steps such as detecting and initializing the hardware through different functions. In the related art, the corresponding function programs are compiled into each driver, so the same function programs exist in different drivers, resulting in an overly large firmware program for the first system including multiple drivers. In the embodiments of the present application, the corresponding functions in the driver are stripped out, that is, the target program. During the running process of the driver, the target program not compiled together with the driver provides the corresponding functions for the driver. In this way, different drivers no longer have the same function programs, thereby reducing the size of the driver and saving the space of the memory for storing the firmware program of the first system.

[0040] In the embodiments of the present application, during the running process of at least one driver in the first system, at least a part of the target program is run to provide corresponding functions for at least one driver. In this way, by providing corresponding functions for the driver through the target program outside the driver, compared with providing corresponding functions through the function programs inside the driver in the related art, the driver in the embodiments of the present application can be separated from the function programs, so that different drivers do not have the same function programs, and further the size of the driver can be reduced, thereby saving the space of the memory for storing the firmware program of the first system.

[0041] In some embodiments, as Figure 2 shown, the above data processing method can also be implemented through step S201, and the above step S102 can be implemented through step S202:

[0042] Step S201, read the first program from the memory into the memory; the first program is the program corresponding to the first system, and at least includes at least one driver and a target program.

[0043] Here, the first program can be the firmware program corresponding to the first system, and this firmware program includes at least one driver and a target program.

[0044] In the embodiments of the present application, at least one driver and the target program can be pre-compiled to obtain the first program, and then the first program is stored in the memory. When the first system is running, the first program can be read from the memory into the memory. Among them, this memory can be a Read-Only Memory (ROM). Exemplarily, this read-only memory can be a Serial Peripheral Interface Read-Only Memory (SPI ROM).

[0045] Step S202, in response to the first system being in the target operating stage, run at least part of the target program based on the first program to provide corresponding functions for the driver corresponding to the target operating stage.

[0046] In the embodiments of the present application, the first system can operate in stages, and the first system runs the corresponding driver in different operating stages.

[0047] Exemplarily, when the first system is a BIOS system, the multiple operating stages of the first system may include Security Option (SEC), Pre EFI Initialization Environment, Driver Execution Environment (DXE), and Boot Device Selection (BDS).

[0048] In the embodiments of the present application, before the first system runs to the target operating stage, the target program can be determined in the first program first, and then when the first system runs to the target operating stage, at least part of the target program is run to provide corresponding functions for the driver corresponding to the target operating stage.

[0049] In some embodiments, "in response to the first system being in the target operating stage, run at least part of the target program based on the first program" in step S202 above can be implemented by at least one of step S2021 and step S2022:

[0050] Step S2021, in response to the first system being in the target operating stage, call at least part of the function functions in the target program; the first system has multiple operating stages, and the first program includes a target program.

[0051] In the embodiments of the present application, the first program includes a target program, that is to say, a target program provides corresponding functions for the drivers of all operating stages of the first system. Therefore, in the embodiments of the present application, the firmware program (i.e., the first program) of the first system includes at least one driver and a target program.

[0052] In some embodiments, during the operation of the first system, after completing one operation stage, the memory will release the corresponding executed program, that is, the target program will be released. Therefore, in order to continue to provide corresponding functions for the driver programs corresponding to other operation stages through the target program when the first system runs to other operation stages adjacent to the target operation stage, it is necessary to read the first program from the memory into the memory again before the first system runs to other operation stages. It can be understood that since the target program and at least one driver program belong to a firmware program (i.e., the first program), the entire first program needs to be read into the memory so that the driver programs corresponding to other operation stages can obtain corresponding functions from the target program in the first program.

[0053] Step S2022, in response to the first system being in the target operation stage, determine the target program corresponding to the target operation stage, and call at least some of the function functions in the target program.

[0054] Here, the function function refers to a function used to provide corresponding functions for the driver program.

[0055] In the embodiments of the present application, the first program includes multiple target programs. That is to say, corresponding functions are provided for the driver programs of different operation stages of the first system through different target programs. Therefore, in the embodiments of the present application, the firmware program (i.e., the first program) of the first system includes at least one driver program and multiple target programs.

[0056] In the embodiments of the present application, when the first system is in the target operation stage, the target program corresponding to the target operation stage can be determined from multiple target programs, and then at least some of the function functions in the target program are called.

[0057] In some embodiments, because different target programs correspond to different operation stages of the first system, when the first system finishes running the target operation stage, the memory will only release the target program corresponding to the target operation stage. Therefore, when the first system runs to other operation stages adjacent to the target operation stage, the target program corresponding to the other operation stage can be continuously determined, and at least some of the function functions in the target program are called.

[0058] In some embodiments, as Figure 3 shown, the above data processing method can also be implemented through step S301 and step S302, and the above step S102 can be implemented through step S303:

[0059] Step S301, read the first program from the memory into the memory; the first program includes at least the at least one driver program.

[0060] Step S302: Before the first system enters the target operation stage, read the target program from the memory into the memory.

[0061] In the embodiments of the present application, the first program includes at least one driver program, and the target program is not in the first program. Therefore, during the program compilation stage, it is necessary to compile at least one driver program separately to obtain the first program, and then compile the target program.

[0062] In the embodiments of the present application, the first program including at least one driver program can be read from the memory into the memory first so that the first system can be started normally. Before the first system runs to the target operation stage, the target program is read from the memory into the memory so that when the first system runs to the target operation stage, the target program can provide corresponding functions for the driver program corresponding to the target operation stage.

[0063] Step S303: In response to the first system being in the target operation stage, run at least part of the target program to provide corresponding functions for the driver program corresponding to the target operation stage.

[0064] Here, the target program can be a single program, or the number of target programs can be multiple.

[0065] In the embodiments of the present application, when the target program is a single program, all of the target program can be used to provide corresponding functions for the driver program corresponding to the target operation stage. When the number of target programs is also multiple, the target program corresponding to the target operation stage is used to provide corresponding functions for the driver program corresponding to the target operation stage.

[0066] In some embodiments, the above step S302 can be implemented by at least one of step S3021 and step S3022:

[0067] Step S3021: Before the first system enters the target operation stage, read the target program from the memory into the memory; the first system has multiple operation stages, and all target operation stages correspond to one target program.

[0068] In the embodiments of the present application, one target program provides corresponding functions for the driver programs of all operation stages of the first system. Therefore, in the embodiments of the present application, the firmware program (i.e., the first program) of the first system includes at least one driver program, and one target program is another firmware program.

[0069] In some embodiments, after the first system finishes running the target running stage, the target program is released from the memory. Therefore, before the first system runs to other running stages adjacent to the target running stage, it is necessary to read the target program from the read memory into the memory again. Then, when the first system runs to other running stages adjacent to the target running stage, at least part of the target program is run to provide corresponding functions for the driver programs corresponding to the other running stages.

[0070] In some embodiments, at least two target running stages correspond to different target programs, and the multiple target programs are a firmware program.

[0071] In the embodiments of the present application, the difference from the embodiments of step S3021 is that before the first system runs to other running stages adjacent to the target running stage, it is not necessary to read the target program from the read memory into the memory again. Instead, when the first system runs to other running stages adjacent to the target running stage, the target program corresponding to the other running stage is run to provide corresponding functions for the driver programs corresponding to the other running stages.

[0072] It can be understood that in the embodiments of step S3021, all target running stages correspond to one target program, and the target program is a firmware program. Therefore, before running to the target running stage, it is necessary to read the target program into the memory first. Then, when running to the target running stage, the corresponding functions are provided for the driver program of the target running stage through the target program. When the target running stage is completed, the target program is released, so there is no target program in the memory. Therefore, before running to other running stages adjacent to the target running stage, it is necessary to write the target program into the memory again to provide corresponding functions for the driver programs of other running stages during the process of running other running stages. That is to say, in this embodiment, after each running stage is completed, it is necessary to write the target program into the memory again.

[0073] When at least two target running stages correspond to different target programs, and the multiple target programs are a firmware program, before running to the target running stage, it is necessary to read the target program into the memory first. Then, when running to the target running stage, the corresponding functions are provided for the driver program of the target running stage through the target program. When the target running stage is completed, the target program corresponding to the target running stage is released, and the target programs of other running stages are still in the memory. Therefore, during the process of running other running stages, the corresponding functions are provided for the driver programs of other running stages through the target programs of these other running stages. That is to say, in this embodiment, only by writing the target program into the memory once, the corresponding functions can be provided for the driver programs of different running stages.

[0074] Step S3022, before the first system enters the target operation stage, determine the target program corresponding to the target operation stage, and read the target program from the memory into the memory; the first system has multiple operation stages, and at least two target operation stages correspond to different target programs.

[0075] In the embodiments of the present application, at least two target operation stages correspond to different target programs, and the multiple target programs are different firmware programs.

[0076] It can be understood that since different target programs are not in the first program, it is necessary to determine the target program corresponding to the target operation stage in the memory before entering the target operation stage, and then read the target program corresponding to the target operation stage into the memory, so as to provide corresponding services for the driver program of the target operation stage through the target program corresponding to the target operation stage.

[0077] In some embodiments, before the first system enters other operation stages adjacent to the target operation stage, determine the target programs corresponding to the other operation stages, and read the target programs corresponding to the other operation stages from the memory into the memory; in response to the first system being in the other operation stages, run at least part of the target programs corresponding to the other operation stages to provide corresponding functions for the driver programs corresponding to the other operation stages.

[0078] It can be understood that in this embodiment, at least two target operation stages correspond to different target programs, and the multiple target programs are different firmware programs. Therefore, before running to the target operation stage, it is necessary to first read the target program corresponding to the target operation stage into the memory, and then when running to the target operation stage, provide corresponding functions for the driver program of the target operation stage through the target program corresponding to the target operation stage. When the target operation stage is completed, the target program corresponding to the target operation stage is released. Before running to other operation stages adjacent to the target operation stage, it is necessary to write the target programs corresponding to the other operation stages into the memory, so as to provide corresponding functions for the driver programs corresponding to the other operation stages through the target programs corresponding to the other operation stages during the process of running the other operation stages. That is to say, in this embodiment, before the first system enters each operation stage, it is necessary to read the target program corresponding to each operation stage from the memory into the memory.

[0079] Figure 4 Schematic diagram of the implementation process of a data processing method provided by the embodiments of the present application Figure 4 , such as Figure 4 shown, this data processing method can be implemented through steps S401 to S403:

[0080] Step S401, obtain the description file of the first system.

[0081] Here, the description file is used to define the functions required by the drivers in the first system. That is, by obtaining the description file of the first system, the function functions to be called by each driver of the first system can be determined.

[0082] Exemplarily, when the first system is a BIOS system, the description file of the first system can be a DSC (Description) file.

[0083] Step S402: Based on the description file, determine the function information required during the operation of at least one driver in the first system.

[0084] Here, the function information can be the attribute information of the function functions called during the operation of at least one driver.

[0085] In the embodiments of the present application, the description file stores the correspondence between the attribute information of different function functions and different drivers. Through multiple correspondences, the function information required during the operation of at least one driver in the first system can be determined.

[0086] Step S403: Based on the function information, generate a target program; the target program is not included in the at least one driver.

[0087] In the embodiments of the present application, the function functions can be compiled based on the function information to obtain the target program.

[0088] In the embodiments of the present application, the target program is used to provide corresponding functions for at least one driver during the operation of at least one driver in the first system.

[0089] It can be understood that in the related art, the function functions with corresponding functions are compiled together with the corresponding drivers. In this way, when different drivers require the same function, the same function function will be compiled into different driver functions, resulting in an overly large firmware of the first system. However, in the embodiments of the present application, the function functions corresponding to the functions required by different drivers are compiled into a target program. That is to say, the driver functions do not contain the function functions corresponding to the required functions, which can reduce the size of the firmware of the first system.

[0090] In some embodiments, the target program and at least one driver can jointly form the firmware program of the first system.

[0091] In some embodiments, at least one driver forms the firmware program of the first system, and the target program belongs to a firmware program different from the firmware program of the first system.

[0092] In the embodiments of the present application, function information required during the operation of at least one driver program in the first system is determined through the description file of the first system; then, based on the function information, a target program is generated. In this way, by generating a target program that does not belong to the driver program, the target program other than the driver program can provide corresponding functions for the driver program. Compared with providing corresponding functions through the function programs within the driver program in the related art, the driver program in the embodiments of the present application can be separated from the function program, so that different driver programs will not have the same function program, thereby reducing the size of the driver program and further saving the space of the memory for storing the firmware program of the first system.

[0093] In some embodiments, as Figure 5 shown, the above step S402 can be implemented through steps S501 to S503:

[0094] Step S501, in the description file, obtain the path information corresponding to multiple basic libraries.

[0095] Here, the basic library can be a pre-written code set that provides basic functions and tools. Exemplarily, when the first system is a BIOS system, the basic library can be BaseLib (Base Library). The path information of the basic library can refer to the relative path of the basic library. Exemplarily, the relative path of the basic library can be: BaseLib|MdePkg / Library / BaseLib / BaseLib.inf.

[0096] Step S502, for each of the basic libraries, based on the path information of the basic library, obtain the first module information file of the basic library.

[0097] Here, the first module information file can be the configuration file of the basic library.

[0098] In some embodiments, when the first system is a BIOS system, the first module information file can be INF (Information file). Exemplarily, INF can include the following information:

[0099] [Defines]

[0100] INF_VERSION = 0x00010005

[0101] BASE_NAME = BaseLib

[0102] MODULE_UNI_FILE = BaseLib.uni

[0103] FILE_GUID = 27d67720 - ea68 - 48ae - 93da - a3a074c90e30

[0104] MODULE_TYPE = BASE

[0105] VERSION_STRING = 1.1

[0106] LIBRARY_CLASS = BaseLib

[0107] [Sources]

[0108] CheckSum.c

[0109] SwitchStack.c

[0110] SwapBytes64.c

[0111] SwapBytes32.c

[0112] Step S503, for each of the base libraries, obtain the function information of the base library in the first module information file of the base library; the function information is used to characterize the attribute information of the functional functions in the base library.

[0113] In the embodiments of the present application, the first module information file of the base library will describe the code file of the functional function and the attribute file of the functional function referenced by the base library, and the code file of the functional function and the attribute file of the functional function can be used as the attribute information of the functional functions in the base library.

[0114] In the embodiments of the present application, first, through the description file of the first system, obtain the path information corresponding to multiple base libraries respectively; then, based on the path information of the base libraries, obtain the first module information file of the base libraries; finally, in the first module information file of the base libraries, obtain the attribute information of the base libraries used to characterize the functional functions in the base libraries. In this way, through the description file of the first system, the attribute information of the functional functions corresponding to each base library can be accurately obtained, so that during the compilation process, based on the functions required by the driver of the first system, the corresponding base library can be determined, and then the target program can be compiled based on the base library, improving the accuracy of compiling the target program.

[0115] In some embodiments, the above step S403 can be implemented through step S4031:

[0116] Step S4031, based on the function information corresponding to the multiple base libraries respectively, compile the functional functions of the multiple base libraries to generate a target program including the functional functions of the multiple base libraries.

[0117] In the embodiments of the present application, the functional functions of multiple basic libraries can be compiled together to form a target program. That is to say, in the running stage, based on a target program, corresponding functions can be provided for at least one driver in the first program.

[0118] In the embodiments of the present application, the functional functions of multiple basic libraries are compiled through the function information respectively corresponding to the multiple basic libraries to generate a target program including the functional functions of the multiple basic libraries. In this way, it is possible to provide corresponding functions for at least one driver in the first program through a target program, thereby reducing the complexity of running the first system.

[0119] In some embodiments, the function information of the basic library includes the code file of the functional function in the basic library and the attribute file of the functional function; as Figure 6 shown, the above step S403 can be implemented through steps S601 to S604:

[0120] Step S601, based on the library attribute information respectively corresponding to the multiple basic libraries, determine the target basic libraries applicable to the running stage in the multiple basic libraries.

[0121] Here, the library attribute information of the basic library is used to define the library name of the basic library and the type corresponding to the basic library. The type of the basic library can represent the running stage to which the basic library is applied. Exemplarily, in the case where the first system is a BIOS system, the library attribute information of the basic library can be LIBRARY_CLASS. LIBRARY_CLASS = BaseLib|DXE_DRIVERPEIM indicates that the basic library is applicable to PEI and DXE.

[0122] In some embodiments, if the library attribute information of the basic library only defines the library name of the basic library, it can be indicated that the functional functions in the basic library are applicable to all running stages of the first system.

[0123] In the embodiments of the present application, the multiple basic libraries can be classified through the library attribute information respectively corresponding to the multiple basic libraries, so as to obtain the basic libraries corresponding to different running stages.

[0124] Step S602, based on the attribute file of the target basic library, determine the function names of the functional functions in the target basic library.

[0125] Here, the attribute file of the target basic library can be the header file of the basic library.

[0126] In the embodiments of the present application, through the attribute file of the target basic library, the function names of the functional functions in the target basic library can be determined.

[0127] Step S603: Define the function names of the functions in the target program during the running stage based on the function names of the functions in the target basic library.

[0128] Step S604: Based on the function names of the functions in the target program during the running stage, link the code files of the functions in the function code file to generate a target program corresponding to the running stage.

[0129] In the embodiments of the present application, the location information of a function in the function code file can be determined through the function name of the function in the target basic library, and then the function names of the functions in the target program during the running stage are defined based on the function names of the functions in the target basic library; during the compilation stage, the c language compiler can link the code files of the functions based on the redefined function names and the location information of the functions in the function code file, so as to obtain a target program corresponding to the running stage.

[0130] Exemplarily, when the property file of the target basic library is BaseLib.h and BaseLib.h declares the function StrnLenS, the actual code of the function StrnLenS is in SafeString.c (SafeString.c is included in the [Source] section of BaseLib.inf). If BaseLibFunc is the service driver name, then BaseLibFunc.StrnLenS can be defined as StrnLenS, and during the compilation stage, the c language compiler will automatically link (Link) to StrnLenS in SafeString.c.

[0131] Exemplarily, the above steps S503 and S504 can be implemented by the following code:

[0132]

[0133] In the embodiments of the present application, the corresponding target programs can be compiled for different running stages of the first system through the above steps.

[0134] Exemplarily, when the first system is a BIOS system, SEC and the pre-EFI initialization environment run in the same running environment, so they share a target program; DXE and BDS run in the same running environment, so they share a target program; in addition, after entering the BIOS system, the SMM (System management mode) environment needs to be retained, so SMM corresponds to a target program. The compilation of the above three target drivers can refer to the following code:

[0135]

[0136] In the embodiments of the present application, based on the library attribute information corresponding to multiple basic libraries respectively, a target basic library applicable to the running stage is determined from the multiple basic libraries; based on the attribute file of the target basic library, the function names of the functional functions in the target basic library are determined; based on the function names of the functional functions in the target basic library, the function names of the functional functions in the target program in the running stage are defined; based on the function names of the functional functions in the target program in the running stage, the code files of the functional functions are linked in the function code file to generate a target program corresponding to the running stage. In this way, the functional functions required by the driver programs corresponding to different running stages can be separated from the driver programs, and target programs corresponding to different running stages are generated, so that there will be no identical functional programs in different driver programs, and thus the size of the driver programs can be reduced, thereby saving the space of the memory for storing the firmware program of the first system.

[0137] In some embodiments, for each of the above-mentioned running stages, the above method can also be implemented through the following steps:

[0138] Step S11, obtain a second module information file of the driver program running in the running stage. The second module information file is used to characterize the functional functions required by the driver program during the running process.

[0139] Step S12, create a calling function for the driver program based on the second module information file.

[0140] Among them, the calling function is used to call the functional functions in the target program corresponding to the running stage when the driver program is running in the running stage.

[0141] Exemplarily, when the first system is a BIOS system, the second module information file may be an INF file.

[0142] In the embodiments of the present application, the basic library corresponding to the driver program can be determined through the second module information file. Therefore, a calling function can be created for the driver program through the second module information file, and the calling function can call the functional functions in the basic library corresponding to the driver program.

[0143] Exemplarily, the INF file in the running stage can be represented by the following code:

[0144]

[0145]

[0146] In the embodiments of the present application, a call function for calling a function in a target program corresponding to the running stage is created for the driver by using a second module information file of the driver running in the running stage when the driver runs in the running stage. In this way, it is possible to call a function in the target program during the running of the driver, so that the running of the first system can be achieved through the separated driver function and the target function.

[0147] The following describes the application of the data processing method provided by the embodiments of the present application in an actual scenario:

[0148] Currently, the BIOS system will reference the same function in different drivers, resulting in an overly large BIOS firmware after compilation.

[0149] To solve the technical problems in the related art, the embodiments of the present application provide a data processing method, which can be implemented through steps S701 to S705:

[0150] Step S701, describe the relative path of BaseLib in the DSC file.

[0151] Among them, the DSC file includes relative paths of multiple types of BaseLib, and different types of BaseLib correspond to different running stages.

[0152] Step S702, obtain the INF file corresponding to BaseLib based on the path of BaseLib.

[0153] Among them, the corresponding INF file will describe the C files (corresponding to the function codes) referenced by this library and the provided header files, and the function names are included in the header files.

[0154] Step S703, create different service drivers according to the library file type LIBRARY_CLASS.

[0155] Among them, LIBRARY_CLASS will define the library name and type. If only the library name is indicated, it is applicable to all stages.

[0156] In the embodiments of the present application, functions provided by a service driver can be defined according to function definitions declared in a header file. Exemplarily, for example, the library header file BaseLib.h declares a function StrnLenS, and the actual code of this function is in SafeString.c (SafeString.c is included in the [Source] section of BaseLib.inf). If BaseLibFunc is the name of the service driver, then define BaseLibFunc.StrnLenS as StrnLenS. During the compilation stage, the C language compiler will automatically link to StrnLenS in SafeString.c.

[0157] Step S704: Compile other drivers.

[0158] In the embodiments of the present application, each of the other drivers also has an INF file, and all libraries required by the driver will be declared in [LibraryClasses] in the INF. Create a BaseLibInitConstructor function for the other driver according to [LibraryClasses]. The BaseLibInitConstructor function is used to obtain the installed service driver, and library functions required to be called in the other driver will be initialized inside BaseLibInitConstructor. Exemplarily, taking DXE as an example, the BaseLib service is obtained through gBS->LocateProtocol and the function is initialized.

[0159] Step S705: Before the BIOS runs to the corresponding stage, install the services for the corresponding stage.

[0160] In the embodiments of the present application, before each other driver runs, BaseLibInitConstructor is run first to obtain the required services and initialize the functions.

[0161] Figure 7 As shown in the schematic structural diagram of a data processing device provided by the embodiments of the present application, Figure 7 as shown, the data processing device 700 includes a first obtaining unit 701 and a running unit 702; wherein,

[0162] The first obtaining unit 701 is configured to obtain a target program in response to the running of the first system; the first system can be used to boot the operating system.

[0163] The running unit 702 is configured to at least run a part of the target program during the process of running at least one driver program in the first system, so as to provide corresponding functions for the at least one driver program.

[0164] Among them, the at least one driver does not include the target program.

[0165] In some embodiments, the data processing device 700 further includes a reading unit; the reading unit is configured to read a first program from a memory into a memory; the first program is a program corresponding to the first system, and at least includes at least one driver and a target program; the running unit 702 is further configured to, in response to the first system being in a target running stage, run at least part of the target program based on the first program, so as to provide corresponding functions for the driver corresponding to the target running stage.

[0166] In some embodiments, the running unit 702 is further configured to, in response to the first system being in a target running stage, call at least part of the function functions in the target program; the first system has multiple running stages, and the first program includes a target program; in response to the first system being in a target running stage, determine the target program corresponding to the target running stage, and call at least part of the function functions in the target program; the first system has multiple running stages, and the first program includes multiple target programs.

[0167] In some embodiments, the reading unit is further configured to read a first program from a memory into a memory; the first program at least includes the at least one driver; before the first system is in a target running stage, read the target program from the memory into the memory; the running unit 702 is further configured to, in response to the first system being in a target running stage, run at least part of the target program, so as to provide corresponding functions for the driver corresponding to the target running stage.

[0168] In some embodiments, the reading unit is further configured to perform at least one of the following: before the first system is in a target running stage, read the target program from the memory into the memory; the first system has multiple running stages, and all target running stages correspond to one target program; before the first system is in a target running stage, determine the target program corresponding to the target running stage, and read the target program from the memory into the memory; the first system has multiple running stages, and at least two target running stages correspond to different target programs.

[0169] Figure 8 The following is a schematic structural diagram of a data processing device provided by an embodiment of the present application, as Figure 7 shown, the data processing device 800 includes a second obtaining unit 801, a determining unit 802, and a generating unit 803; among them,

[0170] The second obtaining unit 801 is configured to obtain a description file of the first system;

[0171] A determining unit 802, configured to determine function information required during the running of at least one driver in the first system based on the description file;

[0172] A generating unit 803, configured to generate a target program based on the function information; the target program is not included in the at least one driver.

[0173] In some embodiments, the determining unit 802 is further configured to obtain path information corresponding to multiple basic libraries in the description file; for each of the basic libraries, obtain a first module information file of the basic library based on the path information of the basic library; for each of the basic libraries, obtain function information of the basic library in the first module information file of the basic library; the function information is used to characterize attribute information of function functions in the basic library.

[0174] In some embodiments, the generating unit 803 is further configured to compile function functions of the multiple basic libraries based on the function information corresponding to the multiple basic libraries respectively, and generate a target program including the function functions of the multiple basic libraries.

[0175] In some embodiments, the function information of the basic library includes a code file of a function function in the basic library and an attribute file of the function function; for each running stage during the running of the at least one driver, the generating unit 803 is further configured to determine a target basic library applicable to the running stage in the multiple basic libraries based on the library attribute information corresponding to the multiple basic libraries respectively; determine a function name of a function function in the target basic library based on the attribute file of the target basic library; define a function name of a function function in the target program of the running stage based on the function name of the function function in the target basic library; link the code file of the function function in the function code file based on the function name of the function function in the target program of the running stage, and generate a target program corresponding to the running stage.

[0176] In some embodiments, for each running stage, the data processing device 800 further includes an obtaining unit and a creating unit; the obtaining unit is configured to obtain a second module information file of a driver running in the running stage; the second module information file is used to characterize function functions required during the running of the driver; the creating unit is configured to create a calling function for the driver based on the second module information file; wherein, the calling function is used to call a function function in the target program corresponding to the running stage when running the driver in the running stage.

[0177] The description of the above device embodiments is similar to that of the above method embodiments and has similar beneficial effects to those of the method embodiments. In some embodiments, the functions or modules included in the device provided in the embodiments of the present application can be used to execute the methods described in the above method embodiments. For the technical details not disclosed in the device embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.

[0178] It should be noted that in the embodiments of the present application, if the above data processing method is implemented in the form of software function modules and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present application, in essence, or the part that contributes to the related technology, can be embodied in the form of a software product. The software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods of the various embodiments of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), magnetic disks, or optical discs that can store program codes. In this way, the embodiments of the present application are not limited to any specific hardware, software, or firmware, or any combination of hardware, software, and firmware.

[0179] The embodiments of the present application provide a computer device, including a memory and a processor. The memory stores a computer program that can run on the processor, and when the processor executes the program, it implements some or all of the steps in the above method.

[0180] The embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements some or all of the steps in the above method. The computer-readable storage medium can be transient or non-transient.

[0181] The embodiments of the present application provide a computer program, including computer-readable code. When the computer-readable code runs in a computer device, the processor in the computer device executes to implement some or all of the steps in the above method.

[0182] An embodiment of the present application provides a computer program product. The computer program product includes a non-transitory computer-readable storage medium storing a computer program. When the computer program is read and executed by a computer, some or all of the steps in the above method are implemented. The computer program product can be specifically implemented in a manner of hardware, software, or a combination thereof. In some embodiments, the computer program product is specifically embodied as a computer storage medium. In other embodiments, the computer program product is specifically embodied as a software product, such as a Software Development Kit (SDK), etc.

[0183] It should be noted here that: the above descriptions of the various embodiments tend to emphasize the differences between the various embodiments, and their similarities or similarities can be referred to each other. The descriptions of the above device, storage medium, computer program, and computer program product embodiments are similar to the descriptions of the above method embodiments and have beneficial effects similar to those of the method embodiments. For the technical details not disclosed in the embodiments of the device, storage medium, computer program, and computer program product of the present application, please refer to the descriptions of the method embodiments of the present application for understanding.

[0184] Figure 9 It is a schematic diagram of a hardware entity of an electronic device in an embodiment of the present application, as Figure 9 shown. The hardware entity of the electronic device 900 includes: a processor 901, a communication interface 902, and a memory 903, where:

[0185] The processor 901 generally controls the overall operation of the electronic device 900, and the overall operation can be to implement the data processing method provided by the embodiment of the present application.

[0186] The communication interface 902 can enable the electronic device 900 to communicate with other terminals or servers through a network.

[0187] The memory 903 is configured to store instructions and applications executable by the processor 901, and can also cache data to be processed or already processed by the processor 901 and each module in the electronic device 900 (for example, image data, audio data, voice communication data, and video communication data), and can be implemented by a flash memory (FLASH) or a random access memory (Random Access Memory, RAM). Data transmission can be performed between the processor 901, the communication interface 902, and the memory 903 through a bus 904.

[0188] An embodiment of the present application provides a computer storage medium. The computer storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the data processing method in any of the above embodiments.

[0189] It should be noted here that the descriptions of the above storage medium and device embodiments are similar to those of the above method embodiments and have similar beneficial effects to the method embodiments. For the technical details not disclosed in the storage medium and device embodiments of the present application, please refer to the descriptions of the method embodiments of the present application for understanding.

[0190] The above-mentioned processor can be at least one of an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a central processing unit (CPU), a controller, a microcontroller, and a microprocessor. It can be understood that other electronic devices for implementing the functions of the above-mentioned processor are also possible, and the embodiments of the present application do not make specific limitations.

[0191] The above-mentioned computer storage medium / memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a ferromagnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM), etc.; it can also be various terminals including one or any combination of the above memories, such as a mobile phone, a computer, a tablet device, a personal digital assistant, etc.

[0192] It should be understood that the "one embodiment" or "an embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, the phrases "in one embodiment" or "in an embodiment" that appear throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the magnitude of the sequence numbers of the above steps / processes does not mean the order of execution, and the order of execution of each step / process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application. The sequence numbers of the embodiments of the present application are only for description and do not represent the advantages or disadvantages of the embodiments.

[0193] It should be noted that in this text, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the phrase "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device including such element.

[0194] The above are only the implementation manners of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of changes or substitutions, which should all be covered within the protection scope of the present application.

Claims

1. A data processing method, the method comprising: Obtaining a target program in response to the operation of a first system; The first system can be used to boot an operating system; During the process of running at least one driver in the first system, at least a part of the target program is run to provide corresponding functions for the at least one driver; Wherein, the at least one driver does not include the target program.

2. The method according to claim 1, the method further comprising: Reading a first program from a memory into a memory; The first program is a program corresponding to the first system, and at least includes at least one driver and a target program; The step of during the process of running at least one driver in the first system, at least running a part of the target program to provide corresponding functions for the at least one driver includes: In response to the first system being in a target running stage, running at least a part of the target program based on the first program to provide corresponding functions for the driver corresponding to the target running stage.

3. The method according to claim 2, the step of in response to the first system being in a target running stage, running at least a part of the target program based on the first program includes at least one of the following: In response to the first system being in a target running stage, calling at least a part of the function functions in the target program; the first system has multiple running stages, and the first program includes one target program; In response to the first system being in a target running stage, determining the target program corresponding to the target running stage, and calling at least a part of the function functions in the target program; the first system has multiple running stages, and the first program includes multiple target programs.

4. The method according to claim 1, the method further comprising: Reading a first program from a memory into a memory; The first program at least includes the at least one driver; Before the first system is in a target running stage, reading the target program from the memory into the memory; The step of during the process of running at least one driver in the first system, at least running a part of the target program to provide corresponding functions for the at least one driver includes: In response to the first system being in a target running stage, running at least a part of the target program to provide corresponding functions for the driver corresponding to the target running stage.

5. The method according to claim 4, the step of before the first system is in a target running stage, reading the target program from the memory into the memory includes at least one of the following: Before the first system is in a target running stage, reading the target program from the memory into the memory; the first system has multiple running stages, and all target running stages correspond to one target program; Before the first system is in a target running stage, determining the target program corresponding to the target running stage, and reading the target program from the memory into the memory; The first system has multiple running stages, and at least two target running stages correspond to different target programs.

6. A data processing method, the method comprising: Obtain the description file of the first system; Based on the description file, determine the function information required during the operation of at least one driver in the first system; Based on the function information, generate a target program; The at least one driver does not include the target program.

7. The method according to claim 6, wherein the determining the function information required during the operation of at least one driver in the first system based on the description file includes: In the description file, obtain the path information corresponding to multiple basic libraries; For each of the basic libraries, based on the path information of the basic library, obtain the first module information file of the basic library; For each of the basic libraries, in the first module information file of the basic library, obtain the function information of the basic library; The function information is used to characterize the attribute information of the functional functions in the basic library.

8. The method according to claim 7, wherein the generating a target program based on the function information includes: Based on the function information corresponding to the multiple basic libraries respectively, compile the functional functions of the multiple basic libraries to generate a target program including the functional functions of the multiple basic libraries.

9. According to the method described in claim 7, the function information of the basic library includes the code file of the function in the basic library and the attribute file of the function; For each operation stage during the operation of the at least one driver, the generating a target program based on the function information includes: Based on the library attribute information corresponding to the multiple basic libraries respectively, determine the target basic library applicable to the operation stage among the multiple basic libraries; Based on the attribute file of the target basic library, determine the function names of the functional functions in the target basic library; Based on the function names of the functional functions in the target basic library, define the function names of the functional functions in the target program of the operation stage; Based on the function names of the functional functions in the target program of the operation stage, link the code files of the functional functions in the function code file to generate a target program corresponding to the operation stage.

10. The method according to claim 9, for each of the operation stages, the method further includes: Obtain the second module information file of the driver running in the operation stage; The second module information file is used to characterize the functional functions required during the operation of the driver; Based on the second module information file, create a call function for the driver; Wherein, the call function is used to call the functional functions in the target program corresponding to the operation stage when the driver runs in the operation stage.