sdcard: Allow building as a static library

* Split main() out in order to allow linking with a multi-call
   executable such as recovery.

Change-Id: I2a5b7b9a11899accdb82ecd43b04d97c0799f384