Skip to content

Commit

Permalink
Detect m7 variant during init
Browse files Browse the repository at this point in the history
Apply the following device names during init:
* ro.boot.mid=PN0720000 --> m7wls (Sprint)
* ro.boot.mid=PN0731000 --> m7wlv (Verizon)
* (all other cases)     --> m7 (GSM)

Change-Id: I5ae05ecb0d8c5806ddc0cf72497fc691bf0ed8c3
  • Loading branch information
mdmower committed Apr 11, 2015
1 parent 79e7e08 commit 59edc57
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 1 deletion.
7 changes: 6 additions & 1 deletion BoardConfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
15 changes: 15 additions & 0 deletions recovery/init/Android.mk
Original file line number Diff line number Diff line change
@@ -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)
58 changes: 58 additions & 0 deletions recovery/init/init_m7univ.c
Original file line number Diff line number Diff line change
@@ -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 <stdlib.h>

#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");
}
}

0 comments on commit 59edc57

Please sign in to comment.