LG SU950/KU9500/Optimus Z CM 7.1 Port - Android Software/Hacking General [Developers Only]

I'm working on a port of CM 7.1 to the LG Optimus Z, and I'd like to use this thread as a dev log. I'll be putting up developments here for review and critique.

Pulled contents of /dev/mtd/mtdX and friends from original phone.
Code:
cat /dev/mtd/mtd0 > /sdcard/misc-mtd0.img
cat /dev/mtd/mtd0ro > /sdcard/misc-mtd0ro.img
cat /dev/mtd/mtd1 > /sdcard/recovery-mtd1.img
cat /dev/mtd/mtd1ro > /sdcard/recovery-mtd1ro.img
cat /dev/mtd/mtd2 > /sdcard/boot-mtd2.img
cat /dev/mtd/mtd2ro > /sdcard/boot-mtd2ro.img
cat /dev/mtd/mtd3 > /sdcard/system-mtd3.img
cat /dev/mtd/mtd3ro > /sdcard/system-mtd3ro.img
cat /dev/mtd/mtd4 > /sdcard/cache-mtd4.img
cat /dev/mtd/mtd4ro > /sdcard/cache-mtd4ro.img

Related

Script to find and delete leftover files in /data/data

cd /data/data
ls > /sdcard/data.txt
cd /data/app
ls > /sdcard/apps.txt
cd /data/app-private
ls >> /sdcard/apps.txt
cd /system/app
ls >> /sdcard/apps.txt
cd /system/sd/app
ls >> /sdcard/apps.txt
cd /system/sd/app-private
ls >> /sdcard/apps.txt | sed 's/\(.*\)\..*/\1/' /sdcard/apps.txt > /sdcard/apps2.txt
cd /sdcard
sort -u apps2.txt > apps.sor
sort -u data.txt > data.sor
diff apps.sor data.sor > sort.txt
cd /sdcard/
sort -u sort.txt > sort.sor
grep -he \+ sort.sor > sort.txt
sed 's/+/rm -ir /' sort.txt > sort.sor
sed 's/rm -ir com.android.*/\1/' sort.sor > sort.txt
sed 's/rm -ir com.google.*/\1/' sort.txt > sort.sor
sort -u sort.sor > sort.txt
cd /data/data
sh /sdcard/sort.txt
cd /sdcard
rm apps.txt
rm data.txt
rm data.sor
rm apps2.txt
rm apps.sor
rm sort.txt
rm sort.sor
Here is a very rough script I wrote that will find data that is leftover after some apps are unstalled. It is missing a exa exception for "superuser permissions" data so the su popups will show up again. Just run (at your own risk) and then reboot.

Question for shell script and eeprom life

Hi
I have created a script to change the cpu speed when igo8 start/stop.
The script work fine,but i think that all this write and erase on eeprom can reduce the eeprom life.
This is a part of the script:
Code:
#/bin/sh
IGO=$(pgrep igo);
FREQMAX=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq);
if [ $IGO > 0 ]
then
if [ $FREQMAX != 768000 ]
then
cat /data/data/com.mhuang.overclocking/shared_prefs/setcpu.xml | sed -e 's/"1024000"/"768000"/g' > /data/data/com.mhuang.overclocking/shared_prefs/TEMP;
mv /data/data/com.mhuang.overclocking/shared_prefs/TEMP /data/data/com.mhuang.overclocking/shared_prefs/setcpu.xml;
cat /data/data/com.mhuang.overclocking/shared_prefs/setcpu.xml | sed -e 's/"806400"/"768000"/g' > /data/data/com.mhuang.overclocking/shared_prefs/TEMP;
mv /data/data/com.mhuang.overclocking/shared_prefs/TEMP /data/data/com.mhuang.overclocking/shared_prefs/setcpu.xml;
cat /data/data/com.mhuang.overclocking/shared_prefs/setcpu.xml | sed -e 's/"1200000"/"768000"/g' > /data/data/com.mhuang.overclocking/shared_prefs/TEMP;
mv /data/data/com.mhuang.overclocking/shared_prefs/TEMP /data/data/com.mhuang.overclocking/shared_prefs/setcpu.xml;
cat /data/data/com.mhuang.overclocking/shared_prefs/setcpu.xml | sed -e 's/"1401600"/"768000"/g' > /data/data/com.mhuang.overclocking/shared_prefs/TEMP;
mv /data/data/com.mhuang.overclocking/shared_prefs/TEMP /data/data/com.mhuang.overclocking/shared_prefs/setcpu.xml;
cat /data/data/com.mhuang.overclocking/shared_prefs/setcpu.xml | sed -e 's/"1516800"/"768000"/g' > /data/data/com.mhuang.overclocking/shared_prefs/TEMP;
mv /data/data/com.mhuang.overclocking/shared_prefs/TEMP /data/data/com.mhuang.overclocking/shared_prefs/setcpu.xml;
cat /data/data/com.mhuang.overclocking/shared_prefs/setcpu.xml | sed -e 's/"1612800"/"768000"/g' > /data/data/com.mhuang.overclocking/shared_prefs/TEMP;
mv /data/data/com.mhuang.overclocking/shared_prefs/TEMP /data/data/com.mhuang.overclocking/shared_prefs/setcpu.xml;
echo 768000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
fi
else
if [ $FREQMAX != 1024000 ]
I would like to have your opinion (and help) please.
Thanks a lot
Fabry_XY

[Q] Faux kernel init.post_boot.sh customization

This is, i´m reeally noob, and do it just for fun and have muy sensation the way I like, so I want to know just the basics to do that.
Just added stock frequencies to init.post_boot.sh of faux kernel, and I wondering, how to control the transitions or steps of the frecuency scaling, I found this lines, but really don´t know if they will work. Some of them are already in my file. But I don´t know whats the function of sampling_rate, up_threshold, and sampling_down_factor, and if they will work on intellidemand governor.
echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
echo 40000 > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/sampling_rate
echo "60000" > /sys/devices/system/cpu/cpu0/cpufreq/conservative/sampling_rate
echo "60000" > /sys/devices/system/cpu/cpu1/cpufreq/conservative/sampling_rate
echo 80 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
echo 80 > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/up_threshold
echo "95" > /sys/devices/system/cpu/cpu0/cpufreq/conservative/up_threshold
echo "95" > /sys/devices/system/cpu/cpu1/cpufreq/conservative/up_threshold
echo "1" > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
echo "2" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo "20" > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
chown system /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
chown system /sys/devices/system/cpu/cpu1/cpufreq/ondemand/sampling_rate
echo "192000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo "192000" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
chown system /sys/devices/system/cpu/cpu0/online
chown system /sys/devices/system/cpu/cpu1/online
chown system /sys/power/perflock
Thanks!

Ideal Init for AOSP-based ROMs

I wrote this program because Android's init process on Qualcomm phones is absolutely terrible. It's full of things like the following hidden code segment:
Code:
if [ -f /sys/devices/soc0/soc_id ]; then
soc_id=`cat /sys/devices/soc0/soc_id`
else
soc_id=`cat /sys/devices/system/soc/soc0/id`
fi
if [ -f /sys/devices/f9967000.i2c/i2c-0/0-0072/enable_irq ]; then
echo 1 > /sys/devices/f9967000.i2c/i2c-0/0-0072/enable_irq
else
echo "doesn't find slimport enable_irq"
fi
case "$soc_id" in
"208" | "211" | "214" | "217" | "209" | "212" | "215" | "218" | "194" | "210" | "213" | "216")
for devfreq_gov in /sys/class/devfreq/qcom,cpubw*/governor
do
echo "cpubw_hwmon" > $devfreq_gov
done
echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "interactive" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo "interactive" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo "interactive" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
#echo "20000 1400000:40000 1700000:20000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
echo 90 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
echo 1190400 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
echo 1 > /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
#echo "85 1500000:90 1800000:70" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
echo 20 > /sys/module/cpu_boost/parameters/boost_ms
#echo 1728000 > /sys/module/cpu_boost/parameters/sync_threshold
#echo 100000 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
echo 1497600 > /sys/module/cpu_boost/parameters/input_boost_freq
echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
#Set LGE Interactive-Grid parameters for G3 models
echo "20000 1100000:40000 1500000:20000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
echo "85 1500000:90" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
echo 960000 > /sys/module/cpu_boost/parameters/sync_threshold
echo 0 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
echo 1 > /sys/devices/system/cpu/cpufreq/interactive/is_grid
echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/above_optimal_max_freq_delay
echo 960000 > /sys/devices/system/cpu/cpufreq/interactive/optimal_max_freq
echo 7 > /sys/devices/system/cpu/cpufreq/interactive/middle_grid_step
echo 37 > /sys/devices/system/cpu/cpufreq/interactive/middle_grid_load
echo 14 > /sys/devices/system/cpu/cpufreq/interactive/high_grid_step
echo 46 > /sys/devices/system/cpu/cpufreq/interactive/high_grid_load
echo 1000 > /sys/class/devfreq/g3-display.0/polling_interval
setprop ro.qualcomm.perf.cores_online 2
;;
*)
echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo "ondemand" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo "ondemand" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
echo 2 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
echo 70 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
echo 3 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential_multi_core
echo 960000 > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
echo 960000 > /sys/devices/system/cpu/cpufreq/ondemand/sync_freq
# even if scaling_max_freq go down because of themal mitigation, input_boost frequency does not go down.
# echo 1190400 > /sys/devices/system/cpu/cpufreq/ondemand/input_boost
echo 80 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
#Set LGE Ondemand-Grid parameters for msm8974aa
echo 960000 > /sys/devices/system/cpu/cpufreq/ondemand/optimal_max_freq
echo 7 > /sys/devices/system/cpu/cpufreq/ondemand/middle_grid_step
echo 40 > /sys/devices/system/cpu/cpufreq/ondemand/middle_grid_load
echo 14 > /sys/devices/system/cpu/cpufreq/ondemand/high_grid_step
echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/high_grid_load
;;
esac
What is $soc_id equal to? Now we have to audit trail to see what and when $soc_id has been set to, which will open up another can of worms to see when it was initialized to, and what are the implications of having $soc_id set to a certain value, rather than another further down in the init process? Why can't we just extract all of the actual information to the boot process and leave the other junk (support for CPUs which are 5+ years old, unused features, etc) behind?
Enter Ideal Init. What Ideal Init is, consists of some changes to your device's stock kernel, and some changes to your device's stock ramdisk. Once you make the changes to the kernel and ramdisk, you create a boot.img with the new and updated kernel and ramdisk, and flash it to your device. The changes you just made to the kernel and ramdisk now allow the system calls made by your device's init.*.rc scripts and init shell scripts to be logged and dumped for later use.
From there you can dump your device's logs using the dmesg command, and run the ideal_init program on your computer to interpret these intercepted system calls and output a single valid init.<device>.rc. Then you can revert back to your original setup.
Basically, this program turns all of these init scripts and these init shell scripts and extracts only the information that was actually used in the boot process to create something like this
Check out the README for detailed instructions
https://github.com/JackpotClavin/Ideal-Init
Hope this helps the device bringup for future ROMs

[Tweak][Guide] Init.d Tweaks

Init.d Tweaks
(Needs ROM (Kernel) With init.d Access And Busybox, Open Empty File In Text Editor (Notepad ++ Or Similar), Insert Tweak You Want In Header,Save in /system/etc/init.d and name it Lomething Like 73tweaks)
1. Strict minfree handler tweak
Code:
echo "2048,3072,6144,15360,17920,20480" > /sys/module/lowmemorykiller/parameters/minfree
2. Internet speed tweaks
Code:
echo "0" > /proc/sys/net/ipv4/tcp_timestamps;
echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse;
echo "1" > /proc/sys/net/ipv4/tcp_sack;
echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle;
echo "1" > /proc/sys/net/ipv4/tcp_window_scaling;
echo "5" > /proc/sys/net/ipv4/tcp_keepalive_probes;
echo "30" > /proc/sys/net/ipv4/tcp_keepalive_intvl;
echo "30" > /proc/sys/net/ipv4/tcp_fin_timeout;
echo "404480" > /proc/sys/net/core/wmem_max;
echo "404480" > /proc/sys/net/core/rmem_max;
echo "256960" > /proc/sys/net/core/rmem_default;
echo "256960" > /proc/sys/net/core/wmem_default;
echo "4096,16384,404480" > /proc/sys/net/ipv4/tcp_wmem;
echo "4096,87380,404480" > /proc/sys/net/ipv4/tcp_rmem;
3. Vm management tweaks
Code:
echo "4096" > /proc/sys/vm/min_free_kbytes
echo "0" > /proc/sys/vm/oom_kill_allocating_task;
echo "0" > /proc/sys/vm/panic_on_oom;
echo "0" > /proc/sys/vm/laptop_mode;
echo "0" > /proc/sys/vm/swappiness
echo "50" > /proc/sys/vm/vfs_cache_pressure
echo "90" > /proc/sys/vm/dirty_ratio
echo "70" > /proc/sys/vm/dirty_background_ratio
4. Misc kernel tweaks
Code:
echo "8" > /proc/sys/vm/page-cluster;
echo "64000" > /proc/sys/kernel/msgmni;
echo "64000" > /proc/sys/kernel/msgmax;
echo "10" > /proc/sys/fs/lease-break-time;
echo "500,512000,64,2048" > /proc/sys/kernel/sem;
5. Battery tweaks
Code:
echo "500" > /proc/sys/vm/dirty_expire_centisecs
echo "1000" > /proc/sys/vm/dirty_writeback_centisecs
6. EXT4 tweaks (greatly increase I/O)
(needs /system, /cache, /data partitions formatted to EXT4)
a) removes journalism
Code:
tune2fs -o journal_data_writeback /block/path/to/system
tune2fs -O ^has_journal /block/path/to/system
tune2fs -o journal_data_writeback /block/path/to/cache
tune2fs -O ^has_journal /block/path/to/cache
tune2fs -o journal_data_writeback /block/path/to/data
tune2fs -O ^has_journal /block/path/to/data
b) perfect mount options
Code:
busybox mount -o remount,noatime,noauto_da_alloc,nodiratime,barrier=0,nobh /system
busybox mount -o remount,noatime,noauto_da_alloc,nosuid,nodev,nodiratime,barrier=0,nobh /data
busybox mount -o remount,noatime,noauto_da_alloc,nosuid,nodev,nodiratime,barrier=0,nobh /cache
7. Flags blocks as non-rotational and increases cache size
Code:
LOOP=`ls -d /sys/block/loop*`;
RAM=`ls -d /sys/block/ram*`;
MMC=`ls -d /sys/block/mmc*`;
for j in $LOOP $RAM
do
echo "0" > $j/queue/rotational;
echo "2048" > $j/queue/read_ahead_kb;
done
8. microSD card speed tweak
Code:
echo "2048" > /sys/devices/virtual/bdi/179:0/read_ahead_kb;
9. Defrags database files
Code:
for i in \
`find /data -iname "*.db"`
do \
sqlite3 $i 'VACUUM;';
done
9. Remove logger
Code:
rm /dev/log/main
10. Ondemand governor tweaks
Code:
SAMPLING_RATE=$(busybox expr `cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_transition_latency` \* 750 / 1000)
echo 95 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
echo $SAMPLING_RATE > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
11. Auto change governor and I/O Scheduler
a) I/O Scheduler (Best: MTD devices - VR; EMMC devices - SIO) - needs kernel with these
Code:
echo "vr" > /sys/block/mmcblk0/queue/scheduler
or
Code:
echo "sio" > /sys/block/mmcblk0/queue/scheduler
b) Governor (Best: Minmax > SavagedZen > Smoothass > Smartass > Interactive) - needs kernel with these
Code:
echo "governor-name-here" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
12. Move dalvik-cache to cache partition (if it's big enough) to free up data partition space
Code:
CACHESIZE=$(df -k /cache | tail -n1 | tr -s ' ' | cut -d ' ' -f2)
if [ $CACHESIZE -gt 80000 ]
then
echo "Large cache detected, moving dalvik-cache to /cache"
if [ ! -d /cache/dalvik-cache ]
then
busybox rm -rf /cache/dalvik-cache /data/dalvik-cache
mkdir /cache/dalvik-cache /data/dalvik-cache
fi
busybox chown 1000:1000 /cache/dalvik-cache
busybox chmod 0771 /cache/dalvik-cache
# bind mount dalvik-cache so we can still boot without the sdcard
busybox mount -o bind /cache/dalvik-cache /data/dalvik-cache
busybox chown 1000:1000 /data/dalvik-cache
busybox chmod 0771 /data/dalvik-cache
else
echo "Small cache detected, dalvik-cache will remain on /data"
fi
13. Disable normalize sleeper
Code:
mount -t debugfs none /sys/kernel/debug
echo NO_NORMALIZED_SLEEPER > /sys/kernel/debug/sched_features
14. GPS.conf
(create or edit your /system/etc/gps.conf with a text editor)
a) European NTP server (replace for america or asia in your case)
Code:
NTP_SERVER=europe.pool.ntp.org
XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra.bin
XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra.bin
XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra.bin
b) SE supl for A-GPS (better than Nokia's or Google's)
Code:
SUPL_HOST=supl.sonyericsson.com
SUPL_PORT=7275
Warning: Using these tweaks may brick your device. Use it with caution.
:good::good::good:
How can I know that my ROM / kernel support Init.d or not??
AK205 said:
How can I know that my ROM / kernel support Init.d or not??
Click to expand...
Click to collapse
Install Universal Init.d from Play Store and follow in-app instructions. Init.d support will be enabled on your device. Your device must be rooted first.
Build.prop tweaks by @bravonova
bravonova said:
Install Universal Init.d from Play Store and follow in-app instructions. Init.d support will be enabled on your device. Your device must be rooted first.
Click to expand...
Click to collapse
I make and init.d script and i copy your custom values to my init.d script. However, on net speed tweaks, the tcp_rmem and tcp_wmem didn't change the value at all even i edited it. Any help?
Should it be in text file or script file?
So we create a different text document containing each code for each tweak?? Not all In one document in the init.d folder??
Nice write up, bro. Thanks. Will have to try.
Guys so why aren't these enhancing tweaks and buildprop tweaks already available in our phones? Why aren't our phones optimized?
Tweaks good for one person or situation are not necessarily optimal for every case in general .
Medyredy said:
Guys so why aren't these enhancing tweaks and buildprop tweaks already available in our phones? Why aren't our phones optimized?
Click to expand...
Click to collapse
Can you help please?
Hello, I'm a newbie here. I wish to overclock my stock kernal, So it can be done through tweak? or I have to compile new overclock kernal from stock kernal source? Their's already a overclocked kernal for my device but its for cm11 and i want to use it on 4.1.2 JB stock ROM. Is their any simple way out?
Your help will be appreciated. Thanks .
use cm11 for s7392 or try
cm12 new developed
or stock i did give it to you before
choice is yours.......
i no longer have this device
rony raj said:
use cm11 for s7392 or try
cm12 new developed
or stock i did give it to you before
choice is yours.......
i no longer have this device
Click to expand...
Click to collapse
Thanks for suggesting new Cm12 kernal.
As of cm11, X264 encoding is important for me, plus their were some other minor bugs in that build. Though i agree its the best build compiled rom for Trend.
I will myself start some project after June~July.
What happened to your device though? You are among the few members who are guiding peoples on threads related to this device and i really appreciate it.

Categories

Resources