FirefoxOS is an attractive platform for Serval Mesh (app for Android) because it targets low-cost mobile devices and is likely to be adopted rapidly by vendors and carriers in developing countries who seek to avoid the compliance and commercial obligations imposed by Google, Apple and other platform suppliers.
A port of the Serval Mesh app to FirefoxOS would pose the following technical challenges:
Serval DNA broadcasts its Mesh Datagram Protocol (MDP) packets over Wi-Fi by encapsulating them in UDP/IP packets. Without packet broadcast, the Serval Mesh cannot work. The socket code would have to be rewritten to use the proposed FirefoxOS UDP Datagram Socket API, which was in early planning stages as at September 2013.
Serval DNA uses Posix process control system calls like fork(2), _exit(2) and signal(2) to create and control a background daemon process. These are probably not available on FirefoxOS. Instead, the FirefoxOS Background Services API (only in proposal stage as at September 2013) would have to be used, necessitating a rewrite of the daemon control logic.
Serval DNA uses Posix file system calls such as open(2) for persistent storage of the keyring file, configuration, logging, and temporary storage of Rhizome payloads. These would have to be rewritten to use the FirefoxOS Device Storage API.
Serval DNA uses local filesystem-bound sockets and named pipes for communication between client and daemon processes. These would have to be rewritten to use abstract local sockets (if supported) or local port numbers (if supported) or some other IPC mechanism not yet proposed (as at September 2013) in FirefoxOS.
Serval DNA uses SQLite for persistent storage of Rhizome bundles. This presents several issues:
Cryptographic operations such as signature verification and Rhizome payload encryption/decryption are performed on Android using the native NaCl library which has been optimised for the ARM processor. This optimisation brings Serval's security features within reach of low-end devices. The Emscripten compiled code has known speed limitations, so how much CPU overhead would that introduce to crypographic operations? Would that make Serval Mesh for FirefoxOS unusable in practical terms due to slowness and battery drain?
The most likely solution would be to re-implement all or most of the test cases using a test framework built specifically for FirefoxOS.