prebuilt: allow user to move binaries to /vendor/bin/hw in ramdisk
Change-Id: Id6c17f2efcb1490d473311f3aa61ba3d652c6607
diff --git a/Android.mk b/Android.mk
index c17ddbe..4bc9ea2 100755
--- a/Android.mk
+++ b/Android.mk
@@ -415,6 +415,7 @@
TWRP_REQUIRED_MODULES += \
relink_libraries \
relink_binaries \
+ relink_vendor_hw_binaries \
twrp_ramdisk \
bc \
dump_image \
diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk
index 7a72918..bb7f89a 100755
--- a/prebuilt/Android.mk
+++ b/prebuilt/Android.mk
@@ -275,6 +275,9 @@
ifneq ($(TW_RECOVERY_ADDITIONAL_RELINK_LIBRARY_FILES),)
RECOVERY_LIBRARY_SOURCE_FILES += $(TW_RECOVERY_ADDITIONAL_RELINK_LIBRARY_FILES)
endif
+ifneq ($(TW_RECOVERY_ADDITIONAL_RELINK_VENDOR_HW_BINARY_FILES),)
+ RECOVERY_VENDOR_HW_BINARY_FILES += $(TW_RECOVERY_ADDITIONAL_RELINK_VENDOR_HW_BINARY_FILES)
+endif
ifneq ($(wildcard external/pcre/Android.mk),)
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libpcre.so
endif
@@ -383,6 +386,17 @@
LOCAL_REQUIRED_MODULES += $(TARGET_BINARY_RELINK_FILES)
include $(BUILD_PHONY_PACKAGE)
+include $(CLEAR_VARS)
+LOCAL_MODULE := relink_vendor_hw_binaries
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := EXECUTABLES
+LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/
+LOCAL_POST_INSTALL_CMD += $(RELINK) $(TARGET_RECOVERY_ROOT_OUT)/vendor/bin/hw $(RECOVERY_VENDOR_HW_BINARY_FILES)
+TARGET_VENDOR_BINARY_RELINK_FILES := $(notdir $(RECOVERY_VENDOR_HW_BINARY_FILES))
+LOCAL_REQUIRED_MODULES += $(TARGET_VENDOR_BINARY_RELINK_FILES)
+$(warning vendor_hw: $(LOCAL_POST_INSTALL_CMD))
+include $(BUILD_PHONY_PACKAGE)
+
#build out TWRP ramdisk
include $(CLEAR_VARS)
LOCAL_MODULE := twrp_ramdisk
diff --git a/prebuilt/relink.sh b/prebuilt/relink.sh
index 063f445..5917114 100755
--- a/prebuilt/relink.sh
+++ b/prebuilt/relink.sh
@@ -12,6 +12,7 @@
src=$2.tmp
fi
+ mkdir -p $1
cp $src $dst
if [[ -e $2.tmp ]]; then rm -f $2.tmp; fi
}