Method for upgrading kernel and driver of 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 resource waste and business stability risks caused by hardware driver recompilation and achieves efficient kernel and driver upgrades.

CN120909626AActive Publication Date: 2025-11-07LANGCHAO ELECTRONIC INFORMATION IND CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202511454348.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-13
Publication Date
2025-11-07
Estimated Expiration
2045-10-13

AI Technical Summary

Technical Problem

During the server operating system kernel upgrade process, hardware drivers need to be recompiled and tested, which leads to resource waste and risks to customer business stability. Existing technologies are difficult to effectively narrow the upgrade scope and reduce uncertainty.

Method used

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 kernel and driver upgrade.

Benefits of technology

This effectively narrowed the scope of driver upgrades, reduced uncertainty, improved customer business stability and upgrade efficiency, and saved system resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120909626A_ABST
    Figure CN120909626A_ABST
Patent Text Reader

Abstract

The invention discloses a kernel and driver upgrading method of an operating system, and relates to the technical field of computers, and the kernel and driver upgrading method comprises the following steps: loading a plurality of target drivers of a target operating system in a target kernel environment to determine a plurality of loading results corresponding to the plurality of target drivers; obtaining a driver priority from a preset driver knowledge base, and screening out a to-be-upgraded driver from the plurality of target drivers according to the driver priority and the plurality of loading results; obtaining target dependency information of the to-be-upgraded driver from a preset driver knowledge base, and compiling and testing the to-be-upgraded driver based on the target dependency information and the driver priority to obtain a target driver package of the to-be-upgraded driver; and completing upgrading of the kernel and the driver of the target operating system based on the target kernel environment and the target driver package. Therefore, screening and grading mechanisms can be added after kernel compiling is completed, the drive upgrading range is effectively narrowed, uncertainty caused by drive upgrading is reduced, and customer service stability is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a kernel and driver upgrading method of an operating system. BACKGROUND

[0002] With the development of server technology, the wide compatibility of server operating system and various hardware has become the most core competitiveness of modern server operating system. The Linux kernel is also constantly evolving and updating. Each kernel upgrade may bring the cost of recompilation, retesting and redeployment of hardware drivers. The upgrade range of the kernel and the driver is closely related to the business stability of the customer. The larger the upgrade range is, the more risks of business stability the customer will have.

[0003] Currently, when upgrading the kernel, it is detected whether the KABI (Kernel Application Binary Interface, Linux kernel application binary interface) of the kernel will change. If the kernel KABI changes, all hardware drivers need to be recompiled and retested for full compatibility, which requires a large number of R&D and testing personnel, seriously affecting the efficiency of kernel and driver release and wasting R&D and testing resources. Moreover, after the release is completed, the range of driver upgrade in the customer's business environment is too large. A large-scale external driver upgrade will bring great uncertainty to the customer's business. If the latest driver is not used, it will affect the business stability of the customer. SUMMARY

[0004] The present application provides a kernel and driver upgrading method of an operating system, which can increase the screening and grading mechanism after the kernel is compiled, effectively reducing the range of driver upgrade, reducing the uncertainty brought by driver upgrade, and improving the business stability of the customer.

[0005] The present application provides a kernel and driver upgrading method of an operating system, which comprises: loading a plurality of target drivers of a target operating system in a target kernel environment to determine a plurality of loading results corresponding to the plurality of target drivers; the target kernel environment is a kernel environment compiled according to a kernel interface list corresponding to the target operating system; obtaining a driver priority of the plurality of target drivers from a preset driver knowledge base, and screening a to-be-upgraded driver from the plurality of target drivers according to the driver priority and the plurality of loading results; obtaining target dependency information of the to-be-upgraded driver from the preset driver knowledge base, and compiling and testing the to-be-upgraded driver based on the target dependency information and the driver priority to obtain a target driver package of the to-be-upgraded driver; upgrading the kernel and the driver of the target operating system based on the target kernel environment and the target driver package.

[0006] This application also provides an operating system kernel and driver upgrade device, including: 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; 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. 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. 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.

[0007] 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-mentioned operating systems when executing the computer program.

[0008] 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.

[0009] 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.

[0010] 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.

[0011] It can be seen that, by the method, the kernel environment can be compiled according to the kernel interface list corresponding to the target operating system, then the target drivers of the target operating system are loaded in the kernel environment, the target drivers to be upgraded are selected from the target drivers according to the driving priority of the target drivers obtained from the preset driving knowledge base and the loading result of the target drivers, the target dependency information of the target drivers to be upgraded is obtained from the preset driving knowledge base, the target drivers to be upgraded are compiled and tested based on the target dependency information and the driving priority, and the target driver package of the target drivers to be upgraded is obtained, and finally the kernel and the drivers of the target operating system are upgraded according to the target kernel environment and the target driver package. In this way, the screening mechanism can be added after the kernel is compiled, and the drivers that need to be recompiled are screened out. For the drivers that do not need to be recompiled, the drivers are classified, and different degrees of testing are performed according to different classifications, so that the testing efficiency and quality are improved. In this way, the range of driver upgrade is effectively reduced, the uncertainty caused by driver upgrade is reduced, and the stability of customer business is improved. BRIEF DESCRIPTION OF DRAWINGS

[0012] In order to more clearly illustrate the embodiments of the present application, the drawings needed in the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0013] Figure 1 A kernel and driver upgrade method flowchart of an operating system provided by an embodiment of the present application; Figure 2 A kernel and driver upgrade method processing schematic diagram of an operating system provided by an embodiment of the present application; Figure 3 A specific kernel and driver upgrade method processing schematic diagram of an operating system provided by an embodiment of the present application; Figure 4 Another kernel and driver upgrade method flowchart of an operating system provided by an embodiment of the present application; Figure 5 A driving dependency relationship schematic diagram provided by an embodiment of the present application; Figure 6 A driving priority database construction schematic diagram provided by an embodiment of the present application; Figure 7 A kernel and driver upgrade device structure schematic diagram of an operating system provided by an embodiment of the present application. DETAILED DESCRIPTION

[0014] With reference to the drawings, the technical solutions in the embodiments of the present application will be clearly and completely described below, obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the present application.

[0015] It should be noted that in the description of the present application, the terms "comprise", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or equipment comprising a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or equipment. The terms "first", "second" and the like in the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence.

[0016] In order 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 drawings and specific embodiments.

[0017] At present, when upgrading the kernel, it is detected whether the KABI of the kernel will change, if the KABI of the kernel changes, all hardware drivers need to be recompiled and retested for full compatibility, which requires a large number of R&D and testing personnel, seriously affecting the kernel and driver release efficiency, and wasting R&D and testing resources. And after completing the release, the range of upgrading the driver in the customer's business environment is too large, and a large range of external driver upgrade will bring great uncertainty to the customer's business, and if the latest driver is not used, it will affect the stability of the customer's business operation.

[0018] In order to overcome the above technical problems, the present application discloses a kernel and driver upgrade method of an operating system, which can increase screening and grading mechanism after kernel compilation is completed, effectively reducing the range of driver upgrade, reducing the uncertainty brought by driver upgrade, and improving the stability of customer business.

[0019] Referring to Figure 1 The embodiments of the present application provide a kernel and driver upgrade method of an operating system, and the method is described in detail in combination with the execution process of the kernel and driver upgrade method of the operating system, which comprises: Step S11, loading a plurality of target drivers of a target operating system in a target kernel environment to determine a plurality of loading results corresponding to the plurality of target drivers; the target kernel environment is a kernel environment compiled according to a kernel interface list corresponding to the target operating system.

[0020] In the present embodiment, kernel environment compilation is also required before loading the driver, specifically, as shown inFigure 2 As shown, it is necessary to monitor whether KABI is damaged, and then recompile the kernel. Specifically, it is necessary to detect whether the kernel interface of the target operating system is damaged during kernel compilation, and update the kernel interface list corresponding to the kernel interface after determining that the kernel interface is damaged, to obtain an updated kernel interface list. The kernel interface list contains interface information of the kernel interface. It needs to be noted that it is necessary to determine whether KABI is damaged before each compilation, that is, whether the parameters in KABI have changed or are damaged. In the case of damaged KABI, it indicates that no incompatible modification has been made to the kernel interface, and the kernel can be compiled directly according to the current KABI. If KABI is damaged, it indicates that incompatible modifications may have been made to the kernel interface during development, resulting in a change in the interface check value. Therefore, it is necessary to update the kernel interface list corresponding to the kernel interface.

[0021] Further, the kernel environment needs to be recompiled according to the updated kernel interface list to obtain a target kernel environment. Specifically, it is necessary to record a plurality of target check values corresponding to the kernel interface during this kernel compilation of the target operating system, and generate a target check value list according to the plurality of target check values. For example, a new function is written during development, and the new function does not exist in the whitelist of KABI, so it is necessary to calculate the check value corresponding to the function and add the check value to the reference check value list of KABI. Then the reference check value list corresponding to the kernel interface is read from the kernel interface list, and the reference 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 does not exist in the reference check value list. If there is a new check value, it is determined that the kernel interface is damaged. In the case of a new check value, it can be determined that there is new content in the current development process, so it can be determined that the current kernel interface is damaged. Therefore, the new check value needs to be added to the reference check value list, and the new function corresponding to the new check value needs to be determined to add the new function to the kernel interface list to complete the update of the kernel interface list.

[0022] In the embodiment, the target operating system needs to load a plurality of target drivers in the target kernel environment to determine a plurality of loading results corresponding to the plurality of target drivers. Specifically, the target operating system needs to load a plurality of target drivers in the target kernel environment to determine whether the plurality of target drivers are successfully loaded in the target kernel environment. If there is a first target driver that is not successfully loaded in the plurality of target drivers, a first loading result corresponding to the first target driver is generated; the first loading result is a result indicating that the driver is not successfully loaded. On the other hand, the successfully loaded drivers in the plurality of target drivers are taken as second target drivers, and a second loading result corresponding to the second target driver is generated; the second loading result is a result indicating that the driver is successfully loaded. It needs to be noted that if the driver is not successfully loaded, it indicates that the driver may have a problem in the current kernel environment, and therefore 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. The driver in the present application refers to an external driver. In this way, the driver can be preliminarily screened, and then the driver that needs to be recompiled and the driver that does not need to be recompiled can be determined.

[0023] In step S12, the driving priority of the plurality of target drivers is obtained from the preset driving knowledge base, and the to-be-upgraded driver is screened from the plurality of target drivers according to the driving priority and the plurality of loading results.

[0024] In the embodiment, before the to-be-upgraded driver is screened based on the preset driving priority and the loading result of the driver, the driving knowledge base needs to be constructed. Specifically, as shown in Figure 3 the target field in the preset driving compilation file is read through a preset instruction, and the installation dependency information and the compilation dependency information of the plurality of target drivers are obtained based on the target field. Then, the installation dependency information and the compilation dependency information of the plurality of target drivers are obtained based on the target field. Further, the number of kernel interfaces dependent on the plurality of target drivers is confirmed, and the driving priority of the plurality of target drivers is determined based on the number of kernel interfaces. Then, the driving dependency relationship is determined based on the dependency between the plurality of target drivers, and the preset driving knowledge base is constructed according to the driving dependency relationship, the installation dependency information, the compilation dependency information and the driving priority. It needs to be noted that the driving priority is a priority set according to the number of kernel interfaces corresponding to the driver, and the priority of the driver can be set to three levels of high priority, medium priority and low priority according to the number of kernel interfaces corresponding to the driver.

[0025] In this embodiment, the to-be-upgraded driver needs to be screened based on the preset driving priority and the loading result of the driver. Specifically, a first target driver with the second loading result and the preset high priority as the driving priority needs to be screened from the target drivers, and then the first target driver is subjected to the function test based on the first preset test standard to determine whether the first target driver passes the function test. If the first target driver does not pass the function test, the first target driver is taken as the to-be-upgraded driver. It needs to be noted that the screened first target driver represents that the driver of this type does not need to be recompiled, but the driver of this type needs to be subjected to the function test based on the first test standard, and the first test standard is the full-amount function test, that is, all functions of the driver need to be tested. If the full-amount function test can be passed, it is indicated that the current driver does not need to be upgraded, and if the full-amount function test cannot be passed, it is indicated that the driver also needs to be upgraded, and the driver needs to be taken as the to-be-upgraded driver. Further, a second target driver with the first loading result needs to be screened from the target drivers, and the second target driver is taken as the to-be-upgraded driver. It needs to be noted that the second target driver represents that the driver of this type cannot be successfully loaded in the current environment, and needs to be recompiled. In this way, the screening mechanism can be added after the kernel is compiled to screen the drivers that need to be recompiled, and for the drivers that do not need to be recompiled, it is determined whether the full-amount function test needs to be performed in combination with the driving priority, so that all drivers do not need to be upgraded, system resources are effectively saved, and the upgrading efficiency of the operating system is improved.

[0026] In step S13, the target dependency information of the to-be-upgraded driver is acquired from the preset driver knowledge base, and the to-be-upgraded driver is compiled and tested based on the target dependency information and the driving priority to obtain the target driver package of the to-be-upgraded driver.

[0027] In this embodiment, the dependency information of the to-be-upgraded driver needs to be acquired from the driver knowledge base, and then the to-be-upgraded driver is recompiled and tested according to the dependency information of the driver. Specifically, the target dependency information of the to-be-upgraded driver needs to be acquired from the preset driver knowledge base, and the to-be-upgraded driver is recompiled based on the target dependency information to obtain the to-be-tested driver. For example, Figure 3As shown, the target dependency information includes the dependency relationship of the driver, the installation dependency information, and the compilation dependency information, the dependency installation needs to be completed through the yum command, the driver is compiled through the rpmbuild according to the dependency order, and it is ensured that the driver of a single hardware can be successfully compiled at one time. Further, the priority of the target driver corresponding to the to-be-tested driver needs to be determined, and the to-be-tested driver is functionally tested based on the priority of the target driver. Specifically, the target test standard corresponding to the to-be-tested driver needs to be determined based on the priority of the target driver. If the priority of the target driver is a preset high priority, the to-be-tested driver is functionally tested based on a first preset test standard. If the priority of the target driver is a preset medium priority, the to-be-tested driver is functionally tested based on a second preset test standard. If the priority of the target driver is a preset low priority, the to-be-tested driver is functionally tested based on a third preset test standard. It needs to be noted that, as Figure 3 As shown, 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 preselected functions of the driver, and the third preset test standard is a standard for reloading the driver.

[0028] Further, after the test is completed, it is also necessary to determine whether the recompiled driver passes the test. Specifically, if the to-be-tested driver fails the functional test, the driver vulnerability of the to-be-tested driver is found, that is, if the to-be-tested driver fails the test, it indicates that the driver may have a bug during the recompilation process. Therefore, the bug of the driver needs to be repaired, and the repaired vulnerability is taken as a new to-be-upgraded driver, and the step of obtaining the target dependency information of the to-be-upgraded driver from the preset driver knowledge base is jumped to, so as to recompile and test the to-be-upgraded driver. In this way, the kernel and driver upgrade can be performed in the customer environment with the smallest range of development and test results, the uncertainty caused by the driver upgrade is reduced, and the stability of the customer business is ensured.

[0029] Step S14: The kernel and driver of the target operating system are upgraded based on the target kernel environment and the target driver package.

[0030] In this embodiment, the kernel environment package corresponding to the target kernel environment needs to be obtained, and the kernel environment package and the target driver package are loaded to the target operating system to complete the kernel and driver upgrade of the target operating system. That is, after obtaining the kernel environment package corresponding to the target kernel environment of the current operating system and the target driver package of all to-be-upgraded drivers, the original environment report and the driver package need to be replaced by the kernel environment package and the target driver package to complete the kernel and driver upgrade of the target operating system.

[0031] In the present application, a plurality of target drivers of a target operating system can be loaded in a target kernel environment to determine a plurality of loading results corresponding to the plurality of target drivers; the target kernel environment is a kernel environment compiled according to a latest kernel interface list corresponding to the target operating system; a driving priority of the plurality of target drivers is obtained from a preset driving knowledge base, and a to-be-upgraded driver is selected from the plurality of target drivers according to the driving priority and the plurality of loading results; target dependency information of the to-be-upgraded driver is obtained from the preset driving knowledge base, and the to-be-upgraded driver is compiled and tested based on the target dependency information and the driving priority to obtain a target driver package of the to-be-upgraded driver; and the kernel and the driver of the target operating system are upgraded based on the target kernel environment and the target driver package. As can be seen, by the method of the present application, the kernel environment can be compiled according to the kernel interface list corresponding to the target operating system, then a plurality of target drivers of a target operating system are loaded in the kernel environment, a to-be-upgraded driver is selected from the plurality of target drivers according to the driving priority of the plurality of target drivers obtained from the preset driving knowledge base and the loading results of the drivers, target dependency information of the to-be-upgraded driver is obtained from the preset driving knowledge base, the to-be-upgraded driver is compiled and tested based on the target dependency information and the driving priority to obtain a target driver package of the to-be-upgraded driver, and finally the kernel and the driver of the target operating system are upgraded based on the target kernel environment and the target driver package. In this way, on the one hand, a screening mechanism can be added after kernel compilation to screen the drivers that need to be recompiled, and whether the drivers that do not need to be recompiled need to be subjected to full function test is determined in combination with the driving priority; on the other hand, the dependency relationship of a single hardware driver compilation can be obtained according to the driving knowledge base to ensure that the single hardware driver is compiled through once and improve the research and development efficiency; and on the other hand, the drivers can be classified according to the driving knowledge base, different degrees of test are performed according to different classifications, the test efficiency and quality are improved, and the external driver upgrade range is effectively reduced, the uncertainty caused by the driver upgrade is reduced, and the customer business stability is improved.

[0032] Based on the foregoing embodiments, before the to-be-upgraded driver is selected based on the preset driving priority and the loading results of the drivers, the driving knowledge base needs to be constructed. Therefore, the present embodiment provides a detailed description of how to construct the driving knowledge base. Referring to FIG. 8, the present embodiment provides a method for constructing a driving knowledge base, including: Figure 4 The present embodiment provides a kernel and driver upgrade method of an operating system, including:

[0033] In step S21, the target field in the preset driving compilation file is read through a preset instruction, and the installation dependency information and the compilation dependency information of a plurality of target drivers are obtained based on the target field.

[0034] In this embodiment, the target field in the preset driver compilation file needs to be read through a preset instruction. It should be noted that the preset instruction is a dnf repoquery-whatrequires xxx command, where xxx represents the name of the driver, the preset driver compilation file refers to the Spec file of the driver compilation, and the target field is the Requires field and the BuildRequires field in the Spec file. The installation dependency information of the driver can be read through the Requires field in the Spec file, and the compilation dependency information of the driver can be read through the BuildRequires field. Further, as shown in Figure 5 , the driver and the dependency relationship need to be stored in the database in a one-to-many relationship. For example, as shown in Figure 5 , the driver dependency relationship table, where the bnxt driver is the Broadcom NetXtreme network card driver, and the corresponding dependency items are kernel, findutils, gawk, bash, kmod, etc. The kernel is the basic kernel and is necessary for runtime; findutils, gawk, and bash are script tools, indicating that the driver package contains installation / configuration scripts; and kmod is a kernel module management tool for loading / unloading the driver. The mpi3mr driver is a storage controller driver, and the corresponding dependency items are kernel-devel, gcc, make, elfutils-libelf-devel, etc. The kernel-devel is a kernel development package containing header files and symbol tables; gcc and make are compilation tool chains; and elfutils-libelf-devel is an ELF (Executable and Linkable Format) file processing development library.

[0035] Step S22, confirming the number of kernel interfaces dependent on the target driver, and determining the driver priority of the target driver based on the number of kernel interfaces.

[0036] In this embodiment, the priority of the driver needs to be determined according to the number of kernel interfaces dependent on the driver. Specifically, as shown in Figure 6As shown, depending on the number of KABI interfaces on which the driver compilation depends, the kernel is compiled to obtain the Module.symvers file containing all KABI interfaces; the driver is compiled to obtain the xxx.mod.c file, the suffix of which is mod.c, and the modversion structure in the file contains the KABI interfaces on which the driver depends; the number of repeated KABI interfaces is compared, and the number of repeated interfaces exceeding 200 is a high-priority driver, the number of repeated interfaces being 100-200 is a medium-priority driver, and the number of repeated interfaces being less than 100 is a low-priority driver, and after the driver level is confirmed, a database of driver priorities is constructed.

[0037] In step S23, the driver dependency relationship is determined based on the dependencies between the target drivers, and the preset driver knowledge base is constructed according to the driver dependency relationship, the installation dependency information, the compilation dependency information, and the driver priority.

[0038] In the embodiment, the driver dependency relationship also needs to be determined based on the dependencies between the target drivers. It needs to be noted that each driver software package corresponds to multiple compilation and installation dependency software packages. The dependency relationship between the driver compilation products also needs to be determined, and there are dozens of software packages in some driver compilation products, and there are also dependencies between the compilation products. Some software packages must be compiled first before subsequent software packages can be compiled, so the driver dependency relationship of the driver compilation products needs to be sorted out in advance to confirm the compilation order of the driver compilation product software packages. Finally, the preset driver knowledge base can be constructed according to the determined driver dependency relationship, the installation dependency information, the compilation dependency information, and the driver priority.

[0039] In the embodiment, the target field in the preset driver compilation file can be read through the preset instruction, the installation dependency information and the compilation dependency information of the target drivers are obtained based on the target field, the number of kernel interfaces on which the target drivers depend is confirmed, the driver priority of the target drivers is determined based on the number of kernel interfaces, the driver dependency relationship is determined based on the dependencies between the target drivers, and the preset driver knowledge base is constructed according to the driver dependency relationship, the installation dependency information, the compilation dependency information, and the driver priority. In this way, the driver compilation dependency relationship and the corresponding priority can be obtained based on the constructed driver knowledge base, the success rate of hardware driver compilation is improved, and the research and development efficiency is effectively improved.

[0040] Those skilled in the art can clearly understand from the description of the above embodiments that the method according to the above embodiments can be realized by means of software and a general hardware platform as necessary, of course, it can also be realized by hardware, but in many cases the former is a better embodiment.

[0041] Reference is made to Figure 7As shown, the embodiments of the present application also provide a kernel and driver upgrading device of an operating system, comprising: a driver loading module 11, configured to load a plurality of target drivers of a target operating system in a target kernel environment to determine a plurality of loading results corresponding to the plurality of target drivers; the target kernel environment is a kernel environment compiled according to a kernel interface list corresponding to the target operating system; a driver screening module 12, configured to acquire a driver priority of the plurality of target drivers from a preset driver knowledge base, and screen a target driver to be upgraded from the plurality of target drivers according to the driver priority and the plurality of loading results; a driver processing module 13, configured to acquire target dependency information of the target driver to be upgraded from the preset driver knowledge base, and compile and test the target driver to be upgraded based on the target dependency information and the driver priority to obtain a target driver package of the target driver to be upgraded; an upgrading module 14, configured to complete kernel and driver upgrading of the target operating system based on the target kernel environment and the target driver package.

[0042] In some embodiments, the kernel and driver upgrading device of the operating system can further comprise: a list updating submodule, configured to detect whether a kernel interface of the target operating system is damaged during kernel compilation, and update a kernel interface list corresponding to the kernel interface to obtain an updated kernel interface list after determining that the kernel interface is damaged; the kernel interface list contains interface information of the kernel interface; an environment compiling unit, configured to recompile the kernel environment according to the updated kernel interface list to obtain the target kernel environment; Correspondingly, the list updating submodule can specifically comprise: a list generating unit, configured to record a plurality of target check values corresponding to the kernel interface during this time kernel compilation of the target operating system, and generate a target check value list according to the plurality of target check values; a check value comparison unit, configured to read a reference check value list corresponding to the kernel interface from the kernel interface list, and compare the reference check value list and the target check value list to determine whether there is an added check value in the target check value list that does not exist in the reference check value list; a damage determination unit, configured to determine that the kernel interface is damaged if there is the added check value; Correspondingly, the list updating submodule can specifically comprise: a list updating unit, configured to add the added check value to the reference check value list, and determine an added function corresponding to the added check value to add the added function to the kernel interface list.

[0043] In some embodiments, the driver loading module 11 can specifically comprise: The drive loading judgment unit is configured to load a plurality of target drives corresponding to a target operating system in a target kernel environment, so as to determine whether the plurality of target drives are successfully loaded in the target kernel environment. The first loading result generation unit is configured to generate a first loading result corresponding to a first target drive if the first target drive is not successfully loaded in the plurality of target drives; and the first loading result is a result indicating that the drive is not successfully loaded. The second loading result generation unit is configured to take a successfully loaded drive in the plurality of target drives as a second target drive, and generate a second loading result corresponding to the second target drive; and the second loading result is a result indicating that the drive is successfully loaded.

[0044] In some embodiments, the kernel and drive upgrading apparatus of the operating system can further include: The dependency information acquisition unit is configured to read a target field in a preset drive compilation file through a preset instruction, and acquire installation dependency information and compilation dependency information of the plurality of target drives based on the target field. The priority determination unit is configured to determine a number of kernel interfaces relied on by the plurality of target drives, and determine drive priorities of the plurality of target drives based on the number of kernel interfaces. The knowledge base construction unit is configured to determine a drive dependency relationship based on the dependency between the plurality of target drives, and construct a preset drive knowledge base according to the drive dependency relationship, the installation dependency information, the compilation dependency information, and the drive priorities.

[0045] In some embodiments, the drive priorities include a preset high priority, a preset medium priority, and a preset low priority; the preset high priority corresponds to a first preset interval of the number of kernel interfaces of the drive; the preset medium priority corresponds to a second preset interval of the number of kernel interfaces of the drive; and the preset low priority corresponds to a third preset interval of the number of kernel interfaces of the drive.

[0046] In some embodiments, the drive screening module 12 can specifically include: The drive screening unit is configured to screen a first target drive with the second loading result and the preset high priority from the plurality of target drives. The drive testing unit is configured to perform a function test on the first target drive based on a first preset test standard, so as to determine whether the first target drive passes the function test. The first target drive to be upgraded determination unit is configured to take the first target drive as a target drive to be upgraded if the first target drive does not pass the function test. The second target drive to be upgraded determination unit is configured to screen a second target drive with the first loading result from the plurality of target drives, and take the second target drive as a target drive to be upgraded.

[0047] In some embodiments, the driving processing module 13 can specifically include: a driving compiling submodule, configured to acquire target dependency information of the to-be-upgraded driving from a preset driving knowledge base, and recompile the to-be-upgraded driving based on the target dependency information to obtain a to-be-tested driving; a driving testing submodule, configured to determine a target driving priority corresponding to the to-be-tested driving, and perform a function test on the to-be-tested driving based on the target driving priority.

[0048] In some embodiments, the driving testing submodule can specifically include: a test standard determining unit, configured to determine a target test standard corresponding to the to-be-tested driving based on the target driving priority; a first testing unit, configured to perform a function test on the to-be-tested driving based on a first preset test standard if the target driving priority is a preset high priority; a second testing unit, configured to perform a function test on the to-be-tested driving based on a second preset test standard if the target driving priority is a preset medium priority; a third testing unit, configured to perform a function test on the to-be-tested driving based on a third preset test standard if the target driving priority is a preset low priority; wherein the first preset test standard is a standard of testing all functions of the driving, the second preset test standard is a standard of testing preselected functions of the driving, and the third preset test standard is a standard of reloading the driving.

[0049] In some embodiments, the kernel and driving upgrading apparatus of the operating system can further include: a vulnerability finding unit, configured to find a driving vulnerability of the to-be-tested driving if the to-be-tested driving fails the function test; a step jumping unit, configured to repair the driving vulnerability to obtain a repaired vulnerability as a new to-be-upgraded driving, and jump to the step of acquiring the target dependency information of the to-be-upgraded driving from the preset driving knowledge base to recompile and test the to-be-upgraded driving.

[0050] In some embodiments, the upgrading module 14 can specifically include: an upgrading unit, configured to acquire a kernel environment package corresponding to the target kernel environment, and load the kernel environment package and the target driving package to the target operating system to complete the kernel and driving upgrading of the target operating system.

[0051] The features of the embodiments of the kernel and driving upgrading apparatus of the operating system can be referred to the related descriptions of the embodiments of the kernel and driving upgrading method of the operating system, which will not be repeated here.

[0052] The embodiment of the present application further provides an electronic device, comprising a memory and a processor, the memory stores a computer program, and the processor is arranged to run the computer program to perform the steps in the kernel and driver upgrading method embodiments of any of the operating systems.

[0053] The embodiment of the present application further provides a computer readable storage medium, which stores a computer program, wherein the computer program is arranged to perform the steps in the kernel and driver upgrading method embodiments of any of the operating systems when running.

[0054] In an example embodiment, the computer readable storage medium can include, but is not limited to, a U disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store computer programs.

[0055] The embodiment of the present application further provides a computer program product, which comprises a computer program, and the computer program is arranged to perform the steps in the kernel and driver upgrading method embodiments of any of the operating systems when executed by a processor.

[0056] The embodiment of the present application further provides another computer program product, which comprises a non-volatile computer readable storage medium, and the non-volatile computer readable storage medium stores a computer program, and the computer program is arranged to perform the steps in the kernel and driver upgrading method embodiments of any of the operating systems when executed by a processor.

[0057] The skilled person can further realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be realized in electronic hardware, computer software or a combination of both. In order to clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been described in general terms in the above description. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0058] The kernel and driver upgrading method of the operating system provided by the present application is described in detail above. The principles and implementation manners of the present application are described by applying specific examples, and the above description of the examples is only applicable to helping understand the method of the present application and the core idea thereof. It should be pointed out that, for those skilled in the art, some improvements and modifications can be made to the present application without departing from the principles of the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.

Claims

1. A method for upgrading the kernel and drivers of an operating system, characterized in that, The method comprises the following steps: loading a plurality of target drivers of a target operating system in a target kernel environment to determine a plurality of loading results corresponding to the plurality of target drivers; the target kernel environment is a kernel environment compiled according to a kernel interface list corresponding to the target operating system; obtaining a driver priority of the plurality of target drivers from a preset driver knowledge base, and screening a target upgrade driver from the plurality of target drivers according to the driver priority and the plurality of loading results; obtaining target dependency information of the target upgrade driver from the preset driver knowledge base, and compiling and testing the target upgrade driver based on the target dependency information and the driver priority to obtain a target driver package of the target upgrade driver; based on the target kernel environment and the target driver package, completing the kernel and driver upgrade of the target operating system.

2. The method of claim 1, wherein the kernel and driver upgrade of the operating system is performed by a system management mode (SMM). Before the step of loading a plurality of target drivers of a target operating system in a target kernel environment to determine a plurality of loading results corresponding to the plurality of target drivers, the method further comprises the following steps: detecting whether a kernel interface of the target operating system is damaged during kernel compilation, and updating a kernel interface list corresponding to the kernel interface to obtain an updated kernel interface list after determining that the kernel interface is damaged; the kernel interface list contains interface information of the kernel interface; recompiling a kernel environment according to the updated kernel interface list to obtain a target kernel environment; correspondingly, the step of detecting whether a kernel interface of the target operating system is damaged during kernel compilation comprises the following steps: recording a plurality of target check values corresponding to the kernel interface during this kernel compilation of the target operating system, and generating a target check value list according to the plurality of target check values; reading a reference check value list corresponding to the kernel interface from the kernel interface list, and comparing the reference check value list with the target check value list to determine whether there is an added check value in the target check value list that does not exist in the reference check value list; if the added check value exists, it is determined that the kernel interface is damaged; correspondingly, the step of updating the kernel interface list corresponding to the kernel interface to obtain an updated kernel interface list comprises the following steps: adding the added check value to the reference check value list, and determining an added function corresponding to the added check value to add the added function to the kernel interface list.

3. The method of claim 1, wherein the kernel and driver upgrade of the operating system is performed by a system management mode (SMM) program. The step of loading a plurality of target drivers of a target operating system in a target kernel environment to determine a plurality of loading results corresponding to the plurality of target drivers comprises the following steps: loading a plurality of target drivers corresponding to the target operating system in the target kernel environment to determine whether the plurality of target drivers are successfully loaded in the target kernel environment; if there is a first target driver that is not successfully loaded in the plurality of target drivers, a first loading result corresponding to the first target driver is generated; the first loading result is a result indicating that the driver is not successfully loaded; a second target driver that is successfully loaded in the plurality of target drivers is taken as a 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 is successfully loaded.

4. The method of claim 3, wherein the kernel and driver upgrade of the operating system is performed by a kernel upgrade module and a driver upgrade module. The method further comprises: reading a target field in a preset driver compilation file through a preset instruction, and obtaining installation dependency information and compilation dependency information of the target drivers based on the target field; confirming a number of kernel interfaces depended by the target drivers, and determining a driver priority of the target drivers based on the number of kernel interfaces; determining a driver dependency relationship based on the dependency among the target drivers, and constructing a preset driver knowledge base according to the driver dependency relationship, the installation dependency information, the compilation dependency information, and the driver priority.

5. The kernel and driver upgrade method of claim 4, wherein, The driver priority comprises a preset high priority, a preset medium priority, and a preset low priority; the preset high priority corresponds to the number of kernel interfaces of a driver being in a first preset interval; the preset medium priority corresponds to the number of kernel interfaces of a driver being in a second preset interval; the preset low priority corresponds to the number of kernel interfaces of a driver being in a third preset interval.

6. The kernel and driver upgrade method of an operating system according to claim 5, wherein, The method further comprises: selecting a first target driver from the target drivers, the first target driver having the second loading result and the preset high priority; performing a function test on the first target driver based on a first preset test standard, to determine whether the first target driver passes the function test; if the first target driver does not pass the function test, regarding the first target driver as the driver to be upgraded; selecting a second target driver from the target drivers, the second target driver having the first loading result, and regarding the second target driver as the driver to be upgraded.

7. The kernel and driver upgrade method of an operating system according to claim 6, wherein, The method further comprises: obtaining target dependency information of the driver to be upgraded from the preset driver knowledge base, and recompiling the driver to be upgraded based on the target dependency information, to obtain a driver to be tested; determining a target driver priority corresponding to the driver to be tested, and performing a function test on the driver to be tested based on the target driver priority.

8. The kernel and driver upgrade method of an operating system according to claim 7, wherein, The method further comprises: determining a target test standard corresponding to the driver to be tested based on the target driver priority; if the target driver priority is the preset high priority, performing a function test on the driver to be tested based on the first preset test standard; if the target driver priority is the preset medium priority, performing a function test on the driver to be tested based on a second preset test standard; if the target driver priority is the preset low priority, performing a function test on the driver to be tested based on a third preset test standard; The first preset test criterion is a criterion for testing all functions of the driver; the second preset test criterion is a criterion for testing pre-selected functions of the driver; and the third preset test criterion is a criterion for reloading the driver.

9. The kernel and driver upgrade method of an operating system according to claim 8, wherein, Before the kernel and the driver of the target operating system are upgraded based on the target kernel environment and the target driver package, the method further comprises: If the to-be-tested driver fails the function test, a driver vulnerability of the to-be-tested driver is found; The driver vulnerability is repaired, and the repaired vulnerability is taken as a new to-be-upgraded driver. The step of obtaining target dependent information of the to-be-upgraded driver from the preset driver knowledge base is jumped to, so as to recompile and test the to-be-upgraded driver.

10. The method of claim 1 to 9, wherein, The kernel and the driver of the target operating system are upgraded based on the target kernel environment and the target driver package, which comprises: A kernel environment package corresponding to the target kernel environment is obtained, and the kernel environment package and the target driver package are loaded to the target operating system to complete the kernel and the driver of the target operating system.

Citation Information

Patent Citations

  • Kernel driver upgrading method and device, server and storage medium

    CN113741926A

  • Distributed storage operating system upgrading method and device, equipment and medium

    CN115495131A

  • Driver upgrading method and device, electronic equipment and storage medium

    CN117112002A

  • Driving program updating method and device, computer equipment and storage medium

    CN117215602A

  • Drive support method, device, equipment, medium and program product

    CN118170440A