Is it possible to enable/disable the eMMC at runtime?

I’m working on an application where I need access to a great many GPIO pins, so it’s my plan to disable both the HDMI and eMMC virtual capes to free up those pins. This means, of course, that I’ll need to boot from the micro SD card.

So actually my first question is: While I know that I can boot from the micro SD card by holding down the button on the board while applying power, how do I go about configuring the board so that it will boot from the micro SD card without holding down the button? What happens if I edit uenv.txt on the eMMC to disable the eMCC and then try to boot without holding down the button? That seems like it could be bad.

Next, I’m wondering if it’s possible to enable and disable the eMCC at runtime. What I’d like to do is boot from the micro SD card and most of the time use all of the GPIO pins because the eMCC is disabled, but at startup and shutdown I’d like to enable the eMCC and use it as a persistent storage for a few configuration values that need to survive having the micro SD card replaced for a software upgrade. So at startup I would enable the eMCC long enough to mount it and read a file, then unmount it at disable the eMCC. Then at shutdown I would enable it again and mount it long enough to write new values to that file.

Am I crazy to think about this? Or is there some way I can use capemgr or the like to accomplish it? Worst case scenario maybe I could write a system which would edit uenv.txt and a startup script and then trigger a reboot in order to enable/disable, but that seems potentially slow and fragile…

Thanks,
Danny

On Debian, you only have to hold the boot button down for the first boot. Files get moved around so that the boot button is not required. Then, run the script "/opt/scripts/tools/grow_partition.sh" to make the whole uSD card available.
Chad