[DEV] itsmagic

Search This thread

sc2k

Senior Member
Dec 24, 2010
106
206
USE AT YOUR OWN RISK! YOU MAY BRICK YOUR DEVICE!


This is just a proof of concept. It will allow you to start any custom recovery. Sadly no completely working custom recovery is available. You can either try seraph's or vache's.

NOTE: Do not flash your kernel from recovery without calling itsmagic! Otherwise you will not be able to boot your device anymore.


How it works:

Checksums for all partitions are stored on mmcblk0p7. During boot, the actual checksums for boot.img and recovery.img are calculated and compared to the values stored in p7.
If a special pattern is applied to p7, the bootloader is triggered to recalculate the checksums and store them to p7. This pattern is also written when using normal recovery after installation of update.zip was succesful.

itsmagic does the same. It just applies the pattern, bootloader does the rest.

Backup:

Automatic method:
1. Download backup_tool
2. Extract somewhere on your PC.
3. Connect Iconia to your PC and ensure that USB debugging is enabled on your Iconia.
4. Execute 01_backup.bat and follow the instructions. The tool will take some time (~10 min), so be patient.
5. As soon as the batch file finished, check the backup folder for the following files:
Code:
p1, p2, p3, p5, p6, p7, mmcblk0_start, md5sums, uid.txt

6. Check if uid.txt contains a number like:
Code:
0x123456789abcdef0

If UID is empty then obtain your USB serial number as described at the end of this post.


Manual method:

1. Get your UID (= USB Serial number, has up to 16 chars) (see at the end of this post how to get). If you brick your device and do not know the UID, you are lost.
2. Backup all partitions (except cache + data) with dd:
Code:
dd if=/dev/block/mmcblk0p1 of=/mnt/external_sd/dumps/p1
dd if=/dev/block/mmcblk0p2 of=/mnt/external_sd/dumps/p2
dd if=/dev/block/mmcblk0p3 of=/mnt/external_sd/dumps/p3
dd if=/dev/block/mmcblk0p5 of=/mnt/external_sd/dumps/p5
dd if=/dev/block/mmcblk0p6 of=/mnt/external_sd/dumps/p6
dd if=/dev/block/mmcblk0p7 of=/mnt/external_sd/dumps/p7

3. Backup the first 0x680000 bytes of mmcblk0:
Code:
dd if=/dev/block/mmcblk0 bs=512 count=13312 of=/mnt/external_sd/dumps/mmcblk0_start
4. Store them somewhere outside of your device.

Install itsmagic:

1. Copy itsmagic somewhere to /data or /cache, and set chmod 755 to it.

Flash a custom recovery:

1. dd the new recovery to mmcblk0p1:
e.g.
Code:
dd if=/mnt/external_sd/cwm.bin of=/dev/block/mmcblk0p1
2. Call itsmagic
3. Reboot. Bootloader will do the rest
4. Boot into recovery and see if it works
5. Every time you change mmcblk0p1 or mmcblk0p2, itsmagic must be called again.

Restore stock recovery:

Same as flashing a custom recovery but flash "p1" of you backup to mmcblk0p1 and call itsmagic.

Note:

Some devices seem to have a /system/etc/install-recovery.sh script. This will reflash the stock recovery every time you boot into normal kernel.



How to get the USB serial number:

1. Connect Iconia to your PC

2. Simple method (Window/Linux/Max), thx @daveid

Call:
Code:
adb devices

It will output something like this:
Code:
List of devices attached
370014740c00594 device

The number is the UID. Save it somewhere. You will need it if you ever brick your device.


Alternative methods (complicated):

2.b Linux
- call lsusb -v
- read the value of iSerial for Iconia

2.c Windows
- Open Device manager
- Goto Properties of Android USB Devices->Acer Composite ADB Interface
- Goto "Details" Tab
- Select "Parent" from the property selection.
- Read the value. It looks like this:
USB\VID_0502&PID_3325\370014740c00594
- The number after the last "/" is the UID.

2.d Windows (alternative method)

Download this tool (download link is nearly at the end of the page):
http://www.nirsoft.net/utils/usb_devices_view.html

- Open the tool
- Sort after VendorID
- Check all devices with VendorID = 0502 and ProductID = 3325 . There is also a "Serial Number" column.



Thanks

Thanks @vache + @rayman for their help.
Thanks to all testers of this tool.

What next

We need a working custom recovery. Sadly I'm quite busy the next few days so I don't have enough time to work on it. But there are enough experienced devs around.

Video

Here's the "faked" video again :D

http://www.youtube.com/watch?v=6IOayJUvvQI
 
Last edited:

interqd

Senior Member
Nov 15, 2008
543
17
Bali
i think this is still not ready for user ..
but cant believe in last 3 days development of iconia can reach this far...

great guys...
sure next month we will have custom rom 3.1 for iconia :D
 

Dexter_nlb

Senior Member
Feb 12, 2009
5,459
4,550
Copenhagen
Finally!!

I am closing in with the 3.1 port of prime 1.4 .. so i needed this release..
so now we can figure out how to flash a working recovery next..
 

eBug

Senior Member
Jul 17, 2008
335
58
Flash a custom recovery:

1. dd the new recovery to mmcblk0p1:
e.g.
Code:
dd if=/mnt/external_sd/cwm.bin of=/dev/block/mmcblk0p1
2. Call itsmagic
3. Reboot. Bootloader will do the rest
4. Boot into recovery and see if it works
5. Every time you change mmcblk0p1 or mmcblk0p2, itsmagic must be called again.

Does the cwm.bin file you mention actually exist?
 

sc2k

Senior Member
Dec 24, 2010
106
206
Last edited:

themono

Senior Member
Sep 15, 2010
281
51
Spectacular, I now understand how this works. Thank you for supplying this to the community.

EDIT: When people begin putting custom roms together, might it be wise to edit the shutdown script to call itsmagic on every shutdown, just to be safe? Or does it introduce a performance penalty on next boot?
 
Last edited:

dhruvmp

Senior Member
Oct 10, 2010
82
7
Has anyone contacted the rom manager guys? This seems like something they might be interested in...
 

ardatdat

Senior Member
Jun 13, 2010
787
1,659
Travel around; but XDA x24
Thanks sc2k! It is amazing!

Basically, I understand the logic, and I have 2 questions:

1) What is the use of UID in the whole process? What I see is getting it and backing it up, but why you say if we brick our device and don't know the UID, we are lost?

2)
But note:
YOU MUST CALL itsmagic from within update.zip! Otherwise your device will not boot anymore.
What update.zip you are describing? You mean custom ROM/kernel? If flashing custom ROM without touching recovery, that means we do not need to call itsmagic again? Thanks.
 

sc2k

Senior Member
Dec 24, 2010
106
206
Thanks sc2k! It is amazing!

Basically, I understand the logic, and I have 2 questions:

1) What is the use of UID in the whole process? What I see is getting it and backing it up, but why you say if we brick our device and don't know the UID, we are lost?

2)

What update.zip you are describing? You mean custom ROM/kernel? If flashing custom ROM without touching recovery, that means we do not need to call itsmagic again? Thanks.

1. UID hast some special meaning during unbricking process. I will provide details some days later. But if you do not have the UID, you will not be able to unbrick your device.

2. Yes, i mean any custom kernel. As boot.img is also verified against the checksum, a new kernel requires a new checksum. To recalculate a new checksum, itsmagic has to be used.
 

ardatdat

Senior Member
Jun 13, 2010
787
1,659
Travel around; but XDA x24
1. UID hast some special meaning during unbricking process. I will provide details some days later. But if you do not have the UID, you will not be able to unbrick your device.

2. Yes, i mean any custom kernel. As boot.img is also verified against the checksum, a new kernel requires a new checksum. To recalculate a new checksum, itsmagic has to be used.

Wow! Thanks.

1. Now, I know that it is important. :) And I will remember it!

2. In theory, after flashing the custom kernel, in the updater-script, I should run the itsmagic. If I forget to embed it in the script, I can make another update.zip that 'only' runs itsmagic and flash it in the recovery. Right? (of coz, I cannot reboot in between...)

Arr.... btw, has acer released the kernel source? in some form of zip or github? I think under the GPL license, acer should have released it if 'someone' is asking for it.
 

Dexter_nlb

Senior Member
Feb 12, 2009
5,459
4,550
Copenhagen
I will put an APP together tomorrow, which should be able to install the recovery + run itsmagic all by a single press in the APP .

Let me see if i can have it ready for today or tomorrow..
but im sure it will make it all alot easier for all regular users.
 

themono

Senior Member
Sep 15, 2010
281
51
In the nicest possible way, if you don't understand the script then at this point I wouldn't run it!

Give things a few more days to settle down.

EDIT: And Dexter beats me to it :p
 
  • Like
Reactions: smaiitm

FloatingFatMan

Senior Member
Apr 20, 2005
2,708
539
54
In the nicest possible way, if you don't understand the script then at this point I wouldn't run it!

Give things a few more days to settle down.

EDIT: And Dexter beats me to it :p

^ This. A thousand times this! If you don't know what the script is doing, you have zero business using it. Don't risk your device, wait until these smart guys have a chance to make it simpler to use, and hopefully safer for everybody!

Oh, and don't forget to, at the very least, pile thanks on these guys. ;)
 

ardatdat

Senior Member
Jun 13, 2010
787
1,659
Travel around; but XDA x24
Thanks all the efforts up to now. I will try out the magic when I back home.

One question to ask: What is the worst situation? What I mean is that, if I forget to run itsmagic after flashing kernel, will I brick the device forever? And that I can no longer boot to recovery again?

Or, can I still go into recovery and restore from backup?

Thanks.
 

ikram0673

Member
Mar 6, 2008
7
0
wow you guys are great!!! im just a regular user so i guess i just wait until all the smart guys make it simpler and safer. thanks for the great job.

anyway where did you guys learn all this thing??
 

Top Liked Posts

  • There are no posts matching your filters.
  • 41
    USE AT YOUR OWN RISK! YOU MAY BRICK YOUR DEVICE!


    This is just a proof of concept. It will allow you to start any custom recovery. Sadly no completely working custom recovery is available. You can either try seraph's or vache's.

    NOTE: Do not flash your kernel from recovery without calling itsmagic! Otherwise you will not be able to boot your device anymore.


    How it works:

    Checksums for all partitions are stored on mmcblk0p7. During boot, the actual checksums for boot.img and recovery.img are calculated and compared to the values stored in p7.
    If a special pattern is applied to p7, the bootloader is triggered to recalculate the checksums and store them to p7. This pattern is also written when using normal recovery after installation of update.zip was succesful.

    itsmagic does the same. It just applies the pattern, bootloader does the rest.

    Backup:

    Automatic method:
    1. Download backup_tool
    2. Extract somewhere on your PC.
    3. Connect Iconia to your PC and ensure that USB debugging is enabled on your Iconia.
    4. Execute 01_backup.bat and follow the instructions. The tool will take some time (~10 min), so be patient.
    5. As soon as the batch file finished, check the backup folder for the following files:
    Code:
    p1, p2, p3, p5, p6, p7, mmcblk0_start, md5sums, uid.txt

    6. Check if uid.txt contains a number like:
    Code:
    0x123456789abcdef0

    If UID is empty then obtain your USB serial number as described at the end of this post.


    Manual method:

    1. Get your UID (= USB Serial number, has up to 16 chars) (see at the end of this post how to get). If you brick your device and do not know the UID, you are lost.
    2. Backup all partitions (except cache + data) with dd:
    Code:
    dd if=/dev/block/mmcblk0p1 of=/mnt/external_sd/dumps/p1
    dd if=/dev/block/mmcblk0p2 of=/mnt/external_sd/dumps/p2
    dd if=/dev/block/mmcblk0p3 of=/mnt/external_sd/dumps/p3
    dd if=/dev/block/mmcblk0p5 of=/mnt/external_sd/dumps/p5
    dd if=/dev/block/mmcblk0p6 of=/mnt/external_sd/dumps/p6
    dd if=/dev/block/mmcblk0p7 of=/mnt/external_sd/dumps/p7

    3. Backup the first 0x680000 bytes of mmcblk0:
    Code:
    dd if=/dev/block/mmcblk0 bs=512 count=13312 of=/mnt/external_sd/dumps/mmcblk0_start
    4. Store them somewhere outside of your device.

    Install itsmagic:

    1. Copy itsmagic somewhere to /data or /cache, and set chmod 755 to it.

    Flash a custom recovery:

    1. dd the new recovery to mmcblk0p1:
    e.g.
    Code:
    dd if=/mnt/external_sd/cwm.bin of=/dev/block/mmcblk0p1
    2. Call itsmagic
    3. Reboot. Bootloader will do the rest
    4. Boot into recovery and see if it works
    5. Every time you change mmcblk0p1 or mmcblk0p2, itsmagic must be called again.

    Restore stock recovery:

    Same as flashing a custom recovery but flash "p1" of you backup to mmcblk0p1 and call itsmagic.

    Note:

    Some devices seem to have a /system/etc/install-recovery.sh script. This will reflash the stock recovery every time you boot into normal kernel.



    How to get the USB serial number:

    1. Connect Iconia to your PC

    2. Simple method (Window/Linux/Max), thx @daveid

    Call:
    Code:
    adb devices

    It will output something like this:
    Code:
    List of devices attached
    370014740c00594 device

    The number is the UID. Save it somewhere. You will need it if you ever brick your device.


    Alternative methods (complicated):

    2.b Linux
    - call lsusb -v
    - read the value of iSerial for Iconia

    2.c Windows
    - Open Device manager
    - Goto Properties of Android USB Devices->Acer Composite ADB Interface
    - Goto "Details" Tab
    - Select "Parent" from the property selection.
    - Read the value. It looks like this:
    USB\VID_0502&PID_3325\370014740c00594
    - The number after the last "/" is the UID.

    2.d Windows (alternative method)

    Download this tool (download link is nearly at the end of the page):
    http://www.nirsoft.net/utils/usb_devices_view.html

    - Open the tool
    - Sort after VendorID
    - Check all devices with VendorID = 0502 and ProductID = 3325 . There is also a "Serial Number" column.



    Thanks

    Thanks @vache + @rayman for their help.
    Thanks to all testers of this tool.

    What next

    We need a working custom recovery. Sadly I'm quite busy the next few days so I don't have enough time to work on it. But there are enough experienced devs around.

    Video

    Here's the "faked" video again :D

    http://www.youtube.com/watch?v=6IOayJUvvQI
    8
    ... somehow the tools got lost

    Edit: Added source
    3
    Does the cwm.bin file you mention actually exist?

    No :) Someone as to develop it.

    There are some alpha Recoveries:

    vache's recovery:
    http://xdaforums.com/showpost.php?p=14655235&postcount=395

    seraphimserapis' recovery:
    http://xdaforums.com/showpost.php?p=14624515&postcount=326

    But note:
    YOU MUST CALL itsmagic from within update.zip! Otherwise your device will not boot anymore.

    BTW: itsmagic needs libc.so to work :)
    3
    I will put an APP together tomorrow, which should be able to install the recovery + run itsmagic all by a single press in the APP .

    Let me see if i can have it ready for today or tomorrow..
    but im sure it will make it all alot easier for all regular users.
    2
    Just to be clear, this is also the device ID as shown with ADB, so you can just do an ADB devices to get it right?