Quantcast
Channel: MobileRead Forums - Kindle Developer's Corner
Viewing all articles
Browse latest Browse all 4410

Tools Kindle backup

$
0
0
As attached, for the touch screen Kindles only.

It is a script, with a pair of tables to control what gets backed up.
The tables could be changed for the earlier than KT devices if somebody was interested in doing it.

You will need command line access to the Kindle to run this script.
Translation: one of kTerm, telnet, ssh, serial port

Installation?
Un-compress it and put it wherever you want it on the Kindle (it will run from the user storage partition).

Running it:
It writes to user storage (/mnt/us/backups) so it will not work if you have user storage exported over the USB cable.
Just call it by name, it will create the (Kindle:)/backups directory if required.

In the couple of cases where the exact size to copy is not known in advance, it copies an over-sized chunk.
That only happens when copying the two kernels and those can be trimmed down to size after they are copied.
(The 'file' command or the 'mkimage -l' command will tell you how long the actual contents is.)

For the curious, the script:
Spoiler:

Code:

#!/bin/sh

## (c) M.S.Zick, 2017
## License: MIT https://opensource.org/licenses/MIT

userStore='/mnt/us'
images='/backups'
target="$userStore$images"

mkdir -p $target 1>/dev/null 2>&1
if [ $? -ne 0 ] ; then
    printf '\n%s\n' 'Make target directory failed.' 1>&2
    exit 1
fi

## Extract portions of the source
## blkSize skipCnt cpyCnt source destination
while read bs skip count src dst msg; do
    printf '\n%s %s %s\n' $msg
    dd if=$src of=$target$dst bs=$bs skip=$skip count=$count 1>&2
done <<'EoF'
4096    0 8192 /dev/mmcblk0 /leadin.bin    Copying lead-in.
4096 3649 1024 /dev/mmcblk0 /diagkern.bin  Copying diag kernel.
4096  65 1024 /dev/mmcblk0 /mainkern.bin  Copying main kernel.
EoF

## Complete copies of the source
## blkSize source destination
while read bs src dst msg; do
    printf '\n%s %s %s\n' $msg
    dd if=$src of=$target$dst bs=$bs 1>&2
done <<'EoF'
4096 /dev/mmcblk0p1    /mainsys.bin    Copying main partition(2min).
4096 /dev/mmcblk0p2    /diagsys.bin    Copying diag partition.
4096 /dev/mmcblk0p3    /localsys.bin    Copying local partition.
4096 /dev/mmcblk0boot0 /boot0.bin      Copying boot0 partition.
4096 /dev/mmcblk0boot1 /boot1.bin      Copying boot1 partition.
EoF

exit 0



An example execution:
Spoiler:

Code:

mszick:PW3-Serial> ssh root@192.168.15.244
root@192.168.15.244's password:
[root@kindle root]# /mnt/us/unjail/mkbackup.sh

Copying lead-in.
8192+0 records in
8192+0 records out
33554432 bytes (32.0MB) copied, 1.930782 seconds, 16.6MB/s

Copying diag kernel.
1024+0 records in
1024+0 records out
4194304 bytes (4.0MB) copied, 0.256070 seconds, 15.6MB/s

Copying main kernel.
1024+0 records in
1024+0 records out
4194304 bytes (4.0MB) copied, 0.328488 seconds, 12.2MB/s

Copying main partition(2min).
115200+0 records in
115200+0 records out
471859200 bytes (450.0MB) copied, 130.329504 seconds, 3.5MB/s

Copying diag partition.
16384+0 records in
16384+0 records out
67108864 bytes (64.0MB) copied, 15.130873 seconds, 4.2MB/s

Copying local partition.
16384+0 records in
16384+0 records out
67108864 bytes (64.0MB) copied, 19.183786 seconds, 3.3MB/s

Copying boot0 partition.
512+0 records in
512+0 records out
2097152 bytes (2.0MB) copied, 4.437261 seconds, 461.5KB/s

Copying boot1 partition.
512+0 records in
512+0 records out
2097152 bytes (2.0MB) copied, 0.304192 seconds, 6.6MB/s


Attached Files
File Type: gz mkbackup.gz (558 Bytes)

Viewing all articles
Browse latest Browse all 4410

Trending Articles