CN108563444B - Android system firmware source code restoration method and storage medium - Google Patents

Android system firmware source code restoration method and storage medium Download PDF

Info

Publication number
CN108563444B
CN108563444B CN201810238074.7A CN201810238074A CN108563444B CN 108563444 B CN108563444 B CN 108563444B CN 201810238074 A CN201810238074 A CN 201810238074A CN 108563444 B CN108563444 B CN 108563444B
Authority
CN
China
Prior art keywords
code
warehouses
warehouse
information
sub
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810238074.7A
Other languages
Chinese (zh)
Other versions
CN108563444A (en
Inventor
陈伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Rockchip Electronics Co Ltd
Original Assignee
Rockchip Electronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Rockchip Electronics Co Ltd filed Critical Rockchip Electronics Co Ltd
Priority to CN201810238074.7A priority Critical patent/CN108563444B/en
Publication of CN108563444A publication Critical patent/CN108563444A/en
Application granted granted Critical
Publication of CN108563444B publication Critical patent/CN108563444B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • G06F11/1469Backup restoration techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Landscapes

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

Abstract

A firmware source code restoring method and a storage medium of an android system are disclosed, wherein the method comprises the steps of storing warehouse information of a repo/manifest directory under a firmware source code root directory, wherein the warehouse information comprises remote warehouse address information of the repo/manifest directory, branch name information and a manifest file name; the method comprises the steps of storing submission information of all sub-warehouses under a firmware source code root directory as a local warehouse submission information file, wherein the submission information comprises remote warehouse address information of the sub-warehouses, branch name information of the sub-warehouses and local submission numbers of the sub-warehouses; the problem that the compiling state needs to be extracted for restoration and modification in the design process of the system firmware is solved.

Description

Android system firmware source code restoration method and storage medium
Technical Field
The invention relates to the field of android system design, in particular to a firmware source code recovery method for an android system.
Background
The currently compiled Android firmware does not contain information from which source code it is compiled. Once a problem occurs after a customer burns such firmware into a device, the code state is not verified. Based on the current situation, the invention provides a method capable of restoring the source code of the firmware from the Android firmware, which is used for helping the problem processing. The research and development personnel for processing the problem can extract the source code state information corresponding to the firmware file or the firmware burnt on the equipment, and then restore the same test environment recurrence problem, which is beneficial to the problem processing.
In order to realize the method for restoring the source code of the firmware from the Android firmware, the method needs to start from a firmware generation mode, collect necessary current code state information during compiling, and store the information into the firmware. When the source code corresponding to the firmware needs to be confirmed, the code state information compiled at that time can be extracted from the firmware file or the device on which the firmware is burned, and then the code state at that time is completely restored.
Disclosure of Invention
Therefore, a method for restoring firmware codes of the android system needs to be provided, so as to solve the problem that the compiling state needs to be extracted for restoring and modifying in the design process of system firmware;
in order to achieve the above object, the inventor provides a firmware source code restoring method for an android system, which includes the steps of storing warehouse information of a repo/relationships directory under a firmware source code root directory, wherein the warehouse information includes remote warehouse address information of the repo/relationships directory, branch name information and relationships file name; the method comprises the steps of storing submission information of all sub-warehouses under a firmware source code root directory as a local warehouse submission information file, wherein the submission information comprises remote warehouse address information of the sub-warehouses, branch name information of the sub-warehouses and local submission numbers of the sub-warehouses; storing difference code information of all sub-warehouses and corresponding remote warehouses under the firmware source code root directory, wherein the difference code information comprises remote warehouse branch names tracked by the sub-warehouses, merging reference point submitting numbers of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and difference codes of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and outputting results to a folder with sub-warehouse directory name information respectively;
storing the code state information into a code state information set folder, compressing the folder, integrating the compressed folder into an android compiling system, generating a first code state information set, and storing the first code state information set into firmware;
when a firmware source code needs to be restored, separating the first code state information set from the firmware, downloading the latest content of a remote warehouse corresponding to a repo/relationships folder, replacing a default pointed relationship name. And traversing a difference code folder in the first code state information set, and combining the difference code into the source code, so that the source code corresponding to the firmware can be completely restored.
Further, the method also comprises the step of,
traversing all git code warehouses managed by a supervisor in a firmware source code project, collecting branch names of remote warehouses tracked by the sub-warehouses, merging reference point submission numbers of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and difference codes of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and respectively outputting results to a folder with sub-warehouse directory name information;
and compressing the first code state information set into a code state information set compression packet, and integrating into android firmware.
Specifically, the step of storing the difference code information between all the sub-warehouses under the firmware source code root directory and the corresponding remote warehouses comprises the specific steps of,
judging whether the current warehouse is an unmodified AOSP warehouse or not, if not, modifying the AOSP codes or introducing a new warehouse, and further performing the following steps:
finding out the local submitted but not uploaded or merged into the remote code warehouse, then recording the remote warehouse address and the pointed branch name of the warehouse, finding out the merging reference point of the local submitted and the remote code warehouse and recording the merging reference point;
and traversing all the modified code warehouses, finding out local uncommitted difference codes, and storing the local uncommitted difference codes into a folder with the directory name information of the sub-warehouses.
Preferably, the step of compressing the code state information set folder and integrating into the newly generated firmware of the android compilation system specifically comprises the step of,
adding a PRODUCT _ COPY _ FILES script into an equipment compiling configuration file of the android compiling system, wherein the script is used for integrating a code state information set compression package into a firmware image file in a system format; executing a compiling command make, and executing a script program for storing the current code state according to the added script; and after the compiling system finishes compiling, generating an information set of the current code state, and storing the information set into android firmware.
Separating a code state information set from equipment firmware, branching and downloading address information and name information of a manifest file according to address information of a manifest remote warehouse, and acquiring current latest manifest.
Xml of the default direction is modified to be downloaded to the source code without the difference code patch through the reposync, and the steps include:
xml submits an information file for a local warehouse by replacing a default pointed manifest, traverses all difference code information folders, acquires a folder which stores merging reference point submission number information, finds a row with the same warehouse directory name in the manifest file by the warehouse directory name information in the folder name, and replaces the submission number in the row as a merging reference point submission number; then restoring the source code without the difference code patch through the reposync;
traversing all difference code information folders, and respectively copying the difference code patch files to corresponding code warehouse directories through the warehouse directory name information in the folder names; the patch files comprise local uncommitted patches and patches which are submitted locally but are not merged into a remote warehouse, and the patch files are updated to the source codes, so that the complete restoration of the source codes corresponding to the firmware can be completed.
An android system firmware source code recovery storage medium storing a computer program which, when executed, performs the steps of,
storing warehouse information of a repo/manifest directory under a firmware source code root directory, wherein the warehouse information comprises remote warehouse address information of the repo/manifest directory, branch name information and a manifest file name; the method comprises the steps of storing submission information of all sub-warehouses under a firmware source code root directory as a local warehouse submission information file, wherein the submission information comprises remote warehouse address information of the sub-warehouses, branch name information of the sub-warehouses and local submission numbers of the sub-warehouses; storing difference code information of all sub-warehouses and corresponding remote warehouses under the firmware source code root directory, wherein the difference code information comprises remote warehouse branch names tracked by the sub-warehouses, merging reference point submitting numbers of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and difference codes of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and outputting results to a folder with sub-warehouse directory name information respectively;
storing the code state information into a code state information set folder, compressing the folder, integrating the compressed folder into an android compiling system, generating a first code state information set, and storing the first code state information set into firmware;
when a firmware source code needs to be restored, separating the first code state information set from the firmware, downloading the latest content of a remote warehouse corresponding to a repo/relationships folder, replacing a default pointed relationship name. And traversing a difference code folder in the first code state information set, and combining the difference code into the source code, so that the source code corresponding to the firmware can be completely restored.
Further, the computer program, when executed, performs the steps,
traversing all git code warehouses managed by a supervisor in a firmware source code project, collecting branch names of remote warehouses tracked by the sub-warehouses, merging reference point submission numbers of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and difference codes of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and respectively outputting results to a folder with sub-warehouse directory name information;
and compressing the first code state information set into a code state information set compression packet, and integrating into android firmware.
Specifically, the step of storing the difference code information between all the sub-warehouses in the firmware source code root directory and the corresponding remote warehouses by the computer program includes the specific steps,
judging whether the current warehouse is an unmodified AOSP warehouse or not, if not, modifying the AOSP codes or introducing a new warehouse, and further performing the following steps:
finding out the local submitted but not uploaded or merged into the remote code warehouse, then recording the remote warehouse address and the pointed branch name of the warehouse, finding out the merging reference point of the local submitted and the remote code warehouse and recording the merging reference point;
and traversing all the modified code warehouses, finding out local uncommitted difference codes, and storing the local uncommitted difference codes into a folder with the directory name information of the sub-warehouses.
Preferably, the computer program performs the steps of compressing the code state information set folder into newly generated firmware of an android compilation system,
adding a PRODUCT _ COPY _ FILES script into an equipment compiling configuration file of the android compiling system, wherein the script is used for integrating a code state information set compression package into a firmware image file in a system format; executing a compiling command make, and executing a script program for storing the current code state according to the added script; and after the compiling system finishes compiling, generating an information set of the current code state, and storing the information set into android firmware.
Specifically, the computer program further executes a step of separating a code state information set from the device firmware, branching and downloading address information and manifest file name information according to manifest remote warehouse address information, and acquiring current latest manifest xml content by using a repoinit command when the computer program is executed;
xml of the default direction is modified to be downloaded to the source code without the difference code patch through the reposync, and the steps include:
xml submits an information file for a local warehouse by replacing a default pointed manifest, traverses all difference code information folders, acquires a folder which stores merging reference point submission number information, finds a row with the same warehouse directory name in the manifest file by the warehouse directory name information in the folder name, and replaces the submission number in the row as a merging reference point submission number; then restoring the source code without the difference code patch through the reposync;
traversing all difference code information folders, and respectively copying the difference code patch files to corresponding code warehouse directories through the warehouse directory name information in the folder names; the patch files comprise local uncommitted patches and patches which are submitted locally but are not merged into a remote warehouse, and the patch files are updated to the source codes, so that the complete restoration of the source codes corresponding to the firmware can be completed.
By the method, the source code information of each version in the code warehouse is recorded and reserved, merged, compiled and reserved in the firmware, and when the peer-to-peer operation needs to be corrected, the firmware is extracted for restoration, and the effective restoration of the firmware is realized by backing to the merged reference number.
Drawings
Fig. 1 is a flowchart of a method for restoring a firmware source code of an android system according to an embodiment of the present invention.
Detailed Description
To explain technical contents, structural features, and objects and effects of the technical solutions in detail, the following detailed description is given with reference to the accompanying drawings in conjunction with the embodiments.
Referring to fig. 1, a method for restoring firmware source codes of an android system is introduced, which includes the steps of S102 storing warehouse information of a repo/relationships directory under a firmware source code root directory, where the warehouse information includes remote warehouse address information of the repo/relationships directory, branch name information, and a relationships file name; the method comprises the steps of storing submission information of all sub-warehouses under a firmware source code root directory as a local warehouse submission information file, wherein the submission information comprises remote warehouse address information of the sub-warehouses, branch name information of the sub-warehouses and local submission numbers of the sub-warehouses; s104, storing difference code information of all sub-warehouses under the firmware source code root directory and corresponding remote warehouses, wherein the difference code information comprises remote warehouse branch names tracked by the sub-warehouses, merging reference point submission numbers of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and difference codes of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and outputting results to a folder with sub-warehouse directory name information respectively;
s106, storing the code state information into a code state information set folder, compressing the folder, integrating the compressed folder into an android compiling system, generating a first code state information set, and storing the first code state information set into firmware;
when the source code of the firmware needs to be restored, the step S108 is carried out to separate the first code state information set from the firmware, the latest content of a remote warehouse corresponding to a repo/manifest folder is downloaded according to the first code state information set, manifest. S110, traversing the difference code folder in the first code state information set, and combining the difference code into the source code, so that the source code corresponding to the firmware can be completely restored.
In the embodiment shown in fig. 1, the warehouse information may be android git warehouse information, the remote warehouse address and score information is remote URL and branch information, the source code is found by searching the main file name, and then the source code is stored in the firmware together with the found difference code information and the merging reference point submission number according to the information of the road sub-warehouse, so that the defect that the code in the firmware code warehouse in the prior art is continuously iterated along with the update of the design version is overcome, the difference of the versions before iteration can be found according to the information of the merging submission number, and the firmware is directly analyzed when the firmware code needs to be restored, the difference code can be found and the patch is merged into the source code, so that the recorded source code can be returned to the specific version corresponding to the firmware. The problem of in the prior art the source code of firmware can't be difficult for preserving, can't carry out simple restoration along with the firmware is solved.
In some other further embodiments, the method specifically includes the steps of traversing all git code warehouses managed by a supervisor in the firmware source code engineering, collecting branch names of the remote warehouses tracked by the sub-warehouses, merging reference point submission numbers of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and difference codes of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and outputting results to a folder with sub-warehouse directory name information respectively;
and compressing the first code state information set into a code state information set compression packet, and integrating into android firmware.
Through the design, the data in the sub-warehouse can be better fixedly extracted, the technical effect of better tracking difference codes is achieved, and the effectiveness of restoration is guaranteed.
In other specific embodiments, the step of storing the difference code information between all the sub-warehouses under the firmware source code root directory and the corresponding remote warehouses comprises the specific steps of,
judging whether the current warehouse is an unmodified AOSP warehouse or not, if not, modifying the AOSP codes or introducing a new warehouse, and further performing the following steps:
finding out the local submitted but not uploaded or merged into the remote code warehouse, then recording the remote warehouse address and the pointed branch name of the warehouse, finding out the merging reference point of the local submitted and the remote code warehouse and recording the merging reference point;
and traversing all the modified code warehouses, finding out local uncommitted difference codes, and storing the local uncommitted difference codes into a folder with the directory name information of the sub-warehouses. According to the technical scheme, the records of the code warehouse can be more accurate, the difference codes can be accurately identified if the warehouse is modified, and the traversal step can be omitted if the warehouse is not modified, so that computer resources are better saved. The technical effect of optimizing the reduction process is achieved by the mobile phone with the scheme.
In other preferred embodiments, the step of compressing the code state information set folder into the newly generated firmware of the android compilation system includes the step of,
adding a PRODUCT _ COPY _ FILES script into an equipment compiling configuration file of the android compiling system, wherein the script is used for integrating a code state information set compression package into a firmware image file in a system format; executing a compiling command make, and executing a script program for storing the current code state according to the added script; and after the compiling system finishes compiling, generating an information set of the current code state, and storing the information set into android firmware.
In some other embodiments, to better restore the difference patch, the method further includes the steps of separating a code state information set from the device firmware, branching and downloading address information and manifest file name information according to manifest remote warehouse address information, and acquiring current latest manifest.
Xml of the default direction is modified to be downloaded to the source code without the difference code patch through the reposync, and the steps include:
xml submits an information file for a local warehouse by replacing a default pointed manifest, traverses all difference code information folders, acquires a folder which stores merging reference point submission number information, finds a row with the same warehouse directory name in the manifest file by the warehouse directory name information in the folder name, and replaces the submission number in the row as a merging reference point submission number; then restoring the source code without the difference code patch through the reposync;
traversing all difference code information folders, and respectively copying the difference code patch files to corresponding code warehouse directories through the warehouse directory name information in the folder names; the patch files comprise local uncommitted patches and patches which are submitted locally but are not merged into a remote warehouse, and the patch files are updated to the source codes, so that the complete restoration of the source codes corresponding to the firmware can be completed.
The invention also provides the following embodiment scheme:
2.1 writing a script file for saving the current code state, and adding the script file into a compiling system for calling
2.1.1 saving scripts of the current code state, involving the steps of:
2.1.1.1 creating code state information set folder for subsequent storing necessary state information file and compressed storing
2.1.1.2 store under the source code root directory, the repo/manifest git repository information, including remote repository address (remote url) and branch to point (branch) information, into the code state information set folder. Xml is a soft link, so it is necessary to find the real manifest file name it points to through the ls-l command and save the real manifest file and file name to the code state information set folder. This step is used in the process of restoring the source code from firmware, providing the remote address, branch and filename information for the manifest repository required in the repoinit command.
2.1.1.3 utilize a repo manifest command to save the latest commit number information to xml file to code State information set folder of all git warehouses managed by the manifest in the current source code project. This step will be used in the process of restoring the source code from firmware, providing the xml file as a parameter to the reposync command for restoring the source code.
And 2.1.1.4 traversing all git code warehouses managed by the manifest in the current source code project by using a repoforall-c command, executing a script of collecting modified warehouse code state information and code patches, and outputting a result to a code state information set folder. The script for collecting the modified warehouse code state information and the modified code patches has the specific functions of:
2.1.1.4.1 determines if the current warehouse is the unmodified google AOSP warehouse. If so, exit is performed, since it is not necessary to check whether there is a patch set since the repository has not been modified, saving traversal time. If not, either the AOSP code has been modified or a new repository introduced, the following steps are required.
2.1.1.4.2 find the commit sets that have been committed locally but not uploaded or merged into the remote code repository, and convert these commit sets into patch file sets using the git format-patch command. The remote warehouse address (remote url) and the branch pointed to (branch) of the warehouse are then recorded, while the merge reference point commit (merge base) of the local commit and the remote code warehouse is found using the git merge base command. The information and file sets are placed in respective repository name folders created with reference to the code state information set folder.
2.1.1.4.3 traversing the modified code repository to find local uncommitted delta code patches, and saving the local uncommitted delta code patches to respective repository name folders created with reference to the code state information set folder by using the git diff-bind and git diff-cached-bind commands.
2.1.1.5 the code status information set folder of 2.1.1.1 is packed and compressed to generate a code status information set compressed package file.
2.1.2 the scripts created by 2.1.1 are integrated into an Android compiling system. The method comprises the following steps:
2.1.2.1, defining the beginning of the droid _ targets to the most core build/core/main.mk of the Android compiling system, adding an execution statement ($ (shell) "script for saving the current code state) of the script created at 2.1.1, and ensuring that the compiling system generates the information set of the current code state at the beginning of compiling the Android firmware.
2.1.2.2 Add PRODUCT _ COPY _ FILES script to the device compilation configuration file of the Android compilation system to COPY 2.1.1.5 the generated compact package file to the firmware image file packaged in the ext4 file system format.
2.2 executing the compiling command make, the compiling system will execute the script program for saving the current code state according to the added script
2.3 the compiling system completes the compiling, generates the information set of the current code state, and stores the information set into the firmware
3 step of restoring source code from firmware
3.1 can know the storage location of the source code status information at that time from the 2.1.2.2 process, and copy the code status compressed package file generated by 2.1.1.5 by mounting the firmware image file of the ext4 file system or the device in which adb pull burns the firmware.
3.2 decompressing the code state compressed packet file obtained in 3.1, the following information can be obtained:
3.2.1 Manifest information required for downloading the original code, including the Manifest remote warehouse address generated by 2.1.1.2, the branch name, the Manifest file name and the Manifest file generated by 2.1.1.3.
3.2.22.1.1.4 generated all modified warehouse code status information and code patches
3.3 restoring Source code
3.3.1 traverse all the modified warehouse code status information and code patch folders generated by 2.1.1.4 to find the folder with 2.1.1.4.2 generated merge reference point (merge base) commit number information. And (3) finding the row with the same warehouse name in the manifest file output by 2.1.1.3 according to the warehouse name information in the folder name, and replacing the submission number (precision) in the changed row as the combination reference point submission number.
3.3.2 Using the repoinit command, take the parameters mentioned at 3.2.1: the remote warehouse address of the manifest, the branch name, the file name of the manifest, and the initialization source code warehouse information.
3.3.3 downloading reference Source code Using the reposync Command
3.3.4 copy 3.3.3.1 processed manifest file to. repo/manifests/folder under the benchmark source code engineering.
3.3.5 use repoinit-m to switch to the manifest file mentioned at 3.3.4
3.3.6 updating of reference Source code to Merge base Source code Using the repo sync command
3.3.7 traverse all the modified repository code status information and code patch folders generated at 2.1.1.4 and copy patch files (including local uncommitted patches and patches that have been submitted locally but not merged into the remote repository) under the corresponding code folders, respectively, with the repository name information in the folder name. Patches that have been submitted locally but not merged into the remote repository are patched using git am. The local uncommitted patch is patched using git apply-reject.
Through the steps, the source code can be restored to the source code state when the firmware is generated. The technical effect that the source code of the firmware cannot be restored aiming at any firmware in the prior art is solved.
An android system firmware source code recovery storage medium storing a computer program which, when executed, performs the steps of,
storing warehouse information of a repo/manifest directory under a firmware source code root directory, wherein the warehouse information comprises remote warehouse address information of the repo/manifest directory, branch name information and a manifest file name; the method comprises the steps of storing submission information of all sub-warehouses under a firmware source code root directory as a local warehouse submission information file, wherein the submission information comprises remote warehouse address information of the sub-warehouses, branch name information of the sub-warehouses and local submission numbers of the sub-warehouses; storing difference code information of all sub-warehouses and corresponding remote warehouses under the firmware source code root directory, wherein the difference code information comprises remote warehouse branch names tracked by the sub-warehouses, merging reference point submitting numbers of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and difference codes of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and outputting results to a folder with sub-warehouse directory name information respectively;
storing the code state information into a code state information set folder, compressing the folder, integrating the compressed folder into an android compiling system, generating a first code state information set, and storing the first code state information set into firmware;
when a firmware source code needs to be restored, separating the first code state information set from the firmware, downloading the latest content of a remote warehouse corresponding to a repo/relationships folder, replacing a default pointed relationship name. And traversing a difference code folder in the first code state information set, and combining the difference code into the source code, so that the source code corresponding to the firmware can be completely restored.
Further, the computer program, when executed, performs the steps,
traversing all git code warehouses managed by a supervisor in a firmware source code project, collecting branch names of remote warehouses tracked by the sub-warehouses, merging reference point submission numbers of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and difference codes of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and respectively outputting results to a folder with sub-warehouse directory name information;
and compressing the first code state information set into a code state information set compression packet, and integrating into android firmware.
Specifically, the step of storing the difference code information between all the sub-warehouses in the firmware source code root directory and the corresponding remote warehouses by the computer program includes the specific steps,
judging whether the current warehouse is an unmodified AOSP warehouse or not, if not, modifying the AOSP codes or introducing a new warehouse, and further performing the following steps:
finding out the local submitted but not uploaded or merged into the remote code warehouse, then recording the remote warehouse address and the pointed branch name of the warehouse, finding out the merging reference point of the local submitted and the remote code warehouse and recording the merging reference point;
and traversing all the modified code warehouses, finding out local uncommitted difference codes, and storing the local uncommitted difference codes into a folder with the directory name information of the sub-warehouses.
Preferably, the computer program performs the steps of compressing the code state information set folder into newly generated firmware of an android compilation system,
adding a PRODUCT _ COPY _ FILES script into an equipment compiling configuration file of the android compiling system, wherein the script is used for integrating a code state information set compression package into a firmware image file in a system format; executing a compiling command make, and executing a script program for storing the current code state according to the added script; and after the compiling system finishes compiling, generating an information set of the current code state, and storing the information set into android firmware.
Specifically, the computer program further executes a step of separating a code state information set from the device firmware, branching and downloading address information and manifest file name information according to manifest remote warehouse address information, and acquiring current latest manifest xml content by using a repoinit command when the computer program is executed;
xml of the default direction is modified to be downloaded to the source code without the difference code patch through the reposync, and the steps include:
xml submits an information file for a local warehouse by replacing a default pointed manifest, traverses all difference code information folders, acquires a folder which stores merging reference point submission number information, finds a row with the same warehouse directory name in the manifest file by the warehouse directory name information in the folder name, and replaces the submission number in the row as a merging reference point submission number; then restoring the source code without the difference code patch through the reposync;
traversing all difference code information folders, and respectively copying the difference code patch files to corresponding code warehouse directories through the warehouse directory name information in the folder names; the patch files comprise local uncommitted patches and patches which are submitted locally but are not merged into a remote warehouse, and the patch files are updated to the source codes, so that the complete restoration of the source codes corresponding to the firmware can be completed.
It should be noted that, although the above embodiments have been described herein, the invention is not limited thereto. Therefore, based on the innovative concepts of the present invention, the technical solutions of the present invention can be directly or indirectly applied to other related technical fields by making changes and modifications to the embodiments described herein, or by using equivalent structures or equivalent processes performed in the content of the present specification and the attached drawings, which are included in the scope of the present invention.

Claims (10)

1. The android system firmware source code restoration method is characterized by comprising the steps of storing warehouse information of a repo/manifest directory under a firmware source code root directory, wherein the warehouse information comprises remote warehouse address information of the repo/manifest directory, branch name information and a manifest file name; the method comprises the steps of storing submission information of all sub-warehouses under a firmware source code root directory as a local warehouse submission information file, wherein the submission information comprises remote warehouse address information of the sub-warehouses, branch name information of the sub-warehouses and local submission numbers of the sub-warehouses; storing difference code information of all sub-warehouses and corresponding remote warehouses under the firmware source code root directory, wherein the difference code information comprises remote warehouse branch names tracked by the sub-warehouses, merging reference point submitting numbers of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and difference codes of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and outputting results to a folder with sub-warehouse directory name information respectively;
storing the code state information into a code state information set folder, compressing the folder, integrating the compressed folder into an android compiling system, generating a first code state information set, and storing the first code state information set into firmware;
when a firmware source code needs to be restored, separating the first code state information set from the firmware, downloading the latest content of a remote warehouse corresponding to a repo/relationships folder, replacing a default pointed relationship name. And traversing a difference code folder in the first code state information set, and combining the difference code into the source code, so that the source code corresponding to the firmware can be completely restored.
2. The android system firmware source code recovery method of claim 1, further comprising a step of,
traversing all git code warehouses managed by a supervisor in a firmware source code project, collecting branch names of remote warehouses tracked by the sub-warehouses, merging reference point submission numbers of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and difference codes of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and respectively outputting results to a folder with sub-warehouse directory name information;
and compressing the first code state information set into a code state information set compression packet, and integrating into android firmware.
3. The android system firmware source code recovery method of claim 2,
storing the difference code information of all the sub-warehouses and the corresponding remote warehouses under the firmware source code root directory specifically comprises the steps of,
judging whether the current warehouse is an unmodified AOSP warehouse or not, if not, modifying the AOSP codes or introducing a new warehouse, and further performing the following steps:
finding out the local submitted but not uploaded or merged into the remote code warehouse, then recording the remote warehouse address and the pointed branch name of the warehouse, finding out the merging reference point of the local submitted and the remote code warehouse and recording the merging reference point;
and traversing all the modified code warehouses, finding out local uncommitted difference codes, and storing the local uncommitted difference codes into a folder with the directory name information of the sub-warehouses.
4. The android system firmware source code recovery method of claim 2, wherein the step of compressing the code state information set folder into a new firmware generation of an android compilation system specifically comprises the step of,
adding a PRODUCT _ COPY _ FILES script into an equipment compiling configuration file of the android compiling system, wherein the script is used for integrating a code state information set compression package into a firmware image file in a system format; executing a compiling command make, and executing a script program for storing the current code state according to the added script; and after the compiling system finishes compiling, generating an information set of the current code state, and storing the information set into android firmware.
5. The android system firmware source code recovery method of claim 1, further comprising the steps of separating a code state information set from device firmware, obtaining current latest manifest.xml content using a repoinit command according to manifest remote warehouse address information, branch download address information, manifest file name information;
xml of the default direction is modified to be downloaded to the source code without the difference code patch through the reposync, and the steps include:
xml submits an information file for a local warehouse by replacing a default pointed manifest, traverses all difference code information folders, acquires a folder which stores merging reference point submission number information, finds a row with the same warehouse directory name in the manifest file by the warehouse directory name information in the folder name, and replaces the submission number in the row as a merging reference point submission number; then restoring the source code without the difference code patch through the reposync;
traversing all difference code information folders, and respectively copying the difference code patch files to corresponding code warehouse directories through the warehouse directory name information in the folder names; the patch files comprise local uncommitted patches and patches which are submitted locally but are not merged into a remote warehouse, and the patch files are updated to the source codes, so that the complete restoration of the source codes corresponding to the firmware can be completed.
6. A firmware source code recovery storage medium of an android system, characterized in that a computer program is stored, which when executed performs the following steps,
storing warehouse information of a repo/manifest directory under a firmware source code root directory, wherein the warehouse information comprises remote warehouse address information of the repo/manifest directory, branch name information and a manifest file name; the method comprises the steps of storing submission information of all sub-warehouses under a firmware source code root directory as a local warehouse submission information file, wherein the submission information comprises remote warehouse address information of the sub-warehouses, branch name information of the sub-warehouses and local submission numbers of the sub-warehouses; storing difference code information of all sub-warehouses and corresponding remote warehouses under the firmware source code root directory, wherein the difference code information comprises remote warehouse branch names tracked by the sub-warehouses, merging reference point submitting numbers of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and difference codes of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and outputting results to a folder with sub-warehouse directory name information respectively;
storing the code state information into a code state information set folder, compressing the folder, integrating the compressed folder into an android compiling system, generating a first code state information set, and storing the first code state information set into firmware;
when a firmware source code needs to be restored, separating the first code state information set from the firmware, downloading the latest content of a remote warehouse corresponding to a repo/relationships folder, replacing a default pointed relationship name. And traversing a difference code folder in the first code state information set, and combining the difference code into the source code, so that the source code corresponding to the firmware can be completely restored.
7. The android system firmware source code recovery storage medium of claim 6, wherein the computer program when executed further performs steps,
traversing all git code warehouses managed by a supervisor in a firmware source code project, collecting branch names of remote warehouses tracked by the sub-warehouses, merging reference point submission numbers of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and difference codes of the sub-warehouses and the remote warehouses tracked by the sub-warehouses, and respectively outputting results to a folder with sub-warehouse directory name information;
and compressing the first code state information set into a code state information set compression packet, and integrating into android firmware.
8. The android system firmware source code recovery storage medium of claim 7,
the computer program is used for storing the difference code information of all the sub-warehouses and the corresponding remote warehouses under the firmware source code root directory,
judging whether the current warehouse is an unmodified AOSP warehouse or not, if not, modifying the AOSP codes or introducing a new warehouse, and further performing the following steps:
finding out the local submitted but not uploaded or merged into the remote code warehouse, then recording the remote warehouse address and the pointed branch name of the warehouse, finding out the merging reference point of the local submitted and the remote code warehouse and recording the merging reference point;
and traversing all the modified code warehouses, finding out local uncommitted difference codes, and storing the local uncommitted difference codes into a folder with the directory name information of the sub-warehouses.
9. The android system firmware source code recovery storage medium of claim 7, wherein the computer program performs the step of compressing the code state information set folder into the newly generated firmware of the android compilation system,
adding a PRODUCT _ COPY _ FILES script into an equipment compiling configuration file of the android compiling system, wherein the script is used for integrating a code state information set compression package into a firmware image file in a system format; executing a compiling command make, and executing a script program for storing the current code state according to the added script; and after the compiling system finishes compiling, generating an information set of the current code state, and storing the information set into android firmware.
10. The android system firmware source code recovery storage medium of claim 6, the computer program when executed further performs the steps of separating a set of code state information from device firmware, branching download address information, manifest filename information, and obtaining current up-to-date manifest.xml content using a repoinit command, based on manifest remote repository address information;
xml of the default direction is modified to be downloaded to the source code without the difference code patch through the reposync, and the steps include:
xml submits an information file for a local warehouse by replacing a default pointed manifest, traverses all difference code information folders, acquires a folder which stores merging reference point submission number information, finds a row with the same warehouse directory name in the manifest file by the warehouse directory name information in the folder name, and replaces the submission number in the row as a merging reference point submission number; then restoring the source code without the difference code patch through the reposync;
traversing all difference code information folders, and respectively copying the difference code patch files to corresponding code warehouse directories through the warehouse directory name information in the folder names; the patch files comprise local uncommitted patches and patches which are submitted locally but are not merged into a remote warehouse, and the patch files are updated to the source codes, so that the complete restoration of the source codes corresponding to the firmware can be completed.
CN201810238074.7A 2018-03-22 2018-03-22 Android system firmware source code restoration method and storage medium Active CN108563444B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810238074.7A CN108563444B (en) 2018-03-22 2018-03-22 Android system firmware source code restoration method and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810238074.7A CN108563444B (en) 2018-03-22 2018-03-22 Android system firmware source code restoration method and storage medium

Publications (2)

Publication Number Publication Date
CN108563444A CN108563444A (en) 2018-09-21
CN108563444B true CN108563444B (en) 2021-03-19

Family

ID=63532071

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810238074.7A Active CN108563444B (en) 2018-03-22 2018-03-22 Android system firmware source code restoration method and storage medium

Country Status (1)

Country Link
CN (1) CN108563444B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109669692B (en) * 2018-12-21 2023-03-10 深圳Tcl新技术有限公司 Source code sharing method, server, computer readable storage medium and system
CN109800018A (en) * 2019-01-10 2019-05-24 郑州云海信息技术有限公司 A kind of code administration method and system based on Gerrit
CN109933364A (en) * 2019-02-25 2019-06-25 晶晨半导体(上海)股份有限公司 A kind of code administration method
CN110688140B (en) * 2019-10-11 2023-11-21 上海创功通讯技术有限公司 Code management method and terminal
CN114816976A (en) * 2021-01-29 2022-07-29 北京字节跳动网络技术有限公司 Information processing method, device, equipment, storage medium and computer program product
CN112988217B (en) * 2021-03-10 2023-11-17 北京大学 Code base design method and detection method for rapid full-network code traceability detection
CN113127429B (en) * 2021-06-16 2022-10-11 北京车智赢科技有限公司 Compression processing method and system and computing equipment
CN113806595B (en) * 2021-08-13 2022-08-12 荣耀终端有限公司 Code search system generation method, code search method and search server

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106528258A (en) * 2016-10-28 2017-03-22 武汉斗鱼网络科技有限公司 Method and system for improving compiling speed of Android project

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7809836B2 (en) * 2004-04-07 2010-10-05 Intel Corporation System and method for automating bios firmware image recovery using a non-host processor and platform policy to select a donor system
US8661425B1 (en) * 2006-07-28 2014-02-25 American Megatrends, Inc. Method, apparatus, and computer-readable medium for storing data associated with a firmware program
CN104317643A (en) * 2014-10-12 2015-01-28 福州瑞芯微电子有限公司 Method, system and device capable of realizing partition migration
CN104809036B (en) * 2015-05-07 2018-11-13 北京瑞星网安技术股份有限公司 Repair the method and system of router firmware loophole
CN105302554B (en) * 2015-10-23 2018-11-30 深圳市创维电器科技有限公司 A kind of android system automated procedures construction method and system
CN106708564A (en) * 2016-11-29 2017-05-24 努比亚技术有限公司 FOTA update method, device and server
CN106775723B (en) * 2016-12-16 2021-01-29 深圳市优博讯科技股份有限公司 Android platform-based system firmware customization method and Android device
CN107341031B (en) * 2017-06-20 2020-12-15 广州慧睿思通信息科技有限公司 Method and device for adding firmware generation information into DSP firmware

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106528258A (en) * 2016-10-28 2017-03-22 武汉斗鱼网络科技有限公司 Method and system for improving compiling speed of Android project

Also Published As

Publication number Publication date
CN108563444A (en) 2018-09-21

Similar Documents

Publication Publication Date Title
CN108563444B (en) Android system firmware source code restoration method and storage medium
CN111142903B (en) Configuration file interactive updating method and device based on file comparison
US9898269B2 (en) Build deployment automation for information technology mangement
CN106371940B (en) Method and device for solving program crash
US9390124B2 (en) Version control system using commit manifest database tables
CN110442371B (en) Method, device and medium for releasing codes and computer equipment
CN107678748B (en) Source code file compiling method and device
CN103530137A (en) Java web application deploying method and device
CN110083360B (en) Compiling method, device, equipment and storage medium of application program code
CN113114749B (en) Hash chain construction and file data synchronization method, device and system
US10067750B2 (en) Whole-program optimization using data from previous compilation runs
CN111324359A (en) Plug-in deployment method and device
CN112988217B (en) Code base design method and detection method for rapid full-network code traceability detection
WO2022116437A1 (en) Multi-architecture static library conflict processing method and apparatus, device, and storage medium
CN115658128A (en) Method, device and storage medium for generating software bill of material
WO2019041891A1 (en) Method and device for generating upgrade package
CN113760234B (en) Software development method and system
CN110688147A (en) Method for packing and analyzing metadata
CN107193619B (en) Method and device for automatically updating compiled version
CN108664255B (en) Software upgrading method and device
CN110750310B (en) Binary and source code switching method based on IOS system componentization development
CN110018857B (en) Method, storage medium, device and method for automatically managing branches in application modularization
CN111949303A (en) Upgrade package processing method and device, electronic equipment and storage medium
CN109343855B (en) Program compiling and grabbing system and method based on instruction camouflage
US8190587B1 (en) In-place image promotion

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 350003 building 18, No.89, software Avenue, Gulou District, Fuzhou City, Fujian Province

Applicant after: Ruixin Microelectronics Co., Ltd

Address before: 350003 building 18, No.89, software Avenue, Gulou District, Fuzhou City, Fujian Province

Applicant before: Fuzhou Rockchips Electronics Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant