Device Tree Repair Method, System and Computer Readable Storage Medium
By differentially processing the device tree source data and target data, patch data is generated and device tree repair is solved, and the problems of excessive update content and cumbersome release process in the existing technology are solved, and efficient device tree repair is achieved.
Patent Information
- Application Number
- CN202010949031.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-10
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2040-09-10
AI Technical Summary
There are too many updates in the existing equipment tree repair plan, long release process and slow speed, which will consume a lot of manpower and time.
By obtaining the device tree source data and target data for differential processing, patch data is generated, and sent to the user equipment to instruct the user equipment to differentially synthesize the patch data with the original device tree mirror file to obtain the updated device tree mirror file.
Reduced updated content, simplified the release process, improved the speed of equipment tree repair, and reduced manpower and time consumption.
Smart Images

Figure CN114168168B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of terminals, and particularly relates to a device tree repair method, a development device, a user device, a system, and a computer-readable storage medium. Background Art
[0002] A device tree is a data structure for describing hardware resources. Currently, many electronic devices use a device tree to describe hardware resources, thereby reducing the description code of hardware resources in the kernel source code and making the kernel source code relatively independent of the description of hardware resources.
[0003] The device tree is usually stored in the storage area of an electronic device in the form of an image file. In addition to the device tree image file, the storage area of the electronic device also includes other types of image files.
[0004] Currently, if the device tree needs to be repaired, developers can only repair the device tree by releasing a new version file. Since each image file carries information such as a version number, when developers release a new version file, the version file needs to update each image file, resulting in too much content to be updated.
[0005] Moreover, developers need to go through steps such as compilation, basic function testing, compatibility testing (Compatibility Test Suite, CTS), and sending for testing when releasing a new version file. The entire version release process is long, slow, and consumes a large amount of manpower and time. Summary of the Invention
[0006] Embodiments of this application provide a device tree repair method, a development device, a user device, a system, and a computer-readable storage medium, which can solve the problems of too much content to be updated, a long release process, slow speed, and consumption of a large amount of manpower and time in the current device tree repair solution.
[0007] In a first aspect, an embodiment of this application provides a device tree repair method, which is applied to a development device and includes:
[0008] Obtain device tree source data and device tree target data;
[0009] Perform differential processing on the device tree source data and the device tree target data to obtain patch data;
[0010] Send the patch data to the user device to instruct the user device to perform differential synthesis on the patch data and the original device tree image file in the user device to obtain an updated device tree image file.
[0011] It should be noted that the device tree source data is the device tree data before patch repair, and the device tree target data is the device tree data after patch repair. The device tree target data is compiled by developers.
[0012] When the development device performs device tree repair, it can first obtain the device tree source data and the device tree target data. Then, the development device performs differential processing on the device tree source data and the device tree target data to obtain patch data.
[0013] After obtaining the patch data, the development device can send the patch data to the user device.
[0014] After the user device obtains the patch data, it performs differential synthesis on the patch data and the original device tree image file to obtain an updated device tree image file. Among them, the original device tree image file is the device tree image file on the local user device.
[0015] In the above device tree repair method, the development device repairs the device tree by means of a patch, without the need to release a new version file, reducing the content of the update. Moreover, releasing patch data does not require a complex version testing and release process, which can improve the device tree repair speed and reduce the consumption of manpower and time.
[0016] In a possible implementation manner of the first aspect, the obtaining of the device tree source data and the device tree target data includes:
[0017] Obtain a basic device tree image file and a target device tree image file;
[0018] Perform format parsing on the basic device tree image file to obtain the device tree source data corresponding to each main board identifier;
[0019] Perform format parsing on the target device tree image file to obtain the device tree target data corresponding to each main board identifier;
[0020] Correspondingly, the performing of differential processing on the device tree source data and the device tree target data to obtain patch data includes:
[0021] Perform differential processing on the device tree source data and the device tree target data corresponding to each main board identifier respectively to obtain the patch data corresponding to each main board identifier.
[0022] It should be noted that when the development device obtains the device tree source data and the device tree target data, it can first obtain the basic device tree image file and the target device tree image file.
[0023] Among them, the basic device tree image file is the device tree image file before patch repair, and the target device tree image file is the device tree image file after patch repair. The target device tree image file is compiled and generated by developers.
[0024] After that, the development device can perform format parsing on the basic device tree image file to obtain device tree source data corresponding to one or more motherboard identifiers. The development device can perform format parsing on the target device tree image file to obtain device tree target data corresponding to one or more motherboard identifiers.
[0025] At this time, the development device can perform differential processing on the device tree source data and device tree target data corresponding to each motherboard identifier to obtain patch data corresponding to each motherboard identifier.
[0026] If the device tree source data corresponding to a certain motherboard identifier does not need to be repaired, the device tree source data and device tree target data corresponding to this motherboard identifier are the same, and the development device performs differential processing on the device tree source data and device tree target data corresponding to this motherboard identifier, and the obtained patch data is empty.
[0027] If the device tree source data corresponding to a certain motherboard identifier needs to be repaired, the device tree source data and device tree target data corresponding to this motherboard identifier are different, and the development device performs differential processing on the device tree source data and device tree target data corresponding to this motherboard identifier, and the changed code by the developer, that is, the patch data, can be obtained.
[0028] In a possible implementation manner of the first aspect, the sending the patch data to the user device includes:
[0029] Encapsulating the patch data into a patch file according to a preset data format;
[0030] Sending the patch file to the user device.
[0031] It should be noted that after the development device obtains the patch data, it can encapsulate the above patch data according to a preset data format to obtain a patch file. Then, the development device sends the patch file to the user device.
[0032] In a second aspect, an embodiment of the present application provides a device tree repair method applied to a user device, including:
[0033] Obtaining patch data, where the patch data is data obtained by a development device performing differential processing on device tree source data and device tree target data;
[0034] Obtaining the original device tree image file;
[0035] Differentially synthesize the patch data with the original device tree image file to obtain an updated device tree image file.
[0036] It should be noted that when a user device repairs the device tree, it can first obtain patch data. The patch data is data obtained by a development device through differential processing of the device tree source data and the device tree target data.
[0037] Then, the user device can obtain the local original device tree image file, and perform differential synthesis on the patch data and the original device tree image file, so as to obtain an updated device tree image file after patch repair.
[0038] In the above device tree repair method, the user device repairs the device tree by means of a patch, without the need to release a new version file, reducing the content of the update. Moreover, repairing the device tree with patch data does not require a complex version testing and release process, which can improve the device tree repair speed and reduce the consumption of manpower and time.
[0039] In a possible implementation manner of the second aspect, the obtaining of the patch data includes:
[0040] Obtain a patch file, where the patch file includes patch data corresponding to at least one main board identifier;
[0041] Obtain a target main board identifier;
[0042] Search for target patch data corresponding to the target main board identifier in the patch file;
[0043] Correspondingly, the differentially synthesizing the patch data with the original device tree image file to obtain an updated device tree image file includes:
[0044] If there is target patch data corresponding to the target main board identifier in the patch file, then differentially synthesize the target patch data with the original device tree image file to obtain an updated device tree image file.
[0045] It should be noted that the development device can perform format parsing on the basic device tree image file to obtain the device tree source data corresponding to each main board identifier, and the development device can perform format parsing on the target device tree image file to obtain the device tree target data corresponding to each main board identifier.
[0046] Then, the development device can perform differential processing on the device tree source data and the device tree target data corresponding to each main board identifier to obtain the patch data corresponding to each main board identifier.
[0047] After that, the development device encapsulates the patch data corresponding to each main board identifier into a patch file and sends the patch file to the user device.
[0048] When the user equipment performs patch repair, it can first obtain the patch file. The patch file includes patch data corresponding to one or more main board identifiers.
[0049] At this time, the user equipment can obtain the target main board identifier of this equipment, and search for the target patch data corresponding to the target main board identifier in the patch file.
[0050] If the target patch data corresponding to the target main board identifier cannot be found in the patch file, it means that the original device tree image file does not need to be patched, and the user equipment can continue to execute the startup steps of the operating system according to the original device tree image file.
[0051] If the target patch data corresponding to the target main board identifier is found in the patch file, it means that the original device tree image file needs to be patched. At this time, the user equipment can perform differential synthesis on the target patch data and the original device tree image file to obtain an updated device tree image file (that is, the device tree image file after patch repair).
[0052] Since the basic device tree image file may include device tree source data of one or more main board identifiers, and the original device tree image file may only include device tree source data of some of the above one or more main board identifiers, the original device tree image file and the above basic device tree image file may be the same or different.
[0053] Similarly, the target device tree image file may include device tree target data of one or more main board identifiers, and the updated device tree image file may only include device tree target data of some of the above one or more main board identifiers. Therefore, the target device tree image file and the above updated device tree may be the same or different.
[0054] In a possible implementation manner of the second aspect, the obtaining of the patch data includes:
[0055] Obtain the digital signature of the patch partition, and perform security verification on the patch partition according to the digital signature of the patch partition;
[0056] If the security verification of the patch partition passes, obtain the patch data from the patch partition.
[0057] It should be noted that when the user equipment obtains the patch data from the patch partition, in order to avoid the data in the patch partition being tampered with, the user equipment can obtain the digital signature of the patch partition and perform security verification on the patch partition according to the digital signature of the patch partition.
[0058] If the security check of the patch partition passes, it indicates that the data in the patch partition has not been tampered with, and the user device can obtain the patch data from the patch partition.
[0059] In a possible implementation of the second aspect, before obtaining the digital signature of the patch partition, it further includes:
[0060] Receiving the patch data sent by the development device and storing the patch data in the patch partition.
[0061] It should be noted that the memory of the user device can be divided into multiple partitions. For example, the read-only memory of the user device can be divided into partitions such as a boot partition, a device tree blob overlay (Dtbo) partition, a system partition, and a vendor partition.
[0062] When the user device receives the patch data sent by the development device, the user device can store the patch data in the local patch partition.
[0063] In a possible implementation of the second aspect, the obtaining of the original device tree image file includes:
[0064] Obtaining the digital signature of the device tree partition and performing a security check on the device tree partition according to the digital signature of the device tree partition;
[0065] If the security check of the device tree partition passes, obtain the original device tree image file from the device tree partition.
[0066] It should be noted that when the user device obtains the original device tree image file from the device tree partition, in order to avoid the data in the device tree partition from being tampered with, the user device can obtain the digital signature of the device tree partition and perform a security check on the device tree partition according to the digital signature of the device tree partition.
[0067] If the security check of the device tree partition passes, it indicates that the data in the device tree partition has not been tampered with, and the user device can obtain the original device tree image file from the device tree partition.
[0068] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0069] A first data module, configured to obtain device tree source data and device tree target data;
[0070] A differential processing module, configured to perform differential processing on the device tree source data and the device tree target data to obtain patch data;
[0071] A data sending module, configured to send the patch data to a user device, so as to instruct the user device to perform differential synthesis on the patch data and an original device tree image file in the user device to obtain an updated device tree image file.
[0072] In a possible implementation manner of the third aspect, the first data module includes:
[0073] A file acquisition sub-module, configured to acquire a basic device tree image file and a target device tree image file;
[0074] A basic parsing sub-module, configured to perform format parsing on the basic device tree image file to obtain device tree source data corresponding to each main board identifier;
[0075] A target parsing sub-module, configured to perform format parsing on the target device tree image file to obtain device tree target data corresponding to each main board identifier;
[0076] Correspondingly, the differential processing module is specifically configured to perform differential processing on the device tree source data and the device tree target data corresponding to each main board identifier respectively to obtain patch data corresponding to each main board identifier.
[0077] In a possible implementation manner of the third aspect, the data sending module includes:
[0078] A format encapsulation sub-module, configured to encapsulate the patch data into a patch file according to a preset data format;
[0079] A file sending sub-module, configured to send the patch file to a user device.
[0080] In a fourth aspect, an embodiment of the present application provides an electronic device, including:
[0081] A second data module, configured to acquire patch data, where the patch data is data obtained by a development device performing differential processing on device tree source data and device tree target data;
[0082] An original file module, configured to acquire an original device tree image file;
[0083] A differential synthesis module, configured to perform differential synthesis on the patch data and the original device tree image file to obtain an updated device tree image file.
[0084] In a possible implementation manner of the fourth aspect, the second data module includes:
[0085] A patch file sub-module, configured to acquire a patch file, where the patch file includes patch data corresponding to at least one main board identifier;
[0086] A target identification sub-module, configured to obtain a target main board identification;
[0087] A patch search sub-module, configured to search for target patch data corresponding to the target main board identification in the patch file;
[0088] Correspondingly, the differential synthesis module is specifically configured to, if there is target patch data corresponding to the target main board identification in the patch file, perform differential synthesis on the target patch data and the original device tree image file to obtain an updated device tree image file.
[0089] In a possible implementation manner of the fourth aspect, the second data module includes:
[0090] A patch signature sub-module, configured to obtain a digital signature of the patch partition, and perform a security check on the patch partition according to the digital signature of the patch partition;
[0091] A patch verification sub-module, configured to, if the security check of the patch partition passes, obtain patch data from the patch partition.
[0092] In a possible implementation manner of the fourth aspect, the second data module further includes:
[0093] A data reception sub-module, configured to receive patch data sent by the development device and store the patch data in the patch partition.
[0094] In a possible implementation manner of the fourth aspect, the original file module includes:
[0095] A device signature sub-module, configured to obtain a digital signature of the device tree partition, and perform a security check on the device tree partition according to the digital signature of the device tree partition;
[0096] A device verification sub-module, configured to, if the security check of the device tree partition passes, obtain the original device tree image file from the device tree partition.
[0097] In a fifth aspect, a development device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the electronic device implements the method provided in the first aspect as described above.
[0098] In a sixth aspect, a user device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the electronic device implements the method provided in the second aspect as described above.
[0099] In a seventh aspect, a device tree repair system is provided, including the development device provided in the fifth aspect and the user device provided in the sixth aspect.
[0100] In an eighth aspect, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program, which when executed by a processor enables a fitting device to implement the method provided in the first aspect or the method provided in the second aspect.
[0101] In a ninth aspect, a chip system is provided. The chip system can be a single chip or a chip module composed of multiple chips. The chip system includes a memory and a processor, and the processor executes a computer program stored in the memory to implement the method provided in the first aspect or the method provided in the second aspect.
[0102] The beneficial effects of the embodiments of the present application compared with the prior art are as follows:
[0103] In the device tree repair method provided in the present application, the development device performs differential processing on the device tree source data and the device tree target data to obtain patch data, and sends the patch data to the user device. The user device patches the original device tree image file with the patch data to repair the original device tree image file and obtain an updated device tree image file.
[0104] In the device tree repair method provided in the present application, the development device and the user device repair the device tree by means of patches, without releasing a new version file and without changing the version number. Therefore, there is no need to update other image files in the version file, reducing the content to be updated. Moreover, when releasing the patch data, the patch data only needs to pass the single-point problem verification and does not require a complex version testing and release process, thereby improving the device tree repair speed, reducing the consumption of manpower and time, and having strong usability and practicality. Description of the Drawings
[0105] Figure 1 It is a schematic structural diagram of a device tree repair system provided by an embodiment of the present application;
[0106] Figure 2 It is a partition schematic diagram of a read-only memory provided by an embodiment of the present application;
[0107] Figure 3 It is a schematic diagram of an electronic device provided by an embodiment of the present application;
[0108] Figure 4 It is a schematic diagram of an application scenario provided by an embodiment of the present application;
[0109] Figure 5A signaling diagram of a device tree repair method provided by an embodiment of the present application;
[0110] Figure 6 A schematic flowchart of a device tree repair method provided by an embodiment of the present application;
[0111] Figure 7 A schematic flowchart of another device tree repair method provided by an embodiment of the present application;
[0112] Figure 8 A schematic diagram of a development device provided by an embodiment of the present application;
[0113] Figure 9 A schematic diagram of a user equipment provided by an embodiment of the present application;
[0114] Figure 10 A schematic diagram of another electronic device provided by an embodiment of the present application. Detailed implementation manners
[0115] In the following description, specific details such as specific system architectures and technologies are presented for the purpose of illustration rather than limitation, so as to thoroughly understand the embodiments of the present application. However, those skilled in the art should understand that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from interfering with the description of the present application.
[0116] It should be understood that when used in the specification and appended claims of the present application, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
[0117] It should also be understood that the term "and / or" as used in the specification and appended claims of the present application refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0118] As used in the specification and appended claims of the present application, the term "if" can be interpreted as "when...", "once", "in response to determining", or "in response to detecting" according to the context. Similarly, the phrase "if determined" or "if detected [the described condition or event]" can be interpreted as meaning "once determined", "in response to determining", "once detected [the described condition or event]", or "in response to detecting [the described condition or event]" according to the context.
[0119] In addition, in the description of the specification and the appended claims of the present application, the terms "first", "second", "third", etc. are only used for differential description and should not be construed as indicating or implying relative importance.
[0120] The reference to "one embodiment" or "some embodiments" etc. described in the specification of the present application means that a specific feature, structure or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, the statements "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments", etc. that appear in different places in this specification do not necessarily all refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "comprise", "include", "have" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0121] The kernel is the core of an operating system. The kernel is the first layer of software extension based on hardware resources, providing the most basic functions of the operating system and serving as the basis for the operation of the operating system. The kernel is responsible for managing the processes, memory, device drivers, files and network systems of the operating system, determining the performance and stability of the system.
[0122] In the kernel source code of a processor, there is a large amount of code describing board-level detail information, such as code describing platform devices, resources, and platform data of various hardware. For the kernel, the vast majority of this code describing board-level detail information belongs to garbage and redundant code.
[0123] In order to reduce the code describing board-level detail information in the kernel source code, some processors' kernels have introduced the Device Tree (dt). For example, the Device Tree was introduced after ARM kernel version 3.x.
[0124] The Device Tree is a data structure describing hardware resources. The Device Tree can pass hardware resources into the kernel through a bootloader, making the description of the kernel source code relatively independent of the hardware resources. That is to say, a file in the dtb format (i.e., the Device Tree file) can be read into memory by the bootloader and parsed by the processor kernel. At this time, for the kernels of the same type of processor, only by replacing the Device Tree file can the kernel of this type be adapted to different motherboards without replacing the kernel file of the kernel.
[0125] The device tree is usually stored in the storage area of an electronic device in the form of an image file. In addition to the device tree image file, the storage area of the electronic device may also include other types of image files.
[0126] For example, the read-only memory (ROM) of an electronic device can be divided into multiple partitions, and each partition stores image files such as a boot image file, a device tree blob overlay (Dtbo) image file, a system image file, and a vendor image file.
[0127] At present, the device tree can only be repaired by releasing a new version. However, the above-mentioned image files all contain version numbers, and some image files even have timestamps. Therefore, during the process of compiling a new version file, the above-mentioned image files will all change, and the entire version needs to be recompiled, resulting in too much content to be updated.
[0128] Moreover, the release of a new version file requires steps such as compilation, basic function testing, compatibility testing, and submission for testing. The entire version release process is long, slow, and consumes a large amount of manpower.
[0129] In view of this, the embodiments of the present application provide a device tree repair method, an electronic device, and a computer-readable storage medium, which can repair the device tree by means of patch repair, solve the problems of excessive updated content, long process, and slow speed in the current device tree repair method, and have strong usability and practicability.
[0130] First, taking Figure 1 the device tree repair system shown as an example, each electronic device to be involved in the embodiments of the present application will be illustrated by way of example.
[0131] As Figure 1 shown, in the device tree repair system, there is one or more development devices 101 ( Figure 1 only one is shown in Figure 1 ), one or more user devices 102 (
[0132] three are shown in
[0133] ) and a transfer device 103.
[0132] Among them, the development device 101 is an electronic device for generating a patch file, and the user device 102 is an electronic device for repairing the device tree using the patch file.
[0133] A direct communication connection may be established between the development device 101 and the user device 102, that is, a direct communication connection is established between the development device 101 and the user device 102; or, an indirect communication connection may also be established between the development device 101 and the user device 102, that is, a relay device 103 responsible for relaying data is provided between the development device 101 and the user device 102.
[0134] For example, after the development device 101 generates a patch file, it can send the patch file to the user device 102 through a direct communication connection with the user device 102. Or, after the development device 101 generates a patch file, it can also send the patch file to the relay device 103, and the relay device 103 forwards the patch file to the user device 102.
[0135] The type of the above communication connection can be set according to the actual situation. For example, the above communication connection may include any one or more of wireless communication solutions such as wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), RFID, or ZigBee. And / or, the above communication connection may also include any one or more of wired communication solutions such as a Registered Jack 45 (RJ45) connection.
[0136] The types of the above development device 101, user device 102, and relay device 103 can be determined according to the actual situation. For example, the above development device 101, user device 102, and relay device 103 may be electronic devices such as mobile phones, tablet computers, wearable devices, in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, laptop computers, ultra-mobile personal computers (UMPC), netbooks, personal digital assistants (PDA), etc. The embodiments of the present application do not impose any restrictions on the specific types of the above development device 101, user device 102, and relay device 103.
[0137] Moreover, the above development device 101, user device 102, and relay device 103 may be of the same type of electronic device, or the above development device 101, user device 102, and relay device 103 may also be of different types of electronic devices.
[0138] When there are multiple development devices 101, the multiple development devices 101 can be electronic devices of the same type, or they can also be electronic devices of different types.
[0139] When there are multiple user devices 102, the multiple user devices 102 can be electronic devices of the same type, or they can also be electronic devices of different types.
[0140] When there are multiple relay devices 103, the multiple relay devices 103 can be electronic devices of the same type, or they can also be electronic devices of different types.
[0141] In addition, Figure 1 The device tree repair system shown is only a schematic example of the embodiments of this application and should not be construed as a specific limitation on the device tree repair system. During the actual application process, the device tree repair system may have more or fewer electronic devices than Figure 1 the device tree repair system shown. For example, in some application scenarios, the device tree repair system may not include the relay device 103, and the development device 101 and the user device 102 establish a direct communication connection. Therefore, the embodiments of this application do not impose any limitations on the device tree repair system.
[0142] Next, Figure 1 the device tree repair method provided by the embodiments of this application will be described in detail with reference to the device tree repair system shown and in combination with specific application scenarios.
[0143] 1. Generate a patch file.
[0144] When generating the patch file, the development device can first obtain the base device tree image file and the target device tree image file.
[0145] Among them, the base device tree image file is the device tree image file before patch repair, and the target device tree image file is the device tree image file after patch repair. The target device tree image file is compiled and generated by the developer.
[0146] If the above base device tree image file and the above target device tree image file are in a compressed format, the development device can decompress the base device tree image file and the target device tree image file, and then perform format parsing on the decompressed base device tree image file and target device tree image file.
[0147] If the above base device tree image file and the above target device tree image file are not in a compressed format, the development device can directly perform format parsing on the base device tree image file and the target device tree image file.
[0148] The development device can parse the format of the base device tree image file to obtain the device tree source data (dtb.src) corresponding to each motherboard identifier (boardid). The development device can parse the format of the target device tree image file to obtain the device tree target data (dtb.tgt) corresponding to each motherboard identifier.
[0149] Then, the development device can use a differential tool to perform differential processing on the device tree source data and the device tree target data corresponding to each motherboard identifier respectively, to obtain the patch data (dtb.patch) corresponding to each motherboard identifier.
[0150] Different motherboard identifiers are used to represent different motherboards, or, it can also be understood as representing the hardware resources of different products.
[0151] Since device tree repair may be targeted at fixing vulnerabilities in certain types of products, developers may only change the device tree source data corresponding to some motherboard identifiers.
[0152] At this time, if the device tree source data corresponding to a certain motherboard identifier does not need to be repaired, then the device tree source data and the device tree target data corresponding to this motherboard identifier are the same, and the development device performs differential processing on the device tree source data and the device tree target data corresponding to this motherboard identifier, and the obtained patch data is empty.
[0153] If the device tree source data corresponding to a certain motherboard identifier needs to be repaired, then the device tree source data and the device tree target data corresponding to this motherboard identifier are different, and the development device performs differential processing on the device tree source data and the device tree target data corresponding to this motherboard identifier, and the changed code by the developer, that is, the patch data, can be obtained.
[0154] For example, assume that the base device tree image file includes the device tree source data corresponding to the motherboard identifier 0x1000b0x7 and the device tree source data corresponding to the motherboard identifier 0x1000b0x9. This device tree repair is used to fix the vulnerability in the device tree source data corresponding to 0x1000b0x9, then developers may only update the device tree source data of 0x1000b0x9. At this time, the device tree source data and the device tree target data corresponding to 0x1000b0x9 are different, and the obtained patch data is not empty. While the device tree source data of 0x1000b0x7 has not been changed, therefore, the device tree source data and the device tree target data corresponding to 0x1000b0x7 are the same, and the obtained patch data is empty.
[0155] After obtaining the patch data, the development device can generate a patch file according to the patch data corresponding to each mainboard identifier and a preset data format. Moreover, the development device can also calculate the hash values of the device tree source data, the device tree target data, and the patch data corresponding to each mainboard identifier, and store the above hash values in the patch file, so that the user device can verify the correctness of the patch data according to the above hash values.
[0156] The hash algorithm for the development device to calculate the hash value can be selected according to actual needs. For example, in some embodiments, the development device can select the Secure Hash Algorithm 256 (SHA-256) to calculate the hash value. In other embodiments, the development device can also select hash algorithms such as SHA-224, SHA-384, SHA-512, etc. to calculate the hash value.
[0157] In addition, the above preset data format can be set according to actual needs. For example, in some embodiments, the above preset data format can be as shown in Table 1:
[0158] Table 1
[0159]
[0160] As shown in Table 1, the file name of the patch file can be patch-dtbo.img, where.img is the extension of the image file. The data structure of the patch file can include a header and data sub-structures corresponding to one or more mainboard identifiers (i.e., data sub-structures corresponding to one or more mainboards).
[0161] For example, the header of the patch file can be dt_table_header in Table 1; the data sub-structures corresponding to each mainboard identifier in the patch file can be dt_table_entry_v1, dt_table_entry_v2, and dt_table_entry_v3, etc. in Table 1.
[0162] In the header of the patch file, parameters such as magic number, the size of the target device tree image file (total_size), the size of the header (header_size), the size of the device tree entry (dt_entry_size), the number of device tree entries (dt_entry_count), the position of the device tree entries (dt_entries_offset), the page size (page_size), and the version number (version) can be included. The content of each parameter in the header is consistent with the header of the target device tree image file, and the development device can directly copy the content of each parameter of the header of the target device tree image file as the header of the patch file.
[0163] In the data sub-structures corresponding to the respective main board identifiers in the patch file, it may include the size (dt_size) of the patch data for a certain main board, the position (dt_offset) of the patch data for a certain main board, the position (dt_offset) of the patch data for a certain main board, the main board identifier (id (board id)) of a certain main board, the hash value of the patch data (patch Sha256
[32] ), the size (dst Size) of the device tree target data, the hash value of the device tree target data (dst Sha256
[32] ), the size (src Size) of the device tree source data, the hash value of the device tree source data (src Sha256
[32] ), the patch data (dtb), and other parameters.
[0164] The development device can determine and fill the content of each parameter in the data sub-structures corresponding to the respective main board identifiers based on the device tree source data, the device tree target data, and the patch data corresponding to each main board identifier, to obtain the patch file.
[0165] It should be noted that the above data structure is only a schematic example of the embodiments of the present application and should not be construed as a limitation on the data structure of the above patch file. In some other embodiments of the present application, the data structure of the patch file may have more or fewer sub-structures and parameters than the structure shown in Table 1. The embodiments of the present application do not impose any restrictions on the data structure of the patch file.
[0166] After generating the patch file, the development device can directly send the patch file to the user device, or alternatively, the development device can also upload the patch file to the relay device.
[0167] When a direct communication connection is established between the development device and the user device, the development device can directly push the generated patch file to the user device, or alternatively, the user device can also actively request the development device to send down the patch file.
[0168] When an indirect communication connection is established between the development device and the user device, the development device can upload the patch file to the relay device (such as a server), and the relay device will push the patch file to the user device, or alternatively, the user device can access the relay device to download the patch file.
[0169] 2. Device tree image file repair.
[0170] After obtaining the patch file, the user device can store the patch file in the patch (Kpatch) partition of the storage space of this device.
[0171] For example, as Figure 2As shown, the ROM of the user device can be divided into partitions such as a boot partition, a device tree blob overlay (Dtbo) partition, a system partition, and a vendor partition. After obtaining the patch file, the user device can store the patch file in the Kpatch partition of the ROM.
[0172] After that, when the operating system of the user device starts up, the user device can obtain the original device tree image file from the device tree partition. When obtaining the original device tree image file, in order to prevent the data in the device tree partition from being tampered with, the user device can obtain the digital signature of the device tree partition and perform a security check on the device tree partition based on the digital signature of the device tree partition. After the security check passes, the user device obtains the original device tree image file from the device tree partition.
[0173] Then, the user can query and obtain the patch file in the patch partition. When obtaining the patch file, in order to prevent the data in the patch partition from being tampered with, the user device can obtain the digital signature of the patch partition and perform a security check on the patch partition based on the digital signature of the patch partition.
[0174] After the security check passes, the user device can query whether there is an unapplied patch file in the patch partition.
[0175] If there is no unapplied patch file in the patch partition, the user device starts the operating system according to the above-mentioned original device tree image file in the normal startup process.
[0176] If there is an unapplied patch file in the patch partition, the user device can parse the format of the patch file to obtain the corresponding target patch data.
[0177] Since there is patch data corresponding to one or more motherboard identifiers in the patch file. Therefore, the user device can obtain the corresponding target patch data from the patch file according to the target motherboard identifier.
[0178] The target motherboard identifier is the identifier of the motherboard of the user device. The user device can query whether there is patch data corresponding to the target motherboard identifier in the patch file according to the target motherboard identifier.
[0179] If there is patch data corresponding to the target motherboard identifier in the patch file, the user device takes the patch data as the target patch data.
[0180] Then, the user device uses a differential tool to perform differential synthesis on the local original device tree image file and the above-mentioned target patch data to obtain an updated device tree image file.
[0181] After obtaining the updated device tree image file, the user device can use the above hash value to verify the updated device tree image file.
[0182] For example, the user device can parse the format of the updated device tree image file to obtain the device tree target data corresponding to the target motherboard identifier. Then, the user device can calculate the hash value of the device tree target data corresponding to the above target motherboard identifier. If the calculated hash value is the same as the hash value of the device tree target data corresponding to the target motherboard identifier in the patch file, the verification of the updated device tree image file passes. If the calculated hash value is different from the hash value of the device tree target data corresponding to the target motherboard identifier in the patch file, the verification of the updated device tree image file fails.
[0183] If the verification passes, it means the patch is successful. The user device can replace and overwrite the original device tree image file with the updated device tree image file to complete the device tree patching operation.
[0184] If the verification fails, it means the patch fails. The user device can abandon the device tree patching operation, or the user device can also re-execute the device tree patching operation.
[0185] In addition, if there is no patch data corresponding to the target motherboard identifier in the patch file, it means the original device tree image file on the user device does not need to be updated, and the user device can directly complete the device tree patching operation.
[0186] It should be noted that since the basic device tree image file may contain the device tree source data of one or more motherboard identifiers, and the original device tree image file may only contain the device tree source data of some of the above one or more motherboard identifiers, the original device tree image file and the above basic device tree image file may be the same or different.
[0187] Similarly, the target device tree image file may contain the device tree target data of one or more motherboard identifiers, and the updated device tree image file may only contain the device tree target data of some of the above one or more motherboard identifiers. Therefore, the target device tree image file and the above updated device tree may be the same or different.
[0188] After completing the patching operation, the user device can continue to start the operating system according to the device tree image file after the patching operation, that is, the original device tree image or the updated device tree image file, in accordance with the normal startup process.
[0189] Next, the above device tree patching and repair method will be described in detail in combination with specific application scenarios.
[0190] Please refer to Figures 3 to 6 。 Figure 3The structural schematic diagram of a user equipment provided by an embodiment of the present application. As Figure 3 shown, the user equipment may include a central processing unit (CPU) 301, a read-only memory (ROM) 302, a random access memory (RAM) 303, and a bus 304.
[0191] Data interaction is carried out among the CPU 301, the ROM 302, and the RAM 303 through the bus 304.
[0192] As Figure 4 shown, the ROM 302 may include partitions such as a Boot partition, a Device Tree (Dt) base layer partition, a Device Tree block overlay (Dtbo) partition, and a Kpatch partition.
[0193] The Boot partition may include files such as a kernel file and a random access memory disk (ram disk).
[0194] The Dtbo partition may include a device tree blob overlay image file (device tree blob overlay.img, Dtbo.img).
[0195] The Kpatch partition may include a patch file for the device tree (patch-dtbo.img), or may further include patch packages such as a kernel patch file (kernel.patch).
[0196] The Dt base layer partition may include a device tree image file (Dt.img).
[0197] When the operating system starts, the CPU 301 may read data from partitions such as the Dtbo partition and the Kpatch partition of the ROM 302 into the RAM 303 to execute the above device tree repair method.
[0198] As Figure 5 shown, it is assumed that the CPU 301 includes the following functional modules: a start_boot module, a diff_patch_pre module, a dobt module, a normal boot module, and a kernel module.
[0199] When the operating system starts, the startup boot module can trigger the initialization of the differential tool, the device tree tool, and the general boot tool through the module call tool.
[0200] When initializing the differential tool, the memory of the differential tool will be initialized. After the general boot tool is initialized, the kernel will be booted.
[0201] The above device tree partitions can be understood as the Dt base layer partition and the Dtbo partition. The above original device tree image files can include Dt.img and Dtbo.img. Among them, Dt.img represents the image file of the base layer of the device tree, and Dtbo.img represents the image file of the overlay layer of the device tree.
[0202] Generally, in the device trees corresponding to the motherboard identifiers of different models, the base layers of the device trees are the same, but the overlay layers of the device trees are different. And the repair of the device tree usually occurs in the overlay layer of the device tree.
[0203] Therefore, the device tree module can obtain Dt.img from the Dt base layer partition through the device tree tool, start Dt.img normally, and not intervene.
[0204] However, when the device tree module starts Dtbo.img, it can first obtain the digital signature of the Dtbo partition and the data of the Dtbo partition, and perform a security check on the data of the Dtbo partition according to the digital signature of the Dtbo partition to prevent the data of the Dtbo partition from being tampered with.
[0205] After the security check of the Dtbo partition passes, the device tree module can read Dtbo.img and decompress Dtbo.img.
[0206] After that, the patch differential module can obtain the digital signature of the Kpatch partition and the data of the Kpatch partition, and perform a security check on the data of the Kpatch partition according to the digital signature of the Kpatch partition to avoid the data of the Kpatch partition from being tampered with.
[0207] After the security check of the Kpatch partition passes, the patch differential module can read the patch file in the Kpatch partition.
[0208] Since the patch file includes patch data corresponding to multiple motherboard identifiers, the patch differential module can obtain the target motherboard identifier of this device and query whether there is target patch data corresponding to the target motherboard identifier in the patch file.
[0209] If there is target patch data corresponding to the target motherboard identifier in the patch file, it indicates that Dtbo.img needs to be patched; if there is no target patch data corresponding to the target motherboard identifier in the patch file, it indicates that Dtbo.img does not need to be patched.
[0210] Assume that there is target patch data corresponding to the target motherboard identifier in the patch file. At this time, the patch difference module can call the difference tool to patch Dtbo.img, and perform difference synthesis on Dtbo.img and the target patch data corresponding to the target motherboard identifier to obtain a new Dtbo.img (i.e., the new device tree block overlay image file).
[0211] Then, the patch difference module can obtain the hash value in the patch file and verify the new Dtbo.img according to the hash value in the patch file. If the verification of the new Dtbo.img passes, the new Dtbo.img is copied to the original address of Dtbo.img to replace the previous Dtbo.img.
[0212] After that, the device tree module can merge Dt.img and the new Dtbo.img to obtain a complete device tree, and continue to execute the subsequent steps according to the normal startup process of the operating system.
[0213] In the device tree repair method of the embodiment of the present application, the development device performs difference processing on the device tree source data and device tree target data corresponding to each motherboard identifier to obtain the patch data corresponding to each motherboard identifier. The user device patches the original device tree image file with the patch data to repair the original device tree image file and obtain an updated device tree image file.
[0214] In the above device tree repair method, the development device and the user device repair the device tree in the form of patches, without compiling a complete version file, without changing the version number, and without updating other image files other than the device tree image file, which can greatly reduce the content to be updated. For example, the data size of the previous version file was about 4M bytes, and the data size of the current patch file is about 10k bytes.
[0215] Moreover, since the above device tree repair method patches the vulnerabilities of the device tree in the form of patches, for single-point problems such as device replacement, power parameter repair, and device vulnerability (bug) repair, the patch file only needs to pass the verification on the single-point problem and does not need to change the original version file. Therefore, releasing a patch does not require steps such as compilation, basic function testing, compatibility testing, and submission for testing, thus greatly shortening the repair time of the device tree, improving the repair speed, and reducing the consumption of manpower and time.
[0216] In addition, since the patch file can contain patch data corresponding to multiple mainboard identifiers, the same patch package can be adapted to multiple models and different mainboards, so as to repair the device tree vulnerabilities of multiple models with one patch package. Moreover, since multiple patch data share the same patch file, when the user device verifies the patch file, it only needs to verify the patch file once, without verifying each patch data separately, reducing the verification times and improving the patch efficiency.
[0217] If there are other patch packages in the patch partition in addition to the patch file of the device tree, the user device can also control the loading order of the patch packages and load the patch packages according to the loading order to meet the repair requirements of the user device.
[0218] When the patch file adopts the data structure shown in Table 1 above, it can support one patch file to be adapted to multiple models. Moreover, the hash value in the patch file can also verify the updated device tree file to ensure that the data is not tampered with.
[0219] The above device tree repair method can patch and repair the device tree in various modes, and the aforementioned modes can include normal startup (normal) mode, repair (recovery) mode, additional repair (erecovery) mode, fastbootd mode, etc.
[0220] It should be understood that the sequence numbers of the steps in the above embodiments do not mean the order of execution. The execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
[0221] Hereinafter, from the perspective of the development device, another device tree repair method provided by the embodiments of the present application will be described in detail. Please refer to Figure 6 , the device tree repair method provided by this embodiment includes:
[0222] S601. Obtain device tree source data and device tree target data;
[0223] S602. Perform differential processing on the device tree source data and the device tree target data to obtain patch data;
[0224] S603. Send the patch data to the user device to instruct the user device to perform differential synthesis on the patch data and the original device tree image file in the user device to obtain an updated device tree image file.
[0225] Optionally, the obtaining of the device tree source data and the device tree target data includes:
[0226] Obtain the base device tree image file and the target device tree image file;
[0227] Perform format parsing on the base device tree image file to obtain the device tree source data corresponding to each main board identifier;
[0228] Perform format parsing on the target device tree image file to obtain the device tree target data corresponding to each main board identifier;
[0229] Correspondingly, the differential processing of the device tree source data and the device tree target data to obtain patch data includes:
[0230] Perform differential processing on the device tree source data and the device tree target data corresponding to each main board identifier respectively to obtain the patch data corresponding to each main board identifier.
[0231] Optionally, the sending the patch data to the user device includes:
[0232] Encapsulate the patch data into a patch file according to a preset data format;
[0233] Send the patch file to the user device.
[0234] In the patch repair method of the embodiments of the present application, the development device repairs the device tree by means of a patch, without the need to release a new version file, reducing the content to be updated. Moreover, releasing patch data does not require a complex version testing and release process, which can improve the device tree repair speed and reduce the consumption of manpower and time.
[0235] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution. The execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
[0236] Hereinafter, from the perspective of the user device, another device tree repair method provided by the embodiments of the present application will be described in detail. Please refer to Figure 7 , the device tree repair method provided in this embodiment includes:
[0237] S701. Obtain patch data, where the patch data is data obtained by a development device through differential processing of device tree source data and device tree target data;
[0238] S702. Obtain the original device tree image file;
[0239] S703. Perform differential synthesis of the patch data and the original device tree image file to obtain an updated device tree image file.
[0240] Optionally, the obtaining the patch data includes:
[0241] Obtain a patch file, where the patch file includes patch data corresponding to at least one main board identifier;
[0242] Obtain a target main board identifier;
[0243] Search for target patch data corresponding to the target main board identifier in the patch file;
[0244] Correspondingly, the differential synthesis of the patch data and the original device tree image file to obtain an updated device tree image file includes:
[0245] If there is target patch data corresponding to the target main board identifier in the patch file, then perform differential synthesis on the target patch data and the original device tree image file to obtain an updated device tree image file.
[0246] Optionally, the obtaining of the patch data includes:
[0247] Obtain the digital signature of the patch partition, and perform a security check on the patch partition according to the digital signature of the patch partition;
[0248] If the security check of the patch partition passes, then obtain the patch data from the patch partition.
[0249] Optionally, before obtaining the digital signature of the patch partition, it further includes:
[0250] Receive the patch data sent by the development device, and store the patch data in the patch partition.
[0251] Optionally, the obtaining of the original device tree image file includes:
[0252] Obtain the digital signature of the device tree partition, and perform a security check on the device tree partition according to the digital signature of the device tree partition;
[0253] If the security check of the device tree partition passes, then obtain the original device tree image file from the device tree partition.
[0254] In the device tree repair method of the embodiments of the present application, the user device repairs the device tree through patches, without releasing new version files, reducing the content of updates. Moreover, using patch data to repair the device tree does not require a complex version testing and release process, which can improve the device tree repair speed and reduce the consumption of manpower and time.
[0255] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution. The execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
[0256] A development device provided by an embodiment of the present application will be described in detail below. Please refer to Figure 8 , the development device provided by this embodiment includes:
[0257] A first data module 801, configured to obtain device tree source data and device tree target data;
[0258] A differential processing module 802, configured to perform differential processing on the device tree source data and the device tree target data to obtain patch data;
[0259] A data sending module 803, configured to send the patch data to a user device, so as to instruct the user device to perform differential synthesis on the patch data and an original device tree image file in the user device to obtain an updated device tree image file.
[0260] Optionally, the first data module 801 includes:
[0261] A file acquisition sub-module, configured to acquire a basic device tree image file and a target device tree image file;
[0262] A basic parsing sub-module, configured to perform format parsing on the basic device tree image file to obtain device tree source data corresponding to each main board identifier;
[0263] A target parsing sub-module, configured to perform format parsing on the target device tree image file to obtain device tree target data corresponding to each main board identifier;
[0264] Correspondingly, the differential processing module 802 is specifically configured to perform differential processing on the device tree source data and the device tree target data corresponding to each main board identifier respectively to obtain patch data corresponding to each main board identifier.
[0265] Optionally, the data sending module 803 includes:
[0266] A format encapsulation sub-module, configured to encapsulate the patch data into a patch file according to a preset data format;
[0267] A file sending sub-module, configured to send the patch file to a user device.
[0268] It should be noted that for the information interaction, execution process, etc. between the above-mentioned devices / units, since they are based on the same concept as the method embodiment of the present application, their specific functions and the technical effects brought about can be specifically referred to the method embodiment part, and will not be elaborated here.
[0269] A user device provided by an embodiment of the present application will be described in detail below. Please refer to Figure 9, the user equipment provided in this embodiment includes:
[0270] A second data module 901, configured to obtain patch data, where the patch data is data obtained by a development device through differential processing of device tree source data and device tree target data;
[0271] An original file module 902, configured to obtain an original device tree image file;
[0272] A differential synthesis module 903, configured to perform differential synthesis on the patch data and the original device tree image file to obtain an updated device tree image file.
[0273] Optionally, the second data module 901 includes:
[0274] A patch file sub-module, configured to obtain a patch file, where the patch file includes patch data corresponding to at least one main board identifier;
[0275] A target identifier sub-module, configured to obtain a target main board identifier;
[0276] A patch search sub-module, configured to search for target patch data corresponding to the target main board identifier in the patch file;
[0277] Correspondingly, the differential synthesis module 903 is specifically configured to, if there is target patch data corresponding to the target main board identifier in the patch file, perform differential synthesis on the target patch data and the original device tree image file to obtain an updated device tree image file.
[0278] Optionally, the second data module 901 includes:
[0279] A patch signature sub-module, configured to obtain a digital signature of a patch partition, and perform security verification on the patch partition according to the digital signature of the patch partition;
[0280] A patch verification sub-module, configured to, if the security verification of the patch partition passes, obtain patch data from the patch partition.
[0281] Optionally, the second data module 901 further includes:
[0282] A data reception sub-module, configured to receive patch data sent by the development device and store the patch data in the patch partition.
[0283] Optionally, the original file module 902 includes:
[0284] A device signature sub-module, configured to obtain a digital signature of a device tree partition, and perform security verification on the device tree partition according to the digital signature of the device tree partition;
[0285] The device verification sub-module is used to obtain the original device tree image file from the device tree partition if the security verification of the device tree partition passes.
[0286] It should be noted that for the information interaction, execution process, etc. between the above-mentioned device / units, since they are based on the same concept as the method embodiment of the present application, for their specific functions and the technical effects brought, please refer to the method embodiment part specifically, and will not be elaborated here.
[0287] Please refer to Figure 10 , the embodiment of the present application also provides an electronic device. As Figure 10 shown, the electronic device 100 in this embodiment includes: a processor 1000, a memory 1001, and a computer program 1002 stored in the memory 1001 and executable on the processor 1000. When the processor 1000 executes the computer program 1002, it implements the steps in the above-mentioned screen expansion method embodiment, such as Figure 6 the steps S601 to S603 shown. Alternatively, when the processor 1000 executes the computer program 1002, it implements the functions of each module / unit in the above-mentioned device embodiments, such as Figure 8 the functions of the modules 801 to 803 shown.
[0288] Exemplarily, the computer program 1002 can be divided into one or more modules / units. The one or more modules / units are stored in the memory 1001 and executed by the processor 1000 to complete the present application. The one or more modules / units can be a series of computer program instruction segments capable of completing specific functions, and these instruction segments are used to describe the execution process of the computer program 1002 in the electronic device 100. For example, the computer program 1002 can be divided into a first data module, a differential processing module, and a data sending module, and the specific functions of each module are as follows:
[0289] The first data module is used to obtain device tree source data and device tree target data;
[0290] The differential processing module is used to perform differential processing on the device tree source data and the device tree target data to obtain patch data;
[0291] The data sending module is used to send the patch data to the user device to instruct the user device to perform differential synthesis on the patch data and the original device tree image file in the user device to obtain an updated device tree image file.
[0292] The electronic device 100 may be a computing device such as a desktop computer, a notebook, a handheld computer, and a cloud server. The electronic device may include, but is not limited to, a processor 1000 and a memory 1001. Those skilled in the art can understand that Figure 10 merely examples of the electronic device 100, which do not constitute a limitation on the electronic device 100, may include more or fewer components than shown in the figure, or combine certain components, or different components. For example, the electronic device may further include input / output devices, network access devices, a bus, etc.
[0293] The so-called processor 1000 may be a central processing unit (CPU), or may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0294] The memory 1001 may be an internal storage unit of the electronic device 100, such as the hard disk or memory of the electronic device 100. The memory 1001 may also be an external storage device of the electronic device 100, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 100. Further, the memory 1001 may also include both the internal storage unit and the external storage device of the electronic device 100. The memory 1001 is used to store the computer program and other programs and data required by the electronic device. The memory 1001 may also be used to temporarily store data that has been output or is to be output.
[0295] Those skilled in the art can clearly understand that, for the convenience and conciseness of description, only the above division of each functional unit and module is used as an example. In actual applications, the above functions can be assigned to different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiments can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit. In addition, the specific names of each functional unit and module are only for the convenience of mutual distinction and do not limit the protection scope of this application. The specific working processes of the units and modules in the above system can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.
[0296] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For parts not detailed or recorded in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0297] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or by a combination of computer software and electronic hardware. Whether these functions are executed in the form of hardware or software depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0298] In the embodiments provided in this application, it should be understood that the disclosed device / electronic device and method can be implemented in other ways. For example, the device / electronic device embodiments described above are only illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical or other forms.
[0299] 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 can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0300] In addition, each functional unit in various embodiments of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of a software functional unit.
[0301] If the above-mentioned integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium. Based on such an understanding, all or part of the processes in the above-mentioned method embodiments of the present application can also be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable storage medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content included in the computer-readable storage medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable storage medium does not include electrical carrier signals and telecommunication signals.
[0302] Finally, it should be noted that the above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A device tree repair method, characterized in that, applied to a development device, includes: Obtain the device tree source data and device tree target data corresponding to each mainboard identifier; Perform differential processing on the device tree source data and the device tree target data corresponding to each mainboard identifier respectively to obtain the patch data corresponding to each mainboard identifier; Send the patch data to the user device to instruct the user device to perform differential synthesis on the patch data and the original device tree image file in the user device to obtain an updated device tree image file.
2. The device tree repair method according to claim 1, characterized in that, The obtaining the device tree source data and device tree target data includes: Obtain a basic device tree image file and a target device tree image file; Perform format parsing on the basic device tree image file to obtain the device tree source data corresponding to each mainboard identifier; Perform format parsing on the target device tree image file to obtain the device tree target data corresponding to each mainboard identifier.
3. The device tree repair method according to claim 1, characterized in that, The sending the patch data to the user device includes: Encapsulate the patch data into a patch file according to a preset data format; Send the patch file to the user device.
4. A device tree repair method, characterized in that, applied to a user device, includes: Obtain patch data, where the patch data is data obtained by a development device performing differential processing on the device tree source data and device tree target data corresponding to a mainboard identifier; Obtain the original device tree image file; Perform differential synthesis on the patch data and the original device tree image file to obtain an updated device tree image file.
5. The device tree repair method according to claim 4, characterized in that, The obtaining the patch data includes: Obtain a patch file, where the patch file includes patch data corresponding to at least one mainboard identifier; Obtain a target mainboard identifier; Search for target patch data corresponding to the target mainboard identifier in the patch file; Correspondingly, the performing differential synthesis on the patch data and the original device tree image file to obtain an updated device tree image file includes: If there is target patch data corresponding to the target mainboard identifier in the patch file, perform differential synthesis on the target patch data and the original device tree image file to obtain an updated device tree image file.
6. The device tree repair method according to claim 4, characterized in that, The obtaining the patch data includes: Obtain the digital signature of the patch partition, and perform security verification on the patch partition according to the digital signature of the patch partition; If the security verification of the patch partition passes, obtain the patch data from the patch partition.
7. The device tree repair method according to claim 6, characterized in that, Before obtaining the digital signature of the patch partition, further includes: Receive the patch data sent by the development device and store the patch data in the patch partition.
8. The device tree repair method according to claim 4, characterized in that, The obtaining the original device tree image file includes: Obtain the digital signature of the device tree partition, and perform a security check on the device tree partition according to the digital signature of the device tree partition; If the security check of the device tree partition passes, obtain the original device tree image file from the device tree partition.
9. A development 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, the method described in any one of claims 1 to 3 is implemented.
10. A user 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, the method described in any one of claims 4 to 8 is implemented.
11. A device tree repair system, wherein, it includes the development device described in claim 9 and the user device described in claim 10.
12. A computer-readable storage medium storing a computer program, wherein, when the computer program is executed by a processor, the method described in any one of claims 1 to 3 is implemented, or the method described in any one of claims 4 to 8 is implemented.
13. A chip system, wherein, the chip system includes a memory and a processor, and the processor executes the computer program stored in the memory to implement the method described in any one of claims 1 to 3, or to implement the method described in any one of claims 4 to 8.
Citation Information
Patent Citations
Upgrading method and terminal
CN107301070A