Compatibility determination method, device and storage medium for replacing kernel module of operating system

By judging the compatibility of the CentOS kernel module, the kernel module compatibility problem when CentOS is upgraded to a domestic operating system is solved, the seamless migration of the kernel module is achieved, and the user experience and migration effect are improved.

CN118626314BActive Publication Date: 2024-10-29KYLIN CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411080356.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-08
Publication Date
2024-10-29
Estimated Expiration
2044-08-08

AI Technical Summary

Technical Problem

When CentOS is upgraded to a domestic operating system, the upgrade fails due to differences in kernel version, architecture, interfaces, protocols, etc. It is impossible to determine whether the kernel module developed by CentOS can run directly on the domestic operating system.

Method used

Provides a method and device for determining compatibility of operating system replacement kernel modules. By obtaining the information of all kernel modules in the current CentOS environment, it determines whether there is a private kernel module, obtains the compatibility information of the private kernel module, and migrates the kernel of the system according to the target. The binary obtains the kernel symbol table, exports symbols and version numbers, and determines replacement compatibility.

Benefits of technology

It can determine the feasibility of kernel module migration, improve users' migration effect and experience, realize seamless migration of kernel modules, and reduce users' migration costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118626314B_ABST
    Figure CN118626314B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a compatibility judgment method, device and storage medium for replacing kernel modules of an operating system. The method comprises: obtaining information of all kernel modules in the current environment of centos, and judging whether the kernel modules include private kernel modules; when private kernel modules are included, obtaining compatibility information of the private kernel modules; obtaining kernel binary files of a target migration system, obtaining a kernel symbol table according to the kernel binary files, and exporting symbols and corresponding version numbers based on the kernel symbol table; determining replacement compatibility according to the compatibility information of the private kernel modules, the symbols and the corresponding version numbers. The migration feasibility of the kernel modules can be determined, thereby improving the migration effect and experience of users.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of program compatibility detection, and in particular to a compatibility determination method, device and storage medium for replacing a kernel module of an operating system. Background Art

[0002] Community Enterprise Operating System (CentOS) is one of the Linux distributions. It is a free, open source, and redistributable open source operating system. It is an open source operating system based on RHEL and has been widely used in servers, cloud computing, big data and other fields. However, due to the copyright and licensing restrictions of RHEL, CentOS cannot fully meet the needs of domestic users, especially in terms of security, controllability, and autonomy. Moreover, CentOS Linux will no longer have operating systems after CentOS Linux 9 after December 2020. Therefore, it is necessary to directly upgrade the CentOS operating system currently used by users to a domestic operating system.

[0003] Due to the differences between domestic operating systems and CentOS in kernel versions, architectures, interfaces, protocols, etc., it is impossible to determine whether the kernel modules developed for CentOS can run directly on domestic operating systems, which in turn affects the upgrade of the CentOS operating system. Summary of the invention

[0004] The embodiments of the present invention provide a compatibility judgment method, device and storage medium for replacing kernel modules of an operating system, so as to solve the technical problem in the prior art of upgrade failure caused by differences in kernel version, architecture, interface, protocol, etc. when upgrading CentOS to a domestic operating system.

[0005] In a first aspect, an embodiment of the present invention provides a method for determining compatibility of replacing a kernel module of an operating system, comprising:

[0006] Obtain information about all kernel modules in the current centos environment, and determine whether the kernel modules include private kernel modules;

[0007] When a private kernel module is included, obtaining compatibility information of the private kernel module;

[0008] Obtain a kernel binary file of a target migration system, obtain a kernel symbol table according to the kernel binary file, and derive symbols and corresponding version numbers based on the kernel symbol table;

[0009] The replacement compatibility is determined based on the compatibility information of the private kernel module, the symbol and the corresponding version number.

[0010] In a second aspect, an embodiment of the present invention further provides a device for determining compatibility of replacing a kernel module of an operating system, comprising:

[0011] A judgment module is used to obtain information about all kernel modules in the current centos environment and to judge whether the kernel modules include private kernel modules;

[0012] An acquisition module, used for acquiring compatibility information of a private kernel module when the private kernel module is included;

[0013] An export module, used for obtaining a kernel binary file of a target migration system, obtaining a kernel symbol table according to the kernel binary file, and exporting symbols and corresponding version numbers based on the kernel symbol table;

[0014] A determination module is used to determine replacement compatibility according to the compatibility information of the private kernel module, the symbol and the corresponding version number.

[0015] In a third aspect, an embodiment of the present invention further provides a storage medium comprising computer executable instructions, which, when executed by a computer processor, are used to execute the method for determining the compatibility of replacing a kernel module of an operating system as provided in the above embodiment.

[0016] The compatibility judgment method, device and storage medium for replacing kernel modules of an operating system provided by the embodiment of the present invention obtain information of all kernel modules in the current environment of centos, and judge whether the kernel modules include private kernel modules; when private kernel modules are included, obtain compatibility information of the private kernel modules; obtain the kernel binary file of the target migration system, obtain the kernel symbol table according to the kernel binary file, and derive symbols and corresponding version numbers based on the kernel symbol table; determine replacement compatibility according to the compatibility information of the private kernel module, the symbols and the corresponding version numbers. According to the kernel characteristics of centos, the private kernel information is found, and the kernel binary file of the target migration system is used to determine whether it is compatible with the private kernel, so as to determine the migration feasibility of the kernel module, thereby improving the migration effect and experience of the user. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0018] Figure 1 It is a flowchart of a method for determining compatibility of replacing a kernel module of an operating system provided in Embodiment 1 of the present invention;

[0019] Figure 2It is a flowchart of a method for determining compatibility of replacing a kernel module of an operating system provided in Embodiment 2 of the present invention;

[0020] Figure 3 It is a structural diagram of a device for determining compatibility of a kernel module replaced by an operating system provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0021] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0022] Embodiment 1

[0023] Figure 1 1 is a flowchart of a compatibility determination method for replacing a kernel module of an operating system provided in the first embodiment of the present invention. This embodiment is applicable to the case where the compatibility of replacing a kernel module is determined when a Cent OS operating system is upgraded to a domestic operating system. The method can be executed by a compatibility determination device for replacing a kernel module of an operating system, and specifically includes the following steps:

[0024] Step 110, obtain information of all kernel modules in the current centos environment, and determine whether the kernel modules include private kernel modules.

[0025] In the CentOS replacement scenario, the CentOS operating system currently used by users can be directly upgraded to a domestic operating system while retaining the user's current business data. The operating system usually involved in the process is Red Hat Enterprise Linux operating system, which is a Linux-based operating system designed by Red Hat specifically for enterprise users.

[0026] In the Linux operating system, the Linux kernel uses modular technology. This design allows the system kernel to be kept to a minimum while ensuring the scalability and maintainability of the kernel. The modular design allows modules to be loaded into the kernel only when needed, realizing dynamic kernel adjustment. It can dynamically add or delete functions to the kernel, such as drivers, file systems, network protocols, etc., without recompiling the kernel. Kernel modules can improve the scalability, maintainability and flexibility of the kernel. They are mainly divided into the following categories: process scheduling module, inter-process communication module, memory management module, file system module and network interface module.

[0027] CentOS, as a kind of Linux operating system, also has kernel modules, and at the same time, it also has private kernel modules. Private kernel modules are not provided by the kernel, and can be compiled and installed by users. It has higher flexibility. Therefore, when replacing the domestic operating system, it is necessary to determine whether there is a private kernel module. The determination of whether the kernel module includes a private kernel module may include: if the path of the module is not in the kernel module directory, it is determined that there is a private kernel module; if the path of the module is in the kernel module directory, it is determined that the name of the module exists in the module name configured in the kernel configuration file. If it does not exist, it is determined that there is a private kernel module; if it exists, it is determined whether the size of the module is consistent with the size in the kernel configuration file. If it is inconsistent, it is determined that there is a private kernel module. That is, if the path is not in the / lib / modules / $(uname -r) / kernel directory, it can be considered that there is a private kernel module. If the path is in the above directory, further judgment is required. Specifically, it can be determined whether the name of the module exists in the kernel name in the corresponding kernel configuration file. If it does not exist, it is still considered that there is a kernel module. When there is a corresponding kernel name, it is necessary to further determine whether the size of the module is consistent with the size in the kernel configuration file. If not, it is determined that there is a private kernel module.

[0028] If the kernel module does not exist, there is no need to judge the compatibility, and centos can be directly upgraded to a domestic operating system.

[0029] Step 120: When a private kernel module is included, obtain compatibility information of the private kernel module.

[0030] After determining the existence of a private kernel module, it is necessary to obtain the compatibility-related information of the private kernel module, and based on this, determine whether it is compatible with the upgraded target domestic operating system. Exemplarily, the compatibility information of the private kernel module can be obtained in the following way: obtain the kernel binary interface information through the kernel module object file display command or the kernel module object information file, and the kernel binary interface information includes the kernel symbols and their version numbers that the kernel module depends on. The kernel symbol table is a symbol table of functions and variables that can be referenced externally in the kernel's internal functions or variables. It can be regarded as an index file, and its purpose is to allow external software to know the actual allocated location inside the kernel file.

[0031] Step 130, obtaining a kernel binary file of the target migration system, obtaining a kernel symbol table according to the kernel binary file, and exporting symbols and corresponding version numbers based on the kernel symbol table.

[0032] Since the target migration system may be in different states, for example, installed and not installed. Therefore, in this embodiment, the compatibility of the target migration system can be evaluated before it is installed. Exemplarily, it can include: when the target migration system is in the installation completed state, the kernel version is obtained by displaying the kernel version command, and the corresponding kernel binary file is found from the / boot directory; when the target migration system is not installed, the installation image of the target migration system is obtained, and the kernel binary file is extracted from the installation image. For an already installed Linux system, the kernel version of the target migration Linux system can be queried using various existing commands, and the kernel binary file can be obtained from the kernel directory.

[0033] If the target Linux system to be migrated is not installed, the kernel binary file can be extracted from the installation image according to the name and path.

[0034] After obtaining the kernel binary file, by parsing the virtual file of the kernel binary file, the virtual file is not a real file. The virtual file in the kernel provides access to the services provided by the kernel when running. Therefore, the kernel symbol table can be read from the virtual file.

[0035] Exemplarily, a symbol information can be obtained from each line of the virtual file, as shown below:

[0036] <address> <type> <symbol>

[0037] <address>: The memory address of the symbol in the kernel.

[0038] <type>: The type of symbol, common types include:

[0039] T: represents global function (global text segment).

[0040] t: represents a local function (local text segment).

[0041] D: represents global variables (global data segment).

[0042] d: represents local variables (local data segment).

[0043] B: represents uninitialized global variables (BSS segment).

[0044] b: represents uninitialized local variables (BSS segment).

[0045] R: Indicates read-only data segment.

[0046] r: Indicates a local read-only data segment.

[0047] A: Indicates absolute symbol.

[0048] N: Indicates debugging symbols.

[0049] n: Indicates local debugging symbols.

[0050] Using the above method, you can get the symbol table and export the symbols and corresponding versions.

[0051] In the system, the kernel binary file can exist in the form of an executable file or a compressed file. Therefore, it is necessary to obtain the kernel binary file for different file formats. For example, the kernel symbol table can be obtained in the following way:

[0052] If the kernel binary file is an executable file, the kernel symbol table is obtained by parsing the virtual file dynamically generated by the kernel, and the exported symbols and their versions are filtered out from the symbol table;

[0053] If the kernel binary file is a compressed file, you can use the xzcat command or the zcat command to decompress the kernel binary file, obtain the kernel symbol table by parsing the virtual file dynamically generated by the kernel, and filter out the exported symbols and their versions from the symbol table.

[0054] Step 140, determining replacement compatibility according to the compatibility information of the private kernel module, the symbol and the corresponding version number.

[0055] Exemplarily, determining the replacement compatibility according to the compatibility information of the private kernel module, the symbol and the corresponding version number may include: when the private kernel module does not specify the version of the symbol, judging whether the target kernel has the same symbol, and if so, determining that there is replacement compatibility; when the private kernel module specifies the version of the symbol, judging whether the target kernel provides the same symbol and version, or the version of the symbol is backward compatible, and determining that there is replacement compatibility when the same symbol and version are provided or the version is backward compatible. If the private kernel module has a version of the specified symbol or a backward compatible version, compatibility may be determined by the version. However, the private kernel module is usually not written into the corresponding version, and therefore, the symbols in the target kernel and the symbols of the private kernel module may be compared, and when the same symbols exist, it may be determined that there is replacement compatibility.

[0056] Furthermore, a private kernel module and analysis document may be generated based on the information obtained in the above steps, and the binary interface information of the private kernel module and the kernel binary of the target migration system may be written into the document, so that the user can view and analyze it.

[0057] This embodiment obtains information of all kernel modules in the current centos environment, and determines whether the kernel modules include private kernel modules; when private kernel modules are included, obtains compatibility information of the private kernel modules; obtains the kernel binary file of the target migration system, obtains the kernel symbol table according to the kernel binary file, and exports symbols and corresponding version numbers based on the kernel symbol table; determines replacement compatibility according to the compatibility information of the private kernel module, the symbols and the corresponding version numbers. According to the kernel characteristics of centos, the private kernel information is found, and the kernel binary file of the target migration system is used to determine whether it is compatible with the private kernel, so as to determine the migration feasibility of the kernel module, thereby improving the migration effect and experience of the user.

[0058] Embodiment 2

[0059] Figure 2 It is a flow chart of the compatibility judgment method for replacing kernel modules of an operating system provided in the second embodiment of the present invention. This embodiment is optimized based on the above embodiment, and the method can also add the following steps: using a compression tool to package the binary files and dependent files of the private kernel module to generate a compressed file; copying the compressed file to other file directories of the kernel module of the target migration system or to a defined private directory; using a dependency analysis command to update the module dependency of the target migration system so that the copied private kernel module can be loaded correctly; according to the module dependency, using a load module command or other tools to load the private kernel module, or creating a configuration file that uses the private kernel module as a loading parameter in the location directory of the core loading module, so that the private kernel module can be automatically loaded when the system starts.

[0060] See also Figure 2 The method for determining compatibility of replacing a kernel module by an operating system comprises:

[0061] Step 210, obtain information of all kernel modules in the current centos environment, and determine whether the kernel modules include private kernel modules.

[0062] Step 220: When a private kernel module is included, obtain compatibility information of the private kernel module.

[0063] Step 230, obtaining a kernel binary file of the target migration system, obtaining a kernel symbol table according to the kernel binary file, and exporting symbols and corresponding version numbers based on the kernel symbol table.

[0064] Step 240: Determine replacement compatibility according to the compatibility information of the private kernel module, the symbol and the corresponding version number.

[0065] Step 250: When it is determined that the module has replacement compatibility, a compression tool is used to package the binary file and dependent files of the private kernel module to generate a compressed file.

[0066] In this embodiment, after determining that the private kernel module has replacement compatibility with the target migration system in the above manner, replacement can be performed. Exemplarily, firstly, the binary file of the private kernel module and the corresponding dependent files are determined, and they can be packaged to generate a compressed file by using the tar command or other tools.

[0067] Step 260: copy the compressed file to other file directories of the kernel module of the target migration system or to a defined private directory.

[0068] Copy the compressed file to the / lib / modules / $(uname -r) / extra directory of the target migration system, or to another suitable directory. Another suitable directory can be the location where the kernel module is located in the target migration system or the location specified by the kernel module.

[0069] Step 270: Use a dependency analysis command to update the module dependency of the target migration system so that the copied private kernel module can be correctly loaded.

[0070] Exemplarily, the module dependencies of the target migration system may be updated using the depmod command or other tools, and the dependencies of the migrated kernel modules may be re-associated using the above command or tools so that the migrated private kernel modules are correctly loaded in the target migration system.

[0071] Step 280, according to the module dependency, use a load module command or other tool to load the private kernel module, or create a configuration file in the location directory of the core loading module that uses the private kernel module as a loading parameter, so that the private kernel module can be automatically loaded when the system starts.

[0072] Exemplarily, the private kernel module may be loaded using the modprobe command or other tools, or a corresponding configuration file may be created in the / etc / modules-load.d directory, so that the private kernel module can be automatically loaded when the system starts.

[0073] This embodiment adds the following steps: using a compression tool to package the binary file and dependent files of the private kernel module to generate a compressed file; copying the compressed file to the kernel module other file directory of the target migration system or to the defined private directory; using the dependency analysis command to update the module dependency of the target migration system so that the copied private kernel module can be correctly loaded; according to the module dependency, using the load module command or other tools to load the private kernel module, or creating a configuration file that uses the private kernel module as a loading parameter in the location directory of the core loading module, so that the private kernel module can be automatically loaded when the system starts. It is possible to easily package the currently compatible private kernel modules and migrate them to the new system, that is, to package the binary file and dependent files of the private kernel module into a compressed file, copy it to the appropriate directory of the target system, update the module dependency, load the private kernel module, thereby realizing the seamless migration of the kernel module, and reducing the migration cost of the user.

[0074] Embodiment 3

[0075] Figure 3 is a schematic diagram of the structure of the device for judging the compatibility of replacing a kernel module with an operating system provided in the third embodiment of the present invention, see Figure 3 , the operating system replaces the kernel module compatibility judgment device, comprising:

[0076] The judgment module 310 is used to obtain information of all kernel modules in the current centos environment and judge whether the kernel modules include private kernel modules;

[0077] An acquisition module 320, configured to acquire compatibility information of a private kernel module when the private kernel module is included;

[0078] The export module 330 is used to obtain a kernel binary file of the target migration system, obtain a kernel symbol table according to the kernel binary file, and export symbols and corresponding version numbers based on the kernel symbol table;

[0079] The determination module 340 is used to determine the replacement compatibility according to the compatibility information of the private kernel module, the symbol and the corresponding version number.

[0080] The operating system replacement kernel module compatibility judgment device provided in this embodiment obtains information of all kernel modules in the current centos environment and judges whether the kernel modules include private kernel modules; when private kernel modules are included, obtains compatibility information of the private kernel modules; obtains the kernel binary file of the target migration system, obtains the kernel symbol table according to the kernel binary file, and derives symbols and corresponding version numbers based on the kernel symbol table; determines replacement compatibility according to the compatibility information of the private kernel module, the symbols and the corresponding version numbers. According to the kernel characteristics of centos, the private kernel information is found, and the kernel binary file of the target migration system is used to determine whether it is compatible with the private kernel, so as to determine the migration feasibility of the kernel module, thereby improving the migration effect and experience of the user.

[0081] Based on the above embodiments, the device further includes:

[0082] The packaging module is used to use compression tools to package the binary files and dependent files of private kernel modules to generate compressed files;

[0083] A copy module, used for copying the compressed file to other file directories of the kernel module of the target migration system or to a defined private directory;

[0084] Update module, used to update the module dependency of the target migration system using dependency analysis command, so that the copied private kernel module can be loaded correctly;

[0085] Create a module for loading the private kernel module using a load module command or other tool according to the module dependency, or create a configuration file that uses the private kernel module as a loading parameter in the location directory of the core loading module, so that the private kernel module can be automatically loaded when the system starts.

[0086] Based on the above embodiments, the judgment module includes:

[0087] The acquisition unit uses a module command that lists the modules loaded into the system or a module loading list file to obtain information about all kernel modules in the current environment, including module name, module path, module size, and module dependency information.

[0088] Based on the above embodiments, the judgment module further includes:

[0089] A first determining unit determines that a private kernel module exists if the path of the module is not in the kernel module directory;

[0090] The second determining unit determines whether the name of the module exists in the module name configured in the kernel configuration file if the path of the module is in the kernel module directory, and if not, determines that the private kernel module exists;

[0091] The third confirmation unit determines whether the size of the module is consistent with the size in the kernel configuration file when the module exists, and determines that the private kernel module exists when the module does not exist.

[0092] Based on the above embodiments, the acquisition module includes:

[0093] The acquisition unit is used to acquire kernel binary interface information through a kernel module object file display command or a kernel module object information file, wherein the kernel binary interface information includes kernel symbols and version numbers that the kernel module depends on.

[0094] Based on the above embodiments, the export module includes:

[0095] Find the unit, which is used to obtain the kernel version through the display kernel version command when the target migration system is in the installation completion state, and find the corresponding kernel binary file from the / boot directory;

[0096] The extraction unit is used to obtain the installation image of the target migration system when the target migration system is in an uninstalled state, and extract the kernel binary file from the installation image.

[0097] Based on the above embodiments, the export module further includes:

[0098] The first export screening unit, if the kernel binary file is an executable file, obtains the kernel symbol table by parsing the virtual file dynamically generated by the kernel, and screens the export symbols and their versions from the symbol table;

[0099] Second, filter the export unit. If the kernel binary file is a compressed file, you can use the xzcat command or the zcat command to decompress the kernel binary file, obtain the kernel symbol table by parsing the virtual file dynamically generated by the kernel, and filter out the export symbols and their versions from the symbol table.

[0100] Based on the above embodiments, the determining module includes:

[0101] A first judgment unit is used to judge whether the target kernel has the same symbol when the private kernel module does not have a version of the specified symbol, and if so, determine whether there is replacement compatibility;

[0102] The second judgment unit is used to judge whether the target kernel provides the same symbol and version or the symbol version is backward compatible when the private kernel module specifies the symbol version, and determine whether there is replacement compatibility when the same symbol and version are provided or the version is backward compatible.

[0103] The operating system replacement kernel module compatibility determination device provided in the embodiment of the present invention can execute the operating system replacement kernel module compatibility determination method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0104] Embodiment 4

[0105] Embodiment 4 of the present invention further provides a storage medium comprising computer executable instructions, which, when executed by a computer processor, are used to execute the compatibility determination method for replacing a kernel module of an operating system as described in any one of the above embodiments.

[0106] The computer storage medium of the embodiment of the present invention may adopt any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device.

[0107] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0108] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0109] Computer program code for performing the operations of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or device. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0110] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.< / type> < / address> < / symbol> < / type> < / address>

Claims

1. A method for determining compatibility of replacing a kernel module of an operating system, characterized in that: include: Obtain information about all kernel modules in the current centos environment, and determine whether the kernel modules include private kernel modules, where the private kernel modules are provided by non-kernels and are compiled and installed by the user. When a private kernel module is included, obtaining compatibility information of the private kernel module; Obtain a kernel binary file of a target migration system, obtain a kernel symbol table according to the kernel binary file, and derive symbols and corresponding version numbers based on the kernel symbol table; Determining replacement compatibility based on the compatibility information of the private kernel module, the symbol and the corresponding version number; The determining whether the kernel module includes a private kernel module comprises: If the module path is not in the kernel module directory, it is determined that a private kernel module exists; If the path of the module is in the kernel module directory, determine whether the name of the module exists in the module name configured in the kernel configuration file, and if not, determine that a private kernel module exists; If it exists, determine whether the size of the module is consistent with the size in the kernel configuration file, and if it is inconsistent, determine that there is a private kernel module; The obtaining the compatibility information of the private kernel module includes: Obtaining kernel binary interface information through a kernel module object file display command or a kernel module object information file, wherein the kernel binary interface information includes kernel symbols and version numbers on which the kernel module depends; The determining of replacement compatibility according to the compatibility information of the private kernel module, the symbol and the corresponding version number includes: When the private kernel module does not specify the version of the symbol, determining whether the target kernel has the same symbol, and if so, determining whether there is replacement compatibility; When the private kernel module specifies the version of the symbol, it is determined whether the target kernel provides the same symbol and version, or the symbol version is backward compatible. When the same symbol and version are provided or the versions are backward compatible, it is determined that there is replacement compatibility.

2. The method according to claim 1, characterized in that The method further comprises: Use compression tools to package the binary files and dependent files of the private kernel module into a compressed file; Copy the compressed file to other file directories of the kernel module of the target migration system or to a defined private directory; Use the dependency analysis command to update the module dependencies of the target migration system so that the copied private kernel modules can be loaded correctly; According to the module dependency, use a load module command or other tool to load the private kernel module, or create a configuration file that uses the private kernel module as a loading parameter in the location directory of the core loading module, so that the private kernel module can be automatically loaded when the system starts.

3. The method according to claim 1, characterized in that The information of all kernel modules in the current centos environment is obtained, including: Use the command to list the modules loaded into the system or the module load list file to obtain information about all kernel modules in the current environment, including module name, module path, module size, and module dependency information.

4. The method according to claim 1, characterized in that: The step of obtaining the kernel binary file of the target migration system includes: When the target migration system is in the installation complete state, use the display kernel version command to obtain the kernel version and find the corresponding kernel binary file in the / boot directory; When the target migration system is in an uninstalled state, an installation image of the target migration system is obtained, and a kernel binary file is extracted from the installation image.

5. The method according to claim 1, characterized in that The exporting of symbols and corresponding version numbers based on the kernel symbol table includes: If the kernel binary file is an executable file, the kernel symbol table is obtained by parsing the virtual file dynamically generated by the kernel, and the exported symbols and their versions are filtered out from the symbol table; If the kernel binary file is a compressed file, use the xzcat command or the zcat command to decompress the kernel binary file, obtain the kernel symbol table by parsing the virtual file dynamically generated by the kernel, and filter out the exported symbols and their versions from the symbol table.

6. A device for determining compatibility of a kernel module when replacing an operating system, characterized in that: include: A judgment module is used to obtain information about all kernel modules in the current centos environment and to judge whether the kernel modules include private kernel modules, where the private kernel modules are provided by non-kernels and are compiled and installed by users themselves; An acquisition module, used for acquiring compatibility information of a private kernel module when the private kernel module is included; An export module, used for obtaining a kernel binary file of a target migration system, obtaining a kernel symbol table according to the kernel binary file, and exporting symbols and corresponding version numbers based on the kernel symbol table; A determination module, configured to determine replacement compatibility according to the compatibility information of the private kernel module, the symbol and the corresponding version number; The judging module further includes: A first determining unit determines that a private kernel module exists if the path of the module is not in the kernel module directory; The second determining unit determines whether the name of the module exists in the module name configured in the kernel configuration file if the path of the module is in the kernel module directory, and if not, determines that the private kernel module exists; A third confirmation unit, when present, determines whether the size of the module is consistent with the size in the kernel configuration file, and when inconsistent, determines that a private kernel module exists; The acquisition module comprises: An acquisition unit, used to acquire kernel binary interface information through a kernel module object file display command or a kernel module object information file, wherein the kernel binary interface information includes kernel symbols and version numbers on which the kernel module depends; The determining module comprises: A first judgment unit is used to judge whether the target kernel has the same symbol when the private kernel module does not have a version of the specified symbol, and if so, determine whether there is replacement compatibility; The second judgment unit is used to judge whether the target kernel provides the same symbol and version or the symbol version is backward compatible when the private kernel module specifies the symbol version, and determine whether there is replacement compatibility when the same symbol and version are provided or the version is backward compatible.

7. A storage medium containing computer executable instructions, characterized in that: The computer executable instructions, when executed by a computer processor, are used to execute the method for determining compatibility of replacing a kernel module of an operating system as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Operating system kernel compatibility quantitative analysis method and system and medium

    CN111966383A

  • Operation system migration method, migration application and migration application deployment method

    CN115617489A