Kernel module compatible operation method, system and device and storage medium

By dynamically compiling the kernel module at runtime, the kernel module recompilation problem caused by kernel version changes is solved, and the kernel module compatibility and maintenance cost reduction is achieved.

CN119938136APending Publication Date: 2025-05-06GUANGDONG ZHONGXING NEWSTART TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411826958.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-12
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

In the prior art, kernel modules need to be recompiled when kernel version changes, resulting in increased version maintenance costs and confusion in version management.

Method used

By dynamically compiling the kernel module at runtime, generating temporary files and calling the compilation command interface, the kernel module is implemented compatible operation.

Benefits of technology

It alleviates the problem of excessive version management chaos, reduces maintenance costs, and realizes compatibility of kernel modules in different versions of kernels.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119938136A_ABST
    Figure CN119938136A_ABST
Patent Text Reader

Abstract

The invention discloses a kernel module compatible operation method, system and device and a storage medium. The method comprises the following steps: determining a temporary file corresponding to a source code of a kernel module; calling a compiling command interface, and compiling the kernel module based on the temporary file to obtain a compiled kernel module; and inserting the compiled kernel module into a kernel, and loading the kernel module. According to the embodiment of the invention, the kernel module is dynamically compiled during running, so that the problem of disordered management due to excessive versions can be relieved, and the maintenance cost is reduced. The method can be widely applied to the technical field of computers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a kernel module compatible operation method, system, device and storage medium. Background Art

[0002] There are two traditional software running methods. One is to compile static binary executable files based on the operating system, which needs to be adapted to different operating systems; the other is to interpret and run through a translator, such as JAVA software, to achieve cross-architecture operation on different systems. During the operation of the Linux kernel module, the kernel module needs to be loaded. If the kernel version changes, the kernel module needs to be recompiled before it can be loaded successfully.

[0003] In the related art, kernel module source code is usually compiled in different kernel versions to generate kernel modules, which are then loaded into the kernel. This method will cause software version compatibility with the kernel, and the kernel module needs to be recompiled every time the kernel is updated, which increases the version maintenance cost and makes version management chaotic. Summary of the invention

[0004] The purpose of the present invention is to solve one of the technical problems existing in the prior art to at least a certain extent.

[0005] To this end, the object of the present invention is to provide a low-cost kernel module compatible operation method, system, device and storage medium.

[0006] In order to achieve the above technical purpose, one aspect of an embodiment of the present invention provides a kernel module compatible operation method, comprising the following steps: determining a temporary file corresponding to the source code of the kernel module; calling a compilation command interface, compiling the kernel module based on the temporary file, and obtaining a compiled kernel module; inserting the compiled kernel module into the kernel, and loading the kernel module. The embodiment of the present application dynamically compiles the kernel module at runtime, which is conducive to alleviating the problem of chaotic management of too many versions and reducing maintenance costs.

[0007] In some embodiments, the kernel module compatible operation method of the embodiment of the present invention further includes:

[0008] If the program is started, determine the temporary file corresponding to the source code of the kernel module;

[0009] The compile time is determined according to the function of the kernel module.

[0010] In some embodiments, in one embodiment of the present invention, the method further comprises:

[0011] If the compiling time is longer than a preset time, a thread is created, and the kernel module is compiled based on the temporary file to obtain a compiled kernel module.

[0012] In some embodiments, in one embodiment of the present invention, compiling the kernel module based on the temporary file to obtain a compiled kernel module includes:

[0013] The kernel module is compiled into a ko file through the make modules command to obtain a compiled kernel module.

[0014] In some embodiments, in one embodiment of the present invention, inserting the compiled kernel module into the kernel and loading the kernel module includes:

[0015] Use the make modules_install command to put the compiled kernel module into the preset directory;

[0016] The compiled kernel module is loaded into the kernel through the insmod command.

[0017] In some embodiments, in one embodiment of the present invention, the method further comprises:

[0018] A first kernel module that is dependent on the kernel module is determined, and the first kernel module is compiled; the first kernel module is determined by viewing documents, analyzing codes, and using command tools.

[0019] In some embodiments, in one embodiment of the present invention, the compile command interface is determined by the following steps:

[0020] Check the kernel documentation and determine the compilation command interface through the preset folder;

[0021] Alternatively, the makefile file is analyzed to determine the compilation command interface.

[0022] On the other hand, an embodiment of the present invention provides a kernel module compatible operation system, including:

[0023] The first module is used to determine the temporary file corresponding to the source code of the kernel module;

[0024] The second module is used to call the compile command interface to compile the kernel module based on the temporary file to obtain a compiled kernel module;

[0025] The third module is used to insert the compiled kernel module into the kernel and load the kernel module.

[0026] On the other hand, an embodiment of the present invention provides a kernel module compatible operation device, including:

[0027] at least one processor;

[0028] at least one memory for storing at least one program;

[0029] When the at least one program is executed by the at least one processor, the at least one processor implements the above-mentioned kernel module compatible operation method.

[0030] On the other hand, an embodiment of the present invention provides a storage medium storing a program executable by a processor, wherein the program executable by the processor is used to implement the above-mentioned kernel module compatible operation method when executed by the processor.

[0031] The embodiment of the present application includes at least the following beneficial effects: The method provided by the embodiment of the present invention includes: determining a temporary file corresponding to the source code of the kernel module; calling a compile command interface, compiling the kernel module based on the temporary file, and obtaining a compiled kernel module; inserting the compiled kernel module into the kernel, and loading the kernel module. The embodiment of the present application dynamically compiles the kernel module at runtime, which is conducive to alleviating the problem of chaotic management of too many versions and reducing maintenance costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the embodiments of the present invention or the drawings of related technical solutions in the prior art are introduced below. It should be understood that the drawings introduced below are only for the convenience of clearly describing some embodiments of the technical solutions of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0033] Figure 1 A flowchart of an embodiment of the kernel module compatible operation method provided by the present invention;

[0034] Figure 2 A flowchart of another embodiment of the kernel module compatible operation method provided by the present invention;

[0035] Figure 3 A schematic diagram of the structure of an embodiment of the kernel module compatible operation system provided by the present invention;

[0036] Figure 4 A schematic structural diagram of an embodiment of a kernel module compatible operation device provided by the present invention. DETAILED DESCRIPTION

[0037] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and are not to be construed as limitations of the present invention. For the step numbers in the following embodiments, they are only provided for the convenience of explanation, and the order between the steps is not limited in any way, and the execution order of each step in the embodiment can be adaptively adjusted according to the understanding of those skilled in the art.

[0038] The Linux operating system product in the embodiment of the present application includes a software implementation of a kernel module that is compatible with different versions of Linux kernel operating technologies.

[0039] There are two traditional software running methods. One is to compile static binary executable files based on the operating system, which needs to be adapted to different operating systems; the other is to interpret and run through a translation machine, such as JAVA software, to achieve cross-architecture operation on different systems. During the operation of the Linux kernel module, the kernel module needs to be loaded. If the kernel version changes, the kernel module needs to be recompiled before it can be loaded successfully. The existing solutions generally compile the kernel module source code in different kernel versions, generate the kernel module, and then load it into the kernel. This method will cause the compatibility of the software version with the kernel, and the kernel module needs to be recompiled every time the kernel is updated. This solution provides a dynamic compilation method. Through the dynamic compilation method of this case, the software can be compiled once to be compatible with different versions of the kernel, and the kernel module can be loaded normally and run normally without recompiling the software.

[0040] The kernel module compatible operation method and system proposed in the embodiment of the present invention will be described in detail below with reference to the accompanying drawings. First, the kernel module compatible operation method proposed in the embodiment of the present invention will be described with reference to the accompanying drawings.

[0041] Reference Figure 1 In an embodiment of the present invention, a kernel module compatible operation method is provided. The kernel module compatible operation method in the embodiment of the present invention can be applied to a terminal, or to a server, or can be software running in a terminal or a server, etc. The terminal can be a tablet computer, a laptop computer, a desktop computer, etc., but is not limited thereto. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The kernel module compatible operation method in the embodiment of the present invention mainly includes the following steps:

[0042] S100: Determine a temporary file corresponding to the source code of the kernel module;

[0043] S200: calling a compile command interface to compile the kernel module based on the temporary file to obtain a compiled kernel module;

[0044] S300: inserting the compiled kernel module into the kernel, and loading the kernel module.

[0045] Optionally, in one embodiment of the present invention, the method further comprises:

[0046] If the program is started, determine the temporary file corresponding to the source code of the kernel module;

[0047] The compile time is determined according to the function of the kernel module.

[0048] In some possible implementations, the kernel module is compiled when the program is started.

[0049] Optionally, in one embodiment of the present invention, the method further comprises:

[0050] If the compiling time is longer than a preset time, a thread is created, and the kernel module is compiled based on the temporary file to obtain a compiled kernel module.

[0051] In some possible implementations, if the compilation time required for the kernel module is long, the compilation work can be performed through threads to improve efficiency. The preset time is an acceptable compilation time that affects the startup of the program. It is understandable that if the compilation time is longer than the preset time, the startup time of the program is too long, affecting the user experience. The preset time can be set according to demand, and this application does not make specific limitations.

[0052] Optionally, in one embodiment of the present invention, compiling the kernel module based on the temporary file to obtain a compiled kernel module includes:

[0053] The kernel module is compiled into a ko file through the make modules command to obtain a compiled kernel module.

[0054] In some possible implementations, ko is the abbreviation of "Kernel Object", which is the kernel module file format under the Linux system. In Linux, a kernel module is a piece of code that can be dynamically loaded into the kernel to expand kernel functionality. When these modules are compiled, a file with a .ko suffix is ​​generated. For example, a simple device driver will be a .ko file after being compiled as a kernel module. The .ko file can be inserted into the running kernel through the insmod (insert module) or modprobe (a smarter module insertion tool that automatically handles module dependencies) command, allowing the kernel to obtain the functions provided by this module, such as loading a new hardware driver, a new file system module, etc.

[0055] Optionally, in one embodiment of the present invention, inserting the compiled kernel module into the kernel and loading the kernel module includes:

[0056] Use the make modules_install command to put the compiled kernel module into the preset directory;

[0057] The compiled kernel module is loaded into the kernel through the insmod command.

[0058] In some possible implementations, insmod is a command for inserting a kernel module into the Linux kernel. Before using insmod, the kernel module needs to be compiled first. Specifically, the steps include:

[0059] S21 write kernel module code;

[0060] S22 write Makefile file;

[0061] S23 compiles kernel modules: the file is a module that can be inserted into the kernel using insmod;

[0062] S24 inserts the module. After compiling the module, use the insmod command to insert the module.

[0063] Optionally, in one embodiment of the present invention, the method further comprises:

[0064] A first kernel module that is dependent on the kernel module is determined, and the first kernel module is compiled; the first kernel module is determined by viewing documents, analyzing codes, and using command tools.

[0065] In some possible implementations, for kernel modules with dependencies, specifically, the modules may depend on other modules or certain libraries in the kernel. The dependencies should be clearly identified and ensured that they are correctly installed or compiled at the same time.

[0066] There are several ways to determine the dependencies of a kernel module:

[0067] Check the documentation. Many kernel modules have official documentation, which mentions dependencies. For example, in the official Linux kernel documentation, for some network-related kernel modules, it is clearly stated that they need to rely on specific network protocol support modules.

[0068] Analyze code, header file references: Check the header file references in the module code. If a module's source file includes another module's related header file, this usually means that it depends on the functions or data structures provided by the module. For example, if a module code contains<linux / netfilter.h> Header files are likely to depend on Netfilter related modules. Function calls: Check the functions called in the code. If a module calls functions provided by other modules, then there is a dependency. For example, a module that calls the scsi_device_add() function may depend on the SCSI subsystem module.

[0069] Use tools, modinfo command (Linux): For existing kernel modules, you can use the modinfo command. For example, modinfo e1000 (assuming e1000 is a network driver module) will display relevant information about the module, where the depends field lists the modules it depends on. Kernel build system: During the kernel build process, the build system records the dependencies between modules. Dependencies can be determined by viewing the files generated by the kernel build process (such as .config files and Makefiles related to various modules).

[0070] Optionally, in one embodiment of the present invention, the compile command interface is determined by the following steps:

[0071] Check the kernel documentation and determine the compilation command interface through the preset folder;

[0072] Alternatively, the makefile file is analyzed to determine the compilation command interface.

[0073] In some possible implementations, different operating systems query the kernel module compilation command interface in different ways. For Linux systems, mainly through the following ways:

[0074] Check the kernel documentation: The Linux kernel source code documentation contains information related to module compilation. These documents detail the commands, parameters, and requirements related to the compilation interface. There are many useful documents in the Documentation folder under the kernel source code directory, such as kbuild / modules.txt, which contains information related to module building.

[0075] Analyze Makefile: The compilation of kernel modules is usually organized by Makefile. Specific compilation rules and interface commands can be found in the Makefile files in the module subdirectory under the kernel source code directory. These Makefiles define how to compile source files into target modules, including the compiler options to be used, dependency handling, etc.

[0076] The method provided by this application is described in detail below with a specific embodiment:

[0077] In Linux, LSM (Linux Security Modules) is the Linux Security Module Framework. It is a general framework for implementing mandatory access control (MAC) policies in the kernel. It allows system administrators or developers to implement multiple security policies by loading different security modules without modifying the core code of the Linux kernel. The LSM framework makes the Linux system more flexible and scalable in terms of security.

[0078] In the context of Linux Security Module (LSM), LSM hook is a key mechanism. Specifically, LSM hook is a series of function pointers that are placed at key kernel operation points. These operation points include system calls (such as file opening, process creation, etc.) and kernel object operations (such as inode operations). When these operations occur, the corresponding LSM hook function will be called first. For example, when a process tries to open a file, the kernel code will first call the LSM hook-related function. This function checks the security policy (such as SELinux or AppArmor-related policies) to determine whether the process is allowed to open the file. If the security policy allows, the operation proceeds normally; if not, an error is returned. Through these hook functions, the LSM framework can intercept and control various kernel operations, thereby effectively implementing mandatory access control policies.

[0079] The LSM module function implemented in user mode needs to compile the LSM hook function into a ko file, and then load it into the kernel when the function is started, so as to implement the user-defined hook function. Every time the kernel version changes, it needs to be recompiled, which is not compatible with the kernel. If there is a kernel module in the program, every time the kernel version changes, it needs to be recompiled, which will increase the version maintenance cost and cause confusion in version management.

[0080] Based on the above problems, the compatibility of Linux kernel modules is achieved through dynamic compilation at runtime, thereby reducing the problem of software version maintenance caused by kernel version changes.

[0081] Dynamic compilation process such as Figure 2 As shown: Each time the program is started, a temporary file of the source code of the Linux LSM kernel module is generated, and then the compilation command interface is called to compile the LSM module. After the compilation is completed, the compiled ko module is inserted into the kernel to load the kernel module, and finally the compiled temporary file is deleted.

[0082] Through dynamic compilation, the software is compatible with different Linux kernel versions, achieving the goal of one-time compilation and multi-kernel operation.

[0083] The compilation method provided by this application affects the startup performance:

[0084] During the startup process, the kernel module is compiled. Depending on the difference in the functions implemented by the kernel module, the time for dynamic compilation also varies. In the EDM project, the method of dynamically compiling the kernel module is used to compile the kernel module when the system starts, and then load the kernel module into the kernel to implement the process control function. Compared with the ordinary method of directly loading the kernel module, the dynamic compilation method takes about 400 milliseconds and has little impact on the startup performance.

[0085] For kernel modules that take a long time to compile, asynchronous compilation can be used. When the program starts, a thread is created to compile the kernel module. After the kernel module is compiled, it is loaded into the kernel module without affecting the startup of the program.

[0086] This solution provides a method based on dynamic compilation to achieve kernel module compatibility with different Linux systems; the software achieves one-time compilation and multi-kernel operation; the kernel module is automatically compiled when the program starts.

[0087] It is understandable that in the related art, the software kernel module is added to the kernel compilation. This solution requires the maintenance of the kernel source code, and each time the software kernel module is changed, the kernel needs to be updated. In this regard, the solution provided by the present application can make the software compatible with different versions of the Linux kernel. By means of dynamic compilation, when the program is started, the corresponding kernel module is adaptively compiled, so that the software can run in different versions of the kernel system.

[0088] In summary, the method provided by the embodiment of the present application includes: determining a temporary file corresponding to the source code of the kernel module; calling a compile command interface, compiling the kernel module based on the temporary file, and obtaining a compiled kernel module; inserting the compiled kernel module into the kernel, and loading the kernel module. The embodiment of the present application dynamically compiles the kernel module at runtime, which is conducive to alleviating the problem of chaotic management of too many versions and reducing maintenance costs.

[0089] Secondly, refer to the attached Figure 3 A kernel module compatible operating system proposed according to an embodiment of the present invention is described.

[0090] Figure 3 1 is a schematic diagram of the structure of a kernel module compatible operation system according to an embodiment of the present invention, wherein the system specifically comprises:

[0091] The first module 310 is used to determine a temporary file corresponding to the source code of the kernel module;

[0092] The second module 320 is used to call the compile command interface to compile the kernel module based on the temporary file to obtain a compiled kernel module;

[0093] The third module 330 is used to insert the compiled kernel module into the kernel and load the kernel module.

[0094] Optionally, in one embodiment of the present invention, the system further includes a fourth module, configured to:

[0095] If the program is started, determine the temporary file corresponding to the source code of the kernel module;

[0096] The compile time is determined according to the function of the kernel module.

[0097] Optionally, in one embodiment of the present invention, the system further includes a fifth module, which is used to create a thread if the compilation time is greater than a preset time, and to compile the kernel module based on the temporary file to obtain a compiled kernel module.

[0098] Optionally, in one embodiment of the present invention, the system also includes a sixth module, which is used to determine a first kernel module that is dependent on the kernel module and compile the first kernel module; the first kernel module is determined by viewing documents, analyzing codes, and using command tools.

[0099] Optionally, in one embodiment of the present invention, the system further includes a seventh module, configured to:

[0100] Check the kernel documentation and determine the compilation command interface through the preset folder;

[0101] Alternatively, the makefile file is analyzed to determine the compilation command interface.

[0102] It can be seen that the contents of the above method embodiments are all applicable to the present system embodiments, the functions specifically implemented by the present system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0103] Reference Figure 4 , an embodiment of the present invention provides a kernel module compatible operation device, comprising:

[0104] at least one processor 410;

[0105] At least one memory 420, used to store at least one program;

[0106] When the at least one program is executed by the at least one processor 410, the at least one processor 410 implements the kernel module compatible operation method.

[0107] Similarly, the contents of the above method embodiments are all applicable to the present device embodiments. The functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0108] An embodiment of the present invention further provides a computer-readable storage medium, in which a program executable by a processor is stored. When the program executable by the processor is executed by the processor, it is used to execute the above-mentioned kernel module compatible operation method.

[0109] Similarly, the contents of the above method embodiments are all applicable to the present storage medium embodiments. The functions specifically implemented by the present storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0110] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the present invention is provided by way of example, for the purpose of providing a more comprehensive understanding of technology. The disclosed method is not limited to the operation and logic flow presented herein. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part for which is described as a larger operation is performed independently.

[0111] In addition, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise specified, one or more of the functions and / or features can be integrated into a single physical device and / or software module, or one or more functions and / or features can be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present invention. More specifically, in view of the properties, functions and internal relationships of the various functional modules in the device disclosed herein, the actual implementation of the module will be understood within the conventional skills of the engineer. Therefore, those skilled in the art can implement the present invention set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.

[0112] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several programs to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0113] The logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable programs for implementing the logical functions, and may be embodied in any computer-readable medium for use by a program execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch and execute a program from a program execution system, device or apparatus), or in conjunction with such program execution systems, devices or apparatuses. For purposes of this specification, a "computer-readable medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by a program execution system, device or apparatus, or in conjunction with such program execution systems, devices or apparatuses.

[0114] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.

[0115] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable program execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0116] In the above description of this specification, the description with reference to the terms "one embodiment / example", "another embodiment / example" or "certain embodiments / examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0117] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.

[0118] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the embodiments. Those skilled in the art may make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present invention.

Claims

1. A kernel module compatible operation method, characterized in that: The following steps are involved: Determine the temporary file corresponding to the source code of the kernel module; Calling a compile command interface to compile the kernel module based on the temporary file to obtain a compiled kernel module; Insert the compiled kernel module into the kernel and load the kernel module.

2. The kernel module compatible operation method according to claim 1, characterized in that: The method further comprises: If the program is started, determine the temporary file corresponding to the source code of the kernel module; The compile time is determined according to the function of the kernel module.

3. The kernel module compatible operation method according to claim 2, characterized in that: The method further comprises: If the compiling time is longer than a preset time, a thread is created, and the kernel module is compiled based on the temporary file to obtain a compiled kernel module.

4. The kernel module compatible operation method according to claim 1, characterized in that: The step of compiling the kernel module based on the temporary file to obtain a compiled kernel module includes: The kernel module is compiled into a ko file through the make modules command to obtain a compiled kernel module.

5. The kernel module compatible operation method according to claim 1, characterized in that: Inserting the compiled kernel module into the kernel and loading the kernel module comprises: Use the make modules_install command to put the compiled kernel module into the preset directory; The compiled kernel module is loaded into the kernel through the insmod command.

6. The kernel module compatible operation method according to claim 1, characterized in that: The method further comprises: A first kernel module that is dependent on the kernel module is determined, and the first kernel module is compiled; the first kernel module is determined by viewing documents, analyzing codes, and using command tools.

7. The kernel module compatible operation method according to claim 1, characterized in that: The compile command interface is determined by the following steps: Check the kernel documentation and determine the compilation command interface through the preset folder; Alternatively, the makefile file is analyzed to determine the compilation command interface.

8. A kernel module compatible operating system, characterized in that: include: The first module is used to determine the temporary file corresponding to the source code of the kernel module; The second module is used to call the compile command interface to compile the kernel module based on the temporary file to obtain a compiled kernel module; The third module is used to insert the compiled kernel module into the kernel and load the kernel module.

9. A kernel module compatible operation device, characterized in that: include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the kernel module compatible operation method according to any one of claims 1 to 7.

10. A computer-readable storage medium storing a program executable by a processor, characterized in that: The processor-executable program is used to implement the kernel module compatible operation method according to any one of claims 1 to 7 when executed by the processor.