mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-01-09 22:17:55 -05:00
GT-2897: More improvements.
This commit is contained in:
21
DevGuide.md
21
DevGuide.md
@@ -173,30 +173,29 @@ cp csframework.jar hfsx_dmglib.jar hfsx.jar iharder-base64.jar ~/flatRepo/
|
|||||||
#### Get Dependencies for GhidraServer
|
#### Get Dependencies for GhidraServer
|
||||||
|
|
||||||
Building the GhidraServer requires "Yet another Java service wrapper" (yajsw) version 12.12.
|
Building the GhidraServer requires "Yet another Java service wrapper" (yajsw) version 12.12.
|
||||||
Download `yajsw-stable-12.12.zip` from their project on www.sourceforge.net, and place it in a directory named:
|
Download `yajsw-stable-12.12.zip` from their project on www.sourceforge.net, and place it in:
|
||||||
`ghidra.bin/Ghidra/Features/GhidraServer/`. Note that `ghidra.bin` must be a sibling of `ghidra`:
|
`~/ghidra/Ghidra/Features/GhidraServer/build`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd ~/Downloads # Or wherever
|
cd ~/Downloads # Or wherever
|
||||||
curl -OL https://sourceforge.net/projects/yajsw/files/yajsw/yajsw-stable-12.12/yajsw-stable-12.12.zip
|
curl -OL https://sourceforge.net/projects/yajsw/files/yajsw/yajsw-stable-12.12/yajsw-stable-12.12.zip
|
||||||
mkdir -p ~/git/ghidra/Ghidra/Features/GhidraServer/build/data/
|
mkdir -p ~/git/ghidra/Ghidra/Features/GhidraServer/build/
|
||||||
cp ~/Downloads/yajsw-stable-12.12.zip ~/git/ghidra/Ghidra/Features/GhidraServer/build/data/
|
cp ~/Downloads/yajsw-stable-12.12.zip ~/git/ghidra/Ghidra/Features/GhidraServer/build/
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Get Dependencies for GhidraDev
|
#### Get Dependencies for GhidraDev
|
||||||
|
|
||||||
Building the GhidraDev plugin for Eclipse requires the CDT and PyDev plugins for Eclipse.
|
Building the GhidraDev plugin for Eclipse requires the CDT and PyDev plugins for Eclipse.
|
||||||
Download `cdt-8.6.0.zip` from The Eclipse Foundation, and place it in a directory named:
|
Download `cdt-8.6.0.zip` from The Eclipse Foundation, and place it in:
|
||||||
`ghidra.bin/GhidraBuild/EclipsePlugins/GhidraDev/buildDependencies/`. Note that
|
`~/git/ghidra/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/build/`:
|
||||||
`ghidra.bin` must be a sibling of `ghidra`.
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd ~/Downloads # Or wherever
|
cd ~/Downloads # Or wherever
|
||||||
curl -OL 'http://www.eclipse.org/downloads/download.php?r=1&protocol=https&file=/tools/cdt/releases/8.6/cdt-8.6.0.zip'
|
curl -OL 'http://www.eclipse.org/downloads/download.php?r=1&protocol=https&file=/tools/cdt/releases/8.6/cdt-8.6.0.zip'
|
||||||
curl -o 'cdt-8.6.0.zip.sha512' -L --retry 3 'http://www.eclipse.org/downloads/sums.php?type=sha512&file=/tools/cdt/releases/8.6/cdt-8.6.0.zip'
|
curl -o 'cdt-8.6.0.zip.sha512' -L --retry 3 'http://www.eclipse.org/downloads/sums.php?type=sha512&file=/tools/cdt/releases/8.6/cdt-8.6.0.zip'
|
||||||
sha512sum -c 'cdt-8.6.0.zip.sha512'
|
shasum -a 512 -c 'cdt-8.6.0.zip.sha512'
|
||||||
mkdir -p ~/git/ghidra.bin/GhidraBuild/EclipsePlugins/GhidraDev/buildDependencies/
|
mkdir -p ~/git/ghidra.bin/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/build/
|
||||||
cp ~/Downloads/cdt-8.6.0.zip ~/git/ghidra.bin/GhidraBuild/EclipsePlugins/GhidraDev/buildDependencies/
|
cp ~/Downloads/cdt-8.6.0.zip ~/git/ghidra/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/build/
|
||||||
```
|
```
|
||||||
|
|
||||||
Download `PyDev 6.3.1.zip` from www.pydev.org, and place it in the same directory:
|
Download `PyDev 6.3.1.zip` from www.pydev.org, and place it in the same directory:
|
||||||
@@ -204,7 +203,7 @@ Download `PyDev 6.3.1.zip` from www.pydev.org, and place it in the same director
|
|||||||
```bash
|
```bash
|
||||||
cd ~/Downloads # Or wherever
|
cd ~/Downloads # Or wherever
|
||||||
curl -OL https://sourceforge.net/projects/pydev/files/pydev/PyDev%206.3.1/PyDev%206.3.1.zip
|
curl -OL https://sourceforge.net/projects/pydev/files/pydev/PyDev%206.3.1/PyDev%206.3.1.zip
|
||||||
cp ~/Downloads/'PyDev 6.3.1.zip' ~/git/ghidra.bin/GhidraBuild/EclipsePlugins/GhidraDev/buildDependencies/
|
cp ~/Downloads/'PyDev 6.3.1.zip ~/git/ghidra/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/build/
|
||||||
```
|
```
|
||||||
|
|
||||||
## Building Ghidra
|
## Building Ghidra
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ addExports([
|
|||||||
])
|
])
|
||||||
|
|
||||||
CopySpec yajswCopySpec = copySpec {
|
CopySpec yajswCopySpec = copySpec {
|
||||||
File localFile = file("build/data/${yajswRelease}.zip")
|
File localFile = file("build/${yajswRelease}.zip")
|
||||||
File binFile = file("${BIN_REPO}/Ghidra/Features/GhidraServer/${yajswRelease}.zip")
|
File binFile = file("${BIN_REPO}/Ghidra/Features/GhidraServer/${yajswRelease}.zip")
|
||||||
|
|
||||||
// First check if the file was downloaded and dropped in locally. If not, check in the bin
|
// First check if the file was downloaded and dropped in locally. If not, check in the bin
|
||||||
|
|||||||
@@ -42,22 +42,14 @@ dependencies {
|
|||||||
compileJava.enabled = false
|
compileJava.enabled = false
|
||||||
jar.enabled = false
|
jar.enabled = false
|
||||||
|
|
||||||
File libraryJarDestDir = file("build/data")
|
|
||||||
|
|
||||||
File pyDevSourceZipFile = file("${BIN_REPO}/GhidraBuild/EclipsePlugins/GhidraDev/buildDependencies/PyDev 6.3.1.zip")
|
|
||||||
File cdtSourceZipFile = file("${BIN_REPO}/GhidraBuild/EclipsePlugins/GhidraDev/buildDependencies/cdt-8.6.0.zip")
|
|
||||||
|
|
||||||
File pyDevDestDir = file("build/data/buildDependencies/pydev")
|
|
||||||
File cdtDestDir = file("build/data/buildDependencies/cdt")
|
|
||||||
|
|
||||||
task utilityJar(type:Copy) {
|
task utilityJar(type:Copy) {
|
||||||
destinationDir libraryJarDestDir
|
destinationDir file("build/data")
|
||||||
|
|
||||||
from { project(':Utility').jar } // using closure to delay until all projects evaluated
|
from { project(':Utility').jar } // using closure to delay until all projects evaluated
|
||||||
}
|
}
|
||||||
|
|
||||||
task launchSupportJar(type:Copy) {
|
task launchSupportJar(type:Copy) {
|
||||||
destinationDir libraryJarDestDir
|
destinationDir file("build/data")
|
||||||
|
|
||||||
from { project(':LaunchSupport').jar } // using closure to delay until all projects evaluated
|
from { project(':LaunchSupport').jar } // using closure to delay until all projects evaluated
|
||||||
}
|
}
|
||||||
@@ -65,13 +57,22 @@ task launchSupportJar(type:Copy) {
|
|||||||
task pyDevUnpack(type:Copy) {
|
task pyDevUnpack(type:Copy) {
|
||||||
description "Unpack PyDev plugin archive for development use"
|
description "Unpack PyDev plugin archive for development use"
|
||||||
group "Development Preparation"
|
group "Development Preparation"
|
||||||
|
|
||||||
|
File pyDevDestDir = file("build/data/buildDependencies/pydev")
|
||||||
|
|
||||||
// Without this, the copyTask will unzip the file to check for "up to date"
|
// Without this, the copyTask will unzip the file to check for "up to date"
|
||||||
onlyIf {
|
onlyIf {
|
||||||
!pyDevDestDir.exists()
|
!pyDevDestDir.exists()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File localFile = file("build/PyDev 6.3.1.zip")
|
||||||
|
File binFile = file("${BIN_REPO}/GhidraBuild/EclipsePlugins/GhidraDev/buildDependencies/PyDev 6.3.1.zip")
|
||||||
|
|
||||||
from zipTree(pyDevSourceZipFile)
|
// First check if the file was downloaded and dropped in locally. If not, check in the bin
|
||||||
|
// repo.
|
||||||
|
def pyDevZipTree = localFile.exists() ? zipTree(localFile) : zipTree(binFile)
|
||||||
|
|
||||||
|
from pyDevZipTree
|
||||||
exclude "**/.project", "**/.pydevproject"
|
exclude "**/.project", "**/.pydevproject"
|
||||||
|
|
||||||
destinationDir pyDevDestDir
|
destinationDir pyDevDestDir
|
||||||
@@ -80,13 +81,22 @@ task pyDevUnpack(type:Copy) {
|
|||||||
task cdtUnpack(type:Copy) {
|
task cdtUnpack(type:Copy) {
|
||||||
description "Unpack CDT plugin archive for development use"
|
description "Unpack CDT plugin archive for development use"
|
||||||
group "Development Preparation"
|
group "Development Preparation"
|
||||||
|
|
||||||
|
File cdtDestDir = file("build/data/buildDependencies/cdt")
|
||||||
|
|
||||||
// Without this, the copyTask will unzip the file to check for "up to date"
|
// Without this, the copyTask will unzip the file to check for "up to date"
|
||||||
onlyIf {
|
onlyIf {
|
||||||
!cdtDestDir.exists()
|
!cdtDestDir.exists()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File localFile = file("build/cdt-8.6.0.zip")
|
||||||
|
File binFile = file("${BIN_REPO}/GhidraBuild/EclipsePlugins/GhidraDev/buildDependencies/cdt-8.6.0.zip")
|
||||||
|
|
||||||
from zipTree(cdtSourceZipFile)
|
// First check if the file was downloaded and dropped in locally. If not, check in the bin
|
||||||
|
// repo.
|
||||||
|
def cdtZipTree = localFile.exists() ? zipTree(localFile) : zipTree(binFile)
|
||||||
|
|
||||||
|
from cdtZipTree
|
||||||
|
|
||||||
destinationDir cdtDestDir
|
destinationDir cdtDestDir
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ ext.AXML_MD5 = '55d70be9862c2b456cc91a933c197934'
|
|||||||
ext.HFS_MD5 = 'cc1713d634d2cd1fd7f21e18ae4d5d5c'
|
ext.HFS_MD5 = 'cc1713d634d2cd1fd7f21e18ae4d5d5c'
|
||||||
ext.YAJSW_MD5 = 'e490ea92554f0238d74d4ef6161cb2c7'
|
ext.YAJSW_MD5 = 'e490ea92554f0238d74d4ef6161cb2c7'
|
||||||
ext.PYDEV_MD5 = '06263bdef4917c49d8d977d12c2d5073'
|
ext.PYDEV_MD5 = '06263bdef4917c49d8d977d12c2d5073'
|
||||||
ext.CDT_MD5 = 'd41d8cd98f00b204e9800998ecf8427e'
|
ext.CDT_MD5 = '8e9438a6e3947d614af98e1b58e945a2'
|
||||||
|
|
||||||
// Number of times to try and establish a connection when downloading files before
|
// Number of times to try and establish a connection when downloading files before
|
||||||
// failing
|
// failing
|
||||||
@@ -123,11 +123,11 @@ def createConfigFile() {
|
|||||||
|
|
||||||
repoConfigFile.write("ext.HOME = System.getProperty('user.home')")
|
repoConfigFile.write("ext.HOME = System.getProperty('user.home')")
|
||||||
repoConfigFile.append("\nallprojects {")
|
repoConfigFile.append("\nallprojects {")
|
||||||
repoConfigFile.append("\nrepositories {")
|
repoConfigFile.append("\n\trepositories {")
|
||||||
repoConfigFile.append("\nmavenCentral()")
|
repoConfigFile.append("\n\t\tmavenCentral()")
|
||||||
repoConfigFile.append("\njcenter()")
|
repoConfigFile.append("\n\t\tjcenter()")
|
||||||
repoConfigFile.append('\nflatDir name: "flat", dirs:["$HOME/flatRepo"]')
|
repoConfigFile.append('\n\t\tflatDir name: "flat", dirs:["$HOME/flatRepo"]')
|
||||||
repoConfigFile.append("\n}")
|
repoConfigFile.append("\n\t}")
|
||||||
repoConfigFile.append("\n}")
|
repoConfigFile.append("\n}")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,46 +237,40 @@ def populateFlatRepo() {
|
|||||||
|
|
||||||
// 1. Download all the dependencies and verify their checksums. If the dependency has already
|
// 1. Download all the dependencies and verify their checksums. If the dependency has already
|
||||||
// been download, do NOT download again.
|
// been download, do NOT download again.
|
||||||
File file = new File(DOWNLOADS_DIR.path, '/dex-tools-2.0.zip')
|
File file = new File(DOWNLOADS_DIR, 'dex-tools-2.0.zip')
|
||||||
def checksum = generateChecksum(file)
|
if (!DEX_MD5.equals(generateChecksum(file))) {
|
||||||
if (!(file.exists() && (checksum.equals(DEX_MD5)))) {
|
|
||||||
download (DEX_ZIP, file.path)
|
download (DEX_ZIP, file.path)
|
||||||
validateChecksum(checksum, DEX_MD5);
|
validateChecksum(generateChecksum(file), DEX_MD5);
|
||||||
}
|
}
|
||||||
|
|
||||||
file = new File(FLAT_REPO_DIR.path + '/AXMLPrinter2.jar')
|
file = new File(DOWNLOADS_DIR, 'AXMLPrinter2.jar')
|
||||||
checksum = generateChecksum(file)
|
if (!AXML_MD5.equals(generateChecksum(file))) {
|
||||||
if (!(file.exists() && (checksum.equals(AXML_MD5)))) {
|
|
||||||
download (AXML_ZIP, file.path)
|
download (AXML_ZIP, file.path)
|
||||||
validateChecksum(checksum, AXML_MD5);
|
validateChecksum(generateChecksum(file), AXML_MD5);
|
||||||
}
|
}
|
||||||
|
|
||||||
file = new File(DOWNLOADS_DIR.path + '/hfsexplorer-0_21-bin.zip')
|
file = new File(DOWNLOADS_DIR, 'hfsexplorer-0_21-bin.zip')
|
||||||
checksum = generateChecksum(file)
|
if (!HFS_MD5.equals(generateChecksum(file))) {
|
||||||
if (!(file.exists() && (checksum.equals(HFS_MD5)))) {
|
|
||||||
download (HFS_ZIP, file.path)
|
download (HFS_ZIP, file.path)
|
||||||
validateChecksum(checksum, HFS_MD5);
|
validateChecksum(generateChecksum(file), HFS_MD5);
|
||||||
}
|
}
|
||||||
|
|
||||||
file = new File(DOWNLOADS_DIR.path + '/yajsw-stable-12.12.zip')
|
file = new File(DOWNLOADS_DIR, 'yajsw-stable-12.12.zip')
|
||||||
checksum = generateChecksum(file)
|
if (!YAJSW_MD5.equals(generateChecksum(file))) {
|
||||||
if (!(file.exists() && (checksum.equals(YAJSW_MD5)))) {
|
|
||||||
download (YAJSW_ZIP, file.path)
|
download (YAJSW_ZIP, file.path)
|
||||||
validateChecksum(checksum, YAJSW_MD5);
|
validateChecksum(generateChecksum(file), YAJSW_MD5);
|
||||||
}
|
}
|
||||||
|
|
||||||
file = new File(DOWNLOADS_DIR.path + "/PyDev 6.3.1.zip")
|
file = new File(DOWNLOADS_DIR, 'PyDev 6.3.1.zip')
|
||||||
checksum = generateChecksum(file)
|
if (!PYDEV_MD5.equals(generateChecksum(file))) {
|
||||||
if (!(file.exists() && (checksum.equals(PYDEV_MD5)))) {
|
|
||||||
download (PYDEV_ZIP, file.path)
|
download (PYDEV_ZIP, file.path)
|
||||||
validateChecksum(checksum, PYDEV_MD5);
|
validateChecksum(generateChecksum(file), PYDEV_MD5);
|
||||||
}
|
}
|
||||||
|
|
||||||
file = new File(DOWNLOADS_DIR.path + '/cdt-8.6.0.zip')
|
file = new File(DOWNLOADS_DIR, 'cdt-8.6.0.zip')
|
||||||
checksum = generateChecksum(file)
|
if (!CDT_MD5.equals(generateChecksum(file))) {
|
||||||
if (!(file.exists() && (checksum.equals(CDT_MD5)))) {
|
|
||||||
download (CDT_ZIP, file.path)
|
download (CDT_ZIP, file.path)
|
||||||
validateChecksum(checksum, CDT_MD5);
|
validateChecksum(generateChecksum(file), CDT_MD5);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Unzip the dependencies
|
// 2. Unzip the dependencies
|
||||||
@@ -286,6 +280,7 @@ def populateFlatRepo() {
|
|||||||
// 3. Copy the necessary jars to the flatRepo directory. Yajsw, CDT, and PyDev go directly into
|
// 3. Copy the necessary jars to the flatRepo directory. Yajsw, CDT, and PyDev go directly into
|
||||||
// the source repository.
|
// the source repository.
|
||||||
copyDexTools()
|
copyDexTools()
|
||||||
|
copyAXML()
|
||||||
copyHfsx()
|
copyHfsx()
|
||||||
copyYajsw()
|
copyYajsw()
|
||||||
copyPyDev()
|
copyPyDev()
|
||||||
@@ -300,7 +295,7 @@ def populateFlatRepo() {
|
|||||||
*/
|
*/
|
||||||
def generateChecksum(file) {
|
def generateChecksum(file) {
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
return
|
return null
|
||||||
}
|
}
|
||||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||||
md.update(Files.readAllBytes(Paths.get(file.path)));
|
md.update(Files.readAllBytes(Paths.get(file.path)));
|
||||||
@@ -340,6 +335,13 @@ def copyDexTools() {
|
|||||||
FileUtils.copyDirectory(new File(DOWNLOADS_DIR, 'dex2jar-2.0/lib/'), FLAT_REPO_DIR, new WildcardFileFilter("dex-*"));
|
FileUtils.copyDirectory(new File(DOWNLOADS_DIR, 'dex2jar-2.0/lib/'), FLAT_REPO_DIR, new WildcardFileFilter("dex-*"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies the AXMLPrinter2 jar to the flat repository
|
||||||
|
*/
|
||||||
|
def copyAXML() {
|
||||||
|
FileUtils.copyFile(new File(DOWNLOADS_DIR, 'AXMLPrinter2.jar'), new File(FLAT_REPO_DIR, "AXMLPrinter2.jar"));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copies the necessary hfsx jars to the flat repository
|
* Copies the necessary hfsx jars to the flat repository
|
||||||
*/
|
*/
|
||||||
@@ -354,21 +356,21 @@ def copyHfsx() {
|
|||||||
* Copies the yajswdir zip to its location in the GhidraServer project.
|
* Copies the yajswdir zip to its location in the GhidraServer project.
|
||||||
*/
|
*/
|
||||||
def copyYajsw() {
|
def copyYajsw() {
|
||||||
FileUtils.copyFile(new File(DOWNLOADS_DIR, "yajsw-stable-12.12.zip"), new File(REPO_DIR, "Ghidra/Features/GhidraServer/build/data/yajsw-stable-12.12.zip"));
|
FileUtils.copyFile(new File(DOWNLOADS_DIR, "yajsw-stable-12.12.zip"), new File(REPO_DIR, "Ghidra/Features/GhidraServer/build/yajsw-stable-12.12.zip"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copies the pydev zip to its bin repository location
|
* Copies the pydev zip to its bin repository location
|
||||||
*/
|
*/
|
||||||
def copyPyDev() {
|
def copyPyDev() {
|
||||||
FileUtils.copyFile(new File(DOWNLOADS_DIR, 'PyDev 6.3.1.zip'), new File(REPO_DIR, "GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/build/data/buildDependencies/PyDev 6.3.1.zip"));
|
FileUtils.copyFile(new File(DOWNLOADS_DIR, 'PyDev 6.3.1.zip'), new File(REPO_DIR, "GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/build/PyDev 6.3.1.zip"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copies the cdt zip to its bin repository location
|
* Copies the cdt zip to its bin repository location
|
||||||
*/
|
*/
|
||||||
def copyCdt() {
|
def copyCdt() {
|
||||||
FileUtils.copyFile(new File(DOWNLOADS_DIR, 'cdt-8.6.0.zip'), new File(REPO_DIR, "GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/build/data/buildDependencies/cdt-8.6.0.zip"));
|
FileUtils.copyFile(new File(DOWNLOADS_DIR, 'cdt-8.6.0.zip'), new File(REPO_DIR, "GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/build/cdt-8.6.0.zip"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user