An automated hierarchical kernel pruning method and system for ship end scenarios
Patent Information
- Application Number
- CN202610867725.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-16
- Publication Date
- 2026-09-25
AI Technical Summary
[0009]本发明解决现有技术中传统Linux内核裁剪采用平面化裁剪逻辑,极易导致裁剪过度、模块关联冲突,无法兼顾内核体积精简与内核兼容性、现有内核验证体系仅覆盖基础功能,无法有效模拟真实的船端物理场景,导致编译后的初始内核镜像上船部署后运行稳定性差、现有内核容错机制单一,且在执行回退或内核替换重启的过程中易引发实时业务数据丢失与核心业务中断的技术问题,提供了一种面向船端场景的自动化分级内核裁剪方法及系统,解决了上述问题
[0052]本发明提供的一种面向船端场景的自动化分级内核裁剪方法及系统,通过S1构建包含关联紧密程度的“加权有向无环图”进行模块关联感知,以及S2中引入内核三级递进式层级裁剪法和基于模块层级和关联权重的“综合仲裁得分”机制,将抽象的依赖关系转化为量化的仲裁得分指标(且在某些实施例中,进一步转化为多因子量化模型公式)。该基于综合仲裁得分的裁决机制实现了在面对“疑似冗余模块”时,通过综合仲裁得分进行精准的去留裁决,裁剪全程校验模块依赖关系。这种层级化且关联感知的处理方式实现了核心保障、业务适配、冗余剔除的有序推进,不仅优先保留了系统基础功能与船端核心业务模块(针对性保留AIS服务、Web服务、虚拟化技术等),彻底剔除非船端冗余模块与专属驱动,还从底层规避了过度裁剪风险。这有效避免了因破坏模块关联链导致的驱动冲突、功能异常等问题,解决了现有技术(如传统的Buildroot或单纯查调用次数的工具)均采用“一刀切”的平面化裁剪,极易破坏隐蔽的依赖链条导致系统瘫痪的问题。在保障内核高兼容性的前提下,平衡了内核精简度与运行稳定性,实现了系统资源的压缩优化,内存优化达7%,并显著提升了船舶业务响应速度。
Smart Images

Figure CN122816685A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of ship intelligence and operating system kernel optimization technology, specifically to an automated hierarchical kernel trimming method and system for shipboard scenarios. Background Technology
[0002] As the core computing hub of intelligent ships, the ship intelligent computing center integrates hardware resources such as edge computing nodes, multi-source sensor access modules, and ship-shore collaborative communication units. It carries core businesses such as the Automatic Identification System (AIS), intelligent engine room operation and maintenance, ship-shore data interaction, virtualization service deployment, and Web management services. The operating efficiency and adaptability of its operating system kernel directly determine the navigation safety and business processing capabilities of intelligent ships.
[0003] In the field of Linux kernel trimming technology, there are already relatively mature related research and application practices both domestically and internationally. Commonly used methods in the embedded systems field include: the Busybox toolset, which streamlines the root file system by integrating hundreds of commonly used Unix commands and tools into a single executable file; the Buildroot tool, which allows for customized trimming of the Linux kernel and root file system through configuration files; and the YoctoProject build system, which supports flexible customization of embedded Linux systems. Furthermore, with the application of large model technology, a Linux kernel trimming method and system based on large model technology has also been proposed domestically. This method obtains a domain-level kernel trimming large language model (KTLLM) through supervised fine-tuning (SFT), providing a question-and-answer responsive trimming process service.
[0004] However, due to the unique requirements of ship intelligent computing centers, such as dynamic adjustment of multiple services, unmanned operation and maintenance, and harsh physical environments, the aforementioned existing technical solutions cannot be perfectly adapted to them, and the following technical defects that urgently need to be addressed have been exposed in practical applications:
[0005] First, existing solutions often employ a flat, simplistic trimming logic, which easily leads to over-trimming or module conflicts, failing to balance kernel size reduction with kernel compatibility. The reason for this is that Busybox focuses only on simplifying the user-level toolset, lacking systematic trimming capabilities for kernel-level modules, and its configuration relies on manual, line-by-line definition. Buildroot and YoctoProject also heavily rely on manual selection of configuration items and parameter tuning, resulting in complex configuration systems with low automation. None of these methods establish a hierarchical priority system of "basic functions - core business - redundancy removal." In the process of implementing kernel trimming across different projects, the implementation relies too heavily on expert experience when dealing with positive dependencies, reverse relationships, and collaborative relationships between kernel modules. Even with large-model-based technologies, without sufficient prompts, the model's conclusions can easily disrupt module dependency chains during project compilation, causing driver conflicts and functional anomalies, leading to system paralysis due to over-trimming or the loss of core business modules.
[0006] Secondly, existing kernel verification systems only cover basic functions and cannot effectively simulate real-world shipboard physical scenarios. This results in poor stability of the initial compiled kernel image after deployment on board. Current mainstream trimming tools and large-model-assisted testing systems often only test the system's CPU, memory, and other general basic functions in conventional virtual machine environments like computer rooms or greenhouses. This verification mode cannot translate the abstract, harsh maritime environment into concrete code-level stress injection, failing to simulate the complex sea conditions unique to ocean-going vessels (such as network link degradation and hardware fluctuations caused by waves blocking satellite antennas, sudden changes in computing load caused by severe ship rolling, and electromagnetic interference caused by high-salt and high-humidity environments). This leads to a very high risk of system kernel operation under extreme physical interference after a kernel image passes conventional verification and is deployed on board, making it difficult to guarantee long-term stable operation.
[0007] Secondly, existing kernel fault tolerance and recovery mechanisms are simplistic, and during rollback or kernel replacement restarts, they are prone to causing real-time business data loss and core business interruptions. Ship intelligent computing centers, operating on the high seas, have a strong need for unmanned operation and maintenance and low computing power consumption. The training and inference of large-model-assisted pruning schemes require significant computing power and memory resources, resulting in high deployment costs and poor real-time performance, making them difficult to implement. More importantly, existing pruning schemes lack a robust tiered rollback mechanism. When the system fails to compile or starts abnormally due to configuration parameter deviations or missing core modules, it cannot automatically classify errors or dynamically backtrack based on log signatures, often requiring a complete overhaul. Furthermore, during critical moments of kernel replacement hot-swapping or restart rollback, the lack of effective isolation and caching measures for data preservation can easily lead to the loss or permanent loss of critical lifeline business data, such as Automatic Identification System (AIS) and ship-to-shore communication protocol data.
[0008] In summary, existing Linux kernel trimming technologies suffer from problems such as reliance on manual configuration or excessively high computing costs. Furthermore, none of them provide methods for addressing hierarchical functional requirements, module association characteristics, and shipboard business scenario design for the maritime industry, thus failing to solve the issues of kernel trimming accuracy, automation, and scenario adaptability. Summary of the Invention
[0009] This invention addresses the problems of traditional Linux kernel trimming, which employs a flat trimming logic that easily leads to over-trimming, module conflicts, and an inability to balance kernel size reduction and kernel compatibility. Furthermore, existing kernel verification systems only cover basic functions and cannot effectively simulate real-world shipboard physical scenarios, resulting in poor stability of the initial compiled kernel image after deployment on board. Additionally, existing kernel fault tolerance mechanisms are limited and prone to real-time business data loss and core business interruptions during rollback or kernel replacement restarts. This invention provides an automated, tiered kernel trimming method and system for shipboard scenarios, solving these problems.
[0010] This invention provides an automated hierarchical kernel pruning method for shipboard scenarios, comprising the following steps:
[0011] S1: Constructing a relational graph: Obtain the initial kernel module of the ship intelligent computing center server, and construct a weighted directed acyclic graph as the relational graph of the kernel module through full module parsing. The nodes of the weighted directed acyclic graph are the initial kernel modules, the directed edges are the dependencies between modules, and the edge weights are the degree of module association.
[0012] S2: Three-level progressive pruning: Based on the weighted directed acyclic graph, a three-level progressive hierarchical pruning is performed on the initial kernel module. The three-level progressive hierarchical pruning includes, in sequence, the system base layer retention pruning, the ship-end business layer adaptation pruning, and the redundant module elimination pruning. In the redundant module elimination pruning, for nodes determined to be suspected redundant modules, a comprehensive arbitration score is calculated based on the module correlation tightness, and a retention or elimination operation is performed according to the comprehensive arbitration score to obtain the target kernel module set.
[0013] S3: Automatic configuration and compilation: Generate a customized configuration file based on the target kernel module set, and perform automatic compilation according to the customized configuration file to obtain the initial kernel image;
[0014] S4: Physical Scene Simulation: Perform fully automated functional verification on the initial kernel image. The fully automated functional verification includes injecting specific test parameters to simulate network link degradation, hardware load fluctuations and electromagnetic interference phenomena in the physical scene at the ship's end. After the verification is passed, the initial kernel image is determined as the target kernel image.
[0015] S5: Intelligent graded rollback: Deploy the target kernel image and continuously collect operation logs; when an operation anomaly is detected, automatically classify the error based on the parsing results of the error signature codes in the operation logs, and trigger the corresponding graded rollback mechanism according to the classification results. The graded rollback mechanism caches real-time business data through a memory protection zone when performing the rollback.
[0016] Preferably, in step S1, the formula for quantifying the degree of correlation W between the modules using a multi-factor weighted model is as follows:
[0017] ,
[0018] Where F represents the frequency of inter-module dependency calls per unit time, and its form is as follows: , This represents the number of times each module pair is invoked during the test period. This represents the maximum number of calls for all modules. This is the time percentage coefficient, and its form is as follows: , This represents the cumulative duration during which both modules are simultaneously in a loading state. Total kernel runtime; The module hierarchy coefficients are the module hierarchy coefficients corresponding to the system base layer module, the shipboard business layer module, and the redundant module elimination and trimming layer module. The preset values are 1, 0.7, and 0.3 respectively; , , These are the preset weighting coefficients, and are set to 0.4, 0.3, and 0.3 respectively.
[0019] Preferably, in step S2, the method for calculating the comprehensive arbitration score based on the degree of correlation between the modules includes:
[0020] Based on formula The linear normalized mapping value is calculated. ,in and These represent the minimum and maximum values of the range of module correlation in the weighted directed acyclic graph, respectively.
[0021] The system base layer, the shipboard business layer, and the redundant module elimination and trimming layer are assigned corresponding level scores based on the level of the initial kernel module node. The level scores are preset to 100 points, 80 points, and 50 points, respectively.
[0022] Based on the business association attributes corresponding to the initial kernel module node, a corresponding business priority score is assigned. The business priority scores of the core business association module and the basic service module are preset to 100 points and 80 points, respectively.
[0023] Based on formula The comprehensive arbitration score S is calculated.
[0024] Preferably, the step of performing a retention or removal operation based on the comprehensive arbitration score when a module association conflict occurs includes:
[0025] Compare the overall arbitration scores S of multiple initial kernel modules that have resource contention or circular dependency conflicts. In the compilation configuration, retain the module with the higher overall arbitration score S and delete the module with the lower score. If the overall arbitration scores S of the conflicting modules are the same, prioritize retaining the module located in the system base layer. If they are at the same level, retain the module with the higher degree of correlation S.
[0026] Preferably, in step S2, the method for performing retention or removal operations on nodes determined to be suspected redundant modules includes:
[0027] Traverse the weighted directed acyclic graph. If there is no directed edge connection between the suspected redundant module and all ship-side dedicated business module nodes in the system, it is directly determined as an invalid redundant module and the removal operation is performed.
[0028] If a related link exists, it will be determined based on the degree of module correlation between it and the corresponding core business module. Perform interval division determination:
[0029] When the modules are closely related When the value is less than 0.2, it is determined to be a weakly correlated redundancy, and the deletion operation is performed directly.
[0030] When the modules are closely related When the value is between 0.2 and 0.5, the verification phase begins. The core business load is simulated. If the core business operates normally after the module is removed, it is deleted; otherwise, it is retained.
[0031] When the modules are closely related If the value is not lower than 0.5, it is determined to be a non-redundant module and is retained.
[0032] Preferably, in step S3, the customized configuration file is a .config configuration file, and the specific steps of the automatic configuration compilation include: automatically matching the kernel configuration item parameters corresponding to each module in the target kernel module set through the automatic configuration engine, automatically generating the customized configuration file in combination with the ARM / aarch64 or x86_64 hardware architecture of the ship intelligent computing center server, and importing the customized configuration file into a preset cross-compilation environment to automatically compile and generate kernel image files, module files and startup configuration files.
[0033] Preferably, in step S4, the method for simulating network link degradation, hardware load fluctuations, and electromagnetic interference phenomena in the physical scenario at the ship's end includes:
[0034] Using the flow control tool tc and its netem module, a random packet loss rate of 0.5% to 5% and a delay parameter of 50ms to 200ms with a jitter of ±30ms are automatically injected to simulate network link degradation.
[0035] The stress testing tool stress-ng was used to dynamically control the processor load rate to vary between 10% and 80% and the memory usage rate to vary between 20% and 70% at random time intervals to simulate hardware load fluctuations.
[0036] Periodically control the unexpected shutdown and recovery of the network interface, or inject system interrupt commands to simulate abnormal module communication under electromagnetic interference.
[0037] Preferably, in step S5, the automatic error classification based on the parsing results of the error signature codes in the operation log, and the triggering of the corresponding graded rollback mechanism, includes:
[0038] The system analyzes the dmesg runtime log. When it detects a signature containing warning or failed, it determines it to be a minor error. The system restores the configuration from the most recent hierarchical snapshot, fine-tunes the parameters, and then recompiles and verifies.
[0039] When a feature code containing "unable" or "error" is detected, it is determined to be a moderate error. The system automatically rolls back to the snapshot after the corresponding level of pruning is completed, restores the original topology state, and re-executes the pruning process.
[0040] When compilation failure information is extracted during the compilation phase, or when the signature of a kernel panic or bug is detected after the system is replaced and started, it is determined to be a serious error, and the system directly rolls back to the baseline snapshot after initialization and restarts.
[0041] Preferably, in step S5, caching real-time business data through a memory protection zone includes:
[0042] Before triggering the rollback operation, a status snapshot of the current core business operation is automatically generated and synchronously stored in the ship's local cache with power failure protection and the shore-based backup node;
[0043] During kernel switching or rebooting, the memory cache protection mechanism is automatically enabled to temporarily cache newly generated real-time data and communication protocol messages in a dedicated memory protection area that has been pre-hard isolated.
[0044] After the system rollback is complete and the business session connection is restored, the temporary data temporarily stored in the memory protection area will be automatically written back and synchronized to the newly mounted kernel business stream.
[0045] This invention also provides an automated hierarchical kernel pruning system for shipboard scenarios, comprising:
[0046] The association graph construction module is used to obtain the initial kernel modules of the ship intelligent computing center server. It constructs a weighted directed acyclic graph as the association graph of the kernel modules through full module parsing. The nodes of the weighted directed acyclic graph are the initial kernel modules, the directed edges are the dependencies between modules, and the edge weights are the degree of module association.
[0047] The three-level progressive pruning module is used to perform a three-level progressive hierarchical pruning on the initial kernel module based on the weighted directed acyclic graph. The three-level progressive hierarchical pruning includes, in sequence, the system base layer retention pruning, the ship-end business layer adaptation pruning, and the redundant module elimination pruning. In the redundant module elimination pruning, for nodes determined to be suspected redundant modules, a comprehensive arbitration score is calculated based on the module correlation tightness, and a retention or elimination operation is performed according to the comprehensive arbitration score to obtain the target kernel module set.
[0048] An automatic configuration compilation module is used to generate a customized configuration file based on the target kernel module set, and to perform automatic compilation according to the customized configuration file to obtain an initial kernel image;
[0049] The physical scene simulation module is used to perform fully automated functional verification of the initial kernel image. The fully automated functional verification includes injecting specific test parameters to simulate network link degradation, hardware load fluctuations and electromagnetic interference phenomena in the physical scene at the ship's end. After the verification is passed, the initial kernel image is determined as the target kernel image.
[0050] The intelligent graded rollback module is used to deploy the target kernel image and continuously collect operation logs. When an operation anomaly is detected, the module automatically classifies the error based on the parsing results of the error signature codes in the operation logs, and triggers the corresponding graded rollback mechanism according to the classification results. The graded rollback mechanism caches real-time business data through a memory protection zone when performing the rollback.
[0051] The beneficial effects of this invention are as follows:
[0052] This invention provides an automated hierarchical kernel pruning method and system for shipboard scenarios. It constructs a weighted directed acyclic graph (DAG) with varying degrees of correlation in S1 for module correlation awareness, and introduces a three-level progressive hierarchical kernel pruning method and a comprehensive arbitration score mechanism based on module hierarchy and correlation weights in S2. This transforms abstract dependencies into quantifiable arbitration score indicators (and in some embodiments, further into multi-factor quantification model formulas). This comprehensive arbitration score-based adjudication mechanism enables precise retention / removal decisions for "suspected redundant modules" through comprehensive arbitration scores, verifying module dependencies throughout the pruning process. This hierarchical and correlation-aware processing method achieves the orderly advancement of core protection, business adaptation, and redundancy removal. It not only prioritizes the retention of basic system functions and core shipboard business modules (specifically retaining AIS services, Web services, virtualization technologies, etc.) and completely eliminates non-shipboard redundant modules and dedicated drivers, but also avoids the risk of over-pruning from the underlying layer. This effectively avoids driver conflicts and functional abnormalities caused by disrupting module dependency chains. It also solves the problem that existing technologies (such as traditional Buildroot or tools that simply check call counts) use a "one-size-fits-all" flat approach, which easily disrupts hidden dependency chains and leads to system crashes. While ensuring high kernel compatibility, it balances kernel simplification with operational stability, achieves system resource compression optimization, memory optimization of up to 7%, and significantly improves the response speed of ship operations.
[0053] By injecting electromagnetic interference test parameters such as network link degradation (e.g., 0.5%–5% packet loss rate), hardware load fluctuations (e.g., 10%–80% CPU spikes), and periodic network card disconnections into S4, the harsh physical environment of the open ocean is transformed into a computer-recognizable "code-level simulation stress injection." The target kernel image, rigorously simulated and verified, can readily handle satellite signal attenuation at sea, sudden changes in computing power caused by severe shipboard rolling, and electromagnetic disconnections caused by high salinity and humidity, significantly improving the high reliability of the intelligent computing center during real ocean voyages. This solves the problem that existing kernel verification systems typically only verify software functionality in greenhouse-like virtual machines, leading to system crashes when facing harsh sea conditions after deployment on board.
[0054] By employing a tiered rollback mechanism in S5 that automatically classifies and triggers errors based on specific error signature codes in the runtime logs (such as warning, unable, and kernel panic), along with a corresponding memory protection zone caching mechanism, intelligent three-dimensional fault tolerance is achieved. It accurately rolls back to the nearest safe snapshot node based on minor, medium, or severe errors, significantly shortening fault recovery time. Furthermore, in the critical moment of kernel hot switching, the system safely caches real-time business messages (such as ship-shore collaborative data) being sent and received through a hard-isolated "memory protection zone," seamlessly writing them back after the new kernel is started. This mechanism achieves system self-healing while absolutely guaranteeing "zero loss and uninterrupted connection" of lifeline ship data, solving the problem that in existing technologies, when kernel compilation or runtime errors occur, a complete overhaul is usually necessary, and system restarts can cause severe business interruptions.
[0055] Furthermore, this invention automates the entire process from module parsing, hierarchical trimming, configuration compilation to verification and deployment, effectively replacing the tedious customization and trimming process that relies on manual selection of configuration items and parameter tuning. This significantly reduces labor costs and fundamentally avoids human error. Full-process automation improves trimming efficiency and significantly reduces maintenance costs. Attached Figure Description
[0056] Figure 1 This is a core flowchart of an automated hierarchical kernel trimming method for shipboard scenarios provided in an embodiment of the present invention.
[0057] Figure 2 This is a schematic diagram of the kernel module association graph (weighted directed acyclic graph) structure provided in an embodiment of the present invention. Figure 3 This is a schematic diagram of a fully automated functional verification framework provided in an embodiment of the present invention.
[0058] Figure 4 This is a hardware device architecture diagram of a kernel trimming system provided in an embodiment of the present invention. Detailed Implementation
[0059] To make the objectives, technical solutions, and advantages of this invention clearer, the following detailed description, in conjunction with the accompanying drawings and specific embodiments, provides a further detailed explanation of an automated hierarchical kernel trimming method and system for shipboard scenarios proposed by this invention. The advantages and features of this invention will become clearer from the following description. It should be noted that the accompanying drawings are in a very simplified form and use non-precise proportions, used only to facilitate and clearly illustrate the purpose of the embodiments of this invention. Please refer to the accompanying drawings to make the objectives, features, and advantages of this invention more apparent and understandable. It should be understood that the structures, proportions, sizes, etc., depicted in the accompanying drawings are only used to complement the content disclosed in the specification, for those skilled in the art to understand and read, and are not intended to limit the implementation conditions of this invention. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportional relationships, or adjustments to the size, without affecting the effects and objectives achieved by this invention, should still fall within the scope of the technical content disclosed in this invention.
[0060] This invention provides an automated hierarchical kernel pruning method for shipboard scenarios, comprising the following steps:
[0061] S1: Constructing a relational graph: Obtain the initial kernel module of the ship intelligent computing center server, and construct a weighted directed acyclic graph as the relational graph of the kernel module through full module parsing. The nodes of the weighted directed acyclic graph are the initial kernel modules, the directed edges are the dependencies between modules, and the edge weights are the degree of module association.
[0062] S2: Three-level progressive pruning: Based on the weighted directed acyclic graph, a three-level progressive hierarchical pruning is performed on the initial kernel module. The three-level progressive hierarchical pruning includes, in sequence, the system base layer retention pruning, the ship-end business layer adaptation pruning, and the redundant module elimination pruning. In the redundant module elimination pruning, for nodes determined to be suspected redundant modules, a comprehensive arbitration score is calculated based on the module correlation tightness, and a retention or elimination operation is performed according to the comprehensive arbitration score to obtain the target kernel module set.
[0063] S3: Automatic configuration and compilation: Generate a customized configuration file based on the target kernel module set, and perform automatic compilation according to the customized configuration file to obtain the initial kernel image;
[0064] S4: Physical Scene Simulation: Perform fully automated functional verification on the initial kernel image. The fully automated functional verification includes injecting specific test parameters to simulate network link degradation, hardware load fluctuations and electromagnetic interference phenomena in the physical scene at the ship's end. After the verification is passed, the initial kernel image is determined as the target kernel image.
[0065] S5: Intelligent graded rollback: Deploy the target kernel image and continuously collect operation logs; when an operation anomaly is detected, automatically classify the error based on the parsing results of the error signature codes in the operation logs, and trigger the corresponding graded rollback mechanism according to the classification results. The graded rollback mechanism caches real-time business data through a memory protection zone when performing the rollback.
[0066] In some embodiments of the present invention, the formula for quantifying the degree of correlation W of the modules using a multi-factor weighted model in step S1 is as follows:
[0067] ,
[0068] Where F represents the frequency of inter-module dependency calls per unit time, and its form is as follows: , This represents the number of times each module pair is invoked during the test period. This represents the maximum number of calls for all modules. This is the time percentage coefficient, and its form is as follows: , This represents the cumulative duration during which both modules are simultaneously in a loading state. Total kernel runtime; The module hierarchy coefficients are the module hierarchy coefficients corresponding to the system base layer module, the shipboard business layer module, and the redundant module elimination and trimming layer module. The preset values are 1, 0.7, and 0.3 respectively; , , These are the preset weighting coefficients, and are set to 0.4, 0.3, and 0.3 respectively.
[0069] In some embodiments of the present invention, step S2, wherein the method for calculating the comprehensive arbitration score based on the degree of module correlation includes:
[0070] Based on formula The linear normalized mapping value is calculated. ,in and These represent the minimum and maximum values of the range of module correlation in the weighted directed acyclic graph, respectively.
[0071] The system base layer, the shipboard business layer, and the redundant module elimination and trimming layer are assigned corresponding level scores based on the level of the initial kernel module node. The level scores are preset to 100 points, 80 points, and 50 points, respectively.
[0072] Based on the business association attributes corresponding to the initial kernel module node, a corresponding business priority score is assigned. The business priority scores of the core business association module and the basic service module are preset to 100 points and 80 points, respectively.
[0073] Based on formula The comprehensive arbitration score S is calculated.
[0074] In some embodiments of the present invention, the step of performing a retention or elimination operation based on the comprehensive arbitration score when a module association conflict occurs includes:
[0075] Compare the overall arbitration scores S of multiple initial kernel modules that have resource contention or circular dependency conflicts. In the compilation configuration, retain the module with the higher overall arbitration score S and delete the module with the lower score. If the overall arbitration scores S of the conflicting modules are the same, prioritize retaining the module located in the system base layer. If they are at the same level, retain the module with the higher degree of correlation S.
[0076] In some embodiments of the present invention, step S2, the method for performing retention or removal operations on nodes determined to be suspected redundant modules, includes:
[0077] Traverse the weighted directed acyclic graph. If there is no directed edge connection between the suspected redundant module and all ship-side dedicated business module nodes in the system, it is directly determined as an invalid redundant module and the removal operation is performed.
[0078] If a related link exists, it will be determined based on the degree of module correlation between it and the corresponding core business module. Perform interval division determination:
[0079] When the modules are closely related When the value is less than 0.2, it is determined to be a weakly correlated redundancy, and the deletion operation is performed directly.
[0080] When the modules are closely related When the value is between 0.2 and 0.5, the verification phase begins. The core business load is simulated. If the core business operates normally after the module is removed, it is deleted; otherwise, it is retained.
[0081] When the modules are closely related If the value is not lower than 0.5, it is determined to be a non-redundant module and is retained.
[0082] In some embodiments of the present invention, in step S3, the customized configuration file is a .config configuration file, and the specific steps of automatic configuration compilation include: automatically matching the kernel configuration item parameters corresponding to each module in the target kernel module set through the automatic configuration engine, automatically generating the customized configuration file in combination with the ARM / aarch64 or x86_64 hardware architecture of the ship intelligent computing center server, and importing the customized configuration file into a preset cross-compilation environment to automatically compile and generate kernel image files, module files and startup configuration files.
[0083] In some embodiments of the present invention, step S4, the method for simulating network link degradation, hardware load fluctuations, and electromagnetic interference phenomena in the physical scenario at the ship's end, includes:
[0084] Using the flow control tool tc and its netem module, a random packet loss rate of 0.5% to 5% and a delay parameter of 50ms to 200ms with a jitter of ±30ms are automatically injected to simulate network link degradation.
[0085] The stress testing tool stress-ng was used to dynamically control the processor load rate to vary between 10% and 80% and the memory usage rate to vary between 20% and 70% at random time intervals to simulate hardware load fluctuations.
[0086] Periodically control the unexpected shutdown and recovery of the network interface, or inject system interrupt commands to simulate abnormal module communication under electromagnetic interference.
[0087] In some embodiments of the present invention, the step of automatically classifying errors based on the parsing results of error signature codes in the operation log and triggering a corresponding graded rollback mechanism includes:
[0088] The system analyzes the dmesg runtime log. When it detects a signature containing warning or failed, it determines it to be a minor error. The system restores the configuration from the most recent hierarchical snapshot, fine-tunes the parameters, and then recompiles and verifies.
[0089] When a feature code containing "unable" or "error" is detected, it is determined to be a moderate error. The system automatically rolls back to the snapshot after the corresponding level of pruning is completed, restores the original topology state, and re-executes the pruning process.
[0090] When compilation failure information is extracted during the compilation phase, or when the signature of a kernel panic or bug is detected after the system is replaced and started, it is determined to be a serious error, and the system directly rolls back to the baseline snapshot after initialization and restarts.
[0091] In some embodiments of the present invention, step S5, wherein caching real-time business data through a memory protection zone includes:
[0092] Before triggering the rollback operation, a status snapshot of the current core business operation is automatically generated and synchronously stored in the ship's local cache with power failure protection and the shore-based backup node;
[0093] During kernel switching or rebooting, the memory cache protection mechanism is automatically enabled to temporarily cache newly generated real-time data and communication protocol messages in a dedicated memory protection area that has been pre-hard isolated.
[0094] After the system rollback is complete and the business session connection is restored, the temporary data temporarily stored in the memory protection area will be automatically written back and synchronized to the newly mounted kernel business stream.
[0095] This invention also provides an automated hierarchical kernel pruning system for shipboard scenarios, comprising:
[0096] The association graph construction module is used to obtain the initial kernel modules of the ship intelligent computing center server. It constructs a weighted directed acyclic graph as the association graph of the kernel modules through full module parsing. The nodes of the weighted directed acyclic graph are the initial kernel modules, the directed edges are the dependencies between modules, and the edge weights are the degree of module association.
[0097] The three-level progressive pruning module is used to perform a three-level progressive hierarchical pruning on the initial kernel module based on the weighted directed acyclic graph. The three-level progressive hierarchical pruning includes, in sequence, the system base layer retention pruning, the ship-end business layer adaptation pruning, and the redundant module elimination pruning. In the redundant module elimination pruning, for nodes determined to be suspected redundant modules, a comprehensive arbitration score is calculated based on the module correlation tightness, and a retention or elimination operation is performed according to the comprehensive arbitration score to obtain the target kernel module set.
[0098] An automatic configuration compilation module is used to generate a customized configuration file based on the target kernel module set, and to perform automatic compilation according to the customized configuration file to obtain an initial kernel image;
[0099] The physical scene simulation module is used to perform fully automated functional verification of the initial kernel image. The fully automated functional verification includes injecting specific test parameters to simulate network link degradation, hardware load fluctuations and electromagnetic interference phenomena in the physical scene at the ship's end. After the verification is passed, the initial kernel image is determined as the target kernel image.
[0100] The intelligent graded rollback module is used to deploy the target kernel image and continuously collect operation logs. When an operation anomaly is detected, the module automatically classifies the error based on the parsing results of the error signature codes in the operation logs, and triggers the corresponding graded rollback mechanism according to the classification results. The graded rollback mechanism caches real-time business data through a memory protection zone when performing the rollback.
[0101] Corresponding to the automated hierarchical kernel pruning method for ship-side scenarios provided by this invention, such as Figure 4 The kernel trimming system hardware architecture diagram shown includes the following hardware computing devices for method operation and system deployment: Kernel compilation computing device: equipped with a high-performance central processing unit and main storage unit, supporting parallel compilation and multi-platform cross-compilation, and having the ability to capture and collect errors during the compilation process, and installing the basic system environment; Cloud server: supporting network access and file upload functions of the kernel compilation computing device, and automatically uploading system snapshots during the trimming process to the corresponding cloud server for off-site archiving.
[0102] With the support of the aforementioned hardware architecture, an automated hierarchical kernel pruning method for shipboard scenarios, such as... Figure 1The core flowchart of the method shown includes the following steps: S1: Constructing a relational graph: Obtain the initial kernel modules of the ship intelligent computing center server, and construct a weighted directed acyclic graph (DAG) as the relational graph of the kernel modules through full module parsing. The nodes of the weighted DAG are the initial kernel modules, the directed edges are the dependencies between modules, and the edge weights are the degree of module correlation; S2: Three-level progressive pruning: Perform a three-level progressive hierarchical pruning on the initial kernel modules based on the weighted DAG. The three-level progressive hierarchical pruning includes, in sequence, system base layer retention pruning, ship-side business layer adaptation pruning, and redundant module elimination pruning; In the redundant module elimination pruning, for nodes determined to be suspected redundant modules, a comprehensive arbitration score is calculated based on the degree of module correlation, and retention or elimination operations are performed according to the comprehensive arbitration score to obtain the target kernel module set; S 3. Automatic Configuration and Compilation: Generate a customized configuration file based on the target kernel module set, and perform automated compilation according to the customized configuration file to obtain an initial kernel image; S4. Physical Scene Simulation: Perform full-process automated functional verification on the initial kernel image. The full-process automated functional verification includes injecting specific test parameters to simulate network link degradation, hardware load fluctuations, and electromagnetic interference phenomena in the ship's physical scene. After successful verification, the initial kernel image is determined as the target kernel image; S5. Intelligent Hierarchical Rollback: Deploy the target kernel image and continuously collect operation logs. When an operational anomaly is detected, automatically classify the error based on the parsing results of the error signature codes in the operation logs, and trigger the corresponding hierarchical rollback mechanism according to the classification results. The hierarchical rollback mechanism caches real-time business data through a memory protection zone during rollback. In summary, this includes kernel module parsing and basic resource construction; three-level progressive hierarchical kernel trimming; customized kernel configuration and automated compilation; full-process automated functional verification; automated deployment, operation monitoring, and hierarchical rollback; iterative optimization and data archiving.
[0103] Furthermore, the specific steps for kernel module parsing and basic resource construction are as follows: Perform full module parsing of the ship intelligent computing center server operating system kernel, analyze the functional attributes of each module, and clarify the positive dependencies, reverse associations, and collaborative relationships between modules; combined with... Figure 2The diagram shows the kernel module association graph structure. A weighted directed acyclic graph (DAG) is constructed, and the strength and influence range of directed edges for each node (module) in the graph are marked. Based on the core business needs of the ship intelligent computing center, a list of ship-side business modules is compiled, clarifying the categories of core modules such as basic system operation modules, ship-side dedicated business modules, and basic service modules, as well as redundant module categories such as manufacturer-specific drivers, non-ship-side peripheral drivers, and desktop redundant function modules, defining the pruning boundaries. After module parsing and list compilation are completed, a baseline snapshot is automatically generated, archiving the current kernel module list, association graph, initial configuration files, and other core information, synchronously stored on the ship-side local storage and shore-based backup nodes, providing data support for subsequent rollback operations.
[0104] Furthermore, the specific steps of the three-level progressive hierarchical kernel trimming are as follows: 1. Based on the constructed kernel module association graph and the ship-side business module list, automated trimming is carried out from bottom to top in a three-level hierarchy of "system foundation layer - ship-side business layer - redundancy removal layer", with a module association verification mechanism embedded throughout the process; The first level is the system foundation layer retention trimming: priority is given to retaining basic core modules such as CPU optimization, memory management, process scheduling, file system core, and general driver framework. Redundant modules that have no association with the foundation layer modules are removed through module association graph verification to avoid mistakenly trimming the dependent modules of the foundation layer modules. After trimming, a snapshot is generated and archived; The second level is the ship-side business layer adaptation trimming: AIS service support module, ship-shore communication protocol module, etc. are retained. The core business modules, such as the virtualization technology support module, web service module, and network security module, are analyzed using module association graphs to determine their dependency chains. This automatically completes the necessary related modules for the operation of each business module, eliminates unnecessary modules unrelated to shipboard business, and optimizes the operational configuration of each business module. After the trimming is complete, a snapshot is generated and archived. The third level involves the complete elimination of redundant modules: For redundant modules such as manufacturer-specific drivers, non-shipboard peripheral drivers, desktop graphical drivers, redundant debugging modules, and non-shipboard protocol stack modules, after confirming through module association graphs that they have no core module dependencies, they are completely eliminated. Suspected redundant modules with potential association risks are temporarily left for verification and further confirmation. After the trimming is complete, a snapshot is generated and archived.
[0105] Furthermore, the specific steps for customized kernel configuration and automated compilation are as follows: Based on the target kernel module set after three-level trimming, the kernel configuration items (CONFIG_* parameters) corresponding to each module are parsed through the automated configuration engine. Combined with the hardware architecture of the ship intelligent computing center server (such as ARM / aarch64, x86_64), a customized .config configuration file is automatically generated to replace the traditional manual configuration method. The customized configuration file is imported into the preset kernel compilation environment, and the cross-compilation tool is called to carry out automated compilation, generating kernel image files, module files, and startup configuration files. Before compilation, a snapshot is automatically generated and archived. During the compilation process, the module compilation status is monitored in real time, and compilation logs are recorded. If problems such as module association conflicts or compilation failures occur, a rollback mechanism is automatically triggered to backtrack to the corresponding node, adjust the trimming strategy, and re-execute the trimming and compilation process.
[0106] Furthermore, such as Figure 3 The diagram illustrates the fully automated functional verification framework. The specific steps of the fully automated functional verification are as follows: Functional Verification Phase: A simulation test environment for the ship's intelligent computing center is built to automatically simulate the system's basic operating state (CPU, memory, file system operation) and core business operation processes (AIS data transmission and reception, Web service access, virtualization instance deployment). This checks whether the kernel supports the full-process operation of all core functions, confirms no functional deficiencies, and verifies the thoroughness of redundant module removal. Compatibility Verification Phase: Based on the module association graph, the collaborative operating state between kernel modules is automatically detected, verifying the relationship between basic layer modules and business layer modules, and between the kernel and ship-side hardware (edge computing nodes, sensor modules). The process involves several steps: First, ensuring the kernel's adaptability to various components (e.g., driver conflicts, resource contention). Second, verifying its stability by simulating hardware fluctuations, electromagnetic interference, and service switching scenarios under complex sea conditions. This involves running the kernel continuously for a preset duration and automatically monitoring its fault-free runtime, abnormal restart count, and resource usage fluctuations. Upon successful verification, a verification report is generated and a snapshot is archived. If verification fails, the fault log is used to locate the problem. If there is excessive trimming or related conflicts, the process is traced back to the three-level progressive trimming steps to adjust the trimming strategy. If there are configuration errors, the process is traced back to the customized kernel configuration and automated compilation steps to optimize the configuration file. If basic functions fail, the process is traced back to the kernel module parsing and basic resource construction steps to rebuild the basic resources.
[0107] Furthermore, the specific steps for automated deployment, operational monitoring, and tiered rollback are as follows: 1. Using snapshot technology, automatically push the verified kernel image file, module files, and boot configuration files to the backup server, then update the GRUB boot entry of this system to complete kernel replacement and boot; 2. After deployment, start the real-time operational monitoring module to continuously collect kernel running status, resource utilization, and core business operation data, providing a basis for subsequent iterative optimization; 3. Establish a tiered rollback mechanism: Snapshot backups for critical nodes are automatically generated and archived after initialization, after each level of trimming, before compilation, and after verification; for minor errors (single redundant module not removed, configuration parameter deviation), restore the configuration from the most recent snapshot, adjust only the corresponding module or parameter, and re-execute compilation and verification; for moderate errors (few... For errors such as incorrect trimming of core modules or missing dependencies of business modules, the system reverts to the snapshot after trimming at the corresponding level, restores the module list and relationship graph, and re-executes the subsequent trimming, compilation, and verification processes. For severe errors (over-trimming causing the system's basic functions to fail or the kernel to fail to start), the system directly reverts to the baseline snapshot after initialization, restores the original kernel module set and basic configuration, and restarts the entire trimming process. If an abnormal kernel operation is detected after deployment, an emergency rollback mechanism is immediately triggered, automatically stopping the current kernel operation, loading the previously verified kernel version and corresponding configuration, quickly restoring business operation, and simultaneously extracting the abnormal logs and the current trimming configuration, synchronizing them to the cloud server to analyze the cause of the error. Each rollback operation is automatically logged, including information such as error type, rollback level, snapshot version, and recovery time.
[0108] Furthermore, the specific steps for iterative optimization and data archiving are as follows: comprehensively collect and archive information such as kernel running data, pruning rule parameters, rollback logs, and verification reports; combine the archived data to continuously optimize the accuracy of the kernel module association graph's relationship identification, adjust the filtering rules and parameter configurations for the three-level pruning, and optimize the snapshot backup strategy (such as the number of snapshots to retain and the storage period); through iterative data analysis, continuously improve the accuracy of module association identification, the rationality of the pruning strategy, and the efficiency of rollback, forming a complete closed loop of "pruning-verification-rollback-optimization," and continuously improving the adaptability and operational stability of the kernel and the ship intelligent computing center.
Claims
1. An automated hierarchical kernel pruning method for shipboard scenarios, characterized in that, Includes the following steps: S1: Constructing a relational graph: Obtain the initial kernel module of the ship intelligent computing center server, and construct a weighted directed acyclic graph as the relational graph of the kernel module through full module parsing. The nodes of the weighted directed acyclic graph are the initial kernel modules, the directed edges are the dependencies between modules, and the edge weights are the degree of module association. S2: Three-level progressive pruning: Based on the weighted directed acyclic graph, the initial kernel module is subjected to three-level progressive hierarchical pruning, which includes system base layer retention pruning, ship-end business layer adaptation pruning, and redundant module elimination pruning in sequence. In the redundant module elimination and pruning process, for nodes identified as suspected redundant modules, a comprehensive arbitration score is calculated based on the degree of module correlation, and a retention or elimination operation is performed according to the comprehensive arbitration score to obtain the target kernel module set; S3: Automatic configuration and compilation: Generate a customized configuration file based on the target kernel module set, and perform automatic compilation according to the customized configuration file to obtain the initial kernel image; S4: Physical Scene Simulation: Perform fully automated functional verification on the initial kernel image. The fully automated functional verification includes injecting specific test parameters to simulate network link degradation, hardware load fluctuations and electromagnetic interference phenomena in the physical scene at the ship's end. After the verification is passed, the initial kernel image is determined as the target kernel image. S5: Intelligent graded rollback: Deploy the target kernel image and continuously collect operation logs; when an operation anomaly is detected, automatically classify the error based on the parsing results of the error signature codes in the operation logs, and trigger the corresponding graded rollback mechanism according to the classification results. The graded rollback mechanism caches real-time business data through a memory protection zone when performing the rollback.
2. The automated hierarchical kernel pruning method for shipboard scenarios according to claim 1, characterized in that, In step S1, the formula for quantifying the degree of correlation W of the modules using a multi-factor weighted model is as follows: , Where F represents the frequency of inter-module dependency calls per unit time, and its form is as follows: , This represents the number of times each module pair is invoked during the test period. This represents the maximum number of calls for all modules. This is the time percentage coefficient, and its form is as follows: , This represents the cumulative duration during which both modules are simultaneously in a loading state. Total kernel runtime; The module hierarchy coefficients are the module hierarchy coefficients corresponding to the system base layer module, the shipboard business layer module, and the redundant module elimination and trimming layer module. The preset values are 1, 0.7, and 0.3 respectively; , , These are the preset weighting coefficients, and are set to 0.4, 0.3, and 0.3 respectively.
3. The automated hierarchical kernel pruning method for shipboard scenarios according to claim 1, characterized in that, In step S2, the method for calculating the comprehensive arbitration score based on the degree of module correlation includes: Based on formula The linear normalized mapping value is calculated. ,in and These represent the minimum and maximum values of the range of module correlation in the weighted directed acyclic graph, respectively. The system base layer, the shipboard business layer, and the redundant module elimination and trimming layer are assigned corresponding level scores based on the level of the initial kernel module node. The level scores are preset to 100 points, 80 points, and 50 points, respectively. Based on the business association attributes corresponding to the initial kernel module node, a corresponding business priority score is assigned. The business priority scores of the core business association module and the basic service module are preset to 100 points and 80 points, respectively. Based on formula The comprehensive arbitration score S is calculated.
4. The automated hierarchical kernel pruning method for shipboard scenarios according to claim 3, characterized in that, When a module association conflict occurs, the retention or removal operation is performed based on the comprehensive arbitration score, including: Compare the overall arbitration scores S of multiple initial kernel modules that have resource contention or circular dependency conflicts. In the compilation configuration, retain the module with the higher overall arbitration score S and delete the module with the lower score. If the overall arbitration scores S of the conflicting modules are the same, prioritize retaining the module located in the system base layer. If they are at the same level, retain the module with the higher degree of correlation S.
5. The automated hierarchical kernel pruning method for shipboard scenarios according to claim 1, characterized in that, In step S2, the method for performing retention or removal operations on nodes identified as suspected redundant modules includes: Traverse the weighted directed acyclic graph. If there is no directed edge connection between the suspected redundant module and all ship-side dedicated business module nodes in the system, it is directly determined as an invalid redundant module and the removal operation is performed. If a related link exists, it will be determined based on the degree of module correlation between it and the corresponding core business module. Perform interval division determination: When the modules are closely related When the value is less than 0.2, it is determined to be a weakly correlated redundancy, and the deletion operation is performed directly. When the modules are closely related When the value is between 0.2 and 0.5, the verification phase begins. The core business load is simulated. If the core business operates normally after the module is removed, it is deleted; otherwise, it is retained. When the modules are closely related If the value is not lower than 0.5, it is determined to be a non-redundant module and is retained.
6. The automated hierarchical kernel pruning method for shipboard scenarios according to claim 1, characterized in that, In step S3, the customized configuration file is a .config configuration file. The specific steps of the automatic configuration compilation include: automatically matching the kernel configuration item parameters corresponding to each module in the target kernel module set through the automatic configuration engine, automatically generating the customized configuration file in combination with the ARM / aarch64 or x86_64 hardware architecture of the ship intelligent computing center server, and importing the customized configuration file into the preset cross-compilation environment to automatically compile and generate kernel image files, module files and startup configuration files.
7. The automated hierarchical kernel pruning method for shipboard scenarios according to claim 1, characterized in that, In step S4, the method for simulating network link degradation, hardware load fluctuations, and electromagnetic interference phenomena in the physical scenario at the ship's end includes: Using the flow control tool tc and its netem module, a random packet loss rate of 0.5% to 5% and a delay parameter of 50ms to 200ms with a jitter of ±30ms are automatically injected to simulate network link degradation. The stress testing tool stress-ng was used to dynamically control the processor load rate to vary between 10% and 80% and the memory usage rate to vary between 20% and 70% at random time intervals to simulate hardware load fluctuations. Periodically control the unexpected shutdown and recovery of the network interface, or inject system interrupt commands to simulate abnormal module communication under electromagnetic interference.
8. The automated hierarchical kernel pruning method for shipboard scenarios according to claim 1, characterized in that, In step S5, the automatic error classification based on the parsing results of the error signature codes in the operation log, and the triggering of the corresponding graded rollback mechanism, includes: The system analyzes the dmesg runtime log. When it detects a signature containing warning or failed, it determines it to be a minor error. The system restores the configuration from the most recent hierarchical snapshot, fine-tunes the parameters, and then recompiles and verifies. When a feature code containing "unable" or "error" is detected, it is determined to be a moderate error. The system automatically rolls back to the snapshot after the corresponding level of pruning is completed, restores the original topology state, and re-executes the pruning process. When compilation failure information is extracted during the compilation phase, or when the signature of a kernel panic or bug is detected after the system is replaced and started, it is determined to be a serious error, and the system directly rolls back to the baseline snapshot after initialization and starts again.
9. The automated hierarchical kernel pruning method for shipboard scenarios according to claim 1, characterized in that, In step S5, caching real-time business data through the memory protection zone includes: Before triggering the rollback operation, a status snapshot of the current core business operation is automatically generated and synchronously stored in the ship's local cache with power failure protection and the shore-based backup node; During kernel switching or rebooting, the memory cache protection mechanism is automatically enabled to temporarily cache newly generated real-time data and communication protocol messages in a dedicated memory protection area that has been pre-hard isolated. After the system rollback is complete and the business session connection is restored, the temporary data temporarily stored in the memory protection area will be automatically written back and synchronized to the newly mounted kernel business stream.
10. An automated hierarchical kernel pruning system for shipboard scenarios, characterized in that, include: The association graph construction module is used to obtain the initial kernel modules of the ship intelligent computing center server. It constructs a weighted directed acyclic graph as the association graph of the kernel modules through full module parsing. The nodes of the weighted directed acyclic graph are the initial kernel modules, the directed edges are the dependencies between modules, and the edge weights are the degree of module association. The three-level progressive pruning module is used to perform three-level progressive hierarchical pruning on the initial kernel module based on the weighted directed acyclic graph. The three-level progressive hierarchical pruning includes, in sequence, system base layer retention pruning, ship-end business layer adaptation pruning, and redundant module elimination pruning. In the redundant module elimination and pruning process, for nodes identified as suspected redundant modules, a comprehensive arbitration score is calculated based on the degree of module correlation, and a retention or elimination operation is performed according to the comprehensive arbitration score to obtain the target kernel module set; An automatic configuration compilation module is used to generate a customized configuration file based on the target kernel module set, and to perform automatic compilation according to the customized configuration file to obtain an initial kernel image; The physical scene simulation module is used to perform fully automated functional verification of the initial kernel image. The fully automated functional verification includes injecting specific test parameters to simulate network link degradation, hardware load fluctuations and electromagnetic interference phenomena in the physical scene at the ship's end. After the verification is passed, the initial kernel image is determined as the target kernel image. The intelligent graded rollback module is used to deploy the target kernel image and continuously collect operation logs. When an operation anomaly is detected, the module automatically classifies the error based on the parsing results of the error signature codes in the operation logs, and triggers the corresponding graded rollback mechanism according to the classification results. The graded rollback mechanism caches real-time business data through a memory protection zone when performing the rollback.