Skip to content

Commit

Permalink
Edit kernel to fit partition size, add some files just in case, and j…
Browse files Browse the repository at this point in the history
…ust add some strings to make mtp and adb work, however it does not work yet.
  • Loading branch information
HexagonWin committed May 30, 2021
1 parent d2e615d commit 6762452
Show file tree
Hide file tree
Showing 15 changed files with 2,273 additions and 131 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ This branch is for building TWRP Recovery only.
Functions
=============
Working : Brightness change, touch, backup, install, adb sideload
Not work : vibrator, f2fs, adb logcat/shell etc adb function, mtp, Currently the created image is so big to fit the partition size.
Not work : vibrator, f2fs, adb logcat/shell etc adb function, mtp

Credits to : AdrianDC (Original works for sony blue family devices), gabrielgagz (custom mkbootimg.mk), 축구천재 (from SDA), 남생이 (from SDA), Alteration (from SDA), 985hPaKicK, hiru (rlawoehd187), PANTECH CORP!
2 changes: 1 addition & 1 deletion ef44/BoardConfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ TW_CRYPTO_FS_TYPE := "ext4"
TW_CRYPTO_KEY_LOC := "footer"
TW_CRYPTO_MNT_POINT := "/data"
TW_CRYPTO_REAL_BLKDEV := "/dev/block/platform/msm_sdcc.1/by-name/Userdata"
TW_DEFAULT_BRIGHTNESS := 51
TW_DEFAULT_BRIGHTNESS := 200
TW_EXCLUDE_SUPERSU := true
TW_EXTERNAL_STORAGE_PATH := "/external_sd"
TW_EXTERNAL_STORAGE_MOUNT_POINT := "external_sd"
Expand Down
3 changes: 3 additions & 0 deletions ef44/omni_ef44.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ $(call inherit-product, device/pantech/ef44/ef44.mk)

PRODUCT_BUILD_PROP_OVERRIDES += PRODUCT_NAME=SKY_IM-A840S BUILD_FINGERPRINT=SKY/SKY_IM-A840S/IM-A840S:4.0.4/IMM76I/IM-A840S.003:user/release-keys PRIVATE_BUILD_DESC="msm8960-user 4.0.4 IMM76I IM-A840S.003 release-keys" BUILD_NUMBER=IM-A840S.003

PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
persist.sys.usb.config=mtp

TARGET_SCREEN_HEIGHT := 1280
TARGET_SCREEN_WIDTH := 720

Expand Down
Binary file modified ef44/prebuilts/kernel
100644 → 100755
Binary file not shown.
98 changes: 98 additions & 0 deletions ef44/rootdir/init.pantech.usb.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# pantech usb composition
on usb-charging-mode
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/f_diag/clients diag
write /sys/class/android_usb/android0/f_serial/transports smd
write /sys/class/android_usb/android0/functions serial,diag
write /sys/devices/platform/android_usb/factory_mode 0
write /sys/devices/platform/android_usb/usb_charging_mode serial,diag
write /sys/class/android_usb/android0/enable 1

# adb
on property:sys.usb.config=serial,diag,obex
write /sys/class/android_usb/android0/functions $sys.usb.config
setprop sys.usb.state $sys.usb.config
setprop persist.pantech.usb.current pc_mode
setprop persist.pantech.usb.default pc_mode

on property:sys.usb.config=serial,diag,obex,adb
write /sys/class/android_usb/android0/functions $sys.usb.config
setprop sys.usb.state $sys.usb.config
setprop persist.pantech.usb.current pc_mode
setprop persist.pantech.usb.default pc_mode

# mtp
on property:sys.usb.config=mtp
write /sys/class/android_usb/android0/functions $sys.usb.config
setprop sys.usb.state $sys.usb.config
setprop persist.pantech.usb.current mtp_mode
setprop persist.pantech.usb.default mtp_mode

on property:sys.usb.config=mtp,adb
write /sys/class/android_usb/android0/functions $sys.usb.config
setprop sys.usb.state $sys.usb.config
setprop persist.pantech.usb.current mtp_mode
setprop persist.pantech.usb.default mtp_mode

# ptp
on property:sys.usb.config=ptp
write /sys/class/android_usb/android0/functions $sys.usb.config
setprop sys.usb.state $sys.usb.config
setprop persist.pantech.usb.current ptp_mode
setprop persist.pantech.usb.default ptp_mode

on property:sys.usb.config=ptp,adb
write /sys/class/android_usb/android0/functions $sys.usb.config
setprop sys.usb.state $sys.usb.config
setprop persist.pantech.usb.current ptp_mode
setprop persist.pantech.usb.default ptp_mode

# mass_storage
on property:sys.usb.config=mass_storage
write /sys/class/android_usb/android0/functions $sys.usb.config
setprop sys.usb.state $sys.usb.config
setprop persist.pantech.usb.current ums_mode
setprop persist.pantech.usb.default ums_mode

on property:sys.usb.config=mass_storage,adb
write /sys/class/android_usb/android0/functions $sys.usb.config
setprop sys.usb.state $sys.usb.config
setprop persist.pantech.usb.current ums_mode
setprop persist.pantech.usb.default ums_mode

# usb tethering
on property:sys.usb.config=rndis
stop adbd
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 10a9
write /sys/class/android_usb/android0/idProduct 1104
write /sys/class/android_usb/android0/bDeviceClass 239
write /sys/class/android_usb/android0/bDeviceSubClass 2
write /sys/class/android_usb/android0/bDeviceProtocol 1
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=rndis,adb
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 10a9
write /sys/class/android_usb/android0/idProduct 1104
write /sys/class/android_usb/android0/bDeviceClass 239
write /sys/class/android_usb/android0/bDeviceSubClass 2
write /sys/class/android_usb/android0/bDeviceProtocol 1
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:persist.service.adb.enable=1
start adbd

on property:persist.service.adb.enable=0
stop adbd

# Allow persistent usb charging disabling
service qcom-usb-sh /system/bin/sh /init.qcom.usb.sh
class core
user root
oneshot
8 changes: 8 additions & 0 deletions ef44/rootdir/init.pantech.usb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Allow persistent usb charging disabling
target=`getprop ro.board.platform`
usbchgdisabled=`getprop persist.usb.chgdisabled`
case "$usbchgdisabled" in
"") ;; #Do nothing here
* )
echo "$usbchgdisabled" > /sys/module/pm8921_charger/parameters/disabled
esac
262 changes: 262 additions & 0 deletions ef44/rootdir/init.qcom.class_core.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
#!/system/bin/sh
# Copyright (c) 2012, Code Aurora Forum. 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 Code Aurora 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.
#

# Set platform variables
target=`getprop ro.board.platform`
soc_hwplatform=`cat /sys/devices/system/soc/soc0/hw_platform` 2> /dev/null
soc_hwid=`cat /sys/devices/system/soc/soc0/id` 2> /dev/null
soc_hwver=`cat /sys/devices/system/soc/soc0/platform_version` 2> /dev/null


# Dynamic Memory Managment (DMM) provides a sys file system to the userspace
# that can be used to plug in/out memory that has been configured as unstable.
# This unstable memory can be in Active or In-Active State.
# Each of which the userspace can request by writing to a sys file.
#
# ro.dev.dmm = 1; Indicates that DMM is enabled in the Android User Space. This
# property is set in the Android system properties file.
#
# If ro.dev.dmm.dpd.start_address is set here then the target has a memory
# configuration that supports DynamicMemoryManagement.
init_DMM()
{
block=-1

case "$target" in
"msm7630_surf" | "msm7630_1x" | "msm7630_fusion" | "msm8960")
;;
*)
return
;;
esac

mem="/sys/devices/system/memory"
op=`cat $mem/movable_start_bytes`
case "$op" in
"0")
log -p i -t DMM DMM Disabled. movable_start_bytes not set: $op
;;

"$mem/movable_start_bytes: No such file or directory ")
log -p i -t DMM DMM Disabled. movable_start_bytes does not exist: $op
;;

*)
log -p i -t DMM DMM available. movable_start_bytes at $op
movable_start_bytes=0x`cat $mem/movable_start_bytes`
block_size_bytes=0x`cat $mem/block_size_bytes`
block=$((#${movable_start_bytes}/${block_size_bytes}))

chown system.system $mem/memory$block/state
chown system.system $mem/probe
chown system.system $mem/active
chown system.system $mem/remove

case "$target" in
"msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
echo $movable_start_bytes > $mem/probe
case "$?" in
"0")
log -p i -t DMM $movable_start_bytes to physical hotplug succeeded.
;;
*)
log -p e -t DMM $movable_start_bytes to physical hotplug failed.
return
;;
esac

echo online > $mem/memory$block/state
case "$?" in
"0")
log -p i -t DMM \'echo online\' to logical hotplug succeeded.
;;
*)
log -p e -t DMM \'echo online\' to logical hotplug failed.
return
;;
esac
;;
esac

setprop ro.dev.dmm.dpd.start_address $movable_start_bytes
setprop ro.dev.dmm.dpd.block $block
;;
esac

case "$target" in
"msm8960")
return
;;
esac

# For 7X30 targets:
# ro.dev.dmm.dpd.start_address is set when the target has a 2x256Mb memory
# configuration. This is also used to indicate that the target is capable of
# setting EBI-1 to Deep Power Down or Self Refresh.
op=`cat $mem/low_power_memory_start_bytes`
case "$op" in
"0")
log -p i -t DMM Self-Refresh-Only Disabled. low_power_memory_start_bytes not set:$op
;;
"$mem/low_power_memory_start_bytes No such file or directory ")
log -p i -t DMM Self-Refresh-Only Disabled. low_power_memory_start_bytes does not exist:$op
;;
*)
log -p i -t DMM Self-Refresh-Only available. low_power_memory_start_bytes at $op
;;
esac
}

#
# For controlling console and shell on console on 8960 - perist.serial.enable 8960
# On other target use default ro.debuggable property.
#
serial=`getprop persist.serial.enable`
dserial=`getprop ro.debuggable`
case "$target" in
"msm8960")
case "$serial" in
"0")
echo 0 > /sys/devices/platform/msm_serial_hsl.0/console
;;
"1")
echo 1 > /sys/devices/platform/msm_serial_hsl.0/console
start console
;;
*)
case "$dserial" in
"1")
start console
;;
esac
;;
esac
;;
*)
case "$dserial" in
"1")
start console
;;
esac
;;
esac

#
# Allow persistent faking of bms
# User needs to set fake bms charge in persist.bms.fake_batt_capacity
#
fake_batt_capacity=`getprop persist.bms.fake_batt_capacity`
case "$fake_batt_capacity" in
"") ;; #Do nothing here
* )
case $target in
"msm8960")
echo "$fake_batt_capacity" > /sys/module/pm8921_bms/parameters/bms_fake_battery
;;
esac
esac

case "$target" in
"msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
case "$soc_hwplatform" in
"FFA" | "SVLTE_FFA")
# linking to surf_keypad_qwerty.kcm.bin instead of surf_keypad_numeric.kcm.bin so that
# the UI keyboard works fine.
ln -s /system/usr/keychars/surf_keypad_qwerty.kcm.bin /system/usr/keychars/surf_keypad.kcm.bin
;;
"Fluid")
setprop ro.sf.lcd_density 240
setprop qcom.bt.dev_power_class 2
;;
*)
ln -s /system/usr/keychars/surf_keypad_qwerty.kcm.bin /system/usr/keychars/surf_keypad.kcm.bin
;;
esac

insmod /system/lib/modules/ss_mfcinit.ko
insmod /system/lib/modules/ss_vencoder.ko
insmod /system/lib/modules/ss_vdecoder.ko
chmod 0666 /dev/ss_mfc_reg
chmod 0666 /dev/ss_vdec
chmod 0666 /dev/ss_venc

init_DMM
;;

"msm8660")
case "$soc_hwplatform" in
"Fluid")
setprop ro.sf.lcd_density 240
;;
"Dragon")
setprop ro.sound.alsa "WM8903"
;;
esac
;;

"msm8960")
# lcd density is write-once. Hence the separate switch case
case "$soc_hwplatform" in
"Liquid")
if [ "$soc_hwver" == "196608" ]; then # version 0x30000 is 3D sku
setprop ro.sf.hwrotation 90
fi

setprop ro.sf.lcd_density 160
;;
"MTP")
setprop ro.sf.lcd_density 240
;;
*)
case "$soc_hwid" in
"109")
setprop ro.sf.lcd_density 160
;;
*)
setprop ro.sf.lcd_density 240
;;
esac
;;
esac

#Set up composition type based on the target
case "$soc_hwid" in
109| 116 | 117 | 118 | 120 | 121| 130)
#APQ8064, MSM8930, MSM8630, MSM8230,
# MSM8627, MSM8227, MPQ8064
setprop debug.composition.type gpu
;;
*)
#8960
setprop debug.composition.type dyn
;;
esac

init_DMM
;;
esac
Loading

0 comments on commit 6762452

Please sign in to comment.