Merge remote-tracking branch 'john/master' into development

This commit is contained in:
Viktor De Pasquale 2019-05-23 20:02:29 +02:00
commit aaabd836e4
5 changed files with 10 additions and 16 deletions

View File

@ -16,7 +16,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools:r8:1.4.96' classpath 'com.android.tools:r8:1.4.96'
classpath 'com.android.tools.build:gradle:3.5.0-beta01' classpath 'com.android.tools.build:gradle:3.5.0-beta02'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.31" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.31"

View File

@ -1,6 +1,6 @@
#Fri Apr 26 14:06:46 CEST 2019 #Thu May 23 01:06:46 PDT 2019
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-rc-1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

View File

@ -90,10 +90,6 @@ int boot_img::parse_file(const char *image) {
case AOSP: case AOSP:
return parse_image(head); return parse_image(head);
/* Unsupported */
case ELF32:
case ELF64:
exit(UNSUPP_RET);
default: default:
break; break;
} }
@ -345,7 +341,7 @@ int unpack(const char *image, bool hdr) {
void repack(const char* orig_image, const char* out_image) { void repack(const char* orig_image, const char* out_image) {
boot_img boot {}; boot_img boot {};
off_t header_off, kernel_off, ramdisk_off, second_off, extra_off; off_t header_off, kernel_off, ramdisk_off, second_off, extra_off, dtb_off;
// Parse original image // Parse original image
boot.parse_file(orig_image); boot.parse_file(orig_image);
@ -475,6 +471,7 @@ void repack(const char* orig_image, const char* out_image) {
} }
// dtb // dtb
dtb_off = lseek(fd, 0, SEEK_CUR);
if (access(DTB_FILE, R_OK) == 0) { if (access(DTB_FILE, R_OK) == 0) {
boot.hdr.dtb_size() = restore(DTB_FILE, fd); boot.hdr.dtb_size() = restore(DTB_FILE, fd);
file_align(); file_align();
@ -527,6 +524,11 @@ void repack(const char* orig_image, const char* out_image) {
size = boot.hdr.recovery_dtbo_size(); size = boot.hdr.recovery_dtbo_size();
HASH_update(&ctx, boot.map_addr + boot.hdr.recovery_dtbo_offset(), size); HASH_update(&ctx, boot.map_addr + boot.hdr.recovery_dtbo_offset(), size);
HASH_update(&ctx, &size, sizeof(size)); HASH_update(&ctx, &size, sizeof(size));
size = boot.hdr.dtb_size();
if (size) {
HASH_update(&ctx, boot.map_addr + dtb_off, size);
HASH_update(&ctx, &size, sizeof(size));
}
} }
memset(boot.hdr.id(), 0, 32); memset(boot.hdr.id(), 0, 32);
memcpy(boot.hdr.id(), HASH_final(&ctx), memcpy(boot.hdr.id(), HASH_final(&ctx),

View File

@ -27,10 +27,6 @@ format_t check_fmt(const void *buf, size_t len) {
return CHROMEOS; return CHROMEOS;
} else if (MATCH(BOOT_MAGIC)) { } else if (MATCH(BOOT_MAGIC)) {
return AOSP; return AOSP;
} else if (MATCH(ELF32_MAGIC)) {
return ELF32;
} else if (MATCH(ELF64_MAGIC)) {
return ELF64;
} else if (MATCH(GZIP1_MAGIC) || MATCH(GZIP2_MAGIC)) { } else if (MATCH(GZIP1_MAGIC) || MATCH(GZIP2_MAGIC)) {
return GZIP; return GZIP;
} else if (MATCH(LZOP_MAGIC)) { } else if (MATCH(LZOP_MAGIC)) {

View File

@ -8,8 +8,6 @@ typedef enum {
/* Boot formats */ /* Boot formats */
CHROMEOS, CHROMEOS,
AOSP, AOSP,
ELF32,
ELF64,
DHTB, DHTB,
BLOB, BLOB,
/* Compression formats */ /* Compression formats */
@ -29,8 +27,6 @@ typedef enum {
#define BOOT_MAGIC "ANDROID!" #define BOOT_MAGIC "ANDROID!"
#define CHROMEOS_MAGIC "CHROMEOS" #define CHROMEOS_MAGIC "CHROMEOS"
#define ELF32_MAGIC "\x7f""ELF\x01"
#define ELF64_MAGIC "\x7f""ELF\x02"
#define GZIP1_MAGIC "\x1f\x8b" #define GZIP1_MAGIC "\x1f\x8b"
#define GZIP2_MAGIC "\x1f\x9e" #define GZIP2_MAGIC "\x1f\x9e"
#define LZOP_MAGIC "\x89""LZO" #define LZOP_MAGIC "\x89""LZO"