CN113485712B - Kernel clipping method and computing device - Google Patents

Kernel clipping method and computing device Download PDF

Info

Publication number
CN113485712B
CN113485712B CN202110761785.4A CN202110761785A CN113485712B CN 113485712 B CN113485712 B CN 113485712B CN 202110761785 A CN202110761785 A CN 202110761785A CN 113485712 B CN113485712 B CN 113485712B
Authority
CN
China
Prior art keywords
kernel
modules
target
module
operating system
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202110761785.4A
Other languages
Chinese (zh)
Other versions
CN113485712A (en
Inventor
张磊
张海东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Deepin Technology Co ltd
Original Assignee
Wuhan Deepin Technology Co ltd
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 Wuhan Deepin Technology Co ltd filed Critical Wuhan Deepin Technology Co ltd
Priority to CN202110761785.4A priority Critical patent/CN113485712B/en
Publication of CN113485712A publication Critical patent/CN113485712A/en
Application granted granted Critical
Publication of CN113485712B publication Critical patent/CN113485712B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/75Structural analysis for program understanding

Landscapes

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

Abstract

The invention discloses a kernel clipping method, which is executed in an operating system and comprises the following steps: generating a first kernel comprising a plurality of first kernel modules; testing kernel functions corresponding to the first kernel modules, determining whether each kernel function is called, and determining one or more target kernel modules used by a current operating system according to the called one or more kernel functions; and compiling and generating a target kernel based on the one or more target kernel modules. The invention also discloses corresponding computing equipment. According to the kernel clipping method, the number of kernel modules of the operating system can be reduced more effectively in a shorter time.

Description

Kernel clipping method and computing device
The application is a divisional application of patent application 2021104404381 filed on 4/23 of 2021.
Technical Field
The invention relates to the technical field of virtual machine customization, in particular to a kernel tailoring method and computing equipment.
Background
Currently, home-made platform virtualization has been fully developed in various industries and is being widely used. Customization of virtualized node systems has become an essential technical step due to industry differences and different respective application scenarios. Because of the tens of thousands of kernel software under the domestic platform, how to quickly and accurately select modules required by industries becomes an important task for the release of domestic platform versions.
In the prior art, a common method for customizing and cutting a kernel is to firstly run a configuration command under a kernel code to generate a configuration file, and then construct the kernel. The specific method comprises the following steps: firstly, obtaining kernel source codes, for example, downloading vanilla kernel source codes from a kernel. Org or a giloub. Com through a Git command, or downloading corresponding kernel source codes by using software package management commands of each release; secondly, running make menuconfig (or similar make nconfig, make xconfig and the like) commands under the kernel source code directory, setting kernel compiling configuration parameters through a text interface, and generating a configuration file required by integral kernel compiling; and finally, running a make command, namely recursively entering each directory to execute a construction command in the Makefile, and constructing the kernel.
On the one hand, the above-mentioned cutting scheme of kernel generally needs to be completed through manual selection, can not combine the existing system environment and the commonly used system module to realize, and the requirement on the personnel of tailoring the kernel is too high, needs frequent test during manual selection, generally needs to pass through many rounds of manual examination and repeated test to determine the manuscript, and the efficiency of kernel cutting is very low and is difficult to reach the optimal result. On the other hand, since in the original system, a part of kernel modules are statically compiled into the kernel in the y mode, as the kernel is loaded and operated together, the part of kernel modules cannot be listed through Lsmod, even though the module listed in Lsmod is not necessarily the module being used, but may be forcedly loaded during the system start-up process along with the default configuration of the system. Therefore, the kernel obtained by the cutting scheme has the advantages that a plurality of modules are not needed to be used, but the cut kernel is added, so that the cutting is not thorough, and still has a cutting room.
Therefore, a kernel clipping method is needed to solve the problems in the above technical solutions.
Disclosure of Invention
To this end, the present invention provides a kernel clipping method in an effort to solve or at least alleviate the above-presented problems.
According to one aspect of the present invention, there is provided a kernel clipping method, which is executed in an operating system, including the steps of: generating a first kernel comprising a plurality of first kernel modules; testing kernel functions corresponding to the first kernel modules, determining whether each kernel function is called, and determining one or more target kernel modules used by a current operating system according to the called one or more kernel functions; and compiling and generating a target kernel based on the one or more target kernel modules.
Optionally, in the kernel clipping method according to the present invention, the step of testing kernel functions corresponding to the plurality of first kernel modules includes: and starting a tracker of the kernel, and tracking the kernel functions based on the tracker so as to determine whether each kernel function is called.
Optionally, in the kernel clipping method according to the present invention, the step of determining one or more target kernel modules used by the current operating system includes: obtaining a mapping table of a kernel module and a kernel function; and determining a first kernel module corresponding to each called kernel function according to the mapping table, and determining the first kernel module as a target kernel module.
Optionally, in the kernel clipping method according to the present invention, the step of generating the first kernel including the plurality of first kernel modules includes: acquiring a plurality of kernel modules used by a current operating system, and determining each used kernel module as a first kernel module; generating a first kernel configuration file based on kernel configuration items respectively corresponding to the plurality of first kernel modules; and performing kernel compiling based on the first kernel configuration file to generate a first kernel comprising a plurality of first kernel modules.
Optionally, in the kernel clipping method according to the present invention, before generating the first kernel configuration file based on the kernel configuration items respectively corresponding to the plurality of first kernel modules, the method includes the steps of: with the make localmodconfig method, a kernel configuration item corresponding to each first kernel module is automatically selected based on the plurality of first kernel modules.
Optionally, in the kernel clipping method according to the present invention, compiling the generating target kernel includes: generating a target kernel configuration file based on kernel configuration items respectively corresponding to the target kernel modules; and performing kernel compiling based on the target kernel configuration file to generate a target kernel comprising one or more target kernel modules.
Optionally, in the kernel clipping method according to the present invention, the method further includes the steps of: acquiring a kernel module list; respectively acquiring paths corresponding to each kernel module in the kernel module list, and acquiring corresponding kernel module files according to the paths; obtaining a kernel function corresponding to each kernel module according to the kernel module file; and creating a mapping table of the kernel module and the kernel function according to each kernel module and the corresponding kernel function.
Optionally, in the kernel clipping method according to the present invention, after compiling the target kernel, the method further includes the steps of: and loading the target kernel into the virtual machine so as to detect whether the target kernel can stably run in the virtual machine.
According to one aspect of the present invention, there is provided a computing device comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be adapted to be executed by the at least one processor, the program instructions comprising instructions for performing the kernel clipping method as described above.
According to one aspect of the present invention, there is provided a readable storage medium storing program instructions which, when read and executed by a computing device, cause the computing device to perform a method as described above.
According to the technical scheme of the invention, a kernel cutting method is provided, and a first kernel is compiled and generated based on a kernel module used by a current operating system, so that preliminary cutting of the kernel is realized. Furthermore, on the basis of the first kernel after preliminary cutting, the target kernel module really required by the current operating system is further screened and determined through automatic testing, and a final target kernel is generated based on compiling of the further determined target kernel module, so that cutting of the kernel is completed. Therefore, the method comprehensively performs two-step cutting on the kernel, and can more effectively reduce the number of kernel modules of the operating system in a shorter time, thereby reducing the starting time of the system as much as possible.
Furthermore, the method adopts make localmodconfig to compile the kernel, so that the kernel configuration item can be automatically selected, the tedious process of manual selection is avoided, and the efficiency of kernel cutting is improved.
Drawings
To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which set forth the various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to fall within the scope of the claimed subject matter. The above, as well as additional objects, features, and advantages of the present disclosure will become more apparent from the following detailed description when read in conjunction with the accompanying drawings. Like reference numerals generally refer to like parts or elements throughout the present disclosure.
FIG. 1 shows a schematic diagram of a computing device 100 according to one embodiment of the invention; and
FIG. 2 illustrates a flow diagram of a kernel clipping method 200 according to one embodiment of the invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Fig. 1 is a schematic block diagram of an example computing device 100.
As shown in FIG. 1, in a basic configuration 102, a computing device 100 typically includes a system memory 106 and one or more processors 104. The memory bus 108 may be used for communication between the processor 104 and the system memory 106.
Depending on the desired configuration, the processor 104 may be any type of processing including, but not limited to: a microprocessor (UP), a microcontroller (UC), a digital information processor (DSP), or any combination thereof. The processor 104 may include one or more levels of caches, such as a first level cache 110 and a second level cache 112, a processor core 114, and registers 116. The example processor core 114 may include an Arithmetic Logic Unit (ALU), a Floating Point Unit (FPU), a digital signal processing core (DSP core), or any combination thereof. The example memory controller 118 may be used with the processor 104, or in some implementations, the memory controller 118 may be an internal part of the processor 104.
Depending on the desired configuration, system memory 106 may be any type of memory including, but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. The system memory 106 may include an operating system 120, one or more applications 122, and program data 124. In some implementations, the application 122 may be arranged to execute instructions on an operating system by the one or more processors 104 using the program data 124.
Computing device 100 may also include a storage interface bus 134. Storage interface bus 134 enables communication from storage devices 132 (e.g., removable storage 136 and non-removable storage 138) to base configuration 102 via bus/interface controller 130. At least a portion of the operating system 120, applications 122, and data 124 may be stored on removable storage 136 and/or non-removable storage 138, and loaded into the system memory 106 via the storage interface bus 134 and executed by the one or more processors 104 when the computing device 100 is powered up or the application 122 is to be executed.
Computing device 100 may also include an interface bus 140 that facilitates communication from various interface devices (e.g., output devices 142, peripheral interfaces 144, and communication devices 146) to basic configuration 102 via bus/interface controller 130. The example output device 142 includes a graphics processing unit 148 and an audio processing unit 150. They may be configured to facilitate communication with various external devices such as a display or speakers via one or more a/V ports 152. Example peripheral interfaces 144 may include a serial interface controller 154 and a parallel interface controller 156, which may be configured to facilitate communication with external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.) via one or more I/O ports 158. An example communication device 146 may include a network controller 160, which may be arranged to facilitate communication with one or more other computing devices 162 via one or more communication ports 164 over a network communication link.
The network communication link may be one example of a communication medium. Communication media may typically be embodied by computer readable instructions, data structures, program modules, and may include any information delivery media in a modulated data signal, such as a carrier wave or other transport mechanism. A "modulated data signal" may be a signal that has one or more of its data set or changed in such a manner as to encode information in the signal. By way of non-limiting example, communication media may include wired media such as a wired network or special purpose network, and wireless media such as acoustic, radio Frequency (RF), microwave, infrared (IR) or other wireless media. The term computer readable media as used herein may include both storage media and communication media.
Computing device 100 may be implemented as a personal computer including desktop and notebook computer configurations. Of course, computing device 100 may also be implemented as part of a small-sized portable (or mobile) electronic device such as a cellular telephone, a digital camera, a Personal Digital Assistant (PDA), a personal media player device, a wireless web-watch device, a personal headset device, an application-specific device, or a hybrid device that may include any of the above functions. And may even be implemented as servers, such as file servers, database servers, application servers, WEB servers, and the like. The embodiments of the present invention are not limited in this regard.
In an embodiment according to the invention, the computing device 100 is configured to perform the kernel clipping method 200 according to the invention. Wherein the operating system of the computing device 100 contains a plurality of program instructions for executing the kernel clipping method 200 according to the present invention, so that the kernel clipping method 200 of the present invention can be executed in the operating system of the computing device.
FIG. 2 illustrates a flow diagram of a kernel clipping method 200 according to one embodiment of the invention. The method 200 is suitable for execution in an operating system of a computing device, such as the computing device 100 described previously. It should be noted that, in the specific embodiment of the present invention, only the Linux operating system is taken as an example to describe the kernel clipping method of the present invention in detail, but the kernel clipping scheme of the present invention is not limited to the Linux operating system.
As shown in fig. 2, the method 200 begins at step S210.
In step S210, a first kernel including a plurality of first kernel modules is generated by compiling.
It should be noted that compiling the first kernel enables a preliminary clipping of the original kernel. The first kernel modules are kernel requirement modules determined in the preliminary clipping process of the original kernel, that is, the kernel modules which are preliminarily determined and used by the kernel of the current operating system. By clipping the original kernel, the generated first kernel is reconstructed, and the number of unnecessary kernel modules in the original kernel is greatly reduced on the basis of ensuring the normal operation of the target system platform.
According to the kernel cropping method 200 of the present invention, after the original kernel is primarily cropped by executing step S210, the following steps S220 to S230 are further executed to further crop the primarily cropped first kernel.
In step S220, kernel functions corresponding to the plurality of first kernel modules are tested, whether each kernel function is called by the current operating system is determined, and one or more target kernel modules used by the current operating system are determined according to the one or more kernel functions that are called. Here, the one or more target kernel modules are kernel modules that are further screened out that the operating system does need.
According to one embodiment, by performing an automated test on kernel functions corresponding to the plurality of first kernel modules, it can be determined whether each kernel function is called by a current operating system, and one or more kernel functions that are called can be obtained. In one embodiment, when the kernel functions corresponding to the plurality of first kernel modules are automatically tested, the tracker ftrace of the kernel is started, the kernel functions are tracked based on an automatic tracking method of the tracker ftrace, the calling condition of the kernel functions is detected, and whether each kernel function is called or not is determined, so that the automatic test of the kernel functions corresponding to the plurality of first kernel modules is realized, and a test result of whether each kernel function is called or not is obtained. One or more kernel functions that are invoked can be determined and obtained based on the test results.
After determining the one or more kernel functions that are invoked, one or more target kernel modules corresponding to the one or more kernel functions that are invoked may be determined and obtained. Here, by acquiring the mapping table of the kernel module and the kernel function, the corresponding first kernel module used, that is, the target kernel module, can be located in the mapping table based on the name of the kernel function being called. In other words, the kernel modules (first kernel modules) corresponding to each of the called kernel functions, respectively, which are to be determined as target kernel modules, may be determined according to the mapping table.
Finally, in step S230, the target kernel is generated based on one or more target kernel modules compilation. In this way, a further clipping of the first kernel is achieved.
It should be understood that the kernel module in the target kernel generated by final compiling is the kernel module which is further screened and determined by the automatic test based on the first kernel after preliminary clipping and really needs the current system. Therefore, the method comprehensively performs two-step cutting on the kernel, and can more effectively reduce the number of kernel modules of the Linux operating system in a shorter time, thereby reducing the starting time of the system as much as possible.
According to one embodiment, the original kernel file is obtained in advance before step S210 is performed. In step S210, the first kernel may be compiled and generated based on the make localmodconfig method to implement the preliminary clipping of the original kernel, where the specific method may be implemented as follows:
firstly, acquiring a kernel module list used by a kernel of a current operating system through Lsmod commands, wherein the kernel module list comprises a plurality of used kernel modules so as to acquire the plurality of used kernel modules, namely the preliminarily determined kernel requirement modules, from the kernel module list. Each of these used kernel modules is determined as a first kernel module. Here, the first kernel modules determined by the preliminary screening may include kernel modules that are forcibly loaded during the system start-up process.
Further, with the make localmodconfig method, a kernel configuration item corresponding to each first kernel module may be automatically selected based on the plurality of first kernel modules. Subsequently, a first kernel configuration file is generated based on the automatically selected kernel configuration items (kernel parameter compiling options) corresponding to the plurality of first kernel modules, respectively. The kernel configuration file is a configuration file required by kernel compilation, and includes configuration parameters required by kernel compilation. The first kernel configuration file herein is a configuration file required for compiling and generating the first kernel, and includes configuration parameters of a plurality of first kernel modules required for compiling and generating the first kernel.
Finally, a kernel compilation is performed based on the first kernel configuration file to generate a first kernel comprising a plurality of first kernel modules. In this way, a preliminary clipping of the original kernel is completed.
According to one embodiment, the generation target kernel may also be compiled based on the make localmodconfig method in step S230 to implement further clipping of the first kernel, where a specific method may be implemented as:
After determining one or more target kernel modules through the automated test, first, using the make localmodconfig method, a kernel configuration item corresponding to each target kernel module may be automatically selected based on the determined one or more target kernel modules, and then, a target kernel configuration file may be generated based on the automatically selected kernel configuration item (kernel parameter compilation option) corresponding to each of the plurality of target kernel modules. The target kernel configuration file is a configuration file required by compiling and generating the target kernel, and includes configuration parameters of one or more target kernel modules required by compiling and generating the target kernel.
Then, a kernel compilation is performed based on the target kernel configuration file to generate a target kernel comprising one or more target kernel modules.
The method adopts make localmodconfig method to compile the kernel, can automatically select the kernel configuration item, avoids the complicated process of manual selection, and is beneficial to improving the efficiency of kernel cutting.
In addition, according to one embodiment of the present invention, after the target kernel is compiled, the target kernel may be loaded into the virtual machine to detect whether the target kernel can stably run within the virtual machine.
According to one embodiment, after the original kernel file is obtained, a mapping table of kernel modules and kernel functions is also created before step S210 is performed. Thus, in step S220, one or more target kernel modules may be determined by acquiring a mapping table of kernel modules and kernel functions, and determining a first kernel module corresponding to each used kernel function according to the mapping table.
Specifically, when a mapping table of kernel modules and kernel functions is created, a kernel module list used by a current kernel is obtained through Lsmod commands, wherein the kernel module list comprises a plurality of used kernel modules, namely a first kernel module.
And then, respectively acquiring paths corresponding to each kernel module (first kernel module) in the kernel module list, and acquiring corresponding kernel module files according to the paths. According to each kernel module file, acquiring a kernel function corresponding to each kernel module (first kernel module) by executing a nm command, and writing each acquired kernel function into a/sys/kernel/debug/trace directory file.
Furthermore, according to each kernel module and the corresponding kernel function, a mapping table of the kernel module and the kernel function is created, and in fact, the mapping table of the first kernel module and the kernel function is also created. Subsequently, the mapping table is written to the kernel-func.
According to one embodiment, the program for performing the automated test on the plurality of first kernel modules in step S220 may be implemented as the following pseudo code:
Here, P is an embodiment program, and after one automation test, a hitmodule.
Further, after the command P-trace/tmp/module-func.map-/hitmodule, kernel function data (including data about whether the kernel function is called) is obtained from the/sys/kernel/debug/trace directory file, a mapping table of the kernel module and the kernel function is obtained from the kernel-func.map file, based on the obtained called kernel function data, the kernel module corresponding to each called kernel function name is respectively queried in the mapping table, and the queried first kernel module is the first kernel module used by the current operating system, and each queried first kernel module is determined as the target kernel module and stored in the hitmodule file.
In addition, when each target kernel module is determined, the hit times of each target kernel module are also determined, and the target kernel module and the corresponding hit times are stored in a hit module. For example, for a kernel module with a default value of y, the kernel module is precisely located to be used as an important basis for clipping the kernel.
To sum up, according to the kernel clipping method 200 of the present invention, a first kernel is compiled and generated based on a kernel module used by a current system, so as to implement preliminary clipping of the kernel. Furthermore, on the basis of the first kernel after preliminary cutting, the target kernel module really required by the current operating system is further screened and determined through automatic testing, and a final target kernel is generated based on compiling of the further determined target kernel module, so that cutting of the kernel is completed. Therefore, the method comprehensively performs two-step cutting on the kernel, and can more effectively reduce the number of kernel modules in the operating system in a shorter time, thereby reducing the starting time of the system as much as possible. The kernel modules of the Linux system can be reduced to less than 100 in a period of one week to two weeks, and the starting time of the system can be reduced to about 1/3 of the original starting time.
Furthermore, the method adopts make localmodconfig to compile the kernel, so that the kernel configuration item can be automatically selected, the tedious process of manual selection is avoided, and the efficiency of kernel cutting is improved.
The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions of the methods and apparatus of the present invention, may take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard drives, U-drives, floppy diskettes, CD-ROMs, or any other machine-readable storage medium, wherein, when the program is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention.
In the case of program code execution on programmable computers, the computing device will generally include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Wherein the memory is configured to store program code; the processor is configured to execute the multi-lingual spam text recognition method of the present invention in accordance with instructions in said program code stored in the memory.
By way of example, and not limitation, readable media comprise readable storage media and communication media. The readable storage medium stores information such as computer readable instructions, data structures, program modules, or other data. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. Combinations of any of the above are also included within the scope of readable media.
In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used with examples of the invention. The required structure for a construction of such a system is apparent from the description above. In addition, the present invention is not directed to any particular programming language. It will be appreciated that the teachings of the present invention described herein may be implemented in a variety of programming languages, and the above description of specific languages is provided for disclosure of enablement and best mode of the present invention.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed as reflecting the intention that: i.e., the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment, or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into a plurality of sub-modules.
Those skilled in the art will appreciate that the modules in the apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. The modules or units or components of the embodiments may be combined into one module or unit or component and, furthermore, they may be divided into a plurality of sub-modules or sub-units or sub-components. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings), may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features but not others included in other embodiments, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.
Furthermore, some of the embodiments are described herein as methods or combinations of method elements that may be implemented by a processor of a computer system or by other means of performing the functions. Thus, a processor with the necessary instructions for implementing the described method or method element forms a means for implementing the method or method element. Furthermore, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is for carrying out the functions performed by the elements for carrying out the objects of the invention.
As used herein, unless otherwise specified the use of the ordinal terms "first," "second," "third," etc., to describe a general object merely denote different instances of like objects, and are not intended to imply that the objects so described must have a given order, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of the above description, will appreciate that other embodiments are contemplated within the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. The disclosure of the present invention is intended to be illustrative, but not limiting, of the scope of the invention, which is defined by the appended claims.

Claims (9)

1. A kernel clipping method, executed in an operating system, comprising the steps of:
creating a mapping table of a kernel module and kernel functions, wherein the mapping table comprises a plurality of first kernel modules and corresponding kernel functions;
Generating a first kernel comprising a plurality of first kernel modules;
starting a kernel tracker, tracking kernel functions based on the tracker to test the kernel functions corresponding to the first kernel modules, determining whether each kernel function is called, and determining one or more target kernel modules used by a current operating system according to the called one or more kernel functions; and
And compiling and generating a target kernel based on the one or more target kernel modules.
2. The method of claim 1, wherein determining one or more target kernel modules to be used by the current operating system comprises:
Obtaining a mapping table of a kernel module and a kernel function;
And determining a first kernel module corresponding to each called kernel function according to the mapping table, and determining the first kernel module as a target kernel module.
3. The method of claim 1 or 2, wherein generating a first kernel comprising a plurality of first kernel modules comprises:
acquiring a plurality of kernel modules used by a current operating system, and determining each used kernel module as a first kernel module;
generating a first kernel configuration file based on kernel configuration items respectively corresponding to the plurality of first kernel modules;
And performing kernel compiling based on the first kernel configuration file to generate a first kernel comprising a plurality of first kernel modules.
4. A method as claimed in claim 3, wherein, before generating the first kernel configuration file based on the kernel configuration items respectively corresponding to the plurality of first kernel modules, comprising the steps of:
With the make localmodconfig method, a kernel configuration item corresponding to each first kernel module is automatically selected based on the plurality of first kernel modules.
5. The method of claim 1 or 2, wherein compiling the generation target kernel comprises:
generating a target kernel configuration file based on kernel configuration items respectively corresponding to the target kernel modules;
and performing kernel compiling based on the target kernel configuration file to generate a target kernel comprising one or more target kernel modules.
6. The method of claim 1 or 2, wherein the step of creating a mapping table of kernel modules and kernel functions comprises:
acquiring a kernel module list;
Respectively acquiring paths corresponding to each kernel module in the kernel module list, and acquiring corresponding kernel module files according to the paths;
Obtaining a kernel function corresponding to each kernel module according to the kernel module file;
And creating a mapping table of the kernel module and the kernel function according to each kernel module and the corresponding kernel function.
7. The method of claim 1 or 2, wherein after compiling the target kernel, further comprising the step of:
and loading the target kernel into the virtual machine so as to detect whether the target kernel can stably run in the virtual machine.
8. A computing device, comprising:
at least one processor; and
A memory storing program instructions, wherein the program instructions are configured to be adapted to be executed by the at least one processor, the program instructions comprising instructions for performing the method of any of claims 1-7.
9. A readable storage medium storing program instructions which, when read and executed by a computing device, cause the computing device to perform the method of any of claims 1-7.
CN202110761785.4A 2021-04-23 2021-04-23 Kernel clipping method and computing device Active CN113485712B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110761785.4A CN113485712B (en) 2021-04-23 2021-04-23 Kernel clipping method and computing device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110761785.4A CN113485712B (en) 2021-04-23 2021-04-23 Kernel clipping method and computing device
CN202110440438.1A CN112860267B (en) 2021-04-23 2021-04-23 Kernel cutting method and computing device

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN202110440438.1A Division CN112860267B (en) 2021-04-23 2021-04-23 Kernel cutting method and computing device

Publications (2)

Publication Number Publication Date
CN113485712A CN113485712A (en) 2021-10-08
CN113485712B true CN113485712B (en) 2024-05-07

Family

ID=75992826

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202110761785.4A Active CN113485712B (en) 2021-04-23 2021-04-23 Kernel clipping method and computing device
CN202110440438.1A Active CN112860267B (en) 2021-04-23 2021-04-23 Kernel cutting method and computing device

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN202110440438.1A Active CN112860267B (en) 2021-04-23 2021-04-23 Kernel cutting method and computing device

Country Status (2)

Country Link
CN (2) CN113485712B (en)
WO (1) WO2022222378A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113485712B (en) * 2021-04-23 2024-05-07 武汉深之度科技有限公司 Kernel clipping method and computing device

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102360305B (en) * 2011-10-09 2013-09-04 中国航天科技集团公司第五研究院第五一三研究所 VxWorks operating system scaling and customizing method for aerospace computer
CN104090783A (en) * 2014-05-22 2014-10-08 西安电子科技大学 Method for increasing starting speed of Linux server through start accelerator
CN104503735A (en) * 2014-11-04 2015-04-08 国网山东省电力公司青岛供电公司 Consistency verification method for standard data exchange interface of power grid system
WO2016207533A1 (en) * 2015-06-25 2016-12-29 Orange Method for assisting with the analysis of the execution of a virtual machine
CN106796531A (en) * 2016-12-27 2017-05-31 深圳前海达闼云端智能科技有限公司 The management method of kernel setup information, device and electronic equipment
CN107102944A (en) * 2017-04-07 2017-08-29 北京深思数盾科技股份有限公司 The analysis method and device of a kind of call function
WO2019245571A1 (en) * 2018-06-21 2019-12-26 Google Llc Automated computer operating system optimization

Family Cites Families (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103207787B (en) * 2012-01-12 2017-03-01 阿里巴巴集团控股有限公司 The loading method of packet and system in a kind of project development
CN104035766A (en) * 2014-05-23 2014-09-10 四川长虹电器股份有限公司 Android system trimming method based on coverage rate test
US9785423B2 (en) * 2015-04-23 2017-10-10 Google Inc. Compiler for translating between a virtual image processor instruction set architecture (ISA) and target hardware having a two-dimensional shift array structure
US10387988B2 (en) * 2016-02-26 2019-08-20 Google Llc Compiler techniques for mapping program code to a high performance, power efficient, programmable image processing hardware platform
CN105893085A (en) * 2016-03-30 2016-08-24 百度在线网络技术(北京)有限公司 Method and device for loading kernel module
CN108614681A (en) * 2016-12-20 2018-10-02 黑龙江傲立辅龙科技开发有限公司 A kind of construction method of embedded computer system software platform
CN108228314B (en) * 2017-12-05 2021-08-20 华东师范大学 Virtual prototype error detection method based on equipment protocol
CN108182066B (en) * 2017-12-22 2020-12-04 天津七一二通信广播股份有限公司 Embedded system-based locomotive platform kernel implementation method
CN108714028B (en) * 2018-04-11 2022-02-25 上海联影医疗科技股份有限公司 Magnetic resonance imaging method and device and medical imaging system
CN110389786B (en) * 2018-04-20 2022-10-14 伊姆西Ip控股有限责任公司 Kernel management method, electronic device and computer-readable storage medium
CN111428241B (en) * 2019-10-31 2023-12-29 北京统信软件技术有限公司 Multi-security access policy control method and computing device
CN110825392B (en) * 2019-10-31 2023-07-04 中国人民解放军战略支援部队第五十六研究所 Customization method, batch deployment method and batch deployment system of operating system
CN111008152B (en) * 2019-12-26 2022-10-11 中国人民解放军国防科技大学 Kernel module compatibility influence domain analysis method, system and medium based on function dependency graph
CN111240684B (en) * 2020-01-03 2023-04-11 北京字节跳动网络技术有限公司 Cutting method and device of JS codes, medium and electronic equipment
CN111966383B (en) * 2020-09-03 2023-08-15 中国人民解放军国防科技大学 Method, system and medium for quantitatively analyzing kernel compatibility of operating system
CN113485712B (en) * 2021-04-23 2024-05-07 武汉深之度科技有限公司 Kernel clipping method and computing device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102360305B (en) * 2011-10-09 2013-09-04 中国航天科技集团公司第五研究院第五一三研究所 VxWorks operating system scaling and customizing method for aerospace computer
CN104090783A (en) * 2014-05-22 2014-10-08 西安电子科技大学 Method for increasing starting speed of Linux server through start accelerator
CN104503735A (en) * 2014-11-04 2015-04-08 国网山东省电力公司青岛供电公司 Consistency verification method for standard data exchange interface of power grid system
WO2016207533A1 (en) * 2015-06-25 2016-12-29 Orange Method for assisting with the analysis of the execution of a virtual machine
CN106796531A (en) * 2016-12-27 2017-05-31 深圳前海达闼云端智能科技有限公司 The management method of kernel setup information, device and electronic equipment
CN107102944A (en) * 2017-04-07 2017-08-29 北京深思数盾科技股份有限公司 The analysis method and device of a kind of call function
WO2019245571A1 (en) * 2018-06-21 2019-12-26 Google Llc Automated computer operating system optimization

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Multiple Kernel Multivariate Performance Learning Using Cutting Plane Algorithm;WangJingbin 等;《2015 IEEE International Conference on Systems, Man, and Cybernetics》;20160114;1870-1875 *
基于视频采集系统的嵌入式Linux操作系统裁剪方法探讨;丁小东;《中国优秀硕士学位论文全文数据库 信息科技辑》;20120715;I138-1332 *

Also Published As

Publication number Publication date
CN113485712A (en) 2021-10-08
CN112860267A (en) 2021-05-28
CN112860267B (en) 2021-07-30
WO2022222378A1 (en) 2022-10-27

Similar Documents

Publication Publication Date Title
CN109710428B (en) Dynamic calling method and device for implementation class
US7971189B2 (en) Automated interaction diagram generation using source code breakpoints
CN113434205B (en) Operating system starting method and computing device
WO2018040270A1 (en) Method and device for loading linux-system elf file in windows system
CN111049889B (en) Static resource uploading method and device, integrated server and system
CN114924810B (en) Heterogeneous program execution method, heterogeneous program execution device, computing equipment and readable storage medium
CN112445708A (en) Pressure testing method and device and computing equipment
CN113485712B (en) Kernel clipping method and computing device
CN111126010A (en) Freemarker template file repairing method and device, computer equipment and storage medium
CN113254347A (en) Log function adding method, computing device and storage medium
CN114780173A (en) Method for loading plug-in application, computing equipment and storage medium
JP2007080049A (en) Built-in program generation method, built-in program development system and information table section
CN114328273B (en) Debugging method and device for application program control and computing equipment
CN113778892B (en) Method for locating performance bottleneck of operating system, computing device and storage medium
CN113535650B (en) File naming method and computing device
CN113190455B (en) Element positioning method and computing equipment
CN113138806B (en) Processing method and device for mobile application running environment
CN112947976B (en) Operating system upgrading method, computing device and storage medium
CN113722715B (en) Imported file checking method, checking system and computing equipment
CN110427211B (en) Demonstration data calling method and device
CN114741116A (en) Program transplanting method and device
CN114510456A (en) File searching method, downloading device and computing equipment
CN117891723A (en) Code checking method, computing device and storage medium
CN114840744A (en) Software recommendation method and device, computing equipment and readable storage medium
CN114490365A (en) Regression testing method, device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant