sanders: Convert libinit to init scripts

* Also set ro.product.manufacturer to motorola for camera HAL in GSIs.

Change-Id: I2c78e4837cdbd8e7f18e3c1a086978bd289a60a6
This commit is contained in:
erfanoabdi
2018-09-16 11:56:26 +00:00
committed by therootlord
parent 01c13a1de5
commit 5db228eca7
7 changed files with 54 additions and 116 deletions

View File

@@ -55,10 +55,6 @@ TARGET_NO_RPC := true
USE_DEVICE_SPECIFIC_GPS := true
BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE := $(TARGET_BOARD_PLATFORM)
# Init
TARGET_INIT_VENDOR_LIB := libinit_sanders
TARGET_RECOVERY_DEVICE_MODULES := libinit_sanders
# Kernel
BOARD_KERNEL_CMDLINE := console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=30 msm_rtb.filter=0x237
BOARD_KERNEL_CMDLINE += ehci-hcd.park=3 androidboot.bootdevice=7824900.sdhci lpm_levels.sleep_disabled=1 vmalloc=350M androidboot.selinux=permissive

View File

@@ -323,7 +323,8 @@ PRODUCT_PACKAGES += \
init.mmi.rc \
init.mmi.usb.rc \
init.qcom.rc \
init.qcom.sensors.sh
init.qcom.sensors.sh \
init.sanders.rc
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/rootdir/etc/ueventd.qcom.rc:$(TARGET_COPY_OUT_VENDOR)/ueventd.rc

View File

@@ -1,13 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := system/core/init
LOCAL_CPPFLAGS := -Wall -DANDROID_TARGET=\"$(TARGET_BOARD_PLATFORM)\"
LOCAL_SRC_FILES := init_sanders.cpp
LOCAL_MODULE := libinit_sanders
LOCAL_STATIC_LIBRARIES := \
libbase
include $(BUILD_STATIC_LIBRARY)

View File

@@ -1,98 +0,0 @@
/*
Copyright (c) 2014, 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>
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <sys/_system_properties.h>
#include <android-base/properties.h>
#include "property_service.h"
#include "vendor_init.h"
using android::base::GetProperty;
using android::init::property_set;
void property_override(char const prop[], char const value[])
{
prop_info *pi;
pi = (prop_info*) __system_property_find(prop);
if (pi)
__system_property_update(pi, value, strlen(value));
else
__system_property_add(prop, strlen(prop), value, strlen(value));
}
void property_override_dual(char const system_prop[], char const vendor_prop[],
char const value[])
{
property_override(system_prop, value);
property_override(vendor_prop, value);
}
void num_sims() {
std::string dualsim;
dualsim = GetProperty("ro.boot.dualsim", "");
property_set("ro.hw.dualsim", dualsim.c_str());
if (dualsim == "true") {
property_set("persist.radio.multisim.config", "dsds");
} else {
property_set("persist.radio.multisim.config", "");
}
}
void vendor_load_properties()
{
std::string platform = GetProperty("ro.board.platform", "");
if (platform != ANDROID_TARGET)
return;
// camera (treble)
property_override("ro.product.manufacturer", "motorola");
property_override("ro.build.product", "sanders");
property_override("ro.product.device", "sanders");
property_override("ro.product.name", "sanders_retail");
// sku
std::string sku = android::base::GetProperty("ro.boot.hardware.sku", "");
property_override_dual("ro.product.model", "ro.vendor.product.model", sku.c_str());
// rmt_storage
std::string device = GetProperty("ro.boot.device", "");
std::string radio = GetProperty("ro.boot.radio", "");
property_set("ro.hw.device", device.c_str());
property_set("ro.hw.radio", radio.c_str());
property_set("ro.hw.fps", "true");
property_set("ro.hw.imager", "12MP");
num_sims();
}

View File

@@ -51,6 +51,7 @@ LOCAL_VENDOR_MODULE := true
include $(BUILD_PREBUILT)
# Init scripts
include $(CLEAR_VARS)
LOCAL_MODULE := fstab.qcom
LOCAL_MODULE_TAGS := optional eng
@@ -82,3 +83,11 @@ LOCAL_MODULE_CLASS := ETC
LOCAL_SRC_FILES := etc/init.qcom.rc
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE := init.sanders.rc
LOCAL_MODULE_TAGS := optional eng
LOCAL_MODULE_CLASS := ETC
LOCAL_SRC_FILES := etc/init.sanders.rc
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw
include $(BUILD_PREBUILT)

View File

@@ -26,6 +26,7 @@
#
import /vendor/etc/init/hw/init.mmi.rc
import /vendor/etc/init/hw/init.sanders.rc
on early-init
mount debugfs debugfs /sys/kernel/debug

View File

@@ -0,0 +1,42 @@
# Copyright (c) 2009-2012, 2014-2018, 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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.
#
on init
setprop ro.hw.dualsim ${ro.boot.dualsim}
setprop ro.hw.device ${ro.boot.device}
setprop ro.hw.radio ${ro.boot.radio}
setprop ro.hw.fps true
setprop ro.hw.imager 13MP
setprop ro.product.manufacturer motorola
setprop ro.product.model ${ro.boot.hardware.sku}
setprop ro.product.vendor.model ${ro.boot.hardware.sku}
on property:ro.hw.dualsim=true
setprop persist.radio.multisim.config dsds
on property:ro.hw.dualsim=false
setprop persist.radio.multisim.config ""