[Q] Help unbrick completely unmodified Razr I - RAZR i Q&A, Help & Troubleshooting

Hello, my Motorola Razr I xt890 was completely stock, bought simfree. No rooting or unlocking, no modifications, nothing.
It started giving some errors (pop up boxes kept showing and I couldn't close them). Eventually I managed to turn off the phone and since then, it won't turn back on.
When I attach a USB cable the green light turns on. Nothing appears on the screen. If I hold down the volume buttons and the power button, the green light eventually turns off, but nothing appears on screen.
When the phone is attached to my PC via USB, Windows makes the "USB connected" and "USB disconnected" sounds, but nothing appears on My Computer.
Is there any hope for it?

sunniguy said:
Hello, my Motorola Razr I xt890 was completely stock, bought simfree. No rooting or unlocking, no modifications, nothing.
When I attach a USB cable the green light turns on. Nothing appears on the screen. If I hold down the volume buttons and the power button, the green light eventually turns off, but nothing appears on screen.
When the phone is attached to my PC via USB, Windows makes the "USB connected" and "USB disconnected" sounds, but nothing appears on My Computer.
Click to expand...
Click to collapse
You won't believe it, but the same exact thing happened to me last night!
My BL is also still locked, running JB, but I used twerkmymoto to get root and didn't do any modifications lately, meaning nothing could have triggered the brick.
So this is what happened to me:
I used my phone, got the 10% low battery warning but was too lazy to recharge it.
Checked my phone several hours later, saw the led flashing in white, meaning I got a new notification (Whatsapp, FB,...) so I tried to turn it on, but nothing helped. Not pressing the power button long, short,...
I thought my phone is just completely out of battery and will work again once I charge it.
So I connected it to my PC, tried adb reboot, didn't work, checked adb devices and it listed me my device but with the status "offline". I thought, maybe thats because I have a lock screen security pattern activated.
Since we can't unplug the battery, I hit all 3 buttons then (power, vol+,vol-), and it "restarted", meaning its in the same stage ever since.
I also turned my phone "on", meaning that the green led is on and let it on until it didn't do anything anymore, meaning the battery completely dried out.
Then I hooked it up to a charger overnight for the full time with no interruption, but it still didn't charge.
Now here is what I tried since then:
power, vol+,vol-
power, vol+
power, vol-
power, vol+,vol-,camera button
Charging via outlet charger
-->green led turns on, nothing else, no display, no vibrate, no M logo
Charging via external battery
-->green led turns on, nothing else, no display, no vibrate, no M logo; charger doesn't get warm, meaning the phone battery doesn't get charged
Connecting via USB
-->green led turns on, nothing else, no display, no vibrate, no M logo, Windows makes the "USB connected" and "USB disconnected" sound, phone is connected for around 2min30seconds, is disconnected for 30sec and reconnects then
When the phone is conected via USB, in the device manager I see a device called Medfield but the system can't find any drivers, (I have RSD 6.1.6, the Motorola Device Manager and this: https://software.intel.com/en-us/android/articles/intel-usb-driver-for-android-devices installed)
RSD of course didn't find any device yet, since no driver was installed yet.
So I manually selected a driver for the medfield device, here is a list of possible devices I can chose from:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I don't know whether I have those driver because of adb minimalist, the Motorola Device Manager or cause I use the Nexus Root Toolkit for my Nexus
I tried the ADB Interface v10 driver (since its the newest) and the Composite ADB Interface v10 and both work, meaning the device manager doesn't show me any errors.
RSD then shows the device.
fastboot doesn't find the phone, but RSD finds it but can't flash anything since it can't start the phone in fastboot mode
Now what is there that we can do to get it fixed? I have very important data on my phone that I'd hate to lose, so if somehow its possible to get it to a point where I can adb pull all my data, that would be awesome!
Again, I didn't play around with any system files, its still a locked BL, no custom rom and my phone only ran out of battery and doesn't boot up anymore.
Thanks a lot in advance!
EDIT:
I read a bit more here:
xsftk to flash dnx and ifwi: http://forum.xda-developers.com/showthread.php?t=2184877
http://forum.xda-developers.com/droid-razr-m/help/droid-razr-m-hardbrick-fix-t2934432
http://forum.xda-developers.com/showthread.php?t=2533049
really good one: http://forum.xda-developers.com/moto-x/general/how-to-resurrecting-bricked-moto-x-t2629057
http://forum.xda-developers.com/droid-ultra/general/droid-ultra-maxx-brick-recovery-t2830806
http://forum.xda-developers.com/showthread.php?t=2149889
Now from what I understand, the bootloader got screwed up (don't ask me how this is even possible with a locked BL)
I still wonder, whether it really is a BL / kernel / recovery error or my battery just fried. Any thoughts on how I can find out whether its the OS or the battery?
Looks like my next step is to get a factory cable but I don't think this will help cause if fastboot can't find the phone then there is nothing to flash.

I dont have a solution. Just a thought. The device shows as medfield. Maybe with the xfstk flasher u can flash something to the device. U could try to boot in Medfield flash mode and install the JB files. Like the iwfi and motoboot. Read on it and try.

added more description to my previous post

For the ones who are interested in this matter and for future references, here is an update:
I built myself a Motorola factory cable, its quite easy when you buy an adapter rather than modifying a cable, I bought this one: "LogiLink AU0010 USB Adapter Mini USB female zu Micro USB male" from amazon for 1.94€
Since a friend of mine has a Razr I, too I could compare the broken and the working phones and see how they react to each cable, so a quick summary of that:
working phone: (powered off)
volume - & regular cable = charging without powering up the full OS
volume - & factory cable = powering up the full OS, once you remove the cable it instantly turns off (cause it receives it power through the cable and not through the battery)
camera button & reg. or factory cable= green LED & no display & no fastboot & PC finds the revice as MEDFIELD
now when I do all the same with my broken phone, nothing works, meaning it always just goes into the MEDFIELD stage.
When its in the MEFIELD state, you need to manually install the "xFSTK libusb-win32 Driver" for the MEDFIELD device in the device manager, then RSDlite and xFSTK-DLDR can find the device. This worked much better for me in XP than on Win 8.1 so I used my VM to flash it in XP.
RSD of course cannot flash anything cause it always says the phone cant be booted into fastboot mode.
with xFSTK-DLDR you can flash the IFWI and the DNX file (successful for me) but still, didn't help recovering the phone.
But together with the factory cable I found out, that it really is not a battery issue but that the bootloader really fried itself for no reason on stock firmware and a locked BL!

dagoban said:
For the ones who are interested in this matter and for future references, here is an update:
I built myself a Motorola factory cable, its quite easy when you buy an adapter rather than modifying a cable, I bought this one: "LogiLink AU0010 USB Adapter Mini USB female zu Micro USB male" from amazon for 1.94€
Since a friend of mine has a Razr I, too I could compare the broken and the working phones and see how they react to each cable, so a quick summary of that:
working phone: (powered off)
volume - & regular cable = charging without powering up the full OS
volume - & factory cable = powering up the full OS, once you remove the cable it instantly turns off (cause it receives it power through the cable and not through the battery)
camera button & reg. or factory cable= green LED & no display & no fastboot & PC finds the revice as MEDFIELD
now when I do all the same with my broken phone, nothing works, meaning it always just goes into the MEDFIELD stage.
When its in the MEFIELD state, you need to manually install the "xFSTK libusb-win32 Driver" for the MEDFIELD device in the device manager, then RSDlite and xFSTK-DLDR can find the device. This worked much better for me in XP than on Win 8.1 so I used my VM to flash it in XP.
RSD of course cannot flash anything cause it always says the phone cant be booted into fastboot mode.
with xFSTK-DLDR you can flash the IFWI and the DNX file (successful for me) but still, didn't help recovering the phone.
But together with the factory cable I found out, that it really is not a battery issue but that the bootloader really fried itself for no reason on stock firmware and a locked BL!
Click to expand...
Click to collapse
So no battery issue. Now as u said it could be that the bootloader is corrupt and so doesn't boot. But part of the phone does boot because it can go into the medfield flash state and u can flash something with a positive return.
Another problem could be that the emmc is corrupt in some places. Then there is no way back, because we can't partition with the medfield flasher. Can only be done with jtag or something i read somewhere (intel).
With xFSTK-DLDR u can also flash the motoboot, or as it is called the bootloader (fastboot). IFWI and DNX (just firmware and medfield loader maybe?) won't solve it alone. If the part of the emmc where the bootloader is, still works u can in theorie flash the bootloader. I don't know anymore which command u need for xFSTK-DLDR to flash motoboot, but it can be found by reading through the ASUS/Acer recovery and bootloader unlocking guide for the intel device. And if it is only the bootloaders fault it hopefully will work, but most of the time when 1 thing is bad, another is also bad.
edit:
Ha found something i had written somewhere:
It is modified by me from the unbrick methode.
set PACKAGE_DIR=unbrick
set FWDNX=--fwdnx %PACKAGE_DIR%\dnx
set FWIMAGE=--fwimage %PACKAGE_DIR%\ifwi
set OSDNX=--osdnx %PACKAGE_DIR%\dnx
set OSIMAGE=--osimage %PACKAGE_DIR%\motoboot
unbrick\xfstk-dldr-solo.exe %FWDNX% %FWIMAGE% %OSDNX% %OSIMAGE% --verbose
Click to expand...
Click to collapse
The only thing i am not sure about is what to do with the FWDNX and OSDNX. We only got 1 dnx file. I compared the 2 dnx files from acer and they were exactly the same in size (bytes), so i assumed that they where the same and have just a different name. But i am not sure about this.
good luck!

Hazou said:
So no battery issue. Now as u said it could be that the bootloader is corrupt and so doesn't boot. But part of the phone does boot because it can go into the medfield flash state and u can flash something with a positive return.
Another problem could be that the emmc is corrupt in some places. Then there is no way back, because we can't partition with the medfield flasher. Can only be done with jtag or something i read somewhere (intel).
With xFSTK-DLDR u can also flash the motoboot, or as it is called the bootloader (fastboot). IFWI and DNX (just firmware and medfield loader maybe?) won't solve it alone. If the part of the emmc where the bootloader is, still works u can in theorie flash the bootloader. I don't know anymore which command u need for xFSTK-DLDR to flash motoboot, but it can be found by reading through the ASUS/Acer recovery and bootloader unlocking guide for the intel device. And if it is only the bootloaders fault it hopefully will work, but most of the time when 1 thing is bad, another is also bad.
edit:
Ha found something i had written somewhere:
It is modified by me from the unbrick methode.
The only thing i am not sure about is what to do with the FWDNX and OSDNX. We only got 1 dnx file. I compared the 2 dnx files from acer and they were exactly the same in size (bytes), so i assumed that they where the same and have just a different name. But i am not sure about this.
good luck!
Click to expand...
Click to collapse
OK, thx, will give this a try, too
If anyone is curious to see what my phone looks like, you can get it in the same stage without damaging anything.
Power off your phone
hold the camera button and then attach the usb cable to your PC, then the phone will 'boot' into the medfield state. You can just turn it off with the power button and power it on again to the regular use without damaging anything, just fyi

So here is what is happening when I'm trying to flash.
If you want to flash the Firmware you need to select a DnX and an IFWI, flashing only 1 of them won't work.
Same with Operating System, you cannot flash just the OS Image (motoboot), you need to flash the OS DnX, too.
So here is the output for the Firmware flash:
Code:
xfstklog_Fr_9._Jan_16-17-35_2015.txt
16:17:29 - XFSTK-LOG--virtual bool MedfieldDownloader::SetDevice(IGenericDevice*)
16:17:29 - XFSTK-LOG--virtual bool MedfieldDownloader::UpdateTarget()
16:17:29 - XFSTK-LOG--void MedfieldDownloader::Init()
16:17:29 - XFSTK-LOG--virtual bool MedfieldUSB20Device::eek:pen()
16:17:29 - XFSTK-LOG--USB Device found - Externally Specified for MT
16:17:29 - XFSTK-LOG--Bulk OUT endpoint in : 0x01
16:17:29 - XFSTK-LOG--Bulk IN endpoint in : 0x81
16:17:29 - XFSTK-LOG--void MedfieldDownloader::do_update(MedfieldOptions*)
16:17:29 - XFSTK-LOG--void MedfieldDownloader::do_update(char*, char*, char*, char*, char*, uint32)
16:17:29 - XFSTK-LOG--void MedfieldDownloader::do_update(char*, char*, char*, char*, char*, uint32)(C:/CFC_9.8.2I-50_SMI-26_S7_USASMIJBRTEU.xml/dnx.bin, C:/CFC_9.8.2I-50_SMI-26_S7_USASMIJBRTEU.xml/ifwi.bin, BLANK.bin, BLANK.bin, C:/CFC_9.8.2I-50_SMI-26_S7_USASMIJBRTEU.xml/dnx.bin, 0x80000000) b_continue_to_OS=0
16:17:29 - XFSTK-LOG--uint32 MedfieldDownloader::get_Opp_Code()
16:17:29 - XFSTK-LOG--Sending DnER...
16:17:30 - XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) DnER
16:17:30 - XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->DnER
16:17:30 - XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
16:17:30 - XFSTK-LOG--GetAck - DFRM(4)
16:17:30 - XFSTK-LOG--void MedfieldDownloader::_log_ack(long long unsigned int)
16:17:30 - XFSTK-LOG--void MedfieldDownloader::_check_file(char*)
16:17:30 - XFSTK-LOG--void MedfieldDownloader::_check_file(char*)
16:17:30 - XFSTK-LOG--C:/CFC_9.8.2I-50_SMI-26_S7_USASMIJBRTEU.xml/dnx.bin size:66528 bytes
16:17:30 - XFSTK-LOG--int MedfieldDownloader::firmware_upgrade_routine(char*, char*, uint32)
16:17:30 - XFSTK-LOG--C:/CFC_9.8.2I-50_SMI-26_S7_USASMIJBRTEU.xml/dnx.bin size:66528 bytes
16:17:30 - XFSTK-LOG--C:/CFC_9.8.2I-50_SMI-26_S7_USASMIJBRTEU.xml/ifwi.bin size:1937660 bytes
16:17:30 - XFSTK-STATUS--FW: Firmware download begining...
16:17:30 - XFSTK-LOG--allocating buffers for FW images...
16:17:30 - XFSTK-LOG--allocating buffers for primary/secondary security FW images...
16:17:30 - XFSTK-LOG--loading buffers for FW images...
16:17:30 - XFSTK-LOG--loading buffers for primary/secondary security FW images...
16:17:30 - XFSTK-LOG--loading buffers for FUPH...
16:17:30 - XFSTK-LOG--sending 6 DWORDS of DnxFW size and checksum...
16:17:30 - XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) à
16:17:30 - XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->à
16:17:30 - XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
16:17:30 - XFSTK-LOG--GetAck - DXBL(4)
16:17:30 - XFSTK-STATUS--FW: Sending DnX ...
16:17:31 - XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINARY__
16:17:31 - XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BINARY__
16:17:31 - XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
16:17:31 - XFSTK-LOG--GetAck - RTBD(4)
16:17:31 - XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) DBDS
16:17:31 - XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->DBDS
16:17:32 - XFSTK-LOG--int MedfieldDownloader::read_in_pipe(unsigned char*, uint32)
16:17:33 - XFSTK-LOG--Read - HLT0(4)
16:17:33 - XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
16:17:34 - XFSTK-LOG--GetAck - RUPHS(8)
16:17:34 - XFSTK-STATUS--FW: Sending FW Update Profile Hdr Size...
16:17:34 - XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) $
16:17:34 - XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->$
16:17:34 - XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
16:17:34 - XFSTK-LOG--GetAck - RUPH(4)
16:17:34 - XFSTK-STATUS--FW: Sending FW Update Profile Hdr...
16:17:34 - XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINARY__
16:17:34 - XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BINARY__
16:17:34 - XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
16:17:35 - XFSTK-LOG--GetAck - DMIP(4)
16:17:35 - XFSTK-STATUS--FW: Sending MIP...
16:17:35 - XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINARY__
16:17:35 - XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BINARY__
16:17:35 - XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
16:17:35 - XFSTK-LOG--GetAck - ER25(4)
16:17:35 - XFSTK-LOG--bool MedfieldDownloader::isfwdone()
[SIZE="4"]16:17:35 - [B]XFSTK-STATUS--Firmware download completed.[/B][/SIZE]
16:17:35 - XFSTK-LOG--virtual bool MedfieldDownloader::GetStatus()
16:17:35 - XFSTK-LOG--virtual bool MedfieldDownloader::Cleanup()
So this flash works, see 16:17:35 - XFSTK-STATUS--Firmware download completed.
And here is the output for the Operating System flash, so not trying to flash firmware and OS at the same time to understand better what is going wrong.
Code:
xfstklog_Fr_9._Jan_16-21-48_2015.txt
16:21:22 - XFSTK-LOG--virtual bool MedfieldDownloader::SetDevice(IGenericDevice*)
16:21:22 - XFSTK-LOG--virtual bool MedfieldDownloader::UpdateTarget()
16:21:22 - XFSTK-LOG--void MedfieldDownloader::Init()
16:21:22 - XFSTK-LOG--virtual bool MedfieldUSB20Device::eek:pen()
16:21:22 - XFSTK-LOG--USB Device found - Externally Specified for MT
16:21:22 - XFSTK-LOG--Bulk OUT endpoint in : 0x01
16:21:22 - XFSTK-LOG--Bulk IN endpoint in : 0x81
16:21:22 - XFSTK-LOG--void MedfieldDownloader::do_update(MedfieldOptions*)
16:21:22 - XFSTK-LOG--void MedfieldDownloader::do_update(char*, char*, char*, char*, char*, uint32)
16:21:22 - XFSTK-LOG--void MedfieldDownloader::do_update(char*, char*, char*, char*, char*, uint32)(BLANK.bin, BLANK.bin, C:/CFC_9.8.2I-50_SMI-26_S7_USASMIJBRTEU.xml/dnx.bin, C:/CFC_9.8.2I-50_SMI-26_S7_USASMIJBRTEU.xml/motoboot.bin, BLANK.bin, 0x80000001) b_continue_to_OS=1
16:21:22 - XFSTK-LOG--uint32 MedfieldDownloader::get_Opp_Code()
16:21:22 - XFSTK-LOG--Sending DnER...
16:21:22 - XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) DnER
16:21:22 - XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->DnER
16:21:22 - XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
16:21:22 - XFSTK-LOG--GetAck - DFRM(4)
16:21:22 - XFSTK-LOG--void MedfieldDownloader::_log_ack(long long unsigned int)
16:21:22 - XFSTK-LOG--int MedfieldDownloader::handle_no_size(uint32)
16:21:22 - XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32)
16:21:22 - XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->
16:21:22 - XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
16:21:23 - XFSTK-LOG--GetAck - HLT0(4)
16:21:23 - XFSTK-LOG--void MedfieldDownloader::_log_ack(long long unsigned int)
16:21:23 - XFSTK-LOG--void MedfieldDownloader::Init()
16:21:23 - XFSTK-LOG--virtual bool MedfieldUSB20Device::eek:pen()
16:21:23 - XFSTK-LOG--USB Device found - Externally Specified for MT
16:21:23 - XFSTK-LOG--Bulk OUT endpoint in : 0x01
16:21:23 - XFSTK-LOG--Bulk IN endpoint in : 0x81
16:21:23 - XFSTK-LOG--uint32 MedfieldDownloader::get_Opp_Code()
16:21:23 - XFSTK-LOG--Sending DnER...
16:21:23 - XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) DnER
16:21:23 - XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->DnER
16:21:23 - XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
[SIZE="4"]16:21:23 - XFSTK-LOG--[B]USB I/O ERROR RETRYING R/W[/B][/SIZE]
16:21:23 - XFSTK-LOG--void MedfieldDownloader::_log_ack(long long unsigned int)
16:21:23 - XFSTK-LOG--bool MedfieldDownloader::isosdone()
16:21:23 - XFSTK-LOG--bool MedfieldDownloader::isosdone()
[SIZE="4"]16:21:23 - XFSTK-STATUS--[B]Firmware download skipped. Continuing to OS...[/B][/SIZE]
16:21:23 - XFSTK-LOG--virtual bool MedfieldDownloader::GetStatus()
16:21:28 - XFSTK-STATUS--Reconnecting to device - Attempt #1
16:21:29 - XFSTK-STATUS--Reconnecting to device - Attempt #2
16:21:30 - XFSTK-STATUS--Reconnecting to device - Attempt #3
16:21:31 - XFSTK-STATUS--Reconnecting to device - Attempt #4
16:21:32 - XFSTK-STATUS--Reconnecting to device - Attempt #5
16:21:33 - XFSTK-STATUS--Reconnecting to device - Attempt #6
16:21:34 - XFSTK-STATUS--Reconnecting to device - Attempt #7
16:21:35 - XFSTK-STATUS--Reconnecting to device - Attempt #8
16:21:36 - XFSTK-STATUS--Reconnecting to device - Attempt #9
16:21:37 - XFSTK-STATUS--Reconnecting to device - Attempt #10
16:21:38 - XFSTK-STATUS--Reconnecting to device - Attempt #11
16:21:39 - XFSTK-STATUS--Reconnecting to device - Attempt #12
16:21:40 - XFSTK-STATUS--Reconnecting to device - Attempt #13
16:21:41 - XFSTK-STATUS--Reconnecting to device - Attempt #14
16:21:42 - XFSTK-STATUS--Reconnecting to device - Attempt #15
16:21:43 - XFSTK-STATUS--Reconnecting to device - Attempt #16
16:21:44 - XFSTK-STATUS--Reconnecting to device - Attempt #17
16:21:45 - XFSTK-STATUS--Reconnecting to device - Attempt #18
16:21:46 - XFSTK-STATUS--Reconnecting to device - Attempt #19
16:21:47 - XFSTK-STATUS--Reconnecting to device - Attempt #20
16:21:23 - XFSTK-LOG--USB I/O ERROR RETRYING R/W
16:21:23 - XFSTK-STATUS--Firmware download skipped. Continuing to OS...
What happens is, that the phone is still powered (LED still green) on but it disconnects (Windows USB removal sound) so for some reason its not possible to flash the OS and only the firmware :/
Its possible to flash a signed original Motorola motoboot to a locked BL phone, correct? (since its the original motoboot file)

dagoban said:
So here is what is happening when I'm trying to flash.
If you want to flash the Firmware you need to select a DnX and an IFWI, flashing only 1 of them won't work.
Same with Operating System, you cannot flash just the OS Image (motoboot), you need to flash the OS DnX, too.
So here is the output for the Firmware flash:
Code:
xfstklog_Fr_9._Jan_16-17-35_2015.txt
16:17:29 - XFSTK-LOG--virtual bool MedfieldDownloader::SetDevice(IGenericDevice*)
16:17:29 - XFSTK-LOG--virtual bool MedfieldDownloader::UpdateTarget()
16:17:29 - XFSTK-LOG--void MedfieldDownloader::Init()
16:17:29 - XFSTK-LOG--virtual bool MedfieldUSB20Device::eek:pen()
16:17:29 - XFSTK-LOG--USB Device found - Externally Specified for MT
16:17:29 - XFSTK-LOG--Bulk OUT endpoint in : 0x01
16:17:29 - XFSTK-LOG--Bulk IN endpoint in : 0x81
16:17:29 - XFSTK-LOG--void MedfieldDownloader::do_update(MedfieldOptions*)
16:17:29 - XFSTK-LOG--void MedfieldDownloader::do_update(char*, char*, char*, char*, char*, uint32)
16:17:29 - XFSTK-LOG--void MedfieldDownloader::do_update(char*, char*, char*, char*, char*, uint32)(C:/CFC_9.8.2I-50_SMI-26_S7_USASMIJBRTEU.xml/dnx.bin, C:/CFC_9.8.2I-50_SMI-26_S7_USASMIJBRTEU.xml/ifwi.bin, BLANK.bin, BLANK.bin, C:/CFC_9.8.2I-50_SMI-26_S7_USASMIJBRTEU.xml/dnx.bin, 0x80000000) b_continue_to_OS=0
16:17:29 - XFSTK-LOG--uint32 MedfieldDownloader::get_Opp_Code()
16:17:29 - XFSTK-LOG--Sending DnER...
16:17:30 - XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) DnER
16:17:30 - XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->DnER
16:17:30 - XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
16:17:30 - XFSTK-LOG--GetAck - DFRM(4)
16:17:30 - XFSTK-LOG--void MedfieldDownloader::_log_ack(long long unsigned int)
16:17:30 - XFSTK-LOG--void MedfieldDownloader::_check_file(char*)
16:17:30 - XFSTK-LOG--void MedfieldDownloader::_check_file(char*)
16:17:30 - XFSTK-LOG--C:/CFC_9.8.2I-50_SMI-26_S7_USASMIJBRTEU.xml/dnx.bin size:66528 bytes
16:17:30 - XFSTK-LOG--int MedfieldDownloader::firmware_upgrade_routine(char*, char*, uint32)
16:17:30 - XFSTK-LOG--C:/CFC_9.8.2I-50_SMI-26_S7_USASMIJBRTEU.xml/dnx.bin size:66528 bytes
16:17:30 - XFSTK-LOG--C:/CFC_9.8.2I-50_SMI-26_S7_USASMIJBRTEU.xml/ifwi.bin size:1937660 bytes
16:17:30 - XFSTK-STATUS--FW: Firmware download begining...
16:17:30 - XFSTK-LOG--allocating buffers for FW images...
16:17:30 - XFSTK-LOG--allocating buffers for primary/secondary security FW images...
16:17:30 - XFSTK-LOG--loading buffers for FW images...
16:17:30 - XFSTK-LOG--loading buffers for primary/secondary security FW images...
16:17:30 - XFSTK-LOG--loading buffers for FUPH...
16:17:30 - XFSTK-LOG--sending 6 DWORDS of DnxFW size and checksum...
16:17:30 - XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) à
16:17:30 - XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->à
16:17:30 - XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
16:17:30 - XFSTK-LOG--GetAck - DXBL(4)
16:17:30 - XFSTK-STATUS--FW: Sending DnX ...
16:17:31 - XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINARY__
16:17:31 - XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BINARY__
16:17:31 - XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
16:17:31 - XFSTK-LOG--GetAck - RTBD(4)
16:17:31 - XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) DBDS
16:17:31 - XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->DBDS
16:17:32 - XFSTK-LOG--int MedfieldDownloader::read_in_pipe(unsigned char*, uint32)
16:17:33 - XFSTK-LOG--Read - HLT0(4)
16:17:33 - XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
16:17:34 - XFSTK-LOG--GetAck - RUPHS(8)
16:17:34 - XFSTK-STATUS--FW: Sending FW Update Profile Hdr Size...
16:17:34 - XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) $
16:17:34 - XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->$
16:17:34 - XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
16:17:34 - XFSTK-LOG--GetAck - RUPH(4)
16:17:34 - XFSTK-STATUS--FW: Sending FW Update Profile Hdr...
16:17:34 - XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINARY__
16:17:34 - XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BINARY__
16:17:34 - XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
16:17:35 - XFSTK-LOG--GetAck - DMIP(4)
16:17:35 - XFSTK-STATUS--FW: Sending MIP...
16:17:35 - XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINARY__
16:17:35 - XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BINARY__
16:17:35 - XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
16:17:35 - XFSTK-LOG--GetAck - ER25(4)
16:17:35 - XFSTK-LOG--bool MedfieldDownloader::isfwdone()
[SIZE="4"]16:17:35 - [B]XFSTK-STATUS--Firmware download completed.[/B][/SIZE]
16:17:35 - XFSTK-LOG--virtual bool MedfieldDownloader::GetStatus()
16:17:35 - XFSTK-LOG--virtual bool MedfieldDownloader::Cleanup()
So this flash works, see 16:17:35 - XFSTK-STATUS--Firmware download completed.
And here is the output for the Operating System flash, so not trying to flash firmware and OS at the same time to understand better what is going wrong.
Code:
xfstklog_Fr_9._Jan_16-21-48_2015.txt
16:21:22 - XFSTK-LOG--virtual bool MedfieldDownloader::SetDevice(IGenericDevice*)
16:21:22 - XFSTK-LOG--virtual bool MedfieldDownloader::UpdateTarget()
16:21:22 - XFSTK-LOG--void MedfieldDownloader::Init()
16:21:22 - XFSTK-LOG--virtual bool MedfieldUSB20Device::eek:pen()
16:21:22 - XFSTK-LOG--USB Device found - Externally Specified for MT
16:21:22 - XFSTK-LOG--Bulk OUT endpoint in : 0x01
16:21:22 - XFSTK-LOG--Bulk IN endpoint in : 0x81
16:21:22 - XFSTK-LOG--void MedfieldDownloader::do_update(MedfieldOptions*)
16:21:22 - XFSTK-LOG--void MedfieldDownloader::do_update(char*, char*, char*, char*, char*, uint32)
16:21:22 - XFSTK-LOG--void MedfieldDownloader::do_update(char*, char*, char*, char*, char*, uint32)(BLANK.bin, BLANK.bin, C:/CFC_9.8.2I-50_SMI-26_S7_USASMIJBRTEU.xml/dnx.bin, C:/CFC_9.8.2I-50_SMI-26_S7_USASMIJBRTEU.xml/motoboot.bin, BLANK.bin, 0x80000001) b_continue_to_OS=1
16:21:22 - XFSTK-LOG--uint32 MedfieldDownloader::get_Opp_Code()
16:21:22 - XFSTK-LOG--Sending DnER...
16:21:22 - XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) DnER
16:21:22 - XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->DnER
16:21:22 - XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
16:21:22 - XFSTK-LOG--GetAck - DFRM(4)
16:21:22 - XFSTK-LOG--void MedfieldDownloader::_log_ack(long long unsigned int)
16:21:22 - XFSTK-LOG--int MedfieldDownloader::handle_no_size(uint32)
16:21:22 - XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32)
16:21:22 - XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->
16:21:22 - XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
16:21:23 - XFSTK-LOG--GetAck - HLT0(4)
16:21:23 - XFSTK-LOG--void MedfieldDownloader::_log_ack(long long unsigned int)
16:21:23 - XFSTK-LOG--void MedfieldDownloader::Init()
16:21:23 - XFSTK-LOG--virtual bool MedfieldUSB20Device::eek:pen()
16:21:23 - XFSTK-LOG--USB Device found - Externally Specified for MT
16:21:23 - XFSTK-LOG--Bulk OUT endpoint in : 0x01
16:21:23 - XFSTK-LOG--Bulk IN endpoint in : 0x81
16:21:23 - XFSTK-LOG--uint32 MedfieldDownloader::get_Opp_Code()
16:21:23 - XFSTK-LOG--Sending DnER...
16:21:23 - XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) DnER
16:21:23 - XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->DnER
16:21:23 - XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
[SIZE="4"]16:21:23 - XFSTK-LOG--[B]USB I/O ERROR RETRYING R/W[/B][/SIZE]
16:21:23 - XFSTK-LOG--void MedfieldDownloader::_log_ack(long long unsigned int)
16:21:23 - XFSTK-LOG--bool MedfieldDownloader::isosdone()
16:21:23 - XFSTK-LOG--bool MedfieldDownloader::isosdone()
[SIZE="4"]16:21:23 - XFSTK-STATUS--[B]Firmware download skipped. Continuing to OS...[/B][/SIZE]
16:21:23 - XFSTK-LOG--virtual bool MedfieldDownloader::GetStatus()
16:21:28 - XFSTK-STATUS--Reconnecting to device - Attempt #1
16:21:29 - XFSTK-STATUS--Reconnecting to device - Attempt #2
16:21:30 - XFSTK-STATUS--Reconnecting to device - Attempt #3
16:21:31 - XFSTK-STATUS--Reconnecting to device - Attempt #4
16:21:32 - XFSTK-STATUS--Reconnecting to device - Attempt #5
16:21:33 - XFSTK-STATUS--Reconnecting to device - Attempt #6
16:21:34 - XFSTK-STATUS--Reconnecting to device - Attempt #7
16:21:35 - XFSTK-STATUS--Reconnecting to device - Attempt #8
16:21:36 - XFSTK-STATUS--Reconnecting to device - Attempt #9
16:21:37 - XFSTK-STATUS--Reconnecting to device - Attempt #10
16:21:38 - XFSTK-STATUS--Reconnecting to device - Attempt #11
16:21:39 - XFSTK-STATUS--Reconnecting to device - Attempt #12
16:21:40 - XFSTK-STATUS--Reconnecting to device - Attempt #13
16:21:41 - XFSTK-STATUS--Reconnecting to device - Attempt #14
16:21:42 - XFSTK-STATUS--Reconnecting to device - Attempt #15
16:21:43 - XFSTK-STATUS--Reconnecting to device - Attempt #16
16:21:44 - XFSTK-STATUS--Reconnecting to device - Attempt #17
16:21:45 - XFSTK-STATUS--Reconnecting to device - Attempt #18
16:21:46 - XFSTK-STATUS--Reconnecting to device - Attempt #19
16:21:47 - XFSTK-STATUS--Reconnecting to device - Attempt #20
16:21:23 - XFSTK-LOG--USB I/O ERROR RETRYING R/W
16:21:23 - XFSTK-STATUS--Firmware download skipped. Continuing to OS...
What happens is, that the phone is still powered (LED still green) on but it disconnects (Windows USB removal sound) so for some reason its not possible to flash the OS and only the firmware :/
Its possible to flash a signed original Motorola motoboot to a locked BL phone, correct? (since its the original motoboot file)
Click to expand...
Click to collapse
That's bad news. They most likely disabled the download of the OS. I know that fastboot can flash motoboot, but u can't reach that.

Hazou said:
That's bad news. They most likely disabled the download of the OS. I know that fastboot can flash motoboot, but u can't reach that.
Click to expand...
Click to collapse
Well then at least we learned something along the process and then its all well documented for the next person who has the same questions
Thanks a lot @Hazou for looking into this!!!

dagoban said:
Well then at least we learned something along the process and then its all well documented for the next person who has the same questions
Thanks a lot Hazou for looking into this!!!
Click to expand...
Click to collapse
What happens if u do both at the same time? So using the full command to flash firmware and os? Because it gives the error at the moment it cant flash the firmware. Maybe it needs it to open the usb port?

Hazou said:
What happens if u do both at the same time? So using the full command to flash firmware and os? Because it gives the error at the moment it cant flash the firmware. Maybe it needs it to open the usb port?
Click to expand...
Click to collapse
It can flash the firmware but not the OS.
Enclosed is the log for flashing the firmware+OS, ignore the battery threshold, the phone needs at least 3.6V (even when using a factory cable) and it 'charges up' the phone til it has the needed 3.6V (so start reading at line 819)
As you can see, it suceeds with flashing the firmware but then it has issues with flashing the OS again
(line 844):
Code:
13:11:56 - XFSTK-STATUS--Firmware download completed. Continuing to OS...
http://pastebin.com/gebZwxp4

Since nothing worked I sent it to Motorola to get it repaired since my phone is still in warranty.
They also couldn't fix it so they replaced the motherboard...
At least now we know when you have this issue, its beyond any possibility of fixing it

dagoban said:
Since nothing worked I sent it to Motorola to get it repaired since my phone is still in warranty.
They also couldn't fix it so they replaced the motherboard...
At least now we know when you have this issue, its beyond any possibility of fixing it
Click to expand...
Click to collapse
A, happy ending . I still think it is an emmc error. Bug in the kernel most likely.

Hazou said:
So no battery issue. Now as u said it could be that the bootloader is corrupt and so doesn't boot. But part of the phone does boot because it can go into the medfield flash state and u can flash something with a positive return.
Another problem could be that the emmc is corrupt in some places. Then there is no way back, because we can't partition with the medfield flasher. Can only be done with jtag or something i read somewhere (intel).
With xFSTK-DLDR u can also flash the motoboot, or as it is called the bootloader (fastboot). IFWI and DNX (just firmware and medfield loader maybe?) won't solve it alone. If the part of the emmc where the bootloader is, still works u can in theorie flash the bootloader. I don't know anymore which command u need for xFSTK-DLDR to flash motoboot, but it can be found by reading through the ASUS/Acer recovery and bootloader unlocking guide for the intel device. And if it is only the bootloaders fault it hopefully will work, but most of the time when 1 thing is bad, another is also bad.
edit:
Ha found something i had written somewhere:
It is modified by me from the unbrick methode.
The only thing i am not sure about is what to do with the FWDNX and OSDNX. We only got 1 dnx file. I compared the 2 dnx files from acer and they were exactly the same in size (bytes), so i assumed that they where the same and have just a different name. But i am not sure about this.
good luck!
Click to expand...
Click to collapse
Hi Hazou,
I tried everything my razr i still Hardbricked
now i want tu tray this method:
set PACKAGE_DIR=unbrick
set FWDNX=--fwdnx %PACKAGE_DIR%\dnx
set FWIMAGE=--fwimage %PACKAGE_DIR%\ifwi
set OSDNX=--osdnx %PACKAGE_DIR%\dnx
set OSIMAGE=--osimage %PACKAGE_DIR%\motoboot
unbrick\xfstk-dldr-solo.exe %FWDNX% %FWIMAGE% %OSDNX% %OSIMAGE% --verbose
Question where i can get this files from (dnx, ifiw, motoboot) ?
I had CM11 before then downgrade to ICS 4.0.4. then used wrong script for rooting then got "Service Required code corrupt message".

miky03 said:
Hi Hazou,
I tried everything my razr i still Hardbricked
now i want tu tray this method:
set PACKAGE_DIR=unbrick
set FWDNX=--fwdnx %PACKAGE_DIR%\dnx
set FWIMAGE=--fwimage %PACKAGE_DIR%\ifwi
set OSDNX=--osdnx %PACKAGE_DIR%\dnx
set OSIMAGE=--osimage %PACKAGE_DIR%\motoboot
unbrick\xfstk-dldr-solo.exe %FWDNX% %FWIMAGE% %OSDNX% %OSIMAGE% --verbose
Question where i can get this files from (dnx, ifiw, motoboot) ?
I had CM11 before then downgrade to ICS 4.0.4. then used wrong script for rooting then got "Service Required code corrupt message".
Click to expand...
Click to collapse
So u where on JB, got CM11 booting and then went to flash ICS through rsd-lite? y, that is asking for problems. Manny people have had that issue.
Medfield flash is indeed possibly the only way back. Those kind of files can be extracted from an ICS and/or JB rsd_lite package. If you are on ICS, try the ICS ones first. if that doesn't work, try the JB ones.
But what script did u use?

uh oh, downgraded to ICS? Not a good idea
@miky03 Make sure you read my entire post here: ttp://forum.xda-developers.com/showpost.php?p=57676067&postcount=2
Also read ALL the posts that I linked in the EDIT section.
If the GUI doesn't work with the files from ICS / JB, most likely your phone is fully bricked. You are not the 1st one who got it to this stage.
@Hazou I think he is refering to this script: http://forum.xda-developers.com/showthread.php?t=2184877
@miky03 you'll see that the script doesn't really do much different than doing it the manual way with xFSTK

dagoban said:
uh oh, downgraded to ICS? Not a good idea
@miky03 Make sure you read my entire post here: ttp://forum.xda-developers.com/showpost.php?p=57676067&postcount=2
Also read ALL the posts that I linked in the EDIT section.
If the GUI doesn't work with the files from ICS / JB, most likely your phone is fully bricked. You are not the 1st one who got it to this stage.
@Hazou I think he is refering to this script: http://forum.xda-developers.com/showthread.php?t=2184877
@miky03 you'll see that the script doesn't really do much different than doing it the manual way with xFSTK
Click to expand...
Click to collapse
hi,
this script http://forum.xda-developers.com/showthread.php?t=2184877 indeed do not work for me.
Sorry for asking but i spend so much time with reading around I'm very tired, if it not a big deal for you, can you please exactly say me how i should modify this script ?
thanks a lot.
---------- Post added at 12:31 AM ---------- Previous post was at 12:06 AM ----------
Hazou said:
So u where on JB, got CM11 booting and then went to flash ICS through rsd-lite? y, that is asking for problems. Manny people have had that issue.?
Click to expand...
Click to collapse
Yes I was on CM11 and every thing was working perfect really great job thanks
I needed more space so I started removing the apps to system partition and something got wrong.
Then I could reach only fastboot so I flashed with RSD Lite the only image I could find on my HDD, unfortunately it was 4.0.4 but it worked, that is the funny thing so I had unlocked Bootloader with unrooted phone and it worked really well.
I was trying to flash a CWM recovery but all the time it was overwritten by motorola one, so i needed root.
Then I used wrong rooting skript for JB ant here it happens i got "Service Required code corrupt message" message.
---------- Post added at 12:55 AM ---------- Previous post was at 12:31 AM ----------
I did this
Bathfile.bat
Code:
cd unbrick
xfstk-dldr-solo.exe --fwdnx dnx --fwimage ifwi --osdnx dnx --osimage motoboot --verbose
pause
I got this
Code:
XFSTK Downloader Solo 1.1.0a
Copyright (c) 2011 Intel Corporation
Intel SoC Device Detection Failed: Attempt #0
Intel SoC Device Detection Failed: Attempt #1
Intel SoC Device Detection Failed: Attempt #2
Intel SoC Device Detection Failed: Attempt #3
Intel SoC Device Detection Failed: Attempt #4
Intel SoC Device Detection Failed: Attempt #5
Intel SoC Device Detection Failed: Attempt #6
Intel SoC Device Detection Failed: Attempt #7
Intel SoC Device Detection Failed: Attempt #8
Intel SoC Device Detection Failed: Attempt #9
Intel SoC Device Detection Failed: Attempt #10
Intel SoC Device Detection Failed: Attempt #11
Intel SoC Device Detection Failed: Attempt #12
Intel SoC Device Detection Failed: Attempt #13
Intel SoC Device Detection Failed: Attempt #14
Intel SoC Device Detection Failed: Attempt #15
Intel SoC Device Detection Failed: Attempt #16
.Intel SoC Device Detection Found
Parsing Commandline....
Registering Status Callback....
.Initiating Download Process....
..XFSTK-LOG--virtual bool MedfieldDownloader::SetDevice(IGenericDevice*)
XFSTK-LOG--virtual bool MedfieldDownloader::UpdateTarget()
XFSTK-LOG--void MedfieldDownloader::Init()
XFSTK-LOG--virtual bool MedfieldUSB20Device::eek:pen()
XFSTK-LOG--USB Device found - Externally Specified for MT
XFSTK-LOG--Bulk OUT endpoint in : 0x01
XFSTK-LOG--Bulk IN endpoint in : 0x81
XFSTK-LOG--void MedfieldDownloader::do_update(MedfieldOptions*)
XFSTK-LOG--void MedfieldDownloader::do_update(char*, char*, char*, char*, char*,
uint32)
XFSTK-LOG--void MedfieldDownloader::do_update(char*, char*, char*, char*, char*,
uint32)(dnx, ifwi, dnx, motoboot, dnx, 0x80000000) b_continue_to_OS=0
XFSTK-LOG--uint32 MedfieldDownloader::get_Opp_Code()
XFSTK-LOG--Sending DnER...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) DnER
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->DnER
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - DxxM(4)
XFSTK-LOG--void MedfieldDownloader::_log_ack(long long unsigned int)
XFSTK-LOG--void MedfieldDownloader::_check_file(char*)
XFSTK-LOG--void MedfieldDownloader::_check_file(char*)
XFSTK-LOG--dnx size:66528 bytes
XFSTK-LOG--int MedfieldDownloader::firmware_upgrade_routine(char*, char*, uint32
)
XFSTK-LOG--dnx size:66528 bytes
XFSTK-LOG--ifwi size:1937464 bytes
XFSTK-STATUS--FW: Firmware download begining...
XFSTK-LOG--allocating buffers for FW images...
XFSTK-LOG--allocating buffers for primary/secondary security FW images...
20690197494632468
XFSTK-LOG--loading buffers for FW images...
XFSTK-LOG--loading buffers for primary/secondary security FW images...
XFSTK-LOG--loading buffers for FUPH...
XFSTK-LOG--sending 6 DWORDS of DnxFW size and checksum...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) Ó♥☺
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->Ó♥☺
XFSTK-PROGRESS--0
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - DXBL(4)
XFSTK-STATUS--FW: Sending DnX ...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--8
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - RTBD(4)
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) DBDS
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->DBDS
XFSTK-LOG--int MedfieldDownloader::read_in_pipe(unsigned char*, uint32)
XFSTK-LOG--Read - ♦(4)
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) RRBD
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->RRBD
XFSTK-LOG--int MedfieldDownloader::read_in_pipe(unsigned char*, uint32) ♦
XFSTK-LOG--Read - BATI♦(16)
XFSTK-STATUS--BATI: Battery power is too low, charging up ...
XFSTK-STATUS--BATI:42415449: Battery voltage: 0xbd(3.562304V) The threshold: 0xb
f(3.600000V)
XFSTK-PROGRESS--8
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - RTBD(4)
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) DBDS
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->DBDS
XFSTK-LOG--int MedfieldDownloader::read_in_pipe(unsigned char*, uint32) BATI
XFSTK-LOG--Read - ♦(4)
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) RRBD
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->RRBD
XFSTK-LOG--int MedfieldDownloader::read_in_pipe(unsigned char*, uint32) ♦
XFSTK-LOG--Read - BATI♦(16)
XFSTK-STATUS--BATI: Battery power is too low, charging up ...
XFSTK-STATUS--BATI:42415449: Battery voltage: 0xbe(3.581152V) The threshold: 0xb
f(3.600000V)
XFSTK-PROGRESS--8
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - RTBD(4)
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) DBDS
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->DBDS
XFSTK-LOG--int MedfieldDownloader::read_in_pipe(unsigned char*, uint32) BATI
XFSTK-LOG--Read - HLT0♦(4)
XFSTK-PROGRESS--8
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - RUPHS(8)
XFSTK-STATUS--FW: Sending FW Update Profile Hdr Size...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) $
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->$
XFSTK-PROGRESS--16
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - RUPH(4)
XFSTK-STATUS--FW: Sending FW Update Profile Hdr...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--25
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - DMIP(4)
XFSTK-STATUS--FW: Sending MIP...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--33
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - LOFW(4)
XFSTK-STATUS--FW: Sending first 128k...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--41
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - HIFW(4)
XFSTK-STATUS--FW: Sending second 128k...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--50
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - PSFW100(8)
XFSTK-STATUS--FW: Sending Primary Security FW 1 Chunk 2
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--58
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - PSFW101(8)
XFSTK-STATUS--FW: Sending Primary Security FW 1 Chunk 1
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--66
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - PSFW102(8)
XFSTK-STATUS--FW: Sending Primary Security FW 1 Chunk 0
XFSTK-LOG--Allocation done
XFSTK-LOG--Writing the Bytes
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--75
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - SSFW00(8)
XFSTK-STATUS--FW: Sending secondary security fw Chunk 0
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--83
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - PSFW200(8)
XFSTK-STATUS--FW: Sending Primary Security FW 2 Chunk 0
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--91
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - VEDFW00(8)
XFSTK-LOG--sending VED FW Chunk 0
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--91
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - SuCP(4)
XFSTK-STATUS--FW: Sending ROM Patch Chunk 0
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--100
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - DMIP(4)
XFSTK-STATUS--FW: Sending MIP...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--108
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - LOFW(4)
XFSTK-STATUS--FW: Sending first 128k...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--116
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - HIFW(4)
XFSTK-STATUS--FW: Sending second 128k...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--125
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - PSFW100(8)
XFSTK-STATUS--FW: Sending Primary Security FW 1 Chunk 2
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--133
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - PSFW101(8)
XFSTK-STATUS--FW: Sending Primary Security FW 1 Chunk 1
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--141
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - PSFW102(8)
XFSTK-STATUS--FW: Sending Primary Security FW 1 Chunk 0
XFSTK-LOG--Allocation done
XFSTK-LOG--Writing the Bytes
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--150
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - SSFW00(8)
XFSTK-STATUS--FW: Sending secondary security fw Chunk 0
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--158
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - PSFW200(8)
XFSTK-STATUS--FW: Sending Primary Security FW 2 Chunk 0
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--166
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - VEDFW00(8)
XFSTK-LOG--sending VED FW Chunk 0
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--166
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - SuCP(4)
XFSTK-STATUS--FW: Sending ROM Patch Chunk 0
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--175
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - HLT$(4)
XFSTK-STATUS--FW: Firmware update comepleted...
XFSTK-PROGRESS--100
XFSTK-PROGRESS--100
XFSTK-LOG--bool MedfieldDownloader::isfwdone()
XFSTK-STATUS--Firmware download completed.
XFSTK-LOG--virtual bool MedfieldDownloader::Cleanup()
Press any key to continue . . .
Ok here some improvement, now when the RAZR starts I just get Green LED and black screen no Service Required code corrupt message any more
what I do wrong ?

miky03 said:
hi,
this script http://forum.xda-developers.com/showthread.php?t=2184877 indeed do not work for me.
Sorry for asking but i spend so much time with reading around I'm very tired, if it not a big deal for you, can you please exactly say me how i should modify this script ?
thanks a lot.
---------- Post added at 12:31 AM ---------- Previous post was at 12:06 AM ----------
Yes I was on CM11 and every thing was working perfect really great job thanks
I needed more space so I started removing the apps to system partition and something got wrong.
Then I could reach only fastboot so I flashed with RSD Lite the only image I could find on my HDD, unfortunately it was 4.0.4 but it worked, that is the funny thing so I had unlocked Bootloader with unrooted phone and it worked really well.
I was trying to flash a CWM recovery but all the time it was overwritten by motorola one, so i needed root.
Then I used wrong rooting skript for JB ant here it happens i got "Service Required code corrupt message" message.
---------- Post added at 12:55 AM ---------- Previous post was at 12:31 AM ----------
I did this
Bathfile.bat
Code:
cd unbrick
xfstk-dldr-solo.exe --fwdnx dnx --fwimage ifwi --osdnx dnx --osimage motoboot --verbose
pause
I got this
Code:
XFSTK Downloader Solo 1.1.0a
Copyright (c) 2011 Intel Corporation
Intel SoC Device Detection Failed: Attempt #0
Intel SoC Device Detection Failed: Attempt #1
Intel SoC Device Detection Failed: Attempt #2
Intel SoC Device Detection Failed: Attempt #3
Intel SoC Device Detection Failed: Attempt #4
Intel SoC Device Detection Failed: Attempt #5
Intel SoC Device Detection Failed: Attempt #6
Intel SoC Device Detection Failed: Attempt #7
Intel SoC Device Detection Failed: Attempt #8
Intel SoC Device Detection Failed: Attempt #9
Intel SoC Device Detection Failed: Attempt #10
Intel SoC Device Detection Failed: Attempt #11
Intel SoC Device Detection Failed: Attempt #12
Intel SoC Device Detection Failed: Attempt #13
Intel SoC Device Detection Failed: Attempt #14
Intel SoC Device Detection Failed: Attempt #15
Intel SoC Device Detection Failed: Attempt #16
.Intel SoC Device Detection Found
Parsing Commandline....
Registering Status Callback....
.Initiating Download Process....
..XFSTK-LOG--virtual bool MedfieldDownloader::SetDevice(IGenericDevice*)
XFSTK-LOG--virtual bool MedfieldDownloader::UpdateTarget()
XFSTK-LOG--void MedfieldDownloader::Init()
XFSTK-LOG--virtual bool MedfieldUSB20Device::eek:pen()
XFSTK-LOG--USB Device found - Externally Specified for MT
XFSTK-LOG--Bulk OUT endpoint in : 0x01
XFSTK-LOG--Bulk IN endpoint in : 0x81
XFSTK-LOG--void MedfieldDownloader::do_update(MedfieldOptions*)
XFSTK-LOG--void MedfieldDownloader::do_update(char*, char*, char*, char*, char*,
uint32)
XFSTK-LOG--void MedfieldDownloader::do_update(char*, char*, char*, char*, char*,
uint32)(dnx, ifwi, dnx, motoboot, dnx, 0x80000000) b_continue_to_OS=0
XFSTK-LOG--uint32 MedfieldDownloader::get_Opp_Code()
XFSTK-LOG--Sending DnER...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) DnER
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->DnER
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - DxxM(4)
XFSTK-LOG--void MedfieldDownloader::_log_ack(long long unsigned int)
XFSTK-LOG--void MedfieldDownloader::_check_file(char*)
XFSTK-LOG--void MedfieldDownloader::_check_file(char*)
XFSTK-LOG--dnx size:66528 bytes
XFSTK-LOG--int MedfieldDownloader::firmware_upgrade_routine(char*, char*, uint32
)
XFSTK-LOG--dnx size:66528 bytes
XFSTK-LOG--ifwi size:1937464 bytes
XFSTK-STATUS--FW: Firmware download begining...
XFSTK-LOG--allocating buffers for FW images...
XFSTK-LOG--allocating buffers for primary/secondary security FW images...
20690197494632468
XFSTK-LOG--loading buffers for FW images...
XFSTK-LOG--loading buffers for primary/secondary security FW images...
XFSTK-LOG--loading buffers for FUPH...
XFSTK-LOG--sending 6 DWORDS of DnxFW size and checksum...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) Ó
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->Ó
XFSTK-PROGRESS--0
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - DXBL(4)
XFSTK-STATUS--FW: Sending DnX ...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--8
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - RTBD(4)
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) DBDS
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->DBDS
XFSTK-LOG--int MedfieldDownloader::read_in_pipe(unsigned char*, uint32)
XFSTK-LOG--Read - (4)
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) RRBD
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->RRBD
XFSTK-LOG--int MedfieldDownloader::read_in_pipe(unsigned char*, uint32)
XFSTK-LOG--Read - BATI(16)
XFSTK-STATUS--BATI: Battery power is too low, charging up ...
XFSTK-STATUS--BATI:42415449: Battery voltage: 0xbd(3.562304V) The threshold: 0xb
f(3.600000V)
XFSTK-PROGRESS--8
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - RTBD(4)
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) DBDS
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->DBDS
XFSTK-LOG--int MedfieldDownloader::read_in_pipe(unsigned char*, uint32) BATI
XFSTK-LOG--Read - (4)
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) RRBD
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->RRBD
XFSTK-LOG--int MedfieldDownloader::read_in_pipe(unsigned char*, uint32)
XFSTK-LOG--Read - BATI(16)
XFSTK-STATUS--BATI: Battery power is too low, charging up ...
XFSTK-STATUS--BATI:42415449: Battery voltage: 0xbe(3.581152V) The threshold: 0xb
f(3.600000V)
XFSTK-PROGRESS--8
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - RTBD(4)
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) DBDS
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->DBDS
XFSTK-LOG--int MedfieldDownloader::read_in_pipe(unsigned char*, uint32) BATI
XFSTK-LOG--Read - HLT0(4)
XFSTK-PROGRESS--8
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - RUPHS(8)
XFSTK-STATUS--FW: Sending FW Update Profile Hdr Size...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) $
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->$
XFSTK-PROGRESS--16
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - RUPH(4)
XFSTK-STATUS--FW: Sending FW Update Profile Hdr...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--25
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - DMIP(4)
XFSTK-STATUS--FW: Sending MIP...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--33
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - LOFW(4)
XFSTK-STATUS--FW: Sending first 128k...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--41
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - HIFW(4)
XFSTK-STATUS--FW: Sending second 128k...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--50
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - PSFW100(8)
XFSTK-STATUS--FW: Sending Primary Security FW 1 Chunk 2
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--58
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - PSFW101(8)
XFSTK-STATUS--FW: Sending Primary Security FW 1 Chunk 1
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--66
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - PSFW102(8)
XFSTK-STATUS--FW: Sending Primary Security FW 1 Chunk 0
XFSTK-LOG--Allocation done
XFSTK-LOG--Writing the Bytes
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--75
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - SSFW00(8)
XFSTK-STATUS--FW: Sending secondary security fw Chunk 0
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--83
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - PSFW200(8)
XFSTK-STATUS--FW: Sending Primary Security FW 2 Chunk 0
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--91
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - VEDFW00(8)
XFSTK-LOG--sending VED FW Chunk 0
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--91
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - SuCP(4)
XFSTK-STATUS--FW: Sending ROM Patch Chunk 0
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--100
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - DMIP(4)
XFSTK-STATUS--FW: Sending MIP...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--108
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - LOFW(4)
XFSTK-STATUS--FW: Sending first 128k...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--116
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - HIFW(4)
XFSTK-STATUS--FW: Sending second 128k...
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--125
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - PSFW100(8)
XFSTK-STATUS--FW: Sending Primary Security FW 1 Chunk 2
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--133
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - PSFW101(8)
XFSTK-STATUS--FW: Sending Primary Security FW 1 Chunk 1
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--141
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - PSFW102(8)
XFSTK-STATUS--FW: Sending Primary Security FW 1 Chunk 0
XFSTK-LOG--Allocation done
XFSTK-LOG--Writing the Bytes
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--150
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - SSFW00(8)
XFSTK-STATUS--FW: Sending secondary security fw Chunk 0
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--158
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - PSFW200(8)
XFSTK-STATUS--FW: Sending Primary Security FW 2 Chunk 0
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--166
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - VEDFW00(8)
XFSTK-LOG--sending VED FW Chunk 0
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--166
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - SuCP(4)
XFSTK-STATUS--FW: Sending ROM Patch Chunk 0
XFSTK-LOG--int MedfieldDownloader::write_out_pipe(unsigned char*, uint32) __BINA
RY__
XFSTK-LOG--virtual bool MedfieldUSB20Device::Write(void*, unsigned int) --->__BI
NARY__
XFSTK-PROGRESS--175
XFSTK-LOG--long long unsigned int MedfieldDownloader::read_in_ack()
XFSTK-LOG--GetAck - HLT$(4)
XFSTK-STATUS--FW: Firmware update comepleted...
XFSTK-PROGRESS--100
XFSTK-PROGRESS--100
XFSTK-LOG--bool MedfieldDownloader::isfwdone()
XFSTK-STATUS--Firmware download completed.
XFSTK-LOG--virtual bool MedfieldDownloader::Cleanup()
Press any key to continue . . .
Ok here some improvement, now when the RAZR starts I just get Green LED and black screen no Service Required code corrupt message any more
what I do wrong ?
Click to expand...
Click to collapse
Hi I m looking for CFC_signed_customer_8.7.1I-110_IFW-DE-41_RTEU.xml.zip that was my last working ROM
In newer firmware I cannot find motoboot only this files see picture

@miky03
There is nothing you can do anymore but throw away your phone. It is fully bricked now, your phone is in the same stage now as mine was when I sent it to Motorola for repair and even they couldn't repair it!
Long story short: get a new phone cause yours will not work anymore.

Related

[HOWTO]Some possible way to recover inverted scrren for T,TX,V

(I don't know if T suffers from inverted screen...)
According to my research,inverted screen is caused by cross-flashing.Wrong screen driver is used for initializing the screen,and the registers get corrupted(written data from the inappropriate driver).After that,the screen will be recognized as other model(written data suggests)so even if you use stock kernel,no proper driver will be loaded.
In order to fix this,we need to write proper register data into the screen again.If we take a look at the source of the driver,we will find "RECOVER_NVM" feature.That's how pre-defined data gets written into screen and we will use it for rescuing the screen.
Step 1.COLLECTING CORRECT DATA.
1.1 Identify your actual screen model
Since the screen is already broken,we can't use any software to make it clear.You need to distinguish them using other ways.For example,TX's B screen has a much wider viewing angle than Screen C.Looking from side will give you answer.​1.2 Get to know current detected model.
1.2.1 Reboot your phone to clear dmesg cache.
1.2.2 When it finishes boot,open ADB SHELL or Terminal Emulator.
1.2.3 Type "su".
1.2.4 After # shows up(root privilege acquired),type
Code:
dmesg | grep "panel"
1.2.5 Look at the lines in red
<6>[ 1.006409] default panel: mipi_sharp_panel
<6>[ 1.006775] setting pdata->panel_info.fb_num to 3. type: 8
<6>[ 1.012208] mdp_probe: panel_detect function
<6>[ 1.061651] mipi_renesas_r63306 mipi_renesas_r63306.0: found panel vendor: mipi_sharp_panel
<6>[ 1.062078] mipi_renesas_r63306 mipi_renesas_r63306.0: found panel: mipi_video_sharp_wxga_ls043k3sx04
<3>[ 1.397588] msm_fb_detect_panel: comparing name=hdmi_msm with mipi_video_renesas_fwvga
<6>[ 1.398718] setting pdata->panel_info.fb_num to 1. type: 7
<6>[ 1.399450] mdp_probe: panel_detect function
<6>[ 1.399603] mdp_probe: no panel_detect function
<6>[ 1.402685] setting pdata->panel_info.fb_num to 1. type: 10
<6>[ 1.403906] mdp_probe: panel_detect function
<6>[ 1.403998] mdp_probe: no panel_detect function
Click to expand...
Click to collapse
In this case,ls043k3sx04 is detected screen model.
(Mine is MDX80,not this log)​1.3 Collect correct register data for your ACTUAL screen model.
You may ask your friend who has the same phone and screen to run the script from this post:http://forum.xda-developers.com/showthread.php?t=2607323
And run the dmesg | grep "panel" also to find the model number.
Note that the register number may differ.The numbers in the script is for TX with Screen C.You can download the kernel source of your phone,navigate to /drivers/video/msm and search for your DETECTED model,open the .c file with any text editor.Search for "nvm_**_reg".The hex number is the register number.List them all in the script.
EG.Mine is Screen C/MDW30​
2.MODIFY THE DETECTED MODEL'S DRIVER
2.1 Open the driver mentioned above.​2.2 Scroll to the first "nvm_**_reg".
You can simply skip the nvm_e4_00_00_00_f0_ff_reg ones(have more than one hex num in their names-they are not storing the register data and are more like START/END BURNING commands )
For example,you find
Code:
static char nvm_[COLOR="Red"]e7[/COLOR]_reg[] = {
0x[COLOR="red"]E7[/COLOR], 0x0F, 0x0C, 0x0B, 0x34
};
The first byte in the array is the same as register number.Leave it unchanged and modify the rest bytes accroding to the correct data you have just collected.
EG.The collected data for E7 is
Code:
GEN_READ
reg=0xE7
len=10
data[0]=0x02
data[1]=0x02
data[2]=0x0D
data[3]=0x36
data[4]=0x00
data[5]=0x00
data[6]=0x00
data[7]=0x00
data[8]=0xCE
data[9]=0x9A
We have 1+4 bytes in the nvm_e7_reg array,1 for reg number and 4 for rest bytes.So you copy 4bytes from this list to the array.
After modding,it should be
Code:
static char nvm_e7_reg[] = {
0xE7, 0x02, 0x02, 0x0D, 0x36
};
NOTE! The last 2 bytes in each register data is checksum.DO NOT write them into the driver.So the max. available data is 8 bytes.If you find some arrays have more than 8 bytes of data,you need to skip them and go on.​2.3 Find the correct values of long arrays
Open ACTUAL screen's driver,search 0xREG_NUM.
EG. You find
Code:
static char nvm_[COLOR="Red"]ca[/COLOR]_reg[] = {
0xCA, 0x0A, 0x15, 0x2E, 0x2D, 0x27, 0x1B, 0x20, 0x2B, 0x29, 0x31,
0x4F, 0x79, 0x3F
};
There are 1+13 bytes.So you search for 0xCA in mdw30.c(my actual model)
You will find in mdw30.c
EG.
Code:
static char gamma_ctrl_set_r_neg[] = {
[COLOR="red"]0xCA[/COLOR], 0x00, 0x12, 0x22, 0x26, 0x21, 0x1C, 0x25,
0x31, 0x2D, 0x49, 0x5F, 0x3F, 0x3F
};
So this is the actual value for Register CA.Copy the rest bytes to mdx80.c(my detected model)
Note: do not use value from arrays named "eco".​2.4 Save the file.​
3.RE-COMPILE THE KERNEL AND APPLY MOD
The rest is pretty easy:compile this kernel with CONFIG_MSM_FB_RECOVER_PANEL,boot into recovery,and follow command in this post:
http://forum.xda-developers.com/showthread.php?p=49297118
Note:
Code:
cd /d/msm_fb/mipi_[COLOR="red"]r63306[/COLOR]
r63306 is the controller name.You can see it in the directory name of the driver.
I hope this will help you.If you have any question,please ask.
Ive run into a problem. It seems the NVM read data is all blank except the checksums bytes.
Additionally, the CONFIG_FB_MSM_RECOVER_PANEL for all the panels do not appear to use the same values.
Your mdw30 panel doesnt even have this! What did you do?
mdx80 CONFIG_FB_MSM_RECOVER_PANEL
Code:
#ifdef CONFIG_FB_MSM_RECOVER_PANEL
static char nvm_e4_00_00_00_f0_ff_reg[] = {
0xE4, 0x00, 0x00, 0x00, 0xF0, 0xFF
};
static char nvm_e7_reg[] = {
0xE7, 0x0F, 0x0C, 0x0B, 0x34 /* default data according to SoMC */
};
static char nvm_bf_reg[] = {
0xBF, 0x01, 0x22, 0x33, 0x06, 0xB0
};
static char nvm_b2_reg[] = {
0xB2, 0x00
};
static char nvm_b4_reg[] = {
0xB4, 0x02
};
static char nvm_b6_reg[] = {
0xB6, 0x51, 0xE3
};
static char nvm_c0_reg[] = {
0xC0, 0x40, 0x02, 0x7F, 0xC8, 0x08
};
static char nvm_c1_reg[] = {
0xC1, 0x00, 0xA8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9D, 0x08, 0x27,
0x09, 0x00, 0x00, 0x00, 0x00
};
static char nvm_c2_reg[] = {
0xC2, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00
};
static char nvm_c3_reg[] = {
0xC3, 0x04
};
static char nvm_c4_reg[] = {
0xC4, 0x4D, 0x83, 0x00
};
static char nvm_c6_reg[] = {
0xC6, 0x12, 0x00, 0x08, 0x71, 0x00, 0x00, 0x00, 0x80, 0x00, 0x04
};
static char nvm_c7_reg[] = {
0xC7, 0x22
};
static char nvm_c8_reg[] = {
0xC8, 0x4C, 0x0C, 0x0C, 0x0C
};
static char nvm_c9_reg[] = {
0xC9, 0x00, 0x06, 0x10, 0x2E, 0x36, 0x34, 0x3F, 0x44, 0x38, 0x32,
0x31, 0x6A, 0x35
};
static char nvm_ca_reg[] = {
0xCA, 0x0A, 0x15, 0x2E, 0x2D, 0x27, 0x1B, 0x20, 0x2B, 0x29, 0x31,
0x4F, 0x79, 0x3F
...
...
mdw30 does not have CONFIG_FB_MSM_RECOVER_PANEL
ls043k3sx04 CONFIG_FB_MSM_RECOVER_PANEL
Code:
#ifdef CONFIG_FB_MSM_RECOVER_PANEL
static char nvm_rsp1[] = {
0xE7, 0x07, 0x0E, 0x0E, 0x35 /* default data */
};
static char dev_code[] = {
0xBF, 0x01, 0x22, 0x33, 0x06, 0xA4
};
static char test_mode1[] = {
0xE4, 0x00, 0x00, 0x00, 0xF0, 0xFF
};
static char test_mode2[] = {
0xE4, 0x39, 0x87
};
static char test_mode3[] = {
0xE4, 0x00, 0x00, 0x00, 0x00, 0x00
};
static char test_mode4[] = {
0xE4, 0xB9, 0x47
};
static char test_mode5[] = {
0xE4, 0xBD
};
static char nvm_read_e4_reg[] = {
0xE4
};
static char nvm_read_e1_reg[] = {
0xE1
};
static char test_mode7[] = {
0xFD, 0x04, 0x55, 0x53, 0x00, 0x70, 0xFF, 0x10, 0x33, 0x22, 0x22, 0x22,
0x37, 0x00
};
static char nvm_erase_and_write_rsp[] = {
0xE0
...
...
NVM.txt
Code:
e7 03 00 0f 34 de 00 00 11 0b 00 00 00 00 00 00 00 00GEN_READ
reg=0xE6
len=10
data[0]=0x00
data[1]=0x00
data[2]=0x00
data[3]=0x00
data[4]=0x00
data[5]=0x00
data[6]=0x00
data[7]=0x00
data[8]=0x8C
data[9]=0x7C
GEN_READ
reg=0xE7
len=10
data[0]=0x00
data[1]=0x00
data[2]=0x00
data[3]=0x00
data[4]=0x00
data[5]=0x00
data[6]=0x00
data[7]=0x00
data[8]=0x8C
data[9]=0x7C
GEN_READ
reg=0xDE
len=10
data[0]=0x00
data[1]=0x00
data[2]=0x00
data[3]=0x00
data[4]=0x00
data[5]=0x00
data[6]=0x00
data[7]=0x00
data[8]=0x8C
data[9]=0x7C
GEN_READ
reg=0xBF
len=10
data[0]=0x00
data[1]=0x00
data[2]=0x00
data[3]=0x00
data[4]=0x00
data[5]=0x00
data[6]=0x00
data[7]=0x00
data[8]=0x8C
data[9]=0x7C
GEN_READ
reg=0xE4
len=10
data[0]=0x00
data[1]=0x00
data[2]=0x00
data[3]=0x00
data[4]=0x00
data[5]=0x00
data[6]=0x00
data[7]=0x00
data[8]=0x8C
data[9]=0x7C
GEN_READ
reg=0xE1
len=10
data[0]=0x00
data[1]=0x00
data[2]=0x00
data[3]=0x00
data[4]=0x00
data[5]=0x00
data[6]=0x00
data[7]=0x00
data[8]=0x8C
data[9]=0x7C
GEN_READ
...
...
Brewski606 said:
Ive run into a problem. It seems the NVM read data is all blank except the checksums bytes.
Additionally, the CONFIG_FB_MSM_RECOVER_PANEL for all the panels do not appear to use the same values.
Your mdw30 panel doesnt even have this! What did you do?
mdx80 CONFIG_FB_MSM_RECOVER_PANEL
Code:
#ifdef CONFIG_FB_MSM_RECOVER_PANEL
static char nvm_e4_00_00_00_f0_ff_reg[] = {
0xE4, 0x00, 0x00, 0x00, 0xF0, 0xFF
};
static char nvm_e7_reg[] = {
0xE7, 0x0F, 0x0C, 0x0B, 0x34 /* default data according to SoMC */
};
static char nvm_bf_reg[] = {
0xBF, 0x01, 0x22, 0x33, 0x06, 0xB0
};
static char nvm_b2_reg[] = {
0xB2, 0x00
};
static char nvm_b4_reg[] = {
0xB4, 0x02
};
static char nvm_b6_reg[] = {
0xB6, 0x51, 0xE3
};
static char nvm_c0_reg[] = {
0xC0, 0x40, 0x02, 0x7F, 0xC8, 0x08
};
static char nvm_c1_reg[] = {
0xC1, 0x00, 0xA8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9D, 0x08, 0x27,
0x09, 0x00, 0x00, 0x00, 0x00
};
static char nvm_c2_reg[] = {
0xC2, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00
};
static char nvm_c3_reg[] = {
0xC3, 0x04
};
static char nvm_c4_reg[] = {
0xC4, 0x4D, 0x83, 0x00
};
static char nvm_c6_reg[] = {
0xC6, 0x12, 0x00, 0x08, 0x71, 0x00, 0x00, 0x00, 0x80, 0x00, 0x04
};
static char nvm_c7_reg[] = {
0xC7, 0x22
};
static char nvm_c8_reg[] = {
0xC8, 0x4C, 0x0C, 0x0C, 0x0C
};
static char nvm_c9_reg[] = {
0xC9, 0x00, 0x06, 0x10, 0x2E, 0x36, 0x34, 0x3F, 0x44, 0x38, 0x32,
0x31, 0x6A, 0x35
};
static char nvm_ca_reg[] = {
0xCA, 0x0A, 0x15, 0x2E, 0x2D, 0x27, 0x1B, 0x20, 0x2B, 0x29, 0x31,
0x4F, 0x79, 0x3F
...
...
mdw30 does not have CONFIG_FB_MSM_RECOVER_PANEL
ls043k3sx04 CONFIG_FB_MSM_RECOVER_PANEL
Code:
#ifdef CONFIG_FB_MSM_RECOVER_PANEL
static char nvm_rsp1[] = {
0xE7, 0x07, 0x0E, 0x0E, 0x35 /* default data */
};
static char dev_code[] = {
0xBF, 0x01, 0x22, 0x33, 0x06, 0xA4
};
static char test_mode1[] = {
0xE4, 0x00, 0x00, 0x00, 0xF0, 0xFF
};
static char test_mode2[] = {
0xE4, 0x39, 0x87
};
static char test_mode3[] = {
0xE4, 0x00, 0x00, 0x00, 0x00, 0x00
};
static char test_mode4[] = {
0xE4, 0xB9, 0x47
};
static char test_mode5[] = {
0xE4, 0xBD
};
static char nvm_read_e4_reg[] = {
0xE4
};
static char nvm_read_e1_reg[] = {
0xE1
};
static char test_mode7[] = {
0xFD, 0x04, 0x55, 0x53, 0x00, 0x70, 0xFF, 0x10, 0x33, 0x22, 0x22, 0x22,
0x37, 0x00
};
static char nvm_erase_and_write_rsp[] = {
0xE0
...
...
NVM.txt
Code:
e7 03 00 0f 34 de 00 00 11 0b 00 00 00 00 00 00 00 00GEN_READ
reg=0xE6
len=10
data[0]=0x00
data[1]=0x00
data[2]=0x00
data[3]=0x00
data[4]=0x00
data[5]=0x00
data[6]=0x00
data[7]=0x00
data[8]=0x8C
data[9]=0x7C
GEN_READ
reg=0xE7
len=10
data[0]=0x00
data[1]=0x00
data[2]=0x00
data[3]=0x00
data[4]=0x00
data[5]=0x00
data[6]=0x00
data[7]=0x00
data[8]=0x8C
data[9]=0x7C
GEN_READ
reg=0xDE
len=10
data[0]=0x00
data[1]=0x00
data[2]=0x00
data[3]=0x00
data[4]=0x00
data[5]=0x00
data[6]=0x00
data[7]=0x00
data[8]=0x8C
data[9]=0x7C
GEN_READ
reg=0xBF
len=10
data[0]=0x00
data[1]=0x00
data[2]=0x00
data[3]=0x00
data[4]=0x00
data[5]=0x00
data[6]=0x00
data[7]=0x00
data[8]=0x8C
data[9]=0x7C
GEN_READ
reg=0xE4
len=10
data[0]=0x00
data[1]=0x00
data[2]=0x00
data[3]=0x00
data[4]=0x00
data[5]=0x00
data[6]=0x00
data[7]=0x00
data[8]=0x8C
data[9]=0x7C
GEN_READ
reg=0xE1
len=10
data[0]=0x00
data[1]=0x00
data[2]=0x00
data[3]=0x00
data[4]=0x00
data[5]=0x00
data[6]=0x00
data[7]=0x00
data[8]=0x8C
data[9]=0x7C
GEN_READ
...
...
Click to expand...
Click to collapse
Maybe your panel require different reading method(or different registers)...And you should modify the RECOGNIZED model's driver.Since it's able to corrupt the registers,it should contain such section.
updateing said:
Maybe your panel require different reading method(or different registers)...And you should modify the RECOGNIZED model's driver.Since it's able to corrupt the registers,it should contain such section.
Click to expand...
Click to collapse
Yes I understand that but I dont know how you find the values for your phone! You have mipi_tmd_mdw30 correct?
The files I pulled from source for your phone are also very different! How did you know what to change the values to?
I attached the source files for your phone. are these the same ones you used?
Brewski606 said:
Yes I understand that but I dont know how you find the values for your phone! You have mipi_tmd_mdw30 correct?
The files I pulled from source for your phone are also very different! How did you know what to change the values to?
I attached the source files for your phone. are these the same ones you used?
Click to expand...
Click to collapse
The data was collected by some member in another forum.MDW30 driver doesn't contain RECOVER_PANEL section.My screen was recognized as MDX80 and it happens to have such a section,so I replaced the data in original MDX80 driver with the one I collected.I didn't touch the mdw30 driver,only replaced the bytes in mdx80.
please Help me My xperia tx no show anything after today call and the screen is gray. The phone is receive calls and SMS. Even touch screen working but it is
gray and don't show anything.

[TOOL][MOD][WIN] Change Your Splash Screen And Various Graphics v.97B

This is a hybrid batch and C program that I wrote to decode and encode the MotoLogo image container. It will allow you to edit or replace any of the 23 images in your logo partition. Click here to see all of the images. This will also work with any Motorola device utilizing this current format.
The logo partition has nothing to do with your boot animation. Your boot animation actually comes right after the static image, that in this case says "Google" in catull font; and if you have an unlocked bootloader, additionally there will be a little lock that appears to be open (aka "dummy locked") in the bottom center of the screen. Your boot animation follows after this screen goes away, your boot animation is typically animated or dynamic. The static screen with "Google" is known as your splash screen to some, or boot screen to others. This tool allows you to change the static image (splash screen) and not your boot animation.​Thanks to GrayBoltWolf for making this video!!
Download the "MotoLogo Injector v.97b" zip file at the bottom of this post.
Extract the zip file to a new folder.
To use just drag any file that you think might have a MotoLogo container in it onto the batch file "MotoLogo_Injectorv97b.bat" (I have included your Nexus 6 71.05 bootloader image in the zip, so just drag it onto the batch script)
The program will then find the Container in the file, extract it and validate every byte in it, and output it in the "Projects" folder.
A newly created folder will pop up that contains the raw image files, PNG image files, some identification files, and your extracted "logo.bin"
There will also be two new batch files in the folder that will make it easy to close the program, edit the images, then just click one of the batch files to get back into the program to re-encode the images. The difference in the two batch files is that one of them will re-encode the logo bin in a "Strict" way, and the other way is "Non-Strict"
Strict goes in the exact same order that the images were encoded in the first place.
Strict will fail if there are any more or any less images.
Strict will fail if any of the image names are changed.
Strict will check the resolution.
Strict will not let you have a Jpg, Bmp, ....any other format mixed in with the Pngs. (If you prefer to work with another image format, you can change that in the settings but you still can't mix them up inside of the "Images" folder; they should all be of the same type.
If an images resolution doesn't match the original images, it will warn you and give you options to resize or disregard the size difference.
Non-Strict simply goes through every file in the "Images" folder in alphanumerical order and makes it a raw file, encodes it, and puts the MotoLogo container together.
Non-Strict will take all kinds of differently formatted images.
The only reason I can see someone wanting to use Non-Strict is to delete images from a MotoLogo container.
In your "Images" folder is where you either edit or replace the PNG images. You can make them bigger, but I don't know what implications this may have as I do not have a Nexus 6. You must keep the names the exact same as the images, it is okay to change the image or even replace it (that's the whole point) but you have to keep the names the same for Strict mode, which I encourage you to use.
When you are finished editing your images:
You can open up the Original batch program if you haven't used it anymore (it remembers the last file loaded that had a successful validated container in it, so you don't have to drag and drop everytime). And then hit 1 "Rebuild Images Directory (Strict-In Order_Resolution Checks)"
Or you can click on the "Make MotoLogo Bin From Images Folder.bat" to go directly there.
After the program has rebuilt it, it will re validate the container, and then reconvert the container into view-able Pngs again. A new folder will automatically open. This contains your modified container called "build.bin". You can flash it from there.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
This is a beta version, because I do not have a device to test on. So, the things I would normally know, i don't know. For instance:
I don't know if you can change all 23 images in the Nexus 6 bootloader, I assume you can, as they are all stored in the Logo partition. If you can, you can theme your bootloader
I also don't know if you can make certain graphics bigger that may overlap another, like the "Start" button interfering with the "arrows" for the rocker buttons.
You need to stay under the size of your "Logo" partition, I'm pretty sure fastboot just errors out if you try to write more data than a partition can hold. But I would like to know how big the partition mmcblk0p30 is. You could find out by executing the following, and posting the size of the C:\LogoPartition.raw file
Code:
adb shell
su
dd if=/dev/block/mmcblk0p30 of=/mnt/sdcard/LogoPartition.raw
exit
exit
adb pull /sdcard/LogoPartition.raw "C:\LogoPartition.raw"
adb kill-server
You may not need the 'mnt' before the "/sdcard/LogoPartition.raw" in the DD command. Please do not try this if you are not familiar with the command, because you could mess some stuff up if you accidentally reverse the "if" and "of" ​
Thanks to @grim489 for testing changing the logo_boot "Google" image!
I am not responsible for any damage done to your device!! Source is in Posts 2 & 3!
SOURCE:
MotoLogoCodec.c
Code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#define OUT_FILE "logo.bin"
#define MOTOLOGO_BARE_HEADER 13
#define MOTOLOGO_IMG_BLK_SIZE 32
#define BIT_SET 0x8000
#define IS_BIT_SET(x) (x & BIT_SET)
#define COLORS 3
#define SWAP(x) (((x & 0xFF00) >> 8) | ((x & 0x00FF) << 8))
typedef struct {
unsigned short count;
unsigned char color[COLORS];
} motoSet;
typedef struct {
char header[8];
unsigned short width;
unsigned short height;
} motoHead;
typedef struct {
char name[24];
unsigned long offset;
unsigned long size;
unsigned short totalBlocks;
unsigned long totalSize;
motoHead imageHead;
} imageHead;
typedef struct {
unsigned char r;
unsigned char g;
unsigned char b;
} pixel;
void MotoRunEncode(void);
int FindMotoLogo(void);
int ParseHeader(unsigned long, int);
void CutMRImageOut(int, char*, unsigned long);
unsigned long int BlockIt(unsigned long int);
void MotoDecode(int, char*, unsigned short, unsigned short, unsigned long, int);
unsigned short pad = 1;
unsigned short addDetails = 0;
unsigned short cutMR = 0;
unsigned short decode = 0, encode = 0;
unsigned short blockSize = 512;
unsigned short pos = 0;
unsigned short filesFound = 0;
unsigned short logoOutput = 1;
unsigned short width = 0, height = 0;
char *inputFile, *base, *path;
char *motoLogoHeader;
unsigned long start, end;
FILE *inStream;
FILE *outStream;
char command[512];
char padByte = 0xff;
void MotoRunEncode(void)
{
unsigned int i,ind, m;
pixel line[width];
unsigned short count;
motoHead motoRunHeader;
if ((inStream = fopen(inputFile, "rb")) == NULL){
fclose(inStream);
fprintf(stderr, "\n%s\nCould not be opened.", inputFile);
return;
}
if ((outStream = fopen(base, "wb")) == NULL){
fclose(inStream);
fclose(outStream);
fprintf(stderr, "\n%s\nCould not be opened.", base);
return;
}
motoRunHeader.header[0] = 0x4D;
motoRunHeader.header[1] = 0x6F;
motoRunHeader.header[2] = 0x74;
motoRunHeader.header[3] = 0x6F;
motoRunHeader.header[4] = 0x52;
motoRunHeader.header[5] = 0x75;
motoRunHeader.header[6] = 0x6E;
motoRunHeader.header[7] = 0x00;
motoRunHeader.width = SWAP(width);
motoRunHeader.height = SWAP(height);
fwrite(&motoRunHeader, 1, sizeof(motoRunHeader), outStream);
for (i = 1; i <= height; i++){
fread(line, COLORS, width, inStream);
for (ind = 0, count = 0 ; ind <= width - 1; ){
if ((memcmp(&line[ind], &line[ind+1], 3) == 0)){
ind++;
count = 1;
while((ind <= width - 2) && ((memcmp(&line[ind], &line[ind+1], 3))== 0)){
count++;
ind++;
}
if (count == 1){
count++;
ind++;
goto LOOP;
} else {
count++;
count |= BIT_SET;
count = SWAP(count);
fwrite(&count, 1, 2, outStream);
fwrite(&line[ind], 1, 3, outStream);
}
ind++;
} else {
count = 1;
ind++;
LOOP:
while (((ind >= width -2)&&(ind <= width -1)) || ((ind <= width - 2) && (memcmp(&line[ind], &line[ind+1], 3) != 0)) || ((ind <= width - 3) && (memcmp(&line[ind+1], &line[ind+2], 3) != 0))){
count++;
ind++;
}
count = SWAP(count);
fwrite(&count, 1, 2, outStream);
fwrite(&line[ind - SWAP(count)], SWAP(count), COLORS, outStream);
continue;
}
}
}
return;
}
int FindMotoLogo(void)
{
char header[] = {0x4D,0x6F,0x74,0x6F,0x4C,0x6F,0x67,0x6F,0x00};
unsigned long int firstOffset;
int readByte;
char string[9];
if ((inStream = fopen(inputFile, "rb")) == NULL){
fclose(inStream);
fprintf(stderr, "\n%s\nCould not be opened.", inputFile);
return;
}
int inNumber = fileno(inStream);
while ((readByte = fgetc(inStream)) != EOF){
if (readByte == header[pos]){
if (pos == 8){
start = (ftell(inStream) - 9);
fseek(inStream, start + 9, SEEK_SET);
read(inNumber, &end, 4);
fseek(inStream, start + 9 + 4 + 24, SEEK_SET );
read(inNumber, &firstOffset, 4);
fseek(inStream, start + firstOffset, SEEK_SET );
read(inNumber, &string, 9);
if (strcmp(string, "MotoRun") == 0){
fseek(inStream, start + 13, SEEK_SET );
return (ParseHeader(end, inNumber));
} else {
pos = 0;
fseek(inStream, start + 9, SEEK_SET );
continue;
}
} else {
pos++;
continue;
}
}
pos = 0;
}
close(inNumber);
fprintf(stderr,"\n%d MotoLogo (logo.bin) files found.", filesFound);
return;
}
int ParseHeader(unsigned long end, int inNumber)
{
unsigned int imageCounter = (end - MOTOLOGO_BARE_HEADER) / MOTOLOGO_IMG_BLK_SIZE;
imageHead motomoto[imageCounter];
int i;
unsigned long logoSize, pos;
for(i=0; i < imageCounter; i++){
read(inNumber, &motomoto[i], 32);
motomoto[i].totalSize = BlockIt(motomoto[i].size);
motomoto[i].totalBlocks = (motomoto[i].totalSize /blockSize);
fprintf(stdout,"\nName: %s\nOffset in Logo.bin: %ld\nImage Data Size: %ld",motomoto[i].name, motomoto[i].offset, motomoto[i].size);
fprintf(stdout,"\nTotal Size: %ld",motomoto[i].totalSize);
fprintf(stdout,"\nTotal Blocks: %d",motomoto[i].totalBlocks);
pos = ftell(inStream);
fseek(inStream, start + motomoto[i].offset, SEEK_SET);
if (cutMR){
CutMRImageOut(inNumber, motomoto[i].name, motomoto[i].size);
fseek(inStream, start + motomoto[i].offset, SEEK_SET); //moved this line inside the parentheses
}
read(inNumber, &motomoto[i].imageHead, 12);
motomoto[i].imageHead.width = SWAP(motomoto[i].imageHead.width);
motomoto[i].imageHead.height = SWAP(motomoto[i].imageHead.height);
fprintf(stdout,"\nWidth x Height: %dx%d",motomoto[i].imageHead.width,motomoto[i].imageHead.height);
fprintf(stdout,"\nHeader: %s\n\n",motomoto[i].imageHead.header);
if (decode){
MotoDecode(inNumber, motomoto[i].name, motomoto[i].imageHead.width, motomoto[i].imageHead.height, motomoto[i].size , i+1);
}
fseek(inStream, pos, SEEK_SET);
}
logoSize = motomoto[imageCounter-1].offset + motomoto[imageCounter-1].totalSize;
fprintf(stdout,"\nLogo.bin contains %ld image files and is %ld bytes in size", i, logoSize);
if (!(logoOutput)){
return 0;
}
sprintf(command,"%s\\%s", path , OUT_FILE );
if ((outStream = fopen(command, "wb")) == NULL){
fclose(outStream);
fprintf(stderr, "\n%s\\%s could not be opened.", path, OUT_FILE);
return 1;
}
int outNumber = fileno(outStream);
fseek(inStream, start, SEEK_SET );
char* logobin = malloc(logoSize);
read(inNumber, logobin, logoSize);
write(outNumber, logobin, logoSize);
close(outNumber);
free(logobin);
return 0;
}
void CutMRImageOut(int inNumber, char* name, unsigned long size){
char newName[26];
FILE *txt;
sprintf(command,"%s\\%s.mr", path , name );
if ((txt = fopen("build.ID", "a")) == NULL){
fclose(txt);
fprintf(stderr, "\nBuild.ID could not be opened.\n");
return;
}
if ((outStream = fopen(command, "wb")) == NULL){
fclose(outStream);
fclose(txt);
fprintf(stderr, "\n%s\\%s.mr could not be opened", path, name);
return;
}
sprintf(command,"%s\n", command );
sprintf(newName, "%s?", name);
fwrite(newName, strlen(newName), 1, txt);
fwrite(command, strlen(command), 1, txt);
fclose(txt);
int outNumber = fileno(outStream);
char *dataStream = malloc(size);
read(inNumber, dataStream, size);
write(outNumber, dataStream, size);
if (pad){
if ((size % blockSize) != 0){
unsigned int max = blockSize - (size % blockSize ), i;
for (i = 0; i < max; i++){
write(outNumber, &padByte , 1);
}
fprintf(stdout,"\n%d bytes padded to %s", max, name);
}
}
close(outNumber);
free(dataStream);
return;
}
unsigned long int BlockIt(unsigned long int isize){
if ((isize % blockSize) == 0){
return isize;
}else{
return isize + (blockSize - (isize %blockSize));
}
}
void MotoDecode(int inNumber, char* name, unsigned short width, unsigned short height, unsigned long size, int index)
{
unsigned short repeats, count;
unsigned char color[3];
unsigned long counter = 0;
motoSet data;
if (addDetails){
sprintf(command, "%s\\%03d_%dx%d_%s.bgr24", path , index, width, height, name);
} else {
sprintf(command, "%s\\%s.bgr24", path, name);
}
if ((outStream = fopen(command, "wb")) == NULL){
fclose(outStream);
fprintf(stderr, "\n%s\nCould not be opened.", command);
return;
}
int outNumber = fileno(outStream);
while((read(inNumber, &data, 5) != EOF) && (counter < size)){
counter += 5;
if ((counter >= size ) || (data.count == 0xffff)){
close(outNumber);
return;
}
data.count = SWAP(data.count);
if (IS_BIT_SET(data.count)){
data.count &= ~BIT_SET;
for (repeats = 0;repeats < data.count; repeats++){
write(outNumber, &data.color, COLORS);
}
} else {
write(outNumber, &data.color, COLORS);
for (repeats = 0; repeats < data.count -1; repeats++){
counter += COLORS;
if ((read(inNumber, color, COLORS) == EOF) || counter >= size){
write(outNumber, &color, COLORS);
close(outNumber);
return;
}
write(outNumber, &color, COLORS);
}
}
}
close(outNumber);
return;
}
int main(int argc, char **argv)
{
int c;
while ((c = getopt (argc, argv, "i:o:p:b:w:h:cdezna")) != -1){
switch(c)
{
case 'a':
addDetails = 1;
break; //add index number and resolution to decoded filenames
case 'i':
inputFile = optarg;
break;
case 'o':
base = optarg;
break;
case 'p':
path = optarg;
break;
case 'b':
blockSize = atoi(optarg);
break;
case 'c':
cutMR = 1;
break;
case 'd':
decode = 1;
break;
case 'e':
encode = 1;
break;
case 'z':
pad = 0;
break;
case 'n':
logoOutput = 0;
break;
case 'w':
width = atoi(optarg);
break;
case 'h':
height = atoi(optarg);
break;
}
}
if (encode == 1){
MotoRunEncode();
return;
}
return(FindMotoLogo());
}
MotoLogoValidator.c
Code:
/*
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#define MOTOLOGO_BARE_HEADER 13
#define MOTOLOGO_IMG_BLK_SIZE 32
#define BIT_SET 0x8000
#define IS_BIT_SET(x) (x & BIT_SET)
#define COLORS 3
#define SWAP(x) (((x & 0xFF00) >> 8) | ((x & 0x00FF) << 8))
typedef struct {
unsigned short count;
unsigned char color[COLORS];
} motoSet;
typedef struct {
char header[8];
unsigned short width;
unsigned short height;
} motoHead;
typedef struct {
char name[24];
unsigned long offset;
unsigned long size;
unsigned short totalBlocks;
unsigned long totalSize;
motoHead imageHead;
} imageHead;
typedef struct {
unsigned char r;
unsigned char g;
unsigned char b;
} pixel;
int FindMotoLogo();
int ValidateMotoLogoHeader();
unsigned long int BlockIt(unsigned long int);
int VerifyImages(char*, unsigned short, unsigned short, unsigned long);
unsigned short pos, inNumber, blockSize = 512;
char *inputFile;
unsigned long start, end;
FILE *inStream;
FILE *txt;
char command[512];
char padByte = 0xff;
int FindMotoLogo()
{
char header[] = {0x4D,0x6F,0x74,0x6F,0x4C,0x6F,0x67,0x6F,0x00};
unsigned long int firstOffset;
int readByte;
char string[9];
for (pos = 0 ; pos <= 8 ; pos++ ){
if ((readByte = fgetc(inStream)) == header[pos]){
fprintf(stdout,"\nHeader:\n%d %02x",pos, header[pos]);
if (pos == 8){
fprintf(stdout, "\nHeader Match");
start = 0;
fseek(inStream, start + 9, SEEK_SET);
read(inNumber, &end, 4);
fseek(inStream, start + 9 + 4 + 24, SEEK_SET );
read(inNumber, &firstOffset, 4);
fseek(inStream, start + firstOffset, SEEK_SET );
read(inNumber, &string, 9);
if (strcmp(string, "MotoRun") == 0){
fseek(inStream, start + 13, SEEK_SET );
fprintf(stdout,"\nEnd of MotoLogo Header is byte %d.\n", end);
return 0;
} else {
fprintf(stderr,"\nFirst offset in MotoLogo header doesn't point to an image header.");
return 1;
}
} else {
continue;
}
} else {
fprintf(stderr,"\nFile: %s\ndoes not start with a valid MotoLogo header.", inputFile);
return 1;
}
}
return 1;
}
int ValidateMotoLogoHeader()
{
unsigned int imageCounter = (end - MOTOLOGO_BARE_HEADER) / (MOTOLOGO_IMG_BLK_SIZE);
fprintf(stdout,"\n%d images referenced in header.\nChecking Images.\n", imageCounter);
imageHead motomoto[imageCounter];
int i;
char motoRunHeader[] = "MotoRun\0";
fseek(inStream, 13, SEEK_SET);
for(i=0; i < imageCounter; i++){
read(inNumber, &motomoto[i], 32); //add an if parameter switch for the last element not to include the padding
motomoto[i].totalSize = BlockIt(motomoto[i].size);
motomoto[i].totalBlocks = (motomoto[i].totalSize /blockSize);
fprintf(stdout,"\nName: \"%s\"\nOffset In File: %ld\nImage Data Size: %ld",motomoto[i].name, motomoto[i].offset, motomoto[i].size);
fprintf(stdout,"\nTotal Size With Padding: %ld",motomoto[i].totalSize);
fprintf(stdout,"\nTotal Blocks: %d",motomoto[i].totalBlocks);
if (i != 0){
if ((motomoto[i-1].offset + motomoto[i-1].totalSize) == (motomoto[i].offset)){
fprintf(stdout, "\nOffsets match!");
} else {
fprintf(stderr, "\nOffsets do not match between %s and %s.\nVALIDATION FAILURE!\n", motomoto[i-1].name, motomoto[i].name);
return 1;
}
} else {
if (motomoto[i].offset == BlockIt(end)){
fprintf(stdout, "\nOffsets Match!");
} else {
fprintf(stderr, "\n%d is offset and %d is the end of the MotoLogo Header\nVALIDATION FAILURE!\n", motomoto[i].offset, BlockIt(end));
return 1;
}
}
pos = ftell(inStream);
fseek(inStream, motomoto[i].offset, SEEK_SET);
read(inNumber, &motomoto[i].imageHead, 12);
motomoto[i].imageHead.width = SWAP(motomoto[i].imageHead.width);
motomoto[i].imageHead.height = SWAP(motomoto[i].imageHead.height);
fprintf(stdout,"\nWidth x Height: %dx%d",motomoto[i].imageHead.width,motomoto[i].imageHead.height);
fprintf(stdout,"\nExpected Pixels: %d", (motomoto[i].imageHead.width * motomoto[i].imageHead.height));
if(strcmp(motoRunHeader, motomoto[i].imageHead.header) != 0){
fprintf(stderr, "\nHeader Should be \"%s\", not \"%s\"\nVALIDATION FAILED!\n", motoRunHeader, motomoto[i].imageHead.header);
return 1;
}
fprintf(stdout,"\nHeader: \"%s\"",motomoto[i].imageHead.header);
if (!VerifyImages(motomoto[i].name, motomoto[i].imageHead.width, motomoto[i].imageHead.height, motomoto[i].size - 12)){
fseek(inStream, pos, SEEK_SET);
continue;
} else {
return 1;
}
}
if ((txt = fopen("MoID.ID", "w")) == NULL){
fclose(txt);
fprintf(stderr, "\nMoID.ID could not be opened.\n");
return 1;
}
for(i=0; i < imageCounter; i++){
fprintf(txt, "%s,%d,%d,%d,%d,", motomoto[i].name, motomoto[i].imageHead.width, motomoto[i].imageHead.height, motomoto[i].totalSize, motomoto[i].totalBlocks);
fprintf(txt, "%d,%d\n", motomoto[i].offset, motomoto[i].size);
}
fclose(txt);
return 0;
}
unsigned long int BlockIt(unsigned long int isize){
if ((isize % blockSize) == 0){
return isize;
}else{
return isize + (blockSize - (isize %blockSize));
}
}
int VerifyImages(char* name, unsigned short width, unsigned short height, unsigned long size)
{
unsigned short line = 0, pixelsonline = 0;
unsigned long pixelsDecoded = 0, totalPixels = 0, bytesRead = 0;
motoSet data;
unsigned long posi;
while(bytesRead < size){
if ((bytesRead += read(inNumber, &data, 5)) == EOF){
return 0;
}
data.count = SWAP(data.count);
if (IS_BIT_SET(data.count)){
data.count &= ~BIT_SET;
pixelsonline += data.count;
} else {
posi = ftell(inStream);
fseek(inStream, (posi + (COLORS * (data.count - 1))), SEEK_SET);
pixelsonline += data.count;
bytesRead = bytesRead + (COLORS * (data.count - 1));
}
if (pixelsonline == width){
line++;
pixelsDecoded += pixelsonline;
pixelsonline = 0;
}
if ((pixelsonline == width) && ((pixelsDecoded / line) == pixelsonline)){
line++;
pixelsonline = 0;
}
}
fprintf(stdout,"\nPixels Decoded: %d\nBytes Read: %d\nSize Minus Header: %d\nLines Properly Terminated: %d", pixelsDecoded, bytesRead, size , line);
if ((pixelsDecoded == width * height) && (bytesRead == size) && (height == line )){
fprintf(stdout,"\n\"%s\" Is Encoded Correctly\n", name);
return 0;
}
if (pixelsDecoded != (width * height)){
fprintf(stderr, "\nThe total pixels decoded, %d, doesn't equal the resolution: %dx%d=%d",pixelsDecoded, width, height, (width * height));
}
if (bytesRead != size){
fprintf(stderr, "\nThe total bytes read, %d, is not equal to the encoded size, %d.", bytesRead, size);
}
if (height != line ){
fprintf(stderr, "\nAt least one run in the encoding runs past the edge of the screen.\nThis will not work.");
}
fprintf(stderr, "\n%s is not encoded correctly\nVALIDATION FAILURE!\n", name);
return 1;
}
int main(int argc, char **argv)
{
int c;
while ((c = getopt (argc, argv, "i:b:")) != -1){
switch(c)
{
case 'i':
inputFile = optarg;
break;
case 'b':
blockSize = atoi(optarg);
break;
}
}
if ((inStream = fopen(inputFile, "rb")) == NULL){
fclose(inStream);
fprintf(stderr, "\n%s\nCould not be opened.\n", inputFile);
return 1;
}
inNumber = fileno(inStream);
if (!FindMotoLogo()){
if (!ValidateMotoLogoHeader()){
fclose(inStream);
return 0;
}
}
fclose(inStream);
return 1;
}
BuildMotoLogo.c
[code[#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
typedef struct {
char name[24];
unsigned long offset;
unsigned long size;
unsigned long sizeWithPadding;
} imageHead;
unsigned long int ReadList(void);
unsigned int GetHeaderSize(void);
unsigned long int BlockIt(unsigned long int);
char *txtFileName;
FILE *inFile;
FILE *outFile;
char *outputFileName;
unsigned short images = 0;
unsigned short blockSize = 512;
unsigned long int ReadList(void){
char header[] = {0x4D,0x6F,0x74,0x6F,0x4C,0x6F,0x67,0x6F,0x00};
char line[512];
int readByte;
imageHead Item[images];
unsigned long int totalDataSize = 0;
int i = 0 , k = 0 , l = 0;
unsigned char padByte = 255;
unsigned long sizes[images];
char *s = "?";
char *tok;
unsigned long int hs;
if ((outFile = fopen (outputFileName, "wb")) == NULL){
perror("\nError opening output file:");
fclose(outFile);
}
hs = GetHeaderSize();
for ( i = 0 ; i < hs ; i++){
fputc(padByte, outFile);
}
i = 0;
hs = (images * 32) + 13;
while(fgets(line, sizeof line , stdin) != NULL){
tok = strtok(line, s);
sprintf(Item.name, "%s",tok);
tok = strtok(NULL, s);
for ( l = 24 ; l - strlen(Item.name) > 0 ; l-- ){
Item.name[l] = '\0';
}
for (k = 0; k < strlen(tok); k++){
if (( tok[k] == '\n') || (tok[k] == '\r' )){
tok[k] = '\0';
}
}
if ((inFile = fopen( tok , "rb")) == NULL){
perror("\nError opening mr file:");
fclose(inFile);
return 0;
}
while( ( readByte = fgetc(inFile) ) != EOF ){
fputc(readByte, outFile);
}
Item.size = ftell(inFile);
fprintf(stdout, "\n%d" , Item.size);
for ( k = 0 ; k < (blockSize - (Item.size % blockSize)) ; k++){
fputc(padByte, outFile);
}
Item.sizeWithPadding = BlockIt(Item.size);
totalDataSize += Item.sizeWithPadding;
if (i == 0){
Item.offset = BlockIt(hs);
} else {
Item.offset = ((Item[ i - 1 ].sizeWithPadding) + (Item[ i - 1 ].offset));
}
fprintf(stdout, "\n%ld", Item.offset);
i++;
fclose(inFile);
}
fseek(outFile, 0 , SEEK_SET);
fwrite(&header, sizeof header, 1 , outFile);
fwrite(&hs, 4, 1 ,outFile);
fprintf(stdout, "\n Size of Header is %d.", hs);
for (i = 0 ; i < images ; i++ ){
fwrite(&Item.name, 1 , 24 , outFile);
fwrite(&Item.offset, 4, 1 , outFile);
fwrite(&Item.size, 4, 1, outFile);
}
fclose(outFile);
fclose(inFile);
return totalDataSize;
}
unsigned int GetHeaderSize(void){
unsigned int ret = BlockIt(13 + ( 32 * images));
return ret;
}
unsigned long int BlockIt(unsigned long int isize){
if ((isize % blockSize) == 0){
return isize;
}else{
return isize + (blockSize - (isize %blockSize));
}
}
int main(int argc, char **argv){
int c;
while ((c = getopt (argc, argv, "o:n:")) != -1){
switch(c)
{
case 'o':
outputFileName = optarg;
break;
case 'n':
images = atoi(optarg);
break;
}
}
ReadList();
return;
}[/code]
SOURCE:
MotoLogo_Injectorv.97b.bat
Code:
@echo off&setlocal enabledelayedexpansion
MODE CON:COLS=78 LINES=1024&set "vers=.97b"
title BETA BETA BETA BETA BETA Motorola Image Injector v%vers% BETA BETA BETA BETA BETA
cd /d "%~dp0"
set "file=%~1"
set /a "aspectMultiplier=100000"
set "useDefaultViewer="
set "syslog=>>"%~dp0sys\log.txt""
set "ffmpeglog="
set "validlog="
set "codeclog="
set "rawBGRDir=Raw_BGR_Files"
set "imagesDir=Images"
set "mrDir=Raw_MR_Files"
set "workHere=Projects"
set "IDfile=MoID.ID"
set "buildFile=build.ID"
set "dontShowInfo=1"
set "autoOpenFolders=1"
set "prevailExt=Png"
if not exist "%~dp0sys\" mkdir "%~dp0sys"
if exist "%~dp0sys\settings.cfg" (call :LoadSetFile)
if "%dontShowInfo%"=="1" set "validlog=>>"%~dp0sys\validation_log.txt" 2>&1" &set "codeclog=>>"%~dp0sys\codec_log.txt" 2>&1" &set "ffmpeglog=>>"%~dp0sys\ffmpeg_log.txt" 2>&1"
if exist "%~dp0sys\last_file" if "[%file%]"=="[]" call :Existing
if /i "[%file%]" equ "[$$$convert$$$]" set "file=%~2" &set "home=%~3" &call :SaveSettings &goto :ConvertFolder
if /i "[%file%]" equ "[$$notstrict$$]" set "file=%~2" &set "home=%~3" &call :SaveSettings &goto :NotStrictConvert
if "[%file%]" neq "[]" if exist "%file%" call :New &goto :Menu
call :help
:Settings
call :DrawHead
echo( ____________________________________________________________________________
echo(
if %dontShowInfo%==1 (
echo( 1 - Show Info On The Screen ^(currently data is logged^)) else (echo( 1 - Log Info To A Text File ^(currently data is shown on screen^))
)
echo(
if %autoOpenFolders%==1 (
echo( 2 - Auto Open Folders After A New File Is Created ^(currently is On^)) else (echo( 2 - Auto Open Folders After A New File Is Created ^(currently is Off^))
echo(
echo( 3 - Change Which Image Format To Use ^(currently it is %prevailExt%^)
echo(
echo( 4 - Clear Logs In Sys Folder
echo(
echo( 5 - Exit
echo(
choice /n /m " Please Select A Menu Number:" /c:12345
if errorlevel 1 set k=1
if errorlevel 2 set k=2
if errorlevel 3 set k=3
if errorlevel 4 set k=4
if errorlevel 5 set k=5
if %k%==1 if %dontShowInfo%==1 (set "dontShowInfo=0") else (set "dontShowInfo=1")
if %k%==2 if %autoOpenFolders%==1 (set "autoOpenFolders=0") else (set "autoOpenFolders=1")
if %k%==3 call :ImageFormat
if %k%==4 2>nul del /q "%~dp0sys\*log*.txt
if %k%==5 goto :Menu
call :SaveSetFile
goto :Settings
:ImageFormat
call :DrawHead
echo(&echo( If you change the extension used in the program, you will no longer
echo( be able to edit older project folders that used the current image extension.
echo( You would have to switch back to what ever image format was used if you wanted
echo( to open an older project. Unless you rebuild a folder in Non Strict, which
echo( would allow you to use all different image types.
echo(&echo( Enter The Extension ^(without the "."^) That You Want To Use.
echo( Currently it is %prevailExt%
set /p prevailExt=: || set "prevailExt=Png"
call :SaveSetFile
goto :eof
:LoadSetFile
<"%~dp0sys\settings.cfg" (
set /p dontShowInfo=
set /p autoOpenFolders=
set /p prevailExt=
)
goto :eof
:SaveSetFile
>"%~dp0sys\settings.cfg" (
echo(%dontShowInfo%
echo(%autoOpenFolders%
echo(%prevailExt%
)
goto :eof
:Existing
call :LoadSettings
call :SaveSettings
if not exist "%file%" call :NotThere
if not exist "%home%\%IDfile%" call :NotThere
if not exist "%home%\%buildFile%" call :NotThere
call :LoadDetails "%home%\%IDfile%"
goto :menu
pause
:New
call :DrawHead
call :LoadNewFile
%codeclog% "%~dp0bin\MotoLogoCodec.exe" -i "%file%" -o "%name%" -p "%home%" || (if defined "%home%" if exist "%home%\" rd /q "%home%" &call :NoLogo)
echo(&echo( MotoLogo container found, validating data...
%validlog% "%~dp0bin\MotoLogoValidator.exe" -i "%file%" || (
if exist "%home%\logo.bin" (
set "file=%home%\Logo.bin"
%validlog% "%~dp0bin\MotoLogoValidator.exe" -i "!file!" || (if defined home if exist "%home%\" del /q "%home%\*.bin" &rd /q "%home%" &call :ValidFail)
) else (if defined home if exist "%home%\" del /q "%home%\*.bin" &rd /q "%home%" &call :ValidFail)
)
set "file=%home%\logo.bin"
call :SaveSettings
echo(&echo( VALIDATION SUCCESSFUL&echo(
%syslog% move "%~dp0%IDfile%" "%home%\"
call :LoadDetails "%home%\%IDfile%"
call :MakeFolders
echo(&echo( Extracting images....Please wait...&echo(
%codeclog% "%~dp0bin\MotoLogoCodec.exe" -z -c -d -i "%file%" -o "%name%" -p "%home%\%mrDir%"
%syslog% move "%~dp0%buildFile%" "%home%\"
%syslog% move "%home%\%mrDir%\*.bgr24" "%home%\%rawBGRDir%\"
call :ffmpegit "%home%\%rawBGRDir%" "%home%\%imagesDir%"
goto :eof
:ValidFail
call :DrawHead
echo(&echo(&echo( Container Failed Validataion..
echo( Press any key to exit.
pause>nul
exit
goto :eof
:MakeFolders
2>nul mkdir "%home%\%rawBGRDir%"
2>nul mkdir "%home%\%mrDir%"
2>nul mkdir "%home%\%imagesDir%"
goto :eof
:Menu
call :DrawHead
call :DrawDetails
echo( ____________________________________________________________________________
echo(
echo( 1 - Rebuild %imagesDir% Directory ^(Strict-In Order-Resolution Checks^)
echo(
echo( 2 - Rebuild %imagesDir% Directory ^(Not Strict^)
echo(
echo( 3 - Open Current Project Folder
echo(
echo( 4 - Settings
echo(
echo( 5 - Fastboot Flash Current File
echo(
echo( 6 - Exit
echo(
choice /n /m " Please Select A Menu Number:" /c:123456
if errorlevel 1 set k=1
if errorlevel 2 set k=2
if errorlevel 3 set k=3
if errorlevel 4 set k=4
if errorlevel 5 set k=5
if errorlevel 6 set k=6
if %k%==1 call :ConvertFolder
if %k%==2 call :NotStrictConvert
if %k%==3 start "" "%home%"
if %k%==4 call :Settings
if %k%==5 call :Fla****
if %k%==6 goto :finish
goto :Menu
:Fla****
call :DrawHead
call :DrawDetails
echo(&echo( Your logo is ready to be flashed.&echo( File:%file%
echo(&echo( Make sure that your device is connected and in Bootloader Mode.
echo(&echo( The following command will be issued:
echo( fastboot flash logo "%file%"
echo(&echo( Press 1 to flash the logo partition, or 2 to go back.&echo(
echo(&echo( 1 - Flash
echo(&echo( 2 - Go Back
echo(
choice /n /m " Please select a menu number:" /c:12
if errorlevel 1 set k=1
if errorlevel 2 set k=2
if !k!==1 (call )
if !k!==2 goto :Menu
"%~dp0bin\fastboot.exe" flash logo "%file%" &&echo. Finished..Press any key to Reboot your device.&&pause>nul&&"%~dp0bin\fastboot.exe" reboot
goto :eof
:NotStrictConvert
call :DrawHead
echo(&echo( This will rebuild all images in the %imageDir% folder.
echo( It will rebuild in alphabetical order while disregarding
echo( original width, height, position in bin file. You can pretty
echo( much put any image format in here and get an encoded bin file.
echo( Press 1 to Continue or 2 to Go Back
echo(&echo( 1 - Continue
echo(&echo( 2 - Go Back
echo(
choice /n /m "please select a menu number:" /c:12
if errorlevel 1 set k=1
if errorlevel 2 set k=2
if !k!==1 (call )
if !k!==2 goto :Menu
if exist "%home%\errors.txt" del /q "%home%\errors.txt"
if not exist "%home%\%IDfile%" call :NotThere
if not exist "%home%\%buildFile%" call :NotThere
call :LoadDetails "%home%\%IDfile%"
if defined home if exist "%home%\" rd /s /q "%home%\Not_Strict_Modified\" 2>nul
2>nul md "%home%\Not_Strict_Modified"
2>nul md "%home%\Not_Strict_Modified\%rawBGRDir%"
2>nul md "%home%\Not_Strict_Modified\%mrDir%"
set /a imageCount=0
2>nul del /q "%home%\%imagesDir%\Thumbs.db"
for /f %%a in ('dir /b /a-d-h "%home%\%imagesDir%\*.*"') do (
set /a imageCount=!imageCount!+1
echo( Converting: %%a
set "name=%%~na"
set name=!name:~0,24!
for /f "tokens=1-8* delims=," %%A in ('bin\ffmpeg -hide_banner -i "%home%\%imagesDir%\%%a" -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -y "%home%\Not_Strict_Modified\%rawBGRDir%\!name!.bgr24" 2^>^&1^|findstr /rxic:".*stream #0:0.*[0-9]x[0-9].*"') do (
echo(%%A >"%home%\imageres"
echo(%%B >>"%home%\imageres"
echo(%%C >>"%home%\imageres"
echo(%%D >>"%home%\imageres"
echo(%%E >>"%home%\imageres"
echo(%%F >>"%home%\imageres"
echo(%%G >>"%home%\imageres"
echo(%%H >>"%home%\imageres"
)
for /f "tokens=1-3 delims=x " %%I in ('type "%home%\imageres"^|findstr /rxic:".*[0-9]x[0-9].*"') do set /a width=%%I &set /a height=%%J
if not defined width echo( Error: "Width undefined in %%a">>"%home%\errors.txt"
if not defined height echo( Error: "Height undefined in %%a">>"%home%\errors.txt"
if not exist "%home%\Not_Strict_Modified\%rawBGRDir%\!name!.bgr24" echo( Error: "%home%\Not_Strict_Modified\%rawBGRDir%\!name!.bgr24" Was not created.>>"%home%\errors.txt"
echo( Encoding: !name!.bgr24
%codeclog% "%~dp0bin\MotoLogoCodec.exe" -e -i "%home%\Not_Strict_Modified\%rawBGRDir%\!name!.bgr24" -o "%home%\Not_Strict_Modified\%mrDir%\!name!.mr" -w !width! -h !height!
if not exist "%home%\Not_Strict_Modified\%mrDir%\!name!.mr" echo( Error: "%home%\Not_Strict_Modified\%mrDir%\!name!.mr" Was not sucessfully encoded.>>"%home%\errors.txt"
echo(!name!?%home%\Not_Strict_Modified\%mrDir%\!name!.mr>>"%home%\Not_Strict_Modified\%buildFile%"
set check=
)
del /q "%home%\imageres"
if exist "%home%\errors.txt" call :Error
echo( Rebuilding Encoded Files...
"%~dp0bin\BuildMotoLogo.exe" <"%home%\Not_Strict_Modified\%buildFile%" -o "%home%\Not_Strict_Modified\build.bin" -n %imageCount%
%validlog% "%~dp0bin\MotoLogoValidator.exe" -i "%home%\Not_Strict_Modified\build.bin" || goto :RebuildError
set "file=%home%\Not_Strict_Modified\build.bin"
set "home=%home%\Not_Strict_Modified"
call :SaveSettings
%syslog% move "%~dp0%IDfile%" "%home%\"
call :LoadDetails "%home%\%IDfile%"
echo( Validation succesful
2>nul md "%home%\%imagesDir%"
call :ffmpegit
goto :Menu
:ConvertFolder
call :DrawHead
if exist "%home%\errors.txt" del /q "%home%\errors.txt"
if not exist "%home%\%IDfile%" call :NotThere
if not exist "%home%\%buildFile%" call :NotThere
call :LoadDetails "%home%\%IDfile%"
echo(&echo( Checking Resolutions..
if defined home if exist "%home%\" rd /s /q "%home%\Modified\" 2>nul
2>nul md "%home%\Modified"
2>nul md "%home%\Modified\%rawBGRDir%"
2>nul md "%home%\Modified\%mrDir%"
for /l %%a in (1,1,%images%) do (
echo( Converting: !logoName[%%a]!
if not exist "%home%\%imagesDir%\!logoName[%%a]!.%prevailExt%" (
call :DrawHead
echo(&echo( An image for !logoName[%%a]! is missing in the %imagesDir% folder.
echo(&echo( If you are trying to remove an image from you bin file, you need
echo( to rebuild the %imagesDir% folder in Non Strict Mode.
echo(&echo( Press any key to return to the menu.
pause>nul
goto :Menu
)
for /f "tokens=1-8* delims=," %%A in ('bin\ffmpeg -hide_banner -i "%home%\%imagesDir%\!logoName[%%a]!.%prevailExt%" -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -y "%home%\Modified\%rawBGRDir%\!logoName[%%a]!.bgr24" 2^>^&1^|findstr /rxic:".*stream #0:0.*[0-9]x[0-9].*"') do (
echo(%%A >"%home%\imageres"
echo(%%B >>"%home%\imageres"
echo(%%C >>"%home%\imageres"
echo(%%D >>"%home%\imageres"
echo(%%E >>"%home%\imageres"
echo(%%F >>"%home%\imageres"
echo(%%G >>"%home%\imageres"
echo(%%H >>"%home%\imageres"
)
for /f "tokens=1-3 delims=x " %%I in ('type "%home%\imageres"^|findstr /rxic:".*[0-9]x[0-9].*"') do set /a width=%%I &set /a height=%%J
if not defined width echo( Error: "Width undefined in !logoName[%%a]!.%prevailExt%">>"%home%\errors.txt"
if not defined height echo( Error: "Height undefined in !logoName[%%a]!.%prevailExt%">>"%home%\errors.txt"
if !width! neq !logoWidth[%%a]! set check=1
if !height! neq !logoHeight[%%a]! set check=1
if defined check call :Aspect !width! !height! !logoWidth[%%a]! !logoHeight[%%a]! "%home%\%imagesDir%\!logoName[%%a]!.%prevailExt%" "%home%\Modified\%rawBGRDir%\!logoName[%%a]!.bgr24" "!logoName[%%a]!"
if not exist "%home%\Modified\%rawBGRDir%\!logoName[%%a]!.bgr24" echo( Error: "%home%\Modified\%rawBGRDir%\!logoName[%%a]!.bgr24" Was not created.>>"%home%\errors.txt"
echo( Encoding: !logoName[%%a]!
%codeclog% "%~dp0bin\MotoLogoCodec.exe" -e -i "%home%\Modified\%rawBGRDir%\!logoName[%%a]!.bgr24" -o "%home%\Modified\%mrDir%\!logoName[%%a]!.mr" -w !width! -h !height!
if not exist "%home%\Modified\%mrDir%\!logoName[%%a]!.mr" echo( Error: "%home%\Modified\%mrDir%\!logoName[%%a]!.mr" Was not sucessfully encoded.>>"%home%\errors.txt"
echo(!logoName[%%a]!?%home%\Modified\%mrDir%\!logoName[%%a]!.mr>>"%home%\Modified\%buildFile%"
set check=
set width=
set height=
)
del /q "%home%\imageres"
if exist "%home%\errors.txt" call :Error
echo( Rebuilding Encoded Files...
"%~dp0bin\BuildMotoLogo.exe" <"%home%\Modified\%buildFile%" -o "%home%\Modified\build.bin" -n %images%
%validlog% "%~dp0bin\MotoLogoValidator.exe" -i "%home%\Modified\build.bin" || goto :RebuildError
set "file=%home%\Modified\build.bin"
set "home=%home%\Modified"
call :SaveSettings
%syslog% move "%~dp0%IDfile%" "%home%\"
call :LoadDetails "%home%\%IDfile%"
echo( Validation succesful
2>nul md "%home%\%imagesDir%"
call :ffmpegit
goto :Menu
:Aspect
set check=
set /a border=5
set /a border2=2*%border%
echo(&echo( Image: %~7
set /a newAspect=%aspectMultiplier%*%1/%2
set /a originalAspect=%aspectMultiplier%*%3/%4
echo(
echo( The resolution for %7 is different from the original image.
echo( New : %1x%2
echo( Original: %3x%4
echo(
echo( ____________________________________________________________________________
if "%originalAspect%"=="%newAspect%" (
echo(
echo( 1 - Stretch Or Shrink The Image To Fit The Original Size
echo(
echo( 2 - Do Nothing And Continue
echo(
choice /n /m "please select a menu number:" /c:12
if errorlevel 1 set k=1
if errorlevel 2 set k=2
if !k!==1 set "videoFilters=-vf "scale=%3:%4""
if !k!==2 goto :eof
) else (
echo(
if %3 gtr %4 (echo( 1 - Resize And Crop While Keeping The Original Aspect And Size ^(Upper Image^)) else (echo( 1 - Resize And Crop While Keeping The Original Aspect And Size ^(Left Image^))
echo(
if %3 gtr %4 (echo( 2 - Stretch Or Shrink The Image To Fit The Original Size ^(Lower Image^)) else (echo( 2 - Stretch Or Shrink The Image To Fit The Original Size ^(Right Image^))
echo(
echo( 3 - Do Nothing And Continue With %1x%2 Image
echo(
if %4 lss %3 (set /a ffw=%3+2*%border%&set /a ffh=%4*2+3*%border%&set "overlay=overlay=%border%:h+%border2%") else (set /a ffw=%3*2+3*%border%&set /a ffh=%4+2*%border%&set "overlay=overlay=w+%border2%:%border%")
if %originalAspect% lss %newAspect% (set "scale=scale=-1:%4") else (set "scale=scale=%3:-1")
"%~dp0bin\ffmpeg.exe" -loglevel fatal -i "%~5" -i "%~5" -filter_complex "color=red:!ffw!x!ffh!:1[bg];[0]!scale!, crop=%3:%4[sc0];[1]scale=%3:%4[sc1];[bg][sc0]overlay=%border%:%border%[x];[x][sc1]!overlay!" -y "%home%\test.png"%ffmpeglog%
if exist "%home%\test.png" if defined useDefaultViewer (start "" "%home%\test.png") else (rundll32 "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen %home%\test.png)
choice /n /m "please select a menu number:" /c:123
if errorlevel 1 set k=1
if errorlevel 2 set k=2
if errorlevel 3 set k=3
if !k!==1 (
if %originalAspect% gtr %newAspect% set "videoFilters=-vf "scale=%3:-1, crop=%3:%4""
if %originalAspect% lss %newAspect% set "videoFilters=-vf "scale=-1:%4, crop=%3:%4""
)
if !k!==2 set "videoFilters=-vf "scale=%3:%4""
if !k!==3 goto :eof
2>nul del /q "%home%\test.png"
)
set /a width=%3
set /a height=%4
%ffmpeglog% "%~dp0bin\ffmpeg.exe" %ffdebug% %ffshowb% -i "%~5" !videoFilters! -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -y "%~6"
goto :eof
:RebuildError
echo( There was a problem rebuilding the images..
echo( Press any key to exit.
pause>nul
goto :Finish
:Error
call :DrawHead
echo(&type "%home%\errors.txt"
echo(&echo( Press any key to exit..
pause >nul
goto :Finish
:DrawHead
cls echo( _________________________________________________________________________-_-
echo( Motorola Image Injector v%vers%
echo(
echo( written by Makers_Mark
echo( ____________________________________________________________________________
goto :eof
:DrawFileInfo
echo( File: %file% &echo( Size: %fileSize% Bytes ^(%megaSize%.%megaDeci% MB^)&echo( ____________________________________________________________________________
goto :eof
:DrawDetails
call :DrawFileInfo
"%~dp0bin\DrawDetails.exe" <"%home%\%IDfile%"
goto :eof
:NoLogo
call :DrawHead
echo(&echo( No Motorola Logo Images were found in the file.
echo( Press any key to exit....
pause>nul
exit
:LoadDetails
set /a images=0
for /f "tokens=1-7 delims=," %%t in ('type "%~1"') do (
set /a images+=1
set "logoName[!images!]=%%t" &set /a logoOffset[!images!]=%%y &set /a logoSize[!images!]=%%z &set /a logoSizeTotal[!images!]=%%w
set /a logoBlocks[!images!]=%%x &set /a logoWidth[!images!]=%%u &set /a logoHeight[!images!]=%%v
)
goto :eof
:dupename
if not exist "%~dp0%workhere%\!%~1!\" (goto :eof)
set /a unique=1
:dupe
if not exist "%~dp0%workhere%\!%~1!.%unique%\" (
set "%~1=!%~1!.%unique%"
goto :eof
) else (
set /a unique+=1
goto :dupe
)
goto :eof
:LoadNewFile
for %%? in ("%file%") do set /a "size=%%~z?" &set "filename=%%~nx?" &set "ext=%%~x?" &set "name=%%~n?"
set "newDir=%name%"
call :dupename "newDir"
set "home=%~dp0%workHere%\%newDir%"
2>nul mkdir "%home%"
goto :eof
:LoadSettings
<"%~dp0sys\last_file" (
set /p file=
set /p home=
set /p fileSize=
)
call :StripQuotes %file% %home%
goto :eof
:StripQuotes
set "file=%~1"
set "home=%~2"
goto :eof
:SaveSettings
for %%? in ("%file%") do set fileSize=%%~z?
set /a fileSize
set /a megaSize=%fileSize%/(1024*1024)
set /a remain=%fileSize% %% (1024*1024)
set /a megaDeci=(%remain%*1000)/(1024*1024)
>"%~dp0sys\last_file" (
echo("%file%"
echo("%home%"
echo(%fileSize%
)
goto :eof
:ffmpegit
echo( Converting Images Into %prevailExt% Images...
(for /f %%a in ('dir /b/a-d "%home%\%rawBGRDir%\*.bgr24"') do (
for /l %%? in (1, 1, %images%) do (
if "%%~na"=="!logoName[%%?]!" (
call set /a width=!logoWidth[%%?]!"
call set /a height=!logoHeight[%%?]!
)
)
"%~dp0bin\ffmpeg.exe" %ffdebug% %ffshowb% -loglevel fatal -f rawvideo -vcodec rawvideo -s !width!x!height! -pix_fmt bgr24 -i "%home%\%rawBGRDir%\%%~nxa" -y "%home%\%imagesDir%\%%~na.%prevailExt%"
))%ffmpeglog%
>"%home%\Make MotoLogo Bin From %imagesDir% Folder.bat" (
echo(@echo off
echo(cmd ^/c ^""%~dpnx0" $$$convert$$$ "%file%" "%home%"^"
echo(
)
>"%home%\Make MotoLogo Bin (Not Strict) From %imagesDir% Folder.bat" (
echo(@echo off
echo(cmd ^/c ^""%~dpnx0" $$notstrict$$ "%file%" "%home%"^"
echo(
)
if %autoOpenFolders%==1 start "" "%home%\"
goto :eof
:help
call :DrawHead
echo(&echo(
echo( You have to drag a file onto this batch file,
echo( in order to load a file into it.
echo( Press a key to close this window and exit.
pause >nul
goto :finish
:NotThere
call :Drawhead
echo(&echo(
echo( File^(s^) are missing. Reload File by dragging and dropping onto
echo( this batch file again.
echo( Press a key to close this window and exit.
pause>nul
goto :finish
:Finish
cls&exit
goto :eof
DrawDetails.c
Code:
#include <string.h>
#include <stdio.h>
#include <windows.h>
int main()
{
char *s = "," ;
char *token ;
int i , j = 1 , k , color ;
char line[80];
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO consoleInfo;
WORD originalColor;
GetConsoleScreenBufferInfo(hConsole, &consoleInfo);
originalColor = consoleInfo.wAttributes;
printf(" ____________________________________________________________________________\n");
printf(" Image Name WxH Size+ Blocks Offset Raw Size \n");
printf(" _________________________________________________________________________-_-\n");
while(fgets(line, sizeof line, stdin) != NULL){
if (( j % 2 ) == 0) {
color = 0x0B;
} else {
color = 0xB0;
}
SetConsoleTextAttribute(hConsole, color);
token = strtok(line, s);
for ( i = 0; i < 7; i++){
if (i==0){
printf(" %2d.%-24s", j,token);
token = strtok(NULL,s);
} else if ( i == 1 ){
printf("%dx", atoi(token));
token = strtok(NULL,s);
} else if ( i == 2 ){
printf("%d\t", atoi(token));
token = strtok(NULL,s);
} else if (( i > 2) && ( i < 6 )){
printf("%d\t", atoi(token));
token = strtok(NULL,s);
} else {
printf("%-13d\r\n", atoi(token));
token = strtok(NULL,s);
}
}
j++;
}
SetConsoleTextAttribute(hConsole, originalColor);
}
It looks to be 8MB. I can't upload though.
grim489 said:
It looks to be 8MB. I can't upload though.
Click to expand...
Click to collapse
Thats cool, no upload needed. Just curious about the filesize. Thanks again!
No problem! I can't help with much else though ?
grim489 said:
No problem! I can't help with much else though ?
Click to expand...
Click to collapse
Hey you've done enough, I almost forgot to thank you for testing my initial image in the other thread, added to the OP.
I'll poke around later with this. Kinda missed having this ability coming from the nexus 5.
any youtube video on the startup animations? i wouldn't mind changing the google screen to saying NeXus 6 logo with the X colored logo
cobyman7035 said:
any youtube video on the startup animations? i wouldn't mind changing the google screen to saying NeXus 6 logo with the X colored logo
Click to expand...
Click to collapse
Thanks fellow XDAlien, almost forgot.. added to OP:
The logo partition has nothing to do with your boot animation. Your boot animation actually comes right after the static image, that in this case says "Google" in catull font; and if you have an unlocked bootloader, additionally there will be a little lock that appears to be open (aka "dummy locked") in the bottom center of the screen. Your boot animation follows after this screen goes away, your boot animation is typically animated or dynamic. The static screen with "Google" is known as your splash screen to some, or boot screen to others. This tool allows you to change the static image (splash screen) and not your boot animation.​
So I got it working. But the bootloader rejects anything that doesn't use the original resolution.
GrayBoltWolf said:
So I got it working. But the bootloader rejects anything that doesn't use the original resolution.
Click to expand...
Click to collapse
Thanks for that information. But for clarification, are you talking about images from just the bootloader screen? For example, if you try to change the logo_boot (the "GOOGLE" splash screen), can you use different resolutions?
makers_mark said:
Thanks for that information. But for clarification, are you talking about images from just the bootloader screen? For example, if you try to change the logo_boot (the "GOOGLE" splash screen), can you use different resolutions?
Click to expand...
Click to collapse
Same for all of them. If it is a higher resolution than the original then the bootloader freaks out and won't flash it.
Here is a video of how to change the boot logo:
Add it to the OP if you want.
Hello,
since I normally try to use as less Google services as possible and buy the Nexus devices always for the "open" HW, I was always a little anoyed by the Google logo on startup.
So thank you very much fpr this great tool. I directly tried it and replaced the Google logo on my Nexus 6 by a white NEXUS logo. I also removed the "UN"LOCK icon from the bootscreen.
Thank you very much again. Everthing works as expected
I attach the NEXUS logo I created for myself if somebody else wants it maybe.
makers_mark said:
Thanks for that information. But for clarification, are you talking about images from just the bootloader screen? For example, if you try to change the logo_boot (the "GOOGLE" splash screen), can you use different resolutions?
Click to expand...
Click to collapse
That's odd. I've changed min several times using all kinds of pictures. I just keep them under 300kb. I use a 1400x2560 photo and flash in TWRP. Never changed it in fastboot mode. I also put a transparent "lock" otherwise it'll show up on splash.
makers_mark said:
Thanks for that information. But for clarification, are you talking about images from just the bootloader screen? For example, if you try to change the logo_boot (the "GOOGLE" splash screen), can you use different resolutions?
Click to expand...
Click to collapse
That's odd. I've changed min several times using all kinds of pictures. I just keep them under 300kb. I use a 1400x2560 photo and flash in TWRP. Never changed it in fastboot mode.
BlockbusterF said:
Hello,
since I normally try to use as less Google services as possible and buy the Nexus devices always for the "open" HW, I was always a little anoyed by the Google logo on startup.
So thank you very much fpr this great tool. I directly tried it and replaced the Google logo on my Nexus 6 by a white NEXUS logo. I also removed the "UN"LOCK icon from the bootscreen.
Thank you very much again. Everthing works as expected
I attach the NEXUS logo I created for myself if somebody else wants it maybe.
Click to expand...
Click to collapse
Did you make this wall? Also how did u remove the " un"lock icon?
---------- Post added at 03:51 PM ---------- Previous post was at 03:20 PM ----------
Can I switch the "un" lock icon with maybe a iron man face?
Yes
---------- Post added at 02:40 PM ---------- Previous post was at 02:38 PM ----------
Galaxysm said:
Did you make this wall? Also how did u remove the " un"lock icon?
---------- Post added at 03:51 PM ---------- Previous post was at 03:20 PM ----------
Can I switch the "un" lock icon with maybe a iron man face?
Click to expand...
Click to collapse
I used a transparent one. So yes you can. I'd keep aspect ratio the same
713brianp27 said:
Yes
---------- Post added at 02:40 PM ---------- Previous post was at 02:38 PM ----------
I used a transparent one. So yes you can. I'd keep aspect ratio the same
Click to expand...
Click to collapse
I was able to do it. And changed the "unlock" icon for a Samus icon. Couldn't find a good iron man face/helmet at 96×96 size.

[MOD][WIN][BOOTLOGO]Change Your Splash Screen and Various Graphics

This is a hybrid batch and C program that I wrote to decode and encode the MotoLogo image container. I originally wrote it for the Nexus 6, but it works on your device too. It will allow you to edit or replace any of the images in your logo partition. This will also work with any Motorola device utilizing this current format.
The logo partition has nothing to do with your boot animation. Your boot animation actually comes right after the static image that is one of the several images you can change with this tool. Your boot animation follows after this screen goes away, your boot animation is typically animated or dynamic. The static screen is known as your splash screen to some, or boot screen to others. This tool allows you to change the static image (splash screen) and not your boot animation!​Thanks to GrayBoltWolf for making this video!!
This video was made using a Nexus 6, but the encoding of the logo.bin is identical. When I made this program, I made it with the mindset of being able to use it to edit ANY MotoLogo image container, even if it's an electronic billboard. I did not include the Nexus 6 bootlader in this version for obvious reasons. But you will just drag and drop your logo.bin from your phone, or if you have an unzipped bootloader (like I provided for the Nexus 6), you can just drag that. The program will find the MotoLogo container in it and cut it out.
Download the "MotoLogo Injector v.1.1" zip file at the bottom of this post.
Extract the zip file to a new folder.
To use just drag any file (your "logo.bin") that you think might have a MotoLogo container in it onto the batch file "MotoLogo_Injectorv1.1.bat"
The program will then find the Container in the file, extract it and validate every byte in it, and output it in the "Projects" folder.
A newly created folder will pop up that contains the raw image files, PNG image files, some identification files, and your extracted "logo.bin"
There will also be two new batch files in the folder that will make it easy to close the program, edit the images, then just click one of the batch files to get back into the program to re-encode the images. The difference in the two batch files is that one of them will re-encode the logo bin in a "Strict" way, and the other way is "Non-Strict"
Strict goes in the exact same order that the images were encoded in the first place.
Strict will fail if there are any more or any less images.
Strict will fail if any of the image names are changed.
Strict will check the resolution.
Strict will not let you have a Jpg, Bmp, ....any other format mixed in with the Pngs. (If you prefer to work with another image format, you can change that in the settings but you still can't mix them up inside of the "Images" folder; they should all be of the same type.
If an images resolution doesn't match the original images, it will warn you and give you options to resize or disregard the size difference.
Non-Strict simply goes through every file in the "Images" folder in alphanumerical order and makes it a raw file, encodes it, and puts the MotoLogo container together.
Non-Strict will take all kinds of differently formatted images.
The only reason I can see someone wanting to use Non-Strict is to delete images from a MotoLogo container.
In your "Images" folder is where you either edit or replace the PNG images. You can make them bigger, but I don't know what implications this may have as I do not have a device to test on. You must keep the names the exact same as the images, it is okay to change the image or even replace it (that's the whole point) but you have to keep the names the same for Strict mode, which I encourage you to use.
When you are finished editing your images:
You can open up the Original batch program if you haven't used it anymore (it remembers the last file loaded that had a successful validated container in it, so you don't have to drag and drop everytime). And then hit 1 "Rebuild Images Directory (Strict-In Order_Resolution Checks)"
Or you can click on the "Make MotoLogo Bin From Images Folder.bat" to go directly there.
After the program has rebuilt it, it will re validate the container, and then reconvert the container into view-able Pngs again. A new folder will automatically open. This contains your modified container called "build.bin". You can flash it from there.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
v.97b Initial Release
v.1.0
Fixed error with Moto X Style bg encoded image size being evenly divisible by 512
Made logging to the screen default so you can tell it's working and not hung up
Changed default image extension from "Png" to "png"
v.1.1
Fixed Settings Bug
I am not responsible for any damage done to your device!! Source is in Posts 2 & 3!
SOURCE:
SOURCE:
MotoLogo_Injectorv1.1.bat
Code:
@echo off&setlocal enabledelayedexpansion
MODE CON:COLS=78 LINES=1024&set "vers=1.1"
color 0b
title Motorola Image Injector v%vers%
cd /d "%~dp0"
set "file=%~1"
set /a "aspectMultiplier=100000"
set "useDefaultViewer="
set "syslog=>>"%~dp0sys\log.txt""
set "ffmpeglog="
set "validlog="
set "codeclog="
set "rawBGRDir=Raw_BGR_Files"
set "imagesDir=Images"
set "mrDir=Raw_MR_Files"
set "workHere=Projects"
set "IDfile=MoID.ID"
set "buildFile=build.ID"
set "dontShowInfo=0"
set "autoOpenFolders=1"
set "prevailExt=png"
if not exist "%~dp0sys\" mkdir "%~dp0sys"
if exist "%~dp0sys\settings.cfg" (call :LoadSetFile)
if "%dontShowInfo%"=="1" set "validlog=>>"%~dp0sys\validation_log.txt" 2>&1" &set "codeclog=>>"%~dp0sys\codec_log.txt" 2>&1" &set "ffmpeglog=>>"%~dp0sys\ffmpeg_log.txt" 2>&1"
if exist "%~dp0sys\last_file" if "[%file%]"=="[]" call :Existing
if /i "[%file%]" equ "[$$$convert$$$]" set "file=%~2" &set "home=%~3" &call :SaveSettings &goto :ConvertFolder
if /i "[%file%]" equ "[$$notstrict$$]" set "file=%~2" &set "home=%~3" &call :SaveSettings &goto :NotStrictConvert
if "[%file%]" neq "[]" if exist "%file%" call :New &goto :Menu
call :help
:Settings
call :DrawHead
echo( ____________________________________________________________________________
echo(
if %dontShowInfo%==1 (
echo( 1 - Show Info On The Screen ^(currently data is logged^)) else (echo( 1 - Log Info To A Text File ^(currently data is shown on screen^))
)
echo(
if %autoOpenFolders%==1 (
echo( 2 - Auto Open Folders After A New File Is Created ^(currently is On^)) else (echo( 2 - Auto Open Folders After A New File Is Created ^(currently is Off^))
echo(
echo( 3 - Change Which Image Format To Use ^(currently it is %prevailExt%^)
echo(
echo( 4 - Clear Logs In Sys Folder
echo(
echo( 5 - Exit
echo(
choice /n /m " Please Select A Menu Number:" /c:12345
if errorlevel 1 set k=1
if errorlevel 2 set k=2
if errorlevel 3 set k=3
if errorlevel 4 set k=4
if errorlevel 5 set k=5
if %k%==1 if %dontShowInfo%==1 (set "dontShowInfo=0") else (set "dontShowInfo=1")
if %k%==2 if %autoOpenFolders%==1 (set "autoOpenFolders=0") else (set "autoOpenFolders=1")
if %k%==3 call :ImageFormat
if %k%==4 2>nul del /q "%~dp0sys\*log*.txt
if %k%==5 goto :Menu
call :SaveSetFile
goto :Settings
:ImageFormat
call :DrawHead
echo(&echo( If you change the extension used in the program, you will no longer
echo( be able to edit older project folders that used the current image extension.
echo( You would have to switch back to what ever image format was used if you wanted
echo( to open an older project. Unless you rebuild a folder in Non Strict, which
echo( would allow you to use all different image types.
echo(&echo( Enter The Extension ^(without the "."^) That You Want To Use.
echo( Currently it is %prevailExt%
set /p prevailExt=: || set "prevailExt=png"
call :SaveSetFile
goto :eof
:LoadSetFile
<"%~dp0sys\settings.cfg" (
set /p dontShowInfo=
set /p autoOpenFolders=
set /p prevailExt=
)
goto :eof
:SaveSetFile
>"%~dp0sys\settings.cfg" (
echo(%dontShowInfo%
echo(%autoOpenFolders%
echo(%prevailExt%
)
goto :eof
:Existing
call :LoadSettings
call :SaveSettings
if not exist "%file%" call :NotThere
if not exist "%home%\%IDfile%" call :NotThere
if not exist "%home%\%buildFile%" call :NotThere
call :LoadDetails "%home%\%IDfile%"
goto :menu
pause
:New
call :DrawHead
call :LoadNewFile
%codeclog% "%~dp0bin\MotoLogoCodec.exe" -i "%file%" -o "%name%" -p "%home%" || (if defined "%home%" if exist "%home%\" rd /q "%home%" &call :NoLogo)
echo(&echo( MotoLogo container found, validating data...
%validlog% "%~dp0bin\MotoLogoValidator.exe" -i "%file%" || (
if exist "%home%\logo.bin" (
set "file=%home%\Logo.bin"
%validlog% "%~dp0bin\MotoLogoValidator.exe" -i "!file!" || (if defined home if exist "%home%\" del /q "%home%\*.bin" &rd /q "%home%" &call :ValidFail)
) else (if defined home if exist "%home%\" del /q "%home%\*.bin" &rd /q "%home%" &call :ValidFail)
)
set "file=%home%\logo.bin"
call :SaveSettings
echo(&echo( VALIDATION SUCCESSFUL&echo(
%syslog% move "%~dp0%IDfile%" "%home%\"
call :LoadDetails "%home%\%IDfile%"
call :MakeFolders
echo(&echo( Extracting images....Please wait...&echo(
"%~dp0bin\MotoLogoCodec.exe" -z -c -d -i "%file%" -o "%name%" -p "%home%\%mrDir%"
%syslog% move "%~dp0%buildFile%" "%home%\"
%syslog% move "%home%\%mrDir%\*.bgr24" "%home%\%rawBGRDir%\"
call :ffmpegit "%home%\%rawBGRDir%" "%home%\%imagesDir%"
goto :eof
:ValidFail
echo(&echo(&echo( Container Failed Validataion..
echo( Press any key to exit.
pause>nul
exit
goto :eof
:MakeFolders
2>nul mkdir "%home%\%rawBGRDir%"
2>nul mkdir "%home%\%mrDir%"
2>nul mkdir "%home%\%imagesDir%"
goto :eof
:Menu
call :DrawHead
call :DrawDetails
echo( ____________________________________________________________________________
echo(
echo( 1 - Rebuild %imagesDir% Directory ^(Strict-In Order-Resolution Checks^)
echo(
echo( 2 - Rebuild %imagesDir% Directory ^(Not Strict^)
echo(
echo( 3 - Open Current Project Folder
echo(
echo( 4 - Settings
echo(
echo( 5 - Fastboot Flash Current File
echo(
echo( 6 - Exit
echo(
choice /n /m " Please Select A Menu Number:" /c:123456
if errorlevel 1 set k=1
if errorlevel 2 set k=2
if errorlevel 3 set k=3
if errorlevel 4 set k=4
if errorlevel 5 set k=5
if errorlevel 6 set k=6
if %k%==1 call :ConvertFolder
if %k%==2 call :NotStrictConvert
if %k%==3 start "" "%home%"
if %k%==4 call :Settings
if %k%==5 call :Fla****
if %k%==6 goto :finish
goto :Menu
:Fla****
call :DrawHead
call :DrawDetails
echo(&echo( Your logo is ready to be flashed.&echo(
echo(&echo( Make sure that your device is connected and in Bootloader Mode.
echo(&echo( The following command will be issued:
echo( fastboot flash logo "%file%"
echo(&echo( Press 1 to flash the logo partition, or 2 to go back.&echo(
echo(&echo( 1 - Flash
echo(&echo( 2 - Go Back
echo(
choice /n /m " Please select a menu number:" /c:12
if errorlevel 1 set k=1
if errorlevel 2 set k=2
if !k!==1 (call )
if !k!==2 goto :Menu
"%~dp0bin\fastboot.exe" flash logo "%file%" &&echo. Finished..Press any key to Reboot your device.&&pause>nul&&"%~dp0bin\fastboot.exe" reboot
goto :eof
:NotStrictConvert
call :DrawHead
echo(&echo( This will rebuild all images in the %imageDir% folder.
echo( It will rebuild in alphabetical order while disregarding
echo( original width, height, position in bin file. You can pretty
echo( much put any image format in here and get an encoded bin file.
echo( Press 1 to Continue or 2 to Go Back
echo(&echo( 1 - Continue
echo(&echo( 2 - Go Back
echo(
choice /n /m "please select a menu number:" /c:12
if errorlevel 1 set k=1
if errorlevel 2 set k=2
if !k!==1 (call )
if !k!==2 goto :Menu
if exist "%home%\errors.txt" del /q "%home%\errors.txt"
if not exist "%home%\%IDfile%" call :NotThere
if not exist "%home%\%buildFile%" call :NotThere
call :LoadDetails "%home%\%IDfile%"
if defined home if exist "%home%\" rd /s /q "%home%\Not_Strict_Modified\" 2>nul
2>nul md "%home%\Not_Strict_Modified"
2>nul md "%home%\Not_Strict_Modified\%rawBGRDir%"
2>nul md "%home%\Not_Strict_Modified\%mrDir%"
set /a imageCount=0
2>nul del /q "%home%\%imagesDir%\Thumbs.db"
for /f %%a in ('dir /b /a-d-h "%home%\%imagesDir%\*.*"') do (
set /a imageCount=!imageCount!+1
echo( Converting: %%a
set "name=%%~na"
set name=!name:~0,24!
for /f "tokens=1-8* delims=," %%A in ('bin\ffmpeg -hide_banner -i "%home%\%imagesDir%\%%a" -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -y "%home%\Not_Strict_Modified\%rawBGRDir%\!name!.bgr24" 2^>^&1^|findstr /rxic:".*stream #0:0.*[0-9]x[0-9].*"') do (
echo(%%A >"%home%\imageres"
echo(%%B >>"%home%\imageres"
echo(%%C >>"%home%\imageres"
echo(%%D >>"%home%\imageres"
echo(%%E >>"%home%\imageres"
echo(%%F >>"%home%\imageres"
echo(%%G >>"%home%\imageres"
echo(%%H >>"%home%\imageres"
)
for /f "tokens=1-3 delims=x " %%I in ('type "%home%\imageres"^|findstr /rxic:".*[0-9]x[0-9].*"') do set /a width=%%I &set /a height=%%J
if not defined width echo( Error: "Width undefined in %%a">>"%home%\errors.txt"
if not defined height echo( Error: "Height undefined in %%a">>"%home%\errors.txt"
if not exist "%home%\Not_Strict_Modified\%rawBGRDir%\!name!.bgr24" echo( Error: "%home%\Not_Strict_Modified\%rawBGRDir%\!name!.bgr24" Was not created.>>"%home%\errors.txt"
echo( Encoding: !name!.bgr24
%codeclog% "%~dp0bin\MotoLogoCodec.exe" -e -i "%home%\Not_Strict_Modified\%rawBGRDir%\!name!.bgr24" -o "%home%\Not_Strict_Modified\%mrDir%\!name!.mr" -w !width! -h !height!
if not exist "%home%\Not_Strict_Modified\%mrDir%\!name!.mr" echo( Error: "%home%\Not_Strict_Modified\%mrDir%\!name!.mr" Was not sucessfully encoded.>>"%home%\errors.txt"
echo(!name!?%home%\Not_Strict_Modified\%mrDir%\!name!.mr>>"%home%\Not_Strict_Modified\%buildFile%"
set check=
)
del /q "%home%\imageres"
if exist "%home%\errors.txt" call :Error
echo( Rebuilding Encoded Files...
"%~dp0bin\BuildMotoLogo.exe" <"%home%\Not_Strict_Modified\%buildFile%" -o "%home%\Not_Strict_Modified\build.bin" -n %imageCount%
%validlog% "%~dp0bin\MotoLogoValidator.exe" -i "%home%\Not_Strict_Modified\build.bin" || goto :RebuildError
set "file=%home%\Not_Strict_Modified\build.bin"
set "home=%home%\Not_Strict_Modified"
call :SaveSettings
%syslog% move "%~dp0%IDfile%" "%home%\"
call :LoadDetails "%home%\%IDfile%"
echo( Validation succesful
2>nul md "%home%\%imagesDir%"
call :ffmpegit
goto :Menu
:ConvertFolder
call :DrawHead
if exist "%home%\errors.txt" del /q "%home%\errors.txt"
if not exist "%home%\%IDfile%" call :NotThere
if not exist "%home%\%buildFile%" call :NotThere
call :LoadDetails "%home%\%IDfile%"
echo(&echo( Checking Resolutions..
if defined home if exist "%home%\" rd /s /q "%home%\Modified\" 2>nul
2>nul md "%home%\Modified"
2>nul md "%home%\Modified\%rawBGRDir%"
2>nul md "%home%\Modified\%mrDir%"
for /l %%a in (1,1,%images%) do (
echo( Converting: !logoName[%%a]!
if not exist "%home%\%imagesDir%\!logoName[%%a]!.%prevailExt%" (
call :DrawHead
echo(&echo( An image for !logoName[%%a]! is missing in the %imagesDir% folder.
echo(&echo( If you are trying to remove an image from you bin file, you need
echo( to rebuild the %imagesDir% folder in Non Strict Mode.
echo(&echo( Press any key to return to the menu.
pause>nul
goto :Menu
)
for /f "tokens=1-8* delims=," %%A in ('bin\ffmpeg -hide_banner -i "%home%\%imagesDir%\!logoName[%%a]!.%prevailExt%" -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -y "%home%\Modified\%rawBGRDir%\!logoName[%%a]!.bgr24" 2^>^&1^|findstr /rxic:".*stream #0:0.*[0-9]x[0-9].*"') do (
echo(%%A >"%home%\imageres"
echo(%%B >>"%home%\imageres"
echo(%%C >>"%home%\imageres"
echo(%%D >>"%home%\imageres"
echo(%%E >>"%home%\imageres"
echo(%%F >>"%home%\imageres"
echo(%%G >>"%home%\imageres"
echo(%%H >>"%home%\imageres"
)
for /f "tokens=1-3 delims=x " %%I in ('type "%home%\imageres"^|findstr /rxic:".*[0-9]x[0-9].*"') do set /a width=%%I &set /a height=%%J
if not defined width echo( Error: "Width undefined in !logoName[%%a]!.%prevailExt%">>"%home%\errors.txt"
if not defined height echo( Error: "Height undefined in !logoName[%%a]!.%prevailExt%">>"%home%\errors.txt"
if !width! neq !logoWidth[%%a]! set check=1
if !height! neq !logoHeight[%%a]! set check=1
if defined check call :Aspect !width! !height! !logoWidth[%%a]! !logoHeight[%%a]! "%home%\%imagesDir%\!logoName[%%a]!.%prevailExt%" "%home%\Modified\%rawBGRDir%\!logoName[%%a]!.bgr24" "!logoName[%%a]!"
if not exist "%home%\Modified\%rawBGRDir%\!logoName[%%a]!.bgr24" echo( Error: "%home%\Modified\%rawBGRDir%\!logoName[%%a]!.bgr24" Was not created.>>"%home%\errors.txt"
echo( Encoding: !logoName[%%a]!
%codeclog% "%~dp0bin\MotoLogoCodec.exe" -e -i "%home%\Modified\%rawBGRDir%\!logoName[%%a]!.bgr24" -o "%home%\Modified\%mrDir%\!logoName[%%a]!.mr" -w !width! -h !height!
if not exist "%home%\Modified\%mrDir%\!logoName[%%a]!.mr" echo( Error: "%home%\Modified\%mrDir%\!logoName[%%a]!.mr" Was not sucessfully encoded.>>"%home%\errors.txt"
echo(!logoName[%%a]!?%home%\Modified\%mrDir%\!logoName[%%a]!.mr>>"%home%\Modified\%buildFile%"
set check=
set width=
set height=
)
del /q "%home%\imageres"
if exist "%home%\errors.txt" call :Error
echo( Rebuilding Encoded Files...
"%~dp0bin\BuildMotoLogo.exe" <"%home%\Modified\%buildFile%" -o "%home%\Modified\build.bin" -n %images%
%validlog% "%~dp0bin\MotoLogoValidator.exe" -i "%home%\Modified\build.bin" || goto :RebuildError
set "file=%home%\Modified\build.bin"
set "home=%home%\Modified"
call :SaveSettings
%syslog% move "%~dp0%IDfile%" "%home%\"
call :LoadDetails "%home%\%IDfile%"
echo( Validation succesful
2>nul md "%home%\%imagesDir%"
call :ffmpegit
goto :Menu
:Aspect
set check=
set /a border=5
set /a border2=2*%border%
echo(&echo( Image: %~7
set /a newAspect=%aspectMultiplier%*%1/%2
set /a originalAspect=%aspectMultiplier%*%3/%4
echo(
echo( The resolution for %7 is different from the original image.
echo( New : %1x%2
echo( Original: %3x%4
echo(
echo( ____________________________________________________________________________
if "%originalAspect%"=="%newAspect%" (
echo(
echo( 1 - Stretch Or Shrink The Image To Fit The Original Size
echo(
echo( 2 - Do Nothing And Continue
echo(
choice /n /m "please select a menu number:" /c:12
if errorlevel 1 set k=1
if errorlevel 2 set k=2
if !k!==1 set "videoFilters=-vf "scale=%3:%4""
if !k!==2 goto :eof
) else (
echo(
if %3 gtr %4 (echo( 1 - Resize And Crop While Keeping The Original Aspect And Size ^(Upper Image^)) else (echo( 1 - Resize And Crop While Keeping The Original Aspect And Size ^(Left Image^))
echo(
if %3 gtr %4 (echo( 2 - Stretch Or Shrink The Image To Fit The Original Size ^(Lower Image^)) else (echo( 2 - Stretch Or Shrink The Image To Fit The Original Size ^(Right Image^))
echo(
echo( 3 - Do Nothing And Continue With %1x%2 Image
echo(
if %4 lss %3 (set /a ffw=%3+2*%border%&set /a ffh=%4*2+3*%border%&set "overlay=overlay=%border%:h+%border2%") else (set /a ffw=%3*2+3*%border%&set /a ffh=%4+2*%border%&set "overlay=overlay=w+%border2%:%border%")
if %originalAspect% lss %newAspect% (set "scale=scale=-1:%4") else (set "scale=scale=%3:-1")
"%~dp0bin\ffmpeg.exe" -loglevel fatal -i "%~5" -i "%~5" -filter_complex "color=red:!ffw!x!ffh!:1[bg];[0]!scale!, crop=%3:%4[sc0];[1]scale=%3:%4[sc1];[bg][sc0]overlay=%border%:%border%[x];[x][sc1]!overlay!" -y "%home%\test.png"%ffmpeglog%
if exist "%home%\test.png" if defined useDefaultViewer (start "" "%home%\test.png") else (rundll32 "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen %home%\test.png)
choice /n /m "please select a menu number:" /c:123
if errorlevel 1 set k=1
if errorlevel 2 set k=2
if errorlevel 3 set k=3
if !k!==1 (
if %originalAspect% gtr %newAspect% set "videoFilters=-vf "scale=%3:-1, crop=%3:%4""
if %originalAspect% lss %newAspect% set "videoFilters=-vf "scale=-1:%4, crop=%3:%4""
)
if !k!==2 set "videoFilters=-vf "scale=%3:%4""
if !k!==3 goto :eof
2>nul del /q "%home%\test.png"
)
set /a width=%3
set /a height=%4
%ffmpeglog% "%~dp0bin\ffmpeg.exe" %ffdebug% %ffshowb% -i "%~5" !videoFilters! -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -y "%~6"
goto :eof
:RebuildError
echo( There was a problem rebuilding the images..
echo( Press any key to exit.
pause>nul
goto :Finish
:Error
call :DrawHead
echo(&type "%home%\errors.txt"
echo(&echo( Press any key to exit..
pause >nul
goto :Finish
:DrawHead
cls echo( _________________________________________________________________________-_-
echo( Motorola Image Injector v%vers%
echo(
echo( written by Makers_Mark
echo( ____________________________________________________________________________
goto :eof
:DrawFileInfo
echo( File: %file% &echo( Size: %fileSize% Bytes ^(%megaSize%.%megaDeci% MB^)&echo( ____________________________________________________________________________
goto :eof
:DrawDetails
call :DrawFileInfo
"%~dp0bin\DrawDetails.exe" <"%home%\%IDfile%"
goto :eof
:NoLogo
call :DrawHead
echo(&echo( No Motorola Logo Images were found in the file.
echo( Press any key to exit....
pause>nul
exit
:LoadDetails
set /a images=0
for /f "tokens=1-7 delims=," %%t in ('type "%~1"') do (
set /a images+=1
set "logoName[!images!]=%%t" &set /a logoOffset[!images!]=%%y &set /a logoSize[!images!]=%%z &set /a logoSizeTotal[!images!]=%%w
set /a logoBlocks[!images!]=%%x &set /a logoWidth[!images!]=%%u &set /a logoHeight[!images!]=%%v
)
goto :eof
:dupename
if not exist "%~dp0%workhere%\!%~1!\" (goto :eof)
set /a unique=1
:dupe
if not exist "%~dp0%workhere%\!%~1!.%unique%\" (
set "%~1=!%~1!.%unique%"
goto :eof
) else (
set /a unique+=1
goto :dupe
)
goto :eof
:LoadNewFile
for %%? in ("%file%") do set /a "size=%%~z?" &set "filename=%%~nx?" &set "ext=%%~x?" &set "name=%%~n?"
set "newDir=%name%"
call :dupename "newDir"
set "home=%~dp0%workHere%\%newDir%"
2>nul mkdir "%home%"
goto :eof
:LoadSettings
<"%~dp0sys\last_file" (
set /p file=
set /p home=
set /p fileSize=
)
call :StripQuotes %file% %home%
goto :eof
:StripQuotes
set "file=%~1"
set "home=%~2"
goto :eof
:SaveSettings
for %%? in ("%file%") do set fileSize=%%~z?
set /a fileSize
set /a megaSize=%fileSize%/(1024*1024)
set /a remain=%fileSize% %% (1024*1024)
set /a megaDeci=(%remain%*1000)/(1024*1024)
>"%~dp0sys\last_file" (
echo("%file%"
echo("%home%"
echo(%fileSize%
)
goto :eof
:ffmpegit
echo( Converting Images Into %prevailExt% Images...
(for /f %%a in ('dir /b/a-d "%home%\%rawBGRDir%\*.bgr24"') do (
for /l %%? in (1, 1, %images%) do (
if "%%~na"=="!logoName[%%?]!" (
call set /a width=!logoWidth[%%?]!"
call set /a height=!logoHeight[%%?]!
)
)
"%~dp0bin\ffmpeg.exe" %ffdebug% %ffshowb% -loglevel fatal -f rawvideo -vcodec rawvideo -s !width!x!height! -pix_fmt bgr24 -i "%home%\%rawBGRDir%\%%~nxa" -y "%home%\%imagesDir%\%%~na.%prevailExt%"
))%ffmpeglog%
>"%home%\Make MotoLogo Bin From %imagesDir% Folder.bat" (
echo(@echo off
echo(cmd ^/c ^""%~dpnx0" $$$convert$$$ "%file%" "%home%"^"
echo(
)
>"%home%\Make MotoLogo Bin (Not Strict) From %imagesDir% Folder.bat" (
echo(@echo off
echo(cmd ^/c ^""%~dpnx0" $$notstrict$$ "%file%" "%home%"^"
echo(
)
if %autoOpenFolders%==1 start "" "%home%\"
goto :eof
:help
call :DrawHead
echo(&echo(
echo( You have to drag a file onto this batch file,
echo( in order to load a file into it.
echo( Press a key to close this window and exit.
pause >nul
goto :finish
:NotThere
call :Drawhead
echo(&echo(
echo( File^(s^) are missing. Reload File by dragging and dropping onto
echo( this batch file again.
echo( Press a key to close this window and exit.
pause>nul
goto :finish
:Finish
cls&exit
goto :eof
DrawDetails.c
Code:
#include <string.h>
#include <stdio.h>
#include <windows.h>
int main()
{
char *s = "," ;
char *token ;
int i , j = 1 , k , color ;
char line[80];
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO consoleInfo;
WORD originalColor;
GetConsoleScreenBufferInfo(hConsole, &consoleInfo);
originalColor = consoleInfo.wAttributes;
printf(" ____________________________________________________________________________\n");
printf(" Image Name WxH Size+ Blocks Offset Raw Size \n");
printf(" _________________________________________________________________________-_-\n");
while(fgets(line, sizeof line, stdin) != NULL){
if (( j % 2 ) == 0) {
color = 0x0B;
} else {
color = 0xB0;
}
SetConsoleTextAttribute(hConsole, color);
token = strtok(line, s);
for ( i = 0; i < 7; i++){
if (i==0){
printf(" %2d.%-24s", j,token);
token = strtok(NULL,s);
} else if ( i == 1 ){
printf("%dx", atoi(token));
token = strtok(NULL,s);
} else if ( i == 2 ){
printf("%d\t", atoi(token));
token = strtok(NULL,s);
} else if (( i > 2) && ( i < 6 )){
printf("%d\t", atoi(token));
token = strtok(NULL,s);
} else {
printf("%-13d\r\n", atoi(token));
token = strtok(NULL,s);
}
}
j++;
}
SetConsoleTextAttribute(hConsole, originalColor);
}
SOURCE:
MotoLogoCodec.c
Code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#define OUT_FILE "logo.bin"
#define MOTOLOGO_BARE_HEADER 13
#define MOTOLOGO_IMG_BLK_SIZE 32
#define BIT_SET 0x8000
#define IS_BIT_SET(x) (x & BIT_SET)
#define COLORS 3
#define SWAP(x) (((x & 0xFF00) >> 8) | ((x & 0x00FF) << 8))
typedef struct {
unsigned short count;
unsigned char color[COLORS];
} motoSet;
typedef struct {
char header[8];
unsigned short width;
unsigned short height;
} motoHead;
typedef struct {
char name[24];
unsigned long offset;
unsigned long size;
unsigned short totalBlocks;
unsigned long totalSize;
motoHead imageHead;
} imageHead;
typedef struct {
unsigned char r;
unsigned char g;
unsigned char b;
} pixel;
void MotoRunEncode(void);
int FindMotoLogo(void);
int ParseHeader(unsigned long, int);
void CutMRImageOut(int, char*, unsigned long);
unsigned long int BlockIt(unsigned long int);
void MotoDecode(int, char*, unsigned short, unsigned short, unsigned long, int);
unsigned short pad = 1;
unsigned short addDetails = 0;
unsigned short cutMR = 0;
unsigned short decode = 0, encode = 0;
unsigned short blockSize = 512;
unsigned short pos = 0;
unsigned short filesFound = 0;
unsigned short logoOutput = 1;
unsigned short width = 0, height = 0;
char *inputFile, *base, *path;
char *motoLogoHeader;
unsigned long start, end;
FILE *inStream;
FILE *outStream;
char command[512];
char padByte = 0xff;
void MotoRunEncode(void)
{
unsigned int i,ind, m;
pixel line[width];
unsigned short count;
motoHead motoRunHeader;
if ((inStream = fopen(inputFile, "rb")) == NULL){
fclose(inStream);
fprintf(stderr, "\n%s\nCould not be opened.", inputFile);
return;
}
if ((outStream = fopen(base, "wb")) == NULL){
fclose(inStream);
fclose(outStream);
fprintf(stderr, "\n%s\nCould not be opened.", base);
return;
}
motoRunHeader.header[0] = 0x4D;
motoRunHeader.header[1] = 0x6F;
motoRunHeader.header[2] = 0x74;
motoRunHeader.header[3] = 0x6F;
motoRunHeader.header[4] = 0x52;
motoRunHeader.header[5] = 0x75;
motoRunHeader.header[6] = 0x6E;
motoRunHeader.header[7] = 0x00;
motoRunHeader.width = SWAP(width);
motoRunHeader.height = SWAP(height);
fwrite(&motoRunHeader, 1, sizeof(motoRunHeader), outStream);
for (i = 1; i <= height; i++){
fread(line, COLORS, width, inStream);
for (ind = 0, count = 0 ; ind <= width - 1; ){
if ((memcmp(&line[ind], &line[ind+1], 3) == 0)){
ind++;
count = 1;
while((ind <= width - 2) && ((memcmp(&line[ind], &line[ind+1], 3))== 0)){
count++;
ind++;
}
if (count == 1){
count++;
ind++;
goto LOOP;
} else {
count++;
count |= BIT_SET;
count = SWAP(count);
fwrite(&count, 1, 2, outStream);
fwrite(&line[ind], 1, 3, outStream);
}
ind++;
} else {
count = 1;
ind++;
LOOP:
while (((ind >= width -2)&&(ind <= width -1)) || ((ind <= width - 2) && (memcmp(&line[ind], &line[ind+1], 3) != 0)) || ((ind <= width - 3) && (memcmp(&line[ind+1], &line[ind+2], 3) != 0))){
count++;
ind++;
}
count = SWAP(count);
fwrite(&count, 1, 2, outStream);
fwrite(&line[ind - SWAP(count)], SWAP(count), COLORS, outStream);
continue;
}
}
}
return;
}
int FindMotoLogo(void)
{
char header[] = {0x4D,0x6F,0x74,0x6F,0x4C,0x6F,0x67,0x6F,0x00};
unsigned long int firstOffset;
int readByte;
char string[9];
if ((inStream = fopen(inputFile, "rb")) == NULL){
fclose(inStream);
fprintf(stderr, "\n%s\nCould not be opened.", inputFile);
return;
}
int inNumber = fileno(inStream);
while ((readByte = fgetc(inStream)) != EOF){
if (readByte == header[pos]){
if (pos == 8){
start = (ftell(inStream) - 9);
fseek(inStream, start + 9, SEEK_SET);
read(inNumber, &end, 4);
fseek(inStream, start + 9 + 4 + 24, SEEK_SET );
read(inNumber, &firstOffset, 4);
fseek(inStream, start + firstOffset, SEEK_SET );
read(inNumber, &string, 9);
if (strcmp(string, "MotoRun") == 0){
fseek(inStream, start + 13, SEEK_SET );
return (ParseHeader(end, inNumber));
} else {
pos = 0;
fseek(inStream, start + 9, SEEK_SET );
continue;
}
} else {
pos++;
continue;
}
}
pos = 0;
}
close(inNumber);
fprintf(stderr,"\n%d MotoLogo (logo.bin) files found.", filesFound);
return;
}
int ParseHeader(unsigned long end, int inNumber)
{
unsigned int imageCounter = (end - MOTOLOGO_BARE_HEADER) / MOTOLOGO_IMG_BLK_SIZE;
imageHead motomoto[imageCounter];
int i;
unsigned long logoSize, pos;
for(i=0; i < imageCounter; i++){
read(inNumber, &motomoto[i], 32);
motomoto[i].totalSize = BlockIt(motomoto[i].size);
motomoto[i].totalBlocks = (motomoto[i].totalSize /blockSize);
fprintf(stdout,"\nName: %s\nOffset in Logo.bin: %ld\nImage Data Size: %ld",motomoto[i].name, motomoto[i].offset, motomoto[i].size);
fprintf(stdout,"\nTotal Size: %ld",motomoto[i].totalSize);
fprintf(stdout,"\nTotal Blocks: %d",motomoto[i].totalBlocks);
pos = ftell(inStream);
fseek(inStream, start + motomoto[i].offset, SEEK_SET);
if (cutMR){
CutMRImageOut(inNumber, motomoto[i].name, motomoto[i].size);
fseek(inStream, start + motomoto[i].offset, SEEK_SET); //moved this line inside the parentheses
}
read(inNumber, &motomoto[i].imageHead, 12);
motomoto[i].imageHead.width = SWAP(motomoto[i].imageHead.width);
motomoto[i].imageHead.height = SWAP(motomoto[i].imageHead.height);
fprintf(stdout,"\nWidth x Height: %dx%d",motomoto[i].imageHead.width,motomoto[i].imageHead.height);
fprintf(stdout,"\nHeader: %s\n\n",motomoto[i].imageHead.header);
if (decode){
MotoDecode(inNumber, motomoto[i].name, motomoto[i].imageHead.width, motomoto[i].imageHead.height, motomoto[i].size , i+1);
}
fseek(inStream, pos, SEEK_SET);
}
logoSize = motomoto[imageCounter-1].offset + motomoto[imageCounter-1].totalSize;
fprintf(stdout,"\nLogo.bin contains %ld image files and is %ld bytes in size", i, logoSize);
if (!(logoOutput)){
return 0;
}
sprintf(command,"%s\\%s", path , OUT_FILE );
if ((outStream = fopen(command, "wb")) == NULL){
fclose(outStream);
fprintf(stderr, "\n%s\\%s could not be opened.", path, OUT_FILE);
return 1;
}
int outNumber = fileno(outStream);
fseek(inStream, start, SEEK_SET );
char* logobin = malloc(logoSize);
read(inNumber, logobin, logoSize);
write(outNumber, logobin, logoSize);
close(outNumber);
free(logobin);
return 0;
}
void CutMRImageOut(int inNumber, char* name, unsigned long size){
char newName[26];
FILE *txt;
sprintf(command,"%s\\%s.mr", path , name );
if ((txt = fopen("build.ID", "a")) == NULL){
fclose(txt);
fprintf(stderr, "\nBuild.ID could not be opened.\n");
return;
}
if ((outStream = fopen(command, "wb")) == NULL){
fclose(outStream);
fclose(txt);
fprintf(stderr, "\n%s\\%s.mr could not be opened", path, name);
return;
}
sprintf(command,"%s\n", command );
sprintf(newName, "%s?", name);
fwrite(newName, strlen(newName), 1, txt);
fwrite(command, strlen(command), 1, txt);
fclose(txt);
int outNumber = fileno(outStream);
char *dataStream = malloc(size);
read(inNumber, dataStream, size);
write(outNumber, dataStream, size);
if (pad){
if ((size % blockSize) != 0){
unsigned int max = blockSize - (size % blockSize ), i;
for (i = 0; i < max; i++){
write(outNumber, &padByte , 1);
}
fprintf(stdout,"\n%d bytes padded to %s", max, name);
}
}
close(outNumber);
free(dataStream);
return;
}
unsigned long int BlockIt(unsigned long int isize){
if ((isize % blockSize) == 0){
return isize;
}else{
return isize + (blockSize - (isize %blockSize));
}
}
void MotoDecode(int inNumber, char* name, unsigned short width, unsigned short height, unsigned long size, int index)
{
unsigned short repeats, count;
unsigned char color[3];
unsigned long counter = 0;
motoSet data;
if (addDetails){
sprintf(command, "%s\\%03d_%dx%d_%s.bgr24", path , index, width, height, name);
} else {
sprintf(command, "%s\\%s.bgr24", path, name);
}
if ((outStream = fopen(command, "wb")) == NULL){
fclose(outStream);
fprintf(stderr, "\n%s\nCould not be opened.", command);
return;
}
int outNumber = fileno(outStream);
while((read(inNumber, &data, 5) != EOF) && (counter < size)){
counter += 5;
if ((counter >= size ) || (data.count == 0xffff)){
close(outNumber);
return;
}
data.count = SWAP(data.count);
if (IS_BIT_SET(data.count)){
data.count &= ~BIT_SET;
for (repeats = 0;repeats < data.count; repeats++){
write(outNumber, &data.color, COLORS);
}
} else {
write(outNumber, &data.color, COLORS);
for (repeats = 0; repeats < data.count -1; repeats++){
counter += COLORS;
if ((read(inNumber, color, COLORS) == EOF) || counter >= size){
write(outNumber, &color, COLORS);
close(outNumber);
return;
}
write(outNumber, &color, COLORS);
}
}
}
close(outNumber);
return;
}
int main(int argc, char **argv)
{
int c;
while ((c = getopt (argc, argv, "i:o:p:b:w:h:cdezna")) != -1){
switch(c)
{
case 'a':
addDetails = 1;
break; //add index number and resolution to decoded filenames
case 'i':
inputFile = optarg;
break;
case 'o':
base = optarg;
break;
case 'p':
path = optarg;
break;
case 'b':
blockSize = atoi(optarg);
break;
case 'c':
cutMR = 1;
break;
case 'd':
decode = 1;
break;
case 'e':
encode = 1;
break;
case 'z':
pad = 0;
break;
case 'n':
logoOutput = 0;
break;
case 'w':
width = atoi(optarg);
break;
case 'h':
height = atoi(optarg);
break;
}
}
if (encode == 1){
MotoRunEncode();
return;
}
return(FindMotoLogo());
}
MotoLogoValidator.c
Code:
/*
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#define MOTOLOGO_BARE_HEADER 13
#define MOTOLOGO_IMG_BLK_SIZE 32
#define BIT_SET 0x8000
#define IS_BIT_SET(x) (x & BIT_SET)
#define COLORS 3
#define SWAP(x) (((x & 0xFF00) >> 8) | ((x & 0x00FF) << 8))
typedef struct {
unsigned short count;
unsigned char color[COLORS];
} motoSet;
typedef struct {
char header[8];
unsigned short width;
unsigned short height;
} motoHead;
typedef struct {
char name[24];
unsigned long offset;
unsigned long size;
unsigned short totalBlocks;
unsigned long totalSize;
motoHead imageHead;
} imageHead;
typedef struct {
unsigned char r;
unsigned char g;
unsigned char b;
} pixel;
int FindMotoLogo();
int ValidateMotoLogoHeader();
unsigned long int BlockIt(unsigned long int);
int VerifyImages(char*, unsigned short, unsigned short, unsigned long);
unsigned short pos, inNumber, blockSize = 512;
char *inputFile;
unsigned long start, end;
FILE *inStream;
FILE *txt;
char command[512];
char padByte = 0xff;
int FindMotoLogo()
{
char header[] = {0x4D,0x6F,0x74,0x6F,0x4C,0x6F,0x67,0x6F,0x00};
unsigned long int firstOffset;
int readByte;
char string[9];
for (pos = 0 ; pos <= 8 ; pos++ ){
if ((readByte = fgetc(inStream)) == header[pos]){
fprintf(stdout,"\nHeader:\n%d %02x",pos, header[pos]);
if (pos == 8){
fprintf(stdout, "\nHeader Match");
start = 0;
fseek(inStream, start + 9, SEEK_SET);
read(inNumber, &end, 4);
fseek(inStream, start + 9 + 4 + 24, SEEK_SET );
read(inNumber, &firstOffset, 4);
fseek(inStream, start + firstOffset, SEEK_SET );
read(inNumber, &string, 9);
if (strcmp(string, "MotoRun") == 0){
fseek(inStream, start + 13, SEEK_SET );
fprintf(stdout,"\nEnd of MotoLogo Header is byte %d.\n", end);
return 0;
} else {
fprintf(stderr,"\nFirst offset in MotoLogo header doesn't point to an image header.");
return 1;
}
} else {
continue;
}
} else {
fprintf(stderr,"\nFile: %s\ndoes not start with a valid MotoLogo header.", inputFile);
return 1;
}
}
return 1;
}
int ValidateMotoLogoHeader()
{
unsigned int imageCounter = (end - MOTOLOGO_BARE_HEADER) / (MOTOLOGO_IMG_BLK_SIZE);
fprintf(stdout,"\n%d images referenced in header.\nChecking Images.\n", imageCounter);
imageHead motomoto[imageCounter];
int i;
char motoRunHeader[] = "MotoRun\0";
fseek(inStream, 13, SEEK_SET);
for(i=0; i < imageCounter; i++){
read(inNumber, &motomoto[i], 32); //add an if parameter switch for the last element not to include the padding
motomoto[i].totalSize = BlockIt(motomoto[i].size);
motomoto[i].totalBlocks = (motomoto[i].totalSize /blockSize);
fprintf(stdout,"\nName: \"%s\"\nOffset In File: %ld\nImage Data Size: %ld",motomoto[i].name, motomoto[i].offset, motomoto[i].size);
fprintf(stdout,"\nTotal Size With Padding: %ld",motomoto[i].totalSize);
fprintf(stdout,"\nTotal Blocks: %d",motomoto[i].totalBlocks);
if (i != 0){
if ((motomoto[i-1].offset + motomoto[i-1].totalSize) == (motomoto[i].offset)){
fprintf(stdout, "\nOffsets match!");
} else {
fprintf(stderr, "\nOffsets do not match between %s and %s.\nVALIDATION FAILURE!\n", motomoto[i-1].name, motomoto[i].name);
return 1;
}
} else {
if (motomoto[i].offset == BlockIt(end)){
fprintf(stdout, "\nOffsets Match!");
} else {
fprintf(stderr, "\n%d is offset and %d is the end of the MotoLogo Header\nVALIDATION FAILURE!\n", motomoto[i].offset, BlockIt(end));
return 1;
}
}
pos = ftell(inStream);
fseek(inStream, motomoto[i].offset, SEEK_SET);
read(inNumber, &motomoto[i].imageHead, 12);
motomoto[i].imageHead.width = SWAP(motomoto[i].imageHead.width);
motomoto[i].imageHead.height = SWAP(motomoto[i].imageHead.height);
fprintf(stdout,"\nWidth x Height: %dx%d",motomoto[i].imageHead.width,motomoto[i].imageHead.height);
fprintf(stdout,"\nExpected Pixels: %d", (motomoto[i].imageHead.width * motomoto[i].imageHead.height));
if(strcmp(motoRunHeader, motomoto[i].imageHead.header) != 0){
fprintf(stderr, "\nHeader Should be \"%s\", not \"%s\"\nVALIDATION FAILED!\n", motoRunHeader, motomoto[i].imageHead.header);
return 1;
}
fprintf(stdout,"\nHeader: \"%s\"",motomoto[i].imageHead.header);
if (!VerifyImages(motomoto[i].name, motomoto[i].imageHead.width, motomoto[i].imageHead.height, motomoto[i].size - 12)){
fseek(inStream, pos, SEEK_SET);
continue;
} else {
return 1;
}
}
if ((txt = fopen("MoID.ID", "w")) == NULL){
fclose(txt);
fprintf(stderr, "\nMoID.ID could not be opened.\n");
return 1;
}
for(i=0; i < imageCounter; i++){
fprintf(txt, "%s,%d,%d,%d,%d,", motomoto[i].name, motomoto[i].imageHead.width, motomoto[i].imageHead.height, motomoto[i].totalSize, motomoto[i].totalBlocks);
fprintf(txt, "%d,%d\n", motomoto[i].offset, motomoto[i].size);
}
fclose(txt);
return 0;
}
unsigned long int BlockIt(unsigned long int isize){
if ((isize % blockSize) == 0){
return isize;
}else{
return isize + (blockSize - (isize %blockSize));
}
}
int VerifyImages(char* name, unsigned short width, unsigned short height, unsigned long size)
{
unsigned short line = 0, pixelsonline = 0;
unsigned long pixelsDecoded = 0, totalPixels = 0, bytesRead = 0;
motoSet data;
unsigned long posi;
while(bytesRead < size){
if ((bytesRead += read(inNumber, &data, 5)) == EOF){
return 0;
}
data.count = SWAP(data.count);
if (IS_BIT_SET(data.count)){
data.count &= ~BIT_SET;
pixelsonline += data.count;
} else {
posi = ftell(inStream);
fseek(inStream, (posi + (COLORS * (data.count - 1))), SEEK_SET);
pixelsonline += data.count;
bytesRead = bytesRead + (COLORS * (data.count - 1));
}
if (pixelsonline == width){
line++;
pixelsDecoded += pixelsonline;
pixelsonline = 0;
}
if ((pixelsonline == width) && ((pixelsDecoded / line) == pixelsonline)){
line++;
pixelsonline = 0;
}
}
fprintf(stdout,"\nPixels Decoded: %d\nBytes Read: %d\nSize Minus Header: %d\nLines Properly Terminated: %d", pixelsDecoded, bytesRead, size , line);
if ((pixelsDecoded == width * height) && (bytesRead == size) && (height == line )){
fprintf(stdout,"\n\"%s\" Is Encoded Correctly\n", name);
return 0;
}
if (pixelsDecoded != (width * height)){
fprintf(stderr, "\nThe total pixels decoded, %d, doesn't equal the resolution: %dx%d=%d",pixelsDecoded, width, height, (width * height));
}
if (bytesRead != size){
fprintf(stderr, "\nThe total bytes read, %d, is not equal to the encoded size, %d.", bytesRead, size);
}
if (height != line ){
fprintf(stderr, "\nAt least one run in the encoding runs past the edge of the screen.\nThis will not work.");
}
fprintf(stderr, "\n%s is not encoded correctly\nVALIDATION FAILURE!\n", name);
return 1;
}
int main(int argc, char **argv)
{
int c;
while ((c = getopt (argc, argv, "i:b:")) != -1){
switch(c)
{
case 'i':
inputFile = optarg;
break;
case 'b':
blockSize = atoi(optarg);
break;
}
}
if ((inStream = fopen(inputFile, "rb")) == NULL){
fclose(inStream);
fprintf(stderr, "\n%s\nCould not be opened.\n", inputFile);
return 1;
}
inNumber = fileno(inStream);
if (!FindMotoLogo()){
if (!ValidateMotoLogoHeader()){
fclose(inStream);
return 0;
}
}
fclose(inStream);
return 1;
}
BuildMotoLogo.c v1.1
Code:
/* Version 1.1
Fixed error with encoded files that have a file size that is
evenly divisible by 512
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
typedef struct {
char name[24];
unsigned long offset;
unsigned long size;
unsigned long sizeWithPadding;
} imageHead;
unsigned long int ReadList(void);
unsigned int GetHeaderSize(void);
unsigned long int BlockIt(unsigned long int);
char *txtFileName;
FILE *inFile;
FILE *outFile;
char *outputFileName;
unsigned short images = 0;
unsigned short blockSize = 512;
unsigned long int ReadList(void){
char header[] = {0x4D,0x6F,0x74,0x6F,0x4C,0x6F,0x67,0x6F,0x00};
char line[512];
int readByte;
imageHead Item[images];
unsigned long int totalDataSize = 0;
int i = 0 , k = 0 , l = 0;
unsigned char padByte = 255;
unsigned long sizes[images];
char *s = "?";
char *tok;
unsigned long int hs;
if ((outFile = fopen (outputFileName, "wb")) == NULL){
perror("\nError opening output file:");
fclose(outFile);
}
hs = GetHeaderSize();
for ( i = 0 ; i < hs ; i++){
fputc(padByte, outFile);
}
i = 0;
hs = (images * 32) + 13;
while(fgets(line, sizeof line , stdin) != NULL){
tok = strtok(line, s);
sprintf(Item[i].name, "%s",tok);
tok = strtok(NULL, s);
for ( l = 24 ; l - strlen(Item[i].name) > 0 ; l-- ){
Item[i].name[l] = '\0';
}
for (k = 0; k < strlen(tok); k++){
if (( tok[k] == '\n') || (tok[k] == '\r' )){
tok[k] = '\0';
}
}
if ((inFile = fopen( tok , "rb")) == NULL){
perror("\nError opening mr file:");
fclose(inFile);
return 0;
}
while( ( readByte = fgetc(inFile) ) != EOF ){
fputc(readByte, outFile);
}
Item[i].size = ftell(inFile);
fprintf(stdout, "\n%d" , Item[i].size);
if ((Item[i].size % 512) != 0){
for ( k = 0 ; k < (blockSize - (Item[i].size % blockSize)) ; k++){
fputc(padByte, outFile);
}
}
Item[i].sizeWithPadding = BlockIt(Item[i].size);
totalDataSize += Item[i].sizeWithPadding;
if (i == 0){
Item[i].offset = BlockIt(hs);
} else {
Item[i].offset = ((Item[ i - 1 ].sizeWithPadding) + (Item[ i - 1 ].offset));
}
fprintf(stdout, "\n%ld", Item[i].offset);
i++;
fclose(inFile);
}
fseek(outFile, 0 , SEEK_SET);
fwrite(&header, sizeof header, 1 , outFile);
fwrite(&hs, 4, 1 ,outFile);
fprintf(stdout, "\n Size of Header is %d.", hs);
for (i = 0 ; i < images ; i++ ){
fwrite(&Item[i].name, 1 , 24 , outFile);
fwrite(&Item[i].offset, 4, 1 , outFile);
fwrite(&Item[i].size, 4, 1, outFile);
}
fclose(outFile);
fclose(inFile);
return totalDataSize;
}
unsigned int GetHeaderSize(void){
unsigned int ret = BlockIt(13 + ( 32 * images));
return ret;
}
unsigned long int BlockIt(unsigned long int isize){
if ((isize % blockSize) == 0){
return isize;
}else{
return isize + (blockSize - (isize %blockSize));
}
}
int main(int argc, char **argv){
int c;
while ((c = getopt (argc, argv, "o:n:")) != -1){
switch(c)
{
case 'o':
outputFileName = optarg;
break;
case 'n':
images = atoi(optarg);
break;
}
}
ReadList();
return;
}
nice it's very important
Does this really work for Moto G 2015? i dont wanna break my phone
how does the bootlogo look
and can you post a pic
@makers_mark Would it be possible to get this as a bash script to run on Ubuntu?
Excellent, works beautifully.
dustin_b said:
@makers_mark Would it be possible to get this as a bash script to run on Ubuntu?
Click to expand...
Click to collapse
Yeah, it's possible, but what I think you're asking is if I can do it, and I'm not proficient enough to write a bash script to do everything my batch script does. You're probably better off running a Windows vm, or if you know what you want to replace with what, send me the images and I'll do it for you.
makers_mark said:
Yeah, it's possible, but what I think you're asking is if I can do it, and I'm not proficient enough to write a batch script to do everything my that batch script does. You're probably better off running a Windows vm, or if you know what you want to replace with what, send me the images and I'll do it for you.
Click to expand...
Click to collapse
Yeah, that's what I was getting at. I know nothing about it or I would do it so I just thought I would ask. I have a Windows laptop( a cheap one though that is slow), and I'm able to use your script on it. It works great by the way! But I prefer my Ubuntu laptop and try not to use the other if possible. I will just use it on Windows or check out the VM like you suggested. Thanks for replying though and for the script!
Sent from my XT1575 using Tapatalk
edit moto x pure .bin
I cannot get v1.1 to validate my logo.bin file and open it to edit. Im pretty sure it is valid because I flashed it and am currently using it. phone is a moto x pure. any tips?
etmidust said:
I cannot get v1.1 to validate my logo.bin file and open it to edit. Im pretty sure it is valid because I flashed it and am currently using it. phone is a moto x pure. any tips?
Click to expand...
Click to collapse
You probably downloaded a logo.bin that was altered. The popular thing to do is simply use a hex editor and edit the offset of the logo unlocked image so that it points to the logo boot image. These will fall validation with my program because I check that the offset of an image meets exactly at the tail end of the previous image. It may work on your phone, but it's a safety I put there to check mainly the modified logo that is produced. I may change that though for the initial validation.
makers_mark said:
You probably downloaded a logo.bin that was altered. The popular thing to do is simply use a hex editor and edit the offset of the logo unlocked image so that it points to the logo boot image. These will fall validation with my program because I check that the offset of an image meets exactly at the tail end of the previous image. It may work on your phone, but it's a safety I put there to check mainly the modified logo that is produced. I may change that though for the initial validation.
Click to expand...
Click to collapse
Thanks, ill keep looking for one I can actually edit then.
etmidust said:
Thanks, ill keep looking for one I can actually edit then.
Click to expand...
Click to collapse
You have one on your phone ☺ I don't have a device, so I don't know the exact location of your logo partition. But follow this guide and you can grab yours off of your phone.
EDIT :
Unless the one there is the already modified one. In that case, try dragging your whole downloaded system image (from Motorola) onto the program. If it is unzipped, the program will find it and cut it out.
etmidust said:
Thanks, ill keep looking for one I can actually .edit then.
Click to expand...
Click to collapse
in the Moto X pure forums, development thread there is a return to stock tool that contains an unmodified boot logo.
NEVERMIND I'm stupid, it's in the development section for the Moto X threads.
Could anybody upload the stock logo.bin? I already have an altered one so I can't rip mine from my phone and my internet (yes, at home) has a data cap so I can't really download the stock image and extract the logo.bin from there. Thanks.
bigfunkychiken said:
NEVERMIND I'm stupid, it's in the development section for the Moto X threads.
Could anybody upload the stock logo.bin? I already have an altered one so I can't rip mine from my phone and my internet (yes, at home) has a data cap so I can't really download the stock image and extract the logo.bin from there. Thanks.
Click to expand...
Click to collapse
Sure, but what is your device model? XT1540?
Thank you for this. It works perfect for my Droid Turbo and is VERY user friendly!
very good. It was very useful.
Can you also add a stock boot image that we can use as a template? All others are from the same modified source that fail validation.

Need advice about “mkbootimg” (compiling android kernel)

I´m working on compiling an kernel from SonyXperiaDev source, have already build kernel zImage with:
HTML:
make ARCH=<arch> CROSS_COMPILE=$CROSS_COMPILE <device_defconfig>
make ARCH=<arch> CROSS_COMPILE=$CROSS_COMPILE -j <cpu_thread_number>
make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE -j12 -C M=$PWD CONFIG_PRIMA_WLAN=m CONFIG_PRIMA_WLAN_LFR=y KERNEL_BUILD=1 WLAN_ROOT=$PWD
I extract the ramdisk.cpio.gz from my device now i´m able to assemble the new boot image. But i'm not sure about the mkbootimg file that is neccessary for assemble the boot.img here a request of the compiling guide:
Assemble the boot image file The kernel image and the RAM image need to be assembled in a boot image file. The boot image file will then be flashed to your phone or tablet. Depending on your device, you need to use the tool mkqcdtbootimg, provided by SonyXperiaDev on GitHub, or mkbootimg, provided by the Android Open Source Project, to create the boot image. Please note that the program must be compiled differently depending on which system you are running.
Click to expand...
Click to collapse
In my case i need the mkbootimg from AOSP but how can i find the right one?
here the command for the next step:
HTML:
./mkbootimg --base 0x80200000 --kernel zImage --ramdisk_offset 0x02000000 --cmdline "androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3 vmalloc=400M androidboot.emmc=true" --ramdisk ramdisk.cpio.gz -o boot.img
Details to my Device:
[ro.product.cpu.abilist32]: [armeabi-v7a,armeabi]
[Xperia Z]
[ro.com.google.gmsversion]: [5.1_r2]
[Sony/C6603/C6603:5.1.1/10.7.A.0.222]
Click to expand...
Click to collapse
I was looking here for the source mkbootimg:
https://android.googlesource.com/platform/system/core/+/android-5.1.1_r2
https://android.googlesource.com/platform/system/core/+refs
it contains the mkbootimmg.c but the kernel and ramdisk offset are diffrent to the sony instrucktion.
HTML:
boot_img_hdr hdr;
char *kernel_fn = 0;
void *kernel_data = 0;
char *ramdisk_fn = 0;
void *ramdisk_data = 0;
char *second_fn = 0;
void *second_data = 0;
char *cmdline = "";
char *bootimg = 0;
char *board = "";
unsigned pagesize = 2048;
int fd;
SHA_CTX ctx;
const uint8_t* sha;
unsigned base = 0x10000000;
unsigned kernel_offset = 0x00008000;
unsigned ramdisk_offset = 0x01000000;
unsigned second_offset = 0x00f00000;
unsigned tags_offset = 0x00000100;
size_t cmdlen;
How can i identify the right mkbootimg file for assembly zImage and ramdisk.gz?
Thank you
You can just use AnyKernel2, it has mkbootimg included, so it automatically makes boot image with ramdisk of currently installed kernel when flashed.

[Help][Q] Compiling Magisk from source errors

UPDATE: ISSUE HAS BEEN FIXED, THANK YOU
Hi all,
I am trying to compile Magisk after cloning it from the Github repository (https://github.com/topjohnwu/Magisk).
I cloned it via
Code:
git clone [B]-recursive[/B] https://github.com/topjohnwu/Magisk.git
in order to download the proper submodules as well.
After running
Code:
python3 build.py all 14.3 143
(btw, I am simply guessing the versioncode argument. Does it matter?)
the error I get is the following:
pastebin: https://pastebin.com/eVwGhvXa
Code:
* Building Magisk binaries
[x86] Compile : b64xz <= b64xz.c
[x86] Compile : magisk <= magisk.c
[x86] Compile : magisk <= daemon.c
[x86] Compile : magisk <= socket_trans.c
[x86] Compile : magisk <= log_monitor.c
[x86] Compile : magisk <= bootstages.c
[x86] Compile : magisk <= misc.c
[x86] Compile : magisk <= vector.c
[x86] Compile : magisk <= xwrap.c
[x86] Compile : magisk <= list.c
[x86] Compile : magisk <= img.c
[x86] Compile : magisk <= file.c
[x86] Compile : magisk <= magiskhide.c
[x86] Compile : magisk <= proc_monitor.c
[x86] Compile : magisk <= hide_utils.c
[x86] Compile : magisk <= magiskpolicy.c
[x86] Compile : magisk <= rules.c
[x86] Compile : magisk <= sepolicy.c
[x86] Compile : magisk <= api.c
[x86] Compile++ : magisk <= resetprop.cpp
[x86] Compile++ : magisk <= system_properties.cpp
In file included from jni/resetprop/resetprop.cpp:63:
In file included from jni/resetprop/_system_properties.h:40:
jni/resetprop/system_properties.h:46:64: error: expected function body after function declarator
int __system_property_set2(const char* key, const char* value) __INTRODUCED_IN(12);
^
jni/resetprop/system_properties.h:61:19: error: expected function body after function declarator
void* cookie) __INTRODUCED_IN(26);
^
jni/resetprop/system_properties.h:70:3: error: expected function body after function declarator
__INTRODUCED_IN(19);
^
jni/resetprop/system_properties.h:89:5: error: expected function body after function declarator
__INTRODUCED_IN(26);
^
jni/resetprop/resetprop.cpp:177:3: error: use of undeclared identifier '__system_property_read_callback2'; did you mean
'__system_property_read2'?
__system_property_read_callback2(pi, read_prop_info, value);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__system_property_read2
jni/resetprop/system_properties.h:94:5: note: '__system_property_read2' declared here
int __system_property_read2(const prop_info* pi, char* name, char* value);
^
jni/resetprop/resetprop.cpp:177:40: error: cannot initialize a parameter of type 'char *' with an lvalue of type 'void (void *, const
char *, const char *, uint32_t)' (aka 'void (void *, const char *, const char *, unsigned int)')
__system_property_read_callback2(pi, read_prop_info, value);
^~~~~~~~~~~~~~
jni/resetprop/system_properties.h:94:56: note: passing argument to parameter 'name' here
int __system_property_read2(const prop_info* pi, char* name, char* value);
^
jni/resetprop/resetprop.cpp:192:2: error: use of undeclared identifier '__system_property_read_callback2'; did you mean
'__system_property_read2'?
__system_property_read_callback2(pi, cb_wrapper, cookie);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__system_property_read2
jni/resetprop/system_properties.h:94:5: note: '__system_property_read2' declared here
int __system_property_read2(const prop_info* pi, char* name, char* value);
^
jni/resetprop/resetprop.cpp:192:39: error: cannot initialize a parameter of type 'char *' with an lvalue of type 'void (void *, const
char *, const char *, uint32_t)' (aka 'void (void *, const char *, const char *, unsigned int)')
__system_property_read_callback2(pi, cb_wrapper, cookie);
^~~~~~~~~~
jni/resetprop/system_properties.h:94:56: note: passing argument to parameter 'name' here
int __system_property_read2(const prop_info* pi, char* name, char* value);
^
In file included from jni/resetprop/system_properties.cpp:54:
In file included from jni/resetprop/_system_properties.h:40:
jni/resetprop/system_properties.h:46:64: error: expected function body after function declarator
int __system_property_set2(const char* key, const char* value) __INTRODUCED_IN(12);
^
jni/resetprop/system_properties.h:61:19: error: expected function body after function declarator
void* cookie) __INTRODUCED_IN(26);
^
jni/resetprop/system_properties.h:70:3: error: expected function body after function declarator
__INTRODUCED_IN(19);
^
jni/resetprop/system_properties.h:89:5: error: expected function body after function declarator
__INTRODUCED_IN(26);
^
jni/resetprop/resetprop.cpp:254:2: error: use of undeclared identifier '__system_property_foreach2'; did you mean
'__system_property_get2'?
__system_property_foreach2(prop_foreach_cb, &wrap);
^~~~~~~~~~~~~~~~~~~~~~~~~~
__system_property_get2
jni/resetprop/system_properties.h:96:5: note: '__system_property_get2' declared here
int __system_property_get2(const char* name, char* value);
^
jni/resetprop/resetprop.cpp:254:29: error: cannot initialize a parameter of type 'const char *' with an lvalue of type
'void (const prop_info *, void *)'
__system_property_foreach2(prop_foreach_cb, &wrap);
^~~~~~~~~~~~~~~
jni/resetprop/system_properties.h:96:40: note: passing argument to parameter 'name' here
int __system_property_get2(const char* name, char* value);
^
jni/resetprop/resetprop.cpp:271:10: error: use of undeclared identifier '__system_property_set2'; did you mean
'__system_property_get2'?
ret = __system_property_set2(name, value);
^~~~~~~~~~~~~~~~~~~~~~
__system_property_get2
jni/resetprop/system_properties.h:96:5: note: '__system_property_get2' declared herejni/resetprop/system_properties.cpp:97:3: error: unknown type name 'va_list'; did you mean '__va_list'?
va_list vl;
^~~~~~~
__va_list
/home/solar/Android/Sdk/ndk-bundle/platforms/android-21/arch-x86/usr/include/sys/types.h:129:27: note: '__va_list' declared here
int __system_property_get2(const char* name, char* value);
^
typedef __builtin_va_list __va_list;
^
jni/resetprop/resetprop.cpp:271:39: error: cannot initialize a parameter of type 'char *' with an lvalue of type 'const char *'
ret = __system_property_set2(name, value);
^~~~~
jni/resetprop/system_properties.h:96:52: note: passing argument to parameter 'value' here
int __system_property_get2(const char* name, char* value);
^
jni/resetprop/system_properties.cpp:98:3: error: use of undeclared identifier 'va_start'
va_start(vl, format);
^
jni/resetprop/system_properties.cpp:99:13: error: use of undeclared identifier 'vsnprintf'
int ret = vsnprintf(s, n, format, vl);
^
jni/resetprop/system_properties.cpp:100:3: error: use of undeclared identifier 'va_end'
va_end(vl);
^
jni/resetprop/resetprop.cpp:278:10: error: use of undeclared identifier '__system_property_set2'; did you mean
'__system_property_get2'?
ret = __system_property_set2(name, value);
^~~~~~~~~~~~~~~~~~~~~~
__system_property_get2
jni/resetprop/system_properties.h:96:5: note: '__system_property_get2' declared here
int __system_property_get2(const char* name, char* value);
^
jni/resetprop/resetprop.cpp:278:39: error: cannot initialize a parameter of type 'char *' with an lvalue of type 'const char *'
ret = __system_property_set2(name, value);
^~~~~
jni/resetprop/system_properties.h:96:52: note: passing argument to parameter 'value' here
int __system_property_get2(const char* name, char* value);
^
14 errors generated.
make: *** [obj/local/x86/objs/magisk/resetprop/resetprop.o] Error 1
make: *** Waiting for unfinished jobs....
jni/resetprop/system_properties.cpp:1012:3: error: unknown type name 'va_list'; did you mean '__va_list'?
va_list ap;
^~~~~~~
__va_list
/home/solar/Android/Sdk/ndk-bundle/platforms/android-21/arch-x86/usr/include/sys/types.h:129:27: note: '__va_list' declared here
typedef __builtin_va_list __va_list;
^
jni/resetprop/system_properties.cpp:1030:3: error: use of undeclared identifier 'va_start'
va_start(ap, num_args);
^
jni/resetprop/system_properties.cpp:1034:33: error: expected '(' for function-style cast or type construction
spec_entry = va_arg(ap, char**);
~~~~^
jni/resetprop/system_properties.cpp:1034:35: error: expected expression
spec_entry = va_arg(ap, char**);
^
jni/resetprop/system_properties.cpp:1037:7: error: use of undeclared identifier 'va_end'
va_end(ap);
^
jni/resetprop/system_properties.cpp:1043:7: error: use of undeclared identifier 'va_end'
va_end(ap);
^
jni/resetprop/system_properties.cpp:1048:3: error: use of undeclared identifier 'va_end'
va_end(ap);
^
jni/resetprop/system_properties.cpp:1053:3: error: unknown type name 'FILE'
FILE* file = fopen(filename, "re");
^
jni/resetprop/system_properties.cpp:1053:16: error: use of undeclared identifier 'fopen'; did you mean 'open'?
FILE* file = fopen(filename, "re");
^~~~~
open
/home/solar/Android/Sdk/ndk-bundle/platforms/android-21/arch-x86/usr/include/fcntl.h:73:12: note: 'open' declared here
extern int open(const char*, int, ...);
^
jni/resetprop/system_properties.cpp:1053:32: error: cannot initialize a parameter of type 'int' with an lvalue of type
'const char [3]'
FILE* file = fopen(filename, "re");
^~~~
/home/solar/Android/Sdk/ndk-bundle/platforms/android-21/arch-x86/usr/include/fcntl.h:73:33: note: passing argument to parameter here
extern int open(const char*, int, ...);
^
jni/resetprop/system_properties.cpp:1497:3: error: use of undeclared identifier '__system_property_wait2'; did you mean
'__system_property_add2'?
__system_property_wait2(nullptr, old_serial, &new_serial, nullptr);
^~~~~~~~~~~~~~~~~~~~~~~
__system_property_add2
jni/resetprop/system_properties.cpp:1449:5: note: '__system_property_add2' declared here
int __system_property_add2(const char* name, unsigned int namelen, const char* value,
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [obj/local/x86/objs/magisk/resetprop/system_properties.o] Error 1
Build Magisk binary failed!
I'm building on Ubuntu 16.04 Xenial 64 bits.
It seems like the cmake or C libraries I have are older or not compatible with the one required by Magisk.
I'm out of ideas and I can't find any tutorials on compiling Magisk or any info on the errors above via Google.
Could you please help me out with some tips on what am I missing? I'd really appreciate it.
Thank you.
@easytotype Have you made sure that you're using the latest Android NDK?
Also, have you tried "sudo apt-get update && sudo apt-get upgrade"?
And, versionString and versionCode should be 14.4 and 1440, instead of 14.3 and 143 (it isn't related to this error, though)
Sent from my Samsung Galaxy Trend Plus using XDA Labs
DodoGTA said:
@easytotype Have you made sure that you're using the latest Android NDK? (...)
Click to expand...
Click to collapse
ndk was the problem indeed!
I had NDK v14,
installing the latest v15 solved the issue.
The facepalm was huge, but without your help I would have been for stuck much much longer.
Thank you very much @DodoGTA :good::good::good::good::good:

Categories

Resources