WO2022183573A1 - 支持多内核版本的驱动安装包生成方法、安装方法及装置 - Google Patents

支持多内核版本的驱动安装包生成方法、安装方法及装置 Download PDF

Info

Publication number
WO2022183573A1
WO2022183573A1 PCT/CN2021/087396 CN2021087396W WO2022183573A1 WO 2022183573 A1 WO2022183573 A1 WO 2022183573A1 CN 2021087396 W CN2021087396 W CN 2021087396W WO 2022183573 A1 WO2022183573 A1 WO 2022183573A1
Authority
WO
WIPO (PCT)
Prior art keywords
driver
kernel
compilation
installation package
file
Prior art date
Application number
PCT/CN2021/087396
Other languages
English (en)
French (fr)
Inventor
单晋奎
Original Assignee
长沙景嘉微电子股份有限公司
长沙景美集成电路设计有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 长沙景嘉微电子股份有限公司, 长沙景美集成电路设计有限公司 filed Critical 长沙景嘉微电子股份有限公司
Publication of WO2022183573A1 publication Critical patent/WO2022183573A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Definitions

  • the present application relates to the technical field of driver installation, and in particular, to a method, installation method and device for generating a driver installation package supporting multi-kernel versions.
  • the kernel of the Linux system is updated quickly. With the upgrade of the Linux kernel, the drivers related to the kernel also need to be passively updated to the latest version. However, when a new kernel driver is released, many users use various old kernel versions. The current practice is to compile a kernel driver installation package for different kernel versions, and each driver installation package corresponds to a kernel version. Users need to download and install the driver installation package that matches the kernel in their own system.
  • Embodiments of the present application provide a method for generating a driver installation package that supports multi-kernel versions, an installation method, and an apparatus, so as to solve the above-mentioned technical problems existing in the related art.
  • an embodiment of the present application provides a method for generating a driver installation package that supports multi-kernel versions, including: obtaining driver source code; compiling the driver source code in a pre-created driver compilation environment to obtain the driver compilation Driver binary files corresponding to each kernel version supported by the environment, wherein the driver compilation environment includes multiple sub-compilation environments, each sub-compilation environment is used to provide compilation support for the corresponding kernel version; a driver installation package is generated according to the obtained driver binary files.
  • an embodiment of the present application provides a method for installing a driver installation package supporting a multi-kernel version, including: obtaining a driver installation package, where the driver installation package includes multiple driver binary files, and the multiple driver binary files are Obtained by separately compiling the driver source code in multiple sub-compilation environments, each sub-compilation environment is used to provide compilation support for the corresponding kernel version; determine each kernel version existing in the current system, and obtain the corresponding kernel version from the driver installation package.
  • the driver binary file corresponding to each kernel version; the corresponding driver binary file is compiled using the real kernel environment of each kernel version to obtain the driver program corresponding to each kernel version; each driver program is updated to the corresponding system boot file.
  • an embodiment of the present application provides a device for generating a driver installation package that supports multi-kernel versions, including: a source code acquisition module for acquiring driver source code; a source code compilation module for compiling in a pre-created driver compilation environment
  • the driver source code is used to obtain the driver binary files corresponding to each kernel version supported by the driver compilation environment, wherein the driver compilation environment includes a plurality of sub-compilation environments, and each sub-compilation environment is used to provide compilation support for the corresponding kernel version ;
  • the installation package generation module is used to generate the driver installation package according to the obtained driver binary file.
  • an embodiment of the present application provides a device for installing a driver installation package that supports multi-kernel versions, including: an installation package acquisition module for acquiring a driver installation package, where the driver installation package includes a plurality of driver binary files, so The multiple driver binary files described above are obtained by compiling the driver source code in multiple sub-compilation environments respectively, each sub-compilation environment is used to provide compilation support for the corresponding kernel version; the binary file matching module is used to determine the existing system in the current system. each kernel version, and obtain the driver binary file corresponding to each kernel version from the driver installation package; the driver compilation module is used for compiling the corresponding driver binary file using the real kernel environment of each kernel version, and obtains the driver binary file corresponding to each kernel version.
  • the driver corresponding to the kernel version; the boot file update module is used to update each driver to the corresponding system boot file.
  • an embodiment of the present application provides a storage medium, where a driver installation package is stored on the storage medium, wherein the driver installation package is generated according to the method described in the first aspect.
  • the driver installation package is used to guide the target device to perform the following steps: determine each kernel version existing in the current system of the target device, and obtain from the driver installation package and the various kernel versions The corresponding driver binary file; the corresponding driver binary file is compiled using the real kernel environment of each kernel version to obtain the driver program corresponding to each kernel version; each driver program is updated to the corresponding system boot file.
  • an embodiment of the present application provides an electronic device, including: a processor and a memory, where the processor is configured to execute computer program instructions stored in the memory, and when the processor executes the computer program instructions, executes the following: The method of the first aspect or the second aspect.
  • a driver source code is compiled to generate a driver installation package, and the driver installation package simultaneously carries multiple driver binary files (.o files) corresponding to each kernel version, which can be used for flexible matching and use Users of different kernel versions, so developers do not need to release multiple driver installation packages for different kernel versions.
  • the driver installation package When installing the driver installation package, the device can obtain the driver binary file matching the kernel from the driver installation package and compile the correct driver. Therefore, no matter what kernel version the device uses, it can be guaranteed that the device can install the correct driver. drive.
  • Fig. 1 shows the flow chart of the driver installation package generation method that supports multi-kernel version provided by this application
  • Fig. 2 shows a flowchart of a specific implementation manner of step S130 in Fig. 1;
  • FIG. 3 shows a flowchart of a specific implementation manner of step S140 in FIG. 1;
  • Fig. 4 shows the flow chart of the driver installation package installation method supporting multi-kernel version provided by the present application
  • Fig. 5 shows the flow chart of the installation method in Fig. 4 in a specific embodiment
  • FIG. 6 shows a schematic diagram of a device for generating a driver installation package that supports multi-kernel versions provided by the present application
  • Fig. 7 shows a schematic diagram of a driver installation package installation device supporting multi-kernel versions provided by the present application.
  • FIG. 1 shows a flow chart of the method for generating a driver installation package, and each step shown in the flow chart can be executed on the server. Referring to Figure 1, the method includes the following steps:
  • Step S110 Create a driver compilation environment in advance, and the driver compilation environment includes a plurality of sub-compilation environments.
  • a dedicated driver compilation environment is created in advance, and different versions of the Linux kernel environment can be added to the driver compilation environment, that is, multiple sub-compilation environments.
  • Compilation support for the kernel version For example, in May 2020, the driver compilation environment includes the kernel environment with version 4.4.131-20200430, and in September 2020, the driver compilation environment includes versions 4.4.131-20200430, 4.4.131-20200730, and 4.4 .131-20200830, including multiple kernel environments, by December 2020, the driver compilation environment includes versions 4.4.131-20200430, 4.4.131-20200730, 4.4.131-20200830, 4.4.131-20201030, and 4.4. 131-20201130 in multiple kernel environments.
  • step S110 specifically includes:
  • Step a1 obtain the kernel image file and kernel header file of ⁇ kernel version 1>.
  • the obtained kernel image file is linux-image- ⁇ kernel version 1>.deb
  • the obtained kernel header file is linux-header- ⁇ kernel version 1>.deb.
  • Step b1 install the kernel image file and kernel header file of ⁇ kernel version 1>.
  • Step c1 obtain the sub-compilation environment corresponding to ⁇ kernel version 1>.
  • the sub-compilation environment obtained in step c1 can provide compilation support for the kernel version 1, and the driver binary file corresponding to the kernel version 1 can be compiled in the sub-compilation environment.
  • the sub-compilation environment corresponding to ⁇ kernel version 1> can be continuously added in the driver compilation environment.
  • the adding process includes:
  • Step a2 obtain the kernel image file and kernel header file of ⁇ kernel version 2>.
  • the obtained kernel image file is linux-image- ⁇ kernel version 2>.deb
  • the obtained kernel header file is linux-header- ⁇ kernel version 2>.deb.
  • Step b2 install the kernel image file and kernel header file of ⁇ kernel version 2>.
  • Step c2 obtain the sub-compilation environment corresponding to ⁇ kernel version 2>.
  • the sub-compilation environment obtained in step c2 can provide compilation support for kernel version 2.
  • the driver compilation environment can provide compilation support for kernel version 1 and kernel version 2 at the same time, and the driver binary file corresponding to kernel version 1 and the driver binary file corresponding to kernel version 2 can be compiled in this driver compilation environment.
  • Step S120 Obtain the driver source code.
  • Step S130 Compile the driver source code in a pre-created driver compilation environment to obtain driver binary files corresponding to each kernel version supported by the driver compilation environment.
  • Step S140 Generate a driver installation package according to the obtained driver binary file.
  • steps S120 to S140 will be described in detail below.
  • step S120 the source code of the driver program that has been developed is obtained.
  • step S130 the driver source code is compiled in a plurality of sub-compilation environments respectively to obtain a plurality of corresponding driver binary files, the corresponding kernel version number is added to the name of each driver binary file, and the plurality of driver binary files are added. Save it in the driver compilation directory.
  • FIG. 2 shows a flowchart of a specific implementation manner of step S130. As shown in FIG. 2, step S130 includes:
  • Step S131 Obtain a list of version numbers of all kernel versions supported by the built driver compilation environment.
  • the version number list includes: kernel version number 1, kernel version number 2, ..., kernel version No. N.
  • the method further includes: clearing all temporary files in the driver compilation directory to ensure that the driver compilation environment is correct.
  • the driver compilation directory is used to store all the driver binaries generated by compilation.
  • Step S132 traverse the kernel version numbers in the version number list one by one, perform steps S133 to S136 for each kernel version number, and end the compilation process after traversing all the kernel version numbers.
  • Step S133 Pass the kernel version number X to be processed this time.
  • the kernel version number X is the version number currently traversed in the version number list.
  • Step S134 Compile the driver source code in the sub-compilation environment corresponding to the kernel version number X to generate the corresponding driver binary file.
  • the kernel header file and link library corresponding to the kernel version number X to compile the driver source code, and compile to generate the corresponding driver binary file. It is assumed that the generated driver binary file (.o file) is mwv206.o. Among them, the link library is provided by the kernel image file.
  • Step S135 Add the corresponding kernel version number to the name of the generated driver binary file.
  • step S134 Save the mwv206.o generated in step S134 as the mwv206.o.dkms. ⁇ kernel version number X> file, so that the target device can quickly obtain the driver binary file matching the kernel when installing the driver installation package. To prevent the driver binary files generated in step S134 from being erased by mistake when all temporary files in the driver compilation directory are erased.
  • Step S136 Save the renamed driver binary file in the driver compilation directory, and jump to step S132.
  • driver binary files After traversing all kernel version numbers, there are driver binary files in the driver compilation directory: mwv206.0.dkms. ⁇ kernel version number 1>, mwv206.0.dkms. ⁇ kernel version number 2>, ..., mwv206. 0.dkms. ⁇ kernel version number N> etc.
  • the corresponding driver binary files are compiled, so that one driver source code is used to compile multiple driver binary files corresponding to the kernel version, which are the driver binary files. Add the kernel version number as a suffix to the name.
  • Table 1 The corresponding relationship between the obtained multiple driver binary files and the kernel version is shown in Table 1:
  • serial number kernel version Binary file 1 4.4.131-20200430 mwv206.o.dkms.4.4.131-20200430 2 4.4.131-20200730 mwv206.o.dkms.4.4.131-20200730 3 4.4.131-20200830 mwv206.o.dkms.4.4.131-20200830 4 4.4.131-20201030 mwv206.o.dkms.4.4.131-20201030 5 4.4.131-20201130 mwv206.o.dkms.4.4.131-20201130
  • step S140 a driver installation package is generated according to all the driver binary files obtained in step S130.
  • Fig. 3 shows a flowchart of a specific implementation manner of step S140. As shown in Fig. 3, step S140 includes:
  • Step S141 Copy all the driver binary files in the driver compilation directory to the driver packaging directory.
  • Step S142 Create a DKMS configuration file and a MakeFile file in the driver packaging directory.
  • the DKMS (Dynamic Kernel Module Support) configuration file specifies the installation location of the driver
  • the MakeFile file specifies the generation rule of the driver.
  • the DKMS configuration file can be implemented by referring to the following code:
  • the specified driver installation location is the extra/ directory.
  • the MakeFile file can be implemented by referring to the following code:
  • the above MakeFile file can be used to establish the corresponding relationship between the kernel version and mwv206.o.dkms. ⁇ kernel version number X> by judging the kernel version existing in the target system one by one when installing the driver installation package in the future.
  • Step S143 Package the DKMS configuration file, MakeFile file and all driver binary files in the driver package directory, and generate a driver installation package.
  • the server After executing steps S120 to S140, the server generates a driver installation package.
  • the target device can download the driver installation package from the server and install it on the device.
  • FIG. 4 shows a flowchart of a method for installing a driver installation package supporting a multi-kernel version provided by the present application.
  • the method for installing a driver installation package is applied to a target device, where the target device is a device that installs a Linux system kernel.
  • the installation method includes:
  • Step S210 Obtain a driver installation package.
  • the target device downloads and obtains a driver installation package (.deb file) from the server, and the driver installation package is generated according to the driver installation package generation method supporting multi-kernel versions provided by this application, that is, the driver installation package includes a plurality of driver binary files , the multiple driver binary files are obtained by compiling the driver source code in multiple sub-compilation environments respectively.
  • a driver installation package (.deb file)
  • the driver installation package includes a plurality of driver binary files
  • the multiple driver binary files are obtained by compiling the driver source code in multiple sub-compilation environments respectively.
  • Step S220 Determine each kernel version existing in the current system, and obtain the driver binary file corresponding to each kernel version from the driver installation package.
  • Step S230 Compile the corresponding driver binary file by using the real kernel environment of each kernel version to obtain a driver program corresponding to each kernel version.
  • Step S240 Update each driver program to the corresponding system boot file respectively.
  • FIG. 5 shows a flowchart of the driver installation package installation method in the present application in a specific embodiment
  • Step S310 Obtain a version number list of all kernel versions existing in the current system of the target device.
  • the obtained version number list includes: kernel version number 1 and kernel version number 4.
  • Step S320 Traverse the kernel version numbers in the version number list one by one, perform steps S330 to S360 for each kernel version number, and end the installation process after traversing all the kernel version numbers.
  • Step S330 Pass the kernel version number X to be processed this time.
  • the kernel version number X is the version number currently traversed in the version number list.
  • Step 340 Compile the driver using the make command.
  • the make command is an important compilation command in the Linux system.
  • the Makefile files in the target directory will be scanned, and automatic compilation will be performed according to the MakeFile files.
  • KERNELRELEASE variable “kernel version number X”
  • Step a3 obtain the corresponding driver binary file mwv206.o.dkms. ⁇ kernel version number X> from the driver installation package according to the kernel version number X;
  • Step b3 copy the mwv206.o.dkms. ⁇ kernel version number X> file as mwv206.o.dkms;
  • Step c3 use the kernel header file and link library of the kernel version X to compile the mwv206.o.dkms file, and link and generate the driver mwv206.ko corresponding to the kernel version X.
  • step a3 the kernel version number X is matched with the names of multiple driver binary files in the driver installation package, and the driver binary file mwv206.o.dkms. ⁇ kernel corresponding to the kernel version number X is obtained according to the matching situation Version number X>.
  • Step S350 Copy the driver generated in step S340 to the installation location corresponding to the kernel version number X.
  • Step S360 Execute the update-initramfs command to update the driver program to the corresponding system boot file, and jump to step S320 to continue the execution.
  • the target device After adding the driver to the corresponding kernel, the target device updates the system boot file of the corresponding kernel, and adds the new mwv206.ko driver to the corresponding system boot file, so that the corresponding kernel boot file will use the corresponding correct one after restarting the system. driver.
  • the command to update the system boot file is: update-initramfs–u–k ⁇ kernel version number>. If there are multiple kernel versions in the current system, the update-initramfs command will be executed multiple times to update the corresponding system boot file.
  • the system boot file is generally initrd.img- ⁇ kernel version number> or initramfs.img- ⁇ kernel version number> document.
  • the method for generating and installing a driver installation package supporting a multi-kernel version provided by the embodiment of the present application has the following technical effects:
  • a driver source code generates a driver installation package, which carries multiple driver binary files (.o files) at the same time, which can flexibly match users who use different kernel versions, so that developers do not need to target different kernels. Version releases multiple driver installation packages.
  • the driver installation package also supports multiple kernels from the date of product release to the current latest version, supports installation across multiple kernel versions, and supports installation across long-term kernel versions.
  • driver installation package When installing the driver installation package, it can automatically match the kernel version in the current system of the device, and add the correct driver to the kernel. When there are multiple available kernel versions in the system, the driver and multiple kernels can be resolved. The matching problem between versions ensures that the device can always install the correct driver.
  • FIG. 6 shows a schematic diagram of an apparatus for generating a driver installation package supporting a multi-kernel version provided by the present application. Based on the same inventive concept, an embodiment of the present application provides an apparatus for generating a driver installation package supporting multi-kernel versions. Please refer to FIG. 6 .
  • the source code obtaining module 410 is used for obtaining the driver source code; the source code compiling module 420 is used for compiling the driver source code in a pre-created driver compiling environment to obtain the driver binary corresponding to each kernel version supported by the driver compiling environment file, wherein the driver compilation environment includes multiple sub-compilation environments, each sub-compilation environment is used to provide compilation support for a corresponding kernel version; the installation package generation module 430 is used to generate a driver installation package according to the obtained driver binary file.
  • the device further includes: a compilation environment creation module for creating multiple sub-compilation environments corresponding to the multiple kernel versions by installing the kernel image files and the kernel header files corresponding to the multiple kernel versions to obtain the Driver build environment.
  • a compilation environment creation module for creating multiple sub-compilation environments corresponding to the multiple kernel versions by installing the kernel image files and the kernel header files corresponding to the multiple kernel versions to obtain the Driver build environment.
  • the source code compiling module 420 is specifically configured to: compile the driver source code in the multiple sub-compilation environments, respectively, to obtain multiple corresponding driver binary files; add the corresponding driver binary files in the naming of the multiple driver binary files. and save the multiple driver binary files in the driver compilation directory.
  • the source code compilation module 420 is further configured to: before compiling the driver program source code, clear all temporary files in the driver compilation directory.
  • the installation package generation module 430 includes: a file copy module for copying all the driver binary files in the driver compilation directory to the driver packaging directory; a configuration file creation module for creating in the driver packaging directory DKMS configuration file and MakeFile file, wherein, the DKMS configuration file specifies the installation location of the driver, and the MakeFile file specifies the generation rule of the driver; Packaging module, for packaging the DKMS configuration file, MakeFile under the driver packaging directory files and all driver binaries, and generate the driver installation package.
  • FIG. 7 shows a schematic diagram of a driver installation package installation device supporting multi-kernel versions provided by the present application.
  • the embodiment of the present application also provides a driver installation package installation device supporting multi-kernel versions, please refer to FIG. 7 , the device includes: an installation package acquisition module 510 , a binary file matching module 520 , a driver program compilation module 530 and a boot file update module 540.
  • the installation package obtaining module 510 is used to obtain a driver installation package, and the driver installation package includes a plurality of driver binary files, and the plurality of driver binary files are obtained by compiling driver source code in a plurality of sub-compilation environments respectively.
  • each sub-compilation environment is used to provide compilation support for the corresponding kernel version;
  • the binary file matching module 520 is used to determine each kernel version existing in the current system, and obtain the driver corresponding to each kernel version from the driver installation package binary file;
  • the driver compiling module 530 is used for compiling the corresponding driver binary file using the real kernel environment of each kernel version to obtain the driver program corresponding to each kernel version;
  • the boot file updating module 540 is used for updating each driver program to the corresponding in the system boot file.
  • the name of each driver binary file carries the corresponding kernel version number
  • the binary file matching module 520 is specifically used for: combining the kernel version numbers of the various kernel versions with the multiple driver binary files in the driver installation package. The names of the files are matched; the driver binaries corresponding to each kernel version are obtained based on the match.
  • the boot file update module 540 is specifically configured to: execute the update-initramfs command to update each driver to the corresponding system boot file.
  • the present application also provides a storage medium on which a driver installation package is stored, wherein the driver installation package is generated according to the method for generating a driver installation package supporting multi-kernel versions provided by the present application.
  • the driver installation package is used to guide the target device to perform the following installation process: determine each kernel version existing in the current system of the target device, and obtain and The driver binary file corresponding to the kernel version; the corresponding driver binary file is compiled using the real kernel environment of each kernel version to obtain the driver program corresponding to each kernel version; each driver program is updated to the corresponding system boot file.
  • the driver installation package installation method for the specific process of installing the driver installation package on the target device, reference may be made to the foregoing description of the driver installation package installation method.
  • the present application also provides an electronic device, including: a processor and a memory, where the processor is configured to execute computer program instructions stored in the memory, and when the processor executes the computer program instructions, the processor executes the multi-support system provided by the present application.
  • the generation method or installation method of the driver installation package of the kernel version may be a server for generating driver installation packages, or it may be any device that uses the Linux system kernel.
  • the embodiments of the present application may be provided as a method, a system, or a computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
  • computer-usable storage media including, but not limited to, disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory result in an article of manufacture comprising instruction means, the instructions
  • the apparatus implements the functions specified in the flow or flow of the flowcharts and/or the block or blocks of the block diagrams.

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

一种支持多内核版本的驱动安装包生成方法、安装方法及装置,其中,生成方法包括:获取驱动程序源码(S120);在预先创建的驱动编译环境中编译所述驱动程序源码,以获得所述驱动编译环境支持的各内核版本对应的驱动二进制文件(S130),其中,所述驱动编译环境包括多个子编译环境,每个子编译环境用于提供对应内核版本的编译支持;根据获得的驱动二进制文件生成驱动安装包(S140)。通过一个驱动程序源码编译生成一个驱动安装包,该驱动安装包中同时携带与各内核版本对应的多个驱动二进制文件,可以用于灵活匹配使用不同内核版本的用户,从而开发者不需要针对不同的内核版本发布多个驱动安装包。

Description

支持多内核版本的驱动安装包生成方法、安装方法及装置 技术领域
本申请涉及驱动安装技术领域,具体地,涉及一种支持多内核版本的驱动安装包生成方法、安装方法及装置。
背景技术
Linux系统的内核升级更新较快,随着Linux内核的升级,与内核相关的驱动程序也需要被动更新到最新的版本。但当发布一个新的内核驱动时,存在许多用户使用各种不同旧版本的内核,现行的做法是针对不同的内核版本,分别编译一个内核驱动安装包,每个驱动安装包对应一个内核版本,用户需要下载与自身系统中的内核相匹配的驱动安装包进行安装。
这样存在的问题是:
1、针对同一个内核驱动程序源码,需要编译并发布多个驱动安装包;
2、如果用户未正确下载并安装与之内核版本相匹配的驱动安装包,将会出现驱动与内核版本不匹配的情况,造成设备异常。
发明内容
本申请实施例中提供一种支持多内核版本的驱动安装包生成方法、安装方法及装置,以解决相关技术中存在的上述技术问题。
第一方面,本申请实施例提供一种支持多内核版本的驱动安装包生成方法,包括:获取驱动程序源码;在预先创建的驱动编译环境中编译所述驱动程序源码,以获得所述驱动编译环境支持的各内核版本对应的驱动二进制文件,其中,所述驱动编译环境包括多个子编译环境,每个子编译环境用于提供对应内核版本的编译支持;根据获得的驱动二进制文件生成驱动安装包。
第二方面,本申请实施例提供一种支持多内核版本的驱动安装包安装方 法,包括:获取驱动安装包,所述驱动安装包中包括多个驱动二进制文件,所述多个驱动二进制文件是通过在多个子编译环境中分别编译驱动程序源码后获得的,每个子编译环境用于提供对应内核版本的编译支持;确定当前系统中存在的各内核版本,并从所述驱动安装包中获取与所述各内核版本对应的驱动二进制文件;利用各内核版本的真实内核环境编译对应的驱动二进制文件,获得与各内核版本对应的驱动程序;将各驱动程序更新到对应的系统引导文件中。
第三方面,本申请实施例提供一种支持多内核版本的驱动安装包生成装置,包括:源码获取模块,用于获取驱动程序源码;源码编译模块,用于在预先创建的驱动编译环境中编译所述驱动程序源码,以获得所述驱动编译环境支持的各内核版本对应的驱动二进制文件,其中,所述驱动编译环境包括多个子编译环境,每个子编译环境用于提供对应内核版本的编译支持;安装包生成模块,用于根据获得的驱动二进制文件生成驱动安装包。
第四方面,本申请实施例提供一种支持多内核版本的驱动安装包安装装置,包括:安装包获取模块,用于获取驱动安装包,所述驱动安装包中包括多个驱动二进制文件,所述多个驱动二进制文件是通过在多个子编译环境中分别编译驱动程序源码后获得的,每个子编译环境用于提供对应内核版本的编译支持;二进制文件匹配模块,用于确定当前系统中存在的各内核版本,并从所述驱动安装包中获取与所述各内核版本对应的驱动二进制文件;驱动程序编译模块,用于利用各内核版本的真实内核环境编译对应的驱动二进制文件,获得与各内核版本对应的驱动程序;引导文件更新模块,用于将各驱动程序更新到对应的系统引导文件中。
第五方面,本申请实施例提供一种存储介质,所述存储介质上存储有驱动安装包,其中,所述驱动安装包是根据第一方面所述的方法生成的,当有目标设备安装所述驱动安装包时,所述驱动安装包用于引导所述目标设备执行如下步骤:确定目标设备的当前系统中存在的各内核版本,并从所述驱动安装包中 获取与所述各内核版本对应的驱动二进制文件;利用各内核版本的真实内核环境编译对应的驱动二进制文件,获得与各内核版本对应的驱动程序;将各驱动程序更新到对应的系统引导文件中。
第六方面,本申请实施例提供一种电子设备,包括:处理器和存储器,所述处理器用于执行所述存储器中存储的计算机程序指令,所述处理器执行所述计算机程序指令时执行如第一方面或第二方面所述的方法。
在本申请提供的技术方案中,一个驱动程序源码编译生成一个驱动安装包,该驱动安装包中同时携带与各内核版本对应的多个驱动二进制文件(.o文件),可以用于灵活匹配使用不同内核版本的用户,从而开发者不需要针对不同的内核版本发布多个驱动安装包。在安装该驱动安装包时,设备可以从驱动安装包中获取与之内核匹配的驱动二进制文件,编译出正确的驱动程序,因此,无论设备使用何种内核版本,可以保证设备均能够安装正确的驱动。
附图说明
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:
图1示出了本申请提供的支持多内核版本的驱动安装包生成方法的流程图;
图2示出了图1中步骤S130的一种具体实现方式的流程图;
图3示出了图1中步骤S140的一种具体实现方式的流程图;
图4示出了本申请提供的支持多内核版本的驱动安装包安装方法的流程图;
图5示出了图4中的安装方法在具体实施例中的流程图;
图6示出了本申请提供的支持多内核版本的驱动安装包生成装置的示意图;
图7示出了本申请提供的支持多内核版本的驱动安装包安装装置的示意 图。
具体实施方式
为了使本申请实施例中的技术方案及优点更加清楚明白,以下结合附图对本申请的示例性实施例进行进一步详细的说明,显然,所描述的实施例仅是本申请的一部分实施例,而不是所有实施例的穷举。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。
针对相关技术中存在的技术问题,本申请实施例提供一种支持多内核版本的驱动安装包生成方法以及相应的安装方法。图1示出了该驱动安装包生成方法的流程图,该流程图中所示的各个步骤可以在服务器上执行。请参照图1,该方法包括如下步骤:
步骤S110:预先创建驱动编译环境,该驱动编译环境中包括多个子编译环境。
在本实施例中,预先创建一个专用的驱动编译环境,该驱动编译环境可添加不同版本的Linux内核环境,即多个子编译环境,每个子编译环境对应一种版本的内核环境,用于提供对应内核版本的编译支持。比如,在2020年5月时,驱动编译环境中包括版本为4.4.131-20200430的内核环境,到2020年9月时,驱动编译环境包括版本4.4.131-20200430、4.4.131-20200730、4.4.131-20200830在内的多个内核环境,到2020年12月时,驱动编译环境包括版本4.4.131-20200430、4.4.131-20200730、4.4.131-20200830、4.4.131-20201030、4.4.131-20201130在内的多个内核环境。
以创建一个子编译环境为例,步骤S110具体包括:
步骤a1,获取<内核版本1>的内核镜像文件和内核头文件。
例如,获取到的内核镜像文件为linux-image-<内核版本1>.deb,获取到的内核头文件为linux-header-<内核版本1>.deb。
步骤b1,安装<内核版本1>的内核镜像文件和内核头文件。
例如,执行dpkg或rpm命令安装linux-image-<内核版本1>.deb和 linux-header-<内核版本1>.deb。
步骤c1,获得<内核版本1>对应的子编译环境。
步骤c1中获得的子编译环境可提供对内核版本1的编译支持,在该子编译环境中可编译得到内核版本1对应的驱动二进制文件。
在创建<内核版本1>对应的子编译环境后,可在驱动编译环境中持续添加新的内核版本对应的子编译环境,其添加过程包括:
步骤a2,获取<内核版本2>的内核镜像文件和内核头文件。
例如,获取到的内核镜像文件为linux-image-<内核版本2>.deb,获取到的内核头文件为linux-header-<内核版本2>.deb。
步骤b2,安装<内核版本2>的内核镜像文件和内核头文件。
例如,执行dpkg或rpm命令安装linux-image-<内核版本2>.deb和linux-header-<内核版本2>.deb。
步骤c2,获得<内核版本2>对应的子编译环境。
步骤c2中获得的子编译环境可提供对内核版本2的编译支持。此时,驱动编译环境可同时提供对内核版本1和内核版本2的编译支持,在该驱动编译环境中可编译得到内核版本1对应的驱动二进制文件和内核版本2对应的驱动二进制文件。
通过上述方法可以在驱动编译环境中添加更多版本的子编译环境。
在完成驱动编译环境的创建后,通过下述步骤S120~步骤S140实现驱动安装包的生成过程。
步骤S120:获取驱动程序源码。
步骤S130:在预先创建的驱动编译环境中编译驱动程序源码,以获得该驱动编译环境支持的各内核版本对应的驱动二进制文件。
步骤S140:根据获得的驱动二进制文件生成驱动安装包。
下文对步骤S120~步骤S140的具体实施方式进行详细说明。
在步骤S120中,获取开发完成的驱动程序源码。
在步骤S130中,在多个子编译环境中分别编译该驱动程序源码,获得对应的多个驱动二进制文件,在每个驱动二进制文件的命名中添加对应的内核版本号,并将多个驱动二进制文件保存在驱动编译目录下。
图2示出了步骤S130的一种具体实现方式的流程图,如图2所示,步骤S130包括:
步骤S131:获取构建的驱动编译环境所支持的所有内核版本的版本号列表。
假设当前驱动编译环境支持:内核版本1、内核版本2、……、内核版本N等多个内核版本的编译,则版本号列表包括:内核版本号1、内核版本号2、……、内核版本号N。
可选的,在步骤S132之前,该方法还包括:清除驱动编译目录下的所有临时文件,确保驱动编译环境正确。驱动编译目录用于存储编译生成的所有驱动二进制文件。
步骤S132:逐个遍历版本号列表中的内核版本号,针对每个内核版本号均执行步骤S133至步骤S136,遍历完所有内核版本号后结束本次编译过程。
步骤S133:传递本次需要处理的内核版本号X。
内核版本号X为版本号列表中当前所遍历的版本号。
步骤S134:在内核版本号X对应的子编译环境中编译驱动程序源码,生成对应的驱动二进制文件。
使用内核版本号X对应的内核头文件和链接库编译驱动程序源码,编译生成对应的驱动二进制文件,假设生成的驱动二进制文件(.o文件)为mwv206.o。其中,链接库由内核镜像文件提供。
步骤S135:在生成的驱动二进制文件的命名中添加对应的内核版本号。
将步骤S134生成的mwv206.o保存为mwv206.o.dkms.<内核版本号X>文件,从而可便于目标设备在安装驱动安装包时,快速获得与之内核匹配的驱动二进制文件,同时,可以防止在清除驱动编译目录下的所有临时文件时,将步 骤S134生成的驱动二进制文件误清除。
步骤S136:将重命名后的驱动二进制文件保存在驱动编译目录下,跳转至步骤S132。
在遍历完所有内核版本号后,在驱动编译目录下共有驱动二进制文件:mwv206.0.dkms.<内核版本号1>、mwv206.0.dkms.<内核版本号2>、……、mwv206.0.dkms.<内核版本号N>等。
通过以上步骤,针对驱动编译环境支持的每个内核版本,均编译出对应的驱动二进制文件,从而利用一个驱动程序源码编译出多个与内核版本有对应关系的驱动二进制文件,并为驱动二进制文件名添加内核版本号作为后缀。得到的多个驱动二进制文件与内核版本的对应关系如下表一:
表一
序号 内核版本 二进制文件(.o)
1 4.4.131-20200430 mwv206.o.dkms.4.4.131-20200430
2 4.4.131-20200730 mwv206.o.dkms.4.4.131-20200730
3 4.4.131-20200830 mwv206.o.dkms.4.4.131-20200830
4 4.4.131-20201030 mwv206.o.dkms.4.4.131-20201030
5 4.4.131-20201130 mwv206.o.dkms.4.4.131-20201130
在步骤S140中,根据步骤S130获得的所有驱动二进制文件生成驱动安装包。图3示出了步骤S140的一种具体实现方式的流程图,如图3所示,步骤S140包括:
步骤S141:将驱动编译目录下的所有驱动二进制文件拷贝到驱动打包目录。
将步骤S130生成的所有mwv206.o.dkms.*文件拷贝到驱动打包目录。
步骤S142:在驱动打包目录下创建DKMS配置文件和MakeFile文件。
其中,DKMS(动态内核模块支持)配置文件指定驱动程序的安装位置,MakeFile文件指定驱动程序的生成规则。
DKMS配置文件可以参照如下代码实施:
PACKAGE_NAME="mwv206-dkms-closed"
PACKAGE_VERSION="1.2.0-multikernel-test2-4.4.131-20200821-desktop.kylin"
MAKE[0]="make-C${dkms_tree}/mwv206-dkms-closed/${PACKAGE_VERSION}/build/"
CLEAN="make-C${dkms_tree}/mwv206-dkms-closed/${PACKAGE_VERSION}/build/clean"
BUILT_MODULE_NAME[0]="mwv206-dkms-closed"
DEST_MODULE_LOCATION[0]="/extra"
AUTOINSTALL="yes"
REMAKE_INITRD="true"
在上述DKMS配置文件中,指定驱动程序的安装位置为extra/目录。
MakeFile文件可以参照如下代码实施:
obj-m:=mwv206-dkms-closed.o
mwv206-dkms-closed-objs:=mwv206.o.dkms
ifneq($(KERNELRELEASE),)
KERNELDIR?=/lib/modules/$(KERNELRELEASE)/build
else
KERNELDIR?=/lib/modules/$(shell uname-r)/build
endif
PWD:=$(shell pwd)
.PHONY:all
all:clean modules#install
.PHONY:modules
modules:
ifneq($(KERNELRELEASE),)
  cp mwv206.o.dkms.$(KERNELRELEASE)mwv206.o.dkms
else
  cp mwv206.o.dkms.$(shell uname-r)mwv206.o.dkms
endif
  $(MAKE)-C$(KERNELDIR)SUBDIRS=$(PWD)modules
.PHONY:clean
clean:
  $(MAKE)-C$(KERNELDIR)SUBDIRS=$(PWD)clean
#.PHONY:install
#install:
#$(MAKE)-C$(KERNELDIR)SUBDIRS=$(PWD)modules_install
上述MakeFile文件可用于:在未来安装驱动安装包时,通过逐个判断目标系统中存在的内核版本,建立内核版本与mwv206.o.dkms.<内核版本号X>的对应关系。
步骤S143:打包驱动打包目录下的DKMS配置文件、MakeFile文件和所有驱动二进制文件,并生成驱动安装包。
服务器在执行步骤S120~步骤S140之后,生成驱动安装包。目标设备可以从服务器处下载该驱动安装包并在设备上安装。
图4示出了本申请提供的支持多内核版本的驱动安装包安装方法的流程图,该驱动安装包安装方法应用于目标设备,其中,目标设备为安装Linux系统内核的设备。请参照图4,该安装方法包括:
步骤S210:获取驱动安装包。
目标设备从服务器下载获得驱动安装包(.deb文件),该驱动安装包是根据本申请提供的支持多内核版本的驱动安装包生成方法生成的,即该驱动安装包中包括多个驱动二进制文件,该多个驱动二进制文件是通过在多个子编译环 境中分别编译驱动程序源码后获得的。
步骤S220:确定当前系统中存在的各内核版本,并从驱动安装包中获取与各内核版本对应的驱动二进制文件。
步骤S230:利用各内核版本的真实内核环境编译对应的驱动二进制文件,获得与各内核版本对应的驱动程序。
步骤S240:将各驱动程序分别更新到对应的系统引导文件中。
图5示出了本申请中的驱动安装包安装方法在具体实施例中的流程图;在具体的实施例中,在获得驱动安装包后,目标设备在该驱动安装包的引导下执行以下步骤:
步骤S310:获取目标设备的当前系统中存在的所有内核版本的版本号列表。
假设当前系统中存在内核版本1和内核版本4两个内核版本,则获得的版本号列表包括:内核版本号1和内核版本号4。
步骤S320:逐个遍历版本号列表中的内核版本号,针对每个内核版本号均执行步骤S330至步骤S360,遍历完所有内核版本号后结束本次安装过程。
步骤S330:传递本次需要处理的内核版本号X。
内核版本号X为版本号列表中当前所遍历的版本号。
步骤340:使用make命令编译出驱动程序。
具体的,使用make命令编译驱动程序。make命令是Linux系统中的重要编译命令,当make命令被执行时,将扫描目标目录下的Makefile文件,根据MakeFile文件执行自动化编译。在编译时,给定KERNELRELEASE变量的值为“内核版本号X”,并执行如下操作:
步骤a3,根据内核版本号X从驱动安装包中获得对应的驱动二进制文件mwv206.o.dkms.<内核版本号X>;
步骤b3,复制mwv206.o.dkms.<内核版本号X>文件为mwv206.o.dkms;
步骤c3,使用内核版本号X的内核头文件和链接库编译mwv206.o.dkms 文件,链接、生成内核版本号X对应的驱动程序mwv206.ko。
其中,在步骤a3中,将内核版本号X与驱动安装包中的多个驱动二进制文件的命名进行匹配,根据匹配情况获得与内核版本号X对应的驱动二进制文件mwv206.o.dkms.<内核版本号X>。
步骤S350:将步骤S340生成的驱动程序拷贝到与内核版本号X对应的安装位置。
将内核版本号X对应的驱动程序mwv206.ko文件拷贝到DKMS配置文件中指定的extra/目录下。
步骤S360:执行update-initramfs命令将驱动程序更新到对应的系统引导文件中,跳转至步骤S320继续执行。
在以上步骤中,通过逐个遍历当前系统中存在的各内核版本,将对应内核版本的驱动二进制文件编译成与内核版本匹配的驱动程序文件(.ko文件),并将驱动程序安装到对应的内核中。比如系统A中存在4.4.131-20200730、4.4.131-20201030两个内核版本,则安装后的对应驱动程序关系如下表二所示:
表二
Figure PCTCN2021087396-appb-000001
又比如,系统B中存在4.4.131-20200430、4.4.131-20200730、4.4.131-20201130三个内核版本,则安装后的对应驱动程序关系如下表三所示:
表三
Figure PCTCN2021087396-appb-000002
Figure PCTCN2021087396-appb-000003
将驱动程序添加到对应内核之后,目标设备更新对应内核的系统引导文件,将新的mwv206.ko驱动程序添加到对应的系统引导文件,这样重启系统后对应的内核引导文件就会使用对应正确的驱动程序。
更新系统引导文件的命令为:update-initramfs–u–k<内核版本号>。如果当前系统中存在多个内核版本,将执行多次update-initramfs命令以更新对应的系统引导文件,系统引导文件一般为initrd.img-<内核版本号>或initramfs.img-<内核版本号>的文件。
比如,系统A中存在4.4.131-20200730、4.4.131-20201030两个内核版本,相应的update-initramfs命令参数和系统引导文件对应关系如下表四所示:
表四
Figure PCTCN2021087396-appb-000004
又比如,系统B中存在4.4.131-20200430、4.4.131-20200730、4.4.131-20201130三个内核版本,相应的update-initramfs命令参数和系统引导文件对应关系如下表五所示:
表五
Figure PCTCN2021087396-appb-000005
综上所述,本申请实施例提供的支持多内核版本的驱动安装包生成方法及安装方法,具有如下技术效果:
1、一个驱动程序源码,生成一个驱动安装包,该驱动安装包中同时携带多个驱动二进制文件(.o文件),可以灵活匹配使用不同内核版本的用户,从而开发者不需要针对不同的内核版本发布多个驱动安装包。
2、该驱动安装包同时支持从产品发布之日起到当前最新版本在内的多个内核,支持跨多个内核版本安装,且支持跨长时间的内核版本安装。
3、在安装驱动安装包时,能够自动匹配设备当前系统中的内核版本,并在内核中添加正确的驱动程序,当系统中存在多个可用的内核版本时,可以解决驱动程序与多个内核版本间的匹配问题,保证设备始终能安装正确的驱动。
图6示出了本申请提供的支持多内核版本的驱动安装包生成装置的示意图。基于同一发明构思,本申请实施例提供一种支持多内核版本的驱动安装包生成装置,请参照图6,该装置包括:源码获取模块410、源码编译模块420和安装包生成模块430。其中,源码获取模块410用于获取驱动程序源码;源码编译模块420用于在预先创建的驱动编译环境中编译所述驱动程序源码,以获得所述驱动编译环境支持的各内核版本对应的驱动二进制文件,其中,所述驱动编译环境包括多个子编译环境,每个子编译环境用于提供对应内核版本的编译支持;安装包生成模块430用于根据获得的驱动二进制文件生成驱动安装 包。
可选的,该装置还包括:编译环境创建模块,用于通过安装多个内核版本对应的内核镜像文件和内核头文件,创建与所述多个内核版本对应的多个子编译环境,获得所述驱动编译环境。
可选的,源码编译模块420具体用于:在所述多个子编译环境中分别编译所述驱动程序源码,获得对应的多个驱动二进制文件;在所述多个驱动二进制文件的命名中添加对应的内核版本号,并将所述多个驱动二进制文件保存在驱动编译目录下。
可选的,源码编译模块420还用于:在编译所述驱动程序源码之前,清除所述驱动编译目录下的所有临时文件。
可选的,安装包生成模块430包括:文件拷贝模块,用于将所述驱动编译目录下的所有驱动二进制文件拷贝到驱动打包目录;配置文件创建模块,用于在所述驱动打包目录下创建DKMS配置文件和MakeFile文件,其中,所述DKMS配置文件指定驱动程序的安装位置,所述MakeFile文件指定驱动程序的生成规则;打包模块,用于打包所述驱动打包目录下的DKMS配置文件、MakeFile文件和所有驱动二进制文件,并生成驱动安装包。
图7示出了本申请提供的支持多内核版本的驱动安装包安装装置的示意图。本申请实施例还提供一种支持多内核版本的驱动安装包安装装置,请参照图7,该装置包括:安装包获取模块510、二进制文件匹配模块520、驱动程序编译模块530和引导文件更新模块540。其中,安装包获取模块510用于获取驱动安装包,所述驱动安装包中包括多个驱动二进制文件,所述多个驱动二进制文件是通过在多个子编译环境中分别编译驱动程序源码后获得的,每个子编译环境用于提供对应内核版本的编译支持;二进制文件匹配模块520用于确定当前系统中存在的各内核版本,并从所述驱动安装包中获取与所述各内核版本对应的驱动二进制文件;驱动程序编译模块530用于利用各内核版本的真实内核环境编译对应的驱动二进制文件,获得与各内核版本对应的驱动程序;引导 文件更新模块540用于将各驱动程序更新到对应的系统引导文件中。
可选的,每个驱动二进制文件的命名中携带对应的内核版本号,二进制文件匹配模块520具体用于:将所述各内核版本的内核版本号与所述驱动安装包中的多个驱动二进制文件的命名进行匹配;根据匹配情况获得与每个内核版本对应的驱动二进制文件。
可选的,引导文件更新模块540具体用于:执行update-initramfs命令,将每个驱动程序更新到对应的系统引导文件中。
可以理解,本实施例中的支持多内核版本的驱动安装包生成装置及安装装置,其实现原理及产生的技术效果在前述方法实施例中已经介绍,为简要描述,该装置实施例中未提及之处可以参照前文中支持多内核版本的驱动安装包生成方法及安装方法中的相应描述。
本申请还提供一种存储介质,该存储介质上存储有驱动安装包,其中,所述驱动安装包是根据本申请提供的支持多内核版本的驱动安装包生成方法生成的,当有目标设备安装所述驱动安装包时,所述驱动安装包用于引导所述目标设备执行如下安装过程:确定目标设备的当前系统中存在的各内核版本,并从所述驱动安装包中获取与所述各内核版本对应的驱动二进制文件;利用各内核版本的真实内核环境编译对应的驱动二进制文件,获得与各内核版本对应的驱动程序;将各驱动程序更新到对应的系统引导文件中。当然,目标设备安装该驱动安装包的具体过程可以参照前文中对于驱动安装包安装方法的描述。
本申请还提供一种电子设备,包括:处理器和存储器,所述处理器用于执行所述存储器中存储的计算机程序指令,所述处理器执行所述计算机程序指令时执行本申请提供的支持多内核版本的驱动安装包生成方法或者安装方法。该电子设备可能是服务器,以用于生成驱动安装包,也可能是任何使用Linux系统内核的设备。
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结 合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
尽管已描述了本申请的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请范围的所有变更和修改。
显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。

Claims (12)

  1. 一种支持多内核版本的驱动安装包生成方法,其特征在于,包括:
    获取驱动程序源码;
    在预先创建的驱动编译环境中编译所述驱动程序源码,以获得所述驱动编译环境支持的各内核版本对应的驱动二进制文件,其中,所述驱动编译环境包括多个子编译环境,每个子编译环境用于提供对应内核版本的编译支持;
    根据获得的驱动二进制文件生成驱动安装包。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    通过安装多个内核版本对应的内核镜像文件和内核头文件,创建与所述多个内核版本对应的多个子编译环境,获得所述驱动编译环境。
  3. 根据权利要求1所述的方法,其特征在于,所述在预先创建的驱动编译环境中编译所述驱动程序源码,包括:
    在所述多个子编译环境中分别编译所述驱动程序源码,获得对应的多个驱动二进制文件;
    在所述多个驱动二进制文件的命名中添加对应的内核版本号,并将所述多个驱动二进制文件保存在驱动编译目录下。
  4. 根据权利要求3所述的方法,其特征在于,在编译所述驱动程序源码之前,所述方法还包括:清除所述驱动编译目录下的所有临时文件。
  5. 根据权利要求3或4所述的方法,其特征在于,所述根据获得的驱动二进制文件生成驱动安装包,包括:
    将所述驱动编译目录下的所有驱动二进制文件拷贝到驱动打包目录;
    在所述驱动打包目录下创建DKMS配置文件和MakeFile文件,其中,所述DKMS配置文件指定驱动程序的安装位置,所述MakeFile文件指定驱动程序的生成规则;
    打包所述驱动打包目录下的DKMS配置文件、MakeFile文件和所有驱动二进制文件,并生成驱动安装包。
  6. 一种支持多内核版本的驱动安装包安装方法,其特征在于,包括:
    获取驱动安装包,所述驱动安装包中包括多个驱动二进制文件,所述多个驱动二进制文件是通过在多个子编译环境中分别编译驱动程序源码后获得的,每个子编译环境用于提供对应内核版本的编译支持;
    确定当前系统中存在的各内核版本,并从所述驱动安装包中获取与所述各内核版本对应的驱动二进制文件;
    利用各内核版本的真实内核环境编译对应的驱动二进制文件,获得与各内核版本对应的驱动程序;
    将各驱动程序更新到对应的系统引导文件中。
  7. 根据权利要求6所述的方法,其特征在于,每个驱动二进制文件的命名中携带对应的内核版本号,所述从所述驱动安装包中获取与所述各内核版本对应的驱动二进制文件,包括:
    将所述各内核版本的内核版本号与所述驱动安装包中的多个驱动二进制文件的命名进行匹配;
    根据匹配情况获得与每个内核版本对应的驱动二进制文件。
  8. 根据权利要求6或7所述的方法,其特征在于,所述将各驱动程序更新到对应的系统引导文件中,包括:
    执行update-initramfs命令,将每个驱动程序更新到对应的系统引导文件中。
  9. 一种支持多内核版本的驱动安装包生成装置,其特征在于,包括:
    源码获取模块,用于获取驱动程序源码;
    源码编译模块,用于在预先创建的驱动编译环境中编译所述驱动程序源码,以获得所述驱动编译环境支持的各内核版本对应的驱动二进制文件,其中,所述驱动编译环境包括多个子编译环境,每个子编译环境用于提供对应内核版本的编译支持;
    安装包生成模块,用于根据获得的驱动二进制文件生成驱动安装包。
  10. 一种支持多内核版本的驱动安装包安装装置,其特征在于,包括:
    安装包获取模块,用于获取驱动安装包,所述驱动安装包中包括多个驱动二进制文件,所述多个驱动二进制文件是通过在多个子编译环境中分别编译驱动程序源码后获得的,每个子编译环境用于提供对应内核版本的编译支持;
    二进制文件匹配模块,用于确定当前系统中存在的各内核版本,并从所述驱动安装包中获取与所述各内核版本对应的驱动二进制文件;
    驱动程序编译模块,用于利用各内核版本的真实内核环境编译对应的驱动二进制文件,获得与各内核版本对应的驱动程序;
    引导文件更新模块,用于将各驱动程序更新到对应的系统引导文件中。
  11. 一种存储介质,其特征在于,所述存储介质上存储有驱动安装包,其中,所述驱动安装包是根据如权利要求1-5任一项所述的方法生成的,当有目标设备安装所述驱动安装包时,所述驱动安装包用于引导所述目标设备执行如下步骤:
    确定目标设备的当前系统中存在的各内核版本,并从所述驱动安装包中获取与所述各内核版本对应的驱动二进制文件;
    利用各内核版本的真实内核环境编译对应的驱动二进制文件,获得与各内核版本对应的驱动程序;
    将各驱动程序更新到对应的系统引导文件中。
  12. 一种电子设备,其特征在于,包括:处理器和存储器,所述处理器用于执行所述存储器中存储的计算机程序指令,所述处理器执行所述计算机程序指令时执行如权利要求1-5任一项或6-8任一项所述的方法。
PCT/CN2021/087396 2021-03-02 2021-04-15 支持多内核版本的驱动安装包生成方法、安装方法及装置 WO2022183573A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110229208.0 2021-03-02
CN202110229208.0A CN113031958B (zh) 2021-03-02 2021-03-02 支持多内核版本的驱动安装包生成方法、安装方法及装置

Publications (1)

Publication Number Publication Date
WO2022183573A1 true WO2022183573A1 (zh) 2022-09-09

Family

ID=76465402

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/087396 WO2022183573A1 (zh) 2021-03-02 2021-04-15 支持多内核版本的驱动安装包生成方法、安装方法及装置

Country Status (2)

Country Link
CN (1) CN113031958B (zh)
WO (1) WO2022183573A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117112144A (zh) * 2023-09-22 2023-11-24 上海卓悠网络科技有限公司 一种在android系统上部署k3s的方法及系统、存储介质
US20240095002A1 (en) * 2022-09-21 2024-03-21 Ncr Corporation Updated driver installation

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115840588A (zh) * 2023-02-14 2023-03-24 北京万里红科技有限公司 应用于debian系统的基于VSCode环境制作ISO镜像的方法
CN116909569A (zh) * 2023-07-24 2023-10-20 中科驭数(北京)科技有限公司 deb软件包的制作方法、装置、设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104021023A (zh) * 2014-06-24 2014-09-03 浪潮电子信息产业股份有限公司 一种突破内核模块版本控制解决方法
CN104239112A (zh) * 2014-09-30 2014-12-24 贝壳网际(北京)安全技术有限公司 一种设备驱动程序安装方法及装置
CN105159732A (zh) * 2015-10-13 2015-12-16 北京奇虎科技有限公司 在移动终端安装或更新应用程序的方法和移动终端
CN105549965A (zh) * 2015-12-09 2016-05-04 浪潮电子信息产业股份有限公司 一种将驱动集成到不同Linux内核版本的方法
CN110389786A (zh) * 2018-04-20 2019-10-29 伊姆西Ip控股有限责任公司 内核管理方法、设备和计算机程序产品

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8533707B2 (en) * 2008-03-04 2013-09-10 Lsi Corporation Linux matrix compilation system and method
CN107977210A (zh) * 2016-10-19 2018-05-01 中兴通讯股份有限公司 一种驱动安装方法及装置
US10592215B1 (en) * 2017-08-17 2020-03-17 NanoVMs, Inc. Unikernel cross-compilation
US10083059B1 (en) * 2018-03-19 2018-09-25 Capital One Services, Llc Method and system of hydrating of virtual machines
CN109408382A (zh) * 2018-10-11 2019-03-01 网宿科技股份有限公司 一种持续集成方法和持续集成系统
CN111427619A (zh) * 2020-03-26 2020-07-17 深圳市镭神智能系统有限公司 一种驱动程序自适配方法、装置、更新方法、设备及系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104021023A (zh) * 2014-06-24 2014-09-03 浪潮电子信息产业股份有限公司 一种突破内核模块版本控制解决方法
CN104239112A (zh) * 2014-09-30 2014-12-24 贝壳网际(北京)安全技术有限公司 一种设备驱动程序安装方法及装置
CN105159732A (zh) * 2015-10-13 2015-12-16 北京奇虎科技有限公司 在移动终端安装或更新应用程序的方法和移动终端
CN105549965A (zh) * 2015-12-09 2016-05-04 浪潮电子信息产业股份有限公司 一种将驱动集成到不同Linux内核版本的方法
CN110389786A (zh) * 2018-04-20 2019-10-29 伊姆西Ip控股有限责任公司 内核管理方法、设备和计算机程序产品

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20240095002A1 (en) * 2022-09-21 2024-03-21 Ncr Corporation Updated driver installation
CN117112144A (zh) * 2023-09-22 2023-11-24 上海卓悠网络科技有限公司 一种在android系统上部署k3s的方法及系统、存储介质
CN117112144B (zh) * 2023-09-22 2024-03-12 上海卓悠网络科技有限公司 一种在android系统上部署k3s的方法及系统、存储介质

Also Published As

Publication number Publication date
CN113031958B (zh) 2022-06-24
CN113031958A (zh) 2021-06-25

Similar Documents

Publication Publication Date Title
WO2022183573A1 (zh) 支持多内核版本的驱动安装包生成方法、安装方法及装置
US10019256B2 (en) Systems and methods for incremental software development
EP3488337B1 (en) Shared software libraries for computing devices
US7814476B2 (en) Systems and methods for updating software
US10114637B1 (en) Automatically updating a shared project build platform
KR100952251B1 (ko) 서비스 패키지에 의해 소프트웨어 제품을 업데이트하는 방법, 컴퓨터로 구현되는 방법, 컴퓨터 판독가능 저장 매체, 및 서비스 패키지
JP4828271B2 (ja) 複数osバージョン用ソフトウェア生成装置及び複数osバージョン用ソフトウェア生成支援プログラム
US8261247B2 (en) Method of modifying code of a running computer program based on symbol values discovered from comparison of running code to corresponding object code
CN105446712B (zh) 一种应用程序缺陷修补方法及装置
JP2021002317A (ja) アプリケーションをアップグレードするための方法、装置、デバイスならびに記憶媒体
CN111930448A (zh) 用于服务发布的方法、电子设备和存储介质
US10802803B2 (en) Intelligent software compiler dependency fulfillment
CN110704113B (zh) 一种基于fpga平台的启动方法、系统及开发板装置
CN109857444B (zh) 应用程序的更新方法、装置、电子设备和可读存储介质
JP2006520973A (ja) Ejbコンパイラをいつ実行する必要があるかを決定するためのシステム及び方法
US20110289491A1 (en) Method and Device for Program Installation
US11573782B2 (en) Self updating agent
WO2011157105A2 (zh) 组件扩展方法和装置
CN116301908B (zh) 基于申威架构的Buildroot本地编译方法及系统
CN115562719B (zh) 一种接口感知的编译配置项补全方法、系统和介质
JP7081805B2 (ja) 情報処理装置、ロードモジュール生成方法及びプログラム、並びに、動的プログラム更新システム及び方法
EP3842932B1 (en) Firmware update method and firmware update system thereof
TW202340937A (zh) 具有自動升級功能的開發系統以及開發系統的自動升級方法
CN117149151A (zh) 基于容器技术的web开发方法及装置
Team Openembedded user manual

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21928654

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 12.02.2024)