Compiling verification system generation method, driving program compiling verification method, system, device, equipment, medium and program product

By generating operating system container images, obtaining kernel files, and configuring container compilation environments, writing automated verification programs to verify drivers in environments of different operating systems and kernel versions, solving the difficulty in automating verification of driver compatibility in the prior art is to solve the problem of automated verification of driver compatibility in existing technologies. The problem of this achieves efficient driver adaptation and verification.

CN119415441APending Publication Date: 2025-02-11GLENFLY TECH CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411448675.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-16
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

It is difficult for the existing technology to automatically verify the compatibility of the same driver in different operating systems, kernel versions and compilation toolchain environments, resulting in a lot of tedious verification and testing work required by R&D and testers.

Method used

By generating operating system container images, obtaining kernel files, and configuring container compilation environments, writing automated verification programs to verify drivers in environments of different operating systems and kernel versions to form a compilation verification system.

Benefits of technology

It realizes automated verification of driver compatibility, reduces the workload of R&D and testers, improves the efficiency of driver adaptation and verification, and ensures the quality of drivers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415441A_ABST
    Figure CN119415441A_ABST
Patent Text Reader

Abstract

The invention relates to a compilation verification system generation method, a driver compilation verification method, a driver compilation verification system, a driver compilation verification device, a driver compilation verification device, equipment, a medium and a product. The method comprises the following steps: generating each operating system container mirror image based on each target operating system required to be supported by each driver; obtaining a kernel file required for compiling a driving program according to the kernel version used by each target operating system; generating a container compiling environment corresponding to each operating system container mirror image based on each tool chain required for compiling each driving program; determining a written automatic verification program which is used for verifying each drive program by using each kernel version and each tool chain based on each kernel file in a container compiling environment corresponding to each operating system container mirror image; and obtaining a compiling verification system based on the operating system container mirror image, the kernel file, the container compiling environment and the automatic verification program. By adopting the method, the driver can be automatically verified to adapt to different operating systems, kernel versions and compiling tool chain environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of driver technology, and in particular to a compilation verification system generation method, a driver program compilation verification method, system, device, computer equipment, storage medium and computer program product. Background Art

[0002] For numerous Linux operating system (OS) releases and kernel versions, if the same driver code needs to be compiled, verified and adapted on these different OS and kernel versions, since the compilation tool chains and kernel header files used by these different operating systems may be different, the function interfaces, data structures and compilation options used by the driver may also be different. Therefore, verification and adaptation are required on each OS / kernel version to ensure the compatibility of the driver code with different compilation environments of different operating systems.

[0003] The driver program is developed and maintained by multiple people in the team. It is necessary to ensure support for multiple kernel versions and operating systems at the same time, and to ensure that the new driver changes made by the R&D personnel do not destroy support for the original OS / kernel versions. This requires R&D and testers to perform a lot of tedious verification and testing work.

[0004] In a driver development environment, developers usually need to install multiple operating system versions and multiple kernel versions on several hard disks, and also need to configure the compilation environment required for the driver in the system installed on each hard disk.

[0005] When multiple people in a team develop a driver, each developer needs to repeatedly set up and configure the OS / kernel environment. This process is very cumbersome and different developers are prone to inconsistent environments, which leads to different verification results. Summary of the invention

[0006] Based on this, it is necessary to provide a compilation verification system generation method, driver compilation verification method, system, device, computer equipment, computer-readable storage medium and computer program product that can automatically verify that the same driver is adaptable to different operating systems, different kernel versions and different compilation tool chain environments in response to the above technical problems.

[0007] In a first aspect, the present application provides a compilation verification system generation method, the method comprising:

[0008] Generate container images for each operating system based on the target operating systems that each driver needs to support;

[0009] According to the kernel version used by each of the target operating systems, obtaining the kernel file required for compiling the driver;

[0010] Based on the tool chains required for compiling the drivers, a container compilation environment corresponding to each operating system container image is generated;

[0011] Determine an automated verification program to be written, wherein the automated verification program is used to verify each of the drivers in the container compilation environment corresponding to each of the operating system container images, based on each of the kernel files, using each of the kernel versions and each of the tool chains;

[0012] A compilation verification system is obtained based on the operating system container image, the kernel file, the container compilation environment and the automated verification program.

[0013] In one embodiment, generating each operating system container image based on each target operating system that each driver needs to support includes:

[0014] Determining at least one general operating system based on the compilation-related versions used by the target operating systems;

[0015] Based on each of the general operating systems, each operating system container image is generated.

[0016] In one embodiment, obtaining the kernel file required for compiling the driver according to the kernel version used by each target operating system includes:

[0017] In the case where the kernel version that each of the drivers depends on is the kernel version of the target operating system or the kernel version already supported by the source server of the target operating system, downloading the kernel file required for compiling the driver based on the target operating system;

[0018] When the kernel version on which each of the drivers depends is not the kernel version that comes with the target operating system and is not the kernel version already supported by the source server of the target operating system, the kernel file is obtained through a customized method, and the customized method includes at least one of the following: downloading the kernel file from the kernel website; or compiling the source code of the kernel version on which each of the drivers depends to obtain the kernel file.

[0019] In one embodiment, compiling the source code of the kernel version on which each of the drivers depends to obtain the kernel file includes:

[0020] Download the source code of the kernel version on which each of the drivers depends, and install the kernel compilation tool in the operating system container image corresponding to the target operating system;

[0021] Extracting a kernel configuration file corresponding to the target operating system, and configuring kernel options in the source code of the kernel version based on the kernel configuration file;

[0022] The kernel compilation tool is used to compile the source code of the kernel version in the operating system container image based on the kernel options to obtain a kernel file.

[0023] In one embodiment, generating a container compilation environment corresponding to each operating system container image based on each tool chain required for compiling each driver includes:

[0024] Installing each tool chain required for compiling each driver into the corresponding operating system container image;

[0025] The installed tool chain and the kernel files required for compiling the driver are integrated to obtain a container compilation environment.

[0026] In one of the embodiments, the driver includes at least one of a kernel-mode driver and a user-mode driver.

[0027] In a second aspect, the present application further provides a compilation verification system, wherein the compilation verification system is generated based on the compilation verification system generation method described in any one of the above embodiments.

[0028] In a third aspect, the present application further provides a driver compilation verification method, the method comprising:

[0029] Get the driver to be compiled and verified;

[0030] The driver program to be compiled and verified is input into a compilation and verification system to obtain a compilation and verification result, wherein the compilation and verification system is generated by the compilation and verification system generation method.

[0031] In one embodiment, the step of inputting the driver program to be compiled and verified into a compilation and verification system to obtain a compilation and verification result includes:

[0032] Determine a compilation verification mode, wherein the compilation verification mode includes a complete compilation verification mode and a partial compilation verification mode. The complete compilation verification mode is to compile and verify each operating system and kernel version supported by the driver to be compiled and verified, and the partial compilation verification mode is to verify only a customized operating system and kernel version;

[0033] Based on the compilation verification mode, the driver program to be compiled and verified is input into a compilation verification system to obtain a compilation verification result.

[0034] In one embodiment, the step of inputting the driver program to be compiled and verified into a compilation and verification system to obtain a compilation and verification result includes:

[0035] The driver program to be compiled and verified is input into a compilation and verification system to instruct each operating system container image in the compilation and verification system to compile and verify the operating system container image sequentially to obtain a compilation and verification result, or each operating system container image in the compilation and verification system to compile and verify the operating system container image concurrently to obtain a compilation and verification result.

[0036] In one embodiment, the compilation verification system is deployed locally or in the cloud; the step of inputting the driver to be compiled and verified into the compilation verification system to obtain a compilation verification result includes:

[0037] In the case where the compilation verification system is deployed locally, the driver program to be compiled and verified is input into the compilation verification system through a configuration script program to obtain a compilation verification result;

[0038] In the case where the compilation verification system is deployed in the cloud, the corresponding operating system container image in the compilation verification system is determined based on the driver program to be compiled and verified, and the driver program to be compiled and verified is input into the determined operating system container image to obtain a compilation verification result.

[0039] In a fourth aspect, the present application further provides a compilation verification system generation device, the device comprising:

[0040] A container generation module, used to generate container images for each operating system based on each target operating system that each driver needs to support;

[0041] A kernel file acquisition module, used for acquiring the kernel file required for compiling the driver according to the kernel version used by each target operating system;

[0042] A compilation environment generation module, used to generate a container compilation environment corresponding to each of the operating system container images based on each tool chain required to compile each of the drivers;

[0043] An automated program determination module, used to determine a written automated verification program, wherein the automated verification program is used to verify each of the drivers based on each of the kernel files using each of the kernel versions and each of the tool chains in the container compilation environment corresponding to each of the operating system container images;

[0044] A generation module is used to obtain a compilation verification system based on the operating system container image, the kernel file, the container compilation environment and the automated verification program.

[0045] In a fifth aspect, the present application further provides a driver compilation verification system, the system comprising:

[0046] The driver program input module to be compiled is used to obtain the driver program to be compiled and verified;

[0047] The compiling and verifying module is used to input the driver program to be compiled and verified into a compiling and verifying system to obtain a compiling and verifying result, wherein the compiling and verifying system is generated based on the compiling and verifying system generating method in any one of the above embodiments.

[0048] In a sixth aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method described in any one of the above embodiments when executing the computer program.

[0049] In a seventh aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method described in any one of the above embodiments are implemented.

[0050] In an eighth aspect, the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the method described in any one of the above embodiments.

[0051] The above-mentioned compilation verification system generation method, driver compilation verification method, system, device, computer equipment, storage medium and computer program product generate each operating system container image based on each target operating system that each driver needs to support; obtain the kernel file required for compiling the driver according to the kernel version used by each target operating system; generate the container compilation environment corresponding to each operating system container image based on each tool chain required for compiling each driver; determine the written automated verification program, the automated verification program is used to verify each driver based on each kernel file using each kernel version and each tool chain in the container compilation environment corresponding to each operating system container image, and obtain the compilation verification system based on the operating system container image, kernel file, container compilation environment and automated verification program, so that when the driver needs to be verified later, the compilation verification system can automatically verify that the same driver is adapted to different operating systems, different kernel versions and different compilation tool chain environments. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0053] FIG1 is a schematic diagram of a flow chart of a method for generating a compilation verification system in one embodiment;

[0054] FIG2 is a schematic diagram of a driver compilation environment in one embodiment;

[0055] FIG3 is a diagram showing the steps of obtaining a kernel file in one embodiment;

[0056] FIG4 is a schematic diagram of a process flow of a driver program compilation verification method in one embodiment;

[0057] FIG5 is a schematic diagram of a flowchart of a driver program compilation and verification method in another embodiment;

[0058] FIG6 is a schematic diagram of the flow chart of two compilation verification modes in one embodiment;

[0059] FIG. 7 is a schematic diagram of a cloud server verification mode for collaborative development driver submission of changes in one embodiment;

[0060] FIG8 is a structural block diagram of a compilation verification system generating device in one embodiment;

[0061] FIG9 is a structural block diagram of a driver compilation and verification device in one embodiment;

[0062] FIG. 10 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0063] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0064] In one embodiment, as shown in FIG1 , a compilation verification system generation method is provided. This embodiment is illustrated by applying the method to a terminal. It is understandable that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0065] S102: Generate operating system container images based on target operating systems that the drivers need to support.

[0066] The driver includes at least one of a kernel-mode driver and a user-mode driver.

[0067] In this application, firstly, according to the different target operating systems that each driver needs to support, these target operating systems are made into multiple containers.

[0068] In one of the optional embodiments, each operating system container image is generated based on each target operating system that each driver needs to support, including any of the following methods: downloading a basic container image corresponding to the version of each target operating system from a target website as an operating system container image; or extracting operating system files from an installed operating system, and generating an operating system container image based on the extracted operating system files.

[0069] First, the operating system base container image to be produced is selected according to the different target operating systems that the driver needs to support. There are two main ways to select the process: (1) According to the version of the target operating system, directly download the base container image of the corresponding OS version from the official website of the corresponding container; (2) You can extract the file system from the existing installed operating system to produce its corresponding container image.

[0070] For example, a container image of docker OS-A is created based on Linux OS-A. For each target operating system, a corresponding container image can be created.

[0071] In one of the optional embodiments, each operating system container image is generated based on each target operating system that each driver needs to support, including: determining at least one general operating system based on each compilation-related version used by each target operating system; and generating each operating system container image based on each general operating system.

[0072] Optionally, one or more general operating system containers may be selected based on the kernel version and compiler tool version used by different target operating systems, as well as version information of basic libraries (such as glibc), to optimize and reduce the number of operating system containers to be produced.

[0073] For example, if the kernel version used by Linux OS-A is v4.0 and the compiler version is gcc v5.0, and the kernel version used by Linux OS-B is v4.1 and the compiler version is gcc v5.1, then these two operating system containers can be optimized to share a container of OS-B for compilation and verification.

[0074] S104: Obtain kernel files required for compiling the driver program according to the kernel versions used by the target operating systems.

[0075] Kernel files include kernel version header files, kernel-related files required to compile kernel drivers, and kernel tools.

[0076] Specifically, in this implementation, according to the kernel version used by the target operating system, the corresponding kernel-related files are extracted and made into a plurality of kernel files required for compiling the driver.

[0077] In one of the optional embodiments, kernel files required for compiling driver programs are obtained based on the kernel version used by each target operating system, including: when the kernel version on which each driver program depends is the kernel version that comes with the target operating system or the kernel version that is already supported in the source server of the target operating system, the kernel files required for compiling driver programs are downloaded based on the target operating system; when the kernel version on which each driver program depends is not the kernel version that comes with the target operating system and is not the kernel version that is already supported in the source server of the target operating system, the kernel files are obtained in a customized manner, and the customized manner includes at least one of the following: downloading the kernel files from a kernel website; or compiling the source code of the kernel version on which each driver program depends to obtain the kernel files.

[0078] If the kernel version that needs to be supported is the kernel version that comes with the target operating system, or is the kernel version that is already supported by the source server of the target operating system, the relevant files of the corresponding kernel version can be directly downloaded through the target operating system.

[0079] If the kernel version you need to support is not the kernel version that comes with or supports the native target operating system, you can customize the selection of other kernel versions that the driver needs to support in the following two ways: (1) Download the header files and other related files of the corresponding kernel version from the official kernel website; (2) Use the kernel version source code to compile and generate kernel-related files required for compiling the driver on the target operating system.

[0080] As for (2) above, it is equivalent to making a customized header file for a specific kernel version. For example, the driver needs to be pre-researched and adapted to the new version of the kernel in advance for compilation verification on a certain OS, or use a new version of the compilation tool chain to compile and verify the driver. For details, please see below.

[0081] S106: Generate a container compilation environment corresponding to each operating system container image based on each tool chain required for compiling each driver.

[0082] In this embodiment, the compilation tool chain and compilation environment required by the driver are configured in each container.

[0083] In one of the optional embodiments, based on the tool chains required for compiling each driver, a container compilation environment corresponding to each operating system container image is generated, including: installing the tool chains required for compiling each driver into the corresponding operating system container image; integrating the installed tool chains and the kernel files required for compiling the driver to obtain the container compilation environment.

[0084] In the multiple operating system image containers selected and created above, install the compilation tool chains required for the driver, including compiler tools and related compilation dependencies, such as gcc / g++ / llvm / clang / glibc, make / cmake, etc.

[0085] If the driver also includes a user-mode driver (UMD) that also needs compilation verification, the compilation tool chain that the corresponding user-mode driver depends on can be installed as needed.

[0086] In the compilation environment of different operating system containers, you can set different compilation options to compile and verify the driver according to your needs.

[0087] Integrate the operating system container and kernel-related files and the compilation tool chain created above, and save them as one or more operating system compilation-driven container images, such as:

[0088] docker OS_A-kernel_v4.1-v4.4-gcc_v5-toolchain_v1-arch_x86_64

[0089] docker OS_B-kernel_v4.4-v6.1-gcc_v9-toolchain_v2-arch_x86_64

[0090] dockerOS_C-kernel_v5.4-v5.15-clang_v11-toolchain_v3-arch_x86_64

[0091] docker OS_D-kernel_v5.1-v6.6-gcc_v12-toolchain_v4-arch_x86_64

[0092] As shown above, the common kernel version kernel-v4.4 can be shared by container A and container B.

[0093] Kernel versions v5.19 and v6.1 are kernel header files and related files customized based on operating system B and compiler gcc / g++ v9.

[0094] Kernel versions v5.4 and v5.15 are kernel header files and related files customized based on the operating system C and compiler llvm / clang v11.

[0095] The driver compilation environment of the operating system container constructed as above is shown in Figure 2.

[0096] S108: Determine the written automated verification program, where the automated verification program is used to verify each driver program based on each kernel file using each kernel version and each tool chain in a container compilation environment corresponding to each operating system container image.

[0097] S110: Obtain a compilation verification system based on the operating system container image, kernel files, container compilation environment, and automated verification program.

[0098] The automated verification program written at the end enables the driver to be compiled and verified in multiple containers using multiple kernel versions and multiple compilation tools. The automated compilation and verification method using containers can customize the type and mode of the operating system and kernel version to be verified according to the needs. It can support the compilation and verification of kernel-mode drivers (KMD) and user-mode drivers (UMD) at the same time.

[0099] Moreover, this method system can be used in a local verification environment and can also be deployed in a cloud server environment for collaborative verification by multiple people. In this way, for new changes to the driver, its impact on the existing supported OS / kernel versions can be discovered at the first time, thereby ensuring that all changes made by R&D personnel can support the compilation tool chain environment of these operating systems and kernel versions, and all R&D personnel can also share this set of driver compilation verification systems. The method of the present application can greatly reduce the tedious and repetitive work of driver R&D and test personnel in setting up their own compilation environments for different OS / kernel versions, thereby improving the efficiency of driver adaptation and verification work. And the quality of the driver is guaranteed so that all changes support the compilation of these OS / kernel versions.

[0100] The above-mentioned compilation verification system generation method generates each operating system container image based on each target operating system that each driver needs to support; obtains the kernel file required for compiling the driver according to the kernel version used by each target operating system; generates the container compilation environment corresponding to each operating system container image based on each tool chain required for compiling each driver; determines to write an automated verification program, the automated verification program is used to verify each driver in the container compilation environment corresponding to each operating system container image based on each kernel file using each kernel version and each tool chain, and obtains the compilation verification system based on the operating system container image, kernel file, container compilation environment and automated verification program, so that when the driver needs to be verified later, the compilation verification system can automatically verify that the same driver is adapted to different operating systems, different kernel versions and different compilation tool chain environments.

[0101] In one of the optional embodiments, as shown in FIG. 3 , the source code of the kernel version on which each driver depends is compiled to obtain a kernel file, including:

[0102] S302: Download the source code of the kernel version that each driver depends on, and install the kernel compilation tool in the operating system container image corresponding to the target operating system;

[0103] S304: extracting a kernel configuration file corresponding to the target operating system, and configuring kernel options in the source code of the kernel version based on the kernel configuration file;

[0104] S306: Compile the source code of the kernel version in the operating system container image based on the kernel option using a kernel compilation tool to obtain a kernel file.

[0105] Assuming that you need to verify that the driver supports kernel version kernelv6 on the operating system container docker A, you can make its kernel header file and related files, that is, kernel files, by following the steps below: download the source code of kernel kernelv6; install the tools required to compile the kernel on operating system (container) A; extract the kernel configuration file of the target operating system A, and configure the kernel options according to the kernel configuration file of A in the kernel v6 source code; compile the kernel in the kernel v6 source code of operating system (container) A to generate the kernel version kernelv6 header file and related files suitable for operating system container docker A

[0106] The above production steps can be performed directly on the target operating system or in the produced container operating system. The kernel version related files extracted and produced as above can be integrated into the operating system container or shared with multiple operating system containers. For example, if operating system container A needs to use kernel v4.9 and kernel v4.14 to verify the driver, and operating system container B needs to use kernel v4.14 and kernel v4.15 to verify the driver, the header file and related files of the produced kernel version kernel v4.14 can be shared with container A and container B for use.

[0107] The present application also provides a compilation verification system, which is generated based on the compilation verification system generation method in any one of the above embodiments.

[0108] In one of the optional embodiments, in combination with FIG4 , the present application further provides a driver compilation verification method, including:

[0109] S402: Obtain the driver to be compiled and verified.

[0110] S404: Input the driver to be compiled and verified into the compilation and verification system to obtain a compilation and verification result, wherein the compilation and verification system is generated by the compilation and verification system generation method in any one of the above embodiments.

[0111] The compilation verification system compiles and verifies the driver to be compiled and verified through an automated verification program to obtain a compilation verification result. For example, the automated verification program automatically compiles and verifies the same driver in each of the containers according to the multiple container compilation environments created as above.

[0112] You can choose to perform a complete compilation verification of all supported operating systems and kernel versions, or customize the configuration to verify only some of the operating systems and kernel versions, or set the default to verify only the kernel-mode driver (KMD) and other configuration combination verification modes.

[0113] For a docker of a certain OS, if the driver fails to compile with a certain kernel version, an error will be reported, reminding that modification is required. After the driver R&D personnel have modified the code, automatic compilation verification will be performed again, and the verification will be repeated in this way until the driver is compiled and verified on all docker and kernel versions that need to be supported.

[0114] For example, 4 operating system containers, 10 kernel versions, and 4 driver compilation toolchain environments were created:

[0115] The operating system container A needs to support kernel version v4.1-v4.4, and the compiler tool chain used is gcc version v4;

[0116] The operating system container B needs to support kernel version v4.3-v4.8, and the compiler tool chain used is gcc version v5;

[0117] The operating system container C needs to support kernel version v4.7-v4.10, and the compiler tool chain used is clang version s7;

[0118] The operating system container D needs to support kernel version v4.9 and the compilation tool chain used is gcc version v8.

[0119] If KMD needs to be verified on operating system containers A, B, C, and D, and UMD only needs to be verified on operating system container D, after writing the automatic compilation and verification driver, if you execute: make docker-driver-verify, it will automatically call and execute as follows:

[0120] (1) make kmd-on-docker_A-kernel_v4.1-v4.4-gcc_v4

[0121] This means that kernel v4.1, v4.2, v4.3, v4.4 and gcc v4 are used to compile the KMD driver in docker A.

[0122] (2) make kmd-on-docker_B-kernel_v4.3-v4.8-gcc_v5 means using kernel v4.3, v4.4, v4.5, v4.6, v4.7, v4.8 and gcc v5 to compile the KMD driver in docker B respectively;

[0123] (3) make kmd-on-docker_C-kernel_v4.7-v4.10-clang_s7 means using kernel v4.7, v4.8, v4.9, v4.10 and clang s7 to compile the KMD driver in docker C;

[0124] (4) make driver-on-docker_D-kernel_v4.9-gcc_v8, which means using kernel v4.9 and gcc v8 to compile KMD and UMD drivers in docker D.

[0125] During the verification process, if a compilation driver fails when using a certain compilation tool version of a certain kernel version of Docker, an error message will be given to remind you of the failure and the verification process will be exited.

[0126] In addition, for different commit changes in the driver, you can configure the corresponding trigger verification of different containers based on the modified files / folders or contents, such as determining whether they are kmd / umd / os / arch related files.

[0127] You can loop through all containers and their corresponding kernel versions, and compile and verify the drivers in sequence according to the configuration selection, as shown in Figure 5.

[0128] In one of the optional embodiments, the driver to be compiled and verified is input into the compilation and verification system to obtain a compilation and verification result, including: determining a compilation and verification mode, the compilation and verification mode 902 includes a complete compilation and verification mode and a partial compilation and verification mode, the complete compilation and verification mode is to compile and verify each operating system and kernel version supported by the driver to be compiled and verified, and the partial compilation and verification mode is to verify only the customized operating system and kernel version; based on the compilation and verification mode, the driver to be compiled and verified is input into the compilation and verification system to obtain a compilation and verification result.

[0129] The compilation verification mode in this embodiment includes: a complete verification mode and a partial compilation verification mode (also referred to as a custom configuration verification mode).

[0130] The full verification mode compiles and verifies the KMD driver code and the UMD driver code for all the operating system containers and their corresponding kernel files and compilation environments.

[0131] Custom configuration verification mode: Only certain kernel versions of certain OS containers are used for KMD / UMD compilation verification through commands or configuration files. For example, only all kernel versions of OS container A are used to compile and verify the KMD driver, or only kernel version v2 of OS container A is used to compile and verify the KMD driver, or container N is used to verify KMD and UMD, as shown in Figure 6.

[0132] In one of the optional embodiments, the driver program to be compiled and verified is input into the compilation and verification system to obtain the compilation and verification result, including: inputting the driver program to be compiled and verified into the compilation and verification system to instruct each operating system container image in the compilation and verification system to sequentially compile and verify the operating system container image to obtain the compilation and verification result, or each operating system container image in the compilation and verification system concurrently compiles and verifies the operating system container image to obtain the compilation and verification result.

[0133] Each compilation verification mode can be verified sequentially or concurrently on different containers.

[0134] In one of the optional embodiments, the compilation verification system is deployed locally or in the cloud; the driver program to be compiled and verified is input into the compilation verification system to obtain a compilation verification result, including: when the compilation verification system is deployed locally, the driver program to be compiled and verified is input into the compilation verification system through a configuration script program to obtain a compilation verification result; when the compilation verification system is deployed in the cloud, the corresponding operating system container image in the compilation verification system is determined based on the driver program to be compiled and verified, and the driver program to be compiled and verified is input into the determined operating system container image to obtain a compilation verification result.

[0135] Based on the operating system container and kernel version header files and compilation tool chain produced above, and using the verification program of the automatically compiled driver, this method can be used in the local environment to verify the driver code, or it can be deployed on a driver verification server and provided to multiple driver developers for collaborative verification.

[0136] Among them, in the local verification mode, for the driver developer, when he modifies the code locally, he can execute the above automated driver adaptation verification program locally to determine whether his changes can meet the compilation verification requirements of multiple containers and multiple kernel versions that need to be supported.

[0137] For example, execute make local-docker-driver-verify or related script configuration programs. Optionally, you can customize the choice to verify all operating system containers and kernel versions, or to verify some of the operating system containers and kernel versions. For example: make all-docker-driver-verify means verifying all operating system containers, kernel versions, and compilation toolchain combinations; make driver-on-docker_A-kernels-compiler means compiling and verifying operating system container A and all kernel versions and compilation toolchains supported by the container. When the driver developer has local code changes, the above automated driver verification command can be used to compile and verify certain operating systems, kernel versions, and compilation toolchains that need to be supported.

[0138] In the cloud collaborative verification mode, if the driver is developed by multiple people in the team, when a developer is about to submit his own driver code changes, the cloud server's automatic driver adaptation verification program can be triggered to automatically compile and verify multiple dockers and multiple kernel versions. If the changes cause the compilation of a kernel version of a docker to fail, the driver code modification will be rejected;

[0139] Only when the changes submitted by the developer can meet all the compilation tests of the cloud server's automated driver adaptation verification can the change be merged into the driver code base. This ensures that when multiple people collaborate on development, everyone's changes can meet the supported OS / kernel version requirements.

[0140] This prevents the situation where the driver breaks support for certain OS / kernels after developers use someone else's change, which is not conducive to timely discovery of changes that introduce problems, nor is it conducive to product release and use of driver code. At the same time, you can configure the compilation verification of different containers to be triggered based on the files or content involved in the code submitted by the driver developer. For example, if a change only modifies a certain umd file a_xxx.c or folder a_dir / , only the automatic compilation verification of operating system container A will be triggered.

[0141] for example:

[0142] (1) Developer dev-A submitted a driver code change commit A1;

[0143] (2) Later, developer dev-B submitted a driver code change commit B1;

[0144] (3) Finally, developer dev-C submitted a driver code change commit C1;

[0145] The changes are processed in the order of the time when the driver code is submitted, as shown in Figure 7:

[0146] First, commit A1 will trigger the automated container compilation verification system for the driver code, that is, compile and verify all operating system containers + kernel versions + compilation tool chains that the driver code needs to support. For example, based on the modification of the submitted code file of commitA1, after analysis by the driver verification server, the corresponding operating system container R, container S, and container T are triggered, and the corresponding kernel version and compilation tool are used to compile and verify the driver.

[0147] Assuming that the A1 change fails to compile when using a certain compilation tool for a certain kernel version in a certain operating system container, the subsequent automatic verification process of the A1 change is terminated, the submitter dev-A is reminded of the relevant error information, and the A1 change is rejected from being merged into the driver code repository;

[0148] After that, commit B1 triggers the automated container compilation and verification system of the driver code. For example, commit B1 is analyzed by the driver verification server and triggers the corresponding operating system container X, container Y, and container Z to compile and verify.

[0149] Assuming that the driver code modified by B1 can be compiled and verified in all supported operating system containers for all required supported kernel versions and compilation tool chains, the B1 modification can be merged into the driver code repository;

[0150] Finally, based on the B1 driver code that has passed the verification above, the driver code repository is merged, and the submitted changes commit C1 triggers the server-side driver code automatic verification system;

[0151] Assuming that the use of C1 causes compilation failure during the verification process, it will be handled the same as commit A1, that is, the verification process will be terminated, the submitter will be notified of the dev-C error message, and the request to merge commit C1 into the driver code repository will be rejected.

[0152] In this way, as shown above, only commit B1 changes that pass the verification of the automated driver code verification system can be merged into the driver code repository, ensuring that the driver code repository on the server is compatible with and supports multiple compilation tool environments for multiple operating systems and multiple kernel versions.

[0153] This application uses container technology to unify the driver compilation environment, and implements driver compilation verification by selecting and making multiple operating system containers, matching multiple kernel version header files and related files, and multiple compilation tool chain environments. It can not only verify the compilation environment of the existing operating system and kernel, but also pre-research and customize the combination of new OS / kernel / compilation tool chain in advance.

[0154] The automated compilation and verification process supports a variety of flexible configurations and verification modes, and compiles and verifies the driver according to user needs. This method can be used for local verification and collaborative development by multiple people. When submitting driver code changes, it ensures that each change in the driver code repository can meet the quality and stability requirements of supporting multiple operating systems.

[0155] Therefore, the present application has the following advantages: using container technology to unify the compilation and verification environment of the driver program, avoiding the problem of repeated construction of the compilation and verification environment and possible inconsistent verification environments; the automated compilation and verification process is easy to use and has various configuration modes, which can simultaneously verify the driver code's adaptability to the compilation environments of multiple operating systems and kernel versions, thereby improving the driver verification efficiency; during team collaborative development, it is ensured that each change to the driver code will not destroy support for the original operating system compilation environment, thereby ensuring the continuity and stability of the driver code quality.

[0156] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0157] Based on the same inventive concept, the embodiment of the present application also provides a compile verification system generation device for implementing the compile verification system generation method involved above and a driver compile verification device for the driver compile verification method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more compile verification system generation devices and driver compile verification device embodiments provided below can refer to the above limitations on the compile verification system generation method and the compile verification system generation method, which will not be repeated here.

[0158] In an exemplary embodiment, as shown in FIG8 , a compilation verification system generation device is provided, including: a container generation module 801, a kernel file acquisition module 802, a compilation environment generation module 803, an automation program determination module 804 and a generation module 805, wherein:

[0159] The container generation module 801 is used to generate each operating system container image based on each target operating system that each driver needs to support;

[0160] The kernel file acquisition module 802 is used to acquire the kernel file required for compiling the driver according to the kernel version used by each target operating system;

[0161] A compilation environment generation module 803 is used to generate a container compilation environment corresponding to each operating system container image based on each tool chain required to compile each driver;

[0162] An automated program determination module 804 is used to determine a written automated verification program, where the automated verification program is used to verify each driver program based on each kernel file using each kernel version and each tool chain in a container compilation environment corresponding to each operating system container image;

[0163] The generation module 805 is used to obtain a compilation verification system based on the operating system container image, kernel files, container compilation environment and automated verification program.

[0164] In one of the optional embodiments, the container generation module 801 is used to generate an operating system container image in any of the following ways: downloading a base container image corresponding to the version of each target operating system from a target website as an operating system container image; or extracting operating system files from an installed operating system and generating an operating system container image based on the extracted operating system files.

[0165] In one of the optional embodiments, the container generation module 801 is used to determine at least one general operating system based on the compilation-related versions used by each target operating system; and generate each operating system container image based on each general operating system.

[0166] In one of the optional embodiments, the above-mentioned kernel file acquisition module 802 is used to download the kernel file required for compiling the driver based on the target operating system when the kernel version on which each driver depends is the kernel version that comes with the target operating system or the kernel version that is already supported in the source server of the target operating system; when the kernel version on which each driver depends is not the kernel version that comes with the target operating system and is not the kernel version that is already supported in the source server of the target operating system, the kernel file is obtained by a customized method, and the customized method includes at least one of the following: downloading the kernel file from the kernel website; or compiling the source code of the kernel version on which each driver depends to obtain the kernel file.

[0167] In one of the optional embodiments, the kernel file acquisition module 802 is used to download the source code of the kernel version on which each driver depends, and install the kernel compilation tool in the operating system container image corresponding to the target operating system; extract the kernel configuration file corresponding to the target operating system, and configure the kernel options in the source code of the kernel version based on the kernel configuration file; compile the source code of the kernel version based on the kernel options in the operating system container image through the kernel compilation tool to obtain the kernel file.

[0168] In one of the optional embodiments, the compilation environment generation module 803 is used to install the tool chains required for compiling the drivers into the corresponding operating system container image; the installed tool chains and the kernel files required for compiling the drivers are integrated to obtain the container compilation environment.

[0169] In one of the optional embodiments, the driver includes at least one of a kernel-mode driver and a user-mode driver.

[0170] In an exemplary embodiment, as shown in FIG9 , a driver program compilation verification device is provided, including: a driver program input module 901 to be compiled and a compilation verification module 902, wherein:

[0171] The driver program input module 901 to be compiled is used to obtain the driver program to be compiled and verified;

[0172] The compiling and verifying module 902 is used to input the driver program to be compiled and verified into the compiling and verifying system to obtain the compiling and verifying result, wherein the compiling and verifying system is generated based on the compiling and verifying system generating method in any one of the above embodiments.

[0173] In one of the optional embodiments, the above-mentioned compilation verification module 902 is specifically used to determine the compilation verification mode, and the compilation verification mode includes a complete compilation verification mode and a partial compilation verification mode. The complete compilation verification mode is to compile and verify each operating system and kernel version supported by the driver to be compiled and verified, and the partial compilation verification mode is to verify only the customized operating system and kernel version; based on the compilation verification mode, the driver to be compiled and verified is input into the compilation verification system to obtain the compilation verification result.

[0174] In one of the optional embodiments, the compilation verification module 902 is specifically used to input the driver to be compiled and verified into the compilation verification system to instruct each operating system container image in the compilation verification system to compile and verify the operating system container image sequentially to obtain a compilation verification result, or each operating system container image in the compilation verification system concurrently compiles and verifies the operating system container image to obtain a compilation verification result.

[0175] In one of the optional embodiments, the above-mentioned compilation verification module 902 is specifically used to, when the compilation verification system is deployed locally, input the driver program to be compiled and verified into the compilation verification system through a configuration script program to obtain a compilation verification result; when the compilation verification system is deployed in the cloud, determine the corresponding operating system container image in the compilation verification system based on the driver program to be compiled and verified, input the driver program to be compiled and verified into the determined operating system container image to obtain a compilation verification result.

[0176] Each module in the above-mentioned compilation verification system generation device and driver compilation verification device can be implemented in whole or in part by software, hardware and their combination. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the corresponding operations of each of the above modules.

[0177] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG10. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a compilation verification system generation method and a driver compilation verification method are implemented.

[0178] Those skilled in the art will understand that the structure shown in FIG. 10 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0179] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0180] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0181] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0182] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0183] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0184] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A compilation verification system generation method, characterized in that: The method comprises: Generate container images for each operating system based on the target operating systems that each driver needs to support; According to the kernel version used by each of the target operating systems, obtaining the kernel file required for compiling the driver; Based on the tool chains required for compiling the drivers, a container compilation environment corresponding to each operating system container image is generated; Determine an automated verification program to be written, wherein the automated verification program is used to verify each of the drivers in the container compilation environment corresponding to each of the operating system container images, based on each of the kernel files, using each of the kernel versions and each of the tool chains; A compilation verification system is obtained based on the operating system container image, the kernel file, the container compilation environment and the automated verification program.

2. The method according to claim 1, characterized in that The generating of each operating system container image based on each target operating system that each driver needs to support includes: Determining at least one general operating system based on the compilation-related versions used by the target operating systems; Based on each of the general operating systems, each operating system container image is generated.

3. The method according to claim 1, characterized in that The step of obtaining the kernel file required for compiling the driver according to the kernel version used by each of the target operating systems includes: In the case where the kernel version that each of the drivers depends on is the kernel version of the target operating system or the kernel version already supported by the source server of the target operating system, downloading the kernel file required for compiling the driver based on the target operating system; When the kernel version on which each of the drivers depends is not the kernel version that comes with the target operating system and is not the kernel version already supported by the source server of the target operating system, the kernel file is obtained through a customized method, and the customized method includes at least one of the following: downloading the kernel file from the kernel website; or compiling the source code of the kernel version on which each of the drivers depends to obtain the kernel file.

4. The method according to claim 3, characterized in that The step of compiling the source code of the kernel version on which each of the drivers depends to obtain the kernel file includes: Download the source code of the kernel version on which each of the drivers depends, and install the kernel compilation tool in the operating system container image corresponding to the target operating system; Extracting a kernel configuration file corresponding to the target operating system, and configuring kernel options in the source code of the kernel version based on the kernel configuration file; The kernel compilation tool is used to compile the source code of the kernel version in the operating system container image based on the kernel options to obtain a kernel file.

5. The method according to claim 1, characterized in that The generating a container compilation environment corresponding to each operating system container image based on each tool chain required for compiling each driver comprises: Installing each tool chain required for compiling each driver into the corresponding operating system container image; The installed tool chain and the kernel files required for compiling the driver are integrated to obtain a container compilation environment.

6. The method according to claim 1, characterized in that The driver includes at least one of a kernel-mode driver and a user-mode driver.

7. A compilation verification system, characterized in that: The compilation verification system is generated based on the compilation verification system generation method according to any one of claims 1 to 6.

8. A driver compilation verification method, characterized in that: The method comprises: Get the driver to be compiled and verified; The driver program to be compiled and verified is input into a compilation and verification system to obtain a compilation and verification result, wherein the compilation and verification system is generated by the compilation and verification system generation method according to any one of claims 1 to 6.

9. The method according to claim 8, characterized in that The step of inputting the driver program to be compiled and verified into a compilation and verification system to obtain a compilation and verification result includes: Determine a compilation verification mode, wherein the compilation verification mode includes a complete compilation verification mode and a partial compilation verification mode. The complete compilation verification mode is to compile and verify each operating system and kernel version supported by the driver to be compiled and verified, and the partial compilation verification mode is to verify only a customized operating system and kernel version; Based on the compilation verification mode, the driver program to be compiled and verified is input into a compilation verification system to obtain a compilation verification result.

10. The method according to claim 8, characterized in that The step of inputting the driver program to be compiled and verified into a compilation and verification system to obtain a compilation and verification result includes: The driver program to be compiled and verified is input into a compilation and verification system to instruct each operating system container image in the compilation and verification system to compile and verify the operating system container image sequentially to obtain a compilation and verification result, or each operating system container image in the compilation and verification system to compile and verify the operating system container image concurrently to obtain a compilation and verification result.

11. The method according to claim 8, characterized in that The compilation verification system is deployed locally or in the cloud; the driver to be compiled and verified is input into the compilation verification system to obtain a compilation verification result, including: In the case where the compilation verification system is deployed locally, the driver program to be compiled and verified is input into the compilation verification system through a configuration script program to obtain a compilation verification result; In the case where the compilation verification system is deployed in the cloud, the corresponding operating system container image in the compilation verification system is determined based on the driver program to be compiled and verified, and the driver program to be compiled and verified is input into the determined operating system container image to obtain a compilation verification result.

12. A compilation verification system generation device, characterized in that: The device comprises: A container generation module, used to generate container images for each operating system based on each target operating system that each driver needs to support; A kernel file acquisition module, used for acquiring the kernel file required for compiling the driver according to the kernel version used by each target operating system; A compilation environment generation module, used to generate a container compilation environment corresponding to each of the operating system container images based on each tool chain required to compile each of the drivers; An automated program determination module, used to determine a written automated verification program, wherein the automated verification program is used to verify each of the drivers based on each of the kernel files using each of the kernel versions and each of the tool chains in the container compilation environment corresponding to each of the operating system container images; A generation module is used to obtain a compilation verification system based on the operating system container image, the kernel file, the container compilation environment and the automated verification program.

13. A driver compilation verification system, characterized in that: The system comprises: The driver program input module to be compiled is used to obtain the driver program to be compiled and verified; A compiling and verifying module is used to input the driver program to be compiled and verified into a compiling and verifying system to obtain a compiling and verifying result, wherein the compiling and verifying system is generated based on the compiling and verifying system generation method according to claim 12.

14. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 or 8 to 11 are implemented.

15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 or 8 to 11 are implemented.

16. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 or 8 to 11 are implemented.

Citation Information

Cited By

  • Docker-based linux kernel compiling method and system

    CN120872355A

  • Driver management method and device, equipment, storage medium and program product

    CN121029225A

  • A driving management method, device, equipment, storage medium and program product

    CN121029225B