Firefox OS/TCP/Patching: Difference between revisions

(→‎Flash the images you build: Changed a link. The previous link redirected twice before showing the correct page.)
 
(13 intermediate revisions by 9 users not shown)
Line 2: Line 2:
<p>The primary Firefox OS build documentation, including pre-requisites, set-up, building, flashing, and FAQs are all available at https://developer.mozilla.org/en-US/Firefox_OS/Building_and_installing_Firefox_OS</p><p>This is meant to be a quick reference guide specific to the Tablet Contribution Program and the first tablet device which is named in the project as "flatfish".</p>  
<p>The primary Firefox OS build documentation, including pre-requisites, set-up, building, flashing, and FAQs are all available at https://developer.mozilla.org/en-US/Firefox_OS/Building_and_installing_Firefox_OS</p><p>This is meant to be a quick reference guide specific to the Tablet Contribution Program and the first tablet device which is named in the project as "flatfish".</p>  


Here's a great [https://speakerdeck.com/eragonj/introduction-to-firefox-osintroductory slide deck on hacking Firefox OS].
Here's a great [https://speakerdeck.com/eragonj/introduction-to-firefox-os introductory slide deck on hacking Firefox OS].


== Preparation ==
== Preparation ==
Line 8: Line 8:
# <p>Firefox OS (B2G) environment, including Android ADB and fastboot</p> <p>https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Firefox_OS_build_prerequisites</p><p><code><span style="color:#006400; background:#D3D3D3">sudo apt-get install libxml2-utils</span></code></p>
# <p>Firefox OS (B2G) environment, including Android ADB and fastboot</p> <p>https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Firefox_OS_build_prerequisites</p><p><code><span style="color:#006400; background:#D3D3D3">sudo apt-get install libxml2-utils</span></code></p>
# <p>Create an account in github</p> <p>https://github.com/</p>
# <p>Create an account in github</p> <p>https://github.com/</p>
=== Gotcha: udev rules for Linux ===
When building on Linux, you may need to manually set up udev rules as noted in the above directions. Beware that the Flatfish appears to report different USB vendor IDs depending on whether it's already booted up or in the fastboot mode! You may need to add both of these udev rules to ''/etc/udev/rules.d/51-android.rules'' in order to do a full system flash:
<pre>
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"
</pre>


== Download B2G and AOSP source codes of flatfish ==
== Download B2G and AOSP source codes of flatfish ==
Line 15: Line 24:
== Start to build flatfish ==
== Start to build flatfish ==
# <p>Connect flatfish device for extract necessary files at first build</p> <p>The first build will pull necessary files into backup-flatfish which is automatic created by extract-files.sh. You DO NOT need to connect flatfish device if backup-flatfish is created.</p>
# <p>Connect flatfish device for extract necessary files at first build</p> <p>The first build will pull necessary files into backup-flatfish which is automatic created by extract-files.sh. You DO NOT need to connect flatfish device if backup-flatfish is created.</p>
# <p>How to build all of B2G</p><p>For flatfish, we need some prefix to support tablet distribution and enable some functions. GAIA_DISTRIBUTION_DIR=distribution_tablet is used for supporting tablet distribution of gaia. B2G_SYSTEM_APPS=1 is for moving webapp from /data to /system, and B2G_UPDATER=1 is enable OTA.</p><p><code><span style="color:#006400; background:#D3D3D3">GAIA_DISTRIBUTION_DIR=distribution_tablet B2G_SYSTEM_APPS=1 B2G_UPDATER=1 ./build.sh</span></code></p><p>Building whole system might take a long time, you can take a rest or try to build gecko/gaia if you just modify gecko/gaia.</p>
# <p>How to build all of B2G</p><p>For flatfish, we need some prefix to support tablet distribution and enable some functions. GAIA_DEVICE_TYPE=tablet is used for supporting tablet distribution of gaia (older versions used GAIA_DISTRIBUTION_DIR=distribution_tablet instead). B2G_SYSTEM_APPS=1 is for moving webapp from /data to /system, and B2G_UPDATER=1 is enable OTA.</p><p><code><span style="color:#006400; background:#D3D3D3">GAIA_DEVICE_TYPE=tablet B2G_SYSTEM_APPS=1 B2G_UPDATER=1 ./build.sh</span></code></p><p>Building whole system might take a long time, you can take a rest or try to build gecko/gaia if you just modify gecko/gaia.</p>
# <p>How to build Gecko or Gaia only</p><p>Gecko only</p><p><code><span style="color:#006400; background:#D3D3D3">B2G_UPDATER=1 ./build.sh gecko</span></code></p><p>Gaia only</p><p><code><span style="color:#006400; background:#D3D3D3">GAIA_DISTRIBUTION_DIR=distribution_tablet B2G_SYSTEM_APPS=1 ./build.sh gaia</span></code></p>
# <p>How to build Gecko or Gaia only</p><p>Gecko only</p><p><code><span style="color:#006400; background:#D3D3D3">B2G_UPDATER=1 ./build.sh gecko</span></code></p><p>Gaia only</p><p><code><span style="color:#006400; background:#D3D3D3">GAIA_DEVICE_TYPE=tablet B2G_SYSTEM_APPS=1 ./build.sh gaia</span></code></p>


== Flash the images you build ==
== Flash the images you build ==
<p>Please make sure adb can connect to your device successfully before flash images. You can do simple test to check adb connection, you will see something like “FLATFISH_123456 device” after typo “adb devices” if adb connection successfully.</p>
<p>Please make sure adb can connect to your device successfully before flash images. You can do a simple test to check adb connection; you will see something like “FLATFISH_123456 device” after typing “adb devices” if adb connection successfully.</p>
# <p>Flash whole images</p><p><code><span style="color:#006400; background:#D3D3D3">./flash.sh</span></code></p>
# <p>Flash whole images</p><p><code><span style="color:#006400; background:#D3D3D3">./flash.sh</span></code></p>
# <p>Flash gecko only</p><p><code><span style="color:#006400; background:#D3D3D3">./flash.sh gecko</span></code></p>
# <p>Flash gecko only</p><p><code><span style="color:#006400; background:#D3D3D3">./flash.sh gecko</span></code></p>
# <p>Flash gaia only</p><p><code><span style="color:#006400; background:#D3D3D3">./flash.sh gaia</span></code></p>
# <p>Flash gaia only</p><p><code><span style="color:#006400; background:#D3D3D3">./flash.sh gaia</span></code></p>
=== Flashing problems ===
If you have problems with the flashing process failing with timeout errors try disabling any USB 3.0 controllers in the BIOS
If your tablet becomes bricked, please follow the steps in [[Firefox OS/TCP/Flashing the Flatfish bootloader#Repairing a bricked device|Repairing a bricked device]] to reflash your device.
If you need the driver for your Windows computer, see this [http://megaswf.com/file/2672515 Jing] for instructions.


== Subsequent code pulls ==
== Subsequent code pulls ==
Line 42: Line 59:


== WIP bug list ==
== WIP bug list ==
<p>Bug 961563 - [TABLET] Support specifying target device type in Gaia build script</p><p>Bug 965145 - [Camera] refactor .sensorAngle patch in bug 947956 for new camera app</p><p>Bug 983013 - Flatfish can't be built on OSX 10.9 (Mavericks)</p>
<p>Bug 965145 - [Camera] refactor .sensorAngle patch in bug 947956 for new camera app</p>


== FAQ ==
== FAQ ==
<p>To be continued</p>
<p>To be continued</p>

Latest revision as of 15:33, 11 March 2015

Developing for the Tablet

The primary Firefox OS build documentation, including pre-requisites, set-up, building, flashing, and FAQs are all available at https://developer.mozilla.org/en-US/Firefox_OS/Building_and_installing_Firefox_OS

This is meant to be a quick reference guide specific to the Tablet Contribution Program and the first tablet device which is named in the project as "flatfish".

Here's a great introductory slide deck on hacking Firefox OS.

Preparation

The following instructions of this document are all verified on Ubuntu 12.04 & 12.10 and also Mac OS.

  1. Firefox OS (B2G) environment, including Android ADB and fastboot

    https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Firefox_OS_build_prerequisites

    sudo apt-get install libxml2-utils

  2. Create an account in github

    https://github.com/

Gotcha: udev rules for Linux

When building on Linux, you may need to manually set up udev rules as noted in the above directions. Beware that the Flatfish appears to report different USB vendor IDs depending on whether it's already booted up or in the fastboot mode! You may need to add both of these udev rules to /etc/udev/rules.d/51-android.rules in order to do a full system flash:

SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"

Download B2G and AOSP source codes of flatfish

  1. git clone b2g scripts and config files

    git clone git://github.com/mozilla-b2g/B2G.git -b master b2g_flatfish

  2. configure flatfish and repo sync aosp and b2g source codes

    cd b2g_flatfish

    ./config.sh flatfish

    You have to wait for a long while to download the source codes depending on the network bandwidth. The files will need approx. 11gb disc space.

Start to build flatfish

  1. Connect flatfish device for extract necessary files at first build

    The first build will pull necessary files into backup-flatfish which is automatic created by extract-files.sh. You DO NOT need to connect flatfish device if backup-flatfish is created.

  2. How to build all of B2G

    For flatfish, we need some prefix to support tablet distribution and enable some functions. GAIA_DEVICE_TYPE=tablet is used for supporting tablet distribution of gaia (older versions used GAIA_DISTRIBUTION_DIR=distribution_tablet instead). B2G_SYSTEM_APPS=1 is for moving webapp from /data to /system, and B2G_UPDATER=1 is enable OTA.

    GAIA_DEVICE_TYPE=tablet B2G_SYSTEM_APPS=1 B2G_UPDATER=1 ./build.sh

    Building whole system might take a long time, you can take a rest or try to build gecko/gaia if you just modify gecko/gaia.

  3. How to build Gecko or Gaia only

    Gecko only

    B2G_UPDATER=1 ./build.sh gecko

    Gaia only

    GAIA_DEVICE_TYPE=tablet B2G_SYSTEM_APPS=1 ./build.sh gaia

Flash the images you build

Please make sure adb can connect to your device successfully before flash images. You can do a simple test to check adb connection; you will see something like “FLATFISH_123456 device” after typing “adb devices” if adb connection successfully.

  1. Flash whole images

    ./flash.sh

  2. Flash gecko only

    ./flash.sh gecko

  3. Flash gaia only

    ./flash.sh gaia

Flashing problems

If you have problems with the flashing process failing with timeout errors try disabling any USB 3.0 controllers in the BIOS

If your tablet becomes bricked, please follow the steps in Repairing a bricked device to reflash your device.

If you need the driver for your Windows computer, see this Jing for instructions.

Subsequent code pulls

To update all the code:

git pull

./repo sync -d

Or to sync only a single make target:

./repo sync gaia

Contributing your code

You can either submit a GitHub pull request or file a bug in Bugzilla with a patch. However, you should almost certainly first discuss it with the B2G or Gaia teams. See the MDN documentation on contributing to Gaia.

WIP bug list

Bug 965145 - [Camera] refactor .sensorAngle patch in bug 947956 for new camera app

FAQ

To be continued