canmove, Confirmed users, Bureaucrats and Sysops emeriti
960
edits
(updated patch) |
m (added Category:Raspberry Pi using HotCat) |
||
(12 intermediate revisions by 3 users not shown) | |||
Line 14: | Line 14: | ||
== Flash an existing build == | == Flash an existing build == | ||
First [https://www.dropbox.com/s/ | First [https://www.dropbox.com/s/4udfp704u2hmemx/ffos-rpi-04.img.tar.bz2?dl=0 download the build]. Next extract it as follows | ||
tar jxvf ffos-rpi.img.tar.bz2 | tar jxvf ffos-rpi-*.img.tar.bz2 | ||
That will produce a file called <code>ffos-rpi.img</code>. Now insert your SD card into a card reader/writer. Your OS should add your SD card as a device called something like <code>/dev/mmcblk0</code>, <code>/dev/sdc</code>, or <code>/dev/disk2</code>. Let's call that device <code>$disk</code> below. | That will produce a file called <code>ffos-rpi-*.img</code>. Now insert your SD card into a card reader/writer. Your OS should add your SD card as a device called something like <code>/dev/mmcblk0</code>, <code>/dev/sdc</code>, or <code>/dev/disk2</code>. Let's call that device <code>$disk</code> below. | ||
<font size="5" color="red">WARNING WARNING WARNING</font>: the remaining steps with <font size="5">COMPLETELY AND PERMANENTLY ERASE YOUR SD CARD</font>. Be extra-triple-careful that you found the right device for your SD card. | <font size="5" color="red">WARNING WARNING WARNING</font>: the remaining steps with <font size="5">COMPLETELY AND PERMANENTLY ERASE YOUR SD CARD</font>. Be extra-triple-careful that you found the right device for your SD card. | ||
Line 24: | Line 24: | ||
Finally, run | Finally, run | ||
sudo dd bs=4M if=ffos-rpi.img of=$device | sudo dd bs=4M if=ffos-rpi-*.img of=$device | ||
Note: this disk image is pre-partitioned for a 4GB disk. If you have a larger SD card and want to allocate the remaining space for your SDCARD partition, then resize that partition in a tool like <code>gparted</code>. | Note: this disk image is pre-partitioned for a 4GB disk. If you have a larger SD card and want to allocate the remaining space for your SDCARD partition, then resize that partition in a tool like <code>gparted</code>. | ||
== Enable touchscreen output == | |||
b2g on the Raspberry Pi supports a class of extension touchscreens. So far, only the [https://www.adafruit.com/products/1601 PiTFT] has been tested, so that model is strongly recommended. The default prebuilt b2g image, and images you build yourself, include support for touchscreen output by default. However, it's disabled by default. | |||
Once you've attached a touchscreen (by which we mean the PiTFT) to your Raspberry Pi (when it's powered off, of course), you can enable it by running the following command through adb (see below) | |||
adb shell setprop persist.fbtft adafruitts | |||
This restarts b2g and has it output to the PiTFT device. At any time you can revert to HDMI output by running | |||
adb shell setprop persist.fbtft none | |||
This setting persists across reboots, as you would expect. | |||
Note: if you're configured your RPi to output through the touchscreen, and you disconnect the touchscreen (when the RPi is powered off, of course), then after rebooting the RPi may still try to output through the nonexistent screen. This bug is not yet understood and seems to be a kernel issue. But you can still follow the directions above to revert to HDMI output. | |||
Touchscreen input (using the PiTFT) seems not to work by now. | |||
== Building b2g for RPi == | == Building b2g for RPi == | ||
Line 43: | Line 61: | ||
./config.sh rpi | ./config.sh rpi | ||
The config.sh step can take quite a while, because it downloads a large amount of data. Once that finishes, you need to apply a patch to the gecko checkout (for now; the patches are making their way through reviews etc.). [https:// | The config.sh step can take quite a while, because it downloads a large amount of data. Once that finishes, you need to apply a patch to the gecko checkout (for now; the patches are making their way through reviews etc.). [https://www.dropbox.com/s/j5bbuifod7pjusi/ffos-rpi-04.patch?dl=0 Download the patch from here] and then apply to your <code>B2G/gecko</code> subdirectory by running the command | ||
(cd gecko && git apply [the patch you downloaded]) | (cd gecko && git apply [the patch you downloaded]) | ||
Note: if <code>git apply</code> fails, you may need to use <code>patch -p1</code>. Also, the contents of this patch should shrink over time as changes are landed upstream. So after you <code>repo sync</code> your checkout, you may need to return to this page and apply a new version of the patch. Hopefully, soon no extra patches will be needed. | Note: if <code>git apply</code> fails, you may need to use <code>patch -p1</code>. Also, the contents of this patch should shrink over time as changes are landed upstream. So after you <code>repo sync</code> your checkout, you may need to return to this page and apply a new version of the patch. Hopefully, soon no extra patches will be needed. | ||
Next, either copy the files <code>device/rpi/rpi/custom-settings.json</code> and <code>device/rpi/rpi/custom-prefs.js</code> in your <code>gaia/build/config/</code> directory, or --- if you already have custom settings or prefs --- append the contents of those files to your existing custom-* files. | Next, either copy the files <code>device/rpi/rpi/custom-settings.json</code> and <code>device/rpi/rpi/custom-prefs.js</code> in your <code>gaia/build/config/</code> directory, or --- if you already have custom settings or prefs --- append the contents of those files to your existing custom-* files. | ||
Line 145: | 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 == | ||
Line 199: | Line 225: | ||
You can also flash your SD card anew at any time by following the instructions above. But this should usually not be necessary. | You can also flash your SD card anew at any time by following the instructions above. But this should usually not be necessary. | ||
[[Category:Firefox OS]] | |||
[[Category:Raspberry Pi]] |