diff --git a/abootimg/build.gradle b/abootimg/build.gradle index e6bf32a..33f9682 100644 --- a/abootimg/build.gradle +++ b/abootimg/build.gradle @@ -43,9 +43,25 @@ task repack(type: Jar, dependsOn:['build']) { } } +//call Google's 'mkbootimg' program task pack_clear(type: JavaExec, dependsOn:[':pack_ramdisk_and_gz', 'build']) { classpath = sourceSets.main.runtimeClasspath main = "cfig.bootimg.repack_with_cmd" args rootProject.outClearIMg, rootProject.rootWorkDir, rootProject.mkbootimgBin } +//call our 'mkbootimg.groovy' +task pack_clear2(type: JavaExec, dependsOn:[':pack_ramdisk_and_gz', 'mkbootimg']) { + classpath = sourceSets.main.runtimeClasspath + main = "cfig.bootimg.repack_with_cmd" + args rootProject.outClearIMg + "2" , rootProject.rootWorkDir, "java -jar build/libs/mkbootimg.jar" +} + +//directly calls engine of 'mkbootimg.groovy' from 'repack' +task pack_clear3(type: JavaExec, dependsOn: [':pack_ramdisk_and_gz', 'repack']) { + classpath = files("build/libs/repack.jar") + main = 'cfig.bootimg.repack' + maxHeapSize '512m' + args rootProject.outClearIMg + "3", rootProject.rootWorkDir +} + diff --git a/abootimg/src/main/groovy/cfig/bootimg/CArgs.groovy b/abootimg/src/main/groovy/cfig/bootimg/CArgs.groovy index d602b92..805a584 100644 --- a/abootimg/src/main/groovy/cfig/bootimg/CArgs.groovy +++ b/abootimg/src/main/groovy/cfig/bootimg/CArgs.groovy @@ -43,15 +43,15 @@ class CArgs { if (null != ramdisk) { ret.add("--ramdisk"); ret.add(ramdisk); - ret.add("--ramdisk_offset"); - ret.add("0x" + Integer.toHexString(ramdisk_offset)); } + ret.add("--ramdisk_offset"); + ret.add("0x" + Integer.toHexString(ramdisk_offset)); if (null != second) { ret.add("--second"); ret.add(second); - ret.add("--second_offset"); - ret.add("0x" + Integer.toHexString(second_offset)); } + ret.add("--second_offset"); + ret.add("0x" + Integer.toHexString(second_offset)); if (null != board) { ret.add("--board"); ret.add(board); diff --git a/abootimg/src/main/groovy/cfig/bootimg/repack_with_cmd.groovy b/abootimg/src/main/groovy/cfig/bootimg/repack_with_cmd.groovy index fca75a7..0cdc1db 100644 --- a/abootimg/src/main/groovy/cfig/bootimg/repack_with_cmd.groovy +++ b/abootimg/src/main/groovy/cfig/bootimg/repack_with_cmd.groovy @@ -24,5 +24,9 @@ if (3 != args.length) { CImgInfo aInfo = CImgInfo.fromJson(args[0], args[1]); List cmdArgs = aInfo.toCommandList(); -cmdArgs.add(0, args[2]); -Run(cmdArgs); \ No newline at end of file +int i = 0; +for (String item : args[2].split()) { + cmdArgs.add(i, item); + i++; +} +Run(cmdArgs); diff --git a/build.gradle b/build.gradle index e1de735..57b1bf2 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,6 @@ model { } } - // ---------------------------------------------------------------------------- // global // ---------------------------------------------------------------------------- @@ -110,18 +109,6 @@ task pack_ramdisk_and_gz { Task task -> } pack_ramdisk_and_gz.dependsOn('mkbootfsExecutable') -task pack_clear2(type: JavaExec, dependsOn: ['abootimg:repack', pack_ramdisk_and_gz]) { - main = 'cfig.bootimg.repack' - classpath = files("abootimg/build/libs/repack.jar") - maxHeapSize '512m' - args String.format("%s.clear2", activeImg), workdir -} - -String[] getMkbootimgArgs(String inWorkdir, String outFile) { - return "good day".split(); - //args = getMkbootimgArgs(workdir, String.format("%s.clear", activeImg)) -} - void unGnuzipFile(String compressedFile, String decompressedFile) throws IOException { byte[] buffer = new byte[1024]; try { @@ -178,7 +165,7 @@ void gnuZipFile(String compressedFile, String decompressedFile) throws IOExcepti } } -task pack(type: JavaExec, dependsOn: ['abootimg:pack_clear', 'boot_signer:jar', pack_clear2]) { +task pack(type: JavaExec, dependsOn: ['abootimg:pack_clear', 'abootimg:pack_clear2', 'abootimg:pack_clear3', 'boot_signer:jar']) { main = 'com.android.verity.BootSignature' classpath = files("boot_signer/build/libs/boot_signer.jar") maxHeapSize '512m'