I can give the parts of the chore I know of -
The eMMC at its base address has a DOS HD format disk label (mbr area not used).
During boot, the address, size and alignment of partitions 1, 2, and 3 are checked.
Note: Partition 1 **DOES NOT** start immediately following the partition table, there is a 16Mbyte gap (at least on the 4Gbyte machines, haven't checked the 2Gbyte machines yet).
The address and alignment of partition 4 is checked, the size is set to match the remainder of the eMMC.
At the start address of partition 4 is another DOS, HD format disk label.
(yes, each partition can have its own partition table, but you will have a hell of a time finding it in the MS documents (it is, or was, in there).
??? I don't recall what things are tested about the sub-partition. ???
Only the first partition table entry is used. (you want to add a partition 2).
The partition table (1), partition 4 is mounted with an 8192 byte offset, placing the mbr area and (sub-) partition table (2) **OUTSIDE** of the fuse layer.
THAT is the reason for the initial /dev/loop/0 layer - losetup can start at an offset.
Although FAT-32 can be re-sized, I don't know if the fuse layer would follow the change in size. (You have to shrink the first (and only) partition to have room for the second.)
If trying this myself, I would first (try) to free all use of t1p4:t2p1 (how you like that abbreviation?) that is 'covered' by the fuse layer.
I am guessing from this point on -
Remove the kernel gadget module -
Shut down the fuse layer -
un-mount /mnt/us and /dev/loop/0 (or /dev/loop0 depending on kernel version) -
un-mount /mnt/base-us if it is still there (???) -
re-size the FAT-32 first partition of the second level partition table -
re-size the first partition of the second level partition table -
The above two re-size operations are so the system doesn't decide some of the system required contents of USB mass storage are missing and re-build everything you just did.
create a second partition in the second level partition table -
re-mount everything you un-mounted -
start everything you had to stop -
re-load the kernel modules you had to un-load -
Hope the fuse layer stays within the new confines of the smaller first partition -
Make use of the new second partition as desired.
The exact details of that procedure is left as a student exercise.
Next Morning Edit:
A whole lot of that would be simplified by doing the work from 'diags' -
Last edited by knc1; 02-16-2016 at 09:30 AM.
|