This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
It is assumed you've already setup your build environment and cloned the repositories.
The following steps allow you to build - and run - B2G on your emulator. Do NOT run them as root.
$ cd B2G
$ make sync
Build the configuration for QEMU:
$ make config-qemu
Next, build the gonk backend and then the system itself:
$ make gonk
NOTE: if ./emu.sh - your emulator - doesn't run at first, you'll need to make it executable:
$ chmod +x emu.sh
Lastly, run the emulator:
NOTE: After cloning your repositories or making your build the first time, you can "clean" them - e.g. put them into the state so that the latest pull is the same as a fresh clone.
To do this, from your repo root:
$ make sync; git clean -xfd; git submodule foreach "git clean -xfd"
Alternately, you can try:
$ make mrproper