I've created a new LNX.a7s now - it's bigger than the original as the first ubi partition is compressed, I'm guessing lzo in the factory firmware.
The second partition bloated up to over 20MB but the tools said there were only 33 LEBs in the second ubi partition so I've trimmed it to size.
I've then used the two new files to produce some output which seems to work and has a modified first partition - maybe Xiaomi will allow DirectUSB access soon and release the ELF (it would help every user who bricks their cameras for sure!) and would mean we could actually test this!
https://mega.co.nz/#F!hAV0gSCB!nXChV0Q-l32nDfzPJlFrKg
Seems to work and I've just dropped a new sub folder into the root filesystem.
Brain dumping this in case it is ever useful to anyone (and I'll forget after sleeping!)
To save the contents from simulated NAND I used (after unmounting the filesystem):
cat /dev/ubi0_0 > ubi0_0
cat /dev/ubi0_1 > ubi0_1
To trim the second large file down I used:
dd count=4257792 bs=1 if=ubi0_1 of=ubi0_1_trimmed
The contents of bi.ini were:
Code:
[linux]
mode=ubi
image=ubi0_0
vol_id=0
vol_size=35739648
vol_type=dynamic
vol_name=linux
vol_alignment=1
[pref]
mode=ubi
image=ubi0_1
vol_id=1
vol_size=222566400
vol_type=dynamic
vol_name=pref
vol_alignment=1
vol_flags=autoresize
And then the command to generate the new LNX.a7s was:
sudo /usr/sbin/ubinize -o my.LNX.a7s -p 131072 -m 2048 -s 512 -O 512 ubi.ini