CN113485712A - Kernel cutting method and computing device - Google Patents

Kernel cutting method and computing device Download PDF

Info

Publication number
CN113485712A
CN113485712A CN202110761785.4A CN202110761785A CN113485712A CN 113485712 A CN113485712 A CN 113485712A CN 202110761785 A CN202110761785 A CN 202110761785A CN 113485712 A CN113485712 A CN 113485712A
Authority
CN
China
Prior art keywords
kernel
modules
target
module
functions
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.)
Pending
Application number
CN202110761785.4A
Other languages
Chinese (zh)
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/CN113485712A/en
Publication of CN113485712A publication Critical patent/CN113485712A/en
Pending legal-status Critical Current

Links

Images

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

Abstract

The invention discloses a kernel cutting method, which is executed in an operating system and comprises the following steps: generating a first core comprising a plurality of first core modules; testing 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 the current operating system according to the called one or more kernel functions; and generating a target kernel based on the one or more target kernel module compilations. The invention also discloses corresponding computing equipment. According to the kernel cutting method, the number of kernel modules of the operating system can be reduced more effectively in a shorter time.

Description

Kernel cutting method and computing device
This application is a divisional application of the invention patent application 2021104404381 filed on 23/4/2021.
Technical Field
The invention relates to the technical field of virtual machine customization, in particular to a kernel cutting method and computing equipment.
Background
At present, the virtualization of a domestic platform has been fully developed in various industries and is being widely used. Due to the difference of industries and different application scenes, the customization of the virtualized node system has become an indispensable technical step. Because the kernel software under the domestic platform is tens of thousands, how to quickly and accurately select the modules required by the industry becomes an important work for releasing the domestic platform version.
In the prior art, a common method for custom tailoring of an inner core is to run a configuration command under an inner core code first, generate a configuration file, and then construct the inner core. The specific method comprises the following steps: firstly, acquiring kernel source codes, for example, downloading vanilla kernel source codes from kernel.org or github.com through a Git command, or downloading corresponding kernel source codes by using software package management commands of various releases; secondly, running a make menuconfig (or similar make nconfig, make xconfig and the like) command under a kernel source code directory, setting kernel compiling configuration parameters through a text interface, and generating a configuration file required by the whole kernel compiling; and finally, running the make command, namely recursively entering each directory to execute the construction command in the Makefile, and constructing the kernel.
On one hand, the kernel cutting scheme is generally finished through manual selection, the core cutting scheme cannot be realized by combining the existing system environment and a common system module, the requirement on kernel customizing cutting personnel is too high, frequent tests are required during manual selection, the kernel cutting can be finalized only through multi-round manual examination and repeated tests, the kernel cutting efficiency is very low, and the optimal result is difficult to achieve. On the other hand, since a part of kernel modules are statically compiled into the kernel in the y mode in the original system, the part of kernel modules cannot be listed by the Lsmod as the kernel is loaded and run together, and even the modules listed by the Lsmod are not necessarily the modules which are being used, but may be forcibly loaded during the system starting process along with the default configuration of the system. Therefore, the kernel obtained by the cutting scheme has a plurality of modules which are not needed but added with the cut kernel, the cutting is not thorough, and the kernel still has a room for cutting.
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 that seeks to solve, or at least alleviate, the above-identified problems.
According to one aspect of the present invention, there is provided a kernel clipping method, executed in an operating system, comprising the steps of: generating a first core comprising a plurality of first core modules; testing 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 the current operating system according to the called one or more kernel functions; and generating a target kernel based on the one or more target kernel module compilations.
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: a tracker of the kernel is started, and kernel functions are tracked based on the tracker 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: acquiring 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 a first kernel including a 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 first kernel modules; performing kernel compilation based on the first kernel configuration file to generate a first kernel comprising a plurality of the 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: and automatically selecting the kernel configuration items corresponding to the first kernel modules respectively based on the first kernel modules by using a make localmodconfig method.
Optionally, in the kernel clipping method according to the present invention, compiling to generate the target kernel includes: generating a target kernel configuration file based on kernel configuration items respectively corresponding to the target kernel modules; performing kernel compilation based on the target kernel configuration file to generate a target kernel including one or more of the target kernel modules.
Optionally, in the kernel clipping method according to the present invention, further comprising: acquiring a kernel module list; respectively acquiring a path corresponding to each kernel module in the kernel module list, and acquiring a corresponding kernel module file according to the path; acquiring a kernel function corresponding to each kernel module according to the kernel module file; and creating a mapping table of the kernel modules and the kernel functions according to each kernel module and the corresponding kernel function.
Optionally, in the kernel clipping method according to the present invention, after compiling and generating 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 an 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 executed by the at least one processor, the program instructions comprising instructions for performing the kernel clipping method as described above.
According to an 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 the method as described above.
According to the technical scheme of the invention, the kernel cutting method is provided, and the first kernel is compiled and generated based on the kernel module used by the current operating system, so that the preliminary cutting of the kernel is realized. And further, on the basis of the primarily cut first kernel, further screening and determining a target kernel module really required by the current operating system through an automatic test, and compiling and generating a final target kernel based on the further determined target kernel module, thereby finishing the cutting of the kernel. Therefore, the invention comprehensively carries out two-step clipping on the kernel, can more effectively reduce the number of kernel modules of the operating system in a shorter time, and further reduces the starting time of the system as much as possible.
Furthermore, the kernel compiling is carried out by adopting the make Localdemodconfig method, the kernel configuration items can be automatically selected, the complicated process of manual selection is avoided, and the kernel cutting efficiency is favorably 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 are indicative of various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to be within the scope of the claimed subject matter. The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description read in conjunction with the accompanying drawings. Throughout this disclosure, like reference numerals generally refer to like parts or elements.
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. A 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 cache, such as a level one cache 110 and a level two 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. System memory 106 may include an operating system 120, one or more applications 122, and program data 124. In some implementations, the application 122 can be arranged to execute instructions on an operating system with program data 124 by one or more processors 104.
Computing device 100 may also include a storage interface bus 134. The storage interface bus 134 enables communication from the storage devices 132 (e.g., removable storage 136 and non-removable storage 138) to the basic configuration 102 via the 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 system memory 106 via storage interface bus 134 and executed by the one or more processors 104 when the computing device 100 is powered on or the applications 122 are 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 the basic configuration 102 via the 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 communications with one or more other computing devices 162 over a network communication link via one or more communication ports 164.
A 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, such as carrier waves or other transport mechanisms, in a modulated data signal. A "modulated data signal" may be a signal that has one or more of its data set or its changes made in a manner that encodes information in the signal. By way of non-limiting example, communication media may include wired media such as a wired network or private-wired network, and various 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 both desktop and notebook computer configurations. Of course, computing device 100 may also be implemented as part of a small-form factor 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, an application specific device, or a hybrid device that include any of the above functions. And may even be implemented as a server, such as a file server, a database server, an application server, a WEB server, and so forth. The embodiments of the present invention are not limited thereto.
In an embodiment in accordance with the invention, computing device 100 is configured to perform kernel clipping method 200 in accordance with the invention. The operating system of the computing device 100 includes a plurality of program instructions for executing the kernel clipping method 200 according to the present invention, so that the kernel clipping method 200 according to 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 above. It should be noted that, in the embodiment of the present invention, the kernel clipping method according to the present invention is described in detail by taking the Linux operating system as an example, but the kernel clipping scheme according to 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, the compiling generates a first kernel including a plurality of first kernel modules.
It should be noted that compiling to generate the first kernel implements a preliminary clipping of the original kernel. The plurality of first kernel modules are kernel requirement modules determined in a preliminary clipping process of an original kernel, namely, preliminarily determined kernel modules used by a kernel of a current operating system. By cutting the original kernel and reconstructing the generated first kernel, the number of unnecessary kernel modules in the original kernel is greatly reduced on the basis of ensuring the normal operation of a target system platform.
According to the kernel clipping method 200 of the present invention, after the original kernel is primarily clipped by performing step S210, the following steps S220 to S230 are further performed to further clip the primarily clipped first kernel.
In step S220, kernel functions corresponding to the 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 called one or more kernel functions. Here, the one or more target kernel modules are kernel modules which are really required by the further screened-out operating system.
According to one embodiment, by automatically testing the kernel functions corresponding to the plurality of first kernel modules, whether each kernel function is called by the current operating system can be determined, and one or more called kernel functions can be obtained. In an embodiment, when the kernel functions corresponding to the first kernel modules are automatically tested, the kernel functions are tracked by starting the tracker trace of the kernel, the kernel functions are detected based on an automatic tracking method of the tracker trace, and whether each kernel function is called is determined, so that the automatic testing of the kernel functions corresponding to the first kernel modules is realized, and the test result of whether each kernel function is called is obtained. And determining and acquiring one or more called kernel functions according to the test result.
After determining the one or more called kernel functions, one or more target kernel modules corresponding to the one or more called kernel functions may be determined and obtained. Here, by obtaining the mapping table of the kernel module and the kernel function, the corresponding first kernel module to be used, that is, the target kernel module, can be located in the mapping table based on the name of the called kernel function. In other words, the kernel module (first kernel module) corresponding to each called kernel function can be determined according to the mapping table, and the first kernel modules can be determined as target kernel modules.
Finally, in step S230, a target kernel is generated based on the one or more target kernel module compilations. In this way, further clipping of the first kernel is also achieved.
It should be understood that the kernel module in the target kernel generated by final compilation is a kernel module which is actually required by the current system and is further screened and determined through an automated test on the basis of the first kernel after preliminary clipping. Therefore, the invention comprehensively carries out two-step cutting on the kernel, can more effectively reduce the number of kernel modules of the Linux operating system in a shorter time, and further reduces the starting time of the system as much as possible.
According to one embodiment, the original kernel file is obtained in advance before performing step S210. In step S210, a first kernel may be compiled and generated based on a make localmodconfig method to implement preliminary clipping on an original kernel, where the specific method may be implemented as:
firstly, a kernel module list used by a kernel of a current operating system is obtained through an Lsmod command, wherein the kernel module list comprises a plurality of kernel modules used, so that the plurality of kernel modules used, namely, the preliminarily determined kernel requirement module, are obtained from the kernel module list. Each of these used core modules is determined as the first core module. Here, the plurality of first core modules determined by the preliminary screening may include a core module that is forcibly loaded during the system boot process.
Furthermore, with the make localmodconfig method, the core configuration items respectively corresponding to each first core module can be automatically selected based on the plurality of first core modules. Subsequently, a first kernel configuration file is generated based on the automatically selected kernel configuration items (kernel parameter compilation options) corresponding to the plurality of first kernel modules, respectively. Here, 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 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, kernel compilation is performed based on the first kernel configuration file to generate a first kernel including a plurality of first kernel modules. In this way, the initial clipping of the original kernel is completed.
According to an embodiment, in step S230, the target kernel may also be compiled and generated based on a make localmodconfig method to implement further clipping of the first kernel, where the specific method may be implemented as:
after determining one or more target kernel modules through automated testing, first, using the make localmodconfig method, it is possible to automatically select, based on the determined one or more target kernel modules, kernel configuration items respectively corresponding to each of the target kernel modules, and then, generate a target kernel configuration file based on the automatically selected kernel configuration items (kernel parameter compilation options) respectively corresponding to the plurality of target kernel modules. Here, the target kernel configuration file is a configuration file required for compiling and generating the target kernel, and includes configuration parameters of one or more target kernel modules required for compiling and generating the target kernel.
Subsequently, kernel compilation is performed based on the target kernel configuration file to generate a target kernel including one or more target kernel modules.
It should be noted that, the kernel compiling is performed by adopting the make Localdemodconfig method, so that the kernel configuration item can be automatically selected, the complicated process of manual selection is avoided, and the kernel cutting efficiency is favorably improved.
In addition, according to an embodiment of the present invention, after the target kernel is generated by compiling, the target kernel may be loaded into the virtual machine, so as to detect whether the target kernel can stably run in the virtual machine.
According to one embodiment, after the original kernel file is obtained, before step S210 is executed, a mapping table of the kernel module and the kernel function is also created. In this way, in step S220, one or more target kernel modules may be determined by obtaining a mapping table of kernel modules and kernel functions, and determining a first kernel module corresponding to each used kernel function respectively according to the mapping table.
Specifically, when creating a mapping table between a kernel module and a kernel function, a kernel module list used by a current kernel is obtained through an Lsmod command, where the kernel module list includes a plurality of kernel modules used, that is, a first kernel module.
Subsequently, a path corresponding to each core module (first core module) in the core module list is respectively obtained, and a corresponding core module file is obtained according to the path. 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 the acquired kernel function into a/sys/kernel/debug/trace directory file.
Further, a mapping table of the kernel module and the kernel function, which is actually the mapping table of the first kernel module and the kernel function, is created according to each kernel module and the corresponding kernel function. Subsequently, the mapping table is written into a kernel-function.
According to one embodiment, the program for performing the automated testing on the plurality of first kernel modules in step S220 may be implemented as the following pseudo code:
Figure BDA0003150177740000091
here, P is an embodiment program, and after one automated test, a hitmodules.
Further, after the command P-trace/tmp/module-function.map —/html units.lst is executed, kernel function data (including data whether a kernel function is called) is obtained from the/sys/kernel/debug/trace directory file, a mapping table of a kernel module and a kernel function is obtained from the kernel-function.map file, based on the obtained called kernel function data, a kernel module corresponding to each called kernel function name is respectively queried in the mapping table, the queried kernel module is the first kernel module used by the current operating system, and each queried used first kernel module is determined as a target kernel module and is stored in the html units.lst 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 hitmodules. For example, for a kernel module whose default value is y, the exact location is used as the basis for clipping the kernel.
In summary, 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 on the kernel. And further, on the basis of the primarily cut first kernel, further screening and determining a target kernel module really required by the current operating system through an automatic test, and compiling and generating a final target kernel based on the further determined target kernel module, thereby finishing the cutting of the kernel. Therefore, the invention comprehensively carries out two-step clipping on the kernel, can more effectively reduce the number of kernel modules in the operating system in a shorter time, and further reduces the starting time of the system as much as possible. Wherein the kernel modules of the Linux system can be reduced to be lower than 100 in one to two weeks, and the starting time of the system can be reduced to about 1/3.
Furthermore, the kernel compiling is carried out by adopting the make Localdemodconfig method, the kernel configuration items can be automatically selected, the complicated process of manual selection is avoided, and the kernel cutting efficiency is favorably 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 thereof, may take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard drives, U.S. disks, floppy disks, 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 multilingual spam-text recognition method of the present invention according to instructions in said program code stored in the memory.
By way of example, and not limitation, readable media may comprise readable storage media and communication media. Readable storage media store 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 this invention. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, 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 interpreted as reflecting an intention that: that the invention as claimed 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 multiple sub-modules.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. 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. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements 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 included in other embodiments, rather than other features, 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 may be used in any combination.
Furthermore, some of the described embodiments are described herein as a method or combination of method elements that can be performed by a processor of a computer system or by other means of performing the described functions. A processor having the necessary instructions for carrying out the method or method elements thus forms a means for carrying out the method or method elements. Further, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is used to implement the functions performed by the elements for the purpose of carrying out the invention.
As used herein, unless otherwise specified the use of the ordinal adjectives "first", "second", "third", etc., to describe a common object, merely indicate that different instances of like objects are being referred to, and are not intended to imply that the objects so described must be in a given sequence, 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 this description, will appreciate that other embodiments can be devised which do not depart from 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 present invention has been disclosed in an illustrative rather than a restrictive sense, and the scope of the present invention is defined by the appended claims.

Claims (10)

1. A kernel clipping method, which is executed in an operating system, comprises the following steps:
creating a mapping table of kernel modules and kernel functions, wherein the mapping table comprises a plurality of first kernel modules and corresponding kernel functions;
generating a first core comprising a plurality of first core modules;
testing 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 the current operating system according to the called one or more kernel functions; and
generating a target kernel based on the one or more target kernel modules compilation.
2. The method of claim 1, wherein testing the kernel functions corresponding to the first plurality of kernel modules comprises:
a tracker of the kernel is started, and kernel functions are tracked based on the tracker to determine whether each kernel function is called.
3. The method of claim 1, wherein determining one or more target kernel modules used by the current operating system comprises:
acquiring 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.
4. The method of any of claims 1-3, wherein generating a first core comprising a plurality of first core 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 first kernel modules;
performing kernel compilation based on the first kernel configuration file to generate a first kernel comprising a plurality of the first kernel modules.
5. The method of claim 4, wherein before generating the first kernel configuration file based on the kernel configuration items respectively corresponding to the plurality of first kernel modules, the method comprises the steps of:
and automatically selecting the kernel configuration items corresponding to the first kernel modules respectively based on the first kernel modules by using a make localmodconfig method.
6. The method of any of claims 1-3, wherein compiling to generate the target kernel comprises:
generating a target kernel configuration file based on kernel configuration items respectively corresponding to the target kernel modules;
performing kernel compilation based on the target kernel configuration file to generate a target kernel including one or more of the target kernel modules.
7. The method of any of claims 1-3, wherein creating a mapping table of kernel modules to kernel functions comprises:
acquiring a kernel module list;
respectively acquiring a path corresponding to each kernel module in the kernel module list, and acquiring a corresponding kernel module file according to the path;
acquiring a kernel function corresponding to each kernel module according to the kernel module file;
and creating a mapping table of the kernel modules and the kernel functions according to each kernel module and the corresponding kernel function.
8. The method of any of claims 1-3, wherein after compiling the generated target kernel, further comprising 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.
9. 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-8.
10. A readable storage medium storing program instructions that, when read and executed by a computing device, cause the computing device to perform the method of any of claims 1-8.
CN202110761785.4A 2021-04-23 2021-04-23 Kernel cutting method and computing device Pending CN113485712A (en)

Priority Applications (1)

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

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110761785.4A CN113485712A (en) 2021-04-23 2021-04-23 Kernel cutting 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 (1)

Publication Number Publication Date
CN113485712A true CN113485712A (en) 2021-10-08

Family

ID=75992826

Family Applications (2)

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

Family Applications Before (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) CN112860267B (en)
WO (1) WO2022222378A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022222378A1 (en) * 2021-04-23 2022-10-27 统信软件技术有限公司 Kernel clipping method and computing device

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102360305A (en) * 2011-10-09 2012-02-22 中国航天科技集团公司第五研究院第五一三研究所 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
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
US20190318511A1 (en) * 2018-04-11 2019-10-17 Shanghai United Imaging Healthcare Co., Ltd. Method and system for determining magnetic susceptibility distribution
CN112860267A (en) * 2021-04-23 2021-05-28 武汉深之度科技有限公司 Kernel cutting method and computing device

Family Cites Families (14)

* 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
CN110389786B (en) * 2018-04-20 2022-10-14 伊姆西Ip控股有限责任公司 Kernel management method, electronic device and computer-readable storage medium
CN110825392B (en) * 2019-10-31 2023-07-04 中国人民解放军战略支援部队第五十六研究所 Customization method, batch deployment method and batch deployment system of operating system
CN111428241B (en) * 2019-10-31 2023-12-29 北京统信软件技术有限公司 Multi-security access policy control method and computing device
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

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102360305A (en) * 2011-10-09 2012-02-22 中国航天科技集团公司第五研究院第五一三研究所 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
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
US20190318511A1 (en) * 2018-04-11 2019-10-17 Shanghai United Imaging Healthcare Co., Ltd. Method and system for determining magnetic susceptibility distribution
CN112860267A (en) * 2021-04-23 2021-05-28 武汉深之度科技有限公司 Kernel cutting method and computing device

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
WANGJINGBIN 等: "Multiple Kernel Multivariate Performance Learning Using Cutting Plane Algorithm", 《2015 IEEE INTERNATIONAL CONFERENCE ON SYSTEMS, MAN, AND CYBERNETICS》, 14 January 2016 (2016-01-14), pages 1870 - 1875 *
WEIXIN_43892506: "kernel裁剪", pages 1 - 15, Retrieved from the Internet <URL:《https://blog.csdn.net/weixin_43892506/article/details/117885040》> *
丁小东: "基于视频采集系统的嵌入式Linux操作系统裁剪方法探讨", 《中国优秀硕士学位论文全文数据库 信息科技辑》, 15 July 2012 (2012-07-15), pages 138 - 1332 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022222378A1 (en) * 2021-04-23 2022-10-27 统信软件技术有限公司 Kernel clipping method and computing device

Also Published As

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

Similar Documents

Publication Publication Date Title
US7971189B2 (en) Automated interaction diagram generation using source code breakpoints
CN112988252B (en) Operating system starting method and computing device
CN111831564A (en) Regression testing method and device and computing equipment
CN111049889B (en) Static resource uploading method and device, integrated server and system
CN113127100B (en) Heterogeneous program execution method and device, computing device and readable storage medium
CN114691240A (en) Drive hardware configuration information loading method, device and system and computing equipment
CN112445708A (en) Pressure testing method and device and computing equipment
CN112860267B (en) Kernel cutting method and computing device
CN110825745B (en) Page generation method and device
CN113204385A (en) Plug-in loading method and device, computing equipment and readable storage medium
CN113805971B (en) Application program running method, computing device 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
CN114328273B (en) Debugging method and device for application program control and computing equipment
WO2023155863A1 (en) Methods and devices for compiler function fusion
CN113238973B (en) Method, computing device and storage medium for locating performance bottleneck of operating system
CN113867825B (en) Multi-system operation method, computing equipment and storage medium
CN117472458B (en) System function optimal configuration method and device, electronic equipment and storage medium
CN117591117B (en) Page generation method, system, equipment and storage medium
CN114036066A (en) Unit testing method and device, computing equipment and readable storage medium
CN110427211B (en) Demonstration data calling method and device
CN115904953A (en) Test method, test device, computing equipment and storage medium
CN114510456A (en) File searching method, downloading device and computing equipment
CN114741116A (en) Program transplanting method and device
CN114168143A (en) Method and device for positioning source code in software, computing equipment and readable 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