1
Cosmo Communicator - Hardware / Re: Partitioning the Cosmo for multi-boot without losing your Android data
« on: July 31, 2020, 11:57:19 pm »I have defined mine as follows, to keep userdata (44) starting at the same original position:Sounds pretty boring actually. I'm pondering something rather more adventurous:
- 38: 126779328 - 126844863 (65536 sectors)
- 41: 126844864 - 126910399 (65536 sectors)
- 42: 126910400 - 126975935 (65536 sectors)
- 43: 126976000 - 244163436 (117187437 sectors / 55.87GB)
- 44: 10158080 - 126779327 (116621248 sectors / 55.6GB)
Code: [Select]
- 44: 1228800 - 34783232
- 36: 235028480 - 241319936
- 42: 241319936 - 241385472
- 41: 241385472 - 241451008
- 38: 241451008 - 241516544
- 35: 241516544 - 243269632
- 37: 243269632 - 244154368
Theory being with a future LineageOS or other OS, system might be shrinkable (or need to expand). As such userdata being the important one, place it first.
Now, in order to make the smaller userdata partition decrypt correctly, you'll need to modify the size inside the metadata partition. Run this on the Cosmo:Code: [Select]dd bs=512 count=32 if=/dev/block/by-name/metadata of=/tmp/meta.bin
Use adb pull /tmp/meta.bin to pull the metadata partition out and open it in a hex editor. The file will begin as follows...Code: [Select]C4 B1 B5 D0 01 00 03 00 30 09 00 00 00 00 00 00
The eight bytes highlighted above, C0 A7 F2 0D 00 00 00 00, are what you need to change - these must match the little-endian encoding of the userdata size. For my size of 116621248, these are: C0 7F F3 06 00 00 00 00. Replace these and save the file. Then, use adb push meta.bin /tmp/ to send it back to the Cosmo, and run this on it:
10 00 00 00 01 00 00 00 C0 A7 F2 0D 00 00 00 00
^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^Code: [Select]dd if=/tmp/meta.bin of=/dev/block/by-name/metadata
You can now exit the shell and reboot your Cosmo. You should receive the bootloader menu and all your Android data should be there.
Noted. This is a very important tidbit.