diff --git a/BoardConfig.mk b/BoardConfig.mk index a71d2e0..826a789 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -88,6 +88,11 @@ BOARD_SEPOLICY_UNION += \ akmd.te \ cir_fw_update.te +# Vendor Init +TARGET_UNIFIED_DEVICE := true +TARGET_INIT_VENDOR_LIB := libinit_m7univ +TARGET_LIBINIT_DEFINES_FILE := device/htc/fireball/init/init_m7univ.c + # TWRP TW_THEME := portrait_hdpi TARGET_RECOVERY_PIXEL_FORMAT := "RGBX_8888" @@ -96,7 +101,7 @@ TW_BRIGHTNESS_PATH := "/sys/class/leds/lcd-backlight/brightness" TW_INCLUDE_CRYPTO := true BOARD_RECOVERY_BLDRMSG_OFFSET := 2048 RECOVERY_VARIANT := twrp -TARGET_RECOVERY_DEVICE_MODULES := chargeled +TARGET_RECOVERY_DEVICE_MODULES := chargeled libinit_m7univ RECOVERY_SDCARD_ON_DATA := true BOARD_HAS_NO_REAL_SDCARD := true TW_NO_USB_STORAGE := true diff --git a/recovery/init/Android.mk b/recovery/init/Android.mk new file mode 100644 index 0000000..34596b8 --- /dev/null +++ b/recovery/init/Android.mk @@ -0,0 +1,15 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_C_INCLUDES := system/core/init + +LOCAL_CFLAGS := \ + -Wall \ + -DANDROID_TARGET=\"$(TARGET_BOARD_PLATFORM)\" + +LOCAL_SRC_FILES := init_m7univ.c + +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE := libinit_m7univ +include $(BUILD_STATIC_LIBRARY) diff --git a/recovery/init/init_m7univ.c b/recovery/init/init_m7univ.c new file mode 100644 index 0000000..14985a1 --- /dev/null +++ b/recovery/init/init_m7univ.c @@ -0,0 +1,58 @@ +/* + Copyright (c) 2013, The Linux Foundation. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of The Linux Foundation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "vendor_init.h" +#include "property_service.h" +#include "log.h" +#include "util.h" + +void vendor_load_properties() { + char platform[PROP_VALUE_MAX]; + char bootmid[PROP_VALUE_MAX]; + int rc; + + rc = property_get("ro.board.platform", platform); + if (!rc || strncmp(platform, ANDROID_TARGET, PROP_VALUE_MAX)) + return; + + property_get("ro.boot.mid", bootmid); + + if (strstr(bootmid, "PN0720000")) { + property_set("ro.product.device", "m7wls"); + property_set("ro.build.product", "m7wls"); + } else if (strstr(bootmid, "PN0731000")) { + property_set("ro.product.device", "m7wlv"); + property_set("ro.build.product", "m7wlv"); + } else { + property_set("ro.product.device", "m7"); + property_set("ro.build.product", "m7"); + } +}