I asked this in XDA Forum, but nobody can answer it. I try here too...
I have some problems
I bought a H96 Max X4 Android TV box from Geekbuying. I have factory firmwares for it, so i start to modify the device. It has Android TV 11 version.
The device has root shell on adb, but the device not rooted itself.
The problems are:
I can unpack superimage from stock firmware, and able to do dd backup super from device. But i can not use fastboot flashing because of "FAILED (remote: 0ffff13c)" error.
The number changes depending on which superimage I am trying to write.
This is not real problem, beacuse of i can use dd for flash back the images.
But...
If i try to write back the backuped superimage or what extracted from stock FW, everything is okay. But the unpacked and repacked image causes bootloop.
The lpdump says the device's metadata and the repacked superimage's metadata are the same:
ohm:/ # lpdump
Slot 0:
Metadata version: 10.2
Metadata size: 1104 bytes
Metadata max size: 65536 bytes
Metadata slot count: 3
Header flags: virtual_ab_device
Partition table:
------------------------
Name: system_a
Group: amlogic_dynamic_partitions_a
Attributes: readonly
Extents:
0 .. 1839895 linear super 2048
------------------------
Name: system_b
Group: amlogic_dynamic_partitions_b
Attributes: readonly
Extents:
------------------------
Name: vendor_a
Group: amlogic_dynamic_partitions_a
Attributes: readonly
Extents:
0 .. 357943 linear super 1843200
------------------------
Name: vendor_b
Group: amlogic_dynamic_partitions_b
Attributes: readonly
Extents:
------------------------
Name: product_a
Group: amlogic_dynamic_partitions_a
Attributes: readonly
Extents:
0 .. 854999 linear super 2201600
------------------------
Name: product_b
Group: amlogic_dynamic_partitions_b
Attributes: readonly
Extents:
------------------------
Name: odm_a
Group: amlogic_dynamic_partitions_a
Attributes: readonly
Extents:
0 .. 1559 linear super 3057664
------------------------
Name: odm_b
Group: amlogic_dynamic_partitions_b
Attributes: readonly
Extents:
------------------------
Name: system_ext_a
Group: amlogic_dynamic_partitions_a
Attributes: readonly
Extents:
0 .. 133159 linear super 3059712
------------------------
Name: system_ext_b
Group: amlogic_dynamic_partitions_b
Attributes: readonly
Extents:
------------------------
Super partition layout:
------------------------
super: 2048 .. 1841944: system_a (1839896 sectors)
super: 1843200 .. 2201144: vendor_a (357944 sectors)
super: 2201600 .. 3056600: product_a (855000 sectors)
super: 3057664 .. 3059224: odm_a (1560 sectors)
super: 3059712 .. 3192872: system_ext_a (133160 sectors)
------------------------
Block device table:
------------------------
Partition name: super
First sector: 2048
Size: 2415919104 bytes
Flags: none
------------------------
Group table:
------------------------
Name: default
Maximum size: 0 bytes
Flags: none
------------------------
Name: amlogic_dynamic_partitions_a
Maximum size: 1876951040 bytes
Flags: none
------------------------
Name: amlogic_dynamic_partitions_b
Maximum size: 1876951040 bytes
Flags: none
------------------------
I use this command to repack the superimage:
./lpmake --metadata-size 65536\
--device-size=2415919104\
--metadata-slots=3\
--super-name=super\
--group=amlogic_dynamic_partitions_a:1876951040\
--group=amlogic_dynamic_partitions_b:1876951040\
--partition=system_a:readonly:942026752:amlogic_dyna mic_partitions_a\
--partition=system_b:readonly:0:amlogic_dynamic_part itions_b\
--partition=vendor_a:readonly:183267328:amlogic_dyna mic_partitions_a\
--partition=vendor_b:readonly:0:amlogic_dynamic_part itions_b\
--partition=product_a:readonly:437760000:amlogic_dyn amic_partitions_a\
--partition=product_b:readonly:0:amlogic_dynamic_par titions_b\
--partition=odm_a:readonly:798720:amlogic_dynamic_pa rtitions_a\
--partition=odm_b:readonly:0:amlogic_dynamic_partiti ons_b\
--partition=system_ext_a:readonly:68177920:amlogic_d ynamic_partitions_a\
--partition=system_ext_b:readonly:0:amlogic_dynamic_ partitions_b\
--image=system_a=/super/system_a.img\
--image=system_b=/super/system_b.img\
--image=vendor_a=/super/vendor_a.img\
--image=vendor_b=/super/vendor_b.img\
--image=product_a=/super/product_a.img\
--image=product_b=/super/product_b.img\
--image=odm_a=/super/odm_a.img\
--image=odm_b=/super/odm_b.img\
--image=system_ext_a=/super/system_ext_a.img\
--image=system_ext_b=/super/system_ext_b.img\
--virtual-ab\
--output /super/supernew.img
The unpacked modified superimage and the unpacked stock superimage gives the same files.
For more information here are the imjtool results:
Original, factory superimage:
./imjtool /mnt/rawsuper.img
MMapped: 0x7f9606303000, imgMeta 0x7f9606304000
liblp dynamic partition (super.img) - Blocksize 0x1000, 3 slots
LP MD Header @0x3000, version 10.2, with 10 logical partitions @0x0 on block device of 2304 GB, at partition super, first sector: 0x800
Partitions @0x3100 in 3 groups:
Group 0: default
Group 1: amlogic_dynamic_partitions_a
Name: system_a (read-only, Linux Ext2/3/4/? Filesystem Image, @0x100000 spanning 1 extents of 898 MB)
Name: vendor_a (read-only, Linux Ext2/3/4/? Filesystem Image, @0x38400000 spanning 1 extents of 174 MB)
Name: product_a (read-only, Linux Ext2/3/4/? Filesystem Image, @0x43300000 spanning 1 extents of 417 MB)
Name: odm_a (read-only, Linux Ext2/3/4/? Filesystem Image, @0x5d500000 spanning 1 extents of 780 KB)
Name: system_ext_a (read-only, Linux Ext2/3/4/? Filesystem Image, @0x5d600000 spanning 1 extents of 65 MB)
Group 2: amlogic_dynamic_partitions_b
Name: system_b (read-only, empty)
Name: vendor_b (read-only, empty)
Name: product_b (read-only, empty)
Name: odm_b (read-only, empty)
Name: system_ext_b (read-only, empty)
And the repacked superimage:
./imjtool /mnt/supernew.img
MMapped: 0x7f3a9dc5b000, imgMeta 0x7f3a9dc5c000
liblp dynamic partition (super.img) - Blocksize 0x1000, 3 slots
LP MD Header @0x3000, version 10.2, with 10 logical partitions @0x0 on block device of 2304 GB, at partition super, first sector: 0x800
Partitions @0x3100 in 3 groups:
Group 0: default
Group 1: amlogic_dynamic_partitions_a
Name: system_a (read-only, Linux Ext2/3/4/? Filesystem Image, @0x100000 spanning 1 extents of 898 MB)
Name: vendor_a (read-only, Linux Ext2/3/4/? Filesystem Image, @0x38400000 spanning 1 extents of 174 MB)
Name: product_a (read-only, Linux Ext2/3/4/? Filesystem Image, @0x43300000 spanning 1 extents of 417 MB)
Name: odm_a (read-only, Linux Ext2/3/4/? Filesystem Image, @0x5d500000 spanning 1 extents of 780 KB)
Name: system_ext_a (read-only, Linux Ext2/3/4/? Filesystem Image, @0x5d600000 spanning 1 extents of 65 MB)
Group 2: amlogic_dynamic_partitions_b
Name: system_b (read-only, empty)
Name: vendor_b (read-only, empty)
Name: product_b (read-only, empty)
Name: odm_b (read-only, empty)
Name: system_ext_b (read-only, empty)
Any idea for what is the problem? Waht does MMapped and imgMeta informations means?
Thanks!