MobiCore Daemon in Android
---

Command line
--
The MobiCore Daemon supports 4 command line options. It also displays them with the help option:

# ./mcDriverDaemon -h
usage: ./mcDriverDaemon [-mdsbh]
Start MobiCore Daemon

-h              show this help
-b              fork to background
-m IMAGE        load mobicore from IMAGE to DDR
-s              disable daemon scheduler(default enabled)
-d SIZE         donate SIZE bytes to mobicore(disabled on most platforms)
-r DRIVER       load dyamic driver

-b Forks the daemon to background

# ./mcDriverDaemon -b

Makes the daemon run in background and returns immediate control to the shell. No need to use shell forking with &

-m Loads a mobicore image to DDR

# ./mcDriverDaemon -m /data/app/mobicore.img

Loads the mobicore.img to DDR and starts executing it.

-s Disables NQ IRQ scheduler

# ./mcDriverDaemon -s

-d Sets how much RAM is donated to Mobicore in bytes

# ./mcDriverDaemon -d 1048576

If no -d is specified then the daemon donates 1Mb. The Value 0 disables RAM donation.

-r Loads dynamic driver at startup. The full path of the driver binary must be given, eg. /data/app/driver.drbin

# ./mcDriverDaemon -r /data/app/driver.drbin

Custom registry locations
--
Registry fallback

In case of a Device wipe in Android the /data/app/mcRegistry folder will be deleted with all it's contents. To overcome 
this the daemon supports a fallback location(eg /system/app/mcRegistry): it first tries to load the trustlet 
from /data/app/mcRegistry/[uuid].tlbin and if it fails then it tries to read the trustlet from /system/app/mcRegistry/[uuid].tlb

Both paths are completely configurable for the Daemon using 2 environment variables:MC_REGISTRY_PATH and MC_REGISTRY_FALLBACK_PATH

For example if you want to use /data/app/mcRegistry as the default path and /system/app/mcRegistry as the fallback path:

$ export MC_REGISTRY_PATH=/data/app/mcRegistry
$ export MC_REGISTRY_FALLBACK_PATH=/system/app/mcRegistry
$ /data/app/mcDriverDaemon

Custom authtoken path
--

The authtoken file is created at provisioning and is by default located in /data/app/mcRegistry/00000.authtoken

Because a device wipe could delete this file and make MobiCore unusable a new environment variable has been added to change the 
default behaviour: MC_AUTH_TOKEN_PATH

$ export MC_AUTH_TOKEN_PATH=/efs
$ /data/app/mcDriverDaemon

This would change the location of the authtoken file to /efs