Issue #95: add vendor_dlkm into known image name

pull/140/head
cfig 3 years ago
parent 0681a5e0c9
commit 68afa1834e
No known key found for this signature in database
GPG Key ID: B104C307F0FDABB7

@ -9,8 +9,8 @@ repositories {
}
dependencies {
implementation("org.bouncycastle:bcprov-jdk15on:1.68")
implementation("org.bouncycastle:bcpkix-jdk15on:1.68")
implementation("org.bouncycastle:bcprov-jdk15on:1.70")
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
}
val fatJar = task("fatJar", type = Jar::class) {

@ -35,17 +35,17 @@ dependencies {
implementation("cc.cfig:io:0.2")
implementation("ch.qos.logback:logback-classic:1.2.11")
implementation("com.fasterxml.jackson.core:jackson-annotations:2.13.1")
implementation("com.fasterxml.jackson.core:jackson-databind:2.13.1")
implementation("com.google.guava:guava:31.0.1-jre")
implementation("com.fasterxml.jackson.core:jackson-annotations:2.13.3")
implementation("com.fasterxml.jackson.core:jackson-databind:2.13.3")
implementation("com.google.guava:guava:31.1-jre")
implementation("org.apache.commons:commons-exec:1.3")
implementation("org.apache.commons:commons-compress:1.21")
implementation("org.tukaani:xz:1.9")
implementation("commons-codec:commons-codec:1.15")
implementation("junit:junit:4.13.2")
implementation("org.bouncycastle:bcprov-jdk15on:1.69")
implementation("org.bouncycastle:bcprov-jdk15on:1.70")
implementation("de.vandermeer:asciitable:0.3.2")
implementation("com.google.protobuf:protobuf-java:3.19.4")
implementation("com.google.protobuf:protobuf-java:3.21.1")
implementation(project(":helper"))
testImplementation("org.jetbrains.kotlin:kotlin-test")

@ -14,13 +14,15 @@
package cfig.utils
import avb.blob.Footer
import cc.cfig.io.Struct
import cfig.helper.Helper
import cfig.helper.Helper.Companion.check_call
import cfig.packable.IPackable
import com.fasterxml.jackson.databind.ObjectMapper
import org.slf4j.LoggerFactory
import cfig.helper.Helper.Companion.check_call
import java.io.FileInputStream
import java.io.File
import com.fasterxml.jackson.databind.ObjectMapper
import avb.blob.Footer
import java.io.FileInputStream
class SparseImgParser : IPackable {
override val loopNo: Int
@ -36,12 +38,18 @@ class SparseImgParser : IPackable {
}
override fun capabilities(): List<String> {
return listOf("^(system|system_ext|system_other|vendor|product|cache|userdata|super|oem)\\.img$")
return listOf("^(system|system_ext|system_other|vendor|product|cache|userdata|super|oem|vendor_dlkm|odm_dlkm)\\.img$")
}
override fun unpack(fileName: String) {
clear()
simg2img(fileName, "$fileName.unsparse")
if (isSparse(fileName)) {
simg2img(fileName, "$fileName.unsparse")
} else if (isExt4(fileName)) {
log.info("$fileName is raw ext4 image")
} else {
log.info("$fileName is raw image")
}
}
override fun pack(fileName: String) {
@ -84,4 +92,19 @@ class SparseImgParser : IPackable {
override fun flash(fileName: String, deviceName: String) {
TODO("not implemented")
}
private fun isSparse(fileName: String): Boolean {
val magic = Helper.Companion.readFully(fileName, 0, 4)
return Struct(">I").pack(SPARSE_MAGIC).contentEquals(magic)
}
private fun isExt4(fileName: String): Boolean {
val superBlock = Helper.readFully(fileName, 1024, 64)
val magic = byteArrayOf(superBlock[0x38], superBlock[0x39])
return Struct(">h").pack(0x53ef).contentEquals(magic)
}
companion object {
private val SPARSE_MAGIC: UInt = 0x3aff26edu
}
}

@ -34,19 +34,19 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("cc.cfig:io:0.2")
implementation("com.google.guava:guava:31.0.1-jre")
implementation("com.google.guava:guava:31.1-jre")
implementation("ch.qos.logback:logback-classic:1.2.11")
implementation("org.apache.commons:commons-exec:1.3")
implementation("org.bouncycastle:bcprov-jdk15on:1.69")
implementation("org.bouncycastle:bcpkix-jdk15on:1.69") //org.bouncycastle.pkcs
implementation("org.bouncycastle:bcprov-jdk15on:1.70")
implementation("org.bouncycastle:bcpkix-jdk15on:1.70") //org.bouncycastle.pkcs
implementation("org.apache.commons:commons-compress:1.21")
implementation("org.tukaani:xz:1.9")
implementation("com.github.freva:ascii-table:1.2.0")
testImplementation("org.jetbrains.kotlin:kotlin-test")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
testImplementation("com.fasterxml.jackson.core:jackson-annotations:2.13.1")
testImplementation("com.fasterxml.jackson.core:jackson-databind:2.13.1")
testImplementation("com.fasterxml.jackson.core:jackson-annotations:2.13.3")
testImplementation("com.fasterxml.jackson.core:jackson-databind:2.13.3")
}
tasks.withType<KotlinCompile>().all {

@ -12,7 +12,7 @@ index be7419c..a8826c9 100644
dependencies {
diff --git a/bbootimg/build.gradle.kts b/bbootimg/build.gradle.kts
index 19833eb..f3b73a6 100644
index 499fb5b..f46cbcf 100644
--- a/bbootimg/build.gradle.kts
+++ b/bbootimg/build.gradle.kts
@@ -20,7 +20,7 @@ plugins {
@ -38,18 +38,18 @@ index e133f36..7537313 100644
dependencies {
classpath("org.apache.commons:commons-exec:1.3")
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 41dfb87..931fed7 100644
index 8049c68..2e33ce8 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
+distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-7.4-bin.zip
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
+distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/helper/build.gradle.kts b/helper/build.gradle.kts
index 34b9439..2fd6e84 100644
index 8618fd9..efd102e 100644
--- a/helper/build.gradle.kts
+++ b/helper/build.gradle.kts
@@ -21,7 +21,7 @@ plugins {

Loading…
Cancel
Save