10-03-2018, 03:17 AM
(This post was last modified: 10-03-2018, 03:21 AM by Im4Tinker. Edited 1 time in total.)
(10-02-2018, 10:16 PM)franckm Wrote: UMS from SD card
eMMC’s U-Boot is broken to booting or not built-in the UMS function (e.g. 3rd party custom image).
If your eMMC is not found while you plug to a PC. then you can recover it by preparing a OS into SD card. Which should contain also the image to write to the eMMC, or just copy the SD card to the eMMC directly. Better similar size to eMMC.
The former option will do to copy the file directly to the eMMC. Supposed that is a zip file
Code:
sudo zcat /path/to/TinkerOS.zip >/dev/mmcblkX ## see explanation below for the partition namingOnce you have the system running, then you need to go to a console like lxterminal and prepare to copy the system back to eMMC. Unless you've logged in by a SSH connection.
Operations
- check the size of SD card against the eMMCCode:
$ sudo fdisk -l - note the highest number of sectors used on the SD card, it must be less than eMMC. Otherwice chose the smallest.
- Found the smaller size e.g. copy the system over the eMMCCode:
Disk /dev/sdc: 14,4 GiB, 15489564672 bytes, 30253056 sectors ## use 30253056 / 2 = 15126528
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dosCode:$ sudo dd if=/dev/mmcblkX of=/dev/mmcblkY bs=1K count=(sizeof_SD/2) conv=notrunc,noerror,sync
Last command explanation :
- X = kernel device number referred to the SD card
- Y = kernel device number referred to the eMMC
- sizeof_SD = size of SD card in sectors or which is the smallest device. This avoid to overflow the eMMC. Once the system is recovered it should take a further partition adjustment.
- There could be some 10 minutes waiting to complete.
There's even a shortcut, but the eMMC won't have any reliable partition table. It'll take to copy the u-boot back to eMMC.
So these are the steps, preferred to use linux OS:
- unpack the OS in a image.
- check where the first partition startsThat should be the limit to stop copying.Code:
$ sudo fdisk -l unpacked.img
- If less than 4 Mb, then recalculate how many blocks to put on the count= statement
- take the first 4 Mbytes from the image Code:
dd if=unpacked.img of=my_u-boot.img bs=512 seek=64 count=8128 - write the unpacked.img to SD card. Mount the SD card and write the my_u-boot.img to the /home/$user directory. (The $user may vary according which OS you want to use)
- boot the SD card with MASKROM enabled
- copy the my_u-boot.img to eMMC.
- similar to the previous method referred to the partition numbering.Code:
$ sudo dd if=my_u-boot.img of=/dev/mmcblkY bs=512 seek=64
Light blue words might be a link. Have you try to click on them?



![[-]](https://tinkerboarding.co.uk/forum/images/collapse.png)