WO2022052739A1 - 设备树修复方法、系统及计算机可读存储介质 - Google Patents

设备树修复方法、系统及计算机可读存储介质 Download PDF

Info

Publication number
WO2022052739A1
WO2022052739A1 PCT/CN2021/112448 CN2021112448W WO2022052739A1 WO 2022052739 A1 WO2022052739 A1 WO 2022052739A1 CN 2021112448 W CN2021112448 W CN 2021112448W WO 2022052739 A1 WO2022052739 A1 WO 2022052739A1
Authority
WO
WIPO (PCT)
Prior art keywords
device tree
patch
data
image file
target
Prior art date
Application number
PCT/CN2021/112448
Other languages
English (en)
French (fr)
Inventor
高明
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to US18/044,938 priority Critical patent/US20230385046A1/en
Priority to EP21865795.5A priority patent/EP4202646A4/en
Publication of WO2022052739A1 publication Critical patent/WO2022052739A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/57Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
    • G06F21/572Secure firmware programming, e.g. of basic input output system [BIOS]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/57Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
    • G06F21/575Secure boot
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/658Incremental updates; Differential updates

Definitions

  • the present application belongs to the technical field of terminals, and in particular, relates to a device tree repair method, system, and computer-readable storage medium.
  • a device tree is a data structure that describes hardware resources.
  • the device tree is usually stored in the storage area of the electronic device in the form of an image file.
  • the storage area of the electronic device also includes other types of image files.
  • the developer can only repair the device tree by publishing a new version file. Since each image file carries information such as a version number, when a developer releases a new version file, the version file needs to update each image file, resulting in too many updates.
  • the embodiments of the present application provide a device tree repair method, development device, user equipment, system, and computer-readable storage medium, which can solve the problem that the current device tree repair solution has too many updated contents, long publishing process, slow speed, A problem that consumes a lot of manpower and time.
  • an embodiment of the present application provides a device tree repair method, which is applied to a development device, including:
  • the patch data is sent to the user equipment to instruct the user equipment to perform differential synthesis of the patch data and the original device tree image file in the user equipment to obtain an updated device tree image file.
  • the source data of the device tree is the data of the device tree before the patch is repaired
  • the target data of the device tree is the data of the device tree after the repair of the patch.
  • the device tree target data is compiled by the developer.
  • the development device When the development device repairs the device tree, it can first obtain the source data of the device tree and the target data of the device tree. Then, the development device performs differential processing on the device tree source data and the device tree target data to obtain patch data.
  • the development device may send the patch data to the user device.
  • the user equipment After acquiring the patch data, the user equipment performs differential synthesis on the patch data and the original device tree image file to obtain an updated device tree image file.
  • the original device tree image file is a local device tree image file of the user device.
  • the development device repairs the device tree through patches, without releasing new version files, reducing the content of updates, and releasing patch data does not require complex version testing and release processes, which can improve the device tree. Repair speed, reduce labor and time consumption.
  • the acquiring device tree source data and device tree target data includes:
  • performing differential processing on the device tree source data and the device tree target data to obtain patch data including:
  • Differential processing is performed on the device tree source data and the device tree target data corresponding to each of the mainboard identifiers, respectively, to obtain patch data corresponding to each of the mainboard identifiers.
  • the development device may first acquire the basic device tree image file and the target device tree image file.
  • the basic device tree image file is the device tree image file before the patch repair
  • the target device tree image file is the device tree image file after the patch repair.
  • the target device tree image file is compiled and generated by the developer.
  • 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 mainboard 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 mainboard identifiers.
  • the development device may perform differential processing on the device tree source data and the device tree target data corresponding to each mainboard identifier, respectively, to obtain patch data corresponding to each mainboard identifier.
  • the device tree source data corresponding to a motherboard identification does not need to be repaired, the device tree source data corresponding to the motherboard identification is consistent with the device tree target data, and the development device performs the device tree source data and device tree target data corresponding to the motherboard identification. Differential processing, the resulting patch data is empty.
  • the device tree source data corresponding to a motherboard identification needs to be repaired, the device tree source data corresponding to the motherboard identification and the device tree target data are inconsistent, and the development device performs differential processing on the device tree source data and device tree target data identified by the motherboard , you can get the code changed by the developer, that is, the patch data.
  • the sending the patch data to the user equipment includes:
  • the patch data is encapsulated into a patch file
  • the patch file is sent to the user device.
  • the development device can encapsulate the above-mentioned 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.
  • an embodiment of the present application provides a device tree repair method, which is applied to user equipment, including:
  • the patch data is the data obtained by the development equipment performing differential processing on the device tree source data and the device tree target data;
  • the patch data and the original device tree image file are differentially synthesized to obtain an updated device tree image file.
  • the patch data is the data obtained by differential processing of the source data of the device tree and the target data of the device tree by the development device.
  • the user equipment 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.
  • the user device repairs the device tree by means of patches, without releasing a new version file, reducing the content of the update, and repairing the device tree by using patch data does not need to go through a complex version test and release process, and can Improve the repair speed of the equipment tree and reduce the consumption of manpower and time.
  • the acquiring patch data includes:
  • the patch file includes patch data corresponding to at least one mainboard identifier
  • performing differential synthesis of the patch data and the original device tree image file to obtain an updated device tree image file including:
  • the target patch data and the original device tree image file are differentially synthesized to obtain an updated device tree image file.
  • the development device can parse the format of the basic device tree image file to obtain the source data of the device tree corresponding to each mainboard identifier, and the development device can parse the format of the target device tree image file to obtain the corresponding data of each mainboard identifier.
  • Device tree target data can be parse the format of the basic device tree image file to obtain the source data of the device tree corresponding to each mainboard identifier, and the development device can parse the format of the target device tree image file to obtain the corresponding data of each mainboard identifier.
  • the development device may perform differential processing on the device tree source data and the device tree target data corresponding to each mainboard identifier, respectively, to obtain patch data corresponding to each mainboard identifier.
  • the development device encapsulates the patch data corresponding to each motherboard identifier into a patch file, and sends the patch file to the user device.
  • the patch file can be obtained first.
  • the patch file includes patch data corresponding to one or more mainboard identifiers.
  • the user equipment can obtain the target mainboard identifier of the device, and search the patch file for target patch data corresponding to the target mainboard identifier.
  • the target patch data corresponding to the target motherboard ID 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 device can continue to perform the booting steps of starting the operating system according to the original device tree image file.
  • the target patch data corresponding to the target motherboard ID is found in the patch file, it means that the original device tree image file needs to be patched.
  • the user device can differentially synthesize the target patch data and the original device tree image file to obtain the updated device.
  • Tree image file that is, the device tree image file after patch repair).
  • the basic device tree image file may contain the device tree source data of one or more mainboard identifiers
  • the original device tree image file may only contain the device tree source data of part of the mainboard identifiers among the above one or more mainboard identifiers, therefore,
  • the original device tree image file and the base device tree image file described above may or may not be the same.
  • the target device tree image file may contain device tree target data of one or more mainboard identifiers
  • the update device tree image file may only contain the device tree target data of part of the mainboard identifiers among the above one or more mainboard identifiers. Therefore, the target device tree image file and the update device tree described above may or may not be the same.
  • the acquiring patch data includes:
  • the patch data is acquired from the patch partition.
  • the user equipment when the user equipment obtains patch data from the patch partition, in order to prevent the data of the patch partition from 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.
  • the security check of the patch partition passes, it means 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.
  • the method before obtaining the digital signature of the patch partition, the method further includes:
  • the memory of the user equipment may be divided into multiple partitions.
  • the read-only memory of the user equipment may be divided into partitions such as a boot partition, a device tree blob overlay (Dtbo) partition, a system partition, and a vendor partition.
  • Dtbo device tree blob overlay
  • the user equipment may store the patch data in the local patch partition.
  • the obtaining the original device tree image file includes:
  • the original device tree image file is obtained from the device tree partition.
  • the user equipment when the user equipment obtains the original device tree image file from the device tree partition, in order to prevent the data of the device tree partition from being tampered with, the user equipment can obtain the digital signature of the device tree partition. Partition for security verification.
  • the security check of the device tree partition passes, it means that the data in the device tree partition has not been tampered with, and the user equipment can obtain the original device tree image file from the device tree partition.
  • an electronic device including:
  • the first data module is used to obtain device tree source data and device tree target data
  • a differential processing module for performing differential processing on the device tree source data and the device tree target data to obtain patch data
  • a data sending module configured to send the patch data to the user equipment to instruct the user equipment to perform differential synthesis of the patch data and the original device tree image file in the user equipment to obtain an updated device tree image file.
  • the first data module includes:
  • the file acquisition sub-module is used to acquire the basic device tree image file and the target device tree image file;
  • the basic parsing submodule is used for format parsing of the basic device tree image file to obtain device tree source data corresponding to each mainboard identifier;
  • the target parsing submodule is used to perform format parsing on the target device tree image file to obtain device tree target data corresponding to each mainboard identifier;
  • the differential processing module is specifically configured to perform differential processing on the device tree source data and device tree target data corresponding to each of the mainboard identifiers, respectively, to obtain patch data corresponding to each of the mainboard identifiers.
  • the data sending module includes:
  • a format encapsulation sub-module for encapsulating the patch data into a patch file according to a preset data format
  • the file sending submodule is used for sending the patch file to the user equipment.
  • an electronic device including:
  • the second data module is used to obtain patch data, the patch data is the data obtained by the development equipment performing differential processing on the device tree source data and the device tree target data;
  • the original file module is used to obtain the original device tree image file
  • a differential synthesis module configured to perform differential synthesis of the patch data and the original device tree image file to obtain an updated device tree image file.
  • the second data module includes:
  • a patch file submodule used to obtain a patch file, the patch file including patch data corresponding to at least one mainboard identifier
  • the target identification sub-module is used to obtain the target motherboard identification
  • a patch search submodule used for searching the target patch data corresponding to the target motherboard identification in the patch file
  • the differential synthesis module is specifically configured to perform differential synthesis between the target patch data and the original device tree image file if there is target patch data corresponding to the target motherboard identifier in the patch file, Get the updated device tree image file.
  • the second data module includes:
  • a patch signature submodule configured to 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;
  • a patch check sub-module configured to obtain patch data from the patch partition if the patch partition passes the security check.
  • the second data module further includes:
  • a data receiving submodule configured to receive patch data sent by the development device, and store the patch data in the patch partition.
  • the original file module includes:
  • a device signature submodule configured to obtain the digital signature of the device tree partition, and perform security verification on the device tree partition according to the digital signature of the device tree partition;
  • a device verification submodule configured to obtain an original device tree image file from the device tree partition if the device tree partition passes the security verification.
  • a development device comprising 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 realizes The method as provided in the above-mentioned first aspect.
  • a user equipment 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 as provided in the above-mentioned second aspect.
  • a seventh aspect provides a device tree repair system, including the development device provided in the fifth aspect and the user equipment provided in the sixth aspect.
  • a computer-readable storage medium where the computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, enables the accessory device to implement the method provided in the first aspect above, or , to implement the method provided in the second aspect above.
  • a ninth aspect provides a chip system
  • the chip system may be a single chip or a chip module composed of multiple chips
  • the chip system includes a memory and a processor
  • the processor executes the storage in the memory.
  • a computer program to implement the method provided in the first aspect above, or to implement the method provided in the second aspect above.
  • 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 equipment.
  • the user device patches the original device tree image file through patch data, repairs the original device tree image file, and obtains an updated device tree image file.
  • the development device and the user device repair the device tree by means of patches, without releasing a new version file, and the version number is not changed. Therefore, there is no need to update other image files in the version file, reducing the need for updating Content. Moreover, when the patch data is released, the patch data only needs to be verified by a single point of problems, and does not need to go through a complex version test and release process, thereby improving the repair speed of the device tree, reducing the consumption of manpower and time, and having a strong ease of use. Usability and practicality.
  • FIG. 1 is a schematic structural diagram of a device tree repair system according to an embodiment of the present application.
  • FIG. 2 is a schematic diagram of a partition of a read-only memory provided by an embodiment of the present application.
  • FIG. 3 is a schematic diagram of an electronic device provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of an application scenario provided by an embodiment of the present application.
  • FIG. 5 is a signaling diagram of a device tree repair method provided by an embodiment of the present application.
  • FIG. 6 is a schematic flowchart of a method for repairing a device tree according to an embodiment of the present application
  • FIG. 7 is a schematic flowchart of another device tree repair method provided by an embodiment of the present application.
  • FIG. 8 is a schematic diagram of a development device provided by an embodiment of the present application.
  • FIG. 9 is a schematic diagram of a user equipment according to an embodiment of the present application.
  • FIG. 10 is a schematic diagram of another electronic device provided by an embodiment of the present application.
  • the term “if” may be contextually interpreted as “when” or “once” or “in response to determining” or “in response to detecting “.
  • the phrases “if it is determined” or “if the [described condition or event] is detected” may be interpreted, depending on the context, to mean “once it is determined” or “in response to the determination” or “once the [described condition or event] is detected. ]” or “in response to detection of the [described condition or event]”.
  • references in this specification to "one embodiment” or “some embodiments” and the like mean that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application.
  • appearances of the phrases “in one embodiment,” “in some embodiments,” “in other embodiments,” “in other embodiments,” etc. in various places in this specification are not necessarily All refer to the same embodiment, but mean “one or more but not all embodiments” unless specifically emphasized otherwise.
  • the terms “including”, “including”, “having” and their variants mean “including but not limited to” unless specifically emphasized otherwise.
  • the kernel is the core of an operating system.
  • the kernel is the first layer of software expansion based on hardware resources, provides the most basic functions of the operating system, and is the basis for the operation of the operating system.
  • the kernel is responsible for managing the operating system's processes, memory, device drivers, files and network systems, and determines the performance and stability of the system.
  • the device tree (dt) is introduced into the kernel of some processors.
  • the device tree was introduced after ARM core version 3.x.
  • the device tree is a data structure that describes hardware resources.
  • the device tree can transfer hardware resources into the kernel through a bootloader, so that the descriptions of the kernel source code and the hardware resources are relatively independent. That is to say, the dtb format file (ie, the device tree file) can be read into the memory by the bootloader, and the dtb format file can be parsed by the processor core.
  • the kernel of the same type of processor it is only necessary to replace the device tree file to make the kernel of this type adapt to different motherboards, and it is not necessary to replace the kernel file of the kernel.
  • the device tree is usually stored in the storage area of the electronic device in the form of an image file, and besides the device tree image file, the storage area of the electronic device may also include other types of image files.
  • the read only memory (ROM) of an electronic device can be divided into multiple partitions, and each partition stores images such as boot (boot) image files, device tree blob overlay (Dtbo) image files, system ( system) image files, vendor (vendor) image files and other image files.
  • boot boot
  • device tree blob overlay Dtbo
  • system system
  • vendor vendor
  • Fixing the device tree at this stage can only be done by releasing a new version.
  • the above image files all contain version numbers, and some image files even have timestamps. Therefore, in the process of compiling a new version file, the above image files will change, and the entire version needs to be recompiled, resulting in too many updated contents.
  • 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 through patch repair, which solves the problem that the current device tree repair method has too many updated contents and processes. Long and slow problems, with strong ease of use and practicality.
  • the device tree repair system includes one or more development devices 101 (only one is shown in FIG. 1 ), one or more user equipments 102 (three are shown in FIG. 1 ), and a transit device 103 .
  • the development device 101 is an electronic device that generates a patch file
  • the user device 102 is an electronic device that uses the patch file to repair the device tree.
  • a direct communication connection may be established between the development device 101 and the user equipment 102, that is, a direct communication connection may be established between the development device 101 and the user equipment 102; alternatively, an indirect communication connection may also be established between the development device 101 and the user equipment 102 , that is, a transfer device 103 responsible for transferring data is set between the development device 101 and the user equipment 102 .
  • the development device 101 may send the patch file to the user device 102 through a communication connection directly connected to the user device 102 .
  • the development device 101 may also send the patch file to the transfer device 103 , and the transfer device 103 forwards the patch file to the user device 102 .
  • the above communication connection can be set according to the actual situation.
  • the above communication connection may include wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), RFID or ZigBee and other wireless communication solutions any one or more of them.
  • WLAN wireless local area networks
  • BT Bluetooth
  • RFID ZigBee
  • the above communication connection may also include any one or more of wired communication solutions such as public telecommunication network (Registered Jack 45, RJ45) connection.
  • the electronic device types of the development device 101 , the user device 102 and the relay device 103 can be determined according to actual conditions.
  • the above-mentioned development equipment 101, user equipment 102 and transfer equipment 103 may be mobile phones, tablet computers, wearable devices, in-vehicle devices, augmented reality (AR)/virtual reality (VR) devices, laptops, Ultra-mobile personal computer (UMPC), netbook, personal digital assistant (personal digital assistant, PDA) and other electronic devices
  • the embodiments of the present application describe the specific types of the above-mentioned development device 101, user device 102, and transfer device 103 No restrictions apply.
  • the development device 101 , the user equipment 102 and the transfer device 103 may be the same type of electronic devices, or the development device 101 , the user equipment 102 and the transfer device 103 may also be different types of electronic devices.
  • the multiple development devices 101 may be electronic devices of the same type, or may also be electronic devices of different types.
  • the multiple user equipments 102 may be electronic devices of the same type, or may also be electronic devices of different types.
  • the multiple relay devices 103 may be electronic devices of the same type, or may also be electronic devices of different types.
  • the device tree repair system shown in FIG. 1 is only a schematic example of the embodiment of the present application, and should not be construed as a specific limitation on the device tree repair system.
  • the device tree repair system may have more or less electronic devices than the device tree repair system shown in FIG. 1 .
  • the device tree repair system may not include the transit device 103, and the development device 101 and the user equipment 102 establish a direct communication connection. Therefore, the embodiments of the present application do not impose any restrictions on the device tree repair system.
  • the development device can obtain the basic device tree image file and the target device tree image file first.
  • the basic device tree image file is the device tree image file before the patch repair
  • the target device tree image file is the device tree image file after the patch repair.
  • the target device tree image file is compiled and generated by the developer.
  • the development device can decompress the base device tree image file and the target device tree image file, and then decompress the decompressed base device tree image file and the target device tree image file.
  • the tree image file is formatted for parsing.
  • the development device can directly perform format parsing on the basic device tree mirror file and the target device tree mirror file.
  • the development device parses the format of the basic device tree image file, and can obtain the device tree source data (dtb.src) corresponding to each motherboard ID (board id).
  • the development device parses the format of the target device tree image file, and can obtain the device tree target data (dtb.tgt) corresponding to each mainboard identifier.
  • 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 mainboard identifier, to obtain patch data (dtb.patch) corresponding to each mainboard identifier.
  • motherboard identifiers are used to represent different motherboards, or, it can also be understood to represent hardware resources of different products.
  • the developer may only change the device tree source data corresponding to part of the motherboard identification.
  • the source data of the device tree corresponding to a certain motherboard identification does not need to be repaired, the source data of the device tree corresponding to the identification of the motherboard is consistent with the target data of the device tree, and the source data of the device tree corresponding to the identification of the motherboard and the device tree of the development device are the same.
  • the target data is subjected to differential processing, and the obtained patch data is empty.
  • the device tree source data corresponding to a motherboard identification needs to be repaired, the device tree source data corresponding to the motherboard identification and the device tree target data are inconsistent, and the development device performs differential processing on the device tree source data and device tree target data identified by the motherboard , you can get the code changed by the developer, that is, the patch data.
  • the basic device tree image file includes device tree source data corresponding to the mainboard identifier 0x1000b0x7 and device tree source data corresponding to the mainboard identifier 0x1000b0x9.
  • This device tree repair is used to fix the vulnerability in the device tree source data corresponding to 0x1000b0x9, so the developer may only update the device tree source data of 0x1000b0x9.
  • the source data of the device tree corresponding to 0x1000b0x9 is inconsistent with the target data of the device tree, and the patch data obtained by differential processing is not empty.
  • the source data of the device tree at 0x1000b0x7 has not been changed. Therefore, the source data of the device tree at 0x1000b0x7 is consistent with the target data of the device tree, and the patch data obtained by differential processing is empty.
  • the development device may generate a patch file according to the patch data corresponding to each motherboard identifier and a preset data format.
  • the development device can also calculate the hash value of the source data of the device tree, the hash value of the target data of the device tree and the hash value of the patch data corresponding to each mainboard identifier, and store the above hash values in the patch file, so that The user equipment can verify the correctness of the patch data according to the above hash value.
  • the hash algorithm used by the development device to calculate the hash value can be selected according to actual needs. For example, in some embodiments, the development device may select Secure Hash Algorithm 256 (SHA-256) to calculate the hash value. In other embodiments, the development device may also use hash algorithms such as SHA-224, SHA-384, and SHA-512 to calculate the hash value.
  • Secure Hash Algorithm 256 SHA-256
  • hash algorithms such as SHA-224, SHA-384, and SHA-512 to calculate the hash value.
  • the above-mentioned preset data format can be set according to actual needs.
  • the above-mentioned preset data format may be as shown in Table 1:
  • the file name of the patch file can be patch-dtbo.img, and img is the extension of the image file.
  • the data structure of the patch file may include a header and a data substructure corresponding to one or more mainboard identifiers (that is, a data substructure corresponding to one or more mainboards).
  • the header of the patch file may be dt_table_header in Table 1; the data substructures corresponding to each motherboard identifier in the patch file may be dt_table_entry_v1, dt_table_entry_v2, and dt_table_entry_v3 in Table 1, etc.
  • the header of the patch file can include the magic number (magic), 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 location of the device tree entry (dt_entries_offset), the page size (page_size), the version number (version) and other parameters.
  • 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 in the header of the target device tree image file as the header of the patch file.
  • the data substructure corresponding to each motherboard identifier of the patch file may include the size of the patch data of a certain motherboard (dt_size), the location of the patch data of a certain motherboard (dt_offset), and the location of the patch data of a certain motherboard ( dt_offset), the motherboard identification of a certain motherboard (id (board id)), the hash value of the patch data (patch Sha256[32]), the size of the device tree target data (dstSize), the hash value of the device tree target data ( dst Sha256[32]), size of device tree source data (srcSize), hash value of device tree source data (src Sha256[32]), patch data (dtb) and other parameters.
  • the development device can determine and fill the content of each parameter in the data substructure corresponding to each mainboard identifier according to the device tree source data, device tree target data and patch data corresponding to each mainboard identifier to obtain a patch file.
  • the above data structure is only a schematic example of the embodiment of the present application, and should not be construed as a limitation on the data structure of the above patch file.
  • the data structure of the patch file may have more or less substructures 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.
  • the development device After the development device generates the patch file, it can directly send the patch file to the user device, or the development device can also upload the patch file to the transit device.
  • the development device may directly push the generated patch file to the user device, or the user device may actively request the development device to issue the patch file.
  • the development device can upload the patch file to the transit device (such as a server), and the transit device can push the patch file to the user device, or the user device can access the transit device. Download the patch file.
  • the transit device such as a server
  • the user device may store the patch file in the patch (Kpatch) partition of the storage space of the device.
  • the ROM of the user equipment can be divided into a boot partition, a device tree blob overlay (Dtbo) partition, a system partition, a vendor partition and other partitions.
  • the user equipment may store the patch file in the Kpatch partition of the ROM.
  • the user equipment can obtain the original device tree image file from the device tree partition.
  • the user equipment can obtain the digital signature of the device tree partition, and perform security verification on the device tree partition according to the digital signature of the device tree partition. After passing the security check, the user equipment obtains the original device tree image file from the device tree partition.
  • users can query and obtain patch files in the patch partition.
  • the user device 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.
  • the user equipment can query whether there are unapplied patch files in the patch partition.
  • the user device starts the operating system according to the above-mentioned original device tree image file according to the normal startup process.
  • the user equipment can perform format parsing on the patch file to obtain corresponding target patch data.
  • the user equipment can obtain the corresponding target patch data from the patch file according to the target motherboard identification.
  • the target board ID is the ID of the user device's board.
  • the user equipment can query whether there is patch data corresponding to the target motherboard identifier in the patch file according to the target motherboard identifier.
  • the user equipment uses the patch data as the target patch data.
  • the user equipment 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.
  • the user equipment After obtaining the updated device tree image file, the user equipment can use the above hash value to verify the updated device tree image file.
  • the user equipment may perform format analysis on the updated device tree image file to obtain device tree target data corresponding to the target motherboard identifier. Then, the user equipment may calculate the hash value of the target data of the device tree corresponding to the target motherboard identification. If the calculated hash value is consistent with the hash value of the device tree target data corresponding to the target motherboard identifier in the patch file, the update device tree image file verification is passed. If the calculated hash value is inconsistent with the hash value of the device tree target data corresponding to the target motherboard identifier in the patch file, the update device tree image file verification fails.
  • the patch is successful, and 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 patch operation.
  • the verification fails it means that the patch fails, and the user equipment can abandon the device tree patch operation, or the user equipment can also perform the device tree patch operation again.
  • the original device tree image file may contain device tree source data of one or more mainboard identifiers
  • the original device tree image file may only contain the device tree of part of the mainboard identifiers among the above one or more mainboard identifiers. source data, so the original device tree image file and the base device tree image file described above may or may not be the same.
  • the target device tree image file may contain device tree target data of one or more mainboard identifiers
  • the update device tree image file may only contain the device tree target data of part of the mainboard identifiers among the above one or more mainboard identifiers. Therefore, the target device tree image file and the update device tree described above may or may not be the same.
  • the user equipment can continue to start the operating system according to the normal startup process according to the device tree image file after the patch operation, that is, the original device tree image or the updated device tree image file.
  • FIG. 3 is a schematic structural diagram of a user equipment according to an embodiment of the present application.
  • the user equipment may include a central processing unit (CPU) 301 , a read-only memory (Read-Only Memory, ROM) 302 , a random access memory (Random Access Memory, RAM) 303 and a bus 304 .
  • CPU central processing unit
  • ROM read-only memory
  • RAM random access memory
  • Data exchange is performed between the CPU 301, the ROM 302 and the RAM 303 through the bus 304.
  • the ROM 302 may include partitions such as a boot partition, a device tree (Device Tree, Dt) base layer partition, a device tree block overlay (Dtbo) partition, and a patch (Kpatch) partition.
  • partitions such as a boot partition, a device tree (Device Tree, Dt) base layer partition, a device tree block overlay (Dtbo) partition, and a patch (Kpatch) partition.
  • the Boot partition can include files such as kernel (kenel) files, random access disks (Random Access Memory disk, ram disk).
  • kernel kenel
  • random access disks Random Access Memory disk, ram disk
  • the Dtbo partition can include device tree block overlay image files (device tree blob overlay.img, Dtbo.img).
  • the Kpatch partition may include a device tree patch file (patch-dtbo.img), or may also include patch packages such as a kernel patch file (kernel.patch).
  • a device tree image file (Dt.img) may be included in the Dt base layer partition.
  • the CPU 301 can read data from the Dtbo partition, the Kpatch partition and other partitions of the ROM 302 to the RAM 303 to execute the above-mentioned device tree repair method.
  • the CPU 301 includes the following functional modules: a start boot (start_boot) module, a patch difference (diff_patch_pre) module, a device tree (dobt) module, a normal boot (normal boot) module, and a kernel (kernel) module.
  • the start-boot module can trigger the initialization of the differential tool, the initialization of the device tree tool, and the initialization of the general boot tool through the module call tool.
  • the memory of the differential tool is initialized.
  • the kernel is booted to boot.
  • the above-mentioned device tree partition can be understood as the Dt base layer partition and the Dtbo partition
  • the above-mentioned original device tree image files can include Dt.img and Dtbo.img, where Dt.img represents the image file of the base layer of the device tree, and Dtbo.img represents the image file of the base layer of the device tree. Image file for the overlay of the device tree.
  • the overlay layer of the device tree is different. Also, the repair of the device tree usually occurs in the overlay layer of the device tree.
  • the device tree module can obtain Dt.img from the Dt base layer partition through the device tree tool, and start Dt.img normally without intervention.
  • 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 security verification 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. .
  • the device tree module can read Dtbo.img and decompress Dtbo.img.
  • the patch difference module can obtain the digital signature of the Kpatch partition and the data of the Kpatch partition, and perform security verification on the data of the Kpatch partition according to the digital signature of the Kpatch partition, so as to avoid the data of the Kpatch partition from being tampered with.
  • the patch differential module can read the patch files in the Kpatch partition.
  • the patch differential module can obtain the target mainboard identifier of the device, and query whether there is target patch data corresponding to the target mainboard identifier in the patch file.
  • the patch differential module can call the differential tool to patch Dtbo.img, and perform differential synthesis between Dtbo.img and the target patch data corresponding to the target motherboard ID to obtain a new Dtbo.img (ie the new device tree block overlay image file).
  • the patch difference module can obtain the hash value in the patch file, and check the new Dtbo.img according to the hash value in the patch file. If the new Dtbo.img is verified, copy the new Dtbo.img to the original address of Dtbo.img and replace the previous Dtbo.img.
  • the device tree module can merge the Dt.img and the new Dtbo.img to obtain a complete device tree, and continue to perform subsequent steps according to the normal startup process of the operating system.
  • the development device obtains patch data corresponding to each mainboard identifier by performing differential processing on the device tree source data and device tree target data corresponding to each mainboard identifier.
  • the user device patches the original device tree image file through patch data, repairs the original device tree image file, and obtains an updated device tree image file.
  • the development device and the user device repair the device tree in a patch mode, without compiling the 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 number of updates.
  • Content For example, the data size of the previous version file is about 4M bytes, and the data size of the current patch file is about 10k bytes.
  • the patch file since the above-mentioned device tree repair method repairs the loopholes of the device tree by means of patches, the patch file only needs to be verified and passed on the single-point problem in the single-point problems such as device replacement, power supply parameter repair, and device vulnerability (bug) repair. Yes, the original version file does not need to be changed. Therefore, the release of the patch does not require the steps of compilation, basic function test, compatibility test, and test delivery, which greatly shortens the repair time of the device tree, improves the repair speed, and reduces the Manpower and time consumption.
  • the patch file can contain patch data corresponding to multiple motherboard identifiers
  • the same patch package can be adapted to multiple models and different motherboards, so that one patch package can repair the device tree of multiple models. Vulnerability.
  • multiple patch data are shared in the same patch file, when the user device verifies the patch file, it only needs to verify the patch file once, and does not need to verify each patch data separately, which reduces the number of verifications and improves the performance. Patch efficiency.
  • the user equipment can also control the loading order of the patch packages, and load the patch packages according to the loading order of the patch packages to meet the repair requirements of the user equipment.
  • the patch file can support one patch file to adapt to multiple models, and the hash value in the patch file can also verify the update device tree file to ensure that the data is not tampered with.
  • the above device tree repair method can perform patch repair on the device tree in various modes, and the aforementioned modes may include normal startup mode, recovery mode, extra repair mode, fastboot mode, etc. .
  • the device tree repairing method provided by this embodiment includes:
  • the obtaining device tree source data and device tree target data includes:
  • performing differential processing on the device tree source data and the device tree target data to obtain patch data including:
  • Differential processing is performed on the device tree source data and the device tree target data corresponding to each of the mainboard identifiers, respectively, to obtain patch data corresponding to each of the mainboard identifiers.
  • the sending the patch data to the user equipment includes:
  • the patch data is encapsulated into a patch file
  • the patch file is sent to the user device.
  • the development device repairs the device tree by means of a patch, without releasing a new version file, reducing the updated content, and releasing the patch data does not need to go through a complex version test and release process, and can Improve the repair speed of the equipment tree and reduce the consumption of manpower and time.
  • the device tree repair method provided by this embodiment includes:
  • patch data is data obtained by a development device performing differential processing on device tree source data and device tree target data;
  • the obtaining patch data includes:
  • the patch file includes patch data corresponding to at least one mainboard identifier
  • performing differential synthesis of the patch data and the original device tree image file to obtain an updated device tree image file including:
  • the target patch data and the original device tree image file are differentially synthesized to obtain an updated device tree image file.
  • the obtaining patch data includes:
  • the patch data is acquired from the patch partition.
  • the method further includes:
  • the obtaining the original device tree image file includes:
  • the original device tree image file is obtained from the device tree partition.
  • the user equipment repairs the device tree by means of patches, without releasing a new version file, reducing the content of updates, and repairing the device tree by using patch data does not need to go through complex version testing and
  • the release process can improve the repair speed of the device tree and reduce the consumption of manpower and time.
  • the development equipment provided in this embodiment includes:
  • the first data module 801 is used to obtain device tree source data and device tree target data;
  • 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
  • a data sending module 803, configured to send the patch data to the user equipment to instruct the user equipment to perform differential synthesis of the patch data and the original device tree image file in the user equipment to obtain an updated device tree image file .
  • the first data module 801 includes:
  • the file acquisition sub-module is used to acquire the basic device tree image file and the target device tree image file;
  • the basic parsing submodule is used for format parsing of the basic device tree image file to obtain device tree source data corresponding to each mainboard identifier;
  • the target parsing submodule is used to perform format parsing on the target device tree image file to obtain device tree target data corresponding to each mainboard identifier;
  • the differential processing module 802 is specifically configured to perform differential processing on the device tree source data and device tree target data corresponding to each of the mainboard identifiers, respectively, to obtain patch data corresponding to each of the mainboard identifiers.
  • the data sending module 803 includes:
  • a format encapsulation sub-module for encapsulating the patch data into a patch file according to a preset data format
  • the file sending submodule is used for sending the patch file to the user equipment.
  • the user equipment provided in this embodiment includes:
  • the second data module 901 is used to obtain patch data, the patch data is the data obtained by the development device performing differential processing on the device tree source data and the device tree target data;
  • the differential synthesis module 903 is configured to perform differential synthesis on the patch data and the original device tree image file to obtain an updated device tree image file.
  • the second data module 901 includes:
  • a patch file submodule used to obtain a patch file, the patch file including patch data corresponding to at least one mainboard identifier
  • the target identification sub-module is used to obtain the target motherboard identification
  • a patch search submodule used for searching the target patch data corresponding to the target motherboard identification in the patch file
  • the differential synthesis module 903 is specifically configured to perform differential synthesis between the target patch data and the original device tree image file if there is target patch data corresponding to the target motherboard identifier in the patch file. to get the updated device tree image file.
  • the second data module 901 includes:
  • a patch signature submodule configured to 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;
  • a patch check sub-module configured to obtain patch data from the patch partition if the patch partition passes the security check.
  • the second data module 901 further includes:
  • a data receiving submodule configured to receive patch data sent by the development device, and store the patch data in the patch partition.
  • the original file module 902 includes:
  • a device signature submodule configured to obtain the digital signature of the device tree partition, and perform security verification on the device tree partition according to the digital signature of the device tree partition;
  • a device verification submodule configured to obtain an original device tree image file from the device tree partition if the device tree partition passes the security verification.
  • an embodiment of the present application further provides an electronic device.
  • the electronic device 100 of 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 .
  • the processor 1000 executes the computer program 1002
  • the steps in the above embodiments of the screen expansion method are implemented, for example, steps S601 to S603 shown in FIG. 6 .
  • the processor 1000 executes the computer program 1002
  • the functions of the modules/units in each of the foregoing apparatus embodiments such as the functions of the modules 801 to 803 shown in FIG. 8 , are implemented.
  • the computer program 1002 can be divided into one or more modules/units, and the one or more modules/units are stored in the memory 1001 and executed by the processor 1000 to complete the this application.
  • the one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program 1002 in the electronic device 100 .
  • the computer program 1002 can be divided into a first data module, a differential processing module and a data transmission module, and the specific functions of each module are as follows:
  • the first data module is used to obtain device tree source data and device tree target data
  • a differential processing module for performing differential processing on the device tree source data and the device tree target data to obtain patch data
  • a data sending module configured to send the patch data to the user equipment to instruct the user equipment to perform differential synthesis of the patch data and the original device tree image file in the user equipment to obtain an updated device tree image file.
  • the electronic device 100 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server.
  • the electronic device may include, but is not limited to, a processor 1000 and a memory 1001 .
  • FIG. 10 is only an example of the electronic device 100, and does not constitute a limitation to the electronic device 100. It may include more or less components than the one shown, or combine some components, or different components
  • the electronic device may further include an input and output device, a network access device, a bus, and the like.
  • the so-called processor 1000 may be a central processing unit (Central Processing Unit, CPU), or other general-purpose processors, digital signal processors (Digital Signal Processors, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (FPGA) 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 1001 may be an internal storage unit of the electronic device 100 , such as a hard disk or a 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 memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) equipped on the electronic device 100 card, Flash Card, etc.
  • the memory 1001 may also include both an internal storage unit of the electronic device 100 and an external storage device.
  • the memory 1001 is used to store the computer program and other programs and data required by the electronic device.
  • the memory 1001 can also be used to temporarily store data that has been output or will be output.
  • the disclosed apparatus/electronic device and method may be implemented in other manners.
  • the above-described embodiments of the apparatus/electronic device are only illustrative.
  • the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units. Or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional unit in each embodiment 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 units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
  • the integrated modules/units if implemented in the form of software functional units and sold or used as independent products, may be stored in a computer-readable storage medium.
  • the present application can implement all or part of the processes in the methods of the above embodiments, and can also be completed by instructing the relevant hardware through a computer program.
  • the computer program can be stored in a computer-readable storage medium, and the computer When the program is executed by the processor, the steps of the foregoing method embodiments can be implemented.
  • the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form, and the like.
  • the computer-readable storage medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM, Read-Only Memory) ), random access memory (RAM, Random Access Memory), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content contained 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, computer-readable Storage media exclude electrical carrier signals and telecommunications signals.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Stored Programmes (AREA)

Abstract

一种设备树修复方法、系统及计算机可读存储介质,适用于终端技术领域。设备树修复方法中,开发设备(101)对设备树源数据和设备树目标数据进行差分处理,得到补丁数据(S602),并将补丁数据发送至用户设备(102)。用户设备(102)通过补丁数据对原始设备树镜像文件打补丁,修复原始设备树镜像文件,得到更新设备树镜像文件(S603)。在设备树修复方法中,通过补丁的方式修复设备树,无需发布新的版本文件,减少更新的内容,并且,发布补丁数据不需要经过复杂的版本测试及发布流程,可以提高设备树修复速度,减少人力和时间的消耗,具有较强的易用性和实用性。

Description

设备树修复方法、系统及计算机可读存储介质
本申请要求于2020年09月10日提交国家知识产权局、申请号为202010949031.7、申请名称为“设备树修复方法、系统及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请属于终端技术领域,尤其涉及一种设备树修复方法、系统及计算机可读存储介质。
背景技术
设备树是一种描述硬件资源的数据结构。当前许多电子设备使用设备树描述硬件资源,从而减少内核源码中关于硬件资源的描述代码,使得内核源码与硬件资源的描述相对独立。
设备树通常以镜像文件的形式存储于电子设备的存储区域中。除了设备树镜像文件以外,电子设备的存储区域还包括其他类型的镜像文件。
目前如果设备树需要修复,则开发人员只能是通过发布新的版本文件对设备树进行修复。由于各个镜像文件均带有版本号等信息,因此,当开发人员发布新的版本文件时,版本文件需要对各个镜像文件进行更新,从而导致更新的内容过多。
并且,开发人员发布新的版本文件需要经过编译、基本功能测试、兼容性测试(Compatibility Test Suite,CTS)、送测等步骤,整个版本发布流程长、速度慢,会耗费大量人力和时间。
发明内容
本申请实施例提供了一种设备树修复方法、开发设备、用户设备、系统及计算机可读存储介质,可以解决当前的设备树修复方案中更新的内容过多、发布流程长、速度慢,会耗费大量人力和时间的问题。
第一方面,本申请实施例提供了一种设备树修复方法,应用于开发设备,包括:
获取设备树源数据和设备树目标数据;
对所述设备树源数据和所述设备树目标数据进行差分处理,得到补丁数据;
将所述补丁数据发送至用户设备,以指示所述用户设备将所述补丁数据与所述用户设备中的原始设备树镜像文件进行差分合成,得到更新设备树镜像文件。
需要说明的是,设备树源数据是补丁修复之前的设备树数据,设备树目标数据是补丁修复之后的设备树数据。设备树目标数据由开发人员编译得到。
开发设备在进行设备树修复时,可以先获取设备树源数据和设备树目标数据。然后,开发设备对设备树源数据和设备树目标数据进行差分处理,得到补丁数据。
在得到补丁数据之后,开发设备可以将补丁数据发送至用户设备。
用户设备获取到补丁数据之后,将补丁数据与原始设备树镜像文件进行差分合成, 得到更新设备树镜像文件。其中,原始设备树镜像文件为用户设备本地的设备树镜像文件。
在上述设备树修复方法中,开发设备通过补丁的方式修复设备树,无需发布新的版本文件,减少更新的内容,并且,发布补丁数据不需要经过复杂的版本测试及发布流程,可以提高设备树修复速度,减少人力和时间的消耗。
在第一方面的一种可能的实现方式中,所述获取设备树源数据和设备树目标数据,包括:
获取基础设备树镜像文件和目标设备树镜像文件;
对所述基础设备树镜像文件进行格式解析,得到各个主板标识对应的设备树源数据;
对所述目标设备树镜像文件进行格式解析,得到各个主板标识对应的设备树目标数据;
相应的,所述对所述设备树源数据和所述设备树目标数据进行差分处理,得到补丁数据,包括:
分别对各个所述主板标识对应的设备树源数据和设备树目标数据进行差分处理,得到各个所述主板标识对应的补丁数据。
需要说明的是,开发设备在获取设备树源数据和设备树目标数据时,可以先获取基础设备树镜像文件以及目标设备树镜像文件。
其中,基础设备树镜像文件为补丁修复之前的设备树镜像文件,目标设备树镜像文件为补丁修复之后的设备树镜像文件。目标设备树镜像文件由开发人员编译生成。
之后,开发设备可以对基础设备树镜像文件进行格式解析,得到一个或多个主板标识对应的设备树源数据。开发设备可以对目标设备树镜像文件进行格式解析,得到一个或多个主板标识对应的设备树目标数据。
此时,开发设备可以分别对各个主板标识对应的设备树源数据和设备树目标数据进行差分处理,得到各个主板标识对应的补丁数据。
如果某一主板标识对应的设备树源数据不需要修复,则该主板标识对应的设备树源数据和设备树目标数据一致,开发设备对该主板标识对应的设备树源数据和设备树目标数据进行差分处理,得到的补丁数据是空的。
如果某一主板标识对应的设备树源数据需要修复,则该主板标识对应的设备树源数据和设备树目标数据不一致,开发设备对该主板标识的设备树源数据和设备树目标数据进行差分处理,可以得到开发人员变更的代码,即补丁数据。
在第一方面的一种可能的实现方式中,所述将所述补丁数据发送至用户设备,包括:
根据预设的数据格式,将所述补丁数据封装成补丁文件;
将所述补丁文件发送至用户设备。
需要说明的是,开发设备在获取到补丁数据之后,可以按照预设的数据格式对上述补丁数据进行封装,得到补丁文件。然后,开发设备再将补丁文件发送至用户设备。
第二方面,本申请实施例提供了一种设备树修复方法,应用于用户设备,包括:
获取补丁数据,所述补丁数据为开发设备对设备树源数据和设备树目标数据进行 差分处理得到的数据;
获取原始设备树镜像文件;
将所述补丁数据与所述原始设备树镜像文件进行差分合成,得到更新设备树镜像文件。
需要说明的是,用户设备在进行设备树修复时,可以先获取补丁数据。补丁数据是由开发设备对设备树源数据和设备树目标数据进行差分处理得到的数据。
然后,用户设备可以获取本地的原始设备树镜像文件,对补丁数据和原始设备树镜像文件进行差分合成,从而得到补丁修复后的更新设备树镜像文件。
在上述设备树修复方法中,用户设备通过补丁的方式修复设备树,无需发布新的版本文件,减少更新的内容,并且,采用补丁数据修复设备树不需要经过复杂的版本测试及发布流程,可以提高设备树修复速度,减少人力和时间的消耗。
在第二方面的一种可能的实现方式中,所述获取补丁数据,包括:
获取补丁文件,所述补丁文件包括至少一种主板标识对应的补丁数据;
获取目标主板标识;
在所述补丁文件中查找与所述目标主板标识对应的目标补丁数据;
相应的,所述将所述补丁数据与所述原始设备树镜像文件进行差分合成,得到更新设备树镜像文件,包括:
若所述补丁文件中存在与所述目标主板标识对应的目标补丁数据,则将所述目标补丁数据与所述原始设备树镜像文件进行差分合成,得到更新设备树镜像文件。
需要说明的是,开发设备可以对基础设备树镜像文件进行格式解析,得到各个主板标识对应的设备树源数据,以及,开发设备可以对目标设备树镜像文件进行格式解析,得到各个主板标识对应的设备树目标数据。
然后,开发设备可以分别对各个主板标识对应的设备树源数据和设备树目标数据进行差分处理,得到各个主板标识对应的补丁数据。
之后,开发设备将各个主板标识对应的补丁数据封装成补丁文件,并将补丁文件发送至用户设备。
用户设备在进行补丁修复时,可以先获取补丁文件。补丁文件中包括一个或多个主板标识对应的补丁数据。
此时,用户设备可以获取本设备的目标主板标识,在补丁文件中查找与目标主板标识对应的目标补丁数据。
如果补丁文件中查找不到与目标主板标识对应的目标补丁数据,则表示原始设备树镜像文件无需进行补丁操作,用户设备可以根据原始设备树镜像文件继续执行启动操作系统的开机步骤。
如果补丁文件中查找到与目标主板标识对应的目标补丁数据,则表示原始设备树镜像文件需要打补丁,此时,用户设备可以将目标补丁数据与原始设备树镜像文件进行差分合成,得到更新设备树镜像文件(即补丁修复后的设备树镜像文件)。
由于基础设备树镜像文件中可能包含一个或多个主板标识的设备树源数据,而原始设备树镜像文件可能只包含上述一个或多个主板标识中的部分主板标识的设备树源数据,因此,原始设备树镜像文件和上述基础设备树镜像文件可能相同,也可能不相 同。
同理,目标设备树镜像文件中可能包含一个或多个主板标识的设备树目标数据,而更新设备树镜像文件可能只包含上述一个或多个主板标识中的部分主板标识的设备树目标数据,因此,目标设备树镜像文件和上述更新设备树可能相同,也可能不相同。
在第二方面的一种可能的实现方式中,所述获取补丁数据,包括:
获取补丁分区的数字签名,根据所述补丁分区的数字签名对所述补丁分区进行安全校验;
若所述补丁分区安全校验通过,则从所述补丁分区中获取补丁数据。
需要说明的是,用户设备从补丁分区获取补丁数据时,为了避免补丁分区的数据被篡改,用户设备可以获取补丁分区的数字签名,根据补丁分区的数字签名对补丁分区进行安全校验。
如果补丁分区安全校验通过,则表示补丁分区的数据未被篡改,用户设备可以从补丁分区获取补丁数据。
在第二方面的一种可能的实现方式中,在所述获取补丁分区的数字签名之前,还包括:
接收所述开发设备发送的补丁数据,将所述补丁数据存储在所述补丁分区。
需要说明的是,用户设备的存储器可以划分为多个分区。例如,用户设备的只读存储器可以划分为引导(boot)分区、设备树块覆盖(device tree blob overlay,Dtbo)分区、系统(system)分区、厂商(vendor)分区等分区。
当用户设备接收到开发设备发送的补丁数据时,用户设备可以将补丁数据存储在本地的补丁分区。
在第二方面的一种可能的实现方式中,所述获取原始设备树镜像文件,包括:
获取设备树分区的数字签名,根据所述设备树分区的数字签名对所述设备树分区进行安全校验;
若所述设备树分区安全校验通过,则从所述设备树分区中获取原始设备树镜像文件。
需要说明的是,用户设备从设备树分区获取原始设备树镜像文件时,为了避免设备树分区的数据被篡改,用户设备可以获取设备树分区的数字签名,根据设备树分区的数字签名对设备树分区进行安全校验。
如果设备树分区安全校验通过,则表示设备树分区的数据未被篡改,用户设备可以从设备树分区获取原始设备树镜像文件。
第三方面,本申请实施例提供了一种电子设备,包括:
第一数据模块,用于获取设备树源数据和设备树目标数据;
差分处理模块,用于对所述设备树源数据和所述设备树目标数据进行差分处理,得到补丁数据;
数据发送模块,用于将所述补丁数据发送至用户设备,以指示所述用户设备将所述补丁数据与所述用户设备中的原始设备树镜像文件进行差分合成,得到更新设备树镜像文件。
在第三方面的一种可能的实现方式中,所述第一数据模块,包括:
文件获取子模块,用于获取基础设备树镜像文件和目标设备树镜像文件;
基础解析子模块,用于对所述基础设备树镜像文件进行格式解析,得到各个主板标识对应的设备树源数据;
目标解析子模块,用于对所述目标设备树镜像文件进行格式解析,得到各个主板标识对应的设备树目标数据;
相应的,所述差分处理模块,具体用于分别对各个所述主板标识对应的设备树源数据和设备树目标数据进行差分处理,得到各个所述主板标识对应的补丁数据。
在第三方面的一种可能的实现方式中,所述数据发送模块,包括:
格式封装子模块,用于根据预设的数据格式,将所述补丁数据封装成补丁文件;
文件发送子模块,用于将所述补丁文件发送至用户设备。
第四方面,本申请实施例提供了一种电子设备,包括:
第二数据模块,用于获取补丁数据,所述补丁数据为开发设备对设备树源数据和设备树目标数据进行差分处理得到的数据;
原始文件模块,用于获取原始设备树镜像文件;
差分合成模块,用于将所述补丁数据与所述原始设备树镜像文件进行差分合成,得到更新设备树镜像文件。
在第四方面的一种可能的实现方式中,所述第二数据模块,包括:
补丁文件子模块,用于获取补丁文件,所述补丁文件包括至少一种主板标识对应的补丁数据;
目标标识子模块,用于获取目标主板标识;
补丁查找子模块,用于在所述补丁文件中查找与所述目标主板标识对应的目标补丁数据;
相应的,所述差分合成模块,具体用于若所述补丁文件中存在与所述目标主板标识对应的目标补丁数据,则将所述目标补丁数据与所述原始设备树镜像文件进行差分合成,得到更新设备树镜像文件。
在第四方面的一种可能的实现方式中,所述第二数据模块,包括:
补丁签名子模块,用于获取补丁分区的数字签名,根据所述补丁分区的数字签名对所述补丁分区进行安全校验;
补丁校验子模块,用于若所述补丁分区安全校验通过,则从所述补丁分区中获取补丁数据。
在第四方面的一种可能的实现方式中,所述第二数据模块,还包括:
数据接收子模块,用于接收所述开发设备发送的补丁数据,将所述补丁数据存储在所述补丁分区。
在第四方面的一种可能的实现方式中,所述原始文件模块,包括:
设备签名子模块,用于获取设备树分区的数字签名,根据所述设备树分区的数字签名对所述设备树分区进行安全校验;
设备校验子模块,用于若所述设备树分区安全校验通过,则从所述设备树分区中获取原始设备树镜像文件。
第五方面,提供了一种开发设备,包括存储器、处理器以及存储在所述存储器中 并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时,电子设备实现如上述第一方面提供的方法。
第六方面,提供了一种用户设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时,电子设备实现如上述第二方面提供的方法。
第七方面,提供了一种设备树修复系统,包括上述第五方面提供的开发设备以及上述第六方面提供的用户设备。
第八方面,提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时,使得配件设备实现如上述第一方面提供的方法,或者,实现如上述第二方面提供的方法。
第九方面,提供了一种芯片系统,所述芯片系统可以为单个芯片,或者多个芯片组成的芯片模组,所述芯片系统包括存储器和处理器,所述处理器执行所述存储器中存储的计算机程序,以实现上述第一方面提供的方法,或者,实现如上述第二方面提供的方法。
本申请实施例与现有技术相比存在的有益效果是:
在本申请提供的设备树修复方法中,开发设备对设备树源数据和设备树目标数据进行差分处理,得到补丁数据,并将补丁数据发送至用户设备。用户设备通过补丁数据对原始设备树镜像文件打补丁,修复原始设备树镜像文件,得到更新设备树镜像文件。
在本申请提供的设备树修复方法中,开发设备和用户设备通过补丁的方式修复设备树,无需发布新的版本文件,版本号未变更,因此,无需更新版本文件中的其他镜像文件,减少更新的内容。并且,发布补丁数据时,该补丁数据只需单点问题验证通过即可,不需要经过复杂的版本测试及发布流程,从而提高设备树修复速度,减少人力和时间的消耗,具有较强的易用性和实用性。
附图说明
图1为本申请实施例提供的一种设备树修复系统的结构示意图;
图2为本申请实施例提供的一种只读存储器的分区示意图;
图3为本申请实施例提供的一种电子设备的示意图;
图4为本申请实施例提供的一种应用场景的示意图;
图5为本申请实施例提供的一种设备树修复方法的信令图;
图6为本申请实施例提供的一种设备树修复方法的流程示意图;
图7为本申请实施例提供的另一种设备树修复方法的流程示意图;
图8为本申请实施例提供的一种开发设备的示意图;
图9为本申请实施例提供的一种用户设备的示意图;
图10为本申请实施例提供的另一种电子设备的示意图。
具体实施方式
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的系统、装置、 电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。
应当理解,当在本申请说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。
还应当理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。
如在本申请说明书和所附权利要求书中所使用的那样,术语“如果”可以依据上下文被解释为“当...时”或“一旦”或“响应于确定”或“响应于检测到”。类似地,短语“如果确定”或“如果检测到[所描述条件或事件]”可以依据上下文被解释为意指“一旦确定”或“响应于确定”或“一旦检测到[所描述条件或事件]”或“响应于检测到[所描述条件或事件]”。
另外,在本申请说明书和所附权利要求书的描述中,术语“第一”、“第二”、“第三”等仅用于区分描述,而不能理解为指示或暗示相对重要性。
在本申请说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。
内核,是一个操作系统的核心。内核是基于硬件资源的第一层软件扩充,提供操作系统的最基本的功能,是操作系统工作的基础。内核负责管理操作系统的进程、内存、设备驱动程序、文件和网络系统,决定着系统的性能和稳定性。
在处理器的内核源码中,存在大量描述板级细节信息的代码,例如描述平台(platform)设备、资源(resource)以及各种硬件的平台数据(platform_data)的代码。对于内核而言,这些描述板级细节信息的代码绝大多数属于垃圾冗余代码。
为了减少内核源码中描述板级细节信息的代码,有的处理器的内核引入了设备树(Device Tree,dt)。例如,ARM内核版本3.x之后引入了设备树。
设备树是一种描述硬件资源的数据结构,设备树可以通过引导加载工具(bootloader)将硬件资源传入内核,使得内核源码与硬件资源的描述相对独立。也即是说,dtb格式的文件(即设备树文件)可以由bootloader读入内存,由处理器内核对dtb格式的文件进行解析。此时,对于同一类型的处理器的内核,只需更换设备树文件即可让该类型的内核适配不同的主板,无需更换内核的内核文件。
设备树通常以镜像文件的形式存储于电子设备的存储区域中,并且,除了设备树镜像文件以外,电子设备的存储区域还可以包括其他类型的镜像文件。
例如,电子设备的只读存储器(Read only memory,ROM)可以划分多个分区,各个分区存放着如引导(boot)镜像文件、设备树块覆盖(device tree blob overlay,Dtbo)镜像文件、系统(system)镜像文件、厂商(vendor)镜像文件等镜像文件。
现阶段修复设备树只能通过发布新版本来进行修复。但是,上述镜像文件均包含版本号,有的镜像文件甚至还有时间戳。因此,在编译新的版本文件的过程中,上述镜像文件都会发生变化,需要重新编译整个版本,导致更新的内容过多。
并且,新的版本文件的发布需要经过编译、基本功能测试、兼容性测试、送测等步骤,整个版本发布流程长、速度慢且耗费大量人力。
有鉴于此,本申请实施例提供了一种设备树修复方法、电子设备及计算机可读存储介质,可以通过补丁修复的方式修复设备树,解决了当前的设备树修复方法更新内容过多、流程长、速度慢的问题,具有较强的易用性和实用性。
首先,以图1所示的设备树修复系统为例,对本申请实施例中即将涉及的各个电子设备进行举例说明。
如图1所示,在设备树修复系统中包括一个或多个开发设备101(图1中仅示出一个)、一个或多个用户设备102(图1中示出三个)以及中转设备103。
其中,开发设备101为生成补丁文件的电子设备,用户设备102为使用补丁文件对设备树进行修复的电子设备。
开发设备101和用户设备102之间可能建立直接的通信连接,即开发设备101和用户设备102建立了直连的通信连接;或者,开发设备101和用户设备102之间也可能建立间接的通信连接,即开发设备101与用户设备102之间设置有负责中转数据的中转设备103。
例如,开发设备101在生成了补丁文件之后,可以通过与用户设备102直连的通信连接向用户设备102发送补丁文件。或者,开发设备101在生成了补丁文件之后,也可以向中转设备103发送补丁文件,由中转设备103将补丁文件转发给用户设备102。
上述通信连接的类型可以根据实际情况进行设置。例如,上述通信连接可以包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),RFID或ZigBee等无线通信的解决方案中的任意一种或多种。和/或,上述通信连接也可以包括公用电信网络(Registered Jack 45,RJ45)连接等有线通信解决方案中的任意一种或多种。
上述开发设备101、用户设备102以及中转设备103的电子设备类型可以根据实际情况确定。例如,上述开发设备101、用户设备102以及中转设备103可以是手机、平板电脑、可穿戴设备、车载设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)等电子设备,本申请实施例对上述开发设备101、用户设备102以及中转设备103的具体类型不作任何限制。
并且,上述开发设备101、用户设备102以及中转设备103可以是相同类型的电子设备,或者,上述开发设备101、用户设备102以及中转设备103也可以是不同类型的电子设备。
当存在多个开发设备101时,多个开发设备101可以是相同类型的电子设备,或者,也可以是不同类型的电子设备。
当存在多个用户设备102时,多个用户设备102可以是相同类型的电子设备,或者,也可以是不同类型的电子设备。
当存在多个中转设备103时,多个中转设备103可以是相同类型的电子设备,或者,也可以是不同类型的电子设备。
此外,图1所示的设备树修复系统仅为本申请实施例的示意性举例,不应理解为对设备树修复系统的具体限制。在实际应用的过程中,设备树修复系统可能存在比图1所示的 设备树修复系统更多或更少的电子设备。例如,在一些应用场景中,设备树修复系统可能不包括中转设备103,开发设备101和用户设备102建立了直连的通信连接。因此,本申请实施例对设备树修复系统不作任何限制。
以下,将根据图1所示的设备树修复系统并结合具体的应用场景,对本申请实施例提供的设备树修复方法进行详细说明。
1、生成补丁文件。
在生成补丁文件时,开发设备可以先获取基础设备树镜像文件以及目标设备树镜像文件。
其中,基础设备树镜像文件为补丁修复之前的设备树镜像文件,目标设备树镜像文件为补丁修复之后的设备树镜像文件。目标设备树镜像文件由开发人员编译生成。
如果上述基础设备树镜像文件和上述目标设备树镜像文件为压缩格式,则开发设备可以对基础设备树镜像文件和目标设备树镜像文件解压,然后再对解压后的基础设备树镜像文件和目标设备树镜像文件进行格式解析。
如果上述基础设备树镜像文件和上述目标设备树镜像文件不是压缩格式,则开发设备可以直接对基础设备树镜像文件和目标设备树镜像文件进行格式解析。
开发设备对基础设备树镜像文件进行格式解析,可以得到各个主板标识(board id)所对应的设备树源数据(dtb.src)。开发设备对目标设备树镜像文件进行格式解析,可以得到各个主板标识所对应的设备树目标数据(dtb.tgt)。
然后,开发设备可以使用差分工具分别对各个主板标识所对应的设备树源数据和设备树目标数据进行差分处理,得到各个主板标识所对应的补丁数据(dtb.patch)。
不同的主板标识用于表示不同的主板,或者,也可以理解为表示不同产品的硬件资源。
由于设备树修复可能是针对性地修复某些类型的产品的漏洞,因此,开发人员可能只更改了部分主板标识对应的设备树源数据。
此时,如果某一主板标识对应的设备树源数据不需要修复,则该主板标识对应的设备树源数据和设备树目标数据一致,开发设备对该主板标识对应的设备树源数据和设备树目标数据进行差分处理,得到的补丁数据是空的。
如果某一主板标识对应的设备树源数据需要修复,则该主板标识对应的设备树源数据和设备树目标数据不一致,开发设备对该主板标识的设备树源数据和设备树目标数据进行差分处理,可以得到开发人员变更的代码,即补丁数据。
例如,假设基础设备树镜像文件中包括主板标识0x1000b0x7对应的设备树源数据以及主板标识0x1000b0x9对应的设备树源数据。本次设备树修复用于修复0x1000b0x9对应的设备树源数据中的漏洞,则开发人员可能只更新了0x1000b0x9的设备树源数据。此时,0x1000b0x9对应的设备树源数据和设备树目标数据不一致,差分处理得到的补丁数据不为空。而0x1000b0x7的设备树源数据未被改动,因此,0x1000b0x7的设备树源数据和设备树目标数据一致,差分处理得到的补丁数据为空。
在获取到补丁数据之后,开发设备可以根据各个主板标识所对应的补丁数据以及预设的数据格式生成补丁文件。并且,开发设备还可以计算各个主板标识对应的设备树源数据的哈希值、设备树目标数据的哈希值以及补丁数据的哈希值,并将上述哈希值存储在补丁文件中,使得用户设备可以根据上述哈希值校验补丁数据的正确性。
开发设备计算哈希值的哈希算法可以根据实际需求进行选择。例如,在一些实施例中,开发设备可以选用安全散列算法256(Secure Hash Algorithm 256,SHA-256)计算哈希值。在另一些实施例中,开发设备也可以选用SHA-224、SHA-384、SHA-512等哈希算法计算哈希值。
此外,上述预设的数据格式可以根据实际需求进行设置。例如,在一些实施例中,上述预设的数据格式可以如表一所示:
表一
Figure PCTCN2021112448-appb-000001
如表一所示,补丁文件的文件名可以为patch-dtbo.img,img为镜像文件的扩展名。补丁文件的数据结构可以包括表头以及一个或多个主板标识所对应的数据子结构(即一款或多款主板对应的数据子结构)。
例如,补丁文件的表头可以为表一中的dt_table_header;补丁文件中各个主板标识对应的数据子结构可以为表一中的dt_table_entry_v1、dt_table_entry_v2以及dt_table_entry_v3等。
在补丁文件的表头中,可以包括魔数(magic)、目标设备树镜像文件的大小(total_size)、表头的大小(header_size)、设备树入口的大小(dt_entry_size)、设备树入口的数量(dt_entry_count)、设备树入口的位置(dt_entries_offset)、页的大小(page_size)、版本号 (version)等参数。表头中的各个参数的内容与目标设备树镜像文件的表头一致,开发设备可以直接复制目标设备树镜像文件的表头的各个参数的内容作为补丁文件的表头。
在补丁文件的各个主板标识所对应的数据子结构中,可以包括某款主板的补丁数据的大小(dt_size)、某款主板的补丁数据的位置(dt_offset)、某款主板的补丁数据的位置(dt_offset)、某款主板的主板标识(id(board id))、补丁数据的哈希值(patch Sha256[32])、设备树目标数据的大小(dstSize)、设备树目标数据的哈希值(dst Sha256[32])、设备树源数据的大小(srcSize)、设备树源数据的哈希值(src Sha256[32])、补丁数据(dtb)等参数。
开发设备可以根据各个主板标识对应的设备树源数据、设备树目标数据以及补丁数据确定并填充上述各个主板标识对应的数据子结构中的各个参数的内容,得到补丁文件。
需要说明的是,以上数据结构仅为本申请实施例的示意性举例,不应理解为对上述补丁文件的数据结构的限制。在本申请的另一些实施例中,补丁文件的数据结构可以拥有比表一所示结构更多或更少的子结构以及参数。本申请实施例对补丁文件的数据结构不作任何限制。
开发设备在生成补丁文件之后,可以直接向用户设备发送补丁文件,或者,开发设备也可以将补丁文件上传至中转设备。
当开发设备与用户设备建立了直连的通信连接时,开发设备可以将生成的补丁文件直接推送至用户设备,或者,也可以由用户设备主动请求开发设备下发补丁文件。
当开发设备与用户设备建立了间接的通信连接时,开发设备可以将补丁文件上传至中转设备(例如服务器),由中转设备将补丁文件推送给用户设备,或者,也可以由用户设备访问中转设备下载补丁文件。
2、设备树镜像文件修复。
用户设备在获取到补丁文件之后,可以将补丁文件存放在本设备的存储空间的补丁(Kpatch)分区。
例如,如图2所示,用户设备的ROM可以划分为引导(boot)分区、设备树块覆盖(device tree blob overlay,Dtbo)分区、系统(system)分区、厂商(vendor)分区等分区。用户设备可以在获取到补丁文件之后,将补丁文件存储在ROM的Kpatch分区。
之后,当用户设备的操作系统启动时,用户设备可以从设备树分区获取原始设备树镜像文件。在获取原始设备树镜像文件时,为了避免设备树分区的数据被篡改,用户设备可以获取设备树分区的数字签名,根据设备树分区的数字签名对设备树分区进行安全校验。在安全校验通过之后,用户设备从设备树分区中获取原始设备树镜像文件。
然后,用户可以在补丁分区中查询并获取补丁文件。在获取补丁文件时,为了避免补丁分区内的数据被篡改,用户设备可以获取补丁分区的数字签名,根据补丁分区的数字签名对补丁分区进行安全校验。
在安全校验通过之后,用户设备可以查询补丁分区内是否存在未应用的补丁文件。
如果补丁分区中不存在未应用的补丁文件,则用户设备根据上述原始设备树镜像文件,按照正常启动流程启动操作系统。
如果补丁分区中存在未应用的补丁文件,则用户设备可以对该补丁文件进行格式解析,得到相应的目标补丁数据。
由于补丁文件中存在一个或多个主板标识对应的补丁数据。因此,用户设备可以根据 目标主板标识从补丁文件中获取相应的目标补丁数据。
目标主板标识为用户设备的主板的标识。用户设备可以根据目标主板标识,查询补丁文件中是否存在与目标主板标识对应的补丁数据。
如果补丁文件中存在与目标主板标识对应的补丁数据,则用户设备将该补丁数据作为目标补丁数据。
然后,用户设备使用差分工具对本地的原始设备树镜像文件以及上述目标补丁数据进行差分合成,得到更新设备树镜像文件。
在得到更新设备树镜像文件之后,用户设备可以使用上述哈希值对更新设备树镜像文件进行校验。
例如,用户设备可以对更新设备树镜像文件进行格式解析,得到目标主板标识对应的设备树目标数据。然后,用户设备可以计算上述目标主板标识对应的设备树目标数据的哈希值。如果计算得到的哈希值与补丁文件中目标主板标识对应的设备树目标数据的哈希值一致,则更新设备树镜像文件校验通过。如果计算得到的哈希值与补丁文件中目标主板标识对应的设备树目标数据的哈希值不一致,则更新设备树镜像文件校验失败。
如果校验通过,则表示补丁成功,用户设备可以用更新设备树镜像文件替换并覆盖原始设备树镜像文件,完成设备树补丁操作。
如果校验失败,则表示补丁失败,用户设备可以放弃设备树补丁操作,或者,用户设备也可以重新执行设备树补丁操作。
此外,如果补丁文件中不存在与目标主板标识对应的补丁数据,则表示用户设备上的原始设备树镜像文件无需更新,用户设备可以直接完成设备树补丁操作。
需要说明的是,由于基础设备树镜像文件中可能包含一个或多个主板标识的设备树源数据,而原始设备树镜像文件可能只包含上述一个或多个主板标识中的部分主板标识的设备树源数据,因此,原始设备树镜像文件和上述基础设备树镜像文件可能相同,也可能不相同。
同理,目标设备树镜像文件中可能包含一个或多个主板标识的设备树目标数据,而更新设备树镜像文件可能只包含上述一个或多个主板标识中的部分主板标识的设备树目标数据,因此,目标设备树镜像文件和上述更新设备树可能相同,也可能不相同。
在完成补丁操作之后,用户设备可以根据补丁操作之后的设备树镜像文件,即原始设备树镜像或更新设备树镜像文件,按照正常启动流程继续启动操作系统。
以下,将结合具体的应用场景对上述设备树补丁修复方法进行详细说明。
请参阅图3至图6。图3为本申请实施例提供的一种的用户设备的结构示意图。如图3所示,用户设备可以包括中央处理器(central processing unit,CPU)301、只读存储器(Read-Only Memory,ROM)302、随机存取存储器(Random Access Memory,RAM)303以及总线304。
CPU 301、ROM 302以及RAM 303之间通过总线304进行数据交互。
如图4所示,在ROM 302中可以包含引导(Boot)分区、设备树(Device Tree,Dt)基础层分区、设备树块覆盖(Dtbo)分区以及补丁(Kpatch)分区等分区。
Boot分区中可以包括内核(kenel)文件、随机存取磁盘(Random Access Memory disk,ram disk)等文件。
Dtbo分区中可以包括设备树块覆盖镜像文件(device tree blob overlay.img,Dtbo.img)。
Kpatch分区中可以包括设备树的补丁文件(patch-dtbo.img),或者,还可以包括内核补丁文件(kernel.patch)等补丁包。
Dt基础层分区中可以包括设备树镜像文件(Dt.img)。
在操作系统启动时,CPU 301可以从ROM 302的Dtbo分区、Kpatch分区等分区读取数据至RAM 303中执行上述设备树修复方法。
如图5所示,假设CPU 301中包括以下功能模块:开始引导(start_boot)模块、补丁差分(diff_patch_pre)模块、设备树(dobt)模块、常规引导(normal boot)模块、内核(kernel)模块。
在操作系统启动时,开始引导模块可以通过模块调用工具触发差分工具初始化、设备树工具初始化以及常规引导工具初始化。
差分工具初始化时,会初始化差分工具的内存。常规引导工具初始化之后,会引导内核启动。
上述设备树分区可以理解为Dt基础层分区和Dtbo分区,上述原始设备树镜像文件可以包括Dt.img和Dtbo.img,其中,Dt.img表示设备树的基础层的镜像文件,Dtbo.img表示设备树的叠加层的镜像文件。
通常不同型号的主板标识对应的设备树中,拥有相同的设备树的基础层,但是设备树的叠加层存在差异。并且,设备树的修复通常发生在设备树的叠加层。
因此,设备树模块可以通过设备树工具,从Dt基础层分区获取Dt.img,正常启动Dt.img,不进行干预。
但是,当设备树模块在启动Dtbo.img时,可以先获取Dtbo分区的数字签名和Dtbo分区的数据,根据Dtbo分区的数字签名对Dtbo分区的数据进行安全校验,防止Dtbo分区的数据被篡改。
Dtbo分区安全校验通过之后,设备树模块可以读取Dtbo.img,并对Dtbo.img进行解压处理。
之后,补丁差分模块可以获取Kpatch分区的数字签名和Kpatch分区的数据,根据Kpatch分区的数字签名对Kpatch分区的数据进行安全校验,避免Kpatch分区的数据被篡改。
Kpatch分区安全校验通过之后,补丁差分模块可以读取Kpatch分区中的补丁文件。
由于补丁文件中包括多个主板标识对应的补丁数据,因此,补丁差分模块可以获取本设备的目标主板标识,查询补丁文件中是否存在与目标主板标识对应的目标补丁数据。
如果补丁文件中存在与目标主板标识对应的目标补丁数据,则表示Dtbo.img需要打补丁;如果补丁文件中不存在与目标主板标识对应的目标补丁数据,则表示Dtbo.img不需要打补丁。
假设补丁文件中存在目标主板标识对应的目标补丁数据,此时,补丁差分模块可以调用差分工具对Dtbo.img打补丁,将Dtbo.img与目标主板标识对应的目标补丁数据进行差分合成,得到新的Dtbo.img(即新的设备树块覆盖镜像文件)。
然后,补丁差分模块可以获取补丁文件中的哈希值,根据补丁文件中的哈希值对新的Dtbo.img进行校验。如果新的Dtbo.img校验通过,则将新的Dtbo.img拷贝到Dtbo.img的 原始地址,替换之前的Dtbo.img。
之后,设备树模块可以将Dt.img和新的Dtbo.img合并,得到完整的设备树,并按照操作系统的正常启动流程继续执行后续步骤。
在本申请实施例的设备树修复方法中,开发设备通过对各个主板标识对应的设备树源数据和设备树目标数据进行差分处理,得到各个主板标识对应的补丁数据。用户设备通过补丁数据对原始设备树镜像文件打补丁,修复原始设备树镜像文件,得到更新设备树镜像文件。
在上述设备树修复方法中,开发设备和用户设备以补丁的方式修复设备树,无需编译完整的版本文件,不改动版本号,无需更新设备树镜像文件以外的其他镜像文件,可以极大地减少更新的内容。例如,以往的版本文件的数据大小约为4M字节,现在的补丁文件的数据大小约为10k字节。
并且,由于上述设备树修复方法通过补丁的方式修补设备树的漏洞,在器件替代、电源参数修复、器件漏洞(bug)修复等单点问题上,补丁文件只需要在单点问题上验证通过即可,不需要更改原有版本文件,因此,发布补丁不需要经过编译、基本功能测试、兼容性测试、送测等步骤,从而极大地缩短了设备树的修复时间,提高了修复速度,减少了人力和时间的消耗。
此外,由于补丁文件中可以包含多个主板标识对应的补丁数据,因此,同一个补丁包可以适配多款机型,适配不同的主板,从而实现一个补丁包修复多款机型的设备树漏洞。并且,由于多个补丁数据共用处于同一个补丁文件中,用户设备对补丁文件进行校验时,只需校验一次补丁文件,无需针对每一个补丁数据分别进行校验,减少校验次数,提高补丁效率。
如果补丁分区中除了设备树的补丁文件以外,还存在其他补丁包,则用户设备还可以控制补丁包的加载顺序,根据补丁包的加载顺序加载补丁包,实现用户设备的修复需求。
当补丁文件采用上述表一所示的数据结构时,可以支持一个补丁文件适配多款机型,并且,补丁文件中的哈希值还可以对更新设备树进行文件进行校验,保证数据不被篡改。
上述设备树修复方法可以在各类模式下对设备树进行补丁修复,前述模式可以包括常规启动(normal)模式、修复(recovery)模式、额外修复(erecovery)模式、快速引导(fastbootd)模式等模式。
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。
以下,将从开发设备的角度,对本申请实施例提供的另一设备树修复方法进行详细说明。请参阅图6,本实施例提供的设备树修复方法包括:
S601、获取设备树源数据和设备树目标数据;
S602、对所述设备树源数据和所述设备树目标数据进行差分处理,得到补丁数据;
S603、将所述补丁数据发送至用户设备,以指示所述用户设备将所述补丁数据与所述用户设备中的原始设备树镜像文件进行差分合成,得到更新设备树镜像文件。
可选地,所述获取设备树源数据和设备树目标数据,包括:
获取基础设备树镜像文件和目标设备树镜像文件;
对所述基础设备树镜像文件进行格式解析,得到各个主板标识对应的设备树源数据;
对所述目标设备树镜像文件进行格式解析,得到各个主板标识对应的设备树目标数据;
相应的,所述对所述设备树源数据和所述设备树目标数据进行差分处理,得到补丁数据,包括:
分别对各个所述主板标识对应的设备树源数据和设备树目标数据进行差分处理,得到各个所述主板标识对应的补丁数据。
可选地,所述将所述补丁数据发送至用户设备,包括:
根据预设的数据格式,将所述补丁数据封装成补丁文件;
将所述补丁文件发送至用户设备。
在本申请实施例的补丁修复方法中,开发设备通过补丁的方式修复设备树,无需发布新的版本文件,减少更新的内容,并且,发布补丁数据不需要经过复杂的版本测试及发布流程,可以提高设备树修复速度,减少人力和时间的消耗。
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。
以下,将从用户设备的角度,对本申请实施例提供的另一设备树修复方法进行详细说明。请参阅图7,本实施例提供的设备树修复方法包括:
S701、获取补丁数据,所述补丁数据为开发设备对设备树源数据和设备树目标数据进行差分处理得到的数据;
S702、获取原始设备树镜像文件;
S703、将所述补丁数据与所述原始设备树镜像文件进行差分合成,得到更新设备树镜像文件。
可选地,所述获取补丁数据,包括:
获取补丁文件,所述补丁文件包括至少一种主板标识对应的补丁数据;
获取目标主板标识;
在所述补丁文件中查找与所述目标主板标识对应的目标补丁数据;
相应的,所述将所述补丁数据与所述原始设备树镜像文件进行差分合成,得到更新设备树镜像文件,包括:
若所述补丁文件中存在与所述目标主板标识对应的目标补丁数据,则将所述目标补丁数据与所述原始设备树镜像文件进行差分合成,得到更新设备树镜像文件。
可选地,所述获取补丁数据,包括:
获取补丁分区的数字签名,根据所述补丁分区的数字签名对所述补丁分区进行安全校验;
若所述补丁分区安全校验通过,则从所述补丁分区中获取补丁数据。
可选地,在所述获取补丁分区的数字签名之前,还包括:
接收所述开发设备发送的补丁数据,将所述补丁数据存储在所述补丁分区。
可选地,所述获取原始设备树镜像文件,包括:
获取设备树分区的数字签名,根据所述设备树分区的数字签名对所述设备树分区进行安全校验;
若所述设备树分区安全校验通过,则从所述设备树分区中获取原始设备树镜像文件。
在本申请实施例的设备树修复方法中,用户设备通过补丁的方式修复设备树,无需发 布新的版本文件,减少更新的内容,并且,采用补丁数据修复设备树不需要经过复杂的版本测试及发布流程,可以提高设备树修复速度,减少人力和时间的消耗。
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。
以下对本申请实施例提供的一种开发设备进行详细说明。请参阅图8,本实施例提供的开发设备包括:
第一数据模块801,用于获取设备树源数据和设备树目标数据;
差分处理模块802,用于对所述设备树源数据和所述设备树目标数据进行差分处理,得到补丁数据;
数据发送模块803,用于将所述补丁数据发送至用户设备,以指示所述用户设备将所述补丁数据与所述用户设备中的原始设备树镜像文件进行差分合成,得到更新设备树镜像文件。
可选地,所述第一数据模块801,包括:
文件获取子模块,用于获取基础设备树镜像文件和目标设备树镜像文件;
基础解析子模块,用于对所述基础设备树镜像文件进行格式解析,得到各个主板标识对应的设备树源数据;
目标解析子模块,用于对所述目标设备树镜像文件进行格式解析,得到各个主板标识对应的设备树目标数据;
相应的,所述差分处理模块802,具体用于分别对各个所述主板标识对应的设备树源数据和设备树目标数据进行差分处理,得到各个所述主板标识对应的补丁数据。
可选地,所述数据发送模块803,包括:
格式封装子模块,用于根据预设的数据格式,将所述补丁数据封装成补丁文件;
文件发送子模块,用于将所述补丁文件发送至用户设备。
需要说明的是,上述装置/单元之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其具体功能及带来的技术效果,具体可参见方法实施例部分,此处不再赘述。
以下对本申请实施例提供的一种用户设备进行详细说明。请参阅图9,本实施例提供的用户设备包括:
第二数据模块901,用于获取补丁数据,所述补丁数据为开发设备对设备树源数据和设备树目标数据进行差分处理得到的数据;
原始文件模块902,用于获取原始设备树镜像文件;
差分合成模块903,用于将所述补丁数据与所述原始设备树镜像文件进行差分合成,得到更新设备树镜像文件。
可选地,所述第二数据模块901,包括:
补丁文件子模块,用于获取补丁文件,所述补丁文件包括至少一种主板标识对应的补丁数据;
目标标识子模块,用于获取目标主板标识;
补丁查找子模块,用于在所述补丁文件中查找与所述目标主板标识对应的目标补丁数据;
相应的,所述差分合成模块903,具体用于若所述补丁文件中存在与所述目标主板标识对应的目标补丁数据,则将所述目标补丁数据与所述原始设备树镜像文件进行差分合成,得到更新设备树镜像文件。
可选地,所述第二数据模块901,包括:
补丁签名子模块,用于获取补丁分区的数字签名,根据所述补丁分区的数字签名对所述补丁分区进行安全校验;
补丁校验子模块,用于若所述补丁分区安全校验通过,则从所述补丁分区中获取补丁数据。
可选地,所述第二数据模块901,还包括:
数据接收子模块,用于接收所述开发设备发送的补丁数据,将所述补丁数据存储在所述补丁分区。
可选地,所述原始文件模块902,包括:
设备签名子模块,用于获取设备树分区的数字签名,根据所述设备树分区的数字签名对所述设备树分区进行安全校验;
设备校验子模块,用于若所述设备树分区安全校验通过,则从所述设备树分区中获取原始设备树镜像文件。
需要说明的是,上述装置/单元之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其具体功能及带来的技术效果,具体可参见方法实施例部分,此处不再赘述。
请参阅图10,本申请实施例还提供了一种电子设备。如图10所示,该实施例的电子设备100包括:处理器1000、存储器1001以及存储在所述存储器1001中并可在所述处理器1000上运行的计算机程序1002。所述处理器1000执行所述计算机程序1002时实现上述屏幕扩展方法实施例中的步骤,例如图6所示的步骤S601至S603。或者,所述处理器1000执行所述计算机程序1002时实现上述各装置实施例中各模块/单元的功能,例如图8所示模块801至803的功能。
示例性的,所述计算机程序1002可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器1001中,并由所述处理器1000执行,以完成本申请。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述所述计算机程序1002在所述电子设备100中的执行过程。例如,所述计算机程序1002可以被分割成第一数据模块、差分处理模块以及数据发送模块,各模块具体功能如下:
第一数据模块,用于获取设备树源数据和设备树目标数据;
差分处理模块,用于对所述设备树源数据和所述设备树目标数据进行差分处理,得到补丁数据;
数据发送模块,用于将所述补丁数据发送至用户设备,以指示所述用户设备将所述补丁数据与所述用户设备中的原始设备树镜像文件进行差分合成,得到更新设备树镜像文件。
所述电子设备100可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所述电子设备可包括,但不仅限于,处理器1000、存储器1001。本领域技术人员可以理解,图10仅仅是电子设备100的示例,并不构成对电子设备100的限定,可以包括比图 示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述电子设备还可以包括输入输出设备、网络接入设备、总线等。
所称处理器1000可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
所述存储器1001可以是所述电子设备100的内部存储单元,例如电子设备100的硬盘或内存。所述存储器1001也可以是所述电子设备100的外部存储设备,例如所述电子设备100上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器1001还可以既包括所述电子设备100的内部存储单元也包括外部存储设备。所述存储器1001用于存储所述计算机程序以及所述电子设备所需的其他程序和数据。所述存储器1001还可以用于暂时地存储已经输出或者将要输出的数据。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的实施例中,应该理解到,所揭露的装置/电子设备和方法,可以通过其它的方式实现。例如,以上所描述的装置/电子设备实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读存储介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述计算机可读存储介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,计算机可读存储介质不包括电载波信号和电信信号。
最后应说明的是:以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (13)

  1. 一种设备树修复方法,其特征在于,应用于开发设备,包括:
    获取设备树源数据和设备树目标数据;
    对所述设备树源数据和所述设备树目标数据进行差分处理,得到补丁数据;
    将所述补丁数据发送至用户设备,以指示所述用户设备将所述补丁数据与所述用户设备中的原始设备树镜像文件进行差分合成,得到更新设备树镜像文件。
  2. 根据权利要求1所述的设备树修复方法,其特征在于,所述获取设备树源数据和设备树目标数据,包括:
    获取基础设备树镜像文件和目标设备树镜像文件;
    对所述基础设备树镜像文件进行格式解析,得到各个主板标识对应的设备树源数据;
    对所述目标设备树镜像文件进行格式解析,得到各个主板标识对应的设备树目标数据;
    相应的,所述对所述设备树源数据和所述设备树目标数据进行差分处理,得到补丁数据,包括:
    分别对各个所述主板标识对应的设备树源数据和设备树目标数据进行差分处理,得到各个所述主板标识对应的补丁数据。
  3. 根据权利要求1所述的设备树修复方法,其特征在于,所述将所述补丁数据发送至用户设备,包括:
    根据预设的数据格式,将所述补丁数据封装成补丁文件;
    将所述补丁文件发送至用户设备。
  4. 一种设备树修复方法,其特征在于,应用于用户设备,包括:
    获取补丁数据,所述补丁数据为开发设备对设备树源数据和设备树目标数据进行差分处理得到的数据;
    获取原始设备树镜像文件;
    将所述补丁数据与所述原始设备树镜像文件进行差分合成,得到更新设备树镜像文件。
  5. 根据权利要求4所述的设备树修复方法,其特征在于,所述获取补丁数据,包括:
    获取补丁文件,所述补丁文件包括至少一种主板标识对应的补丁数据;
    获取目标主板标识;
    在所述补丁文件中查找与所述目标主板标识对应的目标补丁数据;
    相应的,所述将所述补丁数据与所述原始设备树镜像文件进行差分合成,得到更新设备树镜像文件,包括:
    若所述补丁文件中存在与所述目标主板标识对应的目标补丁数据,则将所述目标补丁数据与所述原始设备树镜像文件进行差分合成,得到更新设备树镜像文件。
  6. 根据权利要求4所述的设备树修复方法,其特征在于,所述获取补丁数据,包括:
    获取补丁分区的数字签名,根据所述补丁分区的数字签名对所述补丁分区进行安 全校验;
    若所述补丁分区安全校验通过,则从所述补丁分区中获取补丁数据。
  7. 根据权利要求6所述的设备树修复方法,其特征在于,在所述获取补丁分区的数字签名之前,还包括:
    接收所述开发设备发送的补丁数据,将所述补丁数据存储在所述补丁分区。
  8. 根据权利要求4所述的设备树修复方法,其特征在于,所述获取原始设备树镜像文件,包括:
    获取设备树分区的数字签名,根据所述设备树分区的数字签名对所述设备树分区进行安全校验;
    若所述设备树分区安全校验通过,则从所述设备树分区中获取原始设备树镜像文件。
  9. 一种开发设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至3任一项所述的方法。
  10. 一种用户设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求4至8任一项所述的方法。
  11. 一种设备树修复系统,其特征在于,包括如权利要求9所述的开发设备以及如权利要求10所述的用户设备。
  12. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至3任一项所述的方法,或者,实现如权利要求4至8任一项所述的方法。
  13. 一种芯片系统,其特征在于,所述芯片系统包括存储器和处理器,所述处理器执行所述存储器中存储的计算机程序,以实现如权利要求1至3任一项所述的方法,或者,实现如权利要求4至8任一项所述的方法。
PCT/CN2021/112448 2020-09-10 2021-08-13 设备树修复方法、系统及计算机可读存储介质 WO2022052739A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US18/044,938 US20230385046A1 (en) 2020-09-10 2021-08-13 Method and System for Repairing Device Tree, and Computer-Readable Storage Medium
EP21865795.5A EP4202646A4 (en) 2020-09-10 2021-08-13 DEVICE SHAFT REPAIR METHOD AND SYSTEM AND COMPUTER READABLE STORAGE MEDIUM

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010949031.7 2020-09-10
CN202010949031.7A CN114168168A (zh) 2020-09-10 2020-09-10 设备树修复方法、系统及计算机可读存储介质

Publications (1)

Publication Number Publication Date
WO2022052739A1 true WO2022052739A1 (zh) 2022-03-17

Family

ID=80475716

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/112448 WO2022052739A1 (zh) 2020-09-10 2021-08-13 设备树修复方法、系统及计算机可读存储介质

Country Status (4)

Country Link
US (1) US20230385046A1 (zh)
EP (1) EP4202646A4 (zh)
CN (1) CN114168168A (zh)
WO (1) WO2022052739A1 (zh)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1605353A2 (en) * 2004-06-07 2005-12-14 Northrop Grumman Corporation Method for imaging computer systems
CN105260184A (zh) * 2015-10-15 2016-01-20 广东欧珀移动通信有限公司 一种恢复镜像文件的调试方法及装置
CN106384052A (zh) * 2016-08-26 2017-02-08 浪潮电子信息产业股份有限公司 一种实现BMC U‑boot可信启动控制的方法
CN107145343A (zh) * 2017-04-05 2017-09-08 烽火通信科技股份有限公司 一种动态适配外围设备的系统及方法
CN107301070A (zh) * 2017-06-20 2017-10-27 福州汇思博信息技术有限公司 一种升级方法及终端
CN109062617A (zh) * 2018-06-26 2018-12-21 百富计算机技术(深圳)有限公司 一种支持多类型设备的平台的应用方法、移动终端
CN109343854A (zh) * 2018-09-18 2019-02-15 武汉精立电子技术有限公司 基于zynq系统的智能自动化编译方法及系统

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107632828B (zh) * 2016-07-18 2020-04-07 迈普通信技术股份有限公司 多dts文件支持方法、编译装置及嵌入式设备

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1605353A2 (en) * 2004-06-07 2005-12-14 Northrop Grumman Corporation Method for imaging computer systems
CN105260184A (zh) * 2015-10-15 2016-01-20 广东欧珀移动通信有限公司 一种恢复镜像文件的调试方法及装置
CN106384052A (zh) * 2016-08-26 2017-02-08 浪潮电子信息产业股份有限公司 一种实现BMC U‑boot可信启动控制的方法
CN107145343A (zh) * 2017-04-05 2017-09-08 烽火通信科技股份有限公司 一种动态适配外围设备的系统及方法
CN107301070A (zh) * 2017-06-20 2017-10-27 福州汇思博信息技术有限公司 一种升级方法及终端
CN109062617A (zh) * 2018-06-26 2018-12-21 百富计算机技术(深圳)有限公司 一种支持多类型设备的平台的应用方法、移动终端
CN109343854A (zh) * 2018-09-18 2019-02-15 武汉精立电子技术有限公司 基于zynq系统的智能自动化编译方法及系统

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4202646A4

Also Published As

Publication number Publication date
EP4202646A4 (en) 2024-02-21
EP4202646A1 (en) 2023-06-28
CN114168168A (zh) 2022-03-11
US20230385046A1 (en) 2023-11-30

Similar Documents

Publication Publication Date Title
US9301164B2 (en) Method, system, and terminal for performing system update between mobile communication terminals
JP6649510B2 (ja) パッチアップグレードに基づくファイル処理方法及び機器、端末、並びに記憶媒体
US9965270B2 (en) Updating computer firmware
US7934209B2 (en) Method for firmware variable storage with eager compression, fail-safe extraction and restart time compression scan
US9189631B2 (en) Firmware authentication
US10747883B2 (en) Collated multi-image check in system-on-chips
US10747526B2 (en) Apparatus and method to execute prerequisite code before delivering UEFI firmware capsule
US20090031202A1 (en) Methods, Systems, and Computer Program Products for Class Verification
US10430589B2 (en) Dynamic firmware module loader in a trusted execution environment container
US10664598B1 (en) Firmware security patch deployment
CN110875850A (zh) 一种固件升级方法、系统、可读存储介质及终端设备
CN113449283A (zh) 由主机软件下载的基于非rom的ip固件验证
US8140835B2 (en) Updating a basic input/output system (‘BIOS’) boot block security module in compute nodes of a multinode computer
CN116467015B (zh) 镜像生成方法、系统启动校验方法及相关设备
WO2022052739A1 (zh) 设备树修复方法、系统及计算机可读存储介质
US10776132B1 (en) System and method for preboot device driver provisioning for remotely-staged operating system
EP3992783A1 (en) Patch releasing method, server and terminal device
CN107360167B (zh) 一种认证方法及装置
CN116661876B (zh) 系统启动方法、文件生成方法、电子设备及服务器
US20230031974A1 (en) Enabling spi firmware updates at runtime
US20230078138A1 (en) Computing systems employing measurement of boot components, such as prior to trusted platform module (tpm) availability, for enhanced boot security, and related methods
US11977753B2 (en) BIOS NVRAM storage extension system and method for secure and seamless access for various boot architectures
WO2024067053A1 (zh) 一种应用程序安装方法及电子设备
WO2023185557A1 (zh) 智能销售终端的控制方法、装置、终端设备及存储介质
WO2023045744A1 (zh) 加固方法、注册方法、运行方法、电子设备和存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21865795

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 18044938

Country of ref document: US

ENP Entry into the national phase

Ref document number: 2021865795

Country of ref document: EP

Effective date: 20230323

NENP Non-entry into the national phase

Ref country code: DE