View Single Post
Old 04-29-2017, 10:50 PM   #19
knc1
Going Viral
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: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
On a PW-3 (5.6.1.1 - typical) you want to save the first 32Mbyte.
Code:
PW3_work $ fdisk -l blk0LeadIn.raw

Disk blk0LeadIn: 33 MB, 33554432 bytes
4 heads, 16 sectors/track, 1024 cylinders, total 65536 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x386d519c

     Device Boot      Start         End      Blocks   Id  System
blk0LeadIn1   *       65536      987135      460800   83  Linux
blk0LeadIn2          987136     1118207       65536   83  Linux
blk0LeadIn3         1118208     1249279       65536   83  Linux
blk0LeadIn4         1249280     7634943     3192832    b  W95 FAT32
There are 65,536 sectors of storage prior to the start of the first partition (0 .. 65,535).
That 32Mbyte contains things like u-boot, main and diag kernels, plus the device specific stuff.

Assuming your USBnetworking (in your Linux VM) is setup the same as given in my ssh tutorials:
Code:
PW3_work $ ssh kpw
#################################################
#  N O T I C E  *  N O T I C E  *  N O T I C E  # 
#################################################
Rootfs is mounted read-only. Invoke mntroot rw to
switch back to a writable rootfs.
#################################################
[root@kindle root]#
Giving you (remote) command line access.
First, you want to know the device names assigned to the flash storage:
Code:
[root@kindle root]# cat /proc/partitions
major minor  #blocks  name

   7        0    3192824 loop0
   7        2        564 loop2
   7        3      73292 loop3
   7        4         36 loop4
   7        5        700 loop5
   7        6      14864 loop6
 179        0    3817472 mmcblk0
 179        1     460800 mmcblk0p1
 179        2      65536 mmcblk0p2
 179        3      65536 mmcblk0p3
 179        4    3192832 mmcblk0p4
 179       16       4096 mmcblk0boot1
 179        8       4096 mmcblk0boot0
Where mmcblk0 is the entire eMMC device. The other, more detailed entries, are the logical partitions (where the file systems live).

Visible USB storage (visible when not running USB networking) is at: /mnt/us
The eMMC device uses an erase block size of 4096 bytes.
So to write the first 32Mbyte to a file at the top of visible USB storage:
Code:
dd if=/dev/mmcblk0 of=/mnt/us/blk0LeadIn.raw bs=4096 count=8192
That binary file contains everything that is not accounted for by the partitioned areas.

= = = =

I will continue to work up a script that breaks out all of the parts of that 32Mbyte file, because you don't want to write the entire thing to a replacement motherboard, just specific parts of it.

= = = =

There is also a utility included with the Kindles: idme
Code:
[root@kindle root]# idme
usage: idme <ARGUMENTS>
    --serial S    Sets the serial number S
    --board B     Sets the board id B
    --pcbsn PCB   Sets the pcb serial number PCB
    --mac M       Sets the MAC address M 
    --mfg ID      Sets the Manufacturer Code
    --bootmode BM Sets the bootmode value
    --postmode PM Sets the postmode value
    -s            Shows all existing values
Just using that to display all of the current settings:
Code:
[root@kindle root]# idme -s
serial: G090G1XXXXXXXXXX
accel: 
mac: 74YYYYYYYYYY
mfg: WSXXXXXXXXXXXXXXXX
pcbsn: 09999999999999999
config: 
bootmode: main
postmode: normal
I used fillers for the actual numbers of my device, but that should be obvious.

Then, on the replacement motherboard, you can use the idme utility to set its values to those of your old board.

(But that 32Mbyte backup file may have some uses, go ahead and make it.)

Last edited by knc1; 04-29-2017 at 11:21 PM.
knc1 is offline   Reply With Quote