reverse_engineering:ghidra:create_a_project
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
reverse_engineering:ghidra:create_a_project [2022/03/12 11:34] – kitor | reverse_engineering:ghidra:create_a_project [2022/04/01 17:46] (current) – [Initial analysis] kitor | ||
---|---|---|---|
Line 33: | Line 33: | ||
Close by clicking OK on all dialogs, and then acknowledge the import result. File will appear in a project. | Close by clicking OK on all dialogs, and then acknowledge the import result. File will appear in a project. | ||
- | ===== Initial analysis | + | ===== Project preparation |
Click twice on newly imported file. It will bring up "Code Browser" | Click twice on newly imported file. It will bring up "Code Browser" | ||
Ghidra will ask if you want to perform auto analysis now - select **No**. | Ghidra will ask if you want to perform auto analysis now - select **No**. | ||
+ | |||
+ | === Load 2nd ROM file (where applicable) === | ||
+ | |||
+ | Go to '' | ||
+ | |||
+ | Open '' | ||
=== Fix memory map === | === Fix memory map === | ||
- | Navigate to '' | + | Navigate to '' |
=== Add other memory regions === | === Add other memory regions === | ||
- | Skip this step if you don't have a list of romcopy regions. It will result | + | This topic has a separate Wiki section: [[reverse_engineering: |
- | You can obtain it from QEMU (see: [[reverse_engineering: | + | == Result == |
- | It can be also obtained by reading decompiled code, that will be available in incomplete project. | + | Complete memory map for EOS R 1.8.0 (internal 7.3.9) firmware: |
- | === Run disassembly === | + | {{ : |
- | Jump to second level (DryOS) bootloader address (press ' | + | ===== Initial analysis ===== |
- | ^ CPU ^ Address | + | Project is now ready to start disassembling. |
- | | Digic 6 | '' | + | |
- | | Digic 7,8 | '' | + | |
- | | Digic X | '' | + | |
- | Press F12 to disassemble in Thumb mode. Wait for Ghidra to finish a task - it will discover a lot of functions so it will take some time. | + | === Configure |
- | + | ||
- | After it is done, we name that function '' | + | |
- | + | ||
- | === Run auto analysis === | + | |
Navigate to '' | Navigate to '' | ||
Line 74: | Line 73: | ||
* Disable " | * Disable " | ||
- | Run the analysis - it will take a long time. After it is done, you may want to run "one shot" analysis for Embedded media and for Create Address Tables - but YMMV. | + | Click '' |
+ | === Run disassembly === | ||
- | ===== ROMCOPY regions from static analysis ===== | + | Jump to second level (DryOS) bootloader address (press ' |
- | While qemu '' | + | ^ CPU ^ Address |
+ | | Digic 6 | ||
+ | | Digic 7,8 | '' | ||
+ | | Digic X | '' | ||
- | First of all, it includes all things - including bootloader FROMUTIL that is not needed and may mess up analysis ( it is not available after DryOS boots anyway). 2nd, it just tries to detect bulk memory moves - so a lot of "small regions" | + | Press F12 to disassemble in Thumb mode. Wait for Ghidra |
- | QEMU result might be slightly off as compared to code, as reads/ | + | After it is done, we name that function '' |
- | === Obtaining list of ROMCOPY regions from DryOS (2nd stage) bootloader | + | === Run auto analysis |
- | Navigate | + | Go back to '' |
- | Read the code, note down each source address, destination start address and destination end address. Calculate region sizes. | + | Run the analysis - it will take a long time. After it is done, you may want to run "one shot" analysis |
- | + | ||
- | In disassembled code those may look like: | + | |
- | < | + | |
- | src = & | + | |
- | for (dst = & | + | |
- | *dst = *src; | + | |
- | src = src + 1; | + | |
- | } | + | |
- | </ | + | |
- | + | ||
- | Example, from SX740.102: | + | |
- | ^ source | + | |
- | | 0xe101ced8 | 0x4000 | + | |
- | | 0xe103c648 | 0x23770 | + | |
- | | - | < | + | |
- | | 0xe1072dec | 0xdf002800 | + | |
- | | - | < | + | |
reverse_engineering/ghidra/create_a_project.1647081254.txt.gz · Last modified: 2022/03/12 11:34 by kitor