Okay, so in order for my bootloader to have a partition to read, I'm going to need to create a FAT32 partition on my SD card in addition to the current EXT4 & exFAT partitions. If I do it that way, will they all mount automatically?
Yes, but only with my script. Create Fat32 (p1) and exFAT+ext4 (p2 and p3).
"Dumb" programs that don't support multiple partitions (Windows [!!], bootloader, CM10.1/AOSP roms) will happily look at the FAT32 (p1) as if it is the only one on the drive. (Although, Windows at least recognizes other partitions exist -- and you can toggle some flags using BOOTICE.exe to make them visible.) My script will come along when you run it (or automatically at boot) and mount things as necessary.
I'm wondering how/if TWRP will be able to see all of them, since it can read the external storage as exFAT with no issues, as well as the EXT4 partition. I assume the .mounthere files will only affect the OS while booted, so it can't really affect what the bootloader sees, forcing me to create multiple partitions.
Bingo. Dumb programs (bootloader/CM10.1) = only see partition1, smarter programs (TWRP/my script) = see everything.
("But it's too late!")
What about when mounting to PC via MTP? Will both the FAT32 and exFAT partitions be mounted (in addition to my internal storage)? Currently I get internal storage and SD card. I would expect a third entry there for the FAT32 partition?
In short, no. (Not without some serious hacks to the ROM/stuff I don't know how to do.) Whatever is mounted under "/storage/sdcard1" and "/storage/sdcard0 (more properly, "/data/media") will be visible in MTP. Obviously, you can't mount two things there at once -- only two partitions can be visible.
However, people use a trick where they use "mount -o bind" (Directory Binds,
see that program) to make a "Portal" (ala Valve) to another part of the filesystem
inside a visible one. However, because of a technical bug current utilities will not work. (Why I was so emphatic on my script being able to work around it.) So
yes: it is entirely possible,
no: existing utilities cannot do it for you because of a bug (e.g. DirectoryBind + 4.2) , and
no: I haven't coded for it (yet).
EDIT: Okay, upon re-reading the OP, I think I get it. I need to add a FAT32 partition at the beginning of the card for the bootloader to read. Then, on my exFAT partition, I need to add a .mounthere file that tells the OS to mount my large storage partition at /storage/sdcard1. My FAT32 partition will automatically be mounted at /storage/mmcblk1 (or I can create a folder somewhere and a .mounthere file to have it mounted elsewhere). That part I think I now understand.
Bingo, that is 100% correct.
What I don't know is how/if TWRP will handle the additional partition. I may have to specify the block location of the new partition in the recovery.fstab and compile a custom version myself to get it to mount. Which is fine, if I can get my buildbox running again. But I don't know if TWRP can handle all those partitions by default, and if it can, how/where they would be mounted.
I have absolutely no idea. It depends on how robustly TWRP is coded.
You have to remember I wrote this all in *bash/busybox script*. I am pretty much pushing the limits of what Bash is capable of. I know how to code, but not at the level of "unintelligibility" of the CM10.1 codebase -- if I could compile and knew more about kernel programming, gerrit etiquette, and the "politics" behind code review, I just would have have coded exFAT/ext4/NTFS/btfs support for CM10.1 myself by now.
However, Busybox is near-universal, the binaries are portable, and my script will work on any phone you throw it at.