Good afternoon, dear Nvidia! I tried to create and then restore a backup from u-boot but I failed and don’t know why. Does you EMMC somehow protected from u-boot rewriting?
How we could know from u-boot - rootfs is the first part from 0x22 to 0x1c00022:
Tegra210 (P3450-0000) # mmc part
Partition Map for MMC device 0 -- Partition Type: EFI
Part Start LBA End LBA Name
Attributes
Type GUID
Partition GUID
1 0x00000022 0x01c00021 "APP"
attrs: 0x0000000000000000
type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
guid: 14a5f991-9656-4668-8b02-0657086f6f63
2 0x01c00022 0x01c00821 "DTB"
attrs: 0x0000000000000000
type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
guid: 4730a397-7700-4a53-8f9c-2332c2ec7d09
3 0x01c00822 0x01c03821 "TOS"
attrs: 0x0000000000000000
type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
guid: 09422f1f-09c5-434b-ba7c-ab4efdc80822
4 0x01c03822 0x01c23801 "LNX"
attrs: 0x0000000000000000
type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
guid: 3bc726a2-6f0e-4c35-a0e8-1e65a47e405c
5 0x01c23802 0x01c24001 "DTB-1"
attrs: 0x0000000000000000
type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
guid: 6e8905df-bad5-41ec-ab94-2b3b5f178c03
6 0x01c24002 0x01c27001 "TOS-1"
attrs: 0x0000000000000000
type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
guid: 2799eb78-af34-4c70-a198-690cacb3e76d
7 0x01c27002 0x01c46fe1 "LNX-1"
attrs: 0x0000000000000000
type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
guid: 3ee20a91-f01f-43a4-85df-7705b4cef47f
8 0x01c46fe2 0x01c471e1 "RP4"
attrs: 0x0000000000000000
type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
guid: 5293f83d-277e-4bdb-9a9c-0522cef13967
9 0x01c471e2 0x01d59fde "UDA"
attrs: 0x0000000000000000
type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
guid: 4243bdd5-9ee5-490b-9760-a94a6c617409
I backuped this with such a script:
usb start
usb storage
usb dev 0
setenv emmc_start 0x22
setenv emmc_end 0x1c00022
setenv load_addr 0x100000000
setenv block_size 0x40000000
setenv file_prefix "/backup_part_"
setenv current_sector ${emmc_start}
setenv current_offset 0
setenv part_num 0
setenv error 0
while itest ${current_sector} < ${emmc_end}; do
setexpr sectors_to_write ${block_size} / 0x200
mmc read ${load_addr} ${current_sector} ${sectors_to_write}
if test $? -ne 0; then
echo "Error reading block from eMMC"
setenv error 1
exit
fi
setenv current_file "${file_prefix}${part_num}.bin"
ext4write usb 0:1 ${load_addr} ${current_file} ${block_size} 0
if test $? -ne 0; then
echo "Error writing block to USB"
setenv error 1
exit
fi
setexpr current_sector ${current_sector} + ${sectors_to_write}
setexpr current_offset ${current_offset} + ${block_size}
setexpr part_num ${part_num} + 1
echo "Copied to offset: ${current_offset}"
done
if test ${error} -eq 1; then
echo "Copy process failed."
else
echo "Copy process completed successfully."
fi
I gained this files and then combined it with cat
:
ls ✔ 10s
backup_part_00.bin backup_part_04.bin backup_part_08.bin backup_part_12.bin
backup_part_01.bin backup_part_05.bin backup_part_09.bin backup_part_13.bin
backup_part_02.bin backup_part_06.bin backup_part_10.bin
backup_part_03.bin backup_part_07.bin backup_part_11.bin
cat backup_part_*.bin > backup.bin
Then I try to restore this with such a script but all my EMMC turns to ashes inside:
usb start
usb storage
usb dev 0
setenv usb_start 0
setenv emmc_start 0x22
setenv emmc_end 0x1c00022
setenv block_size 0x40000000
setenv load_addr 0x100000000
setenv current_sector ${emmc_start}
setenv current_offset ${usb_start}
setenv error 0
while itest ${current_sector} < ${emmc_end}; do
ext4load usb 0:1 ${load_addr} backup.bin ${block_size} ${current_offset}
if test $? -ne 0; then
echo "Error loading block from USB"
setenv error 1
exit
fi
setexpr sectors_to_write ${block_size} / 0x200
mmc write ${load_addr} ${current_sector} ${sectors_to_write}
if test $? -ne 0; then
echo "Error writing block to eMMC"
setenv error 1
exit
fi
setexpr current_sector ${current_sector} + ${sectors_to_write}
setexpr current_offset ${current_offset} + ${block_size}
echo "Copied to sector: ${current_sector}"
done
if test ${error} -eq 1; then
echo "Copy process failed."
else
echo "Copy process completed successfully."
fi
What do you think, why is this appears?