NOTE: If that doesn't work, or you need more details: Follow the [https://wiki.mozilla.org/Mobile/Fennec/Android/Detailed_build_instructions detailed instructions to set up a build environment] on your machine. Once you have done that, follow the steps to get the source, set up your mozconfig, and build Fennec.
Before doing anything else, it's a good idea to set up Mercurial with reasonable defaults(patch defaults, etc).
./mach mercurial-setup
If you're interested in more details, learn about [https://mozilla-version-control-tools.readthedocs.org/en/latest/hgmozilla/index.html Mercurial at Mozilla].
==== Alternative: Run the setup script directly ====