Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 08-11-2015, 05:46 AM   #1
newman
homo viator
newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.
 
newman's Avatar
 
Posts: 69
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:
  • fonts are even more contrast
  • Amazon's Kindle Format 8 (KF8/AZW3) works including right-to-left scripts like Arabic, Farsi, ...
  • accented characters (diacritics) in "Notes and Marks" is fixed (see attachment)
  • text style is preserved in "Notes and Marks" (see attachment displaying headline "Hospodářův kalendář..."
  • selection of text which "overflows" from one page to the next won't skip couple of first words on the second page if the selection was too quick

Any Shortcomings?
  • You may brick your Kindle.
  • It takes some time to figure the right approach to upgrade. Every Kindle may be a bit different.
  • With additional code to system tight on RAM you may get more sluggish system.

Prerequisites
  • Strong familiarity with UNIX shell.
  • Kindle 2/DX/DXG (all flavors -- international or US, 3G-only or whatever) with 3.2.1 or higher version of the firmware.
  • Jailbroken Kindle (since you have Kindle with 3.2.1 firmware, your Kindle had to be jailbroken in the past, just make sure the JB is still in place and effective, e.g. by installing USBnet hack).
  • Recent version of kindle_update_tool (I used this one)
  • Patience.

Optional Prerequisites
  • USBnet hack in place and running SSH may be useful should anything went horribly wrong.
  • Remove other hacks not deemed helpful in case of emergency rescue (e.g. ScreenSaver hack, Fonts hack, ...), you may also be tight on space on root partition as well as on operating memory (RAM), every megabyte counts.
  • Backup your data on Kindle, and leave there some 100 MB of free space.
  • Using Kindle's "Reset to factory Defaults" (erases all your documents!) may be of some help too in making sure Kindle is as close to what Amazon expects it to be.

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
Decompress newly created file Update_kindle_3.3_B006.bin.tgz:

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
Find "Update_525120101-611680021.bin" and use the kindle_update_tool to extract it:

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
And decompress the TAR:

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
Copy that file to Kindle's USB root and run it from Kindle's interface. YifanLu adds: "You might get an error and it's OK because some of the modem files may be different, but your Kindle will be updated regardless." I did not get any error, so I can't verify that.

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.
  • Extract "Update_kindle_3.4_B006.bin" with kindle_update_tool.
  • Decompress resulted "Update_kindle_3.4_B006.bin.tgz".
  • Remove all *.sig and *.dat files, we will create our own signatures afterwards.
  • Rename all .ffs files to .sh:
    Code:
    $ rename ffs sh 611680021-1725970040.ffs 999999999-reboot.ffs
  • Open "611680021-1725970040.sh" in text editor of your choice and add following code snippet on new line after #!/bin/sh. They will provide logging useful for debugging:

    Code:
    set -x
    exec > /mnt/us/my-upgrade.out
    exec 2> /mnt/us/my-upgrade.err

Verify you did not mess anything in the script:

Code:
$ bash -n 611680021-1725970040.sh
Create you own signed upgrade BIN, replace "--dxi" with appropriate flag which suits your Kindle type:

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
Look for lines with "FAILED" because if those files are being updated, then you'll have to fix them manually (see below with what happens with /etc/fb.modes).

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
There are two ways to overcome it: (1) local patching (tested and works), or (2) add a swap file (untested).

(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
(2) Add a swap file
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
For more info see http://www.mobileread.com/forums/sho...1&postcount=63.

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!
Attached Thumbnails
Click image for larger version

Name:	screen_shot-46796.gif
Views:	406
Size:	30.3 KB
ID:	140985   Click image for larger version

Name:	screen_shot-46797.gif
Views:	391
Size:	56.0 KB
ID:	140986   Click image for larger version

Name:	screen_shot-46798.gif
Views:	361
Size:	68.7 KB
ID:	140987   Click image for larger version

Name:	screen_shot-27337.gif
Views:	349
Size:	49.3 KB
ID:	141278  
Attached Files
File Type: gz bb-swap-k3.tar.gz (14.5 KB, 131 views)
File Type: bz2 busybox.bz2 (339.7 KB, 128 views)

Last edited by newman; 10-27-2015 at 03:20 AM.
newman is offline   Reply With Quote
Old 08-11-2015, 08:17 AM   #2
knc1
¯\_(ツ)_/¯ <- Clueless
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 11,820
Karma: 12397053
Join Date: Feb 2012
Location: Central Texas
Device: No 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: http://wiki.mobileread.com/wiki/K2_I...s_and_Firmware
DX(G): http://wiki.mobileread.com/wiki/DX%2...s_and_Firmware

Last edited by knc1; 08-11-2015 at 09:48 AM.
knc1 is online now   Reply With Quote
Old 08-11-2015, 08:23 AM   #3
WT Sharpe
Grand Muckity-Muck
WT Sharpe ought to be getting tired of karma fortunes by now.WT Sharpe ought to be getting tired of karma fortunes by now.WT Sharpe ought to be getting tired of karma fortunes by now.WT Sharpe ought to be getting tired of karma fortunes by now.WT Sharpe ought to be getting tired of karma fortunes by now.WT Sharpe ought to be getting tired of karma fortunes by now.WT Sharpe ought to be getting tired of karma fortunes by now.WT Sharpe ought to be getting tired of karma fortunes by now.WT Sharpe ought to be getting tired of karma fortunes by now.WT Sharpe ought to be getting tired of karma fortunes by now.WT Sharpe ought to be getting tired of karma fortunes by now.
 
WT Sharpe's Avatar
 
Posts: 37,373
Karma: 132512849
Join Date: Jun 2009
Location: Chesapeake, VA, USA
Device: Kindle Voyage, iPad Air, Samsung Galaxy J7, & an iPod Nano.
Quote:
Originally Posted by knc1 View Post
Very nice write-up.
I asked for it to become its own thread.
Done.
WT Sharpe is online now   Reply With Quote
Old 08-11-2015, 10:09 AM   #4
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,119
Karma: 82937363
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.
eschwartz is offline   Reply With Quote
Old 08-11-2015, 11:09 AM   #5
newman
homo viator
newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.
 
newman's Avatar
 
Posts: 69
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:
Originally Posted by eschwartz View Post
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.
Thanks! Couldn't find the appropriate tag..

Quote:
Originally Posted by knc1 View Post
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).
That's a great idea. I thought about it too for a second but disregarded it because I did not have USBnet in place at that time and found it potentially dangerous thing to do in an update script.

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.
newman is offline   Reply With Quote
Old 08-11-2015, 11:57 AM   #6
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,119
Karma: 82937363
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
The only issue I can see in an update script is making sure not to overwrite anything important... so choose a unique name.

Last edited by eschwartz; 08-11-2015 at 12:03 PM.
eschwartz is offline   Reply With Quote
Old 08-11-2015, 12:00 PM   #7
knc1
¯\_(ツ)_/¯ <- Clueless
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 11,820
Karma: 12397053
Join Date: Feb 2012
Location: Central Texas
Device: No PW2, KV, KOA
Quote:
Originally Posted by eschwartz View Post
What is wrong with a simple:
Code:
mkswap /mnt/us/swapfile
swapon /mnt/us/swapfile
The only issue I can see in an update script is making sure not to overwrite anything important... so choose a unique name.
You would need to make a file of all zeros first:
Code:
dd if=/dev/zero of=/mnt/us/swapfile bs=1M count=64
mkswap /mnt/us/swapfile
swapon /mnt/us/swapfile
With substitutions for 'count' and name of 'swapfile' as desired.

- - - -
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.
knc1 is online now   Reply With Quote
Old 08-11-2015, 12:10 PM   #8
idoit
hub
idoit ought to be getting tired of karma fortunes by now.idoit ought to be getting tired of karma fortunes by now.idoit ought to be getting tired of karma fortunes by now.idoit ought to be getting tired of karma fortunes by now.idoit ought to be getting tired of karma fortunes by now.idoit ought to be getting tired of karma fortunes by now.idoit ought to be getting tired of karma fortunes by now.idoit ought to be getting tired of karma fortunes by now.idoit ought to be getting tired of karma fortunes by now.idoit ought to be getting tired of karma fortunes by now.idoit ought to be getting tired of karma fortunes by now.
 
idoit's Avatar
 
Posts: 714
Karma: 2151032
Join Date: Jan 2012
Location: Iranian in Canada
Device: K3G, DXG, Kobo mini
Quote:
Originally Posted by newman View Post
[*]With additional code to system tight on RAM (DXG is not the case here, it has twice the memory of K2/DX, i.e. 256 MB) you may get even more sluggish system.
Wait, what?! Kindle DX Graphite (B009) has 256 MB RAM? Can anyone confirm this?
In this thread, people say DXG still has 128MB.

Last edited by idoit; 08-11-2015 at 12:26 PM.
idoit is offline   Reply With Quote
Old 08-11-2015, 12:32 PM   #9
knc1
¯\_(ツ)_/¯ <- Clueless
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 11,820
Karma: 12397053
Join Date: Feb 2012
Location: Central Texas
Device: No PW2, KV, KOA
Quote:
Originally Posted by idoit View Post
Wait, what?! Kindle DX Graphite (B009) has 256 MB RAM? Can anyone confirm this?
Following: wiki dx(g) index, teardowns ->
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
knc1 is online now   Reply With Quote
Old 08-11-2015, 12:44 PM   #10
idoit
hub
idoit ought to be getting tired of karma fortunes by now.idoit ought to be getting tired of karma fortunes by now.idoit ought to be getting tired of karma fortunes by now.idoit ought to be getting tired of karma fortunes by now.idoit ought to be getting tired of karma fortunes by now.idoit ought to be getting tired of karma fortunes by now.idoit ought to be getting tired of karma fortunes by now.idoit ought to be getting tired of karma fortunes by now.idoit ought to be getting tired of karma fortunes by now.idoit ought to be getting tired of karma fortunes by now.idoit ought to be getting tired of karma fortunes by now.
 
idoit's Avatar
 
Posts: 714
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:
Originally Posted by knc1 View Post
Following: wiki dx(g) index, teardowns ->
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
but this is not a teardown of graphite model, so not confirmed yet.

So @newman
Spoiler:
needs to correct that part in first post
... this still needs more confirmation.

Last edited by idoit; 08-11-2015 at 11:24 PM.
idoit is offline   Reply With Quote
Old 08-11-2015, 01:14 PM   #11
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,119
Karma: 82937363
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by knc1 View Post
You would need to make a file of all zeros first:
Code:
dd if=/dev/zero of=/mnt/us/swapfile bs=1M count=64
mkswap /mnt/us/swapfile
swapon /mnt/us/swapfile
With substitutions for 'count' and name of 'swapfile' as desired.

- - - -
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
Yeah, I edited for completeness before seeing your post.

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.
eschwartz is offline   Reply With Quote
Old 08-12-2015, 03:39 AM   #12
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 6,973
Karma: 6553737
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, (PW) & PW2; Kobo H2O
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).
NiLuJe is offline   Reply With Quote
Old 08-12-2015, 04:45 AM   #13
newman
homo viator
newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.
 
newman's Avatar
 
Posts: 69
Karma: 252594
Join Date: May 2010
Device: Kindle DXi with 3.4.2 firmware, Kobo Glo HD
Quote:
Originally Posted by knc1 View Post
You would need to make a file of all zeros first:
Code:
dd if=/dev/zero of=/mnt/us/swapfile bs=1M count=64
mkswap /mnt/us/swapfile
swapon /mnt/us/swapfile
With substitutions for 'count' and name of 'swapfile' as desired.
@knc1, eschwartz: Looking at my Kindle there's no swapon command, so even if you created image by dd on your computer and formatted it to SWAP via mkswap (which is also missing from my setup), you won't have a way to activate it. One may build mkswap and swapon from util-linux or busybox but I am not sure kernel supports swap since it was not originally intended to have it on board.
newman is offline   Reply With Quote
Old 08-12-2015, 08:56 AM   #14
knc1
¯\_(ツ)_/¯ <- Clueless
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 11,820
Karma: 12397053
Join Date: Feb 2012
Location: Central Texas
Device: No PW2, KV, KOA
Quote:
Originally Posted by newman View Post
@knc1, eschwartz: Looking at my Kindle there's no swapon command, so even if you created image by dd on your computer and formatted it to SWAP via mkswap (which is also missing from my setup), you won't have a way to activate it. One may build mkswap and swapon from util-linux or busybox but I am not sure kernel supports swap since it was not originally intended to have it on board.
1) You can't disable "support for swap" in the kernel build, at least not in the most recent kernel versions that I have seen Amazon using (which would be prior to 5.6.5).

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).
knc1 is online now   Reply With Quote
Old 08-12-2015, 09:52 AM   #15
newman
homo viator
newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.newman ought to be getting tired of karma fortunes by now.
 
newman's Avatar
 
Posts: 69
Karma: 252594
Join Date: May 2010
Device: Kindle DXi with 3.4.2 firmware, Kobo Glo HD
Quote:
Originally Posted by knc1 View Post
2) Are you sure they are not there?
Try all possible places - they used to be there.

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).
Just listed all the files there and the only ones bearing "swap" in their names are:

Code:
/proc/swaps
/proc/sys/vm/swappiness
No swapon, swapoff, nor mkswap. It's not present even in NuLuJe's kindle-usbnetwork-0.55.N which has a portion of Busybox.

--

I'll check Buildroot for sure.
newman is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 12:19 PM.


MobileRead.com is a privately owned, operated and funded community.