[Q] Helppppp - XPERIA X8 Q&A, Help & Troubleshooting

i have xperia x8 but call speaker and plug for headphones wont work i

MonsterMkd said:
i have xperia x8 but call speaker and plug for headphones wont work i
Click to expand...
Click to collapse
what have u done with your phone?
upgrade or falling down or what

Also next time you make a thread name it different...(not helpppp,help me. or something similiar)
name it e.g. problem with speaker and headphones...

BlackRabbit1703 said:
what have u done with your phone?
upgrade or falling down or what
Click to expand...
Click to collapse
upgrated to
http://forum.xda-developers.com/showthread.php?t=1898413

MonsterMkd said:
i have xperia x8 but call speaker and plug for headphones wont work
Click to expand...
Click to collapse
Here is the alogcat code when i plug headphone
Code:
--------- beginning of /dev/log/main
I/hal_seport( 1700): Plug has been removed. Resetting system..
I/SystemConnector( 1700): Received connection event from device driver: rid: 50, cco_type: 50, plug_status: 0
E/hal_seport( 1700): hal_seport_enable_vad_detect - Failed to enable VAD button detection
E/hal_seport( 1700): hal_seport_enable_vad_thread - Failed to disable VAD detection
E/hal_seport( 1700): hal_seport_enable_button_thread - Failed to disable AIN detection
E/hal_seport( 1700): hal_seport_enable_vad_detect - Failed to enable VAD button detection
I/hal_seport( 1700): Plug has been detected. Starting thread to do RID polling.
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 171
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 173
I/hal_seport( 1700): Read RID val = 255
I/hal_seport( 1700): Read CCO val = 172
I/SystemConnector( 1700): Received connection event from device driver: rid: 50, cco_type: 50, plug_status: 1
W/SystemConnector( 1700): Unknown accessory attached. Rid: 50, cco_type: 50. Audio not routed to accessory and buttons do not work

MonsterMkd said:
upgrated to
http://forum.xda-developers.com/showthread.php?t=1898413
Click to expand...
Click to collapse
I using this ROM too and never get bug like that
try to install again
flash kernel
wipe dalvik cache, batery stats
factory reset
flash ROM

BlackRabbit1703 said:
I using this ROM too and never get bug like that
try to install again
flash kernel
wipe dalvik cache, batery stats
factory reset
flash ROM
Click to expand...
Click to collapse
i think jack for headphones i burned bicouse one time i have connected to electric power and my outlet booom short circuit......sorry for my bad english

MonsterMkd said:
i think jack for headphones i burned bicouse one time i have connected to electric power and my outlet booom short circuit......sorry for my bad english
Click to expand...
Click to collapse
so u mean that hour headphones was burn?
try to use another jack dude

Related

Pushing for MIUI

Hi all
Tonight (1 Dec) I have time. Lets see how far we can get with MIUI (with whoever is keen).
Check here:
http://forum.xda-developers.com/showthread.php?t=1371428
What my approach this time is is to "dependency inject" MIUI into CM7. That is, start with CM7 base and then add the jars + apks + libs of MIUI from LG's Optimus2X one for one. This is different than starting with MIUI and then changing it with CM files one for one.
Right
Attached is the file list of CM7 nightly and MIUI 1.11.25.
Differences of note:
lgdrmserver
libbridge
liblgdrm
/system/media/gadget files
I'll keep updating on progress! Please do hop on the development, I'm doing all the "beta" testing on my side (thus press thank you and don't post I'll help you test).
Does one need to compile from source <github> or can we just grab files from LG's Optimus2X zip'd MIUI and overwrite the CM7 files? I will also spend some time on this see if I can make some leeway!
Thank you for your help and hard work!!
What does all this mean ?
If I can help with anything? please let me know!! Thanks so much for your efforts!
ssmr2t said:
Thank you for your help and hard work!!
What does all this mean ?
If I can help with anything? please let me know!! Thanks so much for your efforts!
Click to expand...
Click to collapse
Means it might be over your head and should wait till a stable comes out.
Sent from my Inspire
dascope said:
Does one need to compile from source <github> or can we just grab files from LG's Optimus2X zip'd MIUI and overwrite the CM7 files? I will also spend some time on this see if I can make some leeway!
Click to expand...
Click to collapse
Yes, binary files - no compiling. That is, however, what I'm up to.
First up, /system/bin/app_process : zygote, main system daemon.
/system/bin/app_process : No difference in startup.
Next up: framework.jar : The whole platform (will break a lot of things, I'm sure - we'll see)
Ladies and gents, our first boot loop:
W/dalvikvm( 1830): ERROR: Unable to find decl for native Landroid/content/res/AssetManager;.splitThemePackageLjava/lang/String;Ljava/lang/String;[Ljava/lang/StringI
W/dalvikvm( 1830): ERROR: Unable to find decl for native Landroid/content/res/AssetManager;.detachThemePathLjava/lang/String;I)Z
W/dalvikvm( 1830): ERROR: Unable to find decl for native Landroid/content/res/AssetManager;.attachThemePathLjava/lang/StringI
W/dalvikvm( 1830): ERROR: Unable to find decl for native Landroid/content/res/AssetManager;.getBasePackageCount)I
W/dalvikvm( 1830): ERROR: Unable to find decl for native Landroid/content/res/AssetManager;.getBasePackageNameI)Ljava/lang/String;
W/dalvikvm( 1830): ERROR: Unable to find decl for native Landroid/content/res/AssetManager;.getBasePackageIdI)I
W/dalvikvm( 1830): ERROR: Unable to find decl for native Landroid/content/res/AssetManager;.addRedirectionsNativeI)V
W/dalvikvm( 1830): ERROR: Unable to find decl for native Landroid/content/res/AssetManager;.clearRedirectionsNative)V
W/dalvikvm( 1830): ERROR: Unable to find decl for native Landroid/content/res/AssetManager;.generateStyleRedirectionsIII)Z
Seems like a .so that is missing or a .so that needs replacing.
/system/lib/libutils.so is a match - checking.
Solved previous error, now getting this:
I/Netd ( 1741): Netd 1.0 starting
repeatedly.
Getting strace output:
writev(3, [{"\4", 1}, {"Netd\0", 5}, {"Netd 1.0 starting\0", 18}], 3) = 24
brk(0x13000) = 0x13000
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 9
getpid() = 2106
socket(PF_NETLINK, SOCK_DGRAM, 15) = 10
setsockopt(10, SOL_SOCKET, 0x21 /* SO_??? */, [65536], 4) = 0
setsockopt(10, SOL_SOCKET, SO_PASSCRED, [1], 4) = 0
bind(10, {sa_family=AF_NETLINK, pid=2106, groups=ffffffff}, 12) = 0
mmap2(NULL, 69632, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40009000
getsockopt(10, SOL_SOCKET, SO_PEERCRED, "\0\0\0\0��������", [12]) = 0
pipe([11, 12]) = 0
mmap2(0x10000000, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000000
mprotect(0x10000000, 4096, PROT_NONE) = 0
clone(Process 2108 attached
child_stack=0x100fff00, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_DETACHED) = 2108
[pid 2106] writev(6, [{"\6", 1}, {"SocketListener\0", 15}, {"Obtaining file descriptor socket"..., 79}], 3) = 95
[pid 2106] writev(3, [{"\6", 1}, {"Netd\0", 5}, {"Unable to start DnsProxyListener"..., 61}], 3) = 67
Not entirely helpful. Sockets for system services are normally "premade" in Android in the init.rc file. Will look around, otherwise will check for MIUI version.
service zygote /system/xbin/strace -f -tt -o /cache/debug/boot.strace /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
Will make strace put out debug of zygote.
Yay for more debug...
No help, make strace of just netd be put out. Argh.
Code:
1697 19:43:35.612710 open("/dev/log/main", O_WRONLY) = 3
1697 19:43:35.612897 open("/dev/log/radio", O_WRONLY) = 4
1697 19:43:35.613083 open("/dev/log/events", O_WRONLY) = 5
1697 19:43:35.625796 open("/dev/log/system", O_WRONLY) = 6
1697 19:43:35.626018 writev(3, [{"\4", 1}, {"Netd\0", 5}, {"Netd 1.0 starting\0", 18}], 3) = 24
1697 19:43:35.626365 brk(0x13000) = 0x13000
1697 19:43:35.626509 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 7
1697 19:43:35.626663 getpid() = 1697
1697 19:43:35.626785 socket(PF_NETLINK, SOCK_DGRAM, 15) = 11
1697 19:43:35.626952 setsockopt(11, SOL_SOCKET, 0x21 /* SO_??? */, [65536], 4) = 0
1697 19:43:35.627099 setsockopt(11, SOL_SOCKET, SO_PASSCRED, [1], 4) = 0
1697 19:43:35.627234 bind(11, {sa_family=AF_NETLINK, pid=1697, groups=ffffffff}, 12) = 0
1697 19:43:35.627397 mmap2(NULL, 69632, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40009000
1697 19:43:35.627557 getsockopt(11, SOL_SOCKET, SO_PEERCRED, "\0\0\0\0��������", [12]) = 0
1697 19:43:35.627718 pipe([12, 13]) = 0
1697 19:43:35.627891 mmap2(0x10000000, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000000
1697 19:43:35.628027 mprotect(0x10000000, 4096, PROT_NONE) = 0
1697 19:43:35.628173 clone(child_stack=0x100fff00, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_DETACHED) = 1698
1697 19:43:35.628371 listen(9, 4) = 0
1697 19:43:35.628495 pipe([14, 15]) = 0
1697 19:43:35.628648 mmap2(0x10000000, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x4001a000
1697 19:43:35.628782 mprotect(0x4001a000, 4096, PROT_NONE) = 0
1697 19:43:35.628923 clone(child_stack=0x40119f00, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_DETACHED) = 1699
1697 19:43:35.629080 listen(10, 4) = 0
1697 19:43:35.629203 pipe([16, 17]) = 0
1697 19:43:35.629356 mmap2(0x10000000, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x4011a000
1697 19:43:35.629521 mprotect(0x4011a000, 4096, PROT_NONE) = 0
1697 19:43:35.629667 clone(child_stack=0x40219f00, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_DETACHED) = 1700
1697 19:43:35.629820 nanosleep({1000, 0}, <unfinished ...>
1698 19:43:35.629966 syscall_983045(0x100fff00, 0x125c8, 0, 0x40, 0x100fff00, 0xaef01e71, 0x40009008, 0xf0005, 0x10000000, 0xaef01e71, 0x100000, 0x40009008, 0, 0x100ffee8, 0xafd120a0, 0xafd0c80c, 0x60000010, 0x100fff00, 0xb729, 0x7665642f, 0x676f6c2f, 0x7379732f, 0x6d6574, 0x64544800, 0x64696f72, 0x6f732e, 0, 0x6f, 0, 0, 0, 0) = 0
1698 19:43:35.630125 select(13, [11 12], NULL, NULL, NULL <unfinished ...>
1699 19:43:35.630262 syscall_983045(0x40119f00, 0x12728, 0, 0x40, 0x40119f00, 0xaef01e71, 0x12678, 0xf0005, 0x4001a000, 0xaef01e71, 0x100000, 0x12678, 0, 0x40119ee8, 0xafd120a0, 0xafd0c80c, 0x60000010, 0x40119f00, 0xb729, 0x7665642f, 0x676f6c2f, 0x7379732f, 0x6d6574, 0x64544800, 0x64696f72, 0x6f732e, 0, 0x6f, 0, 0, 0, 0) = 0
1699 19:43:35.630421 select(15, [9 14], NULL, NULL, NULL <unfinished ...>
1700 19:43:35.630553 syscall_983045(0x40219f00, 0x12768, 0, 0x40, 0x40219f00, 0xaef01e71, 0x112d8, 0xf0005, 0x4011a000, 0xaef01e71, 0x100000, 0x112d8, 0, 0x40219ee8, 0xafd120a0, 0xafd0c80c, 0x60000010, 0x40219f00, 0xb729, 0x7665642f, 0x676f6c2f, 0x7379732f, 0x6d6574, 0x64544800, 0x64696f72, 0x6f732e, 0, 0x6f, 0, 0, 0, 0) = 0
1700 19:43:35.630712 select(17, [10 16], NULL, NULL, NULLULL^C
Before netd fs off into oblivion.
Right, replacing netd then. Not keen - this is suppose to work out of the box.
Did not help. What I can gather:
It loads its libraries fine, and then starts to listen for a connection. Then, a system call syscall_983045 goes unfinished.
Prompting the crash in netd.
Library dependencies for netd seems (so far from strace):
c,sysutils,log,stdc++,m,cutils,netutils,crypto,z,hardware_legacy,utils,binder,wpa_client,bluedroid
Guessing who is the culprit:
Not c (C lib),stdc++ (standard c++ lib),wpa_client(WiFi),bluedroid (BT),hardware_legacy (lights),log (log),m (math), z (compression),crypto (crypto)
Either cutils, sysutils, netutils, binder
Utils ldd:
arm-none-eabi-ld: warning: libz.so, needed by libutils.so, not found (try using -rpath or -rpath-link)
arm-none-eabi-ld: warning: liblog.so, needed by libutils.so, not found (try using -rpath or -rpath-link)
arm-none-eabi-ld: warning: libcutils.so, needed by libutils.so, not found (try using -rpath or -rpath-link)
arm-none-eabi-ld: warning: libc.so, needed by libutils.so, not found (try using -rpath or -rpath-link)
arm-none-eabi-ld: warning: libstdc++.so, needed by libutils.so, not found (try using -rpath or -rpath-link)
arm-none-eabi-ld: warning: libm.so, needed by libutils.so, not found (try using -rpath or -rpath-link)
arm-none-eabi-ld: warning: cannot find entry symbol _start; defaulting to 00008188
Replacing liblog and libcutils with MIUI versions. Lets have a look what breaks next
liblog added the following error:
1973 20:13:37.926040 open("/dev/log/libra", O_WRONLY) = -1 ENOENT (No such file or directory)
Still no change in netd.
Trying libc, see if netd will budge
Googled for syscall_983045
Apparently used to spawn a service. Part of binder.
Replacing binder as well. Crikey
Well if things break due to syscalls not going through, then we've hit a snag on kernel levels.
Anyone got privy on where they hide the MIUI Optimus 2X kernel source?

[Q] How to create an image from a stock KDZ file for nvflashing

Good day to all dev and to the community,
first of, i know this is not the right thread to post but im kinda desperate now.
i purchase a phone which is optimus ex su880 (nearest family is su660)
i tried updating using the LG updater but unfortunately i bricked my phone.
right now, i can no longer boot to S/w / normal mode and my only solution is to flash it via NVflash.
but my problem is, because of the lack of support for this phone. i cant find any image or .bat file to re install the ICS rom back.
now, my question is if we can create a .bat file/image from a Stock KDZ rom?
i can boot to APX but i have no firmware to flash.
your exeperties is highly appreciated.
i already spent 3 days looking for an answer but to no avail...hope you can enlighten me.
Hi alamatnitotoy,
seems that you have to deal with Tegra 250 AP20H a.k.a. Ventana.
In the first place, have you managed to read your partition table?
Can you send me link where I can download the rom for your phone?
Edit: I managed to download v10m kdz. I am flashing to my p990. Hopefuly i could get the necessary files this way to make you an nvflash rom
Edit2: Download my attachment, please. Extract the rar, then run flash.bat. It should flash the bootloader to your phone after that you can put your phone into S/W download mode to flash any original rom.
I hope it is going to work.
thanks
thank you very much sir.. you save my day...
Click, click, click....
How to create, or, can you create it for me?
tryin said:
Click, click, click....
How to create, or, can you create it for me?
Click to expand...
Click to collapse
If you have su880 it will work for you as well, but if your partition layout got damaged it won't.
When I get home I will make a tutorial how to obtain bootloader.
bitdomo said:
If you have su880 it will work for you as well, but if your partition layout got damaged it won't.
When I get home I will make a tutorial how to obtain bootloader.
Click to expand...
Click to collapse
No no sorry, I have been misunderstood, I wanted to say that this posts don't explain how to create an nvflash image from a stock KDZ file, but only have the solution handed on a plate, or better, in an archive , which is not very educational I think...
But if all goes well for alamatnitotoy....
Thanks anyway for your thought, don't worry...
Well, let the tutorial begin!
Download a kdz rom. In my case I downloaded v10m
Download AIO-toolkit for p990
Start AIO-toolkit select option number 5, then select option number 1. Drag and drop the kdz file to the AIO-toolkit window and hit enter. It will convert the kdz file into smartflash format. When the process finished (the smartflash files are in the root directory of the AIO-toolkit in the v10m folder), you can choose to extract the smartflash file. Choose yes. Then select option number 2. On the next screen select option A or E, it does not matter which you choose because the partitions are in a different order in a su880 smartflash file. So, you have to figure out which partition is which after the extraction. I choosed option A. The extracted files will be in the root directory of AIO-toolkit in the extracted_files folder.
Compare the extracted files with any other bootloader file from p990 or su660 to find out which file is the bootloader, but hopefully the file named bootloader.img is truly the bootlader.
SU880 is the brother phone of P990 and SU660, therefore I suggested that the bootloader partition for SU880 is the 4th partition just like for SU660 and P990
Open bootloader.img in hex editor, delete the bunch of FF hex values from the end of the file then save it.
Now you have to download nvflash and copy the bootloader.img to the nvflash folder.
Create a flash.bat file. fill it with this content:
Code:
nvflash.exe --bl bootloader.img --download 4 bootloader.img
Connet your phone in nvflash mode
Double click on flash.bat and hope the best
After the flashing is done restart your phone to S/W download mode and smartflash the previously converted rom to smarthflash format
Now you have a working su880 with a bootloader which you can use with nvflash
To create an nvflash rom, you need the following files:
bootloader (we have it already)
partition table configuration file
bct file (Binary Configuration Table)
system.img
boot.img (kernel)
recovery.img
Obtaining partition table:
Connect phone in nvflash mode and run nvflash with the following command:
Code:
nvflash.exe --bl bootloader.img --getpartitiontable su880_pt_table.txt
Now you have to convert it by hand to a partition config file. Use su660 or p990 config files as a sample to create it for su880.
Rename the file to partition.cfg
The rest of the files:
You have 2 ways to get the rest of the files by figuring out which extraded files are which files, or use nvflash.
If you choose nvflash then you can read back the partitions from your phone to your computer by this command:
Code:
nvflash.exe --bl bootloader.img --read N FILENAME
N is for the number of the partition and FILENAME is for the name of the file you want to save. After the firt partition read use this command to save the rest of the partitions
Code:
nvflash.exe -r --download N FILENAME
Check the partition config file for which partition has which number.
Name of the partition you need:
APP: system.img
LNX: boot.img (kernel)
SOS: recovery.img
When you read back all partition on the list above (or figured whcih extracted partition file is which partition) then you have to obtain the bct file.
Obtaining bct file:
Run nvflash with this command:
Code:
nvflash.exe --bct su880.bct --getbct --bl bootloader.img
After the command got execudet you will have the btc file on your computer.
Now you have everything. Just one thing left.
Create a flash.bat file and fill it with this content:
Code:
nvflash.exe --bct su880.bct --setbct --odmdata 0xC8000 --configfile partition.cfg --create --bl bootloader.img --go
I haven't tested it yet, because I don't have su880 phone. The only thing which bothers is that I am not 100% sure that my partition config file is correct. I am uploading my work, maybe you can test, but there is a high chance it will brick your phone. I beleive you can still smartflash any rom if you try it and it bricks your phone. I tried it on my p990 just for testing every script is written correctly and I don't made a typo. So it flashed correctly, but since my phone is not a su880 I can not tell is it going to work.
Finally my work is uploaded. Download here
Very good work bitdomo!
Sure very instructive!
Only one question, what's the meaning of
Code:
--odmdata 0xC8000
? Why that address?
tryin said:
Very good work bitdomo!
Sure very instructive!
Only one question, what's the meaning of
Code:
--odmdata 0xC8000
? Why that address?
Click to expand...
Click to collapse
Actually I don't know what is that, I would love to know it as well. This addres is there in every nvflash rom for su660 and p990. To get this information you have to extract the bct file.
The program which extract bct file is here. You have to compile it on linux. At the end of this read me there is an example how to use this program.
Performing that command for su880.btc will lead you to a file like this:
Code:
Version = 0x00020001;
BlockSize = 0x00004000;
PageSize = 0x00000200;
PartitionSize = 0x01000000;
OdmData = 0x000c8000;
# Bootloader used = 1;
# Bootloaders max = 4;
# BCT size = 4080;
# Hash size = 16;
# Crypto offset = 16;
# Crypto length = 4064;
# Max BCT search blocks = 64;
#
# These values are set by cbootimage using the
# bootloader provided by the Bootloader=...
# configuration option.
#
# Bootloader[0].Version = 0x00000001;
# Bootloader[0].Start block = 384;
# Bootloader[0].Start page = 0;
# Bootloader[0].Length = 923444;
# Bootloader[0].Load address = 0x00108000;
# Bootloader[0].Entry point = 0x00108000;
# Bootloader[0].Attributes = 0x00000004;
SDRAM[0].MemoryType = NvBootMemoryType_LpDdr2;
SDRAM[0].PllMChargePumpSetupControl = 0x00000008;
SDRAM[0].PllMLoopFilterSetupControl = 0x00000000;
SDRAM[0].PllMInputDivider = 0x0000000c;
SDRAM[0].PllMFeedbackDivider = 0x000002f8;
SDRAM[0].PllMPostDivider = 0x00000000;
SDRAM[0].PllMStableTime = 0x0000012c;
SDRAM[0].EmcClockDivider = 0x00000001;
SDRAM[0].EmcAutoCalInterval = 0x00000000;
SDRAM[0].EmcAutoCalConfig = 0xe0a61111;
SDRAM[0].EmcAutoCalWait = 0x00000000;
SDRAM[0].EmcPinProgramWait = 0x00000000;
SDRAM[0].EmcRc = 0x00000017;
SDRAM[0].EmcRfc = 0x00000032;
SDRAM[0].EmcRas = 0x00000010;
SDRAM[0].EmcRp = 0x00000007;
SDRAM[0].EmcR2w = 0x00000008;
SDRAM[0].EmcW2r = 0x00000005;
SDRAM[0].EmcR2p = 0x00000003;
SDRAM[0].EmcW2p = 0x0000000b;
SDRAM[0].EmcRrd = 0x00000004;
SDRAM[0].EmcRdRcd = 0x00000007;
SDRAM[0].EmcWrRcd = 0x00000007;
SDRAM[0].EmcRext = 0x00000003;
SDRAM[0].EmcWdv = 0x00000003;
SDRAM[0].EmcQUseExtra = 0x00000006;
SDRAM[0].EmcQUse = 0x00000007;
SDRAM[0].EmcQRst = 0x00000004;
SDRAM[0].EmcQSafe = 0x0000000a;
SDRAM[0].EmcRdv = 0x0000000e;
SDRAM[0].EmcRefresh = 0x0000059f;
SDRAM[0].EmcBurstRefreshNum = 0x00000000;
SDRAM[0].EmcPdEx2Wr = 0x00000004;
SDRAM[0].EmcPdEx2Rd = 0x00000004;
SDRAM[0].EmcPChg2Pden = 0x00000007;
SDRAM[0].EmcAct2Pden = 0x00000008;
SDRAM[0].EmcAr2Pden = 0x00000001;
SDRAM[0].EmcRw2Pden = 0x00000011;
SDRAM[0].EmcTxsr = 0x00000036;
SDRAM[0].EmcTcke = 0x00000003;
SDRAM[0].EmcTfaw = 0x00000013;
SDRAM[0].EmcTrpab = 0x00000008;
SDRAM[0].EmcTClkStable = 0x00000007;
SDRAM[0].EmcTClkStop = 0x00000002;
SDRAM[0].EmcTRefBw = 0x0000062d;
SDRAM[0].EmcFbioCfg1 = 0x00000000;
SDRAM[0].EmcFbioDqsibDlyMsb = 0x00000000;
SDRAM[0].EmcFbioDqsibDly = 0x2c2c2c2c;
SDRAM[0].EmcFbioQuseDlyMsb = 0x00000000;
SDRAM[0].EmcFbioQuseDly = 0x14141414;
SDRAM[0].EmcFbioCfg5 = 0x00000282;
SDRAM[0].EmcFbioCfg6 = 0x00000003;
SDRAM[0].EmcFbioSpare = 0x00000000;
SDRAM[0].EmcMrsResetDllWait = 0x00000000;
SDRAM[0].EmcMrsResetDll = 0x00000000;
SDRAM[0].EmcMrsDdr2DllReset = 0x00000000;
SDRAM[0].EmcMrs = 0x00000000;
SDRAM[0].EmcEmrsEmr2 = 0x00000000;
SDRAM[0].EmcEmrsEmr3 = 0x00000000;
SDRAM[0].EmcEmrsDdr2DllEnable = 0x00000000;
SDRAM[0].EmcEmrsDdr2OcdCalib = 0x00000000;
SDRAM[0].EmcEmrs = 0x00000000;
SDRAM[0].EmcMrw1 = 0x0001008a;
SDRAM[0].EmcMrw2 = 0x00020004;
SDRAM[0].EmcMrw3 = 0x00030002;
SDRAM[0].EmcMrwResetCommand = 0x003f0000;
SDRAM[0].EmcMrwResetNInitWait = 0x0000000a;
SDRAM[0].EmcAdrCfg1 = 0x00070303;
SDRAM[0].EmcAdrCfg = 0x01070303;
SDRAM[0].McEmemCfg = 0x00100000;
SDRAM[0].McLowLatencyConfig = 0x80000003;
SDRAM[0].EmcCfg2 = 0x00000403;
SDRAM[0].EmcCfgDigDll = 0xf0000413;
SDRAM[0].EmcCfgClktrim0 = 0x00000000;
SDRAM[0].EmcCfgClktrim1 = 0x00000000;
SDRAM[0].EmcCfgClktrim2 = 0x00000000;
SDRAM[0].EmcCfg = 0x0001ff00;
SDRAM[0].EmcDbg = 0x01000020;
SDRAM[0].AhbArbitrationXbarCtrl = 0x00010000;
SDRAM[0].EmcDllXformDqs = 0x00000010;
SDRAM[0].EmcDllXformQUse = 0x00000008;
SDRAM[0].WarmBootWait = 0x00000001;
SDRAM[0].EmcCttTermCtrl = 0x00000802;
SDRAM[0].EmcOdtWrite = 0x00000000;
SDRAM[0].EmcOdtRead = 0x00000000;
SDRAM[0].EmcZcalRefCnt = 0x00000000;
SDRAM[0].EmcZcalWaitCnt = 0x00000023;
SDRAM[0].EmcZcalMrwCmd = 0x000a0056;
SDRAM[0].EmcMrwZqInitDev0 = 0x800a00ff;
SDRAM[0].EmcMrwZqInitDev1 = 0x400a00ff;
SDRAM[0].EmcMrwZqInitWait = 0x00000001;
SDRAM[0].EmcDdr2Wait = 0x00000000;
SDRAM[0].PmcDdrPwr = 0x00000000;
SDRAM[0].ApbMiscGpXm2CfgAPadCtrl = 0x77ffc000;
SDRAM[0].ApbMiscGpXm2CfgCPadCtrl2 = 0x08080040;
SDRAM[0].ApbMiscGpXm2CfgCPadCtrl = 0x77fffff8;
SDRAM[0].ApbMiscGpXm2CfgDPadCtrl2 = 0x00000000;
SDRAM[0].ApbMiscGpXm2CfgDPadCtrl = 0x77fffff8;
SDRAM[0].ApbMiscGpXm2ClkCfgPadCtrl = 0x77ffc000;
SDRAM[0].ApbMiscGpXm2CompPadCtrl = 0x01f1f008;
SDRAM[0].ApbMiscGpXm2VttGenPadCtrl = 0x00005500;
For p990:
Code:
Version = 0x00020001;
BlockSize = 0x00004000;
PageSize = 0x00000200;
PartitionSize = 0x01000000;
OdmData = 0x000c8000;
# Bootloader used = 0;
# Bootloaders max = 4;
# BCT size = 4080;
# Hash size = 16;
# Crypto offset = 16;
# Crypto length = 4064;
# Max BCT search blocks = 64;
DevType[0] = NvBootDevType_Sdmmc;
DeviceParam[0].SdmmcParams.ClockDivider = 0x0000000c;
DeviceParam[0].SdmmcParams.DataWidth = NvBootSdmmcDataWidth_8Bit;
DeviceParam[0].SdmmcParams.MaxPowerClassSupported = 0x00000000;
DevType[1] = NvBootDevType_Sdmmc;
DeviceParam[1].SdmmcParams.ClockDivider = 0x0000000c;
DeviceParam[1].SdmmcParams.DataWidth = NvBootSdmmcDataWidth_8Bit;
DeviceParam[1].SdmmcParams.MaxPowerClassSupported = 0x00000000;
DevType[2] = NvBootDevType_Sdmmc;
DeviceParam[2].SdmmcParams.ClockDivider = 0x0000000c;
DeviceParam[2].SdmmcParams.DataWidth = NvBootSdmmcDataWidth_8Bit;
DeviceParam[2].SdmmcParams.MaxPowerClassSupported = 0x00000000;
DevType[3] = NvBootDevType_Sdmmc;
DeviceParam[3].SdmmcParams.ClockDivider = 0x0000000c;
DeviceParam[3].SdmmcParams.DataWidth = NvBootSdmmcDataWidth_8Bit;
DeviceParam[3].SdmmcParams.MaxPowerClassSupported = 0x00000000;
SDRAM[0].MemoryType = NvBootMemoryType_LpDdr2;
SDRAM[0].PllMChargePumpSetupControl = 0x00000008;
SDRAM[0].PllMLoopFilterSetupControl = 0x00000000;
SDRAM[0].PllMInputDivider = 0x0000000c;
SDRAM[0].PllMFeedbackDivider = 0x00000258;
SDRAM[0].PllMPostDivider = 0x00000000;
SDRAM[0].PllMStableTime = 0x0000012c;
SDRAM[0].EmcClockDivider = 0x00000001;
SDRAM[0].EmcAutoCalInterval = 0x00000000;
SDRAM[0].EmcAutoCalConfig = 0xe0a61111;
SDRAM[0].EmcAutoCalWait = 0x00000000;
SDRAM[0].EmcPinProgramWait = 0x00000000;
SDRAM[0].EmcRc = 0x00000012;
SDRAM[0].EmcRfc = 0x00000027;
SDRAM[0].EmcRas = 0x0000000d;
SDRAM[0].EmcRp = 0x00000006;
SDRAM[0].EmcR2w = 0x00000007;
SDRAM[0].EmcW2r = 0x00000005;
SDRAM[0].EmcR2p = 0x00000003;
SDRAM[0].EmcW2p = 0x0000000b;
SDRAM[0].EmcRrd = 0x00000003;
SDRAM[0].EmcRdRcd = 0x00000006;
SDRAM[0].EmcWrRcd = 0x00000006;
SDRAM[0].EmcRext = 0x00000003;
SDRAM[0].EmcWdv = 0x00000003;
SDRAM[0].EmcQUseExtra = 0x00000006;
SDRAM[0].EmcQUse = 0x00000007;
SDRAM[0].EmcQRst = 0x00000004;
SDRAM[0].EmcQSafe = 0x00000009;
SDRAM[0].EmcRdv = 0x0000000d;
SDRAM[0].EmcRefresh = 0x0000045f;
SDRAM[0].EmcBurstRefreshNum = 0x00000000;
SDRAM[0].EmcPdEx2Wr = 0x00000004;
SDRAM[0].EmcPdEx2Rd = 0x00000004;
SDRAM[0].EmcPChg2Pden = 0x00000006;
SDRAM[0].EmcAct2Pden = 0x00000008;
SDRAM[0].EmcAr2Pden = 0x00000001;
SDRAM[0].EmcRw2Pden = 0x0000000f;
SDRAM[0].EmcTxsr = 0x0000002a;
SDRAM[0].EmcTcke = 0x00000003;
SDRAM[0].EmcTfaw = 0x0000000f;
SDRAM[0].EmcTrpab = 0x00000007;
SDRAM[0].EmcTClkStable = 0x00000007;
SDRAM[0].EmcTClkStop = 0x00000002;
SDRAM[0].EmcTRefBw = 0x000004e0;
SDRAM[0].EmcFbioCfg1 = 0x00000000;
SDRAM[0].EmcFbioDqsibDlyMsb = 0x00000000;
SDRAM[0].EmcFbioDqsibDly = 0x34343434;
SDRAM[0].EmcFbioQuseDlyMsb = 0x00000000;
SDRAM[0].EmcFbioQuseDly = 0x00000000;
SDRAM[0].EmcFbioCfg5 = 0x00000282;
SDRAM[0].EmcFbioCfg6 = 0x00000002;
SDRAM[0].EmcFbioSpare = 0x00000000;
SDRAM[0].EmcMrsResetDllWait = 0x00000000;
SDRAM[0].EmcMrsResetDll = 0x00000000;
SDRAM[0].EmcMrsDdr2DllReset = 0x00000000;
SDRAM[0].EmcMrs = 0x00000000;
SDRAM[0].EmcEmrsEmr2 = 0x00000000;
SDRAM[0].EmcEmrsEmr3 = 0x00000000;
SDRAM[0].EmcEmrsDdr2DllEnable = 0x00000000;
SDRAM[0].EmcEmrsDdr2OcdCalib = 0x00000000;
SDRAM[0].EmcEmrs = 0x00000000;
SDRAM[0].EmcMrw1 = 0x0001008a;
SDRAM[0].EmcMrw2 = 0x00020004;
SDRAM[0].EmcMrw3 = 0x00030002;
SDRAM[0].EmcMrwResetCommand = 0x003f0000;
SDRAM[0].EmcMrwResetNInitWait = 0x0000000a;
SDRAM[0].EmcAdrCfg1 = 0x00060302;
SDRAM[0].EmcAdrCfg = 0x01060302;
SDRAM[0].McEmemCfg = 0x00080000;
SDRAM[0].McLowLatencyConfig = 0x80000003;
SDRAM[0].EmcCfg2 = 0x00000403;
SDRAM[0].EmcCfgDigDll = 0xe0000413;
SDRAM[0].EmcCfgClktrim0 = 0x00000000;
SDRAM[0].EmcCfgClktrim1 = 0x00000000;
SDRAM[0].EmcCfgClktrim2 = 0x00000000;
SDRAM[0].EmcCfg = 0x0001ff00;
SDRAM[0].EmcDbg = 0x01000020;
SDRAM[0].AhbArbitrationXbarCtrl = 0x00010000;
SDRAM[0].EmcDllXformDqs = 0x00000010;
SDRAM[0].EmcDllXformQUse = 0x00000008;
SDRAM[0].WarmBootWait = 0x00000001;
SDRAM[0].EmcCttTermCtrl = 0x00000802;
SDRAM[0].EmcOdtWrite = 0x00000000;
SDRAM[0].EmcOdtRead = 0x00000000;
SDRAM[0].EmcZcalRefCnt = 0x00000000;
SDRAM[0].EmcZcalWaitCnt = 0x0000001b;
SDRAM[0].EmcZcalMrwCmd = 0x000a0056;
SDRAM[0].EmcMrwZqInitDev0 = 0x800a00ff;
SDRAM[0].EmcMrwZqInitDev1 = 0x400a00ff;
SDRAM[0].EmcMrwZqInitWait = 0x00000001;
SDRAM[0].EmcDdr2Wait = 0x00000000;
SDRAM[0].PmcDdrPwr = 0x00000000;
SDRAM[0].ApbMiscGpXm2CfgAPadCtrl = 0x77ffc000;
SDRAM[0].ApbMiscGpXm2CfgCPadCtrl2 = 0x08080040;
SDRAM[0].ApbMiscGpXm2CfgCPadCtrl = 0x77fffff8;
SDRAM[0].ApbMiscGpXm2CfgDPadCtrl2 = 0x00000000;
SDRAM[0].ApbMiscGpXm2CfgDPadCtrl = 0x77fffff8;
SDRAM[0].ApbMiscGpXm2ClkCfgPadCtrl = 0x77ffc000;
SDRAM[0].ApbMiscGpXm2CompPadCtrl = 0x01f1f008;
SDRAM[0].ApbMiscGpXm2VttGenPadCtrl = 0x00005500;
If you check the begining of the su880.bct config you can see the odmdata is the same as in the p990.bct config.
That is why I put that --odmdata 0xc8000.
I downloaded bct_dump some time ago, from here, but this is my BCT file:
Version = 0x00020001;
BlockSize = 0x00004000;
PageSize = 0x00000200;
PartitionSize = 0x01000000;
# Bootloader used = 1;
# Bootloaders max = 4;
# BCT size = 4080;
# Hash size = 16;
# Crypto offset = 16;
# Crypto length = 4064;
# Max BCT search blocks = 64;
#
# These values are set by cbootimage using the
# bootloader provided by the Bootloader=...
# configuration option.
#
# Bootloader[0].Version = 0x00000001;
# Bootloader[0].Start block = 288;
# Bootloader[0].Start page = 0;
# Bootloader[0].Length = 891020;
# Bootloader[0].Load address = 0x00108000;
# Bootloader[0].Entry point = 0x00108000;
# Bootloader[0].Attributes = 0x00000004;
DevType[0] = NvBootDevType_Sdmmc;
DeviceParam[0].SdmmcParams.ClockDivider = 0x0000000c;
DeviceParam[0].SdmmcParams.DataWidth = NvBootSdmmcDataWidth_8Bit;
DeviceParam[0].SdmmcParams.MaxPowerClassSupported = 0x00000000;
DevType[1] = NvBootDevType_Sdmmc;
DeviceParam[1].SdmmcParams.ClockDivider = 0x0000000c;
DeviceParam[1].SdmmcParams.DataWidth = NvBootSdmmcDataWidth_8Bit;
DeviceParam[1].SdmmcParams.MaxPowerClassSupported = 0x00000000;
DevType[2] = NvBootDevType_Sdmmc;
DeviceParam[2].SdmmcParams.ClockDivider = 0x0000000c;
DeviceParam[2].SdmmcParams.DataWidth = NvBootSdmmcDataWidth_8Bit;
DeviceParam[2].SdmmcParams.MaxPowerClassSupported = 0x00000000;
DevType[3] = NvBootDevType_Sdmmc;
DeviceParam[3].SdmmcParams.ClockDivider = 0x0000000c;
DeviceParam[3].SdmmcParams.DataWidth = NvBootSdmmcDataWidth_8Bit;
DeviceParam[3].SdmmcParams.MaxPowerClassSupported = 0x00000000;
SDRAM[0].MemoryType = NvBootMemoryType_LpDdr2;
SDRAM[0].PllMChargePumpSetupControl = 0x00000008;
SDRAM[0].PllMLoopFilterSetupControl = 0x00000000;
SDRAM[0].PllMInputDivider = 0x0000000c;
SDRAM[0].PllMFeedbackDivider = 0x00000258;
SDRAM[0].PllMPostDivider = 0x00000000;
SDRAM[0].PllMStableTime = 0x0000012c;
SDRAM[0].EmcClockDivider = 0x00000001;
SDRAM[0].EmcAutoCalInterval = 0x00000000;
SDRAM[0].EmcAutoCalConfig = 0xe0a61111;
SDRAM[0].EmcAutoCalWait = 0x00000000;
SDRAM[0].EmcPinProgramWait = 0x00000000;
SDRAM[0].EmcRc = 0x00000012;
SDRAM[0].EmcRfc = 0x00000027;
SDRAM[0].EmcRas = 0x0000000d;
SDRAM[0].EmcRp = 0x00000006;
SDRAM[0].EmcR2w = 0x00000007;
SDRAM[0].EmcW2r = 0x00000005;
SDRAM[0].EmcR2p = 0x00000003;
SDRAM[0].EmcW2p = 0x0000000b;
SDRAM[0].EmcRrd = 0x00000003;
SDRAM[0].EmcRdRcd = 0x00000006;
SDRAM[0].EmcWrRcd = 0x00000006;
SDRAM[0].EmcRext = 0x00000003;
SDRAM[0].EmcWdv = 0x00000003;
SDRAM[0].EmcQUseExtra = 0x00000006;
SDRAM[0].EmcQUse = 0x00000007;
SDRAM[0].EmcQRst = 0x00000004;
SDRAM[0].EmcQSafe = 0x00000009;
SDRAM[0].EmcRdv = 0x0000000d;
SDRAM[0].EmcRefresh = 0x0000045f;
SDRAM[0].EmcBurstRefreshNum = 0x00000000;
SDRAM[0].EmcPdEx2Wr = 0x00000004;
SDRAM[0].EmcPdEx2Rd = 0x00000004;
SDRAM[0].EmcPChg2Pden = 0x00000006;
SDRAM[0].EmcAct2Pden = 0x00000008;
SDRAM[0].EmcAr2Pden = 0x00000001;
SDRAM[0].EmcRw2Pden = 0x0000000f;
SDRAM[0].EmcTxsr = 0x0000002a;
SDRAM[0].EmcTcke = 0x00000003;
SDRAM[0].EmcTfaw = 0x0000000f;
SDRAM[0].EmcTrpab = 0x00000007;
SDRAM[0].EmcTClkStable = 0x00000007;
SDRAM[0].EmcTClkStop = 0x00000002;
SDRAM[0].EmcTRefBw = 0x000004e0;
SDRAM[0].EmcFbioCfg1 = 0x00000000;
SDRAM[0].EmcFbioDqsibDlyMsb = 0x00000000;
SDRAM[0].EmcFbioDqsibDly = 0x34343434;
SDRAM[0].EmcFbioQuseDlyMsb = 0x00000000;
SDRAM[0].EmcFbioQuseDly = 0x00000000;
SDRAM[0].EmcFbioCfg5 = 0x00000282;
SDRAM[0].EmcFbioCfg6 = 0x00000002;
SDRAM[0].EmcFbioSpare = 0x00000000;
SDRAM[0].EmcMrsResetDllWait = 0x00000000;
SDRAM[0].EmcMrsResetDll = 0x00000000;
SDRAM[0].EmcMrsDdr2DllReset = 0x00000000;
SDRAM[0].EmcMrs = 0x00000000;
SDRAM[0].EmcEmrsEmr2 = 0x00000000;
SDRAM[0].EmcEmrsEmr3 = 0x00000000;
SDRAM[0].EmcEmrsDdr2DllEnable = 0x00000000;
SDRAM[0].EmcEmrsDdr2OcdCalib = 0x00000000;
SDRAM[0].EmcEmrs = 0x00000000;
SDRAM[0].EmcMrw1 = 0x0001008a;
SDRAM[0].EmcMrw2 = 0x00020004;
SDRAM[0].EmcMrw3 = 0x00030002;
SDRAM[0].EmcMrwResetCommand = 0x003f0000;
SDRAM[0].EmcMrwResetNInitWait = 0x0000000a;
SDRAM[0].EmcAdrCfg1 = 0x00060302;
SDRAM[0].EmcAdrCfg = 0x01060302;
SDRAM[0].McEmemCfg = 0x00080000;
SDRAM[0].McLowLatencyConfig = 0x80000003;
SDRAM[0].EmcCfg2 = 0x00000403;
SDRAM[0].EmcCfgDigDll = 0xe0000413;
SDRAM[0].EmcCfgClktrim0 = 0x00000000;
SDRAM[0].EmcCfgClktrim1 = 0x00000000;
SDRAM[0].EmcCfgClktrim2 = 0x00000000;
SDRAM[0].EmcCfg = 0x0001ff00;
SDRAM[0].EmcDbg = 0x01000020;
SDRAM[0].AhbArbitrationXbarCtrl = 0x00010000;
SDRAM[0].EmcDllXformDqs = 0x00000010;
SDRAM[0].EmcDllXformQUse = 0x00000008;
SDRAM[0].WarmBootWait = 0x00000001;
SDRAM[0].EmcCttTermCtrl = 0x00000802;
SDRAM[0].EmcOdtWrite = 0x00000000;
SDRAM[0].EmcOdtRead = 0x00000000;
SDRAM[0].EmcZcalRefCnt = 0x00000000;
SDRAM[0].EmcZcalWaitCnt = 0x0000001b;
SDRAM[0].EmcZcalMrwCmd = 0x000a0056;
SDRAM[0].EmcMrwZqInitDev0 = 0x800a00ff;
SDRAM[0].EmcMrwZqInitDev1 = 0x400a00ff;
SDRAM[0].EmcMrwZqInitWait = 0x00000001;
SDRAM[0].EmcDdr2Wait = 0x00000000;
SDRAM[0].PmcDdrPwr = 0x00000000;
SDRAM[0].ApbMiscGpXm2CfgAPadCtrl = 0x77ffc000;
SDRAM[0].ApbMiscGpXm2CfgCPadCtrl2 = 0x08080040;
SDRAM[0].ApbMiscGpXm2CfgCPadCtrl = 0x77fffff8;
SDRAM[0].ApbMiscGpXm2CfgDPadCtrl2 = 0x00000000;
SDRAM[0].ApbMiscGpXm2CfgDPadCtrl = 0x77fffff8;
SDRAM[0].ApbMiscGpXm2ClkCfgPadCtrl = 0x77ffc000;
SDRAM[0].ApbMiscGpXm2CompPadCtrl = 0x01f1f008;
SDRAM[0].ApbMiscGpXm2VttGenPadCtrl = 0x00005500;
tryin said:
I downloaded bct_dump some time ago, from here, but this is my BCT file:
Version = 0x00020001;
BlockSize = 0x00004000;
PageSize = 0x00000200;
PartitionSize = 0x01000000;
# Bootloader used = 1;
# Bootloaders max = 4;
# BCT size = 4080;
# Hash size = 16;
# Crypto offset = 16;
# Crypto length = 4064;
# Max BCT search blocks = 64;
#
# These values are set by cbootimage using the
# bootloader provided by the Bootloader=...
# configuration option.
#
# Bootloader[0].Version = 0x00000001;
# Bootloader[0].Start block = 288;
# Bootloader[0].Start page = 0;
# Bootloader[0].Length = 891020;
# Bootloader[0].Load address = 0x00108000;
# Bootloader[0].Entry point = 0x00108000;
# Bootloader[0].Attributes = 0x00000004;
DevType[0] = NvBootDevType_Sdmmc;
DeviceParam[0].SdmmcParams.ClockDivider = 0x0000000c;
DeviceParam[0].SdmmcParams.DataWidth = NvBootSdmmcDataWidth_8Bit;
DeviceParam[0].SdmmcParams.MaxPowerClassSupported = 0x00000000;
DevType[1] = NvBootDevType_Sdmmc;
DeviceParam[1].SdmmcParams.ClockDivider = 0x0000000c;
DeviceParam[1].SdmmcParams.DataWidth = NvBootSdmmcDataWidth_8Bit;
DeviceParam[1].SdmmcParams.MaxPowerClassSupported = 0x00000000;
DevType[2] = NvBootDevType_Sdmmc;
DeviceParam[2].SdmmcParams.ClockDivider = 0x0000000c;
DeviceParam[2].SdmmcParams.DataWidth = NvBootSdmmcDataWidth_8Bit;
DeviceParam[2].SdmmcParams.MaxPowerClassSupported = 0x00000000;
DevType[3] = NvBootDevType_Sdmmc;
DeviceParam[3].SdmmcParams.ClockDivider = 0x0000000c;
DeviceParam[3].SdmmcParams.DataWidth = NvBootSdmmcDataWidth_8Bit;
DeviceParam[3].SdmmcParams.MaxPowerClassSupported = 0x00000000;
SDRAM[0].MemoryType = NvBootMemoryType_LpDdr2;
SDRAM[0].PllMChargePumpSetupControl = 0x00000008;
SDRAM[0].PllMLoopFilterSetupControl = 0x00000000;
SDRAM[0].PllMInputDivider = 0x0000000c;
SDRAM[0].PllMFeedbackDivider = 0x00000258;
SDRAM[0].PllMPostDivider = 0x00000000;
SDRAM[0].PllMStableTime = 0x0000012c;
SDRAM[0].EmcClockDivider = 0x00000001;
SDRAM[0].EmcAutoCalInterval = 0x00000000;
SDRAM[0].EmcAutoCalConfig = 0xe0a61111;
SDRAM[0].EmcAutoCalWait = 0x00000000;
SDRAM[0].EmcPinProgramWait = 0x00000000;
SDRAM[0].EmcRc = 0x00000012;
SDRAM[0].EmcRfc = 0x00000027;
SDRAM[0].EmcRas = 0x0000000d;
SDRAM[0].EmcRp = 0x00000006;
SDRAM[0].EmcR2w = 0x00000007;
SDRAM[0].EmcW2r = 0x00000005;
SDRAM[0].EmcR2p = 0x00000003;
SDRAM[0].EmcW2p = 0x0000000b;
SDRAM[0].EmcRrd = 0x00000003;
SDRAM[0].EmcRdRcd = 0x00000006;
SDRAM[0].EmcWrRcd = 0x00000006;
SDRAM[0].EmcRext = 0x00000003;
SDRAM[0].EmcWdv = 0x00000003;
SDRAM[0].EmcQUseExtra = 0x00000006;
SDRAM[0].EmcQUse = 0x00000007;
SDRAM[0].EmcQRst = 0x00000004;
SDRAM[0].EmcQSafe = 0x00000009;
SDRAM[0].EmcRdv = 0x0000000d;
SDRAM[0].EmcRefresh = 0x0000045f;
SDRAM[0].EmcBurstRefreshNum = 0x00000000;
SDRAM[0].EmcPdEx2Wr = 0x00000004;
SDRAM[0].EmcPdEx2Rd = 0x00000004;
SDRAM[0].EmcPChg2Pden = 0x00000006;
SDRAM[0].EmcAct2Pden = 0x00000008;
SDRAM[0].EmcAr2Pden = 0x00000001;
SDRAM[0].EmcRw2Pden = 0x0000000f;
SDRAM[0].EmcTxsr = 0x0000002a;
SDRAM[0].EmcTcke = 0x00000003;
SDRAM[0].EmcTfaw = 0x0000000f;
SDRAM[0].EmcTrpab = 0x00000007;
SDRAM[0].EmcTClkStable = 0x00000007;
SDRAM[0].EmcTClkStop = 0x00000002;
SDRAM[0].EmcTRefBw = 0x000004e0;
SDRAM[0].EmcFbioCfg1 = 0x00000000;
SDRAM[0].EmcFbioDqsibDlyMsb = 0x00000000;
SDRAM[0].EmcFbioDqsibDly = 0x34343434;
SDRAM[0].EmcFbioQuseDlyMsb = 0x00000000;
SDRAM[0].EmcFbioQuseDly = 0x00000000;
SDRAM[0].EmcFbioCfg5 = 0x00000282;
SDRAM[0].EmcFbioCfg6 = 0x00000002;
SDRAM[0].EmcFbioSpare = 0x00000000;
SDRAM[0].EmcMrsResetDllWait = 0x00000000;
SDRAM[0].EmcMrsResetDll = 0x00000000;
SDRAM[0].EmcMrsDdr2DllReset = 0x00000000;
SDRAM[0].EmcMrs = 0x00000000;
SDRAM[0].EmcEmrsEmr2 = 0x00000000;
SDRAM[0].EmcEmrsEmr3 = 0x00000000;
SDRAM[0].EmcEmrsDdr2DllEnable = 0x00000000;
SDRAM[0].EmcEmrsDdr2OcdCalib = 0x00000000;
SDRAM[0].EmcEmrs = 0x00000000;
SDRAM[0].EmcMrw1 = 0x0001008a;
SDRAM[0].EmcMrw2 = 0x00020004;
SDRAM[0].EmcMrw3 = 0x00030002;
SDRAM[0].EmcMrwResetCommand = 0x003f0000;
SDRAM[0].EmcMrwResetNInitWait = 0x0000000a;
SDRAM[0].EmcAdrCfg1 = 0x00060302;
SDRAM[0].EmcAdrCfg = 0x01060302;
SDRAM[0].McEmemCfg = 0x00080000;
SDRAM[0].McLowLatencyConfig = 0x80000003;
SDRAM[0].EmcCfg2 = 0x00000403;
SDRAM[0].EmcCfgDigDll = 0xe0000413;
SDRAM[0].EmcCfgClktrim0 = 0x00000000;
SDRAM[0].EmcCfgClktrim1 = 0x00000000;
SDRAM[0].EmcCfgClktrim2 = 0x00000000;
SDRAM[0].EmcCfg = 0x0001ff00;
SDRAM[0].EmcDbg = 0x01000020;
SDRAM[0].AhbArbitrationXbarCtrl = 0x00010000;
SDRAM[0].EmcDllXformDqs = 0x00000010;
SDRAM[0].EmcDllXformQUse = 0x00000008;
SDRAM[0].WarmBootWait = 0x00000001;
SDRAM[0].EmcCttTermCtrl = 0x00000802;
SDRAM[0].EmcOdtWrite = 0x00000000;
SDRAM[0].EmcOdtRead = 0x00000000;
SDRAM[0].EmcZcalRefCnt = 0x00000000;
SDRAM[0].EmcZcalWaitCnt = 0x0000001b;
SDRAM[0].EmcZcalMrwCmd = 0x000a0056;
SDRAM[0].EmcMrwZqInitDev0 = 0x800a00ff;
SDRAM[0].EmcMrwZqInitDev1 = 0x400a00ff;
SDRAM[0].EmcMrwZqInitWait = 0x00000001;
SDRAM[0].EmcDdr2Wait = 0x00000000;
SDRAM[0].PmcDdrPwr = 0x00000000;
SDRAM[0].ApbMiscGpXm2CfgAPadCtrl = 0x77ffc000;
SDRAM[0].ApbMiscGpXm2CfgCPadCtrl2 = 0x08080040;
SDRAM[0].ApbMiscGpXm2CfgCPadCtrl = 0x77fffff8;
SDRAM[0].ApbMiscGpXm2CfgDPadCtrl2 = 0x00000000;
SDRAM[0].ApbMiscGpXm2CfgDPadCtrl = 0x77fffff8;
SDRAM[0].ApbMiscGpXm2ClkCfgPadCtrl = 0x77ffc000;
SDRAM[0].ApbMiscGpXm2CompPadCtrl = 0x01f1f008;
SDRAM[0].ApbMiscGpXm2VttGenPadCtrl = 0x00005500;
Click to expand...
Click to collapse
I tested the cbootimg you sent. It does not show OdmData line for me too, but the cbootimg from the nvidia git site shows it.
bitdomo said:
I tested the cbootimg you sent. It does not show OdmData line for me too, but the cbootimg from the nvidia git site shows it.
Click to expand...
Click to collapse
Many thanks for your test, I'll try the nvidia one when i have a minute...
dear bitdomo,
My phone too stuck on logo LG. I try extracting KDZ su880 rom. I have got img files. ( recovery.img, bootloader.img...)
I want to flash them via NVflash but i dont know command... Can you help me command to flash recovery.img & bootloadet.img ?
*my bootloader.img was extracted from su880 KDZ , i think no need EDIT with HEX Editor & delete the bunch of FF hex values from the end of the file.
i try using bootloader.bin in bootloader_installer ultility. Run install_gb_bootloader.bat. Seem all was complete. But cannot connect to S/W mode
Thanks !
Copy every img file to your nvflash folder (bootloader.img, recovery.img, boot.img (kernel) )
Open a cmd.
Go to your nvflash folder in cmd.
Connect phone in APX mode to PC
Type these commands in cmd:
Code:
nvflash.exe --bl bootloader.img --download 4 bootloader.img
nvflash.exe -r --download 6 recovery.img
nvflash.exe -r --download 12 boot.img
nvflash.exe -r --go
(-r = --resume)
Wait until the screen goes off or wait 15-20 seconds then unplug your phone.
If the sending bootloader hangs up at some point then delete the FF hex valuess from the end of the bootloader.img and try again.
You can find a bootloader in my attachment of this post which already has FF hex values removed.
bitdomo said:
Copy every img file to your nvflash folder (bootloader.img, recovery.img, boot.img (kernel) )
Open a cmd.
Go to your nvflash folder in cmd.
Connect phone in APX mode to PC
Type these commands in cmd:
Code:
nvflash.exe --bl bootloader.img --download 4 bootloader.img
nvflash.exe -r --download 6 recovery.img
nvflash.exe -r --download 12 boot.img
nvflash.exe -r --go
(-r = --resume)
Wait until the screen goes off or wait 15-20 seconds then unplug your phone.
If the sending bootloader hangs up at some point then delete the FF hex valuess from the end of the bootloader.img and try again.
You can find a bootloader in my attachment of this post which already has FF hex values removed.
Click to expand...
Click to collapse
There are no words to show my gratitude! I reallythrilling now. My phone was rescued, my friend !
Seem Those commands not working with imgs extract from v19c, bitdomo ? I flash v19c KDZ via MartFlash---> Root---> Install Recovery ( but failed )----> Phone stuck logo LG...
I cannot flash bootloader.img,although i delete the FF hex valuess from the end of the bootloader.img.
I am a bit lost. To make things clear please anwser these questions:
1. If I understand well you were able to unbrick your phone with the instruction I wrote to you. Right?
2. What recovery do you want to flash and how? Send me a link for that recovery or the app which flashes the recovery.
3. Can you post here what error message appears when you try to nvflash bootloader? Copy the content of the whole cmd window here, please.
There is a final version of ics rom v20c for su880. v19c is a beta rom if I am not mistaken. I can send you a link if you are intrested in v20c
Edit: v19c is an ics rom and ics rom has locked bootloader therefore it cannot be used with nvflash. You have to use the bootloader from my attachment to flash v19c bootloader.
nvflash.exe --bl mybootloader.img --download 4 v19cbootloader.img
Sent from my LG-P990 using xda app-developers app
bitdomo said:
I am a bit lost. To make things clear please anwser these questions:
...
Click to expand...
Click to collapse
Thanks for help, bitdomo !
1. I unbricked phone with the instruction you wrote , in the previous with v10m kdz. Then I reflash with v19c KDZ & install recovery ( below tut) , Phone brick.
2. I want to install any recovery to flash a custom rom (Jelly Bean). And i folow this link: http://forum.xda-developers.com/showthread.php?t=2281636
3. cmd window when i flash booloader & recovery img file with the contruction you wrote ( with img files extract from v19c kdz )---> view attachment picture.
4. I use the bootloader from your attachment with edit in BAT file [ nvflash.exe --bl mybootloader.img --download 4 v19cbootloader.img ],then run new BAT file, a cmd window appear in the moment ( about 1/3 second) and disappear. nothing is happend...
If v19c cannot be used with nvflash, can you creat BAT file to run & flash stock recovery v19c ?
picture cmd window

[MOD][CM12][COLOROS 2][HYDROGENOS] Splash Screen Image Injector v1.2

This is a program that I wrote to decode the newer style "logo.bin" files used in some OPPO, and OnePlus devices. Please read below so you can better understand this type of encoding being used:
What Is A Raw Image?
A raw image, whether it be a file or an image in memory, is simply pixel data. There is no extra information like width, height, name, end of line... Absolutely nothing, just pixel data. If you have an image that is raw and the resolution is 1080x1920 and you are using a typical RGB24 or BGR24 (like the ones used here), then your exact filesize or size in memory will be 1080x1920x3! We use 3 here because there is one byte for the R or red component, one for the G (green), and one for the B(blue).
What Is A Run Length Encoded Image?
A run length image encoding uses a count ;usually a single byte (char), 2 bytes (short int), or 4 bytes (long int); and then the pixel components. So instead of writing out 300 bytes of '0's to make a line of 100 black pixels. Black is RGB(0,0,0). You could encode this as 100, 0, 0, 0. And only use 4 bytes of data to get the exact same image as the 300 byte raw image. All the run length encoding I've found, except the Motorola style which is a little different, use a run length encoding that is pixel-oriented like this.
Now I've figured out this new one and it is a byte-oriented run length encoding. This is for runs of bytes, not pixels. You may think, well whats the big deal? When you add a little area of color, you increase the run length encoded image in you logo.bin immensely! You use 6 bytes per pixel if there aren't any runs of color data. If you had an image that was a 1080x1920 black image with a 25 pixel wide, by 25 pixel high red box in the middle. The encoder would be doing runs of black data efficiently until it reached the red area.
.....0 255 0 255 0 255 0 255 0 255 0 133 /// we've reached the top left corner of the red square /// 13 1 30 1 255 1 // << that was just one red pixel!! in bgr color order (13, 30, 255) <<// And it keeps going through the rest of the red pixels on that line using 6 bytes per pixel, which is the opposite of compression. Before reaching the red square the encoding was decoding to 255 zeros over and over, until finally 133 zeros. 255 zeros is 85 black pixels stored in just 2 bytes!
This type of encoding is only good for grey scale images. It is not good with color, but it still will handle color of course. In grey scale, the Red, Blue, and Green data components are always the same values. All the way from black (0,0,0) to white (255, 255, 255); including every shade of grey in between>>>(1,1,1) (2,2,2) (3,3,3)....(243, 243, 243) (244, 244, 244)<<<
One other difference in this method of run length encoding is that the color byte is before the count, which is backwards from all of the other methods.​
The attachment contains the C source code (which is also in the 2nd post) and the executable that was compiled using mingw32 on a 64 bit Windows 7 pc. The png library that I used is LodePng, the source is in the download.
To use logoinjector:
Decode your logo.bin:
Code:
logoInjector.exe -i logo.bin -d
All the PNG 's will be extracted from logo.bin. Edit the PNGs that you want to change...
Note:
Your original "logo.bin" file is never changed, it is just read. If the file you try to load isn't a logo.bin file, or if it is the older style, then the program will tell you and exit​
Inject the image(s) back in to the logo.bin:
Code:
logoinjector.exe -i logo.bin -j image_name_1 image_name_3
To list whats in your logo file:
Code:
logoinjector.exe -i logo.bin -l
For a more detailed list:
Code:
logoinjector.exe -i logo.bin -L
If the colors are messed up use the "-s" switch while decoding.
Code:
logoinjector.exe -i logo.bin -d -s
If you had to use the "-s" switch to decode properly, you'll have to use it to inject also:
Code:
logoinjector.exe -i logo.bin -j image_name -s
Note:
With version 1.2, you can put as many names after "-j" as you want, and it's not case sensitive. You also don't have to put the whole name. If you just put "-j fhd" every image in the logo.bin that starts with "fhd" will be injected. There has to be a PNG with the name in the directory though​
The size of your modified.logo.bin will displayed along with the original size, if everything went good. Please know the size of you logo partition. I made this program to encompass any device using this format, and there is no set size of the logo partition between devices. Fastboot will just error out if you try to flash data bigger than the partition before it writes anything. But if someone gets brave and trys to "DD" to the logo partition, it could get ugly.:cyclops:
Flash the "modified.logo.bin" file through fastboot.
v1.2
made it possible for multiple injections in one command
doesn't add png to the decoded png if it was already in the name
fixed out of scope with image 26 in OPPO find 7 logo.bin
added LodePng source in the download
made the default color order BGR
displays the modified logo file size as well as the original file size
runs the modified.logo.bin back through the list function after injecting
checks the number of offsets between the original and modified logo.bin
Use this at your own risk.
Always make backups.
Always.
Code:
/*
/*
* Logo Injector v1.2
*
* Copyright (C) 2015 Joseph Andrew Fornecker
* makers_mark @ xda-developers.com
* [email protected]
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (at your
* opinion) any later version. See <http://www.gnu.org/licenses/gpl.html>
*
* New in v1.2:
*
* - Fixed out of scope crash involving image #26 in oppo find 7 logo.bin (26 IS BIG)
* - Multiple injection names possible after the -j parameter
* - Injection names are now case insensitive
* - BGR is the the default color order, instead of RGB
* - Added more error checks
* - Show the change in file size of original logo.bin compare to the modified logo.bin
* - Several small changes dealing with readability
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdint.h>
#include "lodepng.h"
#define SWAP32(x) (( x >> 24 )&0xff) | ((x << 8)&0xff0000) | ((x >> 8)&0xff00) | ((x << 24)&0xff000000)
#define BLOCK 512
#define OFFSETSTART 48
#define BYTESPERPIXEL 3
#define MAXOFFSETS 28
#define SIZEOFLONGINT 4
#define TWOTOTHETEN 1024
typedef struct {
uint8_t header[8];
uint8_t blank[24];
uint32_t width;
uint32_t height;
uint32_t lengthOfData;
uint32_t special;
uint32_t offsets[MAXOFFSETS];
uint8_t name[64];
uint8_t metaData[288];
} IMAGEHEAD;
uint16_t Copy(FILE *, IMAGEHEAD *, uint16_t , uint16_t, FILE *);
int32_t InjectNewStyle(FILE *, IMAGEHEAD *, uint16_t , uint8_t *, uint16_t, FILE *, uint32_t * );
int32_t RewriteHeaderZero( uint32_t , uint16_t, FILE* , int32_t, uint32_t * );
uint32_t Encode(uint8_t*, uint8_t*, uint32_t);
uint32_t GetEncodedSize(uint8_t*, uint32_t);
uint32_t GetWidth(FILE*);
uint32_t GetHeight(FILE*);
uint64_t BlockIt(uint32_t);
uint16_t GetNumberOfOffsets(FILE*);
int32_t DecodeLogoBin(FILE*, IMAGEHEAD *);
int32_t ListFileDetails(FILE*, IMAGEHEAD *);
uint8_t* Decode(FILE*, uint32_t, uint32_t, uint32_t, uint8_t*);
int32_t IsItTheNewStyle(FILE*);
IMAGEHEAD* ParseHeaders(FILE*, uint16_t);
int32_t IsItALogo(FILE*);
void PrintFileSize(uint32_t);
uint32_t GetFileSize(FILE *);
uint16_t badAss = 0;
int16_t rgb2bgr = 1;
uint16_t convertToPNG = 1;
uint8_t HEADER[] = {0x53,0x50,0x4C,0x41,0x53,0x48,0x21,0x21};
int32_t IsItALogo(FILE *originalLogoBin){
uint8_t string[9];
uint16_t i;
fread(string, 1, 8, originalLogoBin);
for (i = 0 ; i < 8 ; i++){
if (string[i] == HEADER[i]){
continue;
} else {
return 0;
}
}
return 1;
}
int32_t IsItTheNewStyle(FILE *originalLogoBin){
int32_t newStyle = 0;
fread(&newStyle, 1, SIZEOFLONGINT, originalLogoBin);
if (newStyle == 0){
return 1;
} else {
return 0;
}
}
IMAGEHEAD *ParseHeaders(FILE *originalLogoBin, uint16_t numberOfOffsets){
uint8_t i = 0;
IMAGEHEAD *imageHeaders;
imageHeaders = malloc(BLOCK * numberOfOffsets);
memset(imageHeaders, 0, BLOCK * numberOfOffsets);
fseek(originalLogoBin, 0, SEEK_SET);
fread(&imageHeaders[i], 1 , BLOCK, originalLogoBin);
for ( i = 1 ; i < numberOfOffsets ; ++i ){
fseek(originalLogoBin, imageHeaders[0].offsets[i], SEEK_SET);
fread(&imageHeaders[i], 1 , BLOCK, originalLogoBin);
}
return imageHeaders;
}
uint16_t GetNumberOfOffsets(FILE *originalLogoBin){
uint16_t i = 0;
uint32_t readAs = 0;
fseek(originalLogoBin, OFFSETSTART, SEEK_SET);
while(i < MAXOFFSETS){
fread(&readAs, 1, SIZEOFLONGINT, originalLogoBin);
if ((readAs == 0) && (i != 0)){
break;
} else {
i++;
}
}
return i;
}
uint8_t* Decode(FILE *originalLogoBin, uint32_t start, uint32_t length, uint32_t imageBytes, uint8_t* image){
uint32_t decodedBytes = 0, i = 0;
uint8_t* data;
fseek(originalLogoBin, start, SEEK_SET);
data = (uint8_t*)malloc(length);
if (fread(data, 1, length, originalLogoBin) != length) {
fprintf(stderr, "Could not read file!!\n");
exit(0);
}
while((i < length) && (decodedBytes < imageBytes)){
memset(&image[decodedBytes], data[i], (data[i + 1]));
decodedBytes += (uint8_t)data[i+1];
i += 2;
if ((i < length) && (imageBytes - decodedBytes < (uint8_t)data[i + 1])){
memset(&image[decodedBytes], data[i], imageBytes - decodedBytes);
decodedBytes = imageBytes;
fprintf(stdout, "More information was in encoding than resolution called for.\n");
break;
}
}
fprintf(stdout, "%ld decoded bytes\n", decodedBytes);
free(data);
if( rgb2bgr == 1 ){
uint8_t old;
i = 0;
while( i < imageBytes){
old = image[i];
memset(&image[i], image[i + 2], 1);
memset(&image[i + 2], old, 1);
i += BYTESPERPIXEL;
}
}
return image;
}
int32_t DecodeLogoBin(FILE *originalLogoBin, IMAGEHEAD *imageHeaders){
uint32_t size, imageBytes, start;
uint8_t* image;
uint8_t name[65];
uint8_t r = 0;
uint16_t i , numberOfOffsets = GetNumberOfOffsets(originalLogoBin);
for ( i = 0 ; i < numberOfOffsets ; i++ ){
fprintf(stdout,"\n\n\n#%d: Offset:%ld\n", i + 1, imageHeaders[0].offsets[i]);
if ((imageHeaders[i].width == 0) || (imageHeaders[i].height == 0)){
fprintf(stdout, "Placeholder for %s\n", imageHeaders[i].metaData);
continue;
}
fprintf(stdout, "Header=%s\nWidth=%ld\nHeight=%ld\nData Length=%ld\nSpecial=%ld\nName=%s\nMetadata=%s\n",
imageHeaders[i].header, imageHeaders[i].width, imageHeaders[i].height,
imageHeaders[i].lengthOfData, imageHeaders[i].special, imageHeaders[i].name, imageHeaders[i].metaData);
if (convertToPNG){
start = imageHeaders[0].offsets[i] + BLOCK;
imageBytes = imageHeaders[i].width * (imageHeaders[i].height) * BYTESPERPIXEL;
image = malloc(imageBytes);
uint8_t lengthOfName = strlen(imageHeaders[i].name);
uint8_t *ext;
ext = strrchr(imageHeaders[i].name, '.');
if (((ext[1] == 'p') || (ext[1] == 'P')) &&
((ext[2] == 'n') || (ext[2] == 'N')) &&
((ext[3] == 'g') || (ext[3] == 'G')) &&
((ext[0] == '.'))){
sprintf(name, "%s", imageHeaders[i].name);
} else {
sprintf(name, "%s.png", imageHeaders[i].name);
}
lodepng_encode24_file(name, Decode(originalLogoBin, (uint32_t)start, (uint32_t)imageHeaders[i].lengthOfData, (uint32_t)imageBytes, image) , (unsigned)imageHeaders[i].width, (unsigned)imageHeaders[i].height);
free(image);
}
}
return 0;
}
int32_t ListFileDetails(FILE *originalLogoBin, IMAGEHEAD *imageHeaders){
uint32_t i = 0, j = 0;
fseek(originalLogoBin, 0, SEEK_SET);
uint16_t numberOfOffsets = GetNumberOfOffsets(originalLogoBin);
fprintf(stdout, "Resolution\tOffset\tName\n");
fprintf(stdout, "-------------------------------------------------------------\n");
for ( i = 0 ; i < numberOfOffsets ; i++ ){
if ((imageHeaders[i].width == 0) || (imageHeaders[i].height == 0)){
fprintf(stdout, "(placeholder) for %s\n", imageHeaders[i].metaData);
continue;
}
fprintf(stdout,"%dx%d\t", imageHeaders[i].width, imageHeaders[i].height);
if ((imageHeaders[i].width < 1000) && (imageHeaders[i].height <1000)){fprintf(stdout, "\t");}
fprintf(stdout, "%ld\t%s\n", imageHeaders[0].offsets[i], imageHeaders[i].name );
}
return 1;
}
uint16_t Copy(FILE *originalLogoBin, IMAGEHEAD *imageHeaders, uint16_t numberOfOffsets, uint16_t injectionNumber, FILE *modifiedLogoBin){
uint8_t *data;
uint32_t offset, originalOffset;
uint32_t imageSize = BlockIt(BLOCK + imageHeaders[injectionNumber].lengthOfData);
if( imageHeaders[injectionNumber].name[0] == 0){
fprintf(stdout, "Copying \t#%d:(placeholder) %s\n", injectionNumber + 1 , imageHeaders[injectionNumber].metaData);
} else {
fprintf(stdout, "Copying \t#%d:%s\n", injectionNumber + 1 , imageHeaders[injectionNumber].name);
}
data = malloc(imageSize);
memset(data, 0 , imageSize);
fread(data, 1, imageSize, originalLogoBin);
fwrite(data, 1 , imageSize, modifiedLogoBin);
free(data);
}
int32_t InjectNewStyle(FILE *originalLogoBin, IMAGEHEAD *imageHeaders, uint16_t numberOfOffsets, uint8_t *injectionName, uint16_t injectionNumber, FILE *modifiedLogoBin, uint32_t *ihMainOffsets ){
uint32_t encodedSize = 0, actualWritten = 0, imageSize = 0;
uint8_t *data, *header;
int8_t inFileName[69];
int32_t blockDifference;
uint32_t offset, originalOffset;
FILE *pngFile;
sprintf(inFileName, "%s", injectionName);
if (imageHeaders[injectionNumber].special != 1){
fprintf(stdout, "ERROR: \"Special\" is not equal to '1' \nThis would not be safe to flash!\nPlease email logo.bin in question to:\[email protected]\n");
fclose(originalLogoBin);
fclose(modifiedLogoBin);
return 0;
}
if ((pngFile = fopen(inFileName, "rb")) == NULL){
sprintf(inFileName, "%s.png", injectionName);
if ((pngFile = fopen(inFileName, "rb")) == NULL){
fclose(pngFile);
fclose(modifiedLogoBin);
fclose(originalLogoBin);
fprintf(stderr, "%s could not be read\n", inFileName);
return 0;
}
}
IMAGEHEAD new;
memset(new.blank, 0, sizeof(new.blank));
memset(new.metaData, 0, sizeof(new.metaData));
memset(new.offsets, 0, SIZEOFLONGINT * MAXOFFSETS);
strncpy(new.header, HEADER , 8);
strncpy(new.metaData, imageHeaders[injectionNumber].metaData, sizeof(imageHeaders[injectionNumber].metaData));
strncpy(new.name, injectionName, 64);
new.special = 1;
fprintf(stdout, "Injecting\t#%d:%s\n", injectionNumber + 1 , imageHeaders[injectionNumber].name);
if (((new.width = GetWidth(pngFile)) != imageHeaders[injectionNumber].width) && (!badAss)){
fprintf(stderr, "Error: Width of PNG to be injected is %d, it must be %d!\n", new.width, imageHeaders[injectionNumber].width);
fclose(pngFile);
fclose(modifiedLogoBin);
fclose(originalLogoBin);
return 0;
}
if (((new.height = GetHeight(pngFile)) != imageHeaders[injectionNumber].height) && (!badAss)){
fprintf(stderr, "Error: Height of PNG to be injected is %d, it must be %d!\n", new.height, imageHeaders[injectionNumber].height);
fclose(pngFile);
fclose(modifiedLogoBin);
fclose(originalLogoBin);
return 0;
}
uint32_t rawBytes = new.width * new.height * BYTESPERPIXEL;
uint8_t *decodedPNG = malloc(rawBytes);
lodepng_decode24_file(&decodedPNG, (uint32_t*)&new.width, (uint32_t*)&new.height , (const uint8_t*)inFileName);
if (rgb2bgr == 1){
uint8_t old;
uint32_t k = 0;
while( k < rawBytes ){
old = decodedPNG[k];
memset(&decodedPNG[k], decodedPNG[k + 2], 1);
memset(&decodedPNG[k + 2], old, 1);
k += BYTESPERPIXEL;
}
}
encodedSize = GetEncodedSize(decodedPNG, (new.width * new.height * BYTESPERPIXEL));
new.lengthOfData = encodedSize;
uint8_t *rlEncoded = malloc(BlockIt(encodedSize));
memset(rlEncoded, 0, BlockIt(encodedSize));
actualWritten = Encode(decodedPNG, rlEncoded, (new.width * new.height * BYTESPERPIXEL));
blockDifference = (((BLOCK + BlockIt(actualWritten)) - (BLOCK + BlockIt(imageHeaders[injectionNumber].lengthOfData))) / BLOCK);
fwrite(&new, 1 , BLOCK, modifiedLogoBin);
fwrite(rlEncoded, 1 , BlockIt(actualWritten), modifiedLogoBin);
free(decodedPNG);
free(rlEncoded);
RewriteHeaderZero( injectionNumber , numberOfOffsets , modifiedLogoBin , blockDifference, ihMainOffsets);
fclose(pngFile);
return 1;
}
int32_t RewriteHeaderZero( uint32_t injectionImageNumber , uint16_t numberOfOffsets, FILE *modifiedLogoBin , int32_t blockDifference, uint32_t *ihMainOffsets){
uint8_t i, j = injectionImageNumber + 1 ;
uint32_t filePosition = ftell(modifiedLogoBin);
uint32_t offset = 0;
for( ; j < numberOfOffsets; j++){
fseek(modifiedLogoBin, OFFSETSTART + (SIZEOFLONGINT * j), SEEK_SET);
offset = ihMainOffsets[j];
offset += (blockDifference * BLOCK);
fseek(modifiedLogoBin, OFFSETSTART + (SIZEOFLONGINT * j), SEEK_SET);
fwrite(&offset, 1 , SIZEOFLONGINT , modifiedLogoBin);
ihMainOffsets[j] = offset;
}
fseek(modifiedLogoBin, filePosition , SEEK_SET);
return;
}
uint32_t GetEncodedSize(uint8_t* data, uint32_t size){
uint32_t pos = 0, ret = 0;
uint16_t count = 1;
for( pos = 0 ; pos < size ; ++pos , count = 1){
while((pos < size - 1) && (count < 0xFF) && ((memcmp(&data[pos], &data[pos+1], 1)) == 0)){
count++;
pos++;
}
ret += 2;
}
return ret;
}
uint32_t Encode(uint8_t* rawRgbReading, uint8_t* rlEncoded, uint32_t rawSize){
uint32_t writePosition = 0 , readPosition = 0;
uint16_t count = 1;
for( readPosition = 0 ; readPosition < rawSize ; ++readPosition , count = 1){
while((readPosition < rawSize - 1 ) && (count < 0xFF) && ((memcmp(&rawRgbReading[readPosition], &rawRgbReading[readPosition+1], 1)) == 0)){
count++;
readPosition++;
}
rlEncoded[writePosition] = rawRgbReading[readPosition];
rlEncoded[writePosition + 1] = count;
writePosition += 2;
}
return writePosition;
}
uint32_t GetWidth(FILE *pngFile){
uint32_t width;
fseek(pngFile, 16, SEEK_SET);
fread(&width, 1, SIZEOFLONGINT, pngFile);
return(SWAP32(width));
}
uint32_t GetHeight(FILE *pngFile){
uint32_t height;
fseek(pngFile, 20, SEEK_SET);
fread(&height, 1, SIZEOFLONGINT, pngFile);
return(SWAP32(height));
}
uint64_t BlockIt(uint32_t isize){
uint32_t blockSize = BLOCK;
if ((isize % blockSize) == 0){
return isize;
}else{
return isize + (blockSize - (isize % blockSize));
}
}
void Usage(){
fprintf(stdout, "Usage: logoinjector -i \"input file\" [-l] | [-L] | [-d [-s]] | [-j \"image to be replaced\" [-b] | [-s]]\n\n");
fprintf(stdout, "Mandatory Arguments:\n\n");
fprintf(stdout, "\t-i \"C:\\xda\\logo.bin\"\n");
fprintf(stdout, "\t This is the logo.bin file to analyze or inject an image\n\n");
fprintf(stdout, "Optional Arguments:\n\n");
fprintf(stdout, "\t-d Decode all images into PNGs, (-s)wap parameter may be needed for proper color.\n");
fprintf(stdout, "\t-l Lower case 'L' is to display a short list of what is inside the input file.\n");
fprintf(stdout, "\t-L Upper case 'L' is for a more detailed list of logo.bin image contents.\n");
fprintf(stdout, "\t-b 'b' is used to tell the program to disregard width or height differences\n");
fprintf(stdout, "\t when encoding an image, the program also won't fail if it can't find a name\n");
fprintf(stdout, "\t that can't be found on the inject list when encoding images\n");
fprintf(stdout, "\t-s 's' is used to swap RGB and BGR color order. Can be used on decoding or encoding.\n");
fprintf(stdout, "\t NEW IN THIS V1.2: Swap is on by default, meaning the color order will be BGR. Using\n");
fprintf(stdout, "\t the \"-s\" switch will result in a RGB color order. Bottom line: If you (-d)ecode the\n");
fprintf(stdout, "\t images (that have color) and the colors aren't right, then you should use (-s) to \n");
fprintf(stdout, "\t decode and inject images.\n");
fprintf(stdout, "\t-j \"image(s) to be replaced\"\n");
fprintf(stdout, "\t The image(s) name to be replaced as seen in the (-l)ist\n");
fprintf(stdout, "\t NEW IN THIS V1.2: Multiple image names may be put after \"-j\"\n");
fprintf(stdout, "\t The names simply need to be separated by a space. The names now also are not case\n");
fprintf(stdout, "\t sensitive, and it doesn't matter if you put the extension at the end of the name.\n");
fprintf(stdout, "\t You actually only need to put the first characters of the name.\nExample:\n");
fprintf(stdout, "\t logoinjector -i \"your_logo.bin\" -j FHD \n\n");
fprintf(stdout, "\t This will inject a PNG for every name in the logo bin that begins with \"fhd\"\n");
return;
}
void PrintFileSize(uint32_t bytes){
float megaBytes = 0, kiloBytes = 0;
kiloBytes = (float)bytes / (float)TWOTOTHETEN;
megaBytes = kiloBytes / (float)TWOTOTHETEN;
if (kiloBytes < (float)TWOTOTHETEN){
fprintf(stdout, "\t%.2f KB\n", kiloBytes);
} else {
fprintf(stdout, "\t%.2f MB\n", megaBytes);
}
return;
}
uint32_t GetFileSize(FILE *temp){
fseek(temp, 0 , SEEK_END);
uint32_t fileSizeZ = ftell(temp);
return(fileSizeZ);
}
int32_t main(int32_t argc, int8_t **argv){
int32_t c;
int16_t h, i , j , k = 0;
FILE *originalLogoBin = NULL, *modifiedLogoBin = NULL;
uint8_t *inputFile = NULL;
uint8_t *injectNames[MAXOFFSETS];
int16_t decodeAllOpt = 0;
int16_t encodeOpt = 0;
int16_t inject = 0;
int16_t listFile = 0;
uint16_t numberOfOffsets = 0, injected = 0;
for(i = 0; i < MAXOFFSETS; i++){
injectNames[i] = NULL;
}
fprintf(stdout, "__________________________________________________________-_-\n");
fprintf(stdout, "Logo Injector v1.2\n\nWritten By Makers_Mark @ XDA-DEVELOPERS.COM\n");
fprintf(stdout, "_____________________________________________________________\n\n");
while ((c = getopt (argc, (char**)argv, "sSj:J:hHbBdDlLi:I:")) != -1){
switch(c)
{
case 'l':
listFile = 1;
break;
case 'L':
decodeAllOpt = 1;
convertToPNG = 0;
break;
case 'i':
case 'I':
inputFile = optarg;
break;
case 'b':
case 'B':
badAss = 1;
break;
case 'j':
case 'J':
h = optind - 1 ;
uint8_t *nextArg;
while(h < argc){
inject = 1;
nextArg = strdup(argv[h]);
h++;
if(nextArg[0] != '-'){
injectNames[k++] = nextArg;
} else {
break;
}
}
optind = h - 1;
break;
case 'd':
case 'D':
decodeAllOpt = 1 ;
break;
case 's':
case 'S':
rgb2bgr = -1 ;
break;
case 'h':
case 'H':
Usage();
return 0;
break;
default:
Usage();
return 0;
break;
}
}
if (inputFile == NULL){
Usage();
return 0;
}
fprintf(stdout, "FILE: %s\n_____________________________________________________________\n\n", inputFile);
if (rgb2bgr == 1){
fprintf(stdout, "BGR is the color order. Use \"-s\" switch to change it to RGB.\n\n");
} else {
fprintf(stdout, "RGB is the color order. Use \"-s\" switch to change it to BGR.\n\n");
}
if ((originalLogoBin = fopen(inputFile, "rb")) == NULL){
fprintf(stderr, "%s could not be opened\n", inputFile);
return 0;
}
if (!IsItALogo(originalLogoBin)){
fprintf(stdout, "\nThis is NOT a valid Logo.bin\n\n");
fclose(originalLogoBin);
return 0;
}
if (!IsItTheNewStyle(originalLogoBin)){
fprintf(stdout, "\nThis is the old style logo.bin\n\n");
fclose(originalLogoBin);
return 0;
}
numberOfOffsets = GetNumberOfOffsets(originalLogoBin);
IMAGEHEAD *imageHeaders = ParseHeaders(originalLogoBin, numberOfOffsets);
if (listFile){
ListFileDetails(originalLogoBin, imageHeaders);
return 1;
}
if(inject){
uint32_t ihMainOffsets[MAXOFFSETS];
uint8_t found = 0, exitFlag = 0;
for (i = 0; i < MAXOFFSETS ; i++){
ihMainOffsets[i] = 0;
}
for (j = 0; j < k ; j++){
for (i = 0 ; i < numberOfOffsets ; i++ ){
if((strcasecmp(imageHeaders[i].name, injectNames[j]) == 0) ||
(strncasecmp(imageHeaders[i].name, injectNames[j], strlen(injectNames[j])) == 0)){
found = 1;
break;
} else {
found = 0;
}
}
if (!found){
fprintf(stdout, "ERROR: \"%s\" is not in the logo bin !!!!\n", injectNames[j]);
exitFlag = 1;
}
}
if ((exitFlag) && (!badAss)){
fclose(originalLogoBin);
exit(0);
}
memcpy(&ihMainOffsets , &imageHeaders[0].offsets, SIZEOFLONGINT * MAXOFFSETS);
fseek(originalLogoBin, 0, SEEK_SET);
if ((modifiedLogoBin = fopen("modified.logo.bin", "wb+")) == NULL){
fclose(modifiedLogoBin);
fclose(originalLogoBin);
fprintf(stderr, "modified.logo.bin could not be opened\n");
return 0;
}
for (i = 0 ; i < numberOfOffsets ; i++ , injected = 0 ){
for (j = 0; j < k ; j++){
if((strcasecmp(imageHeaders[i].name, injectNames[j]) == 0) ||
(strncasecmp(imageHeaders[i].name, injectNames[j], strlen(injectNames[j])) == 0)){
if (InjectNewStyle(originalLogoBin, imageHeaders , numberOfOffsets, imageHeaders[i].name, i, modifiedLogoBin, ihMainOffsets) == 0){
fprintf(stderr, "Error: Injecting %s\n", imageHeaders[i].name);
fclose(originalLogoBin);
fclose(modifiedLogoBin);
return 0;
}
if ( i != numberOfOffsets - 1 ){
fseek(originalLogoBin, imageHeaders[0].offsets[i+1], SEEK_SET);
}
injected = 1;
break;
}
}
if (!injected){
Copy(originalLogoBin , imageHeaders, numberOfOffsets, i, modifiedLogoBin);
}
}
uint16_t modifiedNumberOfOffsets = 0;
if (GetNumberOfOffsets(modifiedLogoBin) != numberOfOffsets){
fprintf(stderr, "ERROR: The number of offsets doesn't match the Original file!!\n");
fclose(modifiedLogoBin);
if (!badAss){
unlink("modified.logo.bin");
}
exit(0);
}
fprintf(stdout, "\n\nContents of the NEW \"modified.logo.bin\":\n");
fprintf(stdout, "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n\n");
ListFileDetails(modifiedLogoBin, imageHeaders);
fprintf(stdout, "\n\n_____________________________________________________________\nOriginal filesize: ");
PrintFileSize(GetFileSize(originalLogoBin));
fprintf(stdout, "Modified filesize: ");
PrintFileSize(GetFileSize(modifiedLogoBin));
fprintf(stdout, "-------------------------------------------------------------\n");
fclose(originalLogoBin);
fclose(modifiedLogoBin);
return 1;
}
if (decodeAllOpt){
DecodeLogoBin(originalLogoBin, imageHeaders);
fclose(originalLogoBin);
return 1;
}
fclose(originalLogoBin);
return 1;
}
Terrific, this works. Thank you a lot!
After a little trial-and-error and some time in our beloved QHSUSB_DLOAD mode, I finally got it to work! I own a OnePlus One, and I had to use the -s parameter to get it to work correctly. Just a heads-up for any OPO owners who wants to use this. Great work, OP!
treChoy said:
After a little trial-and-error and some time in our beloved QHSUSB_DLOAD mode, I finally got it to work! I own a OnePlus One, and I had to use the -s parameter to get it to work correctly. Just a heads-up for any OPO owners who wants to use this. Great work, OP!
Click to expand...
Click to collapse
Thanks for chiming in, I was going to ask you to test for me initially. Can you elaborate on what happened?
makers_mark said:
Thanks for chiming in, I was going to ask you to test for me initially. Can you elaborate on what happened?
Click to expand...
Click to collapse
Just a foreword that I was using a Windows 8.1 machine, which is bound to be the cause of some of the issues I ran into.
After I unzipped the program and put the logo.bin in the extracted folder, I kept running the commands, but each time, I'd get an error message saying that the program didn't support my OS version, or something to that effect. I tried rewording the commands, but to no avail. Eventually, I just deleted the whole folder and extracted the package again. That seemed to do the trick.
So I had all the images extracted, and I created the ones I wanted to replace. There was a bit of confusion repackaging the image, since the OPO's logo.bin places the ".png" into the name of the images, but eventually, I got it all right. I flashed the modified logo.bin, but when I tried to reboot, my computer started installing drivers for QHSUSB. This had happened before when I was playing around with the LOGO partition, and it was an easy fix. I just jammed the power button for 30 seconds, and prayed to God. Thankfully, the phone booted up, but the splash screen I had created had its colors messed up. I assumed that I needed to swap the red and the blue, so I used the parameter you provided and packaged a new splash screen. I flashed it, and everything looked fine.
It's definitely a little more intimidating than the tool that @chillstep1998 created, but with a little trial-and-error, it's certainly doable. Great work!
Oh, yeah. I needed to use the -s parameter too and I skipped putting the logo.bin in through fastboot - I just modded an install zip and flashed it in with TWRP.
Thanks for this program. Glad that it's back from someone for CM12 as we waited for quite some time now. I have a query though about repacking.
logoinjector.exe -i logo.bin -j (image name you want to replace)
Is it possible to put different file names at the same time if I want to replace two or three files at the same time like this
logoinjector.exe -i logo.bin -j 4-fastboot.png 5-lowpower.png
because it doesn't work for me, I will have to run this command for the number of times I have files to replaced?
Does this method work with custom roms based on nightly cm 12.1?I'm currently on exodus rom.
Spyrious said:
Does this method work with custom roms based on nightly cm 12.1?I'm currently on exodus rom.
Click to expand...
Click to collapse
I suppose it should because logo.bin would be same for all those roms.
Sent from my "GT-I9300/1+1" powered by Carbon Rom & Boeffla/ak Kernel
Fueled by 7000mAh ZeroLemon Battery
Awesome! I had to also use the -s parameter but it worked great. Thanks OP.
Is this an appropriate place to start sharing logos or do we need a separate thread for that?
makers_mark said:
Code:
/*
* Logo Injector v1.0
[/QUOTE]
WOW - Thanks !
I've waited a LONG time for this !
Few things to let you know
1. On my Win 8.1 x64 I run Comodo CIS - which prevents LogoInjector.exe from creating the PNG images after I run "logoInjector.exe -i logo.bin -d".
This is of course the behavior of a false-positive, the overprotection of comodo A/V.
So once I temporary disable it -LogoInjector can successfully create the PNGs.
2. I also, as already reported, needed to use the -s switch inorder to get the right colors
3. I would also very much appreciate if it will be possible to inject multiple images at once with one command.
4. I can advise to update the OP with the size limits of the logo.bin ( if there is at all )
I injected a 276KB png into 335KB logo.bin and got a modified logo.bin size 12,171KB ( 12MB ! ) - never the less - After I flashed it - everything is OK.
5. I can advise to put in the OP a link to a tool/method ( if exist at all ) that can enable extraction of the current installed logo.bin from the phone it self.
button line - VERY GOOD WORK ! :good: :good: :good::highfive:
[B][U]EDIT:[/U][/B]
I attach a[B] FLASHABLE ZIP FILE that INSTALLS the logo.bin[/B] found inside the zip.
just replace the logo.bin in the root of the zip with your custom made "logo.bin".
This method is an alternative to the fastboot command "fastboot flash LOGO logo.bin"
Click to expand...
Click to collapse
330kb modified bootlogo
I got a 330KB modified logo.bin file
Isn't it supposed to be around 16MB?
I'm currently on cm12.1 06/08/2015 (DD/MM/YYYY)
ranger1021994 said:
I got a 330KB modified logo.bin file
Isn't it supposed to be around 16MB?
I'm currently on cm12.1 06/08/2015 (DD/MM/YYYY)
Click to expand...
Click to collapse
Size depends on the size of embedded images.
Sent from my "GT-I9300/1+1" powered by Carbon Rom & Boeffla/ak Kernel
Fueled by 7000mAh ZeroLemon Battery
LOGO.bin file size
nicesoni_ash said:
Size depends on the size of embedded images.
Sent from my "GT-I9300/1+1" powered by Carbon Rom & Boeffla/ak Kernel
Fueled by 7000mAh ZeroLemon Battery
Click to expand...
Click to collapse
My original LOGO file is 16MB big.
How can my modified file be only 330KB?
I don't know what is causing the file size to come down drastically from 16MB to just 330KB. Is it normal? Because I'm not sure it is
ranger1021994 said:
My original LOGO file is 16MB big.
How can my modified file be only 330KB?
I don't know what is causing the file size to come down drastically from 16MB to just 330KB. Is it normal? Because I'm not sure it is
Click to expand...
Click to collapse
Check all image files size individually and if the difference is not that huge then surely something is wrong.
Sent from my "GT-I9300/1+1" powered by Carbon Rom & Boeffla/ak Kernel
Fueled by 7000mAh ZeroLemon Battery
nicesoni_ash said:
Check all image files size individually and if the difference is not that huge then surely something is wrong.
Click to expand...
Click to collapse
ranger1021994 said:
My original LOGO file is 16MB big.
How can my modified file be only 330KB?
I don't know what is causing the file size to come down drastically from 16MB to just 330KB. Is it normal? Because I'm not sure it is
Click to expand...
Click to collapse
gps3dx said:
I injected a 276KB png into 335KB logo.bin and got a modified logo.bin size 12,171KB ( 12MB ! ) - never the less - After I flashed it - everything is OK.
Click to expand...
Click to collapse
@read my quote.
if you enter an image with only ONE COLOR background ( Same RBG values, not gradient ! ) it can drastically lower the final file size.
You can of course use black as background color and crop the images size to your content, so that the cropped areas will be filled automatically by the OPO as black color.
The idea here is that if you'll have full sized photo (1080x1920) with small area content (like 300x400), it contains black areas ( for no reason ) which enlarges the final file size - which make no sense.
nevertheless, Read my quote, as you can see I flash a ~12MB file while the original file was 335KB - and everything works!
I have a stupid question, how can I know whether I have a CM12 or CM11 logo in my oneplus? I have flashed CM11 as a primary rom and flashed CM12 as a secondary rom. I do remember that I flashed a CM12 zip to be able to flash CM12 as a secondary rom but that's a faint memory and I want to be sure before flashing a logo because last time I did that, I lost everything in my Oneplus and had to start from the beginning first by reviving it from its dead state.
Thanks.
nicesoni_ash said:
I have a stupid question, how can I know whether I have a CM12 or CM11 logo in my oneplus? I have flashed CM11 as a primary rom and flashed CM12 as a secondary rom. I do remember that I flashed a CM12 zip to be able to flash CM12 as a secondary rom but that's a faint memory and I want to be sure before flashing a logo because last time I did that, I lost everything in my Oneplus and had to start from the beginning first by reviving it from its dead state.
Thanks.
Click to expand...
Click to collapse
EDIT: Deleted for misinformation
It works!!
gps3dx said:
@read my quote.
if you enter an image with only ONE COLOR background ( Same RBG values, not gradient ! ) it can drastically lower the final file size.
You can of course use black as background color and crop the images size to your content, so that the cropped areas will be filled automatically by the OPO as black color.
The idea here is that if you'll have full sized photo (1080x1920) with small area content (like 300x400), it contains black areas ( for no reason ) which enlarges the final file size - which make no sense.
nevertheless, Read my quote, as you can see I flash a ~12MB file while the original file was 335KB - and everything works!
Click to expand...
Click to collapse
AMAZING!
It works!!
Finally
Thanks a lot!

Can't get info back into android app from php webpage

My english is very bad, so i hope you understand.
I make my own apps, and most off the time in fragment activities
On my website i have a php script, that will check if the username and password is correct filled in in the application.
I hace to get back from the website the userID, firstname and email address from the database, this info is stored in a json format like below:
Code:
$result1["rol"] = $rol;
$result1["login"] = $login;
$result1["username"] = $Qusername;
$result1["userid"] = $userID;
$result1["mail"] = $Qmail;
echo json_encode($result1);
my php scipt woks perfectly, only how to get the $result1 back to android app??
I have the following on my website visible
Code:
{"rol":"9","login":"1","username":"christiaan","userid":"9998","mail":"c.***@h***e.nl"}
And I tried to read that in android with:
Code:
val apiResponse = URL(urlW).readText()
val url = URL(urlW)
val urlConnection = url.openConnection() as HttpURLConnection
val text = urlConnection.inputStream.bufferedReader().readText()
tUser.text = text
urlConnection.disconnect()
urlW contains the full link.
I write app in kotlin.
I have it almost working, but now the app crashes when it's an incorrect username or password:
Code:
val urlW = "http://www.*****.nl/mobile.php?username=*****&password=*****"
//webA.visibility = View.VISIBLE
webA.loadUrl(urlW)
// Request a string response from the provided URL.
val stringRequest = StringRequest(
Request.Method.GET, urlW,
{ response ->
// Display the first 200 characters of the response string.
val onlineString = "${response.substring(0, 200)}"
val explodeOnline = onlineString.split("#").toTypedArray()
tUser.text = explodeOnline[1] + " : " + explodeOnline[2] + " \n " + explodeOnline[3] + " : " + explodeOnline[4]
tPass.text = explodeOnline[5] + " : " + explodeOnline[6] + " \n " + explodeOnline[7] + " : " + explodeOnline[8] + " \n " + explodeOnline[9] + " : " + explodeOnline[10]
},
{ tUser.text = "That didn't work!" })
// Add the request to the RequestQueue.
queue.add(stringRequest)

How To Guide Where does the Magisk App store the settings?

The Magisk App uses the standard location for storing the settings of the App - on my phone this is the directory
/data/user_de/0/com.topjohnwu.magisk/shared_prefs
e.g.
Code:
ASUS_I006D:/ # ls -l /data/user_de/0/com.topjohnwu.magisk/shared_prefs
total 8
-rw-rw---- 1 u0_a129 u0_a129 163 2022-12-06 12:20 com.topjohnwu.magisk_preferences.xml
-rw-rw---- 1 u0_a129 u0_a129 116 2022-12-04 15:09 su_timeout.xml
ASUS_I006D:/ #
The files in that directory are standard xml files, e.g.
Code:
ASUS_I006D:/ # cat /data/user_de/0/com.topjohnwu.magisk/shared_prefs/com.topjohnwu.magisk_preferences.xml
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
<string name="update_channel">-1</string>
<string name="su_auto_response">0</string>
</map>
ASUS_I006D:/ #
The file com.topjohnwu.magisk_preferences.xml is used to store the settings of the Magisk App.
To change one of the settings for the Magisk App via script just change the value for the corresponding entry in the XML file (or create the entry if it's missing).
For example the entry for the setting "Automatic Response" is "su_auto_response" and the known values for this entry are: Grant = 2, Deny = 1 , Prompt = 0
If the Magisk App is currently running it must be stopped (for example via the Android Settings) to activate the new setting.
To stop the Magisk app via CLI command use
Bash:
am force-stop com.topjohnwu.magisk
The known values for this file are listed in the source code for the Magisk App:
https://github.com/topjohnwu/Magisk...main/java/com/topjohnwu/magisk/core/Config.kt
As of 06.12.2022 for the Magisk App version 25.2 the defined entries and values for the file are:
Spoiler: Known keys and vlaues for the settings xml file
C++:
object Key {
// db configs
const val ROOT_ACCESS = "root_access"
const val SU_MULTIUSER_MODE = "multiuser_mode"
const val SU_MNT_NS = "mnt_ns"
const val SU_BIOMETRIC = "su_biometric"
const val ZYGISK = "zygisk"
const val DENYLIST = "denylist"
const val SU_MANAGER = "requester"
const val KEYSTORE = "keystore"
// prefs
const val SU_REQUEST_TIMEOUT = "su_request_timeout"
const val SU_AUTO_RESPONSE = "su_auto_response"
const val SU_NOTIFICATION = "su_notification"
const val SU_REAUTH = "su_reauth"
const val SU_TAPJACK = "su_tapjack"
const val CHECK_UPDATES = "check_update"
const val UPDATE_CHANNEL = "update_channel"
const val CUSTOM_CHANNEL = "custom_channel"
const val LOCALE = "locale"
const val DARK_THEME = "dark_theme_extended"
const val REPO_ORDER = "repo_order"
const val SHOW_SYSTEM_APP = "show_system"
const val DOWNLOAD_DIR = "download_dir"
const val SAFETY = "safety_notice"
const val THEME_ORDINAL = "theme_ordinal"
const val BOOT_ID = "boot_id"
const val ASKED_HOME = "asked_home"
const val DOH = "doh"
}
object Value {
// Update channels
const val DEFAULT_CHANNEL = -1
const val STABLE_CHANNEL = 0
const val BETA_CHANNEL = 1
const val CUSTOM_CHANNEL = 2
const val CANARY_CHANNEL = 3
const val DEBUG_CHANNEL = 4
// root access mode
const val ROOT_ACCESS_DISABLED = 0
const val ROOT_ACCESS_APPS_ONLY = 1
const val ROOT_ACCESS_ADB_ONLY = 2
const val ROOT_ACCESS_APPS_AND_ADB = 3
// su multiuser
const val MULTIUSER_MODE_OWNER_ONLY = 0
const val MULTIUSER_MODE_OWNER_MANAGED = 1
const val MULTIUSER_MODE_USER = 2
// su mnt ns
const val NAMESPACE_MODE_GLOBAL = 0
const val NAMESPACE_MODE_REQUESTER = 1
const val NAMESPACE_MODE_ISOLATE = 2
// su notification
const val NO_NOTIFICATION = 0
const val NOTIFICATION_TOAST = 1
// su auto response
const val SU_PROMPT = 0
const val SU_AUTO_DENY = 1
const val SU_AUTO_ALLOW = 2
// su timeout
val TIMEOUT_LIST = intArrayOf(0, -1, 10, 20, 30, 60)
// repo order
const val ORDER_NAME = 0
const val ORDER_DATE = 1
}
If in doubt what key or value to use just create a backup of the config file; change the approbiate key in the setting in the Magisk App and compare the config file with the just created backup file.

Categories

Resources