Linux kernel cutting method and system based on large model technology

By training the field-level kernel cutting large language model, the problem of complex configuration and low automation in the Linux kernel cutting method is solved, and an efficient and intelligent kernel cutting process is realized, which improves the accuracy and flexibility of cutting.

CN119690451APending Publication Date: 2025-03-25NANJING NORTH OPTICAL ELECTRONICS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411852238.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

The existing Linux kernel clipping methods have problems such as complex configuration, steep learning curve, low degree of automation and poor flexibility, which are difficult to meet the needs of different devices and platforms.

Method used

The field-level kernel-cutting large language model (KTLLM) is trained using large-scale kernel-cutting large language model (KTLLM), and compile configuration files and functional completeness test scripts are generated through supervised fine-tuning and multiple rounds of iteration to achieve automation and intelligence of kernel trimming.

Benefits of technology

It improves the accuracy and efficiency of kernel cropping, reduces learning costs, enhances the degree of automation and flexibility of the system, and ensures the stability and functional coverage of the kernel.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690451A_ABST
    Figure CN119690451A_ABST
Patent Text Reader

Abstract

The invention discloses a Linux kernel clipping method and system based on a large model technology, and the method comprises the steps: integrating kernel clipping professional domain knowledge into a large language model, generating a clipping scheme, and carrying out kernel clipping: carrying out test script iteration, kernel compiling iteration and kernel function completeness test, thereby obtaining a clipped kernel; meanwhile, the system comprises hardware computing equipment and a software function module and is used for implementing the kernel cutting method. Compared with the prior art, the method provides a set of solution for kernel cutting work, wherein the solution is full-process syndrome, quick in question and answer response, high in interaction flexibility and easy to operate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of operating system kernels and is a Linux kernel cutting method and system based on a large model technology. Background Art

[0002] In environments with strict resource requirements such as embedded systems, IoT devices, and mobile devices, Linux kernel tailoring and optimization are particularly important. At present, there have been some related research and technical practices at home and abroad, but there are still many shortcomings and challenges.

[0003] In China, with the rapid development of embedded systems and IoT devices, the demand for streamlined Linux kernels is increasing. Many enterprises and scientific research institutions are committed to developing more efficient kernel tailoring methods. For example, Huawei uses a streamlined Linux kernel in its IoT operating system LiteOS, but it is mainly focused on specific hardware platforms and has poor flexibility.

[0004] Internationally, the research and practice of Linux kernel tailoring are relatively mature. There are mainly the following methods and tools:

[0005] Buildroot: A build tool designed specifically for embedded systems that customizes and tailors the Linux kernel and its root file system through configuration files. Buildroot simplifies the kernel tailoring process, but it still requires manual configuration and is difficult to automate.

[0006] Yocto Project: An open source build system that allows developers to customize embedded Linux systems. Yocto Project supports flexible kernel tailoring, but the configuration is complex and the learning curve is steep.

[0007] With the development of machine learning technology and big models, applying them to the Linux kernel tailoring field provides new solutions and methods. With the support of special field big model technology, the kernel tailoring process can be automated and intelligent, greatly improving the efficiency and accuracy of tailoring. Summary of the invention

[0008] The purpose of the present invention is to provide a Linux kernel tailoring method and system based on large model technology. It aims to solve the problems faced by kernel tailoring under different devices and platforms, such as complex configuration, steep learning curve, low degree of automation and poor flexibility. After integrating the professional domain knowledge of kernel tailoring into the large language model, supervised fine-tuning (SFT) is performed to obtain a domain-level kernel tailoring large language model (abbreviated as KTLLM), which can provide a set of full-process accompanying, rapid question-answering response, strong interactive flexibility and easy-to-use solutions for kernel tailoring.

[0009] The technical solution to achieve the purpose of the present invention is: a Linux kernel tailoring method based on large model technology, comprising the following steps:

[0010] Kernel pruning for large language model training;

[0011] Generate kernel tailoring plan: Generate compilation configuration files and functional completeness test scripts based on kernel requirements and requirement identifiers;

[0012] Test script iteration: test the functional completeness test script;

[0013] Kernel compilation iteration: compile the kernel and run it;

[0014] Kernel functional integrity test: Use the successfully tested functional integrity test script to perform functional integrity test on the kernel after it runs successfully.

[0015] Furthermore, the specific steps of kernel pruning large language model training are:

[0016] Prepare a corpus of kernel-tailored solutions with high semantic and content quality;

[0017] Analyze corpus data, remove duplicate data, and repair missing data;

[0018] Mix domain corpus and general corpus in proportion to generate training data set;

[0019] Set kernel pruning large language model training hyperparameters, such as number of iterations, learning rate, etc.

[0020] Optimize model training results and perform kernel pruning and large language model tuning based on model loss distribution;

[0021] Perform general supervised fine-tuning training to improve the kernel-tailored large language model's ability to understand general instructions and follow language;

[0022] Conduct supervised fine-tuning training in vertical fields to improve the command understanding and language following capabilities of the large language model in vertical fields;

[0023] The trained kernel-pruned large language model is transmitted to the model inference computing device through a high-speed network channel.

[0024] Furthermore, the cutting solution generation includes:

[0025] The kernel tailoring personnel summarize the basic functions that the kernel needs to have and summarize them into kernel requirements according to the functional points;

[0026] The kernel requirements and requirement identifiers are passed into the trained kernel tailored large language model in the model inference computing device. The large model understands, identifies and analyzes the model and generates a compilation configuration file and a functional completeness test script.

[0027] Furthermore, the specific steps of test script iteration are: placing the generated functional completeness test script on the target machine to run the test; if the script test result is successful, retaining the current functional completeness test script for subsequent kernel functional testing; if the script test result fails, collecting the test results, together with the script test failure flag, passing them into the kernel trimmed large language model in the model inference computing device, generating a new functional completeness test script, and performing the script test again.

[0028] Furthermore, the specific steps of kernel compilation iteration are:

[0029] Compile the kernel on the kernel compilation computing device according to the generated compilation configuration file to generate an installation package;

[0030] Install the kernel and replace it, and test run it on the target machine;

[0031] Collect the dmesg log of the target machine startup and run the kernel; if the kernel runs successfully, enter the kernel function completeness test phase; if the kernel fails to run, pass the dmesg log and the run failure flag to KTLLM in the model inference computing device, generate a new compilation configuration file, and return to recompile the kernel.

[0032] Furthermore, in the kernel functional completeness test, if the functional completeness test result passes, the kernel trimming is completed; if the functional completeness test result fails, the test results are collected; the test results together with the test failure flag are passed into the kernel trimming large language model, the compilation configuration file is regenerated, and the kernel compilation iteration is re-performed.

[0033] A Linux kernel tailoring system based on large model technology, the hardware computing device of the kernel tailoring system includes:

[0034] Model training computing equipment: equipped with high-performance image processing units and vector processing units, supporting distributed training and multi-task parallel processing, and capable of processing massive amounts of data;

[0035] Model inference computing equipment: equipped with high-performance computing units, large-capacity storage units, and high-throughput network communication units;

[0036] Kernel compilation computing device: equipped with a high-performance central processing unit and main storage unit, supporting parallel compilation, multi-platform cross-compilation, and capable of capturing and collecting errors during the compilation process;

[0037] Kernel test computing equipment: It is the same model hardware platform as the actual kernel operation, equipped with a variety of test tools and automated test frameworks for kernel function verification, supporting regression testing, performance testing and stress testing.

[0038] Furthermore, the software function modules of the kernel tailoring system include:

[0039] The task receiving and processing module is used to parse the tasks submitted by users and the tasks issued by the upstream modules, and call other functional modules to complete the task objectives;

[0040] The kernel trimming large language model tuning module analyzes the kernel trimming solution corpus provided by the user and performs data cleaning, and divides the data set for model tuning training according to the data volume;

[0041] The kernel requirement parsing and identification module is used to analyze the specific requirements of user applications and identify the functional modules that must be retained and cut by the kernel;

[0042] The kernel compilation configuration generation iteration module is used to generate a preliminary kernel compilation configuration file, and then automatically optimize and adjust the configuration through multiple rounds of iterations until the optimal kernel configuration is generated;

[0043] Kernel functional test script generation iteration module is used to verify the function and performance of the kernel in a specific environment;

[0044] The kernel function test result extraction and analysis module is used to automatically extract the test results and conduct in-depth analysis after executing the test script;

[0045] The kernel file fast compilation module is used to provide efficient kernel file compilation functions and support parallel compilation and incremental compilation;

[0046] Kernel boot log extraction and analysis module, used to automatically collect and analyze boot logs.

[0047] Compared with the prior art, the present invention has the following significant advantages:

[0048] (1) The design of the kernel tailoring method and system of the present invention automatically generates a kernel tailoring plan, performs kernel tailoring, and performs automated testing and verification to ensure kernel stability and functional coverage, effectively improving the accuracy and efficiency of kernel tailoring.

[0049] (2) Through the large language model for kernel tailoring generated by the model training computing device, users do not need to specifically specify the components corresponding to the required kernel functions. The large model can perform kernel compilation configuration conversion according to the functional requirements of the kernel required by the user, effectively reducing the learning cost of kernel tailoring.

[0050] (3) The present invention completes the automatic transfer and optimization iteration of upstream and downstream tasks by deploying task receiving and processing modules on four computing devices and high-speed network channels between devices, greatly improving the automation level of kernel compilation tasks.

[0051] (4) The present invention supports the generation of corresponding kernel compilation configurations by kernel tailoring of a large language model, and also supports users to personalize the kernel compilation configurations, and the kernel compilation configurations are highly flexible. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Figure 1 It is a schematic diagram of the model training computing equipment.

[0053] Figure 2 It is a schematic diagram of the model inference computing device.

[0054] Figure 3 This is a schematic diagram of the kernel compilation computing device.

[0055] Figure 4 It is a schematic diagram of the kernel test computing equipment.

[0056] Figure 5 It is a network connection diagram of computing devices.

[0057] Figure 6 It is the workflow diagram of the kernel trimming system.

[0058] Figure 7 It is a relationship diagram between computing devices and functional modules. DETAILED DESCRIPTION

[0059] The following is combined with Figure 1-6 The present invention is further introduced with specific embodiments. According to the specific description of the following implementation modes, the purpose, technical solutions and advantages of the present application can be made clearer. It should be understood that the mode of implementing the present invention is not limited to the specific embodiments described below. Based on the embodiments provided in this application, all other embodiments obtained by ordinary technicians in this field without making creative work belong to the scope of protection of this application.

[0060] A Linux kernel tailoring system based on large model technology of the present invention includes a hardware computing device and a software function module;

[0061] The computing devices of the kernel tailoring system include: model training computing devices, model reasoning computing devices, kernel compilation computing devices, and kernel testing computing devices. Figure 1-Figure 4 As shown. (Equipment includes modules, modules have functions, or the system contains equipment, equipment contains functional modules)

[0062] The model training computing device is equipped with a high-performance image processing unit and vector processing unit, supports distributed training and multi-task parallel processing, and can process massive amounts of data. It is mainly responsible for receiving and processing large-scale kernel-tailored professional knowledge data sets, performing supervised fine-tuning, model training, performance evaluation, and iterative optimization of large language models, and the device outputs a kernel-tailored large language model (KTLLM).

[0063] The model inference computing device is equipped with high-performance computing units, large-capacity storage units and high-throughput network communication units. It has the characteristics of low latency and high throughput, and can handle a large number of inference tasks in a short time to ensure the real-time performance and response speed of the system. It is mainly responsible for applying the trained kernel tailoring domain large language model (KTLLM) to the kernel tailoring process, analyzing and predicting according to specific application scenarios, and generating tailoring solutions.

[0064] The kernel compilation computing device is equipped with a high-performance central processing unit and main storage unit, supports parallel compilation, multi-platform cross-compilation, and has the ability to capture and collect errors during the compilation process. It is mainly responsible for efficiently and stably executing the kernel compilation work based on the kernel configuration file generated by the model reasoning computing device.

[0065] The kernel test computing device is the same model hardware platform as the kernel actually runs, equipped with a variety of test tools and automated test frameworks for kernel function verification, supporting regression testing, performance testing, and stress testing, etc. It is mainly responsible for verifying and testing the compiled kernel to ensure its functional integrity, performance optimization, and stability.

[0066] The functional modules of the kernel tailoring system include: task receiving and processing module, kernel tailoring large language model tuning module, kernel requirement parsing and identification module, kernel compilation configuration generation iteration module, kernel function test script generation iteration module, kernel function test result extraction and analysis module, kernel file fast compilation module, and kernel startup log extraction and analysis module.

[0067] The task receiving and processing module is used to parse the tasks submitted by the user and the tasks issued by the upstream module, and call other functional modules to complete the task objectives. The task receiving and processing module on the model training computing device receives the model tuning request and related corpus sent by the user, and calls other modules to complete the model training task; the task receiving and processing module on the model inference computing device receives the kernel clipping large language model sent by the model training computing device, and on this basis calls the relevant functional modules according to the user's task request to complete the model inference task; the task receiving and processing module on the kernel compilation computing device receives the .config file generated by the model inference computing device, performs kernel fast compilation, and generates the compiled Linux kernel; the task receiving and processing module in the kernel test computing module receives the Linux kernel generated by the kernel compilation computing device and the kernel test script generated by the model inference computing device, and calls the relevant functional modules to complete the kernel test task.

[0068] The kernel tailoring large language model tuning module analyzes the kernel tailoring solution corpus provided by the user and performs data cleaning, dividing the data set for model tuning training according to the data volume. The user can set the basic large language model used and the related tuning training parameters. Ensure that the tuned large language model has the ability to understand instructions and follow language in the kernel tailoring field.

[0069] The kernel requirement parsing and identification module is used to analyze the specific requirements of user applications and identify the functional modules that must be retained and can be cut in the kernel. Users can provide the application's operating environment and requirement description, and the system automatically parses the required kernel functions. This ensures that the cut kernel can still meet the requirements of specific application scenarios, avoiding unnecessary functions being retained or necessary functions being cut.

[0070] The kernel compilation configuration generation iteration module is used to generate preliminary kernel compilation configuration files (such as .config files). Then, through multiple rounds of iterations, the configuration is automatically optimized and adjusted until the optimal kernel configuration is generated. This reduces the complexity of manual configuration by users, ensures that the generated kernel configuration files best meet actual application requirements, and improves the accuracy and efficiency of configuration through automated iteration.

[0071] The kernel function test script generation iteration module is used to verify the kernel's functions and performance in a specific environment. After the test script is generated, the system continuously optimizes the script content through iteration to improve the test coverage and accuracy. It can greatly save the developer's time, and through iterative optimization, it ensures that the test is comprehensive and effective, and timely discovers potential functional defects.

[0072] The kernel function test result extraction and analysis module is used to automatically extract the test results after executing the test script, and conduct in-depth analysis. The analysis content includes whether the function is normal, whether the performance indicators meet the standards, potential problems and optimization suggestions, etc. Through automatic result extraction and analysis, users can quickly understand the actual operating status of the kernel and make corresponding adjustments and optimizations based on the analysis results.

[0073] The kernel file fast compilation module is used to provide efficient kernel file compilation functions, support parallel compilation and incremental compilation, and significantly shorten the kernel compilation time. Users can obtain the tailored kernel version in a short time for deployment and testing.

[0074] The kernel boot log extraction and analysis module is used to automatically collect and analyze boot logs, focusing on extracting key information that may affect system performance and stability, such as boot errors, module loading status, memory usage, etc. Users can quickly locate and solve problems that occur during the boot process to ensure the stability and efficient operation of the kernel.

[0075] A Linux kernel tailoring method based on large model technology can meet the needs of users for customized kernel tailoring in different application scenarios and platforms. The specific steps are as follows:

[0076] Step 1: Kernel pruning of large language model training phase;

[0077] Fine tune is used to introduce expert knowledge and tune the large language model.

[0078] Step 1.1: Prepare a kernel-tailored corpus with high semantic and content quality;

[0079] Step 1.2: Analyze the corpus data on the model training computing device, remove duplicate corpora, and repair missing corpora;

[0080] Step 1.3: Mix the domain corpus and general corpus in proportion to generate a training dataset;

[0081] Step 1.4: Set the kernel pruning large language model training hyperparameters, such as the number of iterations, learning rate, etc.

[0082] Step 1.5: Optimize the model training results and perform kernel pruning and large language model tuning based on the model loss distribution;

[0083] Step 1.6: Perform general supervised fine-tuning training to improve the kernel-tailored large language model’s understanding of general instructions and language following capabilities;

[0084] Step 1.7: Perform supervised fine-tuning training in vertical fields to improve the command understanding and language following capabilities of the large language model in vertical fields;

[0085] Step 1.8: Transmit the trained kernel-trimmed large language model (KTLLM) to the model inference computing device through a high-speed network channel.

[0086] Step 2: Generate kernel pruning solution, such as Figure 6 shown.

[0087] The kernel requirements and requirement identifiers are passed into the trained kernel tailored large language model (KTLLM) in the model inference computing device to generate a tailored solution. The specific steps are as follows:

[0088] Step 2.1: The kernel tailoring personnel summarize the basic functions that the kernel needs to have and summarize them into kernel requirements according to the functional points;

[0089] Step 2.2: Pass the kernel requirements and requirement identifiers into the trained kernel tailored large language model (KTLLM) in the model inference computing device. The large model understands, identifies and analyzes them to generate a .config compilation configuration file and a functional completeness test script. The .config compilation configuration file is used to configure the module functions that should be included in the kernel, and the functional completeness test script is used to test whether the kernel functions meet expectations.

[0090] Step 3: Test script iteration phase, run the generated functional completeness test script for testing

[0091] 3.1.1: Place the generated functional completeness test script on the target machine (i.e., the kernel test computing device) to run the test;

[0092] 3.1.2: If the script test result is successful, keep the current functional completeness test script for subsequent kernel functional testing;

[0093] If the script test result fails, collect the test results and pass them together with the script test failure flag into the kernel-tailored large language model (KTLLM) in the model inference computing device, generate a new functional completeness test script, and return to step 3.1.1.

[0094] Step 4: Kernel compilation iteration phase:

[0095] Step 4.1: Compile the kernel on the kernel compilation computing device according to the generated .config file to generate an installation package;

[0096] Step 4.2: Install the kernel and replace it, and test run it on the target machine (i.e., the kernel test computing device); Step 4.3: Collect the dmesg log (a command line tool used to view kernel-related logs in Linux) started by the target machine (i.e., the kernel test computing device), and run the kernel;

[0097] If the kernel runs successfully, it enters the kernel functional completeness test phase;

[0098] If the kernel fails to run, the dmesg log and the run failure flag are passed to KTLLM in the model inference computing device, a new .config file is generated, and the process returns to step 4.1.

[0099] Step 5: Kernel functional completeness testing phase:

[0100] Using the functional completeness test script generated by KTLLM in the model inference computing device in the test script iteration phase in step 3, the functional completeness test of the kernel in the kernel compilation iteration phase in step 4 is performed;

[0101] If the functional completeness test result passes, the kernel trimming is completed;

[0102] If the functional completeness test result fails, the test results are collected; the test results together with the test failure flag are passed to the KTLLM in the model reasoning computing device, the .config file is regenerated, and the kernel compilation iteration phase is returned.

[0103] The above-described embodiment is only an applicable mode of the present invention, but the protection scope of the present invention is not limited thereto. The mode and optimization algorithm of the present invention have been explained and demonstrated in detail in the embodiment. Without violating the technical principle, the present invention allows any changes or modifications, which should be covered within the protection scope of the claims of the present invention.

Claims

1. A Linux kernel tailoring method based on large model technology, characterized in that: The steps include: Kernel pruning for large language model training; Generate kernel tailoring plan: Generate compilation configuration files and functional completeness test scripts based on kernel requirements and requirement identifiers; Test script iteration: test the functional completeness test script; Kernel compilation iteration: compile the kernel and run it; Kernel functional integrity test: Use the successfully tested functional integrity test script to perform functional integrity test on the kernel after it runs successfully.

2. The Linux kernel tailoring method based on large model technology according to claim 1 is characterized in that: The specific steps for kernel pruning large language model training are: Prepare a corpus of kernel-tailored solutions with high semantic and content quality; Analyze corpus data, remove duplicate data, and repair missing data; Mix domain corpus and general corpus in proportion to generate training data set; Set kernel clipping large language model training hyperparameters; Optimize model training results and perform kernel pruning and large language model tuning based on model loss distribution; Perform general supervised fine-tuning training to improve the kernel-tailored large language model's ability to understand general instructions and follow language; Conduct supervised fine-tuning training in vertical fields to improve the command understanding and language following capabilities of the large language model in vertical fields; The trained kernel-pruned large language model is transmitted to the model inference computing device through a high-speed network channel.

3. The Linux kernel tailoring method based on large model technology according to claim 1 is characterized in that: The cutting solution generation includes: The kernel tailoring personnel summarize the basic functions that the kernel needs to have and summarize them into kernel requirements according to the functional points; The kernel requirements and requirement identifiers are passed into the trained kernel tailored large language model in the model inference computing device. The large model understands, identifies and analyzes the model and generates a compilation configuration file and a functional completeness test script.

4. The Linux kernel tailoring method based on large model technology according to claim 1 is characterized in that: The specific steps of test script iteration are: placing the generated functional completeness test script on the target machine to run the test; if the script test result is successful, retaining the current functional completeness test script for subsequent kernel functional testing; If the script test result fails, collect the test results and pass them together with the script test failure mark into the kernel-cut large language model in the model inference computing device to generate a new functional completeness test script and perform the script test again.

5. The Linux kernel tailoring method based on large model technology according to claim 1 is characterized in that: The specific steps of kernel compilation iteration are: Compile the kernel on the kernel compilation computing device according to the generated compilation configuration file to generate an installation package; Install the kernel and replace it, and test run it on the target machine; Collect the dmesg log of the target machine startup and run the kernel; if the kernel runs successfully, enter the kernel function completeness test phase; If the kernel fails to run, the dmesg log and the run failure flag are passed to KTLLM in the model inference computing device, a new compilation configuration file is generated, and the kernel is recompiled.

6. The Linux kernel tailoring method based on large model technology according to claim 1 is characterized in that: In the kernel functional completeness test, if the functional completeness test result passes, the kernel trimming is completed; If the functional completeness test result fails, the test results are collected; the test results together with the test failure flag are passed to the kernel tailored large language model, the compilation configuration file is regenerated, and the kernel compilation iteration is re-performed.

7. A Linux kernel tailoring system based on large model technology, characterized in that: The Linux kernel tailoring method based on the large model technology according to any one of claims 1 to 6, wherein the hardware computing device of the kernel tailoring system comprises: Model training computing equipment: equipped with high-performance image processing units and vector processing units, supporting distributed training and multi-task parallel processing, and capable of processing massive amounts of data; Model reasoning computing device: equipped with computing unit, storage unit and network communication unit; Kernel compilation computing device: equipped with a central processing unit and a main storage unit, supports parallel compilation, multi-platform cross-compilation, and has the ability to capture and collect errors during the compilation process; Kernel test computing equipment: It is the same model hardware platform as the actual kernel operation, equipped with a variety of test tools and automated test frameworks for kernel function verification, supporting regression testing, performance testing and stress testing.

8. The Linux kernel tailoring system based on large model technology according to claim 7 is characterized in that: The software functional modules of the kernel tailoring system include: The task receiving and processing module is used to parse the tasks submitted by users and the tasks issued by the upstream modules, and call other functional modules to complete the task objectives; The kernel trimming large language model tuning module analyzes the kernel trimming solution corpus provided by the user and performs data cleaning, and divides the data set for model tuning training according to the data volume; The kernel requirement parsing and identification module is used to analyze the specific requirements of user applications and identify the functional modules that must be retained and cut by the kernel; The kernel compilation configuration generation iteration module is used to generate a preliminary kernel compilation configuration file, and then automatically optimize and adjust the configuration through multiple rounds of iterations until the optimal kernel configuration is generated; Kernel functional test script generation iteration module is used to verify the function and performance of the kernel in a specific environment; The kernel function test result extraction and analysis module is used to automatically extract the test results and conduct in-depth analysis after executing the test script; The kernel file fast compilation module is used to provide efficient kernel file compilation functions and support parallel compilation and incremental compilation; Kernel boot log extraction and analysis module, used to automatically collect and analyze boot logs.