From b8e985c6a29dff748a44ffc9a142c8244ae18099 Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Wed, 31 Aug 2016 13:42:11 -0500 Subject: Fix updater binary for 7.0 Note: updater is currently not backwards compatible with older trees. Maybe later... Change-Id: I3c2a5ef69cfa9005502408f7054e3096a64ba34b --- applypatch/Android.mk | 2 +- applypatch/applypatch.cpp | 8 ++++---- mtdutils/mounts.h | 8 ++++++++ mtdutils/mtdutils.h | 8 ++++++++ updater/Android.mk | 20 +++----------------- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/applypatch/Android.mk b/applypatch/Android.mk index 48eab014e..581e53aa1 100644 --- a/applypatch/Android.mk +++ b/applypatch/Android.mk @@ -34,7 +34,7 @@ LOCAL_SRC_FILES := applypatch.cpp bspatch.cpp freecache.cpp imgpatch.cpp utils.c LOCAL_MODULE := libapplypatch LOCAL_MODULE_TAGS := eng LOCAL_C_INCLUDES += bootable/recovery -LOCAL_STATIC_LIBRARIES += libbase libotafault libmtdutils libmincrypttwrp libbz libz +LOCAL_STATIC_LIBRARIES += libbase libotafault libmtdutils libcrypto_static libbz libz include $(BUILD_STATIC_LIBRARY) diff --git a/applypatch/applypatch.cpp b/applypatch/applypatch.cpp index cc2858551..c2fe11b3b 100644 --- a/applypatch/applypatch.cpp +++ b/applypatch/applypatch.cpp @@ -119,7 +119,7 @@ static int LoadPartitionContents(const char* filename, FileContents* file) { type = MTD; } else if (pieces[0] == "EMMC") { type = EMMC; - } else if (strcmp(magic, "BML") == 0) { + } else if (pieces[0] == "BML") { type = EMMC; } else { printf("LoadPartitionContents called with bad filename (%s)\n", filename); @@ -127,7 +127,7 @@ static int LoadPartitionContents(const char* filename, FileContents* file) { } const char* partition = pieces[1].c_str(); - if (strcmp(magic, "BML") == 0) { + if (pieces[0] == "BML") { if (strcmp(partition, "boot") == 0) { partition = BOARD_BML_BOOT; } else if (strcmp(partition, "recovery") == 0) { @@ -331,7 +331,7 @@ int WriteToPartition(const unsigned char* data, size_t len, const char* target) type = MTD; } else if (pieces[0] == "EMMC") { type = EMMC; - } else if (strcmp(magic, "BML") == 0) { + } else if (pieces[0] == "BML") { type = EMMC; } else { printf("WriteToPartition called with bad target (%s)\n", target); @@ -340,7 +340,7 @@ int WriteToPartition(const unsigned char* data, size_t len, const char* target) const char* partition = pieces[1].c_str(); - if (strcmp(magic, "BML") == 0) { + if (pieces[0] == "BML") { if (strcmp(partition, "boot") == 0) { partition = BOARD_BML_BOOT; } else if (strcmp(partition, "recovery") == 0) { diff --git a/mtdutils/mounts.h b/mtdutils/mounts.h index 30b2927c2..d721355b8 100644 --- a/mtdutils/mounts.h +++ b/mtdutils/mounts.h @@ -17,6 +17,10 @@ #ifndef MTDUTILS_MOUNTS_H_ #define MTDUTILS_MOUNTS_H_ +#ifdef __cplusplus +extern "C" { +#endif + typedef struct MountedVolume MountedVolume; int scan_mounted_volumes(void); @@ -30,4 +34,8 @@ int unmount_mounted_volume(const MountedVolume *volume); int remount_read_only(const MountedVolume* volume); +#ifdef __cplusplus +} +#endif + #endif // MTDUTILS_MOUNTS_H_ diff --git a/mtdutils/mtdutils.h b/mtdutils/mtdutils.h index 6cbf37eec..235cbe7ce 100644 --- a/mtdutils/mtdutils.h +++ b/mtdutils/mtdutils.h @@ -19,6 +19,10 @@ #include // for size_t, etc. +#ifdef __cplusplus +extern "C" { +#endif + typedef struct MtdPartition MtdPartition; int mtd_scan_partitions(void); @@ -58,4 +62,8 @@ struct MtdPartition { char *name; }; +#ifdef __cplusplus +} +#endif + #endif // MTDUTILS_H_ diff --git a/updater/Android.mk b/updater/Android.mk index b85fe557c..23ba592a8 100644 --- a/updater/Android.mk +++ b/updater/Android.mk @@ -33,27 +33,13 @@ LOCAL_CLANG := true LOCAL_SRC_FILES := $(updater_src_files) -LOCAL_STATIC_LIBRARIES += libfec libfec_rs libext4_utils_static libsquashfs_utils libcrypto_static +LOCAL_STATIC_LIBRARIES += libfec libfec_rs libsquashfs_utils libcrypto_static ifeq ($(TARGET_USERIMAGES_USE_EXT4), true) LOCAL_CFLAGS += -DUSE_EXT4 LOCAL_CFLAGS += -Wno-unused-parameter LOCAL_C_INCLUDES += system/extras/ext4_utils -LOCAL_STATIC_LIBRARIES += \ - libext4_utils \ - libz -ifneq ($(wildcard system/core/libmincrypt/rsa_e_3.c),) -LOCAL_STATIC_LIBRARIES = \ - libext4_utils_static \ - libsparse_static \ - libz -endif -ifneq ($(wildcard system/core/include/mincrypt/sha256.h),) -LOCAL_STATIC_LIBRARIES = \ - libext4_utils_static \ - libsparse_static \ - libz -endif +LOCAL_STATIC_LIBRARIES += libext4_utils_static libsparse_static ifneq ($(wildcard external/lz4/Android.mk),) LOCAL_STATIC_LIBRARIES += liblz4 endif @@ -62,7 +48,7 @@ endif LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_UPDATER_LIBS) $(TARGET_RECOVERY_UPDATER_EXTRA_LIBS) LOCAL_STATIC_LIBRARIES += libapplypatch libbase libotafault libedify libmtdutils libminzip libz LOCAL_STATIC_LIBRARIES += libflashutils libmmcutils libbmlutils -LOCAL_STATIC_LIBRARIES += libmincrypttwrp libbz +LOCAL_STATIC_LIBRARIES += libbz LOCAL_STATIC_LIBRARIES += libcutils liblog libc LOCAL_STATIC_LIBRARIES += libselinux -- cgit v1.2.3