On the phone, the b2g
application (which provides the Firefox OS APIs among other things) is started through the /system/bin/b2g.sh
script. You can customize this script to change the behavior of Firefox OS, and this article explains how.
Set environment variables
If you just want to set an environment variable for a single run of B2G, then you can do the following:
adb shell stop b2g adb shell "export ENV_VAR=value && /system/bin/b2g.sh"
If you want to use the same environment variables all of the time, then you can edit b2g.sh
, as described in the next section.
Editing b2g.sh
For debugging, you may want to set environment variables to get logging information or to otherwise affect how the b2g
program runs. You can do this by editing the b2g.sh
script. There aren't any tools included on the phone to edit the file in place, so you'll need to copy it to your computer first.
- Connect the phone to your computer, open a terminal window, and execute the following command to edit the script:
adb pull /system/bin/b2g.sh
- Edit the script to make the changes you want. For example, suppose you'd like to see some logging output (which requires a debug build), then you might add something like:
export NSPR_LOG_FILE=/data/local/tmp/mylog.txt export NSPR_LOG_MODULES=Layers:5
- Run the following commands to save your updated
b2g.sh
script to the phone and restartb2g
:adb shell stop b2g adb remount adb push b2g.sh /system/bin adb shell chmod 0755 /system/bin/b2g.sh adb shell start b2g
Note: /data/local/tmp
is the only place on the filesystem which is writable by content processes.
See also