[TOOLS] Create unlock.img, fix boot.img, repack update.bin (for aboot

Search This thread

draxie

Senior Member
Apr 20, 2014
515
635
The attached archive includes 3 tools for those of you with .3.2.3.2 (or earlier) bootloaders.
Since other tools (and earlier version of these very tools) are available and working well,
this is mostly meant as an entry to an imaginary beauty contest. (JOKING!!!)
  1. cuber.py
    • a generic gmpy2-free reimplementation of @vortox's signature.py
    • use this to generate your unlock.img
  2. cuboot.py (uses cuber.py)
    • a Python-only reimplementation of @vortox's cuber
    • includes fixes to the kernel command-line and the device-tree
    • use this to convert a standard Amazon boot.img (>=.4.x.x)
  3. upHDX (uses cuboot.py)
    • bash script to repack Amazon updates for TWRP
    • could be DANGEROUS, use with care
    • tested on Apollo for both 14.4.5.2 and 14.4.5.3
      • my unit is fully 14.4.5.3 now, except for aboot (which is 3.2.3.2)
    • should work on Thor as well
Those with bootloader .3.2.6 and lower can downgrade to .3.1.0
and upgrade the bootloader to the latest vulnerable version .3.2.3.2.
Those with .3.2.7 and higher appear to be out of luck with forged signatures, but I hear there's progress on rooting .4.5.2.


The python scripts have been tested on the following OS / Python combinations:
  • Windows: 2.7.9 and 3.4.3
  • Linux: 2.7.9 and 3.3.4
  • OSX: 2.6.? (cannot quite remember)

In addition to the tools themselves, I also included "educational" examples
(examples.sh for Linux/OSX, examples.bat for Windows).
These make use of the split.py script, which is otherwise unnecessary.
(The Windows example also shows that simply echoing your manfid/serial
combo to cuber.py -the way one does in Linux/OSX- won't work due to
the carriage-return character introduced by the echo command.
You'll need to handcraft a file matching the '0x%02x%08xn' format...)

Another batch file py..bat is meant as an extra aid for Windows users
to avoid trouble with setting paths and such. You should be able to simply
download and install your preferred Python version.
Open a command shell (cmd.exe), navigate to wherever you extracted the
archives, and type 'py PYTHON-SCRIPT ARGS' to run the Python scripts.
(This handholding intentionally does NOT work for the upHDX script.)

Hopefully, someone will find these simple tools useful.


EDIT: To unlock your bootloader (<=.3.2.3.2), you'll need adb and fastboot.
On Linux, most distributions package these separately. Look for android-tools-{adb,fastboot} or some such.
For Windows, you can get these from the official Android SDK (which is a **large** download,
with a lot more tools you won't need, if you don't already use them, but it's safe).
Alternatively, there's a very legit-looking project here an XDA, with a much smaller
download, fast install, and exactly the tools you need. I haven't used either... (-;

The actual unlock procedure is described here and here.


EDIT#2: I added another script 'cublock.py' to make unlock.img generation super easy both on Windows and Linux.
MD5( tools.zip) = c17fc91344bd3b4b040129a79a39741f

EDIT#3: Fixed issues with older versions of certain tools on Debian 7.
MD5( tools.zip) = 4f93ab667fd61db26c83675ce0bd6d9f

EDIT#4: Fixed a bug when 'cuber.py' is used directly from the command line.
MD5(tools.zip) = 67b4a6d65aa2b0aa3500b122c8a25290View attachment 3210856


XDA:DevDB Information
HDXtools, Tool/Utility for the Amazon Kindle Fire HDX 7" & 8.9"

Contributors
draxie

Version Information
Status: Alpha

Created 2015-03-13
Last Updated 2015-03-13
 

Attachments

  • tools.zip
    5.8 KB · Views: 11,363
Last edited:

tuanda82

Senior Member
Oct 16, 2005
188
12
Thank for your works.

Can I use upHDX to remove bootloader, recovery from 4.5.3 and flash via TWRP?

Thanks
 

draxie

Senior Member
Apr 20, 2014
515
635
Thank for your works.

Can I use upHDX to remove bootloader, recovery from 4.5.3 and flash via TWRP?

Thanks

Let's hope so. ;) That's what I did, in any case.

I'm an adventurer; so, I ran './upHDX fw update-kindle-14.4.5.3_user_453011120.bin',
pushed the resulting update-kindle-14.4.5.3_user_453011120-upHDXfw.zip to my HDX 8.9
and installed it with TWRP.

Worked for me, but I cannot provide any guarantees, unfortunately.
It may be wise to omit 'fw', and doublecheck that you're happy with the contents of the
updater-script in the newly generated archive.

AND, -of course- make sure your bootloader version is at most .3.2.3.2!!!
 
Last edited:
  • Like
Reactions: tuanda82

tuanda82

Senior Member
Oct 16, 2005
188
12
Let's hope so. ;) That's what I did, in any case.

I'm an adventurer; so, I ran './upHDX fw update-kindle-14.4.5.3_user_453011120.bin',
pushed the resulting update-kindle-14.4.5.3_user_453011120-upHDXfw.zip to my HDX 8.9
and installed it with TWRP.

Worked for me, but I cannot provide any guarantees, unfortunately.
It may be wise to omit 'fw', and doublecheck that you're happy with the contents of the
updater-script in the newly generated archive.

AND, -of course- make sure your bootloader version is at most .3.2.3.2!!!

Thanks. But your upHDX scripts is for linux user only. I am on Windows . :(
If you have time could you upload your xxxx_14.4.5.3_xxxx.zip? Thanks
 

AmazonLeaker

Senior Member
Nov 20, 2014
72
21
The attached archive includes 3 tools for those of you with .3.2.3.2 (or earlier) bootloaders.
Since other tools (and earlier version of these very tools) are available and working well,
this is mostly meant as an entry to an imaginary beauty contest. (JOKING!!!)
  1. cuber.py
    • a generic gmpy2-free reimplementation of @vortox's signature.py
    • use this to generate your unlock.img
  2. cuboot.py (uses cuber.py)
    • a Python-only reimplementation of @vortox's cuber
    • includes fixes to the kernel command-line and the device-tree
    • use this to convert a standard Amazon boot.img (>=.4.x.x)
  3. upHDX (uses cuboot.py)
    • bash script to repack Amazon updates for TWRP
    • could be DANGEROUS, use with care
    • tested on Apollo for both 14.4.5.2 and 14.4.5.3
      • my unit is fully 14.4.5.3 now, except for aboot (which is 3.2.3.2)
    • should work on Thor as well
Those with bootloader .3.2.6 and lower can downgrade to .3.1.0
and upgrade the bootloader to the latest vulnerable version .3.2.3.2.
Those with .3.2.7 and higher appear to be out of luck with forged signatures, but I hear there's progress on rooting .4.5.2.


The python scripts have been tested on the following OS / Python combinations:
  • Windows: 2.7.9 and 3.4.3
  • Linux: 2.7.9 and 3.3.4
  • OSX: 2.6.? (cannot quite remember)

In addition to the tools themselves, I also included "educational" examples
(examples.sh for Linux/OSX, examples.bat for Windows).
These make use of the split.py script, which is otherwise unnecessary.
(The Windows example also shows that simply echoing your manfid/serial
combo to cuber.py -the way one does in Linux/OSX- won't work due to
the carriage-return character introduced by the echo command.
You'll need to handcraft a file matching the '0x%02x%08x\n' format...)

Another batch file py..bat is meant as an extra aid for Windows users
to avoid trouble with setting paths and such. You should be able to simply
download and install your preferred Python version.
Open a command shell (cmd.exe), navigate to wherever you extracted the
archives, and type 'py PYTHON-SCRIPT ARGS' to run the Python scripts.
(This handholding intentionally does NOT work for the upHDX script.)

Hopefully, someone will find these simple tools useful.


EDIT: To unlock your bootloader (<=.3.2.3.2), you'll need adb and fastboot.
On Linux, most distributions package these separately. Look for android-tools-{adb,fastboot} or some such.
For Windows, you can get these from the official Android SDK (which is a **large** download,
with a lot more tools you won't need, if you don't already use them, but it's safe).
Alternatively, there's a very legit-looking project here an XDA, with a much smaller
download, fast install, and exactly the tools you need. I haven't used either... (-;

The actual unlock procedure is described here and here.


EDIT#2: I added another script 'cublock.py' to make unlock.img generation super easy both on Windows and Linux.
MD5( tools.zip) = c17fc91344bd3b4b040129a79a39741f
Thanks a lot for the good work but id like to let tell you that it will be great if you can explain all the entire work in layman's terms because there would be many people having hundreds of questions and concerns.

Just an advice if you feel worthy... No disrespect intended...
 

Reckerr

Senior Member
Feb 26, 2012
90
12
I would like it in layman terms...

And how to do it on Windows. This seems like confusion for me. I have no idea where to start.
 

yujikaido79

Senior Member
Oct 15, 2007
168
28
Hong Kong
I did it all in windows 8.1 64 bit edition.

With help from this post:
http://forum.xda-developers.com/showpost.php?p=58897784&postcount=67

get Python 2.7 for windows and install it >>https://www.python.org/download/releases/2.7/
btw I installed the 64 bit edition for both

get GMPY2 for Python 2.7 https://code.google.com/p/gmpy/downloads/list

Follow the post for step by step. I encountered some trouble with fast boot driver, I had to remove the driver and install a generic one I selected from windows then I manually installed it. Ran the fast boot command to unlock and I was unlocked. a lot easier than it looks.

I would like it in layman terms...

And how to do it on Windows. This seems like confusion for me. I have no idea where to start.
 
  • Like
Reactions: Reckerr

draxie

Senior Member
Apr 20, 2014
515
635
Works on Windows...

Thanks. But your upHDX scripts is for linux user only. I am on Windows . :(
If you have time could you upload your xxxx_14.4.5.3_xxxx.zip? Thanks

Actually, I tested upHDX in Windows using Cygwin.
I had to select zip and unzip in the Archive group and python in the Python group
in the installer to get all the dependencies in place, and the only issue I faced was a few filename collisions
in the /system/media/audio/ringtones folder (case-sensitivity problem).
Code:
[COLOR="Lime"]>[/COLOR] diff -ru cygwin/ linux/
Only in linux/system/media/audio/ringtones: ANDROMEDA.ogg
Only in linux/system/media/audio/ringtones: CANISMAJOR.ogg
Only in linux/system/media/audio/ringtones: Hydra.ogg
Only in linux/system/media/audio/ringtones: PERSEUS.ogg
Only in linux/system/media/audio/ringtones: URSAMINOR.ogg
These could just be copied from the original update-*.bin after installation.
 
Last edited:
  • Like
Reactions: lekofraggle

draxie

Senior Member
Apr 20, 2014
515
635
I did it all in windows 8.1 64 bit edition.

With help from this post:
http://forum.xda-developers.com/showpost.php?p=58897784&postcount=67

get Python 2.7 for windows and install it >>https://www.python.org/download/releases/2.7/
btw I installed the 64 bit edition for both

get GMPY2 for Python 2.7 https://code.google.com/p/gmpy/downloads/list

Follow the post for step by step. I encountered some trouble with fast boot driver, I had to remove the driver and install a generic one I selected from windows then I manually installed it. Ran the fast boot command to unlock and I was unlocked. a lot easier than it looks.

Of course, if you want to make it more difficult for yourself,
you can use the older version of my tool as well. ;)
The new one is not limited to Python 2.7, but works on both current Python versions;
and does NOT require GMPY2.

Also, if you are looking to unlock your bootloader, the 'cublock.py' script is your friend.
You just pass in the manfid and serial (separately; no need to fuse them).

Whether you choose to install Python standalone or as part of Cygwin is up to you.
The latter also includes 'bash' and lets you convert the Amazon update to a TWRP-friendly ZIP.
 
Last edited:

Bruder Torgen

Member
Jan 26, 2014
11
4
Of course, if you want to make it more difficult for yourself, you can use the older version of ny tool as well. ;)
The new one is not limited to Python 2.7, but works on both current Python versions; and does NOT require GMPY2.

Also, if you are looking to unlock your bootloader, the 'unlock.py' script is your friend.
You just pass in the manfid and serial (separately; no need to fuse them).

Whether you choose to install Python standalone or as part of Cygwin is up to you.
The latter also includes 'bash' and lets you convert the Amazon update to a TWRP-friendly ZIP.

I have Windows 7 and Nexus 2.0.5 with bootloader from http://forum.xda-developers.com/kin...p-flashable-3-2-3-bootloader-upgrade-t3025504 installed Python 2.7 and the adb and fastboot and driver package from post 1

Using

adb shell
cat /sys/block/mmcblk0/device/manfid
cat /sys/block/mmcblk0/device/serial

And unlock.py and then

adb reboot-bootloader

And

Fastboot -i 0x1949 devices
fastboot -i 0x1949 flash unlock <unlock file>
fastboot -i 0x1949 reboot

IT was very easy, I only had some driver problems in fastboot mode :)
 

DB126

Senior Member
Oct 15, 2013
15,298
10,068
I have Windows 7 and Nexus 2.0.5 with bootloader from http://forum.xda-developers.com/kin...p-flashable-3-2-3-bootloader-upgrade-t3025504 installed Python 2.7 and the adb and fastboot and driver package from post 1

Using

adb shell
cat /sys/block/mmcblk0/device/manfid
cat /sys/block/mmcblk0/device/serial

And unlock.py and then

adb reboot-bootloader

And

Fastboot -i 0x1949 devices
fastboot -i 0x1949 flash unlock <unlock file>
fastboot -i 0x1949 reboot

IT was very easy, I only had some driver problems in fastboot mode :)

FYI - followed this process on an identical environment with identical results. Struggled a bit more with Windows drivers; if you're having trouble this might help (posts 8-10).
 

DB126

Senior Member
Oct 15, 2013
15,298
10,068
im running this version 13.3.0.2 and im a newbe with kindle what should I do :)
Welcome to the HDX forums. How to proceed depends on what you want to accomplish. Read through the various threads to see what is available and the effort required. If your goal is to root and/or install custom roms you MUST disconnect from WiFi as Amazon will attempt to upgrade your tablet to the lastest Fire OS. Should that happen your options will be severely limited.

Two words of caution:
1) Kindles are not like other devices. Tough to tame and easy to brick. If you approach modding with a casual attitude you'll probably end up with a non-recoverable brick. READ, READ, READ before doing anything. Ask questions when you are ready.
2) There are no tidy fail-safe tutorials for the HDX. There is work and risk involved. You have to do your homework first. No one is going to hold your hand (sorry for the lecture - just trying to set expectations early).
 
  • Like
Reactions: Duy Mai and jimyv

draxie

Senior Member
Apr 20, 2014
515
635
More info please!

Uphdx don't work on debian 7

Given that it worked for me even in Cygwin on Windows 7, this sounds odd.

Nevertheless, I'd appreciate more info on how it fails (and which flavor of Debian 7
you are using; so, that I have a chance to reproduce your issue).

UPDATE: Nevermind. I fired up a VM with Debian 7.8.0-amd64-standard,
and found out for myself. Apparently, 'df' in 'coreutils 8.13' used here
doesn't support the '--output' option; AND, python 2.7.3 is more strict
about the input types to 'unpack'. I fixed these and the script worked.
I'll post the new version in a second.
 
Last edited:
  • Like
Reactions: jimyv

lekofraggle

Senior Member
Oct 10, 2010
753
213
Google Pixel C
Thank you for posting this awesome tool. I am running 13.4.5.2 with a twrp recovery and the most recent available (without breaking twrp) kernel.

My question is, if worst case scenario happens and I try to use cygwin to upHDX, it does not work, but I think it did, and I install a partially working update, am I bricked? Or, will it just write over my kernel and recovery with no hope of going back. As I type this, I am thinking the answer is, both are possible, but thought I would ask before breaking things.

Sent from my KFTHWI using Tapatalk

[Edit] If you know what you are doing, this script is very helpful. I especially enjoy how it explains everything it does as it does it. So, you can see the files it changes. I used cygwin and it worked perfectly. If you understand the Unix command tools, it is a piece of cake. I do not mean to belittle the risk involved, it is significant, however, if you read what is happening, and know this worked, and can be assured there is no issue with your recovery, you can still roll back if something goes wrong. Do not take this comment as minimal risk, the risk is substantial, and you need to wipe to go back. One of my devices did not take the update well (My fault), and, I had to go back. These devices do not handle wipes well. So, the moral of the story.

-This is an excellent and versatile tool,
-There is significant risk
-If you do your research, follow directions, and meet the requirements, you can get success. Have your cake and eat it too on your terms!!
-With this tool, I have the most recent update, root, and twrp (Amazon apps work too).
Thanks again for the tools.
[/Edit]
 
Last edited:
  • Like
Reactions: draxie

draxie

Senior Member
Apr 20, 2014
515
635
My question is, if worst case scenario happens and I try to use cygwin to upHDX, it does not work, but I think it did, and I install a partially working update, am I bricked? Or, will it just write over my kernel and recovery with no hope of going back. As I type this, I am thinking the answer is, both are possible, but thought I would ask before breaking things.


I saw you managed fine, but just in case anybody else wonders,
the script will bail at the first sign of error and you'll know it.
Of course, this won't guarantee that things cannot go wrong,
but minimizes the chances that they go unnoticed.
NOTE, HOWEVER that:
  1. This has only been tested on 4.5.2 and 4.5.3; and, I would strongly recommend against blindly running it on newer releases (as the pattern matching that's being relied upon for what to throw away --including the anti-rollback fuse stuff-- might easily get broken with relatively minor changes.
  2. A good sanity check is to unzip both the original update and the newly created "sanitized" version, and compare them (e.g. via a recursive diff) to doublecheck if the changes are sensible.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 17
    The attached archive includes 3 tools for those of you with .3.2.3.2 (or earlier) bootloaders.
    Since other tools (and earlier version of these very tools) are available and working well,
    this is mostly meant as an entry to an imaginary beauty contest. (JOKING!!!)
    1. cuber.py
      • a generic gmpy2-free reimplementation of @vortox's signature.py
      • use this to generate your unlock.img
    2. cuboot.py (uses cuber.py)
      • a Python-only reimplementation of @vortox's cuber
      • includes fixes to the kernel command-line and the device-tree
      • use this to convert a standard Amazon boot.img (>=.4.x.x)
    3. upHDX (uses cuboot.py)
      • bash script to repack Amazon updates for TWRP
      • could be DANGEROUS, use with care
      • tested on Apollo for both 14.4.5.2 and 14.4.5.3
        • my unit is fully 14.4.5.3 now, except for aboot (which is 3.2.3.2)
      • should work on Thor as well
    Those with bootloader .3.2.6 and lower can downgrade to .3.1.0
    and upgrade the bootloader to the latest vulnerable version .3.2.3.2.
    Those with .3.2.7 and higher appear to be out of luck with forged signatures, but I hear there's progress on rooting .4.5.2.


    The python scripts have been tested on the following OS / Python combinations:
    • Windows: 2.7.9 and 3.4.3
    • Linux: 2.7.9 and 3.3.4
    • OSX: 2.6.? (cannot quite remember)

    In addition to the tools themselves, I also included "educational" examples
    (examples.sh for Linux/OSX, examples.bat for Windows).
    These make use of the split.py script, which is otherwise unnecessary.
    (The Windows example also shows that simply echoing your manfid/serial
    combo to cuber.py -the way one does in Linux/OSX- won't work due to
    the carriage-return character introduced by the echo command.
    You'll need to handcraft a file matching the '0x%02x%08xn' format...)

    Another batch file py..bat is meant as an extra aid for Windows users
    to avoid trouble with setting paths and such. You should be able to simply
    download and install your preferred Python version.
    Open a command shell (cmd.exe), navigate to wherever you extracted the
    archives, and type 'py PYTHON-SCRIPT ARGS' to run the Python scripts.
    (This handholding intentionally does NOT work for the upHDX script.)

    Hopefully, someone will find these simple tools useful.


    EDIT: To unlock your bootloader (<=.3.2.3.2), you'll need adb and fastboot.
    On Linux, most distributions package these separately. Look for android-tools-{adb,fastboot} or some such.
    For Windows, you can get these from the official Android SDK (which is a **large** download,
    with a lot more tools you won't need, if you don't already use them, but it's safe).
    Alternatively, there's a very legit-looking project here an XDA, with a much smaller
    download, fast install, and exactly the tools you need. I haven't used either... (-;

    The actual unlock procedure is described here and here.


    EDIT#2: I added another script 'cublock.py' to make unlock.img generation super easy both on Windows and Linux.
    MD5( tools.zip) = c17fc91344bd3b4b040129a79a39741f

    EDIT#3: Fixed issues with older versions of certain tools on Debian 7.
    MD5( tools.zip) = 4f93ab667fd61db26c83675ce0bd6d9f

    EDIT#4: Fixed a bug when 'cuber.py' is used directly from the command line.
    MD5(tools.zip) = 67b4a6d65aa2b0aa3500b122c8a25290View attachment 3210856


    XDA:DevDB Information
    HDXtools, Tool/Utility for the Amazon Kindle Fire HDX 7" & 8.9"

    Contributors
    draxie

    Version Information
    Status: Alpha

    Created 2015-03-13
    Last Updated 2015-03-13
    3
    Of course, if you want to make it more difficult for yourself, you can use the older version of ny tool as well. ;)
    The new one is not limited to Python 2.7, but works on both current Python versions; and does NOT require GMPY2.

    Also, if you are looking to unlock your bootloader, the 'unlock.py' script is your friend.
    You just pass in the manfid and serial (separately; no need to fuse them).

    Whether you choose to install Python standalone or as part of Cygwin is up to you.
    The latter also includes 'bash' and lets you convert the Amazon update to a TWRP-friendly ZIP.

    I have Windows 7 and Nexus 2.0.5 with bootloader from http://forum.xda-developers.com/kin...p-flashable-3-2-3-bootloader-upgrade-t3025504 installed Python 2.7 and the adb and fastboot and driver package from post 1

    Using

    adb shell
    cat /sys/block/mmcblk0/device/manfid
    cat /sys/block/mmcblk0/device/serial

    And unlock.py and then

    adb reboot-bootloader

    And

    Fastboot -i 0x1949 devices
    fastboot -i 0x1949 flash unlock <unlock file>
    fastboot -i 0x1949 reboot

    IT was very easy, I only had some driver problems in fastboot mode :)
    2
    Oh my... Don't get hung up on the filename. It's the contents that matter.
    Just flash that 'unlock.img' the same way you'd flash '0xmmsssssss.unlock'.
    Code:
    fastboot -i 0x1949 flash unlock unlock.img

    I couldn't find much information using the unlock.img. I had no way of knowing if it was compatible with my bootloader, file structure or anything. I didn't want to brick the tablet. I considered flashing it, but I wanted to get more information first. Everyone in the unlock any thor bootloader thread was using cuberHDX.py/.unlock, which ultimately is what I used as well. My bootloader is now unlocked and cm14.1 is installed. Thanks for the reply though.

    ---------- Post added at 01:19 PM ---------- Previous post was at 01:10 PM ----------

    Why would you do that?!?

    There's a good reason I got rid of that. Just count the posts on
    that thread where people ask others to generate the unlock code
    for them because of all kinds of issues that had been fixed for years.

    I'd very much appreciate if you removed you re-post at your earliest convenience?
    In his defense your new tools are confusing. There is limited/no current information on how to properly use them for the latest bootloader. The current guide to unlock any thor bootloader point to using cuberHDX, people trying to follow that guide then get redirected to new tools with no information on how to use them or what the results might be. I had no problems following Davey's post with the old tools, I felt more comfortable doing that method then just stumbling my way through the new tools hoping I didn't break something in the process. The overall process to unlock was relatively easy, but it took me hours to find the information to do it, and when I did it pointed to tools that were no longer available.
    2
    Try deleting your driver from device manager, and then connecting the device while it is in fastboot mode. That was what I did and it worked for me win 8.1 64 bit. I was two seconds away from dusting off my linux box, but it just worked.

    Sent from my KFTHWI using Tapatalk
    2
    im running this version 13.3.0.2 and im a newbe with kindle what should I do :)
    Welcome to the HDX forums. How to proceed depends on what you want to accomplish. Read through the various threads to see what is available and the effort required. If your goal is to root and/or install custom roms you MUST disconnect from WiFi as Amazon will attempt to upgrade your tablet to the lastest Fire OS. Should that happen your options will be severely limited.

    Two words of caution:
    1) Kindles are not like other devices. Tough to tame and easy to brick. If you approach modding with a casual attitude you'll probably end up with a non-recoverable brick. READ, READ, READ before doing anything. Ask questions when you are ready.
    2) There are no tidy fail-safe tutorials for the HDX. There is work and risk involved. You have to do your homework first. No one is going to hold your hand (sorry for the lecture - just trying to set expectations early).