Confirmed users
699
edits
Line 161: | Line 161: | ||
== Preparing a development environment == | == Preparing a development environment == | ||
To hack b2g on the RPi, you'll | To hack b2g on the RPi, you'll need to create an adb connection. adb is the "android debug bridge" over which diagnostic output is received and development commands are sent. Usually an adb connection is made over USB, but the RPi's USB ports can't be configured for slave mode. (On Models B and newer.) | ||
<font size="5" color="red"> | You can connect adb over TCP/IP, though. You have the option of connecting over wifi or ethernet. To connect over wifi, first join the wireless LAN that your host machine is on. | ||
<font size="5" color="red">WARNING WARNING WARNING</font>: FFOS builds for the RPi are intended for DEVELOPERS. They are <font size="5" color="red">WILDLY INSECURE</font>. Don't connect your RPi to a network on which you don't mind it getting <font size="5" color="red">completely pwned</font>. | |||
Next, find your wifi card's IP address through the gaia settings app. Call this address <code>$IP</code>. Finally, on your host machine, run | |||
adb connect $IP:5555 | |||
(5555 is the port that the adb server on your RPi listens on.) | |||
Alternatively, to connect over ethernet, first connect your RPi's ethernet cable to your LAN. The <em>SAME CAVEATS ABOUT SECURITY</em> apply. Next, boot up your RPi and find out its IP address on your LAN. You can do this by either looking at your network router's client table (easy), or running the following command on your RPi's serial console (a little harder; see instructions below on how to set up a serial console) | |||
netcfg | |||
Let's call your RPi's address <code>$IP</code>. Connect adb by running the following command on your host machine | |||
adb connect $IP:5555 | |||
To test your adb connect, run the following command on your host | |||
adb logcat | |||
You should see a long list of diagnostic messages. Pressing Ctrl-c stops the logcat output. | |||
In addition to adb, a serial console is strongly recommended. A serial console is basically required for anyone doing networking or kernel development. You can purchase a serial-to-USB or serial-port connector for your RPi, [https://www.adafruit.com/products/954 for example this one from adafruit]. Some RPi kits also include one of these. The adapter shown above requires you to connect the black lead to pin 6 (ground), the white lead to pin 8 (GPIO14, UART0_TXD), and the green lead to pin 10 (GPIO15, UART0_RXD). You don't need to connect the red lead if your RPi already has a power source. | |||
<font size="5" color="red">'''WARNING'''</font>: be very careful that you connect the leads to the correct pins! At least one developer has burned out a USB-to-serial adapter by connecting the wrong pins. | |||
The b2g kernel is pre-configured to open a serial console for the RPi, so all you need to do is plug the USB cable into your host machine and start up a terminal emulator. The <code>minicom</code> program works well. On ubuntu, install minicom with the command | |||
sudo apt-get install minicom | |||
Then connect to your RPi using the command | |||
minicom -b 115200 -o -D /dev/ttyUSB0 | |||
(Replacing <code>/dev/ttyUSB0</code> with the device assigned to your USB-to-serial adapter, if it's not assigned that name.) You should then see terminal output and get a shell prompt. | |||
Note: you must run minicom in a "smart terminal". minicom doesn't work when run inside an emacs shell, and it errors out with a somewhat cryptic message ("No cursor motion capability (cm)"). | |||
== Rebuilding b2g and updating your RPi == | == Rebuilding b2g and updating your RPi == |