Skip to content

Commit

Permalink
Initialize repository for Galaxy S7 edge (China)
Browse files Browse the repository at this point in the history
Change-Id: I0857e2d5285f9074a3ce53c21e165eb34cd03179
  • Loading branch information
jcadduono committed Sep 9, 2016
0 parents commit f16b61c
Show file tree
Hide file tree
Showing 17 changed files with 2,632 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# Copyright 2012 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# This contains the module build definitions for the hardware-specific
# components for this device.
#
# As much as possible, those components should be built unconditionally,
# with device-specific names to avoid collisions, to avoid device-specific
# bitrot and build breakages. Building a component unconditionally does
# *not* include it on all devices, so it is safe even with hardware-specific
# components.

ifneq ($(filter hero2qltechn,$(TARGET_DEVICE)),)

LOCAL_PATH := $(call my-dir)

include $(call all-makefiles-under,$(LOCAL_PATH))

endif
1 change: 1 addition & 0 deletions AndroidProducts.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PRODUCT_MAKEFILES := $(LOCAL_DIR)/omni_hero2qltechn.mk
97 changes: 97 additions & 0 deletions BoardConfig.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
DEVICE_TREE := device/samsung/hero2qltechn

# Bootloader
TARGET_NO_BOOTLOADER := true
TARGET_BOOTLOADER_BOARD_NAME := msm8996

# Platform
TARGET_BOARD_PLATFORM := msm8996
TARGET_BOARD_PLATFORM_GPU := qcom-adreno530
TARGET_PLATFORM_DEVICE_BASE := /devices/soc/

# Flags
#TARGET_GLOBAL_CFLAGS +=
#TARGET_GLOBAL_CPPFLAGS +=
#COMMON_GLOBAL_CFLAGS +=

# Architecture
TARGET_ARCH := arm64
TARGET_ARCH_VARIANT := armv8-a
TARGET_CPU_ABI := arm64-v8a
TARGET_CPU_ABI2 :=
TARGET_CPU_VARIANT := kryo
TARGET_CPU_SMP := true

TARGET_2ND_ARCH := arm
TARGET_2ND_ARCH_VARIANT := armv7-a-neon
TARGET_2ND_CPU_ABI := armeabi-v7a
TARGET_2ND_CPU_ABI2 := armeabi
TARGET_2ND_CPU_VARIANT := cortex-a53

# Kernel
#TARGET_KERNEL_SOURCE := kernel/samsung/msm8996
TARGET_KERNEL_ARCH := arm64
TARGET_KERNEL_HEADER_ARCH := arm64
TARGET_KERNEL_CONFIG := twrp_defconfig
TARGET_KERNEL_DEVICE_DEFCONFIG := device_hero2qlte_chnzc

TARGET_PREBUILT_KERNEL := $(DEVICE_TREE)/Image.gz
TARGET_PREBUILT_DTB := $(DEVICE_TREE)/dtb.img

# Boot image
BOARD_KERNEL_CMDLINE := console=null androidboot.hardware=qcom androidboot.bootdevice=624000.ufshc androidboot.selinux=permissive user_debug=31 msm_rtb.filter=0x37 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 cma=24M@0-0xffffffff rcupdate.rcu_expedited=1
BOARD_KERNEL_BASE := 0x80000000
BOARD_KERNEL_PAGESIZE := 4096
# 000RU = recovery kernel, 000KU = system kernel
BOARD_MKBOOTIMG_ARGS := --kernel_offset 0x00008000 --ramdisk_offset 0x02200000 --tags_offset 0x02000000 --board RILPA14A000RU
BOARD_CUSTOM_BOOTIMG_MK := $(DEVICE_TREE)/bootimg.mk

# Partitions
BOARD_BOOTIMAGE_PARTITION_SIZE := 0x004C00000
BOARD_RECOVERYIMAGE_PARTITION_SIZE := 0x004C00000
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 0x14E600000
BOARD_USERDATAIMAGE_PARTITION_SIZE := 0x64BFFC000 # 0x64C000000 - 16384 (footer)
BOARD_CACHEIMAGE_PARTITION_SIZE := 0x012C00000
BOARD_FLASH_BLOCK_SIZE := 0x40000

# File systems
BOARD_HAS_LARGE_FILESYSTEM := true
TARGET_USERIMAGES_USE_EXT4 := true
TARGET_USERIMAGES_USE_F2FS := true

# TWRP specific build flags
TW_THEME := portrait_hdpi
RECOVERY_SDCARD_ON_DATA := true
TARGET_RECOVERY_QCOM_RTC_FIX := true
TARGET_RECOVERY_PIXEL_FORMAT := "RGBX_8888"
TARGET_USE_CUSTOM_LUN_FILE_PATH := "/sys/devices/soc/6a00000.ssusb/6a00000.dwc3/gadget/lun%d/file"
TW_BRIGHTNESS_PATH := "/sys/devices/soc/900000.qcom\x2cmdss_mdp/900000.qcom\x2cmdss_mdp:qcom\x2cmdss_fb_primary/leds/lcd-backlight/brightness"
TW_MAX_BRIGHTNESS := 255
TW_DEFAULT_BRIGHTNESS := 162
TW_NO_REBOOT_BOOTLOADER := true
TW_HAS_DOWNLOAD_MODE := true
TW_INCLUDE_NTFS_3G := true
# exFAT drivers included in the kernel
TW_NO_EXFAT_FUSE := true
# No love for the wicked (device ships with M)
TW_EXCLUDE_SUPERSU := true

# Encryption support
TW_INCLUDE_CRYPTO := true
# Disable Qualcomm and Samsung encryption as we are missing msm8996 keystore support
#TW_INCLUDE_CRYPTO_SAMSUNG := true
#TARGET_HW_DISK_ENCRYPTION := true
#TARGET_KEYMASTER_WAIT_FOR_QSEE := true

# Asian region languages
TW_EXTRA_LANGUAGES := true

# Debug flags
#TWRP_INCLUDE_LOGCAT := true
#TARGET_USES_LOGD := true

# Init properties from bootloader version, ex. model info
TARGET_UNIFIED_DEVICE := true
TARGET_INIT_VENDOR_LIB := libinit_hero2qltechn
TARGET_RECOVERY_DEVICE_MODULES := libinit_hero2qltechn
TARGET_LIBINIT_DEFINES_FILE := $(DEVICE_TREE)/init/init_hero2qltechn.cpp
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## TWRP device tree for Galaxy S7 edge (China Qualcomm)

This comment has been minimized.

Copy link
@ronaldinzkie

ronaldinzkie Apr 27, 2019

android_device_samsung_hero2qltechn/recovery/root/prebuilt_file_contexts


Add to `.repo/local_manifests/hero2qltechn.xml`:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project path="device/samsung/hero2qltechn" name="android_device_samsung_hero2qltechn" remote="TeamWin" revision="android-6.0" />
</manifest>
```

Then run `repo sync` to check it out.

To build:

```sh
. build/envsetup.sh
lunch omni_hero2qltechn-eng
make -j5 recoveryimage
```

Kernel sources are available at: https://github.com/jcadduono/android_kernel_samsung_msm8996/tree/twrp-6.0
17 changes: 17 additions & 0 deletions bootimg.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
LOCAL_PATH := $(call my-dir)

FLASH_IMAGE_TARGET ?= $(PRODUCT_OUT)/recovery.tar

ifdef TARGET_PREBUILT_DTB
BOARD_MKBOOTIMG_ARGS += --dt $(TARGET_PREBUILT_DTB)
endif

$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_DTIMAGE_TARGET) $(recovery_kernel) $(recovery_ramdisk)
@echo -e ${CL_GRN}"----- Making recovery image ------"${CL_RST}
$(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@ --ramdisk $(recovery_ramdisk)
@echo -e ${CL_CYN}"Made recovery image: $@"${CL_RST}
@echo -e ${CL_GRN}"----- Lying about SEAndroid state to Samsung bootloader ------"${CL_RST}
$(hide) echo -n "SEANDROIDENFORCE" >> $(INSTALLED_RECOVERYIMAGE_TARGET)
$(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw)
$(hide) tar -C $(PRODUCT_OUT) -H ustar -c recovery.img > $(FLASH_IMAGE_TARGET)
@echo -e ${CL_CYN}"Made Odin flashable recovery tar: ${FLASH_IMAGE_TARGET}"${CL_RST}
9 changes: 9 additions & 0 deletions init/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := system/core/init
LOCAL_CFLAGS := -Wall
LOCAL_SRC_FILES := init_hero2qltechn.cpp
LOCAL_MODULE := libinit_hero2qltechn
include $(BUILD_STATIC_LIBRARY)
51 changes: 51 additions & 0 deletions init/init_hero2qltechn.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
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 "util.h"

void vendor_load_properties()
{
char bootloader[PROP_VALUE_MAX];

property_get("ro.bootloader", bootloader);

if (strstr(bootloader, "G9350ZH")) {
/* Hong Kong */
property_set("ro.product.name", "hero2qltezh");
} else {
/* all other variants become China Open */
property_set("ro.product.name", "hero2qltezc");
}
property_set("ro.product.model", "SM-G9350");
property_set("ro.product.device", "hero2qltechn");
}
2 changes: 2 additions & 0 deletions omni.dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[
]
19 changes: 19 additions & 0 deletions omni_hero2qltechn.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Release name
PRODUCT_RELEASE_NAME := hero2qltechn

# Inherit from the common Open Source product configuration
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)

# Inherit from our custom product configuration
$(call inherit-product, vendor/omni/config/common.mk)

PRODUCT_PACKAGES += \
charger_res_images \
charger

## Device identifier. This must come after all inclusions
PRODUCT_DEVICE := hero2qltechn
PRODUCT_MODEL := SM-G9350
PRODUCT_NAME := omni_hero2qltechn
PRODUCT_BRAND := samsung
PRODUCT_MANUFACTURER := samsung
11 changes: 11 additions & 0 deletions recovery.fstab
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#/firmware vfat /dev/block/bootdevice/by-name/apnhlos flags=mounttodecrypt;fsflags=ro,context=u:object_r:firmware_file:s0
/boot emmc /dev/block/bootdevice/by-name/boot
/recovery emmc /dev/block/bootdevice/by-name/recovery flags=backup=1
/system ext4 /dev/block/bootdevice/by-name/system
/data ext4 /dev/block/bootdevice/by-name/userdata flags=encryptable=footer;length=-16384
/cache ext4 /dev/block/bootdevice/by-name/cache
/efs ext4 /dev/block/bootdevice/by-name/efs flags=backup=1;display="EFS"
/modemst1 emmc /dev/block/bootdevice/by-name/modemst1 flags=backup=1;subpartitionof=/efs
/modemst2 emmc /dev/block/bootdevice/by-name/modemst2 flags=backup=1;subpartitionof=/efs
/external_sd vfat /dev/block/mmcblk0p1 /dev/block/mmcblk0 flags=display="Micro SDcard";storage;wipeingui;removable;encryptable=footer;length=-16384
/usb-otg vfat /dev/block/sde1 /dev/block/sde flags=display="USB-OTG";storage;wipeingui;removable
16 changes: 16 additions & 0 deletions recovery/root/fstab.qcom
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Android fstab file.
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK

#TODO: Add 'check' as fs_mgr_flags with data partition.
# Currently we dont have e2fsck compiled. So fs check would failed.

#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
/dev/block/bootdevice/by-name/system /system ext4 ro,errors=panic,noload wait
/dev/block/bootdevice/by-name/userdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc,discard,journal_async_commit,data=ordered,errors=panic wait,check,encryptable=footer
/dev/block/bootdevice/by-name/efs /efs ext4 noatime,nosuid,nodev,noauto_da_alloc,discard,journal_async_commit,data=ordered,errors=panic wait,check

# VOLD
/dev/block/bootdevice/by-name/hidden /preload ext4 defaults voldmanaged=preload:auto
/devices/soc/74a4900.sdhci/mmc_host/mmc* auto vfat defaults voldmanaged=sdcard:auto
/devices/soc/6a00000.ssusb/6a00000.dwc3/xhci-hcd.0.auto/usb* auto auto defaults voldmanaged=usb:auto
16 changes: 16 additions & 0 deletions recovery/root/init.recovery.qcom.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# encryption support
on init
chmod 0660 /dev/qseecom
chown system drmrpc /dev/qseecom
chmod 0664 /dev/ion
chown system system /dev/ion

#service qseecomd /sbin/qseecomd
# class core
# disabled
# user root
# group root system drmrpc
# seclabel u:r:recovery:s0

#on property:ro.crypto.state=encrypted
# start qseecomd
68 changes: 68 additions & 0 deletions recovery/root/init.recovery.usb.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
on init
chown system system /sys/class/android_usb/android0/terminal_version
chmod 0660 /sys/class/android_usb/android0/terminal_version
chown system system /sys/devices/soc/6a00000.ssusb/6a00000.dwc3/gadget/lun0/file
chmod 0660 /sys/devices/soc/6a00000.ssusb/6a00000.dwc3/gadget/lun0/file

write /sys/class/android_usb/android0/iSerial ${ro.serialno}
write /sys/class/android_usb/android0/f_rndis/manufacturer Samsung
write /sys/class/android_usb/android0/f_rndis/vendorID 04E8
write /sys/class/android_usb/android0/f_rndis/wceis 1
write /sys/class/android_usb/android0/f_ffs/aliases adb
write /sys/class/android_usb/android0/functions mtp,adb

# set up the usb mass storage lun
write /sys/devices/soc/6a00000.ssusb/6a00000.dwc3/gadget/lun0/cdrom 0
write /sys/devices/soc/6a00000.ssusb/6a00000.dwc3/gadget/lun0/nofua 0
write /sys/devices/soc/6a00000.ssusb/6a00000.dwc3/gadget/lun0/ro 0

on boot
setprop sys.usb.config none

write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer}
write /sys/class/android_usb/android0/iProduct ${ro.product.model}
write /sys/class/android_usb/android0/iSerial ${ro.serialno}
write /sys/class/android_usb/android0/bDeviceClass 0
write /sys/class/android_usb/android0/bDeviceSubClass 0
write /sys/class/android_usb/android0/bDeviceProtocol 0
write /sys/class/android_usb/f_mass_storage/inquiry_string "Samsung"

setprop sys.usb.config ${persist.sys.usb.config}

on property:sys.usb.config=none
stop adbd
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 04E8
write /sys/class/android_usb/android0/idProduct 685E
write /sys/class/android_usb/android0/bDeviceClass 0
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=adb
stop adbd
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 04E8
write /sys/class/android_usb/android0/idProduct 685E
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable ${service.adb.root}
start adbd
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=mtp,adb
stop adbd
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 04E8
write /sys/class/android_usb/android0/idProduct 6860
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable 1
start adbd
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=mass_storage,adb
stop adbd
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 04E8
write /sys/class/android_usb/android0/idProduct 685E
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable 1
start adbd
setprop sys.usb.state ${sys.usb.config}
Loading

0 comments on commit f16b61c

Please sign in to comment.