CN118519965A - A method, device, terminal device and storage medium for modifying device tree content - Google Patents

A method, device, terminal device and storage medium for modifying device tree content Download PDF

Info

Publication number
CN118519965A
CN118519965A CN202410596714.7A CN202410596714A CN118519965A CN 118519965 A CN118519965 A CN 118519965A CN 202410596714 A CN202410596714 A CN 202410596714A CN 118519965 A CN118519965 A CN 118519965A
Authority
CN
China
Prior art keywords
file
device tree
tree
content
compiled
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410596714.7A
Other languages
Chinese (zh)
Inventor
肖平
吴向志
祝鹏
黄林琪
段俊欢
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CYG Sunri Co Ltd
Original Assignee
CYG Sunri Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by CYG Sunri Co Ltd filed Critical CYG Sunri Co Ltd
Priority to CN202410596714.7A priority Critical patent/CN118519965A/en
Publication of CN118519965A publication Critical patent/CN118519965A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Stored Programmes (AREA)

Abstract

本申请适用于嵌入式技术领域,提供一种设备树内容的修改方法、装置、终端设备及存储介质。设备树内容的修改方法包括:获取设备树源码文件;设备树源码文件包括需要修改或添加的设备树内容;对设备树源码文件进行编译,得到目标设备树编译文件,并将目标设备树编译文件加载至指定文件系统中;从指定文件系统中将目标设备树编译文件加载至原有的设备树编译文件中,得到更新设备树内容后的设备树编译文件。本申请提供的设备树内容的修改方法,可以将需要修改或添加的设备树内容进行编译后加载到指定文件系统中,再从指定文件系统中将目标设备树编译文件加载至原有的设备树编译文件中,该过程可以在系统运行时进行,因此可以实现在系统运行时动态修改设备树内容,提高了硬件配置的便利性。

The present application is applicable to the field of embedded technology, and provides a method, device, terminal device and storage medium for modifying the content of a device tree. The method for modifying the content of a device tree includes: obtaining a device tree source code file; the device tree source code file includes the device tree content that needs to be modified or added; compiling the device tree source code file to obtain a target device tree compiled file, and loading the target device tree compiled file into a specified file system; loading the target device tree compiled file from the specified file system into the original device tree compiled file to obtain a device tree compiled file after updating the device tree content. The method for modifying the content of a device tree provided in the present application can compile the device tree content that needs to be modified or added and load it into a specified file system, and then load the target device tree compiled file from the specified file system into the original device tree compiled file. This process can be performed while the system is running, so that the device tree content can be dynamically modified while the system is running, which improves the convenience of hardware configuration.

Description

Modification method and device for equipment tree content, terminal equipment and storage medium
Technical Field
The application belongs to the technical field of embedding, and particularly relates to a method and a device for modifying equipment tree content, terminal equipment and a storage medium.
Background
Currently, device tree files are typically static, i.e., the device tree files are compiled into the kernel image statically when the kernel is compiled, which makes the contents of the device tree unmodified once the kernel is started.
Since the content of the device tree cannot be modified after the kernel is started, a user cannot dynamically modify the content of the device tree when the system is running, and the kernel needs to be recompiled when the hardware configuration needs to be modified, which results in lower convenience of the existing hardware configuration.
Disclosure of Invention
In view of the above, the embodiments of the present application provide a method, an apparatus, a terminal device, and a storage medium for modifying a device tree content, so as to solve the technical problem of low convenience of the existing hardware configuration.
In a first aspect, an embodiment of the present application provides a method for modifying a device tree content, including:
acquiring a device tree source code file; the equipment tree source code file comprises equipment tree contents which need to be modified or added;
Compiling the equipment tree source code file to obtain a target equipment tree compiling file, and loading the target equipment tree compiling file into a specified file system;
And loading the target equipment tree compiling file into the original equipment tree compiling file from the appointed file system to obtain the equipment tree compiling file after updating the equipment tree content.
Optionally, the loading the target device tree compilation file into the original device tree compilation file from the specified file system to obtain the device tree compilation file after updating the device tree content includes:
Comparing the target equipment tree compiling file with the original equipment tree compiling file;
if the target equipment tree compiling file is different from the original equipment tree compiling file, a dynamic loading switch in a driving file is started, and the target equipment tree compiling file is loaded into the original equipment tree compiling file from the specified file system through a preset interface, so that the equipment tree compiling file after updating the equipment tree content is obtained.
Optionally, after loading the target device tree compiled file into the original device tree compiled file from the specified file system, the method further includes:
and closing the dynamic loading switch to delete the target equipment tree compiling file in the equipment tree compiling file after updating the equipment tree content.
Optionally, after the dynamic loading switch is turned off to delete the target device tree compiled file in the device tree compiled file after updating the device tree content, the method further includes:
And adjusting the function of a driving file for driving the device tree compiling file according to the device tree compiling file after deleting the target device tree compiling file.
Optionally, after the obtaining the device tree compiled file after updating the device tree content, the method further includes:
And analyzing and updating the equipment tree compiling file after the content of the equipment tree through the kernel.
Optionally, after the device tree compiling file after the device tree content is updated through kernel parsing, the method further includes:
And adjusting the function of a driving file for driving the equipment tree compiling file according to the equipment tree compiling file after updating the equipment tree content.
Optionally, compiling the device tree source code file to obtain a target device tree compiled file, including:
Converting the format of the equipment tree source code file into a preset format;
And compiling the equipment tree source code file in the preset format into a binary file to obtain the target equipment tree compiling file.
In a second aspect, an embodiment of the present application provides a device tree content modification apparatus, including:
The source code file acquisition unit is used for acquiring the equipment tree source code file; the equipment tree source code file comprises equipment tree contents which need to be modified or added;
The compiling unit is used for compiling the equipment tree source code file to obtain a target equipment tree compiling file, and loading the target equipment tree compiling file into a specified file system;
and the loading unit is used for loading the target equipment tree compiling file into the original equipment tree compiling file from the appointed file system to obtain the equipment tree compiling file after updating the equipment tree content.
In a third aspect, an embodiment of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements steps in a method for modifying a device tree content according to any one of the first aspects when the computer program is executed by the processor.
In a fourth aspect, an embodiment of the present application provides a computer readable storage medium storing a computer program, which when executed by a processor implements the steps of a method for modifying the content of a device tree according to any one of the first aspects above.
In a fifth aspect, an embodiment of the present application provides a computer program product for, when run on a terminal device, causing the terminal device to perform the steps of the method of modifying the content of a device tree as described in any one of the first aspects above.
The method, the device, the terminal equipment and the storage medium for modifying the equipment tree content provided by the embodiment of the application have the following beneficial effects:
In the method for modifying the equipment tree content provided by the embodiment of the application, firstly, the equipment tree source code file containing the equipment tree content to be modified or added is obtained, then the equipment tree source code file is compiled to obtain the target equipment tree compiling file, the target equipment tree compiling file is loaded into a designated file system, and finally, the target equipment tree compiling file is loaded into the original equipment tree compiling file from the designated file system to obtain the equipment tree compiling file after updating the equipment tree content. The method for modifying the equipment tree content provided by the embodiment of the application can be executed when the system is running, so that the equipment tree content can be dynamically modified when the system is running, and the convenience of the existing hardware configuration is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of an implementation method for modifying the content of a device tree according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of a device for modifying the content of a device tree according to an embodiment of the present application;
Fig. 3 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
Detailed Description
It is to be understood that the terminology used in the embodiments of the application is for the purpose of describing particular embodiments of the application only, and is not intended to be limiting of the application. In the description of the embodiments of the present application, unless otherwise indicated, "a plurality" means two or more, and "at least one", "one or more" means one, two or more. The terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a definition of "a first", "a second" feature may explicitly or implicitly include one or more of such features.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
The execution main body of the device tree content modification method provided by the embodiment of the application can be terminal equipment. The terminal device may be included in an electronic device such as a mobile phone, a tablet computer, a notebook computer, and a desktop computer.
The method for modifying the equipment tree content provided by the embodiment of the application can be applied to a scene for modifying the equipment tree content, and particularly, when a user needs to dynamically modify the equipment tree content in the system operation, each step of the method for modifying the equipment tree content provided by the embodiment of the application can be executed through the terminal equipment, so that the equipment tree content can be dynamically modified in the system operation, and the convenience of the existing hardware configuration is further improved.
Referring to fig. 1, fig. 1 is a flowchart illustrating an implementation method of modifying equipment tree content according to an embodiment of the present application, where the method for modifying equipment tree content may include S101 to S103, which are described in detail as follows:
in S101, a device tree source code file is acquired.
The device tree source code file comprises device tree contents which need to be modified or added.
In the embodiment of the application, when the user needs to modify the equipment tree content, the equipment tree source code file can be written according to the equipment tree content which needs to be modified or added, and the equipment tree source code file comprising the equipment tree content which needs to be modified or added is input into the terminal equipment, so that the terminal equipment obtains the equipment tree source code file.
The device tree is a data structure and a method for describing a hardware platform and components thereof, and is mainly used in an embedded system; describing a hardware platform: ARM device tree is a structured data format that describes a hardware platform. The system comprises component information of a hardware platform, such as a processor, a peripheral device, an interrupt controller, a clock, a bus, a memory and the like, and connection and dependency relationship between the processor, the peripheral device, the interrupt controller, the clock, the bus, the memory and the like; the device tree source code file may be a dts format file.
In S102, the device tree source code file is compiled to obtain a target device tree compiled file, and the target device tree compiled file is loaded into a specified file system.
In the embodiment of the application, after the terminal equipment acquires the equipment tree source code file, the terminal equipment can compile the equipment tree source code file to obtain the target equipment tree compiled file.
Specifically, the DTC device tree compiling tool may be downloaded in the terminal device in advance, so that the terminal device may compile the device tree source code file through the DTC device tree compiling tool to obtain the target device tree compiling file.
In one possible implementation, the terminal device may compile the device tree source code file through steps a to b. The details are as follows:
in step a, the format of the equipment tree source code file is converted into a preset format.
In this implementation, before compiling the device tree source code file, the format of the device tree source code file needs to be converted into a preset format. The specific preset format can be set according to actual requirements.
The following is a schematic text of a preset format of a device tree source code file provided by the embodiment of the application:
/dts-v1/
/plugin/
{/} {// indicates loading into root node
overlay_id=0x888
overlay{
overlay_name=“overlay_test”;
};
}
As shown in the above text, {/}: the representation is loaded to the root node and may be added to other nodes. Other than the above points of attention, the other grammars are the same as the normal device tree writing grammar.
In the step b, compiling the device tree source code file in the preset format into a binary file to obtain a target device tree compiling file.
In this implementation manner, after the terminal device converts the format of the device tree source code file into the preset format, the device tree source code file in the preset format may be compiled into a binary file, so as to obtain the target device tree compiled file.
After obtaining the target device tree compiled file, the terminal device may load the target device tree compiled file into the specified file system.
In one possible implementation, the specified file system may be configfs file systems. configfs the file system is characterized in that: configfs can create and delete kernel objects in the user state. configfs is a ram-based file system, and configuration of kernel objects is implemented by operation of the file system.
Specifically, a memory buffer area can be opened up in the configfs file system in advance as an operation object, and the compiled file of the target device tree is loaded into the memory space reserved by the configfs file system.
In S103, the target device tree compilation file is loaded into the original device tree compilation file from the specified file system, and the device tree compilation file after updating the device tree content is obtained.
In the embodiment of the application, after the target equipment tree compiling file is loaded into the specified file system, the terminal equipment can compare the target equipment tree compiling file with the original equipment tree compiling file, if the target equipment tree compiling file is different from the original equipment tree compiling file, a dynamic loading switch in the driving file is started, and the target equipment tree compiling file is loaded into the original equipment tree compiling file from the specified file system through a preset interface, so that the equipment tree compiling file after updating the equipment tree content is obtained.
It can be seen from the foregoing that, in the method for modifying the equipment tree content provided in the embodiment of the present application, an equipment tree source code file including the equipment tree content to be modified or added is first obtained, then the equipment tree source code file is compiled to obtain a target equipment tree compiled file, the target equipment tree compiled file is loaded into a specified file system, and finally the target equipment tree compiled file is loaded into an original equipment tree compiled file from the specified file system, so as to obtain an equipment tree compiled file after updating the equipment tree content. The method for modifying the equipment tree content provided by the embodiment of the application can be executed when the system is running, so that the equipment tree content can be dynamically modified when the system is running, and the convenience of the existing hardware configuration is improved.
In an alternative implementation manner, after the target device tree compilation file is loaded into the original device tree compilation file from the specified file system, the terminal device may also close the dynamic loading switch to delete the target device tree compilation file in the device tree compilation file after updating the device tree content.
The above can be seen that, the user can instruct the terminal device to close the dynamic loading switch, so that the target device tree compiling file in the device tree compiling file after the device tree content is updated can be deleted, that is, the target device tree compiling file can be loaded into the original device tree compiling file by opening the dynamic loading switch, and the device tree compiling file after the device tree content is updated can be obtained. The dynamic loading switch can be closed to delete the target equipment tree compiling file in the equipment tree compiling file after the equipment tree content is updated, so that dynamic loading and dynamic modification can be realized, dynamic deletion can be realized, namely, the equipment tree content can be modified or added when the system is operated, and the modified content or added content in the equipment tree content can be deleted when the system is operated.
In one possible implementation, the functions of the driver may also need to be adjusted after the device tree compilation file is added, modified, or deleted.
Based on the above, after the terminal device turns off the dynamic loading switch to delete the target device tree compilation file in the device tree compilation file after updating the device tree content, the terminal device may further adjust a function of the driving file for driving the device tree compilation file according to the device tree compilation file after deleting the target device tree compilation file.
Based on the above, after obtaining the equipment tree compiling file after updating the equipment tree content, the terminal equipment can adjust the function of the driving file for driving the equipment tree compiling file according to the equipment tree compiling file after updating the equipment tree content.
In one possible implementation manner, after obtaining the device tree compiled file after updating the device tree content, the terminal device may also parse the device tree compiled file after updating the device tree content through the kernel.
Compared with the static equipment tree in the prior art, the method for modifying the equipment tree content provided by the embodiment of the application has the following innovation points:
Real-time response: the technology can detect hardware changes in real time and dynamically adjust the device tree to adapt to new hardware configurations. This real-time responsiveness enables the system to automatically identify and accommodate insertion, removal, or modification of hardware devices at runtime without restarting the system or user intervention. This flexibility makes the embedded system more suitable for dynamic environments and improves the adaptability and usability of the system.
And (3) ensuring safety: by means of authority control and audit mechanism for modifying the dynamic equipment tree, only authorized users or processes can be ensured to conduct modification operation on the equipment tree. The security guarantee ensures the stability and the security of the system and prevents malicious modification and potential security risks.
Extensibility and customization: the dynamic modification of the device tree allows for greater scalability and customization of the system. The user can dynamically add, delete or modify the device nodes as required, thereby flexibly configuring the hardware resources and the functional characteristics of the system. This flexibility makes the embedded system more suitable for a variety of different application scenarios and provides the possibility for further customization and optimization of the system.
By the technology, the expandability, maintainability and usability of the embedded system can be improved, the requirements under different application scenes are met, and a new technical breakthrough is brought to the development and deployment of the embedded system.
In an optional implementation manner, the method for modifying the device tree content provided by the embodiment of the application can be applied to an embedded Linux system, and has the following advantages when applied to the embedded Linux system:
1. hardware configuration flexibility: by dynamically modifying the device tree, hardware resources, including adding, deleting, or modifying device nodes, interrupt controllers, sensors, etc., can be dynamically configured at system runtime. This allows the system to flexibly configure and manage hardware resources as needed at run-time without restarting the system.
2. Hot plug support: dynamically modifying the device tree may enable hot plug support for hardware devices. When a hardware device is inserted or removed, the hardware configuration of the system may be dynamically updated by modifying the device tree so that the system can immediately identify and respond to the new hardware device.
3. Function expansion and customization: dynamic expansion and customization of system functions can be achieved by dynamically modifying the device tree. For example, new device nodes or functional modules may be added at system runtime to meet the needs of a particular application scenario without recompiling the kernel or restarting the system.
4. Debugging and troubleshooting: dynamically modifying the device tree may also be used for debugging and troubleshooting. By viewing and modifying the content of the device tree in real time, it is possible to help locate hardware configuration errors, device driving problems, etc., and make corresponding adjustments and repairs without having to shut down or restart the system.
5. Time and resources are saved: the dynamic modification of the device tree can save time and resources required by restarting the system and improve the availability and responsiveness of the system. Especially in a production environment or in a scenario where the availability of the system is high, dynamically modifying the plant tree can significantly reduce downtime of the system.
In general, the dynamic modification of the device tree can provide flexibility, expandability and debugging convenience in the embedded Linux system, so that the system can be more suitable for different application scenes, and the usability and maintainability of the system are improved.
Based on the method for modifying the equipment tree content provided by the above embodiment, the embodiment of the present application further provides a device for modifying the equipment tree content for implementing the method embodiment, please refer to fig. 2, fig. 2 shows a schematic structural diagram of a device for modifying the equipment tree content provided by the embodiment of the present application. As shown in fig. 2, the device tree content modifying apparatus 20 may include: a source code file acquisition unit 21, a compiling unit 22, and a loading unit 23. Wherein:
The source code file obtaining unit 21 is used for obtaining a device tree source code file; the device tree source code file includes device tree content that needs to be modified or added.
The compiling unit 22 is configured to compile the device tree source code file to obtain a target device tree compiled file, and load the target device tree compiled file into a specified file system.
The loading unit 23 is configured to load the target device tree compiled file into an original device tree compiled file from the specified file system, so as to obtain a device tree compiled file after updating the device tree content.
Optionally, the loading unit 23 is specifically configured to:
Comparing the target equipment tree compiling file with the original equipment tree compiling file;
if the target equipment tree compiling file is different from the original equipment tree compiling file, a dynamic loading switch in a driving file is started, and the target equipment tree compiling file is loaded into the original equipment tree compiling file from the specified file system through a preset interface, so that the equipment tree compiling file after updating the equipment tree content is obtained.
Optionally, the modification means 20 of the device tree content may further comprise a deletion unit. Wherein:
The deleting unit is used for closing the dynamic loading switch so as to delete the target equipment tree compiling file in the equipment tree compiling file after updating the equipment tree content.
Optionally, the device tree content modifying means 20 may further comprise a function adjusting unit. Wherein:
The function adjusting unit is used for adjusting the function of the driving file for driving the device tree compiling file according to the device tree compiling file after deleting the target device tree compiling file.
Optionally, the function adjusting unit is further configured to adjust a function of a driving file for driving the device tree compiling file according to the device tree compiling file after updating the device tree content.
Optionally, the device tree content modifying means 20 may further comprise an updating unit. Wherein:
and the updating unit is used for analyzing and updating the equipment tree compiling file after the content of the equipment tree through the kernel.
Optionally, the compiling unit 22 is specifically configured to:
Converting the format of the equipment tree source code file into a preset format;
And compiling the equipment tree source code file in the preset format into a binary file to obtain the target equipment tree compiling file.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a terminal device according to an embodiment of the present application. As shown in fig. 3, the terminal device 3 provided in this embodiment may include: a processor 30, a memory 31 and a computer program 32 stored in the memory 31 and executable on the processor 30, such as a program corresponding to a method of modifying the content of a device tree. The steps in the above-described embodiment of the modification method applied to the device tree content are implemented when the processor 30 executes the computer program 32, for example, S101 to S103 shown in fig. 1. Or the processor 30, when executing the computer program 32, implements the functions of the modules/units of the above described embodiment of the device tree content modification apparatus, such as the functions of the units 21-23 shown in fig. 2.
By way of example, the computer program 32 may be partitioned into one or more modules/units that are stored in the memory 31 and executed by the processor 30 to complete the present application. One or more of the modules/units may be a series of computer program instruction segments capable of performing a specific function for describing the execution of the computer program 32 in the terminal device 3. For example, the computer program 32 may be partitioned into: the specific functions of the source code file obtaining unit 21, the compiling unit 22 and the loading unit 23 are described in the corresponding embodiment of fig. 2, and are not repeated here.
It will be appreciated by those skilled in the art that fig. 3 is merely an example of the terminal device 3 and does not constitute a limitation of the terminal device 3, and may include more or fewer components than shown, or may combine certain components, or different components.
The processor 30 may be a central processing unit (central processing unit, CPU), but may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL processors, DSPs), application Specific Integrated Circuits (ASICs), off-the-shelf programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 31 may be an internal storage unit of the terminal device 3, such as a hard disk or a memory of the terminal device 3. The memory 31 may also be an external storage device of the terminal device 3, such as a plug-in hard disk, a smart memory card (SMART MEDIA CARD, SMC), a Secure Digital (SD) card, or a flash memory card (FLASH CARD) provided on the terminal device 3. Further, the memory 31 may also include both an internal storage unit of the terminal device 3 and an external storage device. The memory 31 is used to store computer programs and other programs and data required by the terminal device. The memory 31 may also be used to temporarily store data that has been output or is to be output.
It will be clear to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units is illustrated, and in practical application, the above-mentioned functional allocation may be performed by different functional units according to needs, that is, the internal structure of the modification device of the device tree content is divided into different functional units, so as to perform all or part of the above-mentioned functions. The functional units in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, the specific names of the functional units are also only for distinguishing from each other, and are not used to limit the protection scope of the present application. The specific working process of the units in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
Embodiments of the present application also provide a computer readable storage medium having a computer program stored therein, which when executed by a processor, performs the steps of the respective method embodiments described above.
The embodiments of the present application provide a computer program product for causing a terminal device to carry out the steps of the respective method embodiments described above when the computer program product is run on the terminal device.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference may be made to related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.

Claims (10)

1.一种设备树内容的修改方法,其特征在于,包括:1. A method for modifying device tree content, comprising: 获取设备树源码文件;所述设备树源码文件包括需要修改或添加的设备树内容;Obtain a device tree source code file; the device tree source code file includes device tree content that needs to be modified or added; 对所述设备树源码文件进行编译,得到目标设备树编译文件,并将所述目标设备树编译文件加载至指定文件系统中;Compile the device tree source code file to obtain a target device tree compiled file, and load the target device tree compiled file into a specified file system; 从所述指定文件系统中将所述目标设备树编译文件加载至原有的设备树编译文件中,得到更新所述设备树内容后的设备树编译文件。The target device tree compiled file is loaded into the original device tree compiled file from the designated file system to obtain the device tree compiled file after updating the device tree content. 2.根据权利要求1所述的方法,其特征在于,所述从所述指定文件系统中将所述目标设备树编译文件加载至原有的设备树编译文件中,得到更新所述设备树内容后的设备树编译文件,包括:2. The method according to claim 1, wherein the step of loading the target device tree compiled file from the designated file system into the original device tree compiled file to obtain the device tree compiled file after updating the device tree content comprises: 将所述目标设备树编译文件与所述原有的设备树编译文件进行比对;Compare the target device tree compilation file with the original device tree compilation file; 若所述目标设备树编译文件与所述原有的设备树编译文件存在差异,则开启驱动文件中的动态加载开关,并通过预设接口,从所述指定文件系统中将所述目标设备树编译文件加载至所述原有的设备树编译文件中,得到更新所述设备树内容后的设备树编译文件。If there is a difference between the target device tree compiled file and the original device tree compiled file, the dynamic loading switch in the driver file is turned on, and the target device tree compiled file is loaded into the original device tree compiled file from the specified file system through a preset interface to obtain the device tree compiled file after updating the device tree content. 3.根据权利要求2所述的方法,其特征在于,在从所述指定文件系统中将所述目标设备树编译文件加载至原有的设备树编译文件中之后,还包括:3. The method according to claim 2, characterized in that after loading the target device tree compilation file from the specified file system into the original device tree compilation file, it also includes: 关闭所述动态加载开关,以删除更新所述设备树内容后的设备树编译文件中的所述目标设备树编译文件。The dynamic loading switch is turned off to delete the target device tree compilation file in the device tree compilation file after the device tree content is updated. 4.根据权利要求3所述的方法,其特征在于,在所述关闭所述动态加载开关,以删除更新所述设备树内容后的设备树编译文件中的所述目标设备树编译文件之后,还包括:4. The method according to claim 3, characterized in that after turning off the dynamic loading switch to delete the target device tree compilation file in the device tree compilation file after updating the device tree content, it also includes: 根据删除所述目标设备树编译文件后的设备树编译文件,对用于驱动设备树编译文件的驱动文件的功能进行调整。According to the device tree compiled file after deleting the target device tree compiled file, the function of the driver file for driving the device tree compiled file is adjusted. 5.根据权利要求1所述的方法,其特征在于,在通过内核解析更新所述设备树内容后的设备树编译文件之后,还包括:5. The method according to claim 1, characterized in that after updating the device tree compilation file after the device tree content is parsed by the kernel, it also includes: 根据更新所述设备树内容后的设备树编译文件,对用于驱动设备树编译文件的驱动文件的功能进行调整。According to the device tree compiled file after the device tree content is updated, the function of the driver file used to drive the device tree compiled file is adjusted. 6.根据权利要求1所述的方法,其特征在于,在所述得到更新所述设备树内容后的设备树编译文件之后,还包括:6. The method according to claim 1, characterized in that after obtaining the device tree compilation file after updating the device tree content, it also includes: 通过内核解析更新所述设备树内容后的设备树编译文件。The device tree compilation file after the device tree content is updated through kernel parsing. 7.根据权利要求1至6任一项所述的方法,其特征在于,所述对所述设备树源码文件进行编译,得到目标设备树编译文件,包括:7. The method according to any one of claims 1 to 6, characterized in that compiling the device tree source code file to obtain a target device tree compiled file comprises: 将所述设备树源码文件的格式转换为预设格式;Converting the format of the device tree source code file into a preset format; 将所述预设格式的所述设备树源码文件编译为二进制文件,得到所述目标设备树编译文件。The device tree source code file in the preset format is compiled into a binary file to obtain the target device tree compiled file. 8.一种设备树内容的修改装置,其特征在于,包括:8. A device for modifying the content of a device tree, characterized by comprising: 源码文件获取单元,用于获取设备树源码文件;所述设备树源码文件包括需要修改或添加的设备树内容;A source code file acquisition unit, used to acquire a device tree source code file; the device tree source code file includes device tree content that needs to be modified or added; 编译单元,用于对所述设备树源码文件进行编译,得到目标设备树编译文件,并将所述目标设备树编译文件加载至指定文件系统中;A compiling unit, used for compiling the device tree source code file to obtain a target device tree compiled file, and loading the target device tree compiled file into a specified file system; 加载单元,用于从所述指定文件系统中将所述目标设备树编译文件加载至原有的设备树编译文件中,得到更新所述设备树内容后的设备树编译文件。The loading unit is used to load the target device tree compiled file into the original device tree compiled file from the specified file system to obtain the device tree compiled file after updating the device tree content. 9.一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至7任一项所述设备树内容的修改方法中的各步骤。9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, each step of the method for modifying the content of a device tree as claimed in any one of claims 1 to 7 is implemented. 10.一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述设备树内容的修改方法中的各步骤。10. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements each step of the method for modifying the content of a device tree as claimed in any one of claims 1 to 7.
CN202410596714.7A 2024-05-14 2024-05-14 A method, device, terminal device and storage medium for modifying device tree content Pending CN118519965A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410596714.7A CN118519965A (en) 2024-05-14 2024-05-14 A method, device, terminal device and storage medium for modifying device tree content

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410596714.7A CN118519965A (en) 2024-05-14 2024-05-14 A method, device, terminal device and storage medium for modifying device tree content

Publications (1)

Publication Number Publication Date
CN118519965A true CN118519965A (en) 2024-08-20

Family

ID=92278703

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410596714.7A Pending CN118519965A (en) 2024-05-14 2024-05-14 A method, device, terminal device and storage medium for modifying device tree content

Country Status (1)

Country Link
CN (1) CN118519965A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119396411A (en) * 2024-11-18 2025-02-07 西北工业大学 A convenient configuration method for the CAN interface of the Jetson series embedded development board

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119396411A (en) * 2024-11-18 2025-02-07 西北工业大学 A convenient configuration method for the CAN interface of the Jetson series embedded development board

Similar Documents

Publication Publication Date Title
US9483242B2 (en) Wholesale replacement of specialized classes in a runtime environments
CN108027722B (en) Dynamically updating applications in compilation and deployment
US10331425B2 (en) Automated source code adaption to inject features between platform versions
US20130232469A1 (en) System and method for automatically resolving dependencies of java archive files for use with maven
US10248409B1 (en) Limiting the effects of source code patches on corresponding native-code patches
CN114490103B (en) Method, device and electronic device for calling operating system interface
US20130055217A1 (en) Breakpoint synchronization for modified program source code
US9513762B1 (en) Static content updates
US7269464B2 (en) System, method and computer program product for providing an interface for instantiating additional programmable logic controller functionality
CN113177292B (en) Universal BIM secondary development implementation method and device
CN118519965A (en) A method, device, terminal device and storage medium for modifying device tree content
WO2019157891A1 (en) Application installation method and application installer generating method
CN117707543A (en) Application installation package manufacturing and installation method, computing device and storage medium
CN100535856C (en) Method for constructing middle library
WO2022184112A1 (en) Android system application debugging method and apparatus, program, medium, and electronic device
US20230325476A1 (en) Obfuscation device, obfuscation method, and obfuscation program
CN108958795B (en) BootLoader code reuse method and development board in embedded system
US9720803B2 (en) Methods and apparatus for debugging of remote systems
CN112100622B (en) A data processing method and device
CN113590224B (en) Method and device for detecting server, electronic equipment and storage medium
CN121116258A (en) Program variable value forcing method and device during running of PLC program
CN117453302A (en) Method, device, equipment and computer readable medium for importing software development kit
CN119718333A (en) Program compilation method, electronic device and program product
CN118838640A (en) Python source code packaging and publishing method, system, medium and product
CN120596072A (en) Code construction method, device, electronic device and storage medium

Legal Events

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