Kernel upgrading and degrading automatic drive adaptation method, device, equipment and medium

Through the automated kernel upgrade and downgrade driver adaptation method, the problem of inconsistent requirements for the kernel version of cloud applications is solved, and the automated adaptation of kernel and drivers is realized to ensure the system's device availability and stability during the kernel upgrade process.

CN119847612AActive Publication Date: 2025-04-18CHINA TELECOM CLOUD TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411629917.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-14
Publication Date
2025-04-18
Estimated Expiration
2044-11-14

AI Technical Summary

Technical Problem

When deploying the upper-layer cloud application of the operating system, the requirements for the underlying kernel version of the cloud application vary, resulting in the need to change and upgrade the system kernel on the original system. During the upgrade process, the system may not recognize the storage array or network card, resulting in the unavailability of the network.

Method used

Provides a kernel upgrade and downgrade automated driver adaptation method. By filtering out driver configuration files that meet the conditions based on the target architecture, target kernel version and yum warehouse URL parameters, parsing the device PCI identification information supported by the driver, scanning the device information that needs to be installed on the server, creating a yum repo file, installing the target version kernel package, performing symbol table compatibility verification, and integrating the drivers supported in the target kernel into the initramfs file.

Benefits of technology

It realizes batch OOB driver installation and configuration according to the server hardware configuration, which is suitable for all server configurations, ensuring the automatic installation and configuration of device drivers during kernel upgrade, and solving the worries of kernel upgrade and downgrade.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119847612A_ABST
    Figure CN119847612A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of kernel upgrading and degrading and drive adaptation, and discloses a kernel upgrading and degrading automatic drive adaptation method and device, equipment and a medium, and the method comprises the steps: screening out a drive configuration file meeting a parameter condition from OOB drive installation configuration files according to a target architecture, a target kernel version and a yum warehouse URL parameter; analyzing to obtain PCI identification information of equipment supported by the driver; scanning information of equipment needing to install the OOB driver on the server, and storing related information on which the installation driver depends; creating a yum repo file required for installing the driver; installing the target version kernel package, and performing compatibility verification on the symbol table of the old kernel version in the configuration file and the symbol table of the target kernel version; according to the method, the drive configuration files are screened out in batches, targeted drive installation configuration is achieved, and the method is suitable for configuration of all servers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Linux kernel upgrade and downgrade and driver adaptation, and in particular to a kernel upgrade and downgrade automatic driver adaptation method, device, equipment and medium. Background Art

[0002] At present, when deploying cloud applications on the operating system, some cloud applications have different requirements for the underlying kernel version, which requires the system kernel to be changed on the original system. In addition, sometimes it is also necessary to upgrade the kernel of the original system in order to fix important vulnerabilities in the operating system. If you only upgrade the kernel without taking care of the raid card that must be supported by the OOB driver, it may cause the system to fail to recognize the storage array connected to the raid card where the operating system is located during startup, or fail to recognize the corresponding network card, resulting in network unavailability. Summary of the invention

[0003] In view of this, the present invention provides a kernel upgrade and downgrade automatic driver adaptation method, device, equipment and medium to solve the problem of how to perform targeted OOB driver installation and configuration in batches according to the hardware configuration on the server.

[0004] In a first aspect, the present invention provides a kernel upgrade and downgrade automatic driver adaptation method, the method comprising:

[0005] According to the target architecture, target kernel version and yum repository URL parameters, filter out the driver configuration files that meet the parameter conditions from the OOB driver installation configuration files;

[0006] Parse the filtered driver configuration files, obtain the PCI identification information of the devices supported by the driver, and save it to a temporary file;

[0007] Scan the device information on the server that needs to install the OOB driver, and save the relevant information of the driver installation dependency to the configuration file;

[0008] Create the yum repo file required to install the driver;

[0009] Install the target kernel version package and perform compatibility check between the symbol table of the old kernel version in the configuration file and the symbol table of the target kernel version;

[0010] Integrate drivers supported by the target kernel into the initramfs file.

[0011] The present invention screens out driver configuration files in batches according to the target architecture, target kernel version and yum repository URL parameters, obtains PCI identification information of devices supported by the driver, and screens out drivers suitable for the kernel based on OOB driver configuration information, so as to facilitate targeted OOB driver installation and configuration, install the target version kernel package for all server configurations, perform compatibility verification, and realize automatic installation and configuration of device drivers requiring OOB drivers, thereby solving the worries of kernel upgrade and downgrade.

[0012] In an optional implementation, according to the target architecture, the target kernel version, and the yum repository URL parameter, a driver configuration file that meets the parameter conditions is screened out from the OOB driver installation configuration file, including:

[0013] Pass the target architecture, target kernel version, and yum repository URL parameters to the main upgrade script to filter out drivers that are suitable for the target kernel version under the target architecture;

[0014] Use the yum repository URL parameter to replace the URL variable information in the driver configuration file to generate a new driver configuration file.

[0015] The present invention uses a main upgrade script to filter out drivers suitable for the kernel under the architecture based on OOB driver configuration information, and uses variable replacement to generate a driver configuration file for unified processing according to different server configurations, thereby meeting the batch upgrade requirements of the server.

[0016] In an optional implementation, parsing the filtered driver configuration file to obtain PCI identification information of the device supported by the driver includes:

[0017] Parse the filtered driver configuration files to get the location of the target kernel driver in the YUM source;

[0018] Download the RPM software package corresponding to the driver to a temporary file according to the location of the target kernel driver in the YUM source;

[0019] Unzip the ko file corresponding to the driver from the RPM software package;

[0020] Retrieve the PCI identification information of the devices that can be supported in the driver ko file.

[0021] The present invention parses the driver configuration file to obtain the device collection supported by the driver module, and directly provides the compiled driver PRM package by downloading the PRM software package corresponding to the driver to a temporary file, thereby saving the time of repeated compilation while ensuring safety.

[0022] In an optional implementation, scanning the device information on the server for which the OOB driver needs to be installed includes:

[0023] Scan the PCI identification information of all OOB driver devices that need to be installed under the target kernel saved in the temporary file;

[0024] Compare the PCI identification information of all OOB driver devices that need to be installed in the target kernel with the output information of the current system to determine the device information of the OOB driver that needs to be installed on the server.

[0025] The present invention obtains all OOB driver device information that needs to be installed by scanning, and compares the scanned OOB driver device information that needs to be installed with the output information under the current system, so as to batch determine the device information of the OOB driver that needs to be installed on the server, so as to facilitate batch OOB driver adaptation.

[0026] In an optional implementation, after performing compatibility check on the symbol table of the old kernel version in the configuration file and the symbol of the target kernel version, the method further includes:

[0027] If the compatibility check passes, the driver that passes KABI compatibility is created as a soft link of the driver of the new kernel;

[0028] Install a new kernel driver that does not pass KABI compatibility.

[0029] The present invention creates a soft link as a new kernel driver for a KABI-compatible driver, and directly installs the new kernel driver for an incompatible driver to ensure that the driver can work normally between kernels of different versions to avoid instability caused by changes in the kernel interface. At the same time, maintaining KABI compatibility can reduce the workload of recompilation.

[0030] In an optional implementation, integrating the drivers supported in the target kernel into the initramfs file includes:

[0031] Use the dracut -f --kver <upgraded kernel version> command to integrate the drivers supported by the new kernel into the initramfs file.

[0032] The present invention integrates the driver in the kernel into the initramfs file, so as to fully combine the weak-update characteristics of the driver when the kernel is upgraded, thereby saving storage resources.

[0033] In a second aspect, the present invention provides a kernel upgrade and downgrade automatic drive adaptation device, the device comprising:

[0034] The filtering module is used to filter out driver configuration files that meet the parameter conditions from the OOB driver installation configuration files according to the target architecture, target kernel version, and yum repository URL parameters;

[0035] The parsing module is used to parse the filtered driver configuration files, obtain the PCI identification information of the devices supported by the driver, and save it in a temporary file;

[0036] The scanning module is used to scan the device information on the server that needs to install the OOB driver, and save the relevant information of the driver installation dependency to the configuration file;

[0037] Create a module to create the yum repo file required to install the driver;

[0038] A verification module is used to install the target version kernel package and perform compatibility verification on the symbol table of the old kernel version in the configuration file and the symbol table of the target kernel version;

[0039] The driver integration module is used to integrate the drivers supported by the target kernel into the initramfs file.

[0040] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the kernel upgrade and downgrade automatic drive adaptation method of the above-mentioned first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0041] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the kernel upgrade and downgrade automatic driver adaptation method of the first aspect or any corresponding embodiment thereof.

[0042] In a fifth aspect, the present invention provides a computer program product, including computer instructions, which are used to enable a computer to execute the kernel upgrade and downgrade automatic driver adaptation method of the above-mentioned first aspect or any corresponding embodiment. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0044] Figure 1is a flowchart of a kernel upgrade and downgrade automatic driver adaptation method according to an embodiment of the present invention;

[0045] Figure 2 is an application diagram of the kernel upgrade and downgrade automatic driver adaptation method according to an embodiment of the present invention;

[0046] Figure 3 is a structural block diagram of a kernel upgrade and downgrade automatic drive adaptation device according to an embodiment of the present invention;

[0047] Figure 4 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0049] According to an embodiment of the present invention, an embodiment of a kernel upgrade and downgrade automatic driver adaptation method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0050] In this embodiment, a kernel upgrade and downgrade automatic driver adaptation method is provided. Figure 1 is a flow chart of a kernel upgrade and downgrade automatic driver adaptation method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0051] Step S101, according to the target architecture, target kernel version and yum repository URL parameters, filter out the driver configuration files that meet the parameter conditions from the OOB driver installation configuration files.

[0052] In the embodiment of the present invention, taking the source OS kernel version 0062 and preparing to upgrade to the 0064 kernel as an example, according to the target architecture arch, target kernel version and yum repo url input parameters, the driver package configuration of the symbol parameter condition is screened out from the OOB driver installation configuration file. It should be noted that the OOB driver (out of box driver) refers to the driver that comes with the non-kernel rpm package, which is usually provided by the device manufacturer.

[0053] Step S102, parsing the filtered driver configuration file, obtaining PCI identification information of the device supported by the driver, and saving it into a temporary file.

[0054] In the embodiment of the present invention, the driver configuration file is parsed by a script to obtain the pciids information of all devices supported by the driver that meet the parameter conditions of step S101, and save it in a temporary file OOB_hardware.conf.

[0055] Step S103, scanning the device information on the server that needs to install the OOB driver, and saving the relevant information on which the driver installation depends in the configuration file.

[0056] In an embodiment of the present invention, a script is called to scan which devices on the server need to install the OOB driver, and the device information that needs to install the OOB driver is obtained by scanning. At the same time, all files required to install the driver are written into the oob_pciids.json configuration file.

[0057] Step S104, creating a yum repo file required for installing the driver.

[0058] In the embodiment of the present invention, the create_driver_repo.sh script is called to create the yum repo file required for installing the driver, that is, to create a local yum source.

[0059] Step S105 , installing the target version kernel package, and performing a compatibility check between the symbol table of the old kernel version in the configuration file and the symbol table of the target kernel version.

[0060] In the embodiment of the present invention, the current 0064 kernel is not installed in the system. First, the 0064 kernel package is installed, and then the KABI compatibility check is performed on the symbol table of the old kernel version in the oob_pciids.json configuration file and the kernel symbol table of the 0064 kernel through a script.

[0061] Step S106, integrating the drivers supported by the target kernel into the initramfs file.

[0062] In the embodiment of the present invention, the installed OOB driver is integrated into the initramfs file, that is, the driver supported in the new kernel is integrated into the initramfs file.

[0063] Compared with the existing upgrade configuration of a single driver for a certain server, including the compilation and adaptation of a single RAID card driver or a single network card driver, this embodiment can perform targeted OOB driver installation and configuration in batches according to the hardware configuration on the server, and is applicable to all server configurations.

[0064] The kernel upgrade and downgrade automatic driver adaptation method provided in this embodiment screens out driver configuration files in batches according to the target architecture, target kernel version and yum repository URL parameters, and obtains the PCI identification information of the devices supported by the driver. Based on the OOB driver configuration information, the driver suitable for the kernel is screened out, so as to facilitate targeted OOB driver installation and configuration, so as to be applicable to all server configurations, install the target version kernel package, and perform compatibility verification to realize automatic installation and configuration of device drivers requiring OOB drivers, thereby solving the worries of kernel upgrade and downgrade.

[0065] In this embodiment, a kernel upgrade and downgrade automatic driver adaptation method is provided, and the process includes the following steps:

[0066] Step S201, according to the target architecture, target kernel version and yum repository URL parameters, filter out the driver configuration file that meets the parameter conditions from the OOB driver installation configuration file.

[0067] Specifically, the above step S201 includes:

[0068] Step S2011, passing the target architecture, target kernel version and yum repository URL parameters to the main upgrade script, and filtering out the drivers suitable for the target kernel version under the target architecture.

[0069] Step S2012, using the yum repository URL parameter to replace the URL variable information in the driver configuration file to generate a new driver configuration file.

[0070] In an embodiment of the present invention, three parameters, namely, target architecture x86-64, target kernel version 4.19.90-2102.2.0.0064.ctl2, and yum repository URL parameter https: / / ctyunos.ctyun.cn / hostos / , are passed to the main upgrade script. The main upgrade script will screen out some drivers suitable for the 4.19.90-2102.2.0.0064.ctl2 kernel under the x86-64 architecture based on all OOB driver configuration information in oob_driver.json, and replace the URL variable information in the driver configuration file with https: / / ctyunos.ctyun.cn / hostos / to generate a new driver configuration file oob_driver-new.json.

[0071] The main upgrade script is used to filter out the kernel-friendly drivers under the architecture based on the OOB driver configuration information, and the driver configuration file is generated using variable replacement for unified processing based on different server configurations, thereby meeting the batch upgrade requirements of the servers.

[0072] Step S202, parsing the filtered driver configuration file, obtaining PCI identification information of the device supported by the driver, and saving it into a temporary file.

[0073] Specifically, the above step S202 includes:

[0074] Step S2021, parse the filtered driver configuration file to obtain the location of the target kernel driver in the YUM source.

[0075] Step S2022, downloading the RPM software package corresponding to the driver to a temporary file according to the location of the target kernel driver in the YUM source.

[0076] Step S2023, decompress the ko file corresponding to the driver from the RPM software package.

[0077] Step S2024, retrieving the PCI identification information of the supported devices in the driver ko file.

[0078] In an embodiment of the present invention, the driver configuration file is parsed by the rpm_extract_pciids.sh script. The script will first download the RPM software package corresponding to the driver to a temporary file according to the location of the 064 kernel driver in the yum source in the new driver configuration file oob_driver-new.json, and decompress the ko file corresponding to the driver from the RPM software package, decompress the ko file corresponding to the driver, and then use the modinfo command to view the pciids information of the devices that can be supported in the 0064 driver ko file, and save it to the temporary file OOB_hardware.conf file.

[0079] By parsing the driver configuration file, the device collection supported by the driver module is obtained. By downloading the PRM software package corresponding to the driver to a temporary file, the compiled driver PRM package is directly provided, which saves the time of repeated compilation while ensuring security.

[0080] Step S203, scanning the device information on the server that needs to install the OOB driver, and saving the relevant information on which the driver installation depends in the configuration file.

[0081] Specifically, the device information on the server that needs to install the OOB driver scanned in the above step S203 includes:

[0082] Step S2031, scanning the PCI identification information of all OOB driver devices that need to be installed under the target kernel stored in the temporary file.

[0083] Step S2032: Compare the PCI identification information of all OOB driver devices that need to be installed in the target kernel with the output information of the current system to determine the device information of the OOB driver that needs to be installed on the server.

[0084] In the embodiment of the present invention, scanning is performed through the scan_devices_need_OOB.sh script, which compares the pciids information of all devices that need to install OOB drivers under the 064 kernel stored in the OOB_hardware.conf file with the lspci-nn output information under the current system to find the devices that need to install OOB drivers in the current system. The information of the devices that need to install OOB drivers on the server is scanned, and all the files that need to be installed for installing the driver are written to the oob_pciids.json configuration file.

[0085] All OOB driver device information that needs to be installed is obtained by scanning, and the scanned OOB driver device information that needs to be installed is compared with the output information under the current system, so as to batch determine the device information of the OOB driver that needs to be installed on the server, so as to facilitate batch OOB driver adaptation.

[0086] Step S204, creating a yum repo file required for installing the driver.

[0087] For details, please see Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.

[0088] Step S205 , installing the target version kernel package, and performing a compatibility check between the symbol table of the old kernel version in the configuration file and the symbol table of the target kernel version.

[0089] For details, please see Figure 1 Step S105 of the illustrated embodiment will not be described in detail here.

[0090] Step S205a: If the compatibility check passes, the driver that passes the KABI compatibility is created as a driver soft link of the new kernel.

[0091] Step S205b, installing a new kernel driver that does not pass KABI compatibility.

[0092] In an embodiment of the present invention, the symbol table that the old kernel version ko driver in the oob_pciids.json configuration file depends on and the kernel symbol table of the 0064 kernel are checked by the check-kabi script. If the compatibility test passes, the soft link of the OOB driver in the 0062 kernel that is compatible with KABI is created in the lib / modules directory of the 0064 kernel by the weak-modules command. According to the driver list in the oob_pciids.json configuration file, the soft link list that has been added is compared, and the driver that does not create the soft link is installed. The driver that does not pass the KABI compatibility directly installs the new kernel driver.

[0093] At the same time, weak-update technology is used to directly use old driver versions compatible with the KABI interface to avoid wasting storage resources.

[0094] Create soft links to new kernel drivers for KABI-compatible drivers, and directly install new kernel drivers for incompatible drivers to ensure that the drivers can work properly between different versions of the kernel to avoid instability caused by changes in the kernel interface. At the same time, maintaining KABI compatibility can reduce the workload of recompilation.

[0095] Step S206, integrating the drivers supported by the target kernel into the initramfs file.

[0096] Specifically, the above step S206 includes:

[0097] Step S2061, integrating the drivers supported by the new kernel into the initramfs file through the dracut -f --kver <upgraded kernel version> command.

[0098] In the embodiment of the present invention, the installed OOB driver is integrated into the initramfs file through the dracut -f --kver <upgraded kernel version> command.

[0099] The kernel upgrade and downgrade automatic driver adaptation method provided in this embodiment integrates the driver in the kernel into the initramfs file, so as to fully combine the weak-update feature of the driver during the kernel upgrade and save storage resources.

[0100] As a specific application example of the embodiment of the present invention, Figure 2 As shown in the figure, the kernel upgrade and downgrade automatic driver adaptation process is as follows:

[0101] 1. Find the rpm package that meets the requirements according to the arch, target kernel version and yum repo url input parameters;

[0102] 2. Call the rpm_extract_pciids.sh script to parse the pciids information of the devices supported by the driver;

[0103] 3. Call the scan_devices_need_OOB.sh script to scan the information of devices that need to install OOB drivers on the server;

[0104] 4. Save the relevant information of the driver installation dependencies to the oob_pciids.json configuration file;

[0105] 5. Call the create_driver_repo.sh script to create the yum repo file required to install the driver;

[0106] 6. Install the target version kernel and create a soft link of the current version driver in the new kernel for the KABI-compatible driver;

[0107] 7. Install the OOB driver that is not compatible with KABI;

[0108] 8. Use the dracut -f --kver <upgraded kernel version> command to integrate the installed OOB driver into the initramfs file.

[0109] The kernel upgrade and downgrade automatic driver adaptation method provided by the embodiment of the present invention has the following main advantages:

[0110] (1) It supports kernel upgrade and downgrade, and can perform batch OOB driver adaptation according to the hardware configuration on the server, which is applicable to all server configurations;

[0111] (2) The driver adaptation version directly provides the compiled driver rpm package, which ensures security and saves time for repeated compilation. In addition, the weak-update technology is used to directly use the old driver version compatible with the KABI interface to avoid resource waste.

[0112] (3) Implement the add, delete, modify, and query management functions of OOB driver configuration information through scripts. Using scripts to manage configuration files can avoid format errors in JSON configuration files that may be caused by manual addition.

[0113] The kernel upgrade and downgrade automatic driver adaptation method provided in the embodiment of the present invention can be applied to scenarios including but not limited to: 1. Batch upgrade of kernels of public cloud or private cloud hosts; 2. Upgrading to a kernel that has resolved certain CVE vulnerabilities.

[0114] Its value lies in: 1. Helping operation and maintenance to better install the system kernel and OOB driver, ensuring the one-to-one correspondence between the kernel and driver versions; 2. When business requirements are unclear, first uniformly deploy CTyunOS with a certain version of the kernel, and then upgrade or downgrade the kernel as needed after the business is clear.

[0115] In this embodiment, a kernel upgrade and downgrade automatic drive adaptation device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0116] This embodiment provides a kernel upgrade and downgrade automatic drive adapter device, such as Figure 3 As shown, including:

[0117] The screening module 301 is used to screen out driver configuration files that meet the parameter conditions from the OOB driver installation configuration files according to the target architecture, target kernel version and yum repository URL parameters.

[0118] The parsing module 302 is used to parse the filtered driver configuration file, obtain the PCI identification information of the device supported by the driver, and save it into a temporary file.

[0119] The scanning module 303 is used to scan the device information on the server that needs to install the OOB driver, and save the relevant information on which the driver installation depends into the configuration file.

[0120] The creation module 304 is used to create the yum repo file required for installing the driver.

[0121] The verification module 305 is used to install the target version kernel package and perform compatibility verification on the symbol table of the old kernel version in the configuration file and the symbol table of the target kernel version.

[0122] The driver integration module 306 is used to integrate the drivers supported by the target kernel into the initramfs file.

[0123] In some optional implementations, the screening module 301 includes:

[0124] The filter unit is used to pass the target architecture, target kernel version and yum repository URL parameters to the main upgrade script to filter out the drivers that are suitable for the target kernel version under the target architecture.

[0125] The replacement unit is used to generate a new driver configuration file by replacing the URL variable information in the driver configuration file with the yum repository URL parameter.

[0126] In some optional implementations, the parsing module 302 includes:

[0127] The parsing unit is used to parse the filtered driver configuration file to obtain the location of the target kernel driver in the YUM source.

[0128] The download unit is used to download the RPM software package corresponding to the driver to a temporary file according to the location of the target kernel driver in the YUM source.

[0129] The decompression unit is used to decompress the ko file corresponding to the driver from the RPM software package.

[0130] The retrieval unit is used to retrieve the PCI identification information of the device that can be supported in the driver ko file.

[0131] In some optional implementations, the scanning module 303 includes:

[0132] The scanning unit is used to scan the PCI identification information of all OOB driver devices that need to be installed under the target kernel saved in the temporary file.

[0133] The comparison unit is used to compare the PCI identification information of all OOB driver devices that need to be installed under the target kernel with the output information under the current system to determine the device information of the OOB driver that needs to be installed on the server.

[0134] In some optional embodiments, the device further comprises:

[0135] Create a module to create a driver that passes KABI compatibility as a soft link for the new kernel driver if the compatibility check passes.

[0136] Driver module, used to install new kernel drivers that do not pass KABI compatibility.

[0137] In some optional implementations, the driver integration module 306 includes:

[0138] The driver integration unit is used to integrate the drivers supported by the new kernel into the initramfs file through the dracut -f --kver <upgraded kernel version> command.

[0139] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0140] The kernel upgrade and downgrade automatic drive adapter device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0141] The embodiment of the present invention also provides a computer device having the above Figure 3 The kernel upgrade and downgrade automation driver adapter shown.

[0142] See also Figure 4 , Figure 4 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 4 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 4 A processor 10 is taken as an example.

[0143] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0144] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0145] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0146] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0147] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 4 The example of connecting through bus is taken in the following.

[0148] The input device 30 can receive input digital or character information and generate key signal input related to user settings and function control of the computer device, such as a touch screen, etc. The output device 40 can include a display device, etc.

[0149] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0150] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0151] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations all fall within the scope of the present application.

Claims

1. A kernel upgrade and downgrade automatic driver adaptation method, characterized in that: The method comprises: According to the target architecture, target kernel version and yum repository URL parameters, filter out the driver configuration files that meet the parameter conditions from the OOB driver installation configuration files; Parse the filtered driver configuration files, obtain the PCI identification information of the devices supported by the driver, and save it to a temporary file; Scan the device information on the server that needs to install the OOB driver, and save the relevant information of the driver installation dependency to the configuration file; Create the yum repo file required to install the driver; Install the target version kernel package, and perform compatibility check between the symbol table of the old kernel version in the configuration file and the symbol table of the target kernel version; Integrate drivers supported by the target kernel into the initramfs file.

2. The method according to claim 1, characterized in that The method of filtering out a driver configuration file that meets the parameter conditions from the OOB driver installation configuration file according to the target architecture, target kernel version, and yum repository URL parameters includes: Pass the target architecture, target kernel version, and yum repository URL parameters to the main upgrade script to filter out drivers that are suitable for the target kernel version under the target architecture; The URL variable information in the driver configuration file is replaced by the yum warehouse URL parameter to generate a new driver configuration file.

3. The method according to claim 1, characterized in that: The driver configuration file filtered out by the analysis is used to obtain the PCI identification information of the device supported by the driver, including: Parse the filtered driver configuration files to get the location of the target kernel driver in the YUM source; Download the RPM software package corresponding to the driver to a temporary file according to the location of the target kernel driver in the YUM source; Decompress the ko file corresponding to the driver from the RPM software package; Retrieve the PCI identification information of the devices that can be supported in the driver ko file.

4. The method according to claim 1, characterized in that: The device information of the server that needs to install the OOB driver includes: Scan the PCI identification information of all OOB driver devices that need to be installed under the target kernel saved in the temporary file; The PCI identification information of all OOB driver devices that need to be installed under the target kernel is compared with the output information under the current system to determine the device information of the OOB driver that needs to be installed on the server.

5. The method according to claim 1, characterized in that After the compatibility check is performed on the symbol table of the old kernel version in the configuration file and the symbol of the target kernel version, the method further comprises: If the compatibility check passes, the driver that passes KABI compatibility is created as a soft link of the driver of the new kernel; Install a new kernel driver that does not pass KABI compatibility.

6. The method according to claim 1, characterized in that The integration of the drivers supported by the target kernel into the initramfs file includes: Use the dracut -f --kver <upgraded kernel version> command to integrate the drivers supported by the new kernel into the initramfs file.

7. A kernel upgrade and downgrade automatic drive adapter device, characterized in that: The device comprises: The filtering module is used to filter out driver configuration files that meet the parameter conditions from the OOB driver installation configuration files according to the target architecture, target kernel version, and yum repository URL parameters; The parsing module is used to parse the filtered driver configuration files, obtain the PCI identification information of the devices supported by the driver, and save it in a temporary file; The scanning module is used to scan the device information on the server that needs to install the OOB driver, and save the relevant information of the driver installation dependency to the configuration file; Create a module to create the yum repo file required to install the driver; A verification module is used to install the target version kernel package and perform compatibility verification on the symbol table of the old kernel version in the configuration file and the symbol table of the target kernel version; The driver integration module is used to integrate the drivers supported by the target kernel into the initramfs file.

8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the kernel upgrade and downgrade automatic drive adaptation method described in any one of claims 1 to 6 by executing the computer instructions.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the kernel upgrade and downgrade automatic driver adaptation method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The method comprises computer instructions, wherein the computer instructions are used to enable a computer to execute the kernel upgrade and downgrade automatic driver adaptation method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Driver adaptation method and device for operating system kernel upgrading and electronic equipment

    CN113849202A

  • Compatible processing method and device of ARM server and computer equipment

    CN115543355A

  • Driving module and kernel compatibility checking method, computing device and storage medium

    CN117193791A

  • Method and system for installing Linux operating system based on PXE self-adaptive hard disk drive

    CN117850815A

  • Method for packaging driver kernel module, electronic device and storage medium

    US20240168768A1