Kernel and driver upgrade method for operating system
By introducing a filtering and grading mechanism after kernel compilation, drivers to be upgraded are selected and compiled and tested, which solves the problem of wasted resources in hardware driver recompilation and testing, and improves upgrade efficiency and customer business stability.
Patent Information
- Application Number
- CN202511454348.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-13
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2045-10-13
AI Technical Summary
During server operating system kernel upgrades, hardware drivers need to be recompiled and tested, resulting in a waste of R&D and testing resources, and large-scale driver upgrades affect the stability of customer businesses.
After the kernel is compiled, a filtering and grading mechanism is introduced. By loading the target driver, obtaining the driver priority and dependency information, the driver to be upgraded is selected, and then compiled and tested to generate the target driver package, thus completing the upgrade of the kernel and the driver.
This effectively narrowed the scope of driver upgrades, reduced uncertainty, and improved customer business stability and upgrade efficiency.
Smart Images

Figure CN120909626B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method for upgrading the kernel and driver of an operating system. Background Technology
[0002] With the development of server technology, the broad compatibility of server operating systems with various hardware has become the core competitiveness of modern server operating systems. The Linux kernel is also constantly evolving and updating. Each kernel upgrade may bring the cost of recompiling, retesting, and redeploying hardware drivers. The scope of kernel and driver upgrades is closely related to the stability of customers' businesses; the larger the upgrade scope, the greater the risk to business stability for customers.
[0003] Currently, when upgrading the kernel, the kernel's KABI (Kernel Application Binary Interface) is checked for changes. If the kernel KABI changes, all hardware drivers need to be recompiled and undergo full compatibility testing again. This requires a significant investment of R&D and testing personnel, severely impacting kernel and driver release efficiency and wasting R&D and testing resources. Furthermore, after release, the scope of driver upgrades in customer business environments is too broad. Widespread external driver upgrades introduce significant uncertainty to customer businesses, and failing to use the latest drivers can affect the stability of customer business operations. Summary of the Invention
[0004] This application provides a method for upgrading the kernel and drivers of an operating system. After the kernel is compiled, a filtering and hierarchical mechanism can be added, which effectively narrows the scope of driver upgrades, reduces the uncertainty brought about by driver upgrades, and improves the stability of customer business.
[0005] This application provides a method for upgrading the kernel and drivers of an operating system, including:
[0006] Load several target drivers of the target operating system in the target kernel environment to determine several loading results corresponding to the several target drivers; the target kernel environment is a kernel environment compiled according to the kernel interface list corresponding to the target operating system.
[0007] Obtain the driver priorities of several target drivers from the preset driver knowledge base, and select the driver to be upgraded from several target drivers based on the driver priorities and several loading results;
[0008] Obtain the target dependency information of the driver to be upgraded from the preset driver knowledge base, and compile and test the driver to be upgraded based on the target dependency information and driver priority to obtain the target driver package of the driver to be upgraded.
[0009] The kernel and drivers of the target operating system are upgraded based on the target kernel environment and the target driver package.
[0010] This application also provides an operating system kernel and driver upgrade device, including:
[0011] The driver loading module is used to load several target drivers of the target operating system in the target kernel environment, so as to determine several loading results corresponding to several target drivers; the target kernel environment is a kernel environment compiled according to the kernel interface list corresponding to the target operating system;
[0012] The driver filtering module is used to obtain the driver priorities of several target drivers from a preset driver knowledge base, and filter out the drivers to be upgraded from several target drivers based on the driver priorities and several loading results.
[0013] The driver processing module is used to obtain the target dependency information of the driver to be upgraded from the preset driver knowledge base, and compile and test the driver to be upgraded based on the target dependency information and driver priority to obtain the target driver package of the driver to be upgraded.
[0014] The upgrade module is used to upgrade the kernel and drivers of the target operating system based on the target kernel environment and the target driver package.
[0015] This application also provides an electronic device, including: a memory for storing a computer program; and a processor for implementing the kernel and driver upgrade method of any of the above-described operating systems when executing the computer program.
[0016] This application also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the steps of the kernel and driver upgrade method of any of the above-mentioned operating systems.
[0017] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the kernel and driver upgrade method of any of the above-described operating systems.
[0018] In this application, several target drivers of the target operating system can be loaded in the target kernel environment to determine several loading results corresponding to the several target drivers; the target kernel environment is a kernel environment compiled according to the latest kernel interface list corresponding to the target operating system; the driver priorities of several target drivers are obtained from a preset driver knowledge base, and the driver to be upgraded is selected from several target drivers according to the driver priorities and several loading results; the target dependency information of the driver to be upgraded is obtained from the preset driver knowledge base, and the driver to be upgraded is compiled and tested based on the target dependency information and driver priorities to obtain the target driver package of the driver to be upgraded; the kernel and driver of the target operating system are upgraded based on the target kernel environment and the target driver package.
[0019] Therefore, the method described in this application allows for the compilation of a kernel environment based on the kernel interface list corresponding to the target operating system. Several target drivers for the target operating system are then loaded into the kernel environment. Based on the driver priorities of these target drivers obtained from a pre-defined driver knowledge base and the driver loading results, the driver to be upgraded is selected from among the target drivers. The target dependency information of the driver to be upgraded is obtained from the pre-defined driver knowledge base, and the driver to be upgraded is compiled and tested based on the target dependency information and driver priorities to obtain the target driver package. Finally, the kernel and driver upgrades for the target operating system are completed based on the target kernel environment and the target driver package. This approach adds a filtering mechanism after kernel compilation to identify drivers that need recompilation. For drivers that do not need recompilation, they are categorized, and different levels of testing are performed according to different categories, improving testing efficiency and quality. This effectively narrows the scope of driver upgrades, reduces the uncertainty brought by driver upgrades, and improves the stability of customer services. Attached Figure Description
[0020] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 A flowchart illustrating an operating system kernel and driver upgrade method provided in this application embodiment;
[0022] Figure 2 A schematic diagram illustrating an operating system kernel and driver upgrade method provided in an embodiment of this application;
[0023] Figure 3 A schematic diagram illustrating a specific operating system kernel and driver upgrade method provided in this application embodiment;
[0024] Figure 4 A flowchart illustrating another operating system kernel and driver upgrade method provided in this application embodiment;
[0025] Figure 5 A schematic diagram of a driver dependency relationship provided in an embodiment of this application;
[0026] Figure 6 This is a schematic diagram illustrating the construction of a driver priority database as provided in an embodiment of this application;
[0027] Figure 7 This is a schematic diagram of the structure of an operating system kernel and driver upgrade device provided in an embodiment of this application. Detailed Implementation
[0028] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.
[0029] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0030] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0031] Currently, when upgrading the kernel, the kernel KABI is checked for changes. If the kernel KABI changes, all hardware drivers need to be recompiled and re-tested for full compatibility. This requires a significant investment of R&D and testing personnel, severely impacting kernel and driver release efficiency and wasting R&D and testing resources. Furthermore, after release, the scope of driver upgrades in customer business environments is too broad. Widespread external driver upgrades introduce significant uncertainty to customer businesses, and failure to use the latest drivers can affect the stability of customer business operations.
[0032] To overcome the aforementioned technical problems, this application discloses an operating system kernel and driver upgrade method, which can add a filtering and hierarchical mechanism after the kernel is compiled, effectively narrowing the scope of driver upgrades, reducing the uncertainty brought about by driver upgrades, and improving the stability of customer business.
[0033] See Figure 1 As shown, embodiments of this application provide a method for upgrading the kernel and drivers of an operating system. The method is described in detail below, in conjunction with the execution flow of the operating system kernel and driver upgrade method. The method includes:
[0034] Step S11: Load several target drivers of the target operating system in the target kernel environment to determine several loading results corresponding to the several target drivers; the target kernel environment is the kernel environment compiled according to the kernel interface list corresponding to the target operating system.
[0035] In this embodiment, the kernel environment needs to be compiled before loading the driver. Specifically, as follows: Figure 2 As shown, it's necessary to monitor whether the KABI is corrupted before recompiling the kernel. Specifically, it's necessary to check if the kernel interface of the target operating system is corrupted during kernel compilation. If corruption is confirmed, the kernel interface list corresponding to the kernel interface is updated to obtain the updated kernel interface list. The kernel interface list contains the interface information of the kernel interface. It's important to note that before each compilation, it's necessary to determine if the KABI is corrupted, i.e., whether the parameters in the KABI have changed or become corrupted. If the KABI is corrupted, it indicates that no incompatible modifications have been made to the kernel interface, and kernel compilation can proceed directly based on the current KABI. If the KABI is corrupted, it indicates that incompatible modifications may have been made to the kernel interface during development, causing changes in the interface's checksum. Therefore, the kernel interface list corresponding to the kernel interface needs to be updated.
[0036] Furthermore, the kernel environment needs to be recompiled based on the updated kernel interface list to obtain the target kernel environment. Specifically, it is necessary to record several target checksums corresponding to the kernel interfaces during the current kernel compilation of the target operating system, and generate a target checksum list based on these checksums. For example, if a new function is written during development that does not exist in the KABI whitelist, the checksum corresponding to this function needs to be calculated and added to the KABI baseline checksum list. Then, the baseline checksum list corresponding to the kernel interfaces needs to be read from the kernel interface list, and the baseline checksum list and the target checksum list need to be compared to determine whether there is a new checksum in the target checksum list that is not in the baseline checksum list. If a new checksum exists, it is determined that the kernel interface is corrupted. In the case of a new checksum, it can be determined that there is new content during this development process, and therefore the current kernel interface can be determined to be corrupted. Therefore, the new checksum needs to be added to the baseline checksum list, and the new function corresponding to the new checksum needs to be determined so that the new function can be added to the kernel interface list to complete the update of the kernel interface list.
[0037] In this embodiment, it is also necessary to load several target drivers of the target operating system in the target kernel environment to determine several loading results corresponding to the target drivers. Specifically, several target drivers corresponding to the target operating system need to be loaded in the target kernel environment to determine whether the target drivers are successfully loaded in the target kernel environment. If there is a first target driver that is not successfully loaded among the target drivers, a first loading result corresponding to the first target driver is generated; the first loading result indicates that the driver was not successfully loaded. On the other hand, the driver that is successfully loaded among the target drivers needs to be used as the second target driver, and a second loading result corresponding to the second target driver is generated; the second loading result indicates that the driver was successfully loaded. It should be noted that if the driver is not successfully loaded, it indicates that the driver may have problems in the current kernel environment, so it needs to be recompiled. If the driver can be successfully loaded, it indicates that the driver is compatible with the current kernel environment and does not need to be recompiled. In this application, the driver refers to an external driver. In this way, the drivers can be initially screened, thereby determining the drivers that need to be recompiled and the drivers that do not need to be recompiled.
[0038] Step S12: Obtain the driver priorities of several target drivers from the preset driver knowledge base, and select the driver to be upgraded from several target drivers based on the driver priorities and several loading results.
[0039] In this embodiment, before filtering drivers to be upgraded based on preset driver priorities and driver loading results, a driver knowledge base needs to be constructed. Specifically, such as... Figure 3As shown, it is necessary to read the target fields in the preset driver compilation file using preset instructions, and obtain the installation and compilation dependency information of several target drivers based on the target fields. Then, based on the target fields, it is necessary to further determine the number of kernel interfaces that several target drivers depend on, and determine the driver priority of several target drivers based on the number of kernel interfaces. Then, based on the dependencies between several target drivers, the driver dependency relationships are determined, and a preset driver knowledge base is constructed based on the driver dependency relationships, installation dependency information, compilation dependency information, and driver priority. It should be noted that the driver priority is set according to the number of kernel interfaces corresponding to the driver, and the driver priority can be set to three levels: high priority, medium priority, and low priority, based on the number of kernel interfaces corresponding to the driver.
[0040] In this embodiment, it is necessary to filter the drivers to be upgraded based on preset driver priorities and driver loading results. Specifically, it is necessary to select a first target driver from several target drivers whose loading result is the second loading result and whose driver priority is a preset high priority. Then, functional testing is performed on the first target driver based on a first preset test standard to determine whether the first target driver passes the functional test. If the first target driver fails the functional test, it is designated as the driver to be upgraded. It should be noted that the selected first target driver means that this type of driver does not need to be recompiled, but it needs to be functionally tested according to the first test standard. The first test standard is a full functional test, that is, all functions of the driver need to be tested. If it passes the full functional test, it indicates that the current driver does not need to be upgraded. If it fails the full functional test, it indicates that the driver also needs to be upgraded and should be designated as the driver to be upgraded. Further, it is necessary to select a second target driver from several target drivers whose loading result is the first loading result and designate the second target driver as the driver to be upgraded. It should be noted that the second target driver means that this type of driver cannot be successfully loaded in the current environment and needs to be recompiled. This allows for the addition of a filtering mechanism after kernel compilation to identify drivers that require recompilation. For drivers that do not require recompilation, driver priority is used to determine whether full functional testing is necessary. This avoids upgrading all drivers, effectively saving system resources and improving the efficiency of operating system upgrades.
[0041] Step S13: Obtain the target dependency information of the driver to be upgraded from the preset driver knowledge base, and compile and test the driver to be upgraded based on the target dependency information and driver priority to obtain the target driver package of the driver to be upgraded.
[0042] In this embodiment, it is necessary to obtain the dependency information of the driver to be upgraded from the driver knowledge base, and then recompile and test the driver to be upgraded based on the driver dependency information. Specifically, it is necessary to obtain the target dependency information of the driver to be upgraded from the preset driver knowledge base, and recompile the driver to be upgraded based on the target dependency information to obtain the driver to be tested. Figure 3 As shown, the target dependency information includes driver dependencies, installation dependencies, and compilation dependencies. Dependencies need to be installed using the `yum` command, and the driver should be compiled using `rpmbuild` in the dependency order to ensure that the driver for a single hardware device can be compiled successfully on the first attempt. Further, the priority of the target driver corresponding to the driver under test needs to be determined, and functional testing of the driver under test should be performed based on the target driver priority. Specifically, the target test standard corresponding to the driver under test needs to be determined based on the target driver priority. If the target driver priority is a preset high priority, functional testing of the driver under test is performed based on the first preset test standard; if the target driver priority is a preset medium priority, functional testing of the driver under test is performed based on the second preset test standard; and if the target driver priority is a preset low priority, functional testing of the driver under test is performed based on the third preset test standard. It should be noted that, if... Figure 3 As shown, the first preset test standard is the standard for testing all functions of the driver, the second preset test standard is the standard for testing pre-selected functions of the driver, and the third preset test standard is the standard for reloading the driver.
[0043] Furthermore, after testing, it's necessary to determine whether the recompiled driver passes the tests. Specifically, if the driver under test fails the functional tests, driver vulnerabilities are investigated. That is, if the driver fails the tests, it indicates a potential bug during recompilation. Therefore, the bug needs to be fixed, and the fixed vulnerability is used as the new driver to be upgraded. The process then proceeds to retrieving the target dependency information of the driver to be upgraded from the pre-defined driver knowledge base, allowing for recompilation and testing of the driver to be upgraded. This approach minimizes the impact of R&D and testing results on the customer environment's kernel and driver upgrades, reducing the uncertainty of driver upgrades and ensuring the stability of customer services.
[0044] Step S14: Based on the target kernel environment and target driver package, complete the upgrade of the target operating system kernel and drivers.
[0045] In this embodiment, it is necessary to obtain the kernel environment package corresponding to the target kernel environment, and load the kernel environment package and the target driver package into the target operating system to complete the upgrade of the target operating system's kernel and drivers. That is, after obtaining the kernel environment package corresponding to the current target kernel environment of the operating system, and the target driver packages of all drivers to be upgraded, it is necessary to replace the original environment package and driver package with the kernel environment package and the target driver package to complete the upgrade of the target operating system's kernel and drivers.
[0046] In this application, several target drivers of the target operating system can be loaded in the target kernel environment to determine several loading results corresponding to the several target drivers; the target kernel environment is a kernel environment compiled according to the latest kernel interface list corresponding to the target operating system; the driver priorities of several target drivers are obtained from a preset driver knowledge base, and the driver to be upgraded is selected from several target drivers according to the driver priorities and several loading results; the target dependency information of the driver to be upgraded is obtained from the preset driver knowledge base, and the driver to be upgraded is compiled and tested based on the target dependency information and driver priorities to obtain the target driver package of the driver to be upgraded; the kernel and driver of the target operating system are upgraded based on the target kernel environment and the target driver package. Therefore, the method described in this application allows for the compilation of a kernel environment based on the kernel interface list corresponding to the target operating system. Several target drivers for the target operating system are then loaded into the kernel environment. Based on the driver priorities and loading results of these target drivers obtained from a pre-defined driver knowledge base, the driver to be upgraded is selected from among the target drivers. The target dependency information of the driver to be upgraded is obtained from the pre-defined driver knowledge base. Based on the target dependency information and driver priorities, the driver to be upgraded is compiled and tested to obtain the target driver package. Finally, the kernel and driver upgrades for the target operating system are completed based on the target kernel environment and the target driver package. This approach offers several advantages. First, it adds a filtering mechanism after kernel compilation to identify drivers that need recompilation. For drivers that do not need recompilation, driver priority is used to determine whether full functional testing is required. Second, it allows for the acquisition of dependencies for individual hardware driver compilation based on the driver knowledge base, ensuring that individual hardware drivers compile successfully on the first attempt, improving development efficiency. Third, it allows for driver grading based on the driver knowledge base, enabling different levels of testing based on different grades, improving testing efficiency and quality, effectively narrowing the scope of external driver upgrades, reducing the uncertainty brought by driver upgrades, and improving the stability of customer services.
[0047] As can be seen from the foregoing embodiments, before filtering drivers to be upgraded based on preset driver priorities and driver loading results, it is necessary to first construct a driver knowledge base. Therefore, this embodiment provides a detailed explanation of how to construct a driver knowledge base. See [link to documentation]. Figure 4As shown, embodiments of this application provide a method for upgrading the kernel and drivers of an operating system, including:
[0048] Step S21: Read the target field in the preset driver compilation file through preset instructions, and obtain the installation dependency information and compilation dependency information of several target drivers based on the target field.
[0049] In this embodiment, it is necessary to read the target fields in the preset driver compilation file using a preset instruction. It should be noted that the preset instruction is the `dnf repoquery-whatrequires xxx` command, where `xxx` represents the driver name, the preset driver compilation file refers to the driver's compilation specification file, and the target fields are the `Requires` and `BuildRequires` fields in the specification file. The driver's installation dependency information can be read through the `Requires` field in the specification file, and the driver's compilation dependency information can be read through the `BuildRequires` field. Further, as... Figure 5 As shown, the drivers and dependencies need to be stored in the database in a one-to-many relationship. For example, as Figure 5 The driver dependency table shown indicates that the bnxt driver is the Broadcom NetXtreme network card driver, with dependencies including kernel, findutils, gawk, bash, and kmod. Kernel is the base kernel, essential for runtime; findutils, gawk, and bash are scripting tools, indicating the driver package contains installation / configuration scripts; kmod is a kernel module management tool used to load / unload the driver. Similarly, the mpi3mr driver is a storage controller driver, with dependencies including kernel-devel, gcc, make, and elfutils-libelf-devel. Kernel-devel is the kernel development package, containing header files and symbol tables; gcc and make are compilation toolchains; and elfutils-libelf-devel is an ELF (Executable and Linkable Format) file processing development library.
[0050] Step S22: Confirm the number of kernel interfaces that several target drivers depend on, and determine the driver priority of several target drivers based on the number of kernel interfaces.
[0051] In this embodiment, the driver priority needs to be determined based on the number of kernel interfaces the driver depends on. Specifically, for example... Figure 6As shown, depending on the number of KABI interfaces that the driver compilation depends on, the kernel is compiled to obtain the Module.symvers file, which contains all the KABI interfaces; the driver is compiled to obtain the xxx.mod.c file. Different drivers have different file names, but the suffix is mod.c. The modversion structure in this file contains the KABI interfaces that the driver depends on. The number of duplicate KABI interfaces is compared. Drivers with more than 200 duplicate interfaces are high-priority drivers, drivers with 100 to 200 duplicate interfaces are medium-priority drivers, and drivers with less than 100 duplicate interfaces are low-priority drivers. After the driver level is determined, a driver priority database is built.
[0052] Step S23: Determine driver dependencies based on the dependencies between several target drivers, and build a preset driver knowledge base based on driver dependencies, installation dependency information, compilation dependency information, and driver priority.
[0053] In this embodiment, it is also necessary to determine driver dependencies based on the dependencies between several target drivers. It should be noted that each driver package corresponds to multiple compilation and installation dependency packages. Furthermore, it is necessary to determine the dependencies between the driver compilation artifacts themselves. Some driver compilation artifacts have dozens of packages, and these artifacts also have dependencies on each other. Some packages must be compiled first before subsequent packages can be compiled. Therefore, it is necessary to identify the driver dependencies of the driver compilation artifacts in advance and confirm the compilation order of the driver compilation artifact packages. Finally, a preset driver knowledge base can be constructed based on the determined driver dependencies, installation dependency information, compilation dependency information, and driver priorities.
[0054] In this embodiment, target fields in a preset driver compilation file can be read using preset instructions. Based on these target fields, installation and compilation dependency information for several target drivers can be obtained. The number of kernel interfaces that several target drivers depend on can be confirmed, and the driver priorities of several target drivers can be determined based on the number of kernel interfaces. Finally, driver dependency relationships can be determined based on the dependencies between several target drivers. A preset driver knowledge base can be constructed based on the driver dependency relationships, installation dependency information, compilation dependency information, and driver priorities. In this way, hardware driver compilation dependencies and corresponding priorities can be obtained based on the constructed driver knowledge base, improving the compilation success rate of hardware drivers and effectively improving R&D efficiency.
[0055] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.
[0056] See Figure 7As shown, embodiments of this application also provide an operating system kernel and driver upgrade device, including:
[0057] The driver loading module 11 is used to load several target drivers of the target operating system in the target kernel environment, so as to determine several loading results corresponding to the several target drivers; the target kernel environment is a kernel environment compiled according to the kernel interface list corresponding to the target operating system;
[0058] The driver filtering module 12 is used to obtain the driver priorities of several target drivers from the preset driver knowledge base, and filter out the drivers to be upgraded from several target drivers according to the driver priorities and several loading results.
[0059] The driver processing module 13 is used to obtain the target dependency information of the driver to be upgraded from the preset driver knowledge base, and compile and test the driver to be upgraded based on the target dependency information and driver priority to obtain the target driver package of the driver to be upgraded.
[0060] Upgrade module 14 is used to upgrade the kernel and drivers of the target operating system based on the target kernel environment and the target driver package.
[0061] In some embodiments, the operating system kernel and driver upgrade device may further include:
[0062] The list update submodule is used to detect whether the kernel interface of the target operating system is corrupted during kernel compilation, and after determining that the kernel interface is corrupted, it updates the kernel interface list corresponding to the kernel interface to obtain the updated kernel interface list; the kernel interface list contains the interface information of the kernel interface.
[0063] The environment compilation unit is used to recompile the kernel environment according to the updated kernel interface list to obtain the target kernel environment;
[0064] Correspondingly, the list update submodule can specifically include:
[0065] The list generation unit is used to record several target check values corresponding to the kernel interface during the current kernel compilation of the target operating system, and to generate a list of target check values based on these target check values.
[0066] The check value comparison unit is used to read the baseline check value list corresponding to the kernel interface from the kernel interface list, and compare the baseline check value list with the target check value list to determine whether there is a new check value in the target check value list that is not in the baseline check value list;
[0067] The damage determination unit is used to determine that the kernel interface is damaged if a new check value is found.
[0068] Correspondingly, the list update submodule can specifically include:
[0069] The list update unit is used to add new check values to the baseline check value list and determine the new function corresponding to the new check value so as to add the new function to the kernel interface list.
[0070] In some embodiments, the driver loading module 11 may specifically include:
[0071] The driver loading determination unit is used to load several target drivers corresponding to the target operating system in the target kernel environment to determine whether the several target drivers have been successfully loaded in the target kernel environment.
[0072] The first loading result generation unit is used to generate a first loading result corresponding to the first target driver if there is a first target driver that has not been successfully loaded among several target drivers; the first loading result is the result indicating that the driver has not been successfully loaded.
[0073] The second loading result generation unit is used to take the driver that has been successfully loaded from several target drivers as the second target driver and generate a second loading result corresponding to the second target driver; the second loading result is the result indicating that the driver has been successfully loaded.
[0074] In some embodiments, the operating system kernel and driver upgrade device may further include:
[0075] The dependency information acquisition unit is used to read the target fields in the preset driver compilation file through preset instructions, and obtain the installation dependency information and compilation dependency information of several target drivers based on the target fields;
[0076] The priority determination unit is used to determine the number of kernel interfaces that several target drivers depend on, and to determine the driver priority of several target drivers based on the number of kernel interfaces.
[0077] The knowledge base construction unit is used to determine driver dependencies based on the dependencies between several target drivers, and to build a preset driver knowledge base according to the driver dependencies, installation dependency information, compilation dependency information and driver priority.
[0078] In some embodiments, the driver priority includes a preset high priority, a preset medium priority, and a preset low priority; the preset high priority is when the number of kernel interfaces corresponding to the driver is in a first preset range; the preset medium priority is when the number of kernel interfaces corresponding to the driver is in a second preset range; and the preset low priority is when the number of kernel interfaces corresponding to the driver is in a third preset range.
[0079] In some embodiments, the driving filtering module 12 may specifically include:
[0080] The driver filtering unit is used to filter out the first target driver from several target drivers, whose loading result is the second loading result and whose driver priority is a preset high priority.
[0081] The driver testing unit is used to perform functional tests on the first target driver based on a first preset test standard to determine whether the first target driver passes the functional test.
[0082] The first driver to be upgraded determination unit is used to determine the first target driver as the driver to be upgraded if the first target driver fails the functional test.
[0083] The second driver to be upgraded determination unit is used to select the second target driver whose loading result is the first loading result from a number of target drivers, and to use the second target driver as the driver to be upgraded.
[0084] In some embodiments, the driver processing module 13 may specifically include:
[0085] The driver compilation submodule is used to obtain the target dependency information of the driver to be upgraded from the preset driver knowledge base, and recompile the driver to be upgraded based on the target dependency information to obtain the driver to be tested.
[0086] The driver testing submodule is used to determine the priority of the target driver corresponding to the driver under test, and to perform functional testing on the driver under test based on the priority of the target driver.
[0087] In some embodiments, the driving test submodule may specifically include:
[0088] The test standard determination unit is used to determine the target test standard corresponding to the driver to be tested based on the target driver priority.
[0089] The first test unit is used to perform functional testing on the driver to be tested based on the first preset test standard if the target driver priority is a preset high priority.
[0090] The second test unit is used to perform functional testing on the driver to be tested based on the second preset test standard if the target driver priority is a preset medium priority.
[0091] The third test unit is used to perform functional testing on the driver to be tested based on the third preset test standard if the target driver priority is a preset low priority.
[0092] The first preset test standard is a standard for testing all functions of the driver; the second preset test standard is a standard for testing pre-selected functions of the driver; and the third preset test standard is a standard for reloading the driver.
[0093] In some embodiments, the operating system kernel and driver upgrade device may further include:
[0094] The vulnerability finding unit is used to find driver vulnerabilities in the driver under test if the driver under test fails the functional test.
[0095] The step jump unit is used to fix the driver vulnerability, so that the fixed vulnerability is used as the new driver to be upgraded, and jumps to the step of obtaining the target dependency information of the driver to be upgraded from the preset driver knowledge base, so as to recompile and test the driver to be upgraded.
[0096] In some embodiments, the upgrade module 14 may specifically include:
[0097] The upgrade unit is used to obtain the kernel environment package corresponding to the target kernel environment, and load the kernel environment package and the target driver package into the target operating system to complete the upgrade of the kernel and driver of the target operating system.
[0098] For a description of the features in the embodiment corresponding to the operating system kernel and driver upgrade device, please refer to the relevant description of the embodiment corresponding to the operating system kernel and driver upgrade method, which will not be repeated here.
[0099] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in the embodiments of the kernel and driver upgrade method of any of the above-described operating systems.
[0100] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in the embodiments of the kernel and driver upgrade method of any of the above-described operating systems when it runs.
[0101] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0102] The embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in the embodiments of the kernel and driver upgrade method of any of the above-described operating systems.
[0103] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in the kernel and driver upgrade method embodiments of any of the above-described operating systems.
[0104] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0105] The kernel and driver upgrade method for an operating system provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only intended to help understand the method and core ideas of this application. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this application.
Claims
1. A method for upgrading the kernel and drivers of an operating system, characterized in that, include: Load several target drivers of the target operating system in the target kernel environment to determine several loading results corresponding to the several target drivers; The target kernel environment is a kernel environment compiled according to the kernel interface list corresponding to the target operating system; Obtain the driver priorities of the target drivers from the preset driver knowledge base, and select the driver to be upgraded from the target drivers based on the driver priorities and the loading results. The target dependency information of the driver to be upgraded is obtained from the preset driver knowledge base, and the driver to be upgraded is compiled and tested based on the target dependency information and the driver priority to obtain the target driver package of the driver to be upgraded. Based on the target kernel environment and the target driver package, complete the upgrade of the kernel and drivers of the target operating system; The driver priority includes a preset high priority, a preset medium priority, and a preset low priority; the preset high priority is when the number of kernel interfaces corresponding to the driver is in a first preset range; the preset medium priority is when the number of kernel interfaces corresponding to the driver is in a second preset range; and the preset low priority is when the number of kernel interfaces corresponding to the driver is in a third preset range. The step of selecting the driver to be upgraded from the plurality of target drivers based on the driver priority and the plurality of loading results includes: The second loading result is selected from the plurality of target drivers and the driver priority is a first target driver with a preset high priority; the second loading result indicates that the driver has been successfully loaded. The first target driver is subjected to functional testing based on a first preset test standard to determine whether the first target driver passes the functional test. If the first target driver fails the functional test, then the first target driver will be designated as a driver to be upgraded. Select a second target driver from the plurality of target drivers whose loading result is the first loading result, and use the second target driver as the driver to be upgraded; the first loading result indicates that the driver failed to load.
2. The operating system kernel and driver upgrade method according to claim 1, characterized in that, Before loading several target drivers of the target operating system in the target kernel environment and determining several loading results corresponding to the several target drivers, the method further includes: The kernel interface of the target operating system is detected as corrupted during kernel compilation. If the kernel interface is found to be corrupted, the kernel interface list corresponding to the kernel interface is updated to obtain an updated kernel interface list. The kernel interface list contains the interface information of the kernel interface. The kernel environment is recompiled based on the updated kernel interface list to obtain the target kernel environment; Accordingly, detecting whether the kernel interface of the target operating system is corrupted during kernel compilation includes: Record several target check values corresponding to the kernel interface during the current kernel compilation of the target operating system, and generate a target check value list based on the aforementioned target check values; The baseline check value list corresponding to the kernel interface is read from the kernel interface list, and the baseline check value list and the target check value list are compared to determine whether there is a new check value in the target check value list that is not in the baseline check value list. If the newly added checksum exists, then the kernel interface is determined to be corrupted; Accordingly, updating the kernel interface list corresponding to the kernel interface to obtain the updated kernel interface list includes: The newly added check value is added to the baseline check value list, and the new function corresponding to the newly added check value is determined, so as to add the new function to the kernel interface list.
3. The operating system kernel and driver upgrade method according to claim 1, characterized in that, The step of loading several target drivers of the target operating system in the target kernel environment to determine several loading results corresponding to the several target drivers includes: Load several target drivers corresponding to the target operating system in the target kernel environment to determine whether the several target drivers have been successfully loaded in the target kernel environment; If there is a first target driver that has failed to load among the plurality of target drivers, a first loading result corresponding to the first target driver is generated; the first loading result indicates that the driver has failed to load. The driver that is successfully loaded from the plurality of target drivers is taken as the second target driver, and a second loading result corresponding to the second target driver is generated; the second loading result is a result indicating that the driver has been successfully loaded.
4. The operating system kernel and driver upgrade method according to claim 3, characterized in that, Before obtaining the driver priorities of the plurality of target drivers from the preset driver knowledge base, and filtering the drivers to be upgraded from the plurality of target drivers based on the driver priorities and the plurality of loading results, the method further includes: The target fields in the preset driver compilation file are read by preset instructions, and the installation dependency information and compilation dependency information of the target drivers are obtained based on the target fields. Confirm the number of kernel interfaces that the target drivers depend on, and determine the driver priority of the target drivers based on the number of kernel interfaces; Driver dependencies are determined based on the dependencies between the target drivers, and a preset driver knowledge base is constructed based on the driver dependencies, the installation dependency information, the compilation dependency information, and the driver priority.
5. The operating system kernel and driver upgrade method according to claim 1, characterized in that, The step of obtaining the target dependency information of the driver to be upgraded from the preset driver knowledge base, and compiling and testing the driver to be upgraded based on the target dependency information and the driver priority, includes: Obtain the target dependency information of the driver to be upgraded from the preset driver knowledge base, and recompile the driver to be upgraded based on the target dependency information to obtain the driver to be tested; Determine the target driver priority corresponding to the driver under test, and perform functional testing on the driver under test based on the target driver priority.
6. The operating system kernel and driver upgrade method according to claim 5, characterized in that, The functional testing of the driver under test based on the target driver priority includes: The target test standard corresponding to the driver to be tested is determined based on the target driver priority; If the target driver priority is the preset high priority, then the driver to be tested is functionally tested based on the first preset test standard; If the target driver priority is the preset medium priority, then the driver to be tested is functionally tested based on the second preset test standard; If the target driver priority is the preset low priority, then the driver to be tested is functionally tested based on the third preset test standard; The first preset test standard is a standard for testing all functions of the driver; the second preset test standard is a standard for testing pre-selected functions of the driver; and the third preset test standard is a standard for reloading the driver.
7. The operating system kernel and driver upgrade method according to claim 6, characterized in that, Before upgrading the kernel and drivers of the target operating system based on the target kernel environment and the target driver package, the process also includes: If the driver under test fails the functional test, then find the driver vulnerability of the driver under test; The driver vulnerability is fixed, and the fixed vulnerability is used as the new driver to be upgraded. Then, the process jumps to the step of obtaining the target dependency information of the driver to be upgraded from the preset driver knowledge base, so as to recompile and test the driver to be upgraded.
8. The method for upgrading the kernel and driver of an operating system according to any one of claims 1 to 7, characterized in that, The upgrade of the kernel and drivers of the target operating system based on the target kernel environment and the target driver package includes: Obtain the kernel environment package corresponding to the target kernel environment, and load the kernel environment package and the target driver package into the target operating system to complete the upgrade of the kernel and driver of the target operating system.
Citation Information
Patent Citations
Kernel driver upgrading method and device, server and storage medium
CN113741926A
Driver upgrading method and device, electronic equipment and storage medium
CN117112002A