Method and device for realizing automatic cutting of system kernel, product and medium

Automatically detect external interface status and dynamically adjust driver registration through the BootLoader program, solving the problem of drivers still after hardware is unplugged in embedded systems, realizing automatic cutting of system kernels, improving efficiency and power consumption management, and suitable for diversification embedded application scenarios.

CN119311326APending Publication Date: 2025-01-14西安超越申泰信息科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411424920.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

In the prior art, when the hardware peripherals are unplugged for embedded systems, peripheral drivers still exist, resulting in waste of power consumption and it is difficult to achieve flexible software and hardware cutting to meet the needs of different application scenarios.

Method used

The BootLoader program automatically detects the access status of the external interface, updates the configuration files dynamically, decides whether to register the interface driver, and redistributes resources in the kernel state to realize automatic cropping of the system kernel.

Benefits of technology

It effectively avoids power consumption waste, improves kernel development efficiency, reduces CPU usage, and achieves the best utilization rate and smooth operation of system resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119311326A_ABST
    Figure CN119311326A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses a method and a device for realizing automatic cutting of a system kernel, a product and a medium. According to the invention, the bottom bootstrap program can automatically detect the access condition of the peripheral component and then decide whether to register and load the peripheral driver, and meanwhile, the peripheral interface configuration file can be accessed in the kernel stage, so that the kernel driver can be cut and optimized to the maximum extent; by means of the function, complex manual operation can be effectively reduced, CPU power consumption can be well reduced, system operation can be smoother, and the general trend of low power consumption in the embedded field is positively complied with.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and for example, to a method, device, product and medium for implementing automatic tailoring of a system kernel. Background Art

[0002] Embedded systems are application-centric, based on modern computer technology, and can flexibly tailor software and hardware modules according to user needs, such as functionality, reliability, cost, size, power consumption, environment, etc. Embedded systems have the characteristics of software and hardware customization. Embedded systems target so many application scenarios and bring about extremely different design index requirements (functional performance, reliability, cost, power consumption), so that it is difficult to have a set of solutions to meet all system requirements in reality. Therefore, according to different needs, flexibly tailoring software and hardware and building a final system that meets the requirements is an inevitable technical route for the development of embedded technology.

[0003] In the process of implementing the embodiments of the present disclosure, it is found that there are at least the following problems in the related art:

[0004] At present, the device tree file is directly modified according to the actual access situation of the hardware peripherals, which is a one-time action. However, in the actual process, there is a possibility of unplugging a certain device. In this case, the peripheral driver is still running, resulting in a waste of some power consumption. The present invention can realize the dynamic opening and closing of the peripherals, which can better avoid this problem.

[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0006] In order to provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not an extensive review, nor is it intended to identify key / critical components or delineate the scope of protection of these embodiments, but rather serves as a prelude to the detailed description that follows.

[0007] The embodiments of the present disclosure provide a method, device, product and medium for realizing automatic tailoring of the system kernel, so as to solve the technical problem that the existing tailoring method does not connect to peripherals but the interface driver still exists, which greatly improves the kernel development efficiency, reduces the CPU usage and also greatly reduces the system power consumption.

[0008] In some embodiments, the method comprises:

[0009] S01, after power-on, the CPU starts at the external flash and loads the BootLoader program in the external flash. When the BootLoader program is executed, it automatically detects the access status of the external interface through the interface detection circuit and updates this status to the configuration file. The interface driver file obtains the latest status information of each interface in the configuration file, and decides whether to register the interface driver according to the latest status information of each interface, and the CPU resources are reallocated;

[0010] S02, after being guided by the BootLoader program, it enters the kernel loading stage. The device description file monitors the feedback level of the interface detection circuit in real time, and passes the feedback level to the registration function of the kernel driver. In the kernel state, it is determined again whether to continue to load such drivers. The CPU reallocates resources according to the final driver loading situation and officially loads the system files.

[0011] S03. Enter the operating system normally after loading rootfs.

[0012] Furthermore, an interface detection circuit is added to each interface circuit of the CPU. In the default state, the interface detection circuit feedback level is a high level. When the external interface is inserted, the interface detection circuit feedback level is a low level. The actual access status of the external interface is reflected in the form of high / low level feedback from the interface detection circuit.

[0013] Furthermore, in step S02, the device description file is a .dts file, and the registration function is a probe function.

[0014] Furthermore, in step S01, registration interface drivers of power supply, clock, memory, and external general interface are performed.

[0015] Furthermore, in step S02, the pruned device tree file is transferred to the kernel loading stage for pruning and registering the peripheral driver.

[0016] Furthermore, the method is used in embedded systems.

[0017] In some embodiments, the device includes a processor and a memory storing program instructions, and the processor is configured to execute the aforementioned method for realizing automatic system kernel trimming when running the program instructions.

[0018] In some embodiments, the intelligent terminal product is a computer, a mobile phone or a tablet computer, and the aforementioned device for realizing automatic cutting of the system kernel is installed in the product body.

[0019] In some embodiments, the storage medium stores program instructions, and when the program instructions are run, the aforementioned method for realizing automatic trimming of the system kernel is executed.

[0020] The method, device, product and medium for realizing automatic system kernel tailoring provided by the embodiments of the present disclosure can achieve the following technical effects: The invention mainly optimizes the current embedded system driver loading. It can decide whether to register and load the interface driver according to the actual access status of the external interface device. This operation can achieve the best system kernel tailoring, the best system resource utilization, and the smoothest system operation, and can be applied to various complex application scenarios.

[0021] The above general description and the following description are exemplary and explanatory only and are not intended to limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] One or more embodiments are exemplarily described by corresponding drawings, which do not limit the embodiments. Elements with the same reference numerals in the drawings are shown as similar elements, and the drawings do not constitute a scale limitation, and wherein:

[0023] Figure 1 is a flow chart of the method described in Example 1;

[0024] Figure 2 Schematic diagram of the device described in Example 2. DETAILED DESCRIPTION

[0025] In order to be able to understand the features and technical contents of the embodiments of the present disclosure in more detail, the implementation of the embodiments of the present disclosure is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present disclosure. In the following technical description, for the convenience of explanation, a full understanding of the disclosed embodiments is provided through multiple details. However, one or more embodiments can still be implemented without these details. In other cases, to simplify the drawings, well-known structures and devices can be simplified for display.

[0026] The terms "first", "second", etc. in the embodiments of the present disclosure are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so as to describe the embodiments of the present disclosure described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.

[0027] Unless otherwise stated, the term "plurality" means two or more.

[0028] In the embodiment of the present disclosure, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B indicates: A or B.

[0029] The term "and / or" is a description of the association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B.

[0030] The term "correspondence" may refer to an association relationship or a binding relationship. The correspondence between A and B means that there is an association relationship or a binding relationship between A and B.

[0031] Example 1

[0032] This embodiment discloses a method for realizing automatic clipping of system content. Figure 1 As shown, the following steps are included:

[0033] S01. After power-on, the CPU starts at the external flash and loads the BootLoader program in the external flash. When the BootLoader program is executed, it automatically detects the access status of the external interface through the interface detection circuit and updates this status to the configuration file. The interface driver file obtains the latest status information of each interface in the configuration file, and decides whether to register the interface driver according to the latest status information of each interface, and the CPU resources are reallocated; this configuration file can be directly accessed in the kernel stage; in this embodiment, according to the level state fed back by the interface detection circuit, the status attribute of the interface in the device tree file is modified, and the status attribute (ok or disable) in the device tree file determines whether to load the peripheral driver. Specifically, the interface driver is registered when the external interface is detected to be inserted, and the interface driver is not registered when the external interface access is not detected.

[0034] S02, after being guided by the BootLoader program, the kernel loading stage is entered. The device description file monitors the feedback level of the interface detection circuit in real time, and passes the feedback level to the registration function of the kernel driver. In the kernel state, it is determined again whether to continue to load such drivers. The CPU reallocates resources according to the final driver loading situation, so that the kernel obtains the best optimization state and officially loads the system files;

[0035] S03. After loading rootfs, the operating system is entered normally. The kernel driver is optimally optimized under the system, the CPU usage is greatly reduced, and the system runs smoothly.

[0036] In this embodiment, an interface detection circuit is added to each interface circuit of the CPU. In the default state, the feedback level of the interface detection circuit is a high level. When the external interface is inserted, the feedback level of the interface detection circuit is a low level. The actual access status of the external interface is reflected in the form of a high / low level feedback from the interface detection circuit. The interface detection circuit is implemented in an existing manner.

[0037] In this embodiment, in step S02, the device description file is a .dts file, and the registration function is a probe function. The .dts file will pass some driver descriptions to the interface driver source file, and based on these descriptions, the probe function will decide whether to register these drivers, thereby achieving the expected function;

[0038] In this embodiment, step S01 registers interface drivers for power, clock, memory, and external general interfaces. Then the kernel program is loaded, and the trimmed device tree file is transferred to the kernel loading stage for trimming and registering peripheral drivers, so that there will be no situation where there are only drivers but no peripherals connected. In this way, the system kernel can be trimmed to the best, occupying the lowest system resources, and further loading the system file system, so that the embedded system runs more smoothly and efficiently.

[0039] In this embodiment, the method is used in an embedded system.

[0040] In step S02, the pruned device tree file is transferred to the kernel loading stage for peripheral driver pruning and registration. The interface configuration file is dynamically adjusted according to the external detection circuit. The device tree file reads the interface configuration file to dynamically adjust the status attribute of the interface description in the device tree file. After the adjustment, step S02 is performed.

[0041] The main innovation of this method is that the underlying boot program can automatically detect the access status of peripheral components, and then decide whether to register and load the peripheral driver, rather than whether the peripheral driver is enabled. At the same time, the kernel stage can also access the peripheral interface configuration file, so that the kernel driver can be maximized. Tailoring and optimization; this function can effectively reduce complex manual operations, can greatly reduce CPU power consumption, can make the system run more smoothly, and actively conform to the general trend of low power consumption in the embedded field.

[0042] Example 2

[0043] Combination Figure 2 As shown, the embodiment of the present disclosure provides a device 300 for realizing automatic tailoring of the system kernel, including a processor 304 and a memory 301. Optionally, the device may also include a communication interface 302 and a bus 303. Among them, the processor 304, the communication interface 302, and the memory 301 can communicate with each other through the bus 303. The communication interface 302 can be used for information transmission. The processor 304 can call the logic instructions in the memory 301 to execute X of the above embodiment.

[0044] In addition, the logic instructions in the memory 301 described above can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.

[0045] The memory 301 is a computer-readable storage medium that can be used to store software programs and computer executable programs, such as program instructions / modules corresponding to the method in the embodiment of the present disclosure. The processor 304 executes the function application and data processing by running the program instructions / modules stored in the memory 301, that is, the method for automatically cutting system content in the above embodiment is implemented.

[0046] The memory 301 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 301 may include a high-speed random access memory and may also include a non-volatile memory.

[0047] Example 3

[0048] The embodiments of the present disclosure provide a product (for example, a computer, a mobile phone, etc.), including: a product body, and the above-mentioned device for realizing automatic cropping of system content. The device for realizing automatic cropping of system content is installed in the product body. The installation relationship described here is not limited to placement inside the product, but also includes installation connections with other components of the product, including but not limited to physical connections, electrical connections, or signal transmission connections. It can be understood by those skilled in the art that the device for realizing automatic cropping of system content can be adapted to a feasible product body, thereby realizing other feasible embodiments.

[0049] Example 3

[0050] The embodiment of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured to execute the above-mentioned method for realizing automatic clipping of system content.

[0051] The computer-readable storage medium mentioned above may be a transient computer-readable storage medium or a non-transitory computer-readable storage medium.

[0052] The technical solution of the embodiment of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium and includes one or more instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiment of the present disclosure. The aforementioned storage medium may be a non-transient storage medium, including: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes, or a transient storage medium.

[0053] The above description and accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent possible changes only. Unless explicitly required, separate components and functions are optional, and the order of operation may vary. The parts and features of some embodiments may be included in or replace the parts and features of other embodiments. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the scope of protection. As used in the description in the text, unless the context clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of listings containing one or more associated ones. In addition, when used in the present application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of stated features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the presence of other identical elements in the process, method or device comprising the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.

[0054] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. The technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present disclosure. The technicians may clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.

[0055] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.

Claims

1. A method for realizing automatic cutting of a system kernel, characterized in that: The following steps are involved: S01. After power-on, the CPU starts at the external flash and loads the BootLoader program in the external flash. When the BootLoader program is executed, it automatically detects the access status of the external interface and updates the status to the configuration file. The interface driver file obtains the latest status information of each interface in the configuration file, and decides whether to register the interface driver according to the latest status information of each interface, and the CPU resources are reallocated. S02, after being guided by the BootLoader program, it enters the kernel loading stage. The device description file monitors the feedback level of the interface detection circuit in real time, and passes the feedback level to the registration function of the kernel driver. In the kernel state, it is determined again whether to continue to load such drivers. The CPU reallocates resources according to the final driver loading situation and officially loads the system files. S03. Enter the operating system normally after loading rootfs.

2. The method for realizing automatic cutting of the system kernel according to claim 1, characterized in that: An interface detection circuit is added to each interface circuit of the CPU. In the default state, the feedback level of the interface detection circuit is a high level. When the external interface is inserted, the feedback level of the interface detection circuit is a low level. The actual access status of the external interface is reflected in the form of high / low level feedback from the interface detection circuit.

3. The method for realizing automatic cutting of system kernel according to claim 1, characterized in that: In step S02, the device description file is a .dts file, and the registration function is a probe function.

4. The method for realizing automatic cutting of system kernel according to claim 1, characterized in that: In step S01, the registration interface drivers of the power supply, clock, memory, and external general interface are performed.

5. The method for realizing automatic cutting of system kernel according to claim 1, characterized in that: In step S02, the pruned device tree file is transferred to the kernel loading stage for peripheral driver pruning and registration.

6. The method for realizing automatic cutting of system kernel according to claim 1, characterized in that: This method is used in embedded systems.

7. A device for realizing automatic cutting of a system kernel, comprising a processor and a memory storing program instructions, characterized in that: The processor is configured to execute the method for implementing automatic system kernel trimming according to any one of claims 1 to 6 when running the program instructions.

8. An intelligent terminal product, which is a computer, a mobile phone or a tablet computer, characterized in that: include: Product body; The device for realizing automatic cutting of the system kernel as claimed in claim 7 is installed in the product body.

9. A storage medium storing program instructions, characterized in that: When the program instructions are executed, the method for realizing automatic cutting of the system kernel as claimed in any one of claims 1 to 6 is executed.