aml-linux-usb-burn
aml-linux-usb-burn copied to clipboard
DTB is not flashed, boot failed if partition layout changes
I changed partition sizes in aml_upgrade_package.img, but after flashing it, bootloader still sees old partition table - system and cache sizes are wrong:
[mmc_startup] mmc refix success
init_part() 297: PART_TYPE_AML
[mmc_init] mmc init success
Amlogic multi-dtb tool
Single dtb detected
start dts,buffer=0000000073e8a240,dt_addr=0000000073e8a240
get_partition_from_dts() 71: ret 0
Amlogic multi-dtb tool
Single dtb detected
parts: 17
00: logo 0000000000800000 1
01: recovery 0000000001800000 1
02: misc 0000000000800000 1
03: dtbo 0000000000800000 1
04: cri_data 0000000000800000 2
05: param 0000000001000000 2
06: boot 0000000001000000 1
set has_boot_slot = 0
07: rsv 0000000001000000 1
08: metadata 0000000001000000 1
09: vbmeta 0000000000200000 1
10: tee 0000000002000000 1
11: vendor 0000000010000000 1
12: odm 0000000008000000 1
**13: system 0000000050000000 1**
14: product 0000000008000000 1
**15: cache 0000000046000000 2**
16: data ffffffffffffffff 4
init_part() 297: PART_TYPE_AML
eMMC/TSD partition table have been checked OK!
crc32_s:0x1577dad == storage crc_pattern:0x1577dad!!!
crc32_s:0xee152b83 == storage crc_pattern:0xee152b83!!!
crc32_s:0x7fd3b243 == storage crc_pattern:0x7fd3b243!!!
mmc env offset: 0x4d400000
In: serial
Out: serial
Err: serial
reboot_mode=watchdog_reboot
[store]To run cmd[emmc dtb_read 0x1000000 0x40000]
_verify_dtb_checksum()-2755: calc b62fcfb7, store b62fcfb7
_verify_dtb_checksum()-2755: calc b62fcfb7, store b62fcfb7
dtb_read()-2972: total valid 2
update_old_dtb()-2953: do nothing
Amlogic multi-dtb tool
Single dtb detected
In the result box can't boot and resets to USB Burning mode:
...
active slot = 0
CONFIG_AVB2:
active_slot: normal avb2: 0
Err imgread(L328):Fmt unsupported!genFmt 0x0 != 0x3
InUsbBurn
[MSG]sof
Set Addr 25
Get DT cfg
Get DT cfg
set CFG
Flashing the same image with official USB Burning Tool has no problem.
You have to change partition size inside device tree(s), not just size of actual partition. Search github for dtbSplit or dtbTool scripts, someone reverse-engineered aml-s version of dtbTool to split and combine DTBs from/into dtb.img
@Stane1983 If I understand you right I've already done all the needed:
--- a/arch/arm/boot/dts/amlogic/partition_mbox_normal_P_32.dtsi
+++ b/arch/arm/boot/dts/amlogic/partition_mbox_normal_P_32.dtsi
@@ -102,7 +102,7 @@
system:system
{
pname = "system";
- size = <0x0 0x50000000>;
+ size = <0x0 0x46000000>;
mask = <1>;
};
product:product{
@@ -113,7 +113,7 @@
cache:cache
{
pname = "cache";
- size = <0x0 0x46000000>;
+ size = <0x0 0x25000000>;
mask = <2>;
};
data:data
--- a/SWG2001A/BoardConfig.mk
+++ b/SWG2001A/BoardConfig.mk
@@ -83,7 +83,7 @@ BOARD_HAVE_FLASHLIGHT := false
BOARD_HAVE_HW_JPEGENC := true
TARGET_USERIMAGES_USE_EXT4 := true
-BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 4294967296
BOARD_FLASH_BLOCK_SIZE := 4096
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
@@ -112,7 +112,7 @@ BOARD_VENDORIMAGE_PARTITION_SIZE := 268435456
BOARD_ODMIMAGE_PARTITION_SIZE := 134217728
BOARD_PRODUCTIMAGE_PARTITION_SIZE := 134217728
else
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1342177280
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1174405120
BOARD_VENDORIMAGE_PARTITION_SIZE := 268435456
BOARD_ODMIMAGE_PARTITION_SIZE := 134217728
BOARD_PRODUCTIMAGE_PARTITION_SIZE := 134217728
Nevertheless, the tool didn't flash the DTB changes.
Again, the same aml_upgrade_package.img flashed fine with USB Burning Tool, so I assume there is problem with this tool. Sorry if I misunderstand something.
@Stane1983 any thoughts?
DTB seem just doesn't flashed for some reason. If I flash it afterwards (with fastboot) - all is OK
Can it be due to this condition: "$parts" != "dtb"
?
https://github.com/Stane1983/aml-linux-usb-burn/blob/257b808ba8550db023875b139db2eca9d11d55a4/aml-flash#L771
All files here are collected from http://openlinux.amlogic.com:8000/download/A113/Tool/flash-tool-v4.7/flash-tool/ as mentioned in readme. I don't have time anymore to debug this script, you can fork it and continue maintaining it if you wish.
Ok, I'll try to fix it.
Seems this part from http://openlinux.amlogic.com:8000/download/A113/DOC/Amlogic_update_usb_tool_user_guide.pdf is skipped in the script due aforementioned "$parts" != "dtb"
condition:
3.3.1 Commonly way to upgrading dtb
Step 1. Download dtb.img to memory
update mwrite z:\xxx\p200\dtb.img mem 0x1080000 normal
Step 2. Using flash command to updating the dtb.img
update bulkcmd "store dtb write 0x1080000"
3.3.2 Newly way to upgrading dtb
If your uboot code is the latest version, try this combined command to upgrading dtb:
update partition _aml_dtb z:/xxx/dtb.img