|
|
Thread Tools | Search this Thread |
08-11-2015, 05:46 AM | #1 |
homo viator
Posts: 78
Karma: 252594
Join Date: May 2010
Device: Kindle DXi with 3.4.2 firmware, Kobo Glo HD
|
How to update Kindle 2/DX/DXG with YifanLu's firmware from 3.2.1 to 3.4.2
How to update Kindle 2/DX/DXG with YifanLu's firmware from 3.2.1 to 3.4.2
This guide comes with no warranty, you may brick your device. Here I describe how it worked for me, I don't know if this guide can be directly applied to any other device than the one I used - be cautious. Why Would I Do That? The only sound reason I know of is TLS (Transport Layer Security) support in experimental web browser. After 2014 and 2015 revelations of fatal shortcomings of SSL 3.0 (a secure protocol used in HTTPS communication) like POODLE, many sites disabled it's support in web servers resulting in Kindle's experimental web browser being unable to connect to many secured web sites. The protocol to which many web sites migrates is TLS. However, that protocol (set of protocols) was not enabled in Kindle until 3.4.1 firmware. In 3.4.2 this is still enabled. As a bonus you'll get tons of general fixes all around Kindle, though I don't know of many particular bugfixes, or enhancements, I know of two:
Any Shortcomings?
Prerequisites
Optional Prerequisites
Get The Right Upgrade Files Once prerequisites are met, start by downloading Kindle 3 firmwares. There are three flavors for three similar versions of Kindle. Basically, I believe - though I am not entirely sure about that - they are all the same, so, feel free to download firmwares from any flavor, I used "B006" on DXi. Since I expect you to have 3.2.1 firmware, we will follow the official upgrade path: 3.2.1→3.3→3.4→3.4.2 (note: the first step is the same if you start from 3.1 or from 3.2, you just have to use different BIN file and may face different challenges; but if you start from 3.0 or 3.0.1, you have to upgrade to 3.1 first -- for such an upgrade you can alter the upgrade method presented here to your needs but I can't be specific since I started from 3.2.1). Download upgrade files for 3.3, 3.4, and 3.4.2. 3.2.1→3.3 Upgrade This is by far the easier upgrade. Now I'll mostly paraphrase YifanLu's comment in this regard. Use kindle_update_tool to extract Update_kindle_3.3_B006.bin: Code:
$ kindle_update_tool.py e Update_kindle_3.3_B006.bin Signature: FC02 (OTA update) min version: 525120101 max version: 611680021 device code: 06 optional: no md5 of tgz: f90023068f5556befd51c9522dab4c60 Code:
$ tar xvvf Update_kindle_3.3_B006.bin.tgz -rw-r--r-- signdaemon/signdaemon 192 2011-09-09 20:44 update-Update_525120101-611680021.dat -rw-r--r-- signdaemon/signdaemon 2469 2011-09-09 20:44 111111111-k3.ffs -rw-rw-rw- signdaemon/signdaemon 128 2011-09-09 20:45 111111111-k3.ffs.sig -rw-r--r-- signdaemon/signdaemon 24760248 2011-09-09 20:44 Update_525120101-611680021.bin -rw-rw-rw- signdaemon/signdaemon 128 2011-09-09 20:45 Update_525120101-611680021.bin.sig -rw-rw-rw- signdaemon/signdaemon 128 2011-09-09 20:45 update-Update_525120101-611680021.dat.sig Code:
$ kindle_update_tool.py e Update_525120101-611680021.bin Signature: FC02 (OTA update) min version: 525120101 max version: 611680021 device code: 06 optional: no md5 of tgz: c14a5f16c6dfbf8e606fb039daafdf89 Code:
$ tar xvvf Update_525120101-611680021.bin.tgz -rw-r--r-- signdaemon/signdaemon 1008 2011-09-09 20:41 update-06-525120101-611680021.dat -rwxr-xr-x signdaemon/signdaemon 6205 2011-09-09 20:40 525120101-611680021.ffs -rw-r--r-- signdaemon/signdaemon 6031949 2011-09-09 20:41 06/update-06-525120101-611680021.bin drwxrwxr-x Creating directory: 06 -rw-rw-rw- signdaemon/signdaemon 128 2011-09-09 20:41 06/update-06-525120101-611680021.bin.sig -rw-r--r-- signdaemon/signdaemon 5878741 2011-09-09 20:41 06/update-06-529960105-611680021.bin -rw-rw-rw- signdaemon/signdaemon 128 2011-09-09 20:41 06/update-06-529960105-611680021.bin.sig -rw-r--r-- signdaemon/signdaemon 5863321 2011-09-09 20:40 06/update-06-553210206-611680021.bin -rw-rw-rw- signdaemon/signdaemon 128 2011-09-09 20:41 06/update-06-553210206-611680021.bin.sig -rw-r--r-- signdaemon/signdaemon 1926999 2011-09-09 20:40 06/update-06-558700031-611680021.bin -rw-rw-rw- signdaemon/signdaemon 128 2011-09-09 20:41 06/update-06-558700031-611680021.bin.sig -rw-r--r-- signdaemon/signdaemon 1369833 2011-09-09 20:40 06/update-06-572340009-611680021.bin -rw-rw-rw- signdaemon/signdaemon 128 2011-09-09 20:41 06/update-06-572340009-611680021.bin.sig -rw-r--r-- signdaemon/signdaemon 1519255 2011-09-09 20:41 06/update-06-576290015-611680021.bin -rw-rw-rw- signdaemon/signdaemon 128 2011-09-09 20:41 06/update-06-576290015-611680021.bin.sig -rw-rw-rw- signdaemon/signdaemon 128 2011-09-09 20:41 525120101-611680021.ffs.sig -rw-r--r-- signdaemon/signdaemon 2153983 2011-09-09 08:48 kernels/611680021-kernel.tar.gz drwxrwxr-x Creating directory: kernels -rw-rw-rw- signdaemon/signdaemon 128 2011-09-09 20:41 kernels/611680021-kernel.tar.gz.sig -rw-r--r-- signdaemon/signdaemon 3880 2011-09-09 20:40 support.tar.gz -rw-rw-rw- signdaemon/signdaemon 128 2011-09-09 20:41 support.tar.gz.sig -rw-rw-rw- signdaemon/signdaemon 128 2011-09-09 20:41 update-06-525120101-611680021.dat.sig Now you’ll have a bunch of files. Go into the "06" folder and find "update-06-576290015-611680021.bin" (if you don't upgrade from 3.2.1, find the right BIN file numbers here). Open that in a hex editor of your choice and go to offset 0xC. Change the byte to 0x02 for K2, 0x03 for K2i, 0x04 for DX, 0x05 for DXi, and 0x09 for DXG. Save it. Code:
$ hexedit 06/update-06-576290015-611680021.bin After restart your Kindle should be upgraded to "3.3 (611680021)", verify that in Settings. 3.3→3.4 Upgrade In theory you could hexedit Update_kindle_3.4_B006.bin on byte 0xC to contain your specific Kindle code (see paragraph above), and it may work -- feel free to try it -- and you could fast-forward to 3.4→3.4.2 upgrade. However, in my case (1) file /etc/fb.modes was different from what the update file expected and when Kindle tried to apply a patch on it, it failed; (2) my DXi always hanged on patching libwebkit and libwebkitgtk -- two libraries of size about 14-22 MB which, to be patched by bspatch tool, require at least 20 MB of free RAM, which my Kindle did not have.
Verify you did not mess anything in the script: Code:
$ bash -n 611680021-1725970040.sh Code:
$ kindle_update_tool.py m --dxi --sign kindle_3.4_B006-my-log 611680021-1725970040.sh 999999999-reboot.sh rootfs_md5_list.tar.gz update-adds.tar.gz update-kernel.tar.gz update-patches.tar.gz
calculating signature for 611680021-1725970040.sh
cmd = openssl dgst -sha256 -sign /tmp/tmplDABFe -out /tmp/tmp9hCOlU 611680021-1725970040.sh
calculating signature for 999999999-reboot.sh
cmd = openssl dgst -sha256 -sign /tmp/tmplDABFe -out /tmp/tmpfJzg2A 999999999-reboot.sh
calculating signature for rootfs_md5_list.tar.gz
cmd = openssl dgst -sha256 -sign /tmp/tmplDABFe -out /tmp/tmpZ_tyBa rootfs_md5_list.tar.gz
calculating signature for update-adds.tar.gz
cmd = openssl dgst -sha256 -sign /tmp/tmplDABFe -out /tmp/tmpGXsunh update-adds.tar.gz
calculating signature for update-kernel.tar.gz
cmd = openssl dgst -sha256 -sign /tmp/tmplDABFe -out /tmp/tmpj7ERcV update-kernel.tar.gz
calculating signature for update-patches.tar.gz
cmd = openssl dgst -sha256 -sign /tmp/tmplDABFe -out /tmp/tmpWtd2nD update-patches.tar.gz
adding 611680021-1725970040.sh
adding 999999999-reboot.sh
adding rootfs_md5_list.tar.gz
adding update-adds.tar.gz
adding update-kernel.tar.gz
adding update-patches.tar.gz
calculating signature for bundle file
cmd = openssl dgst -sha256 -sign /tmp/tmplDABFe -out /tmp/tmp_VkSLM /tmp/tmp4HgOUe
making bin file
output written to update_kindle_3.4_B006-my-log.bin
Upload "update_kindle_3.4_B006-my-log.bin" to Kindle and run the upgrade. It will fail, probably. You'll see a couple of restarts (or resets to factory defaults?!) but at least in my case Kindle always survived. Now, in Kindle USB root you'll find two logs my-upgrade.out and my-upgrade.err. Inspect them to see what was the problem which prevented the upgrade. Now, you're bit on your own... File /etc/fb.modes is different on DX - not sure about Kindle 2 - to what was was expected because it contains display resolutions which are present on DX but not on Kindle 3 (DX has 824×1200, K 2 and 3 just 600x800) and a patched result did not match the expected MD5 hash (see appropriate parts of 611680021-1725970040.sh for the verification process): Code:
... local4.info ota_install I def:patch:patchinfo="/etc/fb.modes":patching file ota_install: I def:patch:patchinfo="/etc/fb.modes":patching file local4.crit ota_install C def:patch:patchinfo="/etc/fb.modes":checksum failure ota_install: C def:patch:patchinfo="/etc/fb.modes":checksum failure local4.info ota_install I def:patch:current_md5=f0845d7fe22da159acbf1fef65302abd,expected_md5=645ec280a0ac85ac6c4672d614d7388d,patch_md5=e8f0742b63cfa44f2cc77582557ae9d6:checksum verify To see other files which potentially might fail in MD5 hash check use Busybox attached to this article: Code:
# busybox md5sum -c rootfs_md5_list | grep -v OK /opt/amazon/ebook/lib/KindleDeviceServicesShasta-1.0.jar: FAILED /opt/amazon/ebook/lib/json_simple-1.1.jar: FAILED md5sum: can't open '/opt/config/not_shipped': No such file or directory /opt/config/not_shipped: FAILED md5sum: can't read '/etc/kdb.src/luigi/': Is a directory /etc/kdb.src/luigi/: FAILED /etc/shadow: FAILED md5sum: can't open '/etc/udev/rules.d/XX-luigi.rules': No such file or directory /etc/udev/rules.d/XX-luigi.rules: FAILED /etc/init.d/video: FAILED md5sum: can't open '/usr/sbin/usbnetwork': No such file or directory /usr/sbin/usbnetwork: FAILED md5sum: WARNING: 8 of 2403 computed checksums did NOT match I had to copy out system /etc/fb.modes file, patch it with appropriate file from "update-adds.tar.gz", edit the result a bit to fit my Kindle's display resolution, create a proper patch (see man bsdiff), replace the old patch from "update-adds.tar.gz" by the new one, and finally change the expected MD5 in "611680021-1725970040.sh". Also MD5 hash of /etc/fb.modes should be changed in "rootfs_md5_list" file from "rootfs_md5_list.tar.gz". There are other ways to fix this problem (e.g. local patching and transfer of the file, see how libwebkit{,gtk} was handled, but I did not know it was possible back then). Once fixed, upgrade process hanged later on patching libwebkit. The line where the upgrade process stopped before being killed by Kindle was, according to the logs: Code:
bspatch /usr/lib/libwebkit-1.0.so.2.5.0 patch/usr/lib/libwebkit-1.0.so.2.5.0 147.libwebkit-1.0.so.2.5.0.patch (1) Local patching I copied out /usr/lib/libwebkit-1.0.so.2.5.0 from Kindle (use USBnet or copy it by a suitable command at suitable place in the script) to my computer, patched it by bspatch, verified that MD5 hash of the patched file is the one expected in "611680021-1725970040.sh", put it to Kindle's USB root and added this line instead of the broken bspatch line: Code:
cp /mnt/us/libwebkit-1.0.so.2.5.0.NEW patch/usr/lib/libwebkit-1.0.so.2.5.0 I did not tried this approach in upgrade scenario. [UPDATE: Although it looks like a more sane way to fix the problem of not enough free memory for bspatch-ing on Kindle, I added swap file to my general Kindle environment as a permanent way how to enlarge virtual memory but I got frequent filesystem corruptions!] Let's extend virtual memory by 64 MB! Download and unpack NiLuJe's stripped Busybox (also in files attached to this article), which does only operations related to swapping, to /mnt/us/ (that is the topmost directory on Kindle when attached as USB storage). Add following three lines right after those two exec lines in 611680021-1725970040.sh: Code:
dd if=/dev/zero of=/mnt/base-us/swapfile bs=1M count=64 chmod +x /mnt/base-us/busybox /mnt/us/busybox mkswap /mnt/base-us/swapfile /mnt/us/busybox swapon /mnt/base-us/swapfile Repack with kindle_update_tool, upgrade, see if it got fixed. If successful, this upgrade should take some 20 minutes. 3.4→3.4.2 Upgrade In 3.4.1 (sic) upgrade Amazon added TLS and disabled SSL 3.0 support, so another big library got updated: libwebkitgtk (about 22 MB). Do the same you did when upgrading to 3.4 (extract TGZ from downloaded BIN, unpack TGZ, rename FFS to SH). Add the logging shell code snippet to "1725970040-2687240004.sh". Also MD5 hash of /etc/fb.modes should be changed in "rootfs_md5_list" file from "rootfs_md5_list.tar.gz", if you did that change in 3.3→3.4 upgrade before. Repack, upgrade and see what went wrong. Again, upgrade process will probably fail on bspatch-ing of libwebkit and then on libwebkitgtk, do the same fixing you have done in upgrade to 3.4 (i.e. local patching, or add a swap file). If successful, this upgrade should take about 5 minutes and you'll end up with 3.4.2 on your Kindle, verify you are able to see TLS support in "Version" paragraph at howsmyssl.com and some site which runs TLS-only, e.g. instapaper.com. Enjoy! Last edited by newman; 10-27-2015 at 03:20 AM. |
08-11-2015, 08:17 AM | #2 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Very nice write-up.
I asked for it to become its own thread. _ _ _ _ The 'out of memory' problems could be avoided by creating a swap **file** in the user store and then enabling 'swap to file'. (64Mb ... 128Mb should keep bzpatch happy) Note: Many of the posts here about using swap create a file and then turn it into a device using losetup - Which is not required, Linux swap can use the file itself (or a partition or a device or any mixture of the three). - - - - Indexed as: K2: https://wiki.mobileread.com/wiki/K2_I...s_and_Firmware DX(G): https://wiki.mobileread.com/wiki/DX%2...s_and_Firmware Last edited by knc1; 08-11-2015 at 09:48 AM. |
Advert | |
|
08-11-2015, 08:23 AM | #3 |
Bah, humbug!
Posts: 39,073
Karma: 157049943
Join Date: Jun 2009
Location: Chesapeake, VA, USA
Device: Kindle Oasis, iPad Pro, & a Samsung Galaxy S9.
|
|
08-11-2015, 10:09 AM | #4 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
+1 karma for the excellent writeup.
P.S. I took the liberty of adding [CODE][/CODE] tags for enhanced readability/copying of commands, including monospaced text. Hope you don't mind. Last edited by eschwartz; 08-11-2015 at 10:30 AM. |
08-11-2015, 11:09 AM | #5 | ||
homo viator
Posts: 78
Karma: 252594
Join Date: May 2010
Device: Kindle DXi with 3.4.2 firmware, Kobo Glo HD
|
Just wanted to say thanks to those who answered my question in the original thread, you helped me a lot!
Quote:
Quote:
If anyone knows how to create, append and enable a swapfile in Kindle's Linux, feel free to add it to my comment #1 as an option. I don't have the time to properly investigate it in weeks to come, although I may add it later myself. |
||
Advert | |
|
08-11-2015, 11:57 AM | #6 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
What is wrong with a simple:
Code:
dd if=/dev/zero of=/mnt/us/swapfile bs=1M count=128 mkswap /mnt/us/swapfile swapon /mnt/us/swapfile Last edited by eschwartz; 08-11-2015 at 12:03 PM. |
08-11-2015, 12:00 PM | #7 | |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
Code:
dd if=/dev/zero of=/mnt/us/swapfile bs=1M count=64 mkswap /mnt/us/swapfile swapon /mnt/us/swapfile - - - - Tested on desktop as working. Code:
core2quad ~ $ sudo dd if=/dev/zero of=/var1/swapfile bs=1M count=64 64+0 records in 64+0 records out 67108864 bytes (67 MB) copied, 0.846735 s, 79.3 MB/s core2quad ~ $ sudo mkswap /var1/swapfile Setting up swapspace version 1, size = 65532 KiB no label, UUID=9901ff0c-49e8-4b75-9eb1-858ab97eb198 core2quad ~ $ sudo swapon /var1/swapfile core2quad ~ $ swapon -s Filename Type Size Used Priority /dev/sda2 partition 1048572 0 1 /dev/sdb2 partition 1048572 0 1 /var1/swapfile file 65532 0 -1 Last edited by knc1; 08-11-2015 at 12:14 PM. |
|
08-11-2015, 12:10 PM | #8 | |
hub
Posts: 715
Karma: 2151032
Join Date: Jan 2012
Location: Iranian in Canada
Device: K3G, DXG, Kobo mini
|
Quote:
In this thread, people say DXG still has 128MB. Last edited by thatworkshop; 08-11-2015 at 12:26 PM. |
|
08-11-2015, 12:32 PM | #9 | |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
http://www.rapidrepair.com/Merchant2...n=cp-kindle-dx Datasheet on the Samsung K4X1G323PC -> http://datasheet.octopart.com/K4X1G3...t-17925055.pdf Organized as 32Mx32 == 128Mbyte |
|
08-11-2015, 12:44 PM | #10 | |
hub
Posts: 715
Karma: 2151032
Join Date: Jan 2012
Location: Iranian in Canada
Device: K3G, DXG, Kobo mini
|
Update: I found it myself, so for future reference: http://www.techrepublic.com/pictures...e-teardown/31/
Quote:
So @newman Spoiler:
... this still needs more confirmation.
Last edited by thatworkshop; 08-11-2015 at 11:24 PM. |
|
08-11-2015, 01:14 PM | #11 | |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
Aside -- doing it on a desktop -- has ext4 filesystem -- probably should use fallocate on general principle... But pointless on the Kindle's fat32 userstore. Also the Kindle doesn't have fallocate. |
|
08-12-2015, 03:39 AM | #12 |
BLAM!
Posts: 13,477
Karma: 26012492
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
FWIW, and if someone cared enough, you probably could replace every usage of the old Python packager, and that in multiple stages of the thing, with KindleTool. (Even the hackish on-device factory update generation).
|
08-12-2015, 04:45 AM | #13 | |
homo viator
Posts: 78
Karma: 252594
Join Date: May 2010
Device: Kindle DXi with 3.4.2 firmware, Kobo Glo HD
|
Quote:
|
|
08-12-2015, 08:56 AM | #14 | |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
1.1) Besides, these commands will be run on the 3 series firmware, and I am pretty sure my 3.x firmwares have them present. 1.2) I am not sure about the 2.5.8 firmware - I haven't jailbroken any of my K2 or DX(anything) Kindles. 2) Are you sure they are not there? Try all possible places - they used to be there. 3) Wait three weeks (until the 2015.08 release happens) then download Buildroot(.org), twiddle Kmenu buttons, build your own support to live in /mnt/usr/* (check our external system layout plan - just because I documented it doesn't mean I can remember it.) Keep in mind that you may have to do a bit of fudging/editing of BR to get it to use the very old kernel headers and library versions used by the 3.x series firmware. IIRC, you need to be building for the i.MX31 SoC. Hmm... Building for something that old - It might be better to just skip BR and use NiLuJe's toolchain to build Busybox directly (as it where, without the "help" of a build system other than its own). |
|
08-12-2015, 09:52 AM | #15 | |
homo viator
Posts: 78
Karma: 252594
Join Date: May 2010
Device: Kindle DXi with 3.4.2 firmware, Kobo Glo HD
|
Quote:
Code:
/proc/swaps /proc/sys/vm/swappiness -- I'll check Buildroot for sure. |
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Kindle DXG - firmware 3.3 resolution? | SoNic67 | Kindle Developer's Corner | 9 | 12-23-2015 09:50 AM |
Firmware Update Can't update my Kindle DXG to 2.5.8 | pavlingm | Amazon Kindle | 1 | 02-18-2014 03:25 PM |
Firmware Update Kindle DXg firmware 3.x | aliabbasjp | Amazon Kindle | 3 | 04-09-2012 02:02 PM |
is it possible to update the available RAM on the Kindle-DXG? | max99 | Amazon Kindle | 2 | 09-01-2011 11:59 AM |
Firmware Update DXG Firmware update? | polbit | Amazon Kindle | 5 | 08-26-2010 06:45 PM |