Related
The latest version:
https://github.com/xiaolu/galaxys2_kernel_repack
update for cygwin
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I hate GFW
I got a problem after repacked the new zImage.
The original size of zImage is 8MB, but the new zImage is 5MB...
Chenglu said:
Unpack:
Code:
./k-unpack zImagexwki8 initramfs-ki8
[I] Extracting gzip'd kernel image from file: zImagexwki8 (start = 16621)
[I] CPIO compression type detected = none | offset = 163840
[I] Extracting non-compressed CPIO image from kernel image (offset = 163840)
[I] Expanding CPIO archive: initramfs.cpio to initramfs-ki8.
Create newinitramfs.cpio:
Code:
./gen_initramfs.sh -o newinitramfs-ki8.cpio -u 0 -g 0 ./initramfs-ki8
or
Code:
cd initramfs-ki8
find . | cpio -o -H newc > ../newinitramfs-ki8.cpio
Edit k-repack Modified to your cross-compiler:
Code:
COMPILER=/home/xiaolu/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-eabi
COMPILER_LIB=/home/xiaolu/CodeSourcery/Sourcery_G++_Lite/lib/gcc/arm-none-eabi/4.5.2
Rebuild kernel:
Code:
./k-repack zImagexwki8 newinitramfs-ki8.cpio
[I] ---------------------------kernel repacker for i9100---------------------------
[I] Extracting gzip'd kernel from zImagexwki8 (start = 16621)
[I] Non-compressed CPIO image from kernel image (offset = 163840)
[I] CPIO image MAX size:3044984
[I] head count:3208824
[I] Making head.img ( from 0 ~ 163840 )
[I] Making a tail.img ( from 3208824 ~ 13773971 )
[I] Current ramdsize using cat : 3045376 with required size : 3044984
[I] Current ramdsize using gzip -fc : 1888879 with required size : 3044984
[I] gzip -fc accepted!
[I] Merging [head+ramdisk] + padding + tail
[I] Now we are rebuilding the zImage
[I] Image ---> piggy.gzip
[I] piggy.gzip ---> piggy.gzip.o
[I] Compiling head.o
[I] Compiling misc.o
[I] Compiling decompress.o
[I] Compiling lib1funcs.o
[I] Create vmlinux.lds
[I] head.o + misc.o + piggy.gzip.o + decompress.o + lib1funcs.o---> vmlinux
[I] vmlinux ---> zImage
[I] Re-compiled to new_zImage
[I] Cleaning up...
[I] finished...
Resources form GT-I9100_OpenSource_Update2(https://opensource.samsung.com )
initramfs-xwki8-cwm5.0.2.6.zip is modified initramfs for xwki8 stock kernel.
Click to expand...
Click to collapse
You are my hero
Thanks for making it
rock_shen said:
I got a problem after repacked the new zImage.
The original size of zImage is 8MB, but the new zImage is 5MB...
Click to expand...
Click to collapse
No problem,CPIO image is gzipped
rock_shen said:
I got a problem after repacked the new zImage.
The original size of zImage is 8MB, but the new zImage is 5MB...
Click to expand...
Click to collapse
use command Filled to 8387840 bytes
Code:
dd if=new_zImage of=zImage bs=8387840 conv=sync
I have writed a script for easy repacking/unpacking/padding
Code:
#!/bin/sh
REUNPACK=$1
if [ $REUNPACK == repack ]; then
cd initramfs_root
find . | cpio -o -H newc > ../initramfs.cpio
cd ..
./k-repack zImage initramfs.cpio
fi;
if [ $REUNPACK == unpack ]; then
./k-unpack zImage
fi;
if [ $REUNPACK == cpio ]; then
cd initramfs_root
find . | cpio -o -H newc > ../initramfs.cpio
fi;
if [ $REUNPACK == padding ]; then
rm -rf zImage
dd if=new_zImage of=zImage bs=8387840 conv=sync
fi;
if [ $REUNPACK == clean ]; then
rm -rf zImage initramfs_root initramfs.cpio new_zImage
echo "Done!"
fi;
netchip said:
I have writed a script for easy repacking/unpacking/padding
Code:
#!/bin/sh
REUNPACK=$1
if [ $REUNPACK == repack ]; then
cd initramfs_root
find . | cpio -o -H newc > ../initramfs.cpio
cd ..
./k-repack zImage initramfs.cpio
fi;
if [ $REUNPACK == unpack ]; then
./k-unpack zImage
fi;
if [ $REUNPACK == cpio ]; then
cd initramfs_root
find . | cpio -o -H newc > ../initramfs.cpio
fi;
if [ $REUNPACK == padding ]; then
rm -rf zImage
dd if=new_zImage of=zImage bs=8387840 conv=sync
fi;
if [ $REUNPACK == clean ]; then
rm -rf zImage initramfs_root initramfs.cpio new_zImage
echo "Done!"
fi;
Click to expand...
Click to collapse
good work
Chenglu said:
I hate GFW
Click to expand...
Click to collapse
haha
me too
guaiwujia said:
haha
me too
Click to expand...
Click to collapse
hiahia
nice scripttl there. makes it easier for devs.
Sent from my GT-I9100 using xda premium
update to v3
Chenglu said:
I hate GFW
Click to expand...
Click to collapse
me too!~
thx
.......
What is GFW?
Sent from my GT-I9100
The Great Fire Wall of China
Chenglu said:
The Great Fire Wall of China
Click to expand...
Click to collapse
I dont like that too xD
black-snowflake said:
me too!~
Click to expand...
Click to collapse
Foreigners don't know what’s GWF you said here, but I think you know who I am!
I'm having a problem. Whenever I try to repack a kernel, it says the ramdisk size is too big. It also says realpath command isn't found on line 12.
Code:
[email protected]:~/Desktop/Kernel/tools# ./repack zImage newinitramfs.cpio
./repack: line 12: realpath: command not found
[I] ---------------------------kernel repacker for i9100---------------------------
[I] Extracting gzip'd kernel from zImage (start = 16621)
[I] CPIO compression type detected = gzip | offset = 163840
[I] CPIO image MAX size:2860094
[I] Head count:3023934
[I] Making head.img ( from 0 ~ 163840 )
[I] Making a tail.img ( from 3023934 ~ 10612864 )
[I] Current ramdsize using cat : 4573696 with required size : 2860094 bytes
[I] Current ramdsize using gzip -f9 : 2866888 with required size : 2860094 bytes
[E] New ramdisk is still too big. Repack failed. 2866888 > 2860094
Tried both 4.4.1 & 4.5.2 version of G++ Lite, none of them is fixes the problem.
Looks like there's something wrong with gzip..
Help?
Padding big binary files to end of the zImage files.
Example(initramfs-tools-v5 Padding sufiles to zImage files):
How to use:
Code:
busybox dd if=/dev/block/mmcblk0p5 of=/system/app/Superuser.apk skip=7026336 seek=0 bs=1 count=196640
busybox dd if=/dev/block/mmcblk0p5 of=/system/bin/su skip=7000000 seek=0 bs=1 count=26336
hello i trying to ODEX my MIUIv4 (ICS 4.0.4) but i had some troubles:
there is my script for odexing:
Code:
#/sbin/sh
D=/data
E=/sddata
S=/system
SD=/sdcard
bbcmd="busybox"
bbcat="$bbcmd cat"
bbgrep="$bbcmd grep"
bbsed="$bbcmd sed"
SYSTARGET="/system"
OPTTEMP="/tmp"
$bbcmd chmod 777 $OPTTEMP/{busybox,dexopt_wrapper,zip,zipalign}
mount -o rw /system
mount -o rw /data
mount -o rw /cache
local zip="$OPTTEMP/zip"
local zipalign="$OPTTEMP/zipalign"
local dexopt_wrapper="$OPTTEMP/dexopt_wrapper"
local bootclpath="/system/framework/core.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar:/system/framework/filterfw.jar"
# change to system/framework and process EVERY jar IN ORDER OF BOOTCLASSPATH!
cd /system/framework
indir=$(pwd)
for filename in \
core.jar core-junit.jar miui-framework.jar bouncycastle.jar ext.jar framework.jar android.policy.jar services.jar apache-xml.jar filterfw.jar \
am.jar ime.jar android.test.runner.jar input.jar javax.obex.jar monkey.jar pm.jar svc.jar bmgr.jar com.android.location.provider.jar com.android.future.usb.accessory.jar com.google.android.maps.jar com.google.android.media.effects.jar com.google.widevine.software.drm.jar
do
name=${filename%.jar}
$bbcmd cp -f $filename $OPTTEMP/$filename
$dexopt_wrapper $filename $name.odex $bootclpath > /dev/null 2>&1
if [ $? -eq 0 ]
then
$zip -d $filename classes.dex > /dev/null 2>&1
$bbcmd cp -f $name.odex $OPTTEMP/$name.odex
echo "$filename - done."
else
$bbcmd rm *.odex
$bbcmd cp -f $OPTTEMP/*.jar $indir/
echo "Framework file $filename failled. Cannot Complete."
echo "System has been restored."
return 1;
fi
done
$zipalign 4 framework-res.apk framework-res.apk.align > /dev/null 2>&1
$bbcmd mv -f framework-res.apk.align framework-res.apk
$zipalign 4 framework-miui-res.apk framework-miui-res.align > /dev/null 2>&1
$bbcmd mv -f framework-miui-res.align framework-miui-res.apk
cd /system/app
indir=$(pwd)
# Process apks from system/app that are normally odexed
for filename in *.apk
do
name=${filename%.apk}
$dexopt_wrapper $filename $name.odex $bootclpath > /dev/null 2>&1
if [ $? -eq 0 ]
then
$zip -d $filename classes.dex > /dev/null 2>&1
$zipalign 4 $filename $filename.align > /dev/null 2>&1
$bbcmd mv -f $filename.align $filename
echo "$filename - done."
fi
done
$bbcmd find /system/framework -type f -exec chmod 644 {} \;
$bbcmd find /system/app -type f -exec chmod 644 {} \;
[ -d /cache/dalvik-cache ] && $bbcmd rm -rf /cache/dalvik-cache/*
[ -d /data/dalvik-cache ] && $bbcmd rm -rf /data/dalvik-cache/*
return 0;
and i had errors in android.policy, framework, services .odex files
Added a big list of disable/enable android.permissions
Cleaned up Op.
Made information more concise and easier on the eyes.
read_ahead_kb:
Code:
#
for i in /sys/devices/virtual/bdi/*/read_ahead_kb
do
echo "(AnyMultipleOf 128)" > $i
done
inode_readahead_blks
Code:
#
for i in /sys/fs/ext4/*/inode_*
do
echo "VAR" > $i
done
You won't find more simple scripting SETTING=VALUE...
Code:
write='busybox sysctl -w /sys/devices/system/cpu'
i=$write/cpufreq/conservative
j=$write/cpu0/cpufreq
$j/scaling_governor=conservative
$j/scaling_max_freq=1200000
$jscaling_min_freq=25000
$i/sampling_rate=25000
$i/up_threshold=40
$i/down_threshold=50
$i/freq_step=5
$i/sampling_down_factor=2
|
Code:
\( An Ondemand example \)
write='busybox sysctl -w /sys/devices/cpu'
i=$write/cpufreq/ondemand
j=$write/cpu0/cpufreq
$j/scaling_governor=ondemand
$j/scaling_min_freq=25000
$j/scaling_max_freq=1400000
$i/sampling_rate=50000
$i/up_threshold=65
$i/powersave_bias=10
$i/sampling_down_factor=3
$i/down_differential=30
$i/freq_step=65
|
Code:
\( Pegasus example \)
write='busybox sysctl -w /sys/devices/system/cpu'
i=$write/cpufreq/pegasusq
j=$write/cpu0/cpufreq
$j/scaling_governor=pegasusq
$j/scaling_min_freq=25000
$j/scaling_max_freq=1400000
$i/pegasusq/up_threshold=80
$i/pegasusq/up_threshold_at_min_freq=65
$i/pegasusq/sampling_down_factor=5
$i/pegasusq/down_differential=5
$i/pegasusq/freq_step=60
$i/freq_for_responsiveness=500000
$i/pegasusq/cpu_up_rate=10
$i/pegasusq/cpu_down_rate=20
$i/pegasusq/hotplug_freq_1_1=500000
$i/pegasusq/hotplug_freq_2_0=200000
$i/pegasusq/hotplug_rq_1_1=300
$i/pegasusq/hotplug_rq_2_0=350
$i/pegasusq/ignore_nice_load=0
$i/pegasusq/io_is_busy=1
$i/pegasusq/max_cpu_lock=0
$i/pegasusq/hotplug_lock=0
|
|
simple shell for speed and memory management
Code:
\( You can virtually write any setting \)\
ext4=`busybox sysctl -w /sys/fs/ext4/mmcblk0`
lmk=`busybox sysctl -w /sys/module/lowmemorykiller/parameters`
$ext4\p10/inode_readahead_blks=128
$ext4\p9/inode_readahead_blks=128
$ext4\p7/inode_readahead_blks=256
$ext4\p12/inode_readahead_blks=64
$ext4\p10/inode_goal=16
$ext4\p9/inode_goal=16
$ext4\p7/inode_goal=16
$ext4\p12/inode_goal=16
busybox sysctl -w /proc/1/oom_adj=-17
$lmk/adj=0,2,-4,8,12,15
$lmk/minfree=1024,3072,5120,12288,17408,24566
Screen state script that turns on and off both cpus
For now, this Post will be home to I/O tweaks
Queue settings unknown to most that
Code:
for i in /sys/block/*/*/force*
do
echo "0" > $i
echo 0 > /sys/block/mmcblk0/mmcblk0p1/ro
echo 0 > /sys/block/mmcblk0/mmcblk0p10/ro
echo 0 > /sys/block/mmcblk0/mmcblk0p11/ro
echo 0 > /sys/block/mmcblk0/mmcblk0p12/ro
echo 0 > /sys/block/mmcblk0/mmcblk0p2/ro
echo 0 > /sys/block/mmcblk0/mmcblk0p3/ro
echo 0 > /sys/block/mmcblk0/mmcblk0p4/ro
echo 0 > /sys/block/mmcblk0/mmcblk0p5/ro
echo 0 > /sys/block/mmcblk0/mmcblk0p6/ro
echo 0 > /sys/block/mmcblk0/mmcblk0p7/ro
echo 0 > /sys/block/mmcblk0/mmcblk0p8/ro
echo 0 > /sys/block/mmcblk0/mmcblk0p9/ro
Now you`re ready to adjust stuff...
Code:
for i in /sys/devices/virtual/block/*/queue
do
echo "sio" > $i/scheduler
echo "4096" > $i/minimum_io_size
echo "1" > $i/add_random
echo "4096" > $i/discard_granularity
echo "1" > /discard_zeroes_data
echo "1" > $i/discard_max_bytes
echo "1024" > $i/optimal_io_size
done
|or
for i in /sys/devices/virtual/block/*/queue
do
echo "deadline" > $i/scheduler
echo "2048" > $i/minimum_io_size
echo "1" > $i/add_random
echo "0" > $i/discard_max_bytes
echo "0" > $i/discard_granularity
echo "1" > /discard_zeroes_data
echo "128" > $i/optimal_io_size
done
I have so many variations and these ftmp dont have parameters so Ill let you get creative on those.
Sys Call
Valid keys for /etc/sysctl.conf
I meant for this list to be the OP.. but alas.. i was 11000 or so character to heavy.. lol
A gift ( not all sysctl calls are adjustable and this list is raw. there will be one or two no goes ..)
( wow, I hadn't realized there was near 800 settings in here.... )
ICS SYSCALL MASTER KEY
Alright, I know that most of you will already know how to use a sysctl.conf, but there are probably a couple
things that you didn't know about sysctl, so I may as well start with the obvious...
Code:
\\the following is the easiest way to use sysctl.conf, it is ideally done at init but is equally as easy to use from termemu\\
#/system/bin/sh \\ for init.d \\
sysctl -p \\ from terminal emulator you would have first signed it as usr \\
Now for one you may not now
I'm sure you've seen it used on each command.. (something like 'busybox sysctl -e -w vm.ridin_dirty=example)
*note in sysctl, -(e) is to skip displaying key (e)rrors and keep reading; -n is umber errors i believe; -w is (w)rite; the -p above is (p)rint sysclt.conf
Code:
\\ this is a nice little trick, there are over around 30 kb of keys,,what to do?? \\
su \\ or #/system/bin/sh if in a script \\
sysctl -p /etc/where/ever/your/2nd/sysctl/is
sysctl -p /or/your/5th
sysctl -p $0 <\\ or call your working script itself.\\>
<\\next is the command to create master list from your own device\\>
[B]sysctl -A > /data/log/MasterSysctl.txt[/B]
<\\and this next one,,, well this next is just priceless.. how's this for difficult syntax\\>
sysctl -w /proc/1/oom_adj=-17 <\\yes,, I mean..it...\\>
sysctl -w /sys/devices/virtual/block/loop1/queue/scheduler=easiest_way_to_apply_any_setting_you_arent_sure_of
Some working examples coming soon.
CpuFreq slash Governor settings
Similar but more refined and for a PEGASUS SETUP
Customize it all...
This is an advanced example made simple.. This one will set (between 6) governor and its settings, max and min freq, readahead kb in all of BDI, and inode readahead blks in each mmcblk.
And its 2.2* kb. And you only need to edit the subs if you wamt...
{no mem management or screenstate, but I just had a 4.5 hour screen on cycle at 1.4 max and scoring 4600+ on quadrants...}
Code:
#!/system/bin/sh
chmod 0644 /sys/block/*/queue/*
mount -o remount,rw / /
mount -o remount.rw /system /system
governor=pegasusq
max_freq=1400000
min_freq=50000
inode_readahead=128
read_ahead_kb=3840
cpu=/sys/devices/system/cpu/cpu0/cpufreq
echo "$min_freq" > $cpu/scaling_min_freq
echo "$max_freq" > $cpu/scaling_max_freq
for i in /sys/block/*/*/force_ro
do
echo "0" > $i
done
for i in /sys/class/bdi/*/read*
do
echo "$read_ahead_kb" > $i
done
for i in /sys/fs/ext4/*/inode_*
do
echo "$inode_readahead" > $i
done
for i in $cpu/scaling_governor
do
echo "$governor" > $i
done
for i in /sys/devices/system/cpu/cpufreq
do
active=`cat $cpu/scaling_governor`
Begin_ondemand
echo "40000" > $i/ondemand/sampling_rate
echo "70" > $i/ondemand/up_threshold
echo "15" > $i/ondemand/powersave_bias
echo "70" > $i/ondemand/freq_step
echo "3" > $i/ondemand/sampling_down_factor
Begin_smartassv2
echo "800000" > $i/smartass/awake_ideal_freq
echo "200000" > $i/smartass/sleep_ideal_freq
echo "800000" > $i/smartass/sleep_wakeup_freq
echo "75" > $i/smartass/max_cpu_load
echo "45" > $i/smartass/min_cpu_load
echo "0" > $i/smartass/ramp_up_step
echo "0" > $i/smartass/ramp_down_step
echo "24000" > $i/smartass/up_rate_us
echo "99000" > $i/smartass/down_rate_us
Begin_interactive
echo "80" > $i/interactive/go_hispeed_load
echo "40000" > $i/interactive/min_sample_time
echo "20000" > $i/interactive/timer_rate
#Begin_pegasusq
echo "80" > $i/pegasusq/up_threshold
echo "65" > $i/pegasusq/up_threshold_at_min_freq
echo "5" > $i/pegasusq/sampling_down_factor
echo "5" > $i/pegasusq/down_differential
echo "60" > $i/pegasusq/freq_step
echo "400000" > $i/freq_for_responsiveness
echo "10" > $i/pegasusq/cpu_up_rate
echo "20" > $i/pegasusq/cpu_down_rate
echo "400000" > $i/pegasusq/hotplug_freq_1_1
echo "300000" > $i/pegasusq/hotplug_freq_2_0
echo "300" > $i/pegasusq/hotplug_rq_1_1
echo "350" > $i/pegasusq/hotplug_rq_2_0
echo "0" > $i/pegasusq/ignore_nice_load
echo "1" > $i/pegasusq/io_is_busy
echo "0" > $i/pegasusq/max_cpu_lock
echo "0" > $i/pegasusq/hotplug_lock
#Begin_lulzactive
echo "60" > $i/lulzactive/inc_cpu_load
echo "4" > $i/lulzactive/pump_up_step
echo "1" > $i/lulzactive/pump_down_step
echo "10000" > $i/lulzactive/up_sample_time
echo "70000" > $i/lulzactive/down_sample_time
echo "5" > $i/lulzactive/screen_off_min_step
#Begin_conservative
echo "55" > $i/conservative/up_threshold
echo "25000" > $i/conservative/sampling_rate
echo "3" > $i/conservative/sampling_down_factor
echo "40" > $i/conservative/down_threshold
echo "5" > $i/conservative/freq_step
done
exit 0
Odex all data apps
http://forum.xda-developers.com/showthread.php?p=32305612
Here's a link to a post with a Flashable busybox (with extra-goodies)
PhAkEer said:
a place where one can come to copy/plaste sections
Click to expand...
Click to collapse
I know how to copy, but what is this plaste you speak of?
anyways, this looks promising for adding some more scripts in one spot for all.
Sent from my SPH-D710 using Tapatalk
Click here for custom mods for your E4GT
Prove it
PhAkEer said:
Prove it
Click to expand...
Click to collapse
Edited in a quote before you edited :screwy: haha
Sent from my SPH-D710 using Tapatalk
Click here for custom mods for your E4GT
What is a script? And what do all those fancy thingy things you posted do? Oh, and I spilled grape juice all over my phone. Its still dripping out of it. Why do you think it won't turn on? Also, can you come help me pick my nose?
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
How did this thread sneak in on me bro? A little sly-of-hand action there huh.... hook 'em in placebo and create another thread... then mention nonchalantly in placebo thread to check your other thread for the latest.Lol
Looking forward to seeing where this one leads.. nice work man!
Sent from my SPH-D710 using Xparent Blue Tapatalk 2
blackcanopy said:
How did this thread sneak in on me bro? A little sly-of-hand action there huh.... hook 'em in placebo and create another thread... then mention nonchalantly in placebo thread to check your other thread for the latest.Lol
Looking forward to seeing where this one leads.. nice work man!
Sent from my SPH-D710 using Xparent Blue Tapatalk 2
Click to expand...
Click to collapse
Come one now, brah. You know exactly where this goes....
(this leads to me being in your backpack after a while.. and...
to my ultimate goal.... I sleep.. for at least 6 hours at once...)
Anybody want a script to odex data/apps??
Wrote it this morning.
Just need dexopt-wrapper and then execute this.. no reboot, apps keep their classes.dex for the future as well...
Code:
#!/system/bin/sh
J=/system/framework
A=/data/app
W=/system/xbin/dexopt-wrapper
mount -o remount,rw /system /system
mount -o remount,rw /data /data
rm -f $A/*.odex
for i in $A/*
do
name=`basename $i .apk`
$W $A/$name.apk $A/$name.odex $J/core.jar:$J/core-junit.jar:$J/bouncycastle.jar:$J/ext.jar:$J/framework.jar:$J/framework2.jar:$J/android.policy.jar:$J/services.jar:$J/apache-xml.jar
chmod 0644 $A/$name.odex
done
echo $i
sleep 2
exit 0
( and telling me if this stuff does or does not work is NOT off topic ftr )
Haven't even had time to look at this to see what it does...
Found it in an unnamed folder in a backup..
If anybodies knows who's work this is please say so..
I'm only posting it to get it off of my work pc.. I'll look into it later.
Code:
#!/system/bin/sh
#
#
readdebug() {
DUAL_CORE_DEBUG=`cat /system/etc/dual_core/debug`
DUAL_CORE_DEBUG=${DUAL_CORE_DEBUG:=0}
}
log() {
if [ "$DUAL_CORE_DEBUG" = "1" ] ; then
echo "$(date): [email protected]" >> /devlog/dual_core
fi
}
logcpu() {
if [ "$DUAL_CORE_DEBUG" = "1" ] ; then
local NOW_FREQ=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq`
local NOW=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq`
log "CPU[0]: scaling_max_freq=$NOW"
local NOW_ONLINE=`cat /sys/devices/system/cpu/cpu1/online`
log "CPU[1]: online=$NOW_ONLINE"
if [ -f /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq ] ; then
local NOW=`cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq`
log "CPU[1]: scaling_max_freq=$NOW"
fi
fi
}
init_dc_fs() {
sysrw
touch /devlog/dual_core ; chmod 777 /devlog/dual_core
touch /system/etc/dual_core/debug ; chmod 777 /system/etc/dual_core/debug
touch /system/etc/dual_core/sleep_frequency ; chmod 777 /system/etc/dual_core/sleep_frequency
touch /system/etc/dual_core/disable_sleep_freq ; chmod 777 /system/etc/dual_core/disable_sleep_freq
sysro
}
waitforwakeup() {
log "waitforwakeup{" ; logcpu
AWAKE=`cat /sys/power/wait_for_fb_wake`
if [ "$AWAKE" = "awake" ] ; then
CPU0_FREQ_AWAKE=${CPU0_FREQ_AWAKE:="$CPU0_FREQ_BOOT"}
log "Awake triggered... old awake is: $CPU0_FREQ_AWAKE"
log "CPU[1] try set online"
chmod 644 /sys/devices/system/cpu/cpu1/online
echo "1" > /sys/devices/system/cpu/cpu1/online
chmod 444 /sys/devices/system/cpu/cpu1/online
log "CPU[1] online"
if [ "$DISABLE_SLEEP" = "1" ] || [ "$OC_DAEMON" = "1" ] ; then
log "sleep cpu0 frequency mod disabled"
else
log "waking up from earlier sleep.. set to old awake frequency = $CPU0_FREQ_AWAKE"
echo "$CPU0_FREQ_AWAKE" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
fi
sleep 1
echo "$CPU0_FREQ_AWAKE" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
chmod 644 /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
chmod 444 /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
log "}wakeup" ; logcpu
fi
}
waitforsleep() {
log "waitforsleep{" ; logcpu
SLEEPING=`cat /sys/power/wait_for_fb_sleep`
if [ "$SLEEPING" = "sleeping" ] ; then
log "Sleep triggered..."
sleep_cpu0
log "CPU[1]: try set offline"
chmod 644 /sys/devices/system/cpu/cpu1/online
echo "0" > /sys/devices/system/cpu/cpu1/online
chmod 444 /sys/devices/system/cpu/cpu1/online
log "CPU[1]: offline"
fi
log "}waitforsleep" ; logcpu
}
sleep_cpu0() {
CPU0_FREQ_AWAKE=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq`
log "Sleeping, remember awake frequency: $CPU0_FREQ_AWAKE"
DISABLE_SLEEP=`cat /system/etc/dual_core/disable_sleep_freq`
if [ "$DISABLE_SLEEP" = "1" ] || [ "$OC_DAEMON" = "1" ] ; then
log "DISABLE_SLEEP=1 or OCD detected"
else
if [ -e /system/etc/dual_core/sleep_frequency ] ; then
SLEEP_FREQUENCY=`cat /system/etc/dual_core/sleep_frequency`
log "sleep_frequency setting found, using $SLEEP_FREQUENCY instead of $CPU0_FREQ_AWAKE"
fi
SLEEP_FREQUENCY=${SLEEP_FREQUENCY:=DEFAULT_SLEEP_FREQUENCY}
echo "$SLEEP_FREQUENCY" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
log "Set cpu0 frequency to $SLEEP_FREQUENCY"
fi
}
DEFAULT_SLEEP_FREQUENCY=192000
init_dc_fs
DUAL_CORE_DEBUG="1"
log "Starting..."; logcpu
if [ -f /system/etc/virtuous_oc/wake_max_freq ] ; then
OC_DAEMON=1
log "OC Daemon found."
fi
DISABLE_SLEEP=`cat /system/etc/dual_core/disable_sleep_freq`
CPU0_FREQ_BOOT=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq`
STATE=`cat /sys/power/state_onchg`
if [ "$STATE" = "chgoff" ] ; then
log "device is asleep, scaling down"
sleep_cpu0
fi
DUAL_CORE_DEBUG="0"
(while : ; do
waitforwakeup
readdebug
waitforsleep
readdebug
done &)
at a glance it looks like an extremely over complicated screenstate script....
PhAkEer said:
Haven't even had time to look at this to see what it does...
Found it in an unnamed folder in a backup..
If anybodies knows who's work this is please say so..
I'm only posting it to get it off of my work pc.. I'll look into it later.
Code:
#!/system/bin/sh
#
#
readdebug() {
DUAL_CORE_DEBUG=`cat /system/etc/dual_core/debug`
DUAL_CORE_DEBUG=${DUAL_CORE_DEBUG:=0}
}
log() {
if [ "$DUAL_CORE_DEBUG" = "1" ] ; then
echo "$(date): [email protected]" >> /devlog/dual_core
fi
}
logcpu() {
if [ "$DUAL_CORE_DEBUG" = "1" ] ; then
local NOW_FREQ=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq`
local NOW=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq`
log "CPU[0]: scaling_max_freq=$NOW"
local NOW_ONLINE=`cat /sys/devices/system/cpu/cpu1/online`
log "CPU[1]: online=$NOW_ONLINE"
if [ -f /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq ] ; then
local NOW=`cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq`
log "CPU[1]: scaling_max_freq=$NOW"
fi
fi
}
init_dc_fs() {
sysrw
touch /devlog/dual_core ; chmod 777 /devlog/dual_core
touch /system/etc/dual_core/debug ; chmod 777 /system/etc/dual_core/debug
touch /system/etc/dual_core/sleep_frequency ; chmod 777 /system/etc/dual_core/sleep_frequency
touch /system/etc/dual_core/disable_sleep_freq ; chmod 777 /system/etc/dual_core/disable_sleep_freq
sysro
}
waitforwakeup() {
log "waitforwakeup{" ; logcpu
AWAKE=`cat /sys/power/wait_for_fb_wake`
if [ "$AWAKE" = "awake" ] ; then
CPU0_FREQ_AWAKE=${CPU0_FREQ_AWAKE:="$CPU0_FREQ_BOOT"}
log "Awake triggered... old awake is: $CPU0_FREQ_AWAKE"
log "CPU[1] try set online"
chmod 644 /sys/devices/system/cpu/cpu1/online
echo "1" > /sys/devices/system/cpu/cpu1/online
chmod 444 /sys/devices/system/cpu/cpu1/online
log "CPU[1] online"
if [ "$DISABLE_SLEEP" = "1" ] || [ "$OC_DAEMON" = "1" ] ; then
log "sleep cpu0 frequency mod disabled"
else
log "waking up from earlier sleep.. set to old awake frequency = $CPU0_FREQ_AWAKE"
echo "$CPU0_FREQ_AWAKE" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
fi
sleep 1
echo "$CPU0_FREQ_AWAKE" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
chmod 644 /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
chmod 444 /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
log "}wakeup" ; logcpu
fi
}
waitforsleep() {
log "waitforsleep{" ; logcpu
SLEEPING=`cat /sys/power/wait_for_fb_sleep`
if [ "$SLEEPING" = "sleeping" ] ; then
log "Sleep triggered..."
sleep_cpu0
log "CPU[1]: try set offline"
chmod 644 /sys/devices/system/cpu/cpu1/online
echo "0" > /sys/devices/system/cpu/cpu1/online
chmod 444 /sys/devices/system/cpu/cpu1/online
log "CPU[1]: offline"
fi
log "}waitforsleep" ; logcpu
}
sleep_cpu0() {
CPU0_FREQ_AWAKE=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq`
log "Sleeping, remember awake frequency: $CPU0_FREQ_AWAKE"
DISABLE_SLEEP=`cat /system/etc/dual_core/disable_sleep_freq`
if [ "$DISABLE_SLEEP" = "1" ] || [ "$OC_DAEMON" = "1" ] ; then
log "DISABLE_SLEEP=1 or OCD detected"
else
if [ -e /system/etc/dual_core/sleep_frequency ] ; then
SLEEP_FREQUENCY=`cat /system/etc/dual_core/sleep_frequency`
log "sleep_frequency setting found, using $SLEEP_FREQUENCY instead of $CPU0_FREQ_AWAKE"
fi
SLEEP_FREQUENCY=${SLEEP_FREQUENCY:=DEFAULT_SLEEP_FREQUENCY}
echo "$SLEEP_FREQUENCY" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
log "Set cpu0 frequency to $SLEEP_FREQUENCY"
fi
}
DEFAULT_SLEEP_FREQUENCY=192000
init_dc_fs
DUAL_CORE_DEBUG="1"
log "Starting..."; logcpu
if [ -f /system/etc/virtuous_oc/wake_max_freq ] ; then
OC_DAEMON=1
log "OC Daemon found."
fi
DISABLE_SLEEP=`cat /system/etc/dual_core/disable_sleep_freq`
CPU0_FREQ_BOOT=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq`
STATE=`cat /sys/power/state_onchg`
if [ "$STATE" = "chgoff" ] ; then
log "device is asleep, scaling down"
sleep_cpu0
fi
DUAL_CORE_DEBUG="0"
(while : ; do
waitforwakeup
readdebug
waitforsleep
readdebug
done &)
at a glance it looks like an extremely over complicated screenstate script....
Click to expand...
Click to collapse
You might be right! It kinda looks like the script from the CPU sleep thread from here http://forum.xda-developers.com/showthread.php?t=1739457
Sent from my SPH-D710 using Tapatalk 2
Customizable Pegasus.
As is I'm getting something I'd recognize as a score in quad on jb... I thought the day would never come....
Code:
#!/system/bin/sh
# SETUP FOR PEGASUS
# I/O Settings
scheduler=deadline
read_ahead=3072
inode_blks=64
inode_goal=8
# CPU Freq Settings
min_freq=200
max_freq=1200
up_thresh=80
sampling=40000
sampling_factor=3
down_diff=5
freq_step=60
response_freq=500000
up_rate=20
down_rate=30
freq_1_1=400000
freq_2_0=300000
rq_1_1=400
rq_2_0=350
ignore_nice=0
io_is_busy=0
cpu_lock=0
lockR=0
# Stream settings
max_mb_scan=0
min_mb_scan=0
mb_stream_req=0
max_writeback_bump=32
req_order2=0
prealloc_mb=768
# Here we go again...lol
set -x
exec > /data/log/Pegasus.log 2>&1
/system/bin/sh
for j in $(/system/xbin/busybox mount | /system/xbin/busybox grep ext4 | /system/xbin/busybox cut -d " " -f3)
do
sync
/system/xbin/busybox mount -o remount,noatime,barrier=0,commit=5 $j
done
mount -o remount,noatime,nobh,nodiratime,nodelalloc,noauto_da_alloc,barrier=0 /system /system
mount -o remount,noatime,nobh,nodiratime,nodelalloc,noauto_da_alloc,barrier=0,commit=0 /cache /cache
mount -o remount,noatime,nodiratime,delalloc,noauto_da_alloc,barrier=0,commit=0 /data /data
for i in /sys/fs/ext4/*
do
echo "$max_mb_scan" > $i/mb_max_to_scan
echo "$min_mb_scan" > $i/mb_min_to_scan
echo "$inode_blks" > $i/inode_readahead_blks
echo "$inode_goal" > $i/inode_goal
echo "$mb_stream_req" > $i/mb_stream_req
echo "$max_writeback_bump" > $i/max_writeback_mb_bump
echo "$preaoc_mb" > $i/mb_group_prealloc
echo "$req_order2" > $i/mb_order2_req
done
echo "pegasusq" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
for i in /sys/devices/system/cpu/cpufreq/pegasusq
do
echo "$up_thresh" > $i/up_threshold
echo "$sampling" > $i/sampling_rate
echo "$sampling_factor" > $i/sampling_down_factor
echo "$down_diff" > $i/down_differential
echo "$freq_step" > $i/freq_step
echo "$up_rate" > $i/cpu_up_rate
echo "$down_rate" > $i/cpu_down_rate
echo "$freq_1_1" > $i/hotplug_freq_1_1
echo "$freq_2_0" > $i/hotplug_freq_2_0
echo "$rq_1_1" > $i/hotplug_rq_1_1
echo "$rq_2_0" > $i/hotplug_rq_2_0
echo "$ignore_nice" > $i/ignore_nice_load
echo "$io_is_busy" > $i/io_is_busy
echo "$cpu_lock" > $i/max_cpu_lock
done
for i in /sys/devices/virtual/bdi/*/read_ahead_kb
do
echo "$read_ahead" > $i
done
for i in /sys/class/block/*/queue
do
echo "$scheduler" > $i/scheduler
echo "$read_ahead" > $i/read_ahead_kb
done
case "$min_freq" in
*)
i=/sys/devices/system/cpu/cpu0/cpufreq
;;
25)
echo "25000" > $i/scaling_min_freq
;;
50)
echo "50000" > $i/scaling_min_freq
;;
100)
echo "100000" > $i/scaling_min_freq
;;
200)
echo "200000" > $i/scaling_min_freq
;;
300)
echo "300000" > $i/scaling_min_freq
;;
400)
echo "400000" > $i/scaling_min_freq
;;
500)
echo "500000" > $i/scaling_min_freq
;;
esac;
case "$max_freq" in
800)
echo "800000" > $cpu/scaling_max_freq
;;
900)
echo "900000" > $cpu/scaling_max_freq
;;
1000)
echo "1000000" > $cpu/scaling_max_freq
;;
1100)
echo "1100000" > $cpu/scaling_max_freq
;;
1200)
echo "1200000" > $cpu/scaling_max_freq
;;
1300)
echo "1300000" > $cpu/scaling_max_freq
;;
1400)
echo "1400000" > $cpu/scaling_max_freq
;;
1600)
echo "1600000" > $cpu/scaling_max_freq
;;
esac;
Nice to see this in the development section :thumbup:
-TeaM VeNuM Like A Boss
MiguelHogue said:
Nice to see this in the development section :thumbup:
-TeaM VeNuM Like A Boss
Click to expand...
Click to collapse
It isn't so such much for something to develop, I mainly just wanted the resources available the Tw themers and the like.
The parameters for the section said dev/mod/hack so I'm sure it fits in there somewhere.. I need to start getting some material in here though. . ... watch this...
EEECCCCCCHOOOO
khoeoeoeoe
ohohohohhh
See...
This one is a WIP so pay attention
Dual cpu screenstate script.. simple stuff
the way I have this setup it setup it will call powersave when screen is off. This is only practical if it calls another governor when the screen comes back on, so change it from "sh /data/local/pegasus" to "sh wherever you have a gov script" or to
"echo govofchoice > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
Code:
#!/system/bin/sh
#
#
sleep 1m
while [[ "awake" = $AWAKE ]]
do
AWAKE=`cat /sys/power/wait_for_fb_wake`
if [ "awake" = $AWAKE ]
then
echo "1" > /sys/devices/system/cpu/cpu1/online
echo "1" > /sys/devices/system/cpu/cpu0/online
sh /data/local/Pegasus
fi
sleep 2
ASLEEP=`cat /sys/power/wait_for_fb_sleep`
if [ "sleeping" = $ASLEEP ]
then
echo "0" > /sys/devices/system/cpu/cpu1/online
echo "0" > /sys/devices/system/cpu/cpu0/online
echo "powersave" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
fi
sleep 2
done
exit 0
PhAkEer said:
Anybody want a script to odex data/apps??
Wrote it this morning.
Just need dexopt-wrapper and then execute this.. no reboot, apps keep their classes.dex for the future as well...
Code:
#!/system/bin/sh
J=/system/framework
A=/data/app
W=/system/xbin/dexopt-wrapper
mount -o remount,rw /system /system
mount -o remount,rw /data /data
rm -f $A/*.odex
for i in $A/*
do
name=`basename $i .apk`
$W $A/$name.apk $A/$name.odex $J/core.jar:$J/core-junit.jar:$J/bouncycastle.jar:$J/ext.jar:$J/framework.jar:$J/framework2.jar:$J/android.policy.jar:$J/services.jar:$J/apache-xml.jar
chmod 0644 $A/$name.odex
done
echo $i
sleep 2
exit 0
( and telling me if this stuff does or does not work is NOT off topic ftr )
Click to expand...
Click to collapse
Where do we get a copy of dexopt-wrapper? I downloaded the odex station that has it in the zip you had somewhere, but I get status7 error when flashing it.
Sent from my SPH-D710 using Xparent Blue Tapatalk 2
Just extract the wrapper to xbin and youre gtg
Warning: hideous sig acomin..
Need a change of pace?
Odexing Data with a simple script
or
Change your boot splash-screen in two steps
[VRTHEME][JB 4.1.2 LSx] Change updater-script & installtheme.sh [FOR 2dn ROM Only]
VRTHEME FILES for 2ND ROM ONLY
Original user of S2 I9100 JB 4.1.2 ROM on 2ND ROM, i also want to use Themes and Mods for JB 4.1.2 LSx ROM i found on XDA I9100 threads.
Most are based on http://forum.xda-developers.com/showthread.php?t=1207017 .
To flash them on 2nd ROM, again we have to re-script updater-script and installtheme.sh scripts.
REMEMBER, when we use a 4.1.2 JB ROM as second rom, most of the files which are in /preload/symlink/system/app/* are finaly placed in /data/sec_data/*
so we have to use this PATH in updater-script and installtheme.sh .
In most of the themed ZIP original file we find on XDA, some apks system are in /system/app or /preload/symlink/system/app , be carrefull of this,
in VR-Themed ZIP file we want to moddify for 2nd ROM , sometimes, we have to move /preload/symlink/system/app/xxxxxxxx.apk in /vrtheme/system/app/xxxxxxxx.apk before using it.
so, about using the original VR-Theme or VR-Mod zipped files found on XDA, my different purposes for theming are :
if system files are in /preload/symlink/system/app , they will be themed in /data/sec_data
if system files are in /preload/symlink/system/app , they will be themed in /preload/symlink/system/app (if you use on 1rst ROM)
if system files are in /system/app , they will be themed if they are in /system/app or /data/sec_data/ or /preload/symlink/system/app too
At my sens, the only way to have an error is to put some xxxxxxx.apk folders in /vrtheme/system/app/
which are in fact LNs files in /system/app/ on TEL, (in 2nd ROM, partition /system/ = /preload/ !)
Another way to undertand it, it's that there is no way to destroy symlinked files in /system/app/* (on tel) because no files from /vrtheme/system/app are unknow from you, (the only files we find in are managed by you, by deplacing some themed xxxxxxxx.apk folder from /preload/symplink/system/app, because ROM on TELhave on 2nd ROM too. On another terms too, we can manage apks systems files in /data/sec_data/* instead of /system/app/* (preload/app/*) so only xxxxxxxx.apk directories which are volontary in /vrtheme/system/app/* would be themed in /system/app/ on your 2nd ROM.
for example, flashbarservice.apk can be found sometimes in/system/app and sometimes in /data/sec_data/
Anyway you have to ALWAYS verify the xxxxxxxx.apk directories placement in the Original ZIP Theme or Mod file before flashing it
i think my updater-script and installtheme.sh are also fonctional for apks in /data/app/
Remember that generaly, a file xxxxxxxx.apk is patched on phone only if it exist a ZIP folder named xxxxxxxx.apk in /vrtheme/system/app/, /vrtheme/system/framework/, /vrtheme/preload/symlink/system/app/, /vrtheme/data/app or now /vrtheme/data/sec_data/ , and in the TEL, in /system/app/ , /preload/symlink/system/app/ , /system/framework/ , /data/app/ and /data/sec_data/
Give a try on my sample MIX here : https://mega.co.nz/#F!bhww0QYT!L2cnHS84iZJC7aCvdTmFjg
updater-script and installtheme.sh in attachments are to replace those in your original theme or mod files you find , at the same place which there are , to avoid the desired theme or mod in your 2nd ROM.
(delete ".pdf" at the of name file to use it)
i try to be explicit as i can with my (very limited) bad school english
Thanks.
New Update V2 version of this particular updater-script, only for file which are in \vrtheme\data\sec_data\, (and usual \vrtheme\system\app\ and \vrtheme\system\framework\ for sure)
Version before managed \vrtheme\preload\symlink\system\app\ so it was a waste of space in sdcard, i reduce that because THIS IS only for second rom usage, so update if you use.
lines from new updater-script :
package_extract_dir("vrtheme/data/app", "/sdcard/vrtheme/data/app");
package_extract_dir("vrtheme/data/sec_data", "/sdcard/vrtheme/data/sec_data");
package_extract_dir("vrtheme/system/app", "/sdcard/vrtheme/system/app");
package_extract_dir("vrtheme/system/framework", "/sdcard/vrtheme/system/framework");
NO PRELOD here.
Thanks
toolpack and how to for 2nd ROM ONLY
hope it's the best how too i post for adapt mod and vrtheme for 2nd ROM use !
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
updater-script details :
HTML:
ui_print("");
ui_print(" Mounting Filesystems... ");
mount("ext4", "EMMC", "/dev/block/mmcblk0p9", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p10", "/data");
mount("ext4", "EMMC", "/dev/block/mmcblk0p7", "/cache");
mount("ext4", "EMMC", "/dev/block/mmcblk0p12", "/preload");
ui_print("");
ui_print(" Clearing dalvik-cache... ");
delete_recursive("/data/dalvik-cache");
ui_print("");
ui_print(" Flashing new extra files before vrtheme them... ");
package_extract_dir("system/app", "/system/app");
package_extract_dir("data/sec_data", "/data/sec_data");
package_extract_file("vrtheme/symlink_data-data_sec_to_system_app", "/tmp/symlink_data-data_sec_to_system_app");
set_perm(0, 0, 0777, "/tmp/symlink_data-data_sec_to_system_app");
run_program("/tmp/symlink_data-data_sec_to_system_app");
set_perm_recursive(0, 0, 0755, 0644, "/data/sec_data");
ui_print("......extracting.vrtheme.to.sdcard.....");
package_extract_dir("vrtheme/data/app", "/sdcard/vrtheme/data/app");
package_extract_dir("vrtheme/data/sec_data", "/sdcard/vrtheme/data/sec_data");
package_extract_dir("vrtheme/system/app", "/sdcard/vrtheme/system/app");
package_extract_dir("vrtheme/system/framework", "/sdcard/vrtheme/system/framework");
ui_print("......extracting.files.to.work.....");
package_extract_file("vrtheme/installtheme.sh", "/sdcard/vrtheme/installtheme.sh");
package_extract_file("vrtheme/cleanup.sh", "/sdcard/vrtheme/cleanup.sh");
package_extract_file("vrtheme/zipalign", "/sdcard/vrtheme/zipalign");
package_extract_file("vrtheme/zip", "/sdcard/vrtheme/zip");
set_perm(0, 0, 0755, "/sdcard/vrtheme/installtheme.sh");
set_perm(0, 0, 0755, "/sdcard/vrtheme/cleanup.sh");
set_perm(0, 0, 0755, "/sdcard/vrtheme/zipalign");
set_perm(0, 0, 0755, "/sdcard/vrtheme/zip");
ui_print("..now.patching.with.installthem.sh....");
run_program("/sdcard/vrtheme/installtheme.sh");
ui_print(" Cleaning up... ");
run_program("/sdcard/vrtheme/cleanup.sh");
run_program("/sbin/umount", "/system");
run_program("/sbin/umount", "/data");
run_program("/sbin/umount", "/cache");
run_program("/sbin/umount", "/preload");
Installtheme.sh detail :
HTML:
#!/sbin/sh
# Copyright VillainROM 2011. All Rights Reserved
# cleanup from last time
[ -d /sdcard/vrtheme-backup ] && rm -r /sdcard/vrtheme-backup
# we need to first go through each file in the "app" folder, and for each one present, apply the modified theme to the APK
# let us copy each original APK here first.
echo "Processing /system/app/"
busybox mkdir -p /sdcard/vrtheme-backup/system/app
busybox mkdir -p /sdcard/vrtheme/apply/system/app
cd /sdcard/vrtheme/system/app/
for f in $(ls)
do
echo "Processing $f"
cp /system/app/$f /sdcard/vrtheme/apply/system/app/
cp /system/app/$f /sdcard/vrtheme-backup/system/app/
done
echo "Backups done for system apps"
# repeat for /preload/symlink/system/app now
[ -d /sdcard/vrtheme/preload/symlink/system/app ] && preload=1 || preload=0
if [ "$preload" -eq "1" ]; then
echo "Processing /preload/symlink/system/app/"
busybox mkdir -p /sdcard/vrtheme-backup/preload/symlink/system/app
busybox mkdir -p /sdcard/vrtheme/apply/preload/symlink/system/app
cd /sdcard/vrtheme/preload/symlink/system/app/
for f in $(ls)
do
echo "Processing $f"
cp /preload/symlink/system/app/$f /sdcard/vrtheme/apply/preload/symlink/system/app/
cp /preload/symlink/system/app/$f /sdcard/vrtheme-backup/preload/symlink/system/app/
done
echo "Backups done for preload apps"
fi
# repeat for /system/framework now
[ -d /sdcard/vrtheme/system/framework ] && framework=1 || framework=0
if [ "$framework" -eq "1" ]; then
echo "Processing /system/framework"
busybox mkdir -p /sdcard/vrtheme-backup/system/framework
busybox mkdir -p /sdcard/vrtheme/apply/system/framework
cd /sdcard/vrtheme/system/framework
for f in $(ls)
do
echo "Processing $f"
cp /system/framework/$f /sdcard/vrtheme/apply/system/framework/
cp /system/framework/$f /sdcard/vrtheme-backup/system/framework/
done
echo "Backups done for frameworks"
fi
# repeat for /data/sec_data now
[ -d /sdcard/vrtheme/data/sec_data ] && datasecapps=1 || datasecapps=0
if [ "$datasecapps" -eq "1" ]; then
echo "Processing /data/sec_data/"
busybox mkdir -p /sdcard/vrtheme-backup/data/sec_data/
busybox mkdir -p /sdcard/vrtheme/apply/data/sec_data/
cd /sdcard/vrtheme/data/sec_data/
for f in $(ls)
do
echo "Processing $f"
cp /data/sec_data/$f /sdcard/vrtheme/apply/data/sec_data/
cp /data/sec_data/$f /sdcard/vrtheme-backup/data/sec_data/
done
echo "Backups done for data sec data"
fi
# repeat for /data/app now
[ -d /sdcard/vrtheme/data/app ] && dataapps=1 || dataapps=0
if [ "$dataapps" -eq "1" ]; then
echo "Processing /data/app/"
busybox mkdir -p /sdcard/vrtheme-backup/data/app/
busybox mkdir -p /sdcard/vrtheme/apply/data/app/
cd /sdcard/vrtheme/data/app/
for f in $(ls)
do
echo "Processing $f"
cp /data/app/$f /sdcard/vrtheme/apply/data/app/
cp /data/app/$f /sdcard/vrtheme-backup/data/app/
done
echo "Backups done for data app"
fi
# for each of the system apps needing processed
cd /sdcard/vrtheme/apply/system/app/
for f in $(ls)
do
echo "Working on $f"
cd /sdcard/vrtheme/system/app/$f/
/sdcard/vrtheme/zip -r /sdcard/vrtheme/apply/system/app/$f *
done
echo "Patched system files"
if [ "$preload" -eq "1" ]; then
cd /sdcard/vrtheme/apply/preload/symlink/system/app/
for f in $(ls)
do
echo "Working on $f"
cd /sdcard/vrtheme/preload/symlink/system/app/$f/
/sdcard/vrtheme/zip -r /sdcard/vrtheme/apply/preload/symlink/system/app/$f *
done
echo "Patched preload files"
fi
if [ "$framework" -eq "1" ]; then
cd /sdcard/vrtheme/apply/system/framework
for f in $(ls)
do
echo "Working on $f"
cd /sdcard/vrtheme/system/framework/$f/
/sdcard/vrtheme/zip -r /sdcard/vrtheme/apply/system/framework/$f *
done
echo "Patched framework files"
fi
if [ "$datasecapps" -eq "1" ]; then
cd /sdcard/vrtheme/apply/data/sec_data/
for f in $(ls)
do
echo "Working on $f"
cd /sdcard/vrtheme/data/sec_data/$f/
/sdcard/vrtheme/zip -r /sdcard/vrtheme/apply/data/sec_data/$f *
done
echo "Patched sec data files"
fi
if [ "$dataapps" -eq "1" ]; then
cd /sdcard/vrtheme/apply/data/app/
for f in $(ls)
do
echo "Working on $f"
cd /sdcard/vrtheme/data/app/$f/
/sdcard/vrtheme/zip -r /sdcard/vrtheme/apply/data/app/$f *
done
echo "Patched data app files"
fi
# and now time to zipalign
cd /sdcard/vrtheme/apply/system/app/
busybox mkdir aligned
for f in $(ls)
do
echo "Zipaligning $f"
/sdcard/vrtheme/zipalign -f 4 $f ./aligned/$f
done
if [ "$preload" -eq "1" ]; then
cd /sdcard/vrtheme/apply/preload/symlink/system/app/
busybox mkdir aligned
for f in $(ls)
do
echo "Zipaligning $f"
/sdcard/vrtheme/zipalign -f 4 $f ./aligned/$f
done
fi
if [ "$framework" -eq "1" ]; then
cd /sdcard/vrtheme/apply/system/framework/
busybox mkdir aligned
for f in $(ls)
do
echo "Zipaligning $f"
/sdcard/vrtheme/zipalign -f 4 $f ./aligned/$f
done
fi
if [ "$datasecapps" -eq "1" ]; then
cd /sdcard/vrtheme/apply/data/sec_data/
busybox mkdir aligned
for f in $(ls)
do
echo "Zipaligning $f"
/sdcard/vrtheme/zipalign -f 4 $f ./aligned/$f
done
fi
if [ "$dataapps" -eq "1" ]; then
cd /sdcard/vrtheme/apply/data/app/
busybox mkdir aligned
for f in $(ls)
do
echo "Zipaligning $f"
/sdcard/vrtheme/zipalign -f 4 $f ./aligned/$f
done
fi
# time to now move each new app back to its original location
cd /sdcard/vrtheme/apply/system/app/aligned/
cp * /system/app/
chmod 644 /system/app/*
if [ "$preload" -eq "1" ]; then
cd /sdcard/vrtheme/apply/preload/symlink/system/app/aligned/
cp * /preload/symlink/system/app/
chmod 644 /preload/symlink/system/app/*
fi
if [ "$framework" -eq "1" ]; then
cd /sdcard/vrtheme/apply/system/framework/aligned/
cp * /system/framework/
chmod 644 /system/framework/*
fi
if [ "$datasecapps" -eq "1" ]; then
cd /sdcard/vrtheme/apply/data/sec_data/aligned/
cp * /data/sec_data/
chmod 644 /data/sec_data/*
fi
if [ "$dataapps" -eq "1" ]; then
cd /sdcard/vrtheme/apply/data/app/aligned/
cp * /data/app/
chmod 644 /data/app/*
fi
# Do not remove the credits from this, it's called being a douche
echo "VillainTheme is done"
# we are all done now
Cleanup.sh detail :
#!/sbin/sh
rm -rf /sdcard/vrtheme/
echo "Cleanup complete"
Hi readers !
post 1 updated.
Hi,
i flash many roms and sometimes after new rom flashed , i see dpi preserved my change before flash, even some rom preserve xposed framework still activated...maybe you have experience with some other backup/restore /system files during flash, maybe have you another idea to preserve some stuff.
For my part, i make a new backuptool.sh and backuptool.functions scripts compiled with some i find over roms i tried....
We have:
save dpi
save xposed framework
save addond
i think in red are the line you can personalize, i hope you know what to do with.
backuptool.sh
Code:
#!/sbin/sh
#
# Backup and restore addon /system files
#
export C=/tmp/backup
export S=/system
[COLOR="Red"]export V=what you want[/COLOR]
persist_props="ro.sf.lcd_density"
sysroot="/system"
saveroot="/tmp/save"
# Preserve DPI
save_props()
{
rm -f "$saveroot/prop"
for prop in $persist_props; do
echo "save_props: $prop"
grep "^$prop=" "$sysroot/build.prop" >> "$saveroot/prop"
done
}
# Restore DPI
restore_props()
{
local sedargs
sedargs="-i"
for prop in $(cat $saveroot/prop); do
echo "restore_props: $prop"
k=$(echo $prop | cut -d'=' -f1)
sedargs="$sedargs s/^$k=.*/$prop/"
done
sed $sedargs "$sysroot/build.prop"
}
# Backup Xposed Framework (bin/app_process)
xposed_backup()
{
if [ -f /system/bin/app_process.orig ]
then
cp /system/bin/app_process /tmp/backup/
fi
}
# Restore Xposed Framework (bin/app_process)
xposed_restore()
{
if [ -f /tmp/backup/app_process ]
then
mv /system/bin/app_process /system/bin/app_process.orig
cp /tmp/backup/app_process /system/bin/
fi
}
# Preserve /system/addon.d in /tmp/addon.d
preserve_addon_d() {
mkdir -p /tmp/addon.d/
cp -a /system/addon.d/* /tmp/addon.d/
chmod 755 /tmp/addon.d/*.sh
}
# Restore /system/addon.d in /tmp/addon.d
restore_addon_d() {
cp -a /tmp/addon.d/* /system/addon.d/
rm -rf /tmp/addon.d/
}
[COLOR="Red"]# Proceed only if /system is the expected major and minor version
check_prereq() {
if ( ! grep -q "^ro.cm.version=$V.*" /system/build.prop ); then
echo "Not backing up files from incompatible version: $V"
return 0
fi
return 1
}[/COLOR]
check_blacklist() {
if [ -f /system/addon.d/blacklist ];then
## Discard any known bad backup scripts
cd /$1/addon.d/
for f in *sh; do
s=$(md5sum $f | awk {'print $1'})
grep -q $s /system/addon.d/blacklist && rm -f $f
done
fi
}
check_whitelist() {
found=0
if [ -f /system/addon.d/whitelist ];then
## forcefully keep any version-independent stuff
cd /$1/addon.d/
for f in *sh; do
s=$(md5sum $f | awk {'print $1'})
grep -q $s /system/addon.d/whitelist
if [ $? -eq 0 ]; then
found=1
else
rm -f $f
fi
done
fi
return $found
}
mkdir -p $saveroot
# Execute /system/addon.d/*.sh scripts with $1 parameter
run_stage() {
for script in $(find /tmp/addon.d/ -name '*.sh' |sort -n); do
$script $1
done
}
case "$1" in
backup)
save_props
mkdir -p $C
[COLOR="Red"]# if check_prereq; then[/COLOR]
if check_whitelist system; then
exit 127
fi
[COLOR="Red"]# fi[/COLOR]
check_blacklist system
xposed_backup
preserve_addon_d
run_stage pre-backup
run_stage backup
run_stage post-backup
;;
restore)
restore_props
[COLOR="Red"]# if check_prereq; then[/COLOR]
if check_whitelist tmp; then
exit 127
fi
[COLOR="Red"]# fi[/COLOR]
check_blacklist tmp
xposed_restore
run_stage pre-restore
run_stage restore
run_stage post-restore
restore_addon_d
rm -rf $C
rm -rf /data/data/android.pacstats
sync
;;
*)
echo "Usage: $0 {backup|restore}"
exit 1
esac
exit 0
backuptool.functions
Code:
#!/sbin/sh
#
# Functions for backuptool.sh
#
export C=/tmp/backup
export S=/system
export V=what you want
backup_file() {
if [ -e "$1" ]; then
local F=`basename "$1"`
local D=`dirname "$1"`
# dont backup any apps that have odex files, they are useless
if ( echo "$F" | grep -q "\.apk$" ) && [ -e `echo "$1" | sed -e 's/\.apk$/\.odex/'` ]; then
echo "Skipping odexed apk $1";
else
mkdir -p "$C/$D"
cp -p $1 "$C/$D/$F"
fi
fi
}
restore_file() {
local FILE=`basename "$1"`
local DIR=`dirname "$1"`
if [ -e "$C/$DIR/$FILE" ]; then
if [ ! -d "$DIR" ]; then
mkdir -p "$DIR";
fi
cp -p "$C/$DIR/$FILE" "$1";
if [ -n "$2" ]; then
echo "Deleting obsolete file $2"
rm "$2";
fi
fi
}
the files in attachments. just remove ".txt' at end to use them as well.
thanks.