Skip to content

Instantly share code, notes, and snippets.

@jedp
Created September 24, 2012 22:50

Revisions

  1. jedp revised this gist Dec 6, 2012. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    # B2G Quickstart for Payments and Identity

    Before you begin: You want to do this on a Mac. I have been using Linux for months, and unresolved redraw issues (white screen of death) are killing me. Mac works great. Use OSX.

    This sets you up to make two separate targets:
    - One for a desktop [simulator] [1]
    - One for the Unagi [device] [2]
  2. jedp revised this gist Dec 6, 2012. 1 changed file with 10 additions and 2 deletions.
    12 changes: 10 additions & 2 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -202,12 +202,20 @@ crashes.

    If it crashes, try blowing away the build dir and makeing again.

    Great! You've already built Gaia, so you can just run b2g like so:
    Great! You've already built Gaia, so you can just run b2g on Linux like so (obviously substituting your build and gaia dir paths):

    ```
    build/dist/bin/b2g -profile gaia/profile --no-remote
    $BUILD_DIR/dist/bin/b2g -profile $GAIA_DIR/profile --no-remote
    ```

    On Mac, you want to run the generated app thingy:

    ```
    $BUILD_DIR/dist/B2GDebug.app/Contents/MacOS/b2g -profile $GAIA_DIR/profle
    ```

    (Note: You can actually run it either way on OSX, but if you don't do it the latter way, the finder will think it's a terminal window, and the keyboard input will be routed down to the window you launched b2g from.)

    You should see the emulator appear in all its glory.

    Hotkeys:
  3. jedp revised this gist Oct 24, 2012. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -304,6 +304,14 @@ TEST_PATH=browser/modules/test make -C ../build mochitest-browser-chrome

    To test UI components that require mochi tests, either [push to the try server] [9] or apply your patch in your copy of the pine branch and run your tests there.

    ##Questions to Ask Yourself when Hope Seems Lost

    - did you blow away your gaia profile? If not, `rm -rf profile && make`
    - did you `git pull --rebase mozilla master` your gaia tree? try it!
    - did you blow away your gecko build dir? May be necessary after inbound merges.
    - are there any b2g processes running? `ps -eaf | grep b2g` and kill them.
    - have you tried burning incense, pouring libations, and chanting? You should!

    [1]: https://developer.mozilla.org/en-US/docs/Mozilla/Boot_to_Gecko/Choosing_how_to_run_Gaia_or_B2G "Running Gaia"
    [2]: https://intranet.mozilla.org/B2G_Team/Unagi "Building and flashing the target to the phone"
    [3]: https://hg.mozilla.org/users/jparsons_mozilla.com/b2g-payments-identity "Jed's clone of mozilla-inbound"
  4. jedp revised this gist Oct 22, 2012. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -158,7 +158,7 @@ Follow the steps below to build for desktop, and optionally for the device.
    Create a `.mozconfig` file containing:
    ```
    mk_add_options MOZ_OBJDIR=../build
    mk_add_options MOZ_MAKE_FLAGS="-j8 -s"
    mk_add_options MOZ_MAKE_FLAGS="-j8 -s" # set -j to the number of cores you want it to use
    mk_add_options ENABLE_MARIONETTE=1
    ac_add_options --enable-application=b2g
    @@ -241,20 +241,21 @@ VARIANT=user # 'user' strangely means 'production'
    Follow the [B2G Unagi setup instructions] [2]. I can't summarize those steps here, because there are downloads and passwords involved. It's a short document that will take you through:
    - setting up udev (on Linux)
    - downloading the Adreno driver
    - downloading the unagi backup directory
    - installing busybox on the phone

    I honestly can't recall which of those steps I had to follow and which were already simplified somehow. But it was pretty straightforward.

    Now configure, build, and flash:
    ```
    ./config.sh otoro # assuming otoro is the correct target
    ./config.sh unagi # assuming unagi is the correct target
    ./build.sh
    ./flash.sh
    ```

    Running `config.sh` will download a ton of stuff the first time.

    If it crashes (which it will) with a complaint that you don't have `libOmxVidEnc.so` or some such on your device or in your backup folder, you should [download the official otoro backup folder] [11] (123MB!).
    If it crashes (which it will) with a complaint that you don't have `libOmxVidEnc.so` or some such on your device or in your backup folder, you probably haven't downloaded [the backup folder] [11].

    That's that. Time to go play with the phone.

    @@ -313,4 +314,4 @@ To test UI components that require mochi tests, either [push to the try server]
    [8]: https://developer.mozilla.org/en-US/docs/Mozilla/Boot_to_Gecko/Using_the_B2G_desktop_client
    [9]: https://wiki.mozilla.org/Build:TryServerAsBranch
    [10]: https://id.etherpad.mozilla.org/2012-05-31-id-warroom
    [11]: https://intranet.mozilla.org/B2G_Team/Otoro#Optional:_Download_backup-otoro_folder
    [11]: https://intranet.mozilla.org/B2G_Team/Unagi#Optional:_Getting_a_copy_of_backup-unagi
  5. jedp revised this gist Oct 19, 2012. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    This sets you up to make two separate targets:
    - One for a desktop [simulator] [1]
    - One for the ZTE [device] [2]
    - One for the Unagi [device] [2]

    These are the moving parts:
    - [mozilla-inbound repo] [3] clone (hg)
    @@ -238,7 +238,7 @@ VARIANT=user # 'user' strangely means 'production'
    # this option omits the test apps from the phone
    ```

    Follow the [B2G Otoro setup instructions] [2]. I can't summarize those steps here, because there are downloads and passwords involved. It's a short document that will take you through:
    Follow the [B2G Unagi setup instructions] [2]. I can't summarize those steps here, because there are downloads and passwords involved. It's a short document that will take you through:
    - setting up udev (on Linux)
    - downloading the Adreno driver
    - installing busybox on the phone
    @@ -304,7 +304,7 @@ TEST_PATH=browser/modules/test make -C ../build mochitest-browser-chrome
    To test UI components that require mochi tests, either [push to the try server] [9] or apply your patch in your copy of the pine branch and run your tests there.

    [1]: https://developer.mozilla.org/en-US/docs/Mozilla/Boot_to_Gecko/Choosing_how_to_run_Gaia_or_B2G "Running Gaia"
    [2]: https://intranet.mozilla.org/B2G_Team/Otoro "Building and flashing the target to the phone"
    [2]: https://intranet.mozilla.org/B2G_Team/Unagi "Building and flashing the target to the phone"
    [3]: https://hg.mozilla.org/users/jparsons_mozilla.com/b2g-payments-identity "Jed's clone of mozilla-inbound"
    [4]: https://github.com/jedp/gaia "Jed's fork of Gaia"
    [5]: https://github.com/mozilla-b2g/B2G "The B2G project that builds the phone target"
  6. jedp revised this gist Oct 12, 2012. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -270,6 +270,15 @@ adb forward tcp:9999 tcp:9999
    netcat localhost 9999
    ```

    ## Rebooting b2g

    So you just crashed your phone in the REPL?

    ```
    adb shell stop b2g
    adb shell start b2g
    ```

    ## Testing

    We have notes about running xpshell tests in our [native identity warroom notes] [10].
  7. jedp revised this gist Oct 12, 2012. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -258,6 +258,18 @@ If it crashes (which it will) with a complaint that you don't have `libOmxVidEnc

    That's that. Time to go play with the phone.

    ## REPL

    You can has REPL!

    Add to your prefs: `pref("b2g.remote-js.enabled", true);`

    Then:
    ```
    adb forward tcp:9999 tcp:9999
    netcat localhost 9999
    ```

    ## Testing

    We have notes about running xpshell tests in our [native identity warroom notes] [10].
  8. jedp revised this gist Oct 9, 2012. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -254,6 +254,8 @@ Now configure, build, and flash:

    Running `config.sh` will download a ton of stuff the first time.

    If it crashes (which it will) with a complaint that you don't have `libOmxVidEnc.so` or some such on your device or in your backup folder, you should [download the official otoro backup folder] [11] (123MB!).

    That's that. Time to go play with the phone.

    ## Testing
    @@ -290,3 +292,4 @@ To test UI components that require mochi tests, either [push to the try server]
    [8]: https://developer.mozilla.org/en-US/docs/Mozilla/Boot_to_Gecko/Using_the_B2G_desktop_client
    [9]: https://wiki.mozilla.org/Build:TryServerAsBranch
    [10]: https://id.etherpad.mozilla.org/2012-05-31-id-warroom
    [11]: https://intranet.mozilla.org/B2G_Team/Otoro#Optional:_Download_backup-otoro_folder
  9. jedp revised this gist Oct 8, 2012. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -260,6 +260,18 @@ That's that. Time to go play with the phone.

    We have notes about running xpshell tests in our [native identity warroom notes] [10].

    Briefly, to run all xpcshell tests:

    ```
    TEST_PATH=toolkit/identity/test make -C ../build xpcshell-tests
    ```

    To run a single test:

    ```
    SOLO_FILE="test_yourfilename.js" make -C ../build/toolkit/identity/tests check-one
    ```

    Mochitests will not work in the b2g environment. For example:
    ```
    # This will fail
  10. jedp revised this gist Sep 28, 2012. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -185,6 +185,12 @@ ac_add_options --enable-tests
    export CXXFLAGS="-DMOZ_ENABLE_JS_DUMP $EXTRA_INCLUDE"
    ```

    To configure (or reconfigure), say:

    ```
    make -f client.mk configure
    ```

    Now with your `.mozconfig` in place, you can build:

    ```
  11. jedp revised this gist Sep 28, 2012. 1 changed file with 15 additions and 3 deletions.
    18 changes: 15 additions & 3 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -158,11 +158,20 @@ Follow the steps below to build for desktop, and optionally for the device.
    Create a `.mozconfig` file containing:
    ```
    mk_add_options MOZ_OBJDIR=../build
    mk_add_options MOZ_MAKE_FLAGS="-j8 -s" # adjust -j for your number of cores
    mk_add_options MOZ_MAKE_FLAGS="-j8 -s"
    mk_add_options ENABLE_MARIONETTE=1
    ac_add_options --enable-application=b2g
    ac_add_options --disable-libjpeg-turbo
    ac_add_options --enable-debug
    ac_add_options --enable-debug-symbols
    ac_add_options --disable-optimize
    ac_add_options --disable-install-strip
    ac_add_options --with-ccache
    ac_add_options --disable-crashreporter
    ac_add_options --enable-gstreamer
    # This option is required if you want to be able to run Gaia's tests
    ac_add_options --enable-tests
    @@ -171,6 +180,9 @@ ac_add_options --enable-tests
    # you want to forward to. If you get crashes at startup,
    # make sure this line is commented.
    #ac_add_options --enable-b2g-ril
    # enable dump() from js
    export CXXFLAGS="-DMOZ_ENABLE_JS_DUMP $EXTRA_INCLUDE"
    ```

    Now with your `.mozconfig` in place, you can build:
  12. jedp revised this gist Sep 27, 2012. 1 changed file with 53 additions and 0 deletions.
    53 changes: 53 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -24,6 +24,59 @@ b2g/ # git clone of mozilla-b2g/B2G

    ## Prep steps: Setting up Mercurial Queues

    You'll need to create an `~/.hgrc` file if you don't already have one. These are my settings:

    (Note - don't just paste this! Two lines to edit!)

    ```
    [ui]
    merge = kdiff3
    username = Your Name <[email protected]>
    [diff]
    # git diff is required so binary files don't break
    git = 1
    showfunc = True
    unified = 8
    [defaults]
    diff=-p -U 8
    commit= -v
    [paths]
    # makes it easier to push to try
    try = ssh://hg.mozilla.org/try
    [extensions]
    # I don't even remember what these are all for
    graphlog =
    hgext.mq =
    fetch =
    purge =
    hgext.rebase =
    hgext.extdiff =
    hgext.transplant =
    rdiff=/home/jed/lib/python/rdiff.py
    # this lets you import patches straight from bugzilla
    # source: https://hg.mozilla.org/users/robarnold_cmu.edu/qimportbz
    # about: http://robarnold.org/2009/06/02/hg-qimport-my-bugzilla-patch-redux.html
    qimportbz=/path/to/your/qimportbz/
    [extdiff]
    # Creates the command 'hg cdiff' for colorized diff output
    cmd.cdiff = colordiff
    opts.cdiff = -wuprN
    [merge-tools]
    # Specify command line
    kdiff3.args = $base $local $other -o $output
    # Give higher priority
    kdiff3.priority = 1
    [bookmarks]
    track.current = True
    ```

    Follow the steps in the [introduction to Mercurial queues] [6].

    Read the [Mercurial queue workflow] [7] documentation.
  13. jedp revised this gist Sep 27, 2012. 1 changed file with 41 additions and 34 deletions.
    75 changes: 41 additions & 34 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -28,6 +28,32 @@ Follow the steps in the [introduction to Mercurial queues] [6].

    Read the [Mercurial queue workflow] [7] documentation.

    ## Setting up `gaia`

    `cd b2g-src`

    `git clone` (or maybe fork first) https://github.com/mozilla-b2g/gaia

    Update with a `git pull`.

    We need to create a default profile that will toggle the native identity features on.

    Create the file `custom-prefs.js` in the root of the gaia directory. Put these lines in it:

    ```
    pref("dom.identity.enabled", true);
    pref("toolkit.identity.debug", true);
    ```

    Build with:
    ```
    DEBUG=1 make
    ```

    You need network to build, since packages will be downloaded from nightly.

    If you want to update the custom prefs at any time, you will need to re-build the profile (but not the whole project) with `make profile`.

    ## Setting up the `mozilla-inbound` repo

    This is where we will be working on `navigator.id` and friends.
    @@ -55,52 +81,22 @@ default = http://hg.mozilla.org/users/jparsons_mozilla.com/b2g-payments-identity
    default-push = ssh://hg.mozilla.org/users/jparsons_mozilla.com/b2g-payments-identity
    ```

    Now you should be able to pull and build:

    You can regularly pull and update:
    ```
    hg pull
    hg update
    make -f client.mk
    ```

    Whoever is managing the shared user repo (me, in this case), would regularly do:

    ```
    hg pull mozilla-inbound
    hg update
    make -f client.mk
    hg push
    ```

    You have to regularly blow away the `../build` directory. Try that first if `make`
    crashes.
    Don't run `make` yet!

    While that runs, set up Gaia.

    ## Setting up `gaia`

    `cd b2g-src`

    `git clone` (or maybe fork first) https://github.com/mozilla-b2g/gaia

    Update with a `git pull`.

    We need to create a default profile that will toggle the native identity features on.

    Create the file `custom-prefs.js` in the root of the gaia directory. Put these lines in it:

    ```
    pref("dom.identity.enabled", true);
    pref("toolkit.identity.debug", true);
    ```

    Build with:
    ```
    DEBUG=1 make
    ```

    You need network to build, since packages will be downloaded from nightly.

    If you want to update the custom prefs at any time, you will need to re-build the profile (but not the whole project) with `make profile`.
    Follow the steps below to build for desktop, and optionally for the device.

    ## Building for desktop or the device

    @@ -124,6 +120,15 @@ ac_add_options --enable-tests
    #ac_add_options --enable-b2g-ril
    ```

    Now with your `.mozconfig` in place, you can build:

    ```
    make -f client.mk
    ```

    You have to regularly blow away the `../build` directory. Try that first if `make`
    crashes.

    If it crashes, try blowing away the build dir and makeing again.

    Great! You've already built Gaia, so you can just run b2g like so:
    @@ -142,6 +147,8 @@ MDN has more about [using the B2G desktop client] [8].

    ### Building for the device

    Build for the desktop as described in the preceding section.

    We clone the b2g project, but we will not use the `repo sync` script in it. Instead, we will make it use our own `mozilla-inbound` and `gaia` code.

    ```
  14. jedp revised this gist Sep 27, 2012. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -80,6 +80,8 @@ While that runs, set up Gaia.

    `cd b2g-src`

    `git clone` (or maybe fork first) https://github.com/mozilla-b2g/gaia

    Update with a `git pull`.

    We need to create a default profile that will toggle the native identity features on.
  15. jedp revised this gist Sep 27, 2012. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -82,13 +82,24 @@ While that runs, set up Gaia.

    Update with a `git pull`.

    We need to create a default profile that will toggle the native identity features on.

    Create the file `custom-prefs.js` in the root of the gaia directory. Put these lines in it:

    ```
    pref("dom.identity.enabled", true);
    pref("toolkit.identity.debug", true);
    ```

    Build with:
    ```
    DEBUG=1 make
    ```

    You need network to build, since packages will be downloaded from nightly.

    If you want to update the custom prefs at any time, you will need to re-build the profile (but not the whole project) with `make profile`.

    ## Building for desktop or the device

    ### Desktop builds
  16. jedp revised this gist Sep 26, 2012. 1 changed file with 12 additions and 2 deletions.
    14 changes: 12 additions & 2 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -165,7 +165,17 @@ Running `config.sh` will download a ton of stuff the first time.

    That's that. Time to go play with the phone.

    ## Testing

    We have notes about running xpshell tests in our [native identity warroom notes] [10].

    Mochitests will not work in the b2g environment. For example:
    ```
    # This will fail
    TEST_PATH=browser/modules/test make -C ../build mochitest-browser-chrome
    ```

    To test UI components that require mochi tests, either [push to the try server] [9] or apply your patch in your copy of the pine branch and run your tests there.

    [1]: https://developer.mozilla.org/en-US/docs/Mozilla/Boot_to_Gecko/Choosing_how_to_run_Gaia_or_B2G "Running Gaia"
    [2]: https://intranet.mozilla.org/B2G_Team/Otoro "Building and flashing the target to the phone"
    @@ -175,5 +185,5 @@ That's that. Time to go play with the phone.
    [6]: https://developer.mozilla.org/en-US/docs/Mercurial_Queues#Introduction
    [7]: https://developer.mozilla.org/en-US/docs/Creating_Mercurial_User_Repositories#Mercurial_Queue_User_Repository_Workflow
    [8]: https://developer.mozilla.org/en-US/docs/Mozilla/Boot_to_Gecko/Using_the_B2G_desktop_client


    [9]: https://wiki.mozilla.org/Build:TryServerAsBranch
    [10]: https://id.etherpad.mozilla.org/2012-05-31-id-warroom
  17. jedp revised this gist Sep 25, 2012. 1 changed file with 37 additions and 30 deletions.
    67 changes: 37 additions & 30 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -89,36 +89,7 @@ DEBUG=1 make

    You need network to build, since packages will be downloaded from nightly.

    ## Building B2G

    Now we will use our `mozilla-inbound` and `gaia` repos to build B2G.

    `cd $HOME/b2g`

    We can build either for the device (and flash the build to the phone), or for the desktop. Desktop builds are useful for testing and more rapid development.

    ### Device builds

    Create `.userconfig` and add these lines (adjusting paths accordingly):

    ```shell
    # Configuration for custom device builds; Desktop builds ignore this.

    GAIA_PATH=/path/to/b2g-src/gaia
    GECKO_PATH=/path/to/b2g-src/mi

    VARIANT=user # 'user' strangely means 'production'
    # this option omits the test apps from the phone
    ```

    If this is your first time flashing a phone, be sure to follow the [preliminary instructions] [2].

    Now configure, build, and flash:
    ```
    ./config.sh otoro # assuming otoro is the correct target
    ./build.sh
    ./flash.sh
    ```
    ## Building for desktop or the device

    ### Desktop builds

    @@ -156,7 +127,43 @@ Hotkeys:

    MDN has more about [using the B2G desktop client] [8].

    ### Building for the device

    We clone the b2g project, but we will not use the `repo sync` script in it. Instead, we will make it use our own `mozilla-inbound` and `gaia` code.

    ```
    git clone git clone https://github.com/mozilla-b2g/B2G b2g
    cd b2g
    ```
    Create `.userconfig` and add these lines (adjusting paths accordingly):

    ```shell
    # Configuration for custom device builds; Desktop builds ignore this.

    GAIA_PATH=/path/to/b2g-src/gaia
    GECKO_PATH=/path/to/b2g-src/mi

    VARIANT=user # 'user' strangely means 'production'
    # this option omits the test apps from the phone
    ```

    Follow the [B2G Otoro setup instructions] [2]. I can't summarize those steps here, because there are downloads and passwords involved. It's a short document that will take you through:
    - setting up udev (on Linux)
    - downloading the Adreno driver
    - installing busybox on the phone

    I honestly can't recall which of those steps I had to follow and which were already simplified somehow. But it was pretty straightforward.

    Now configure, build, and flash:
    ```
    ./config.sh otoro # assuming otoro is the correct target
    ./build.sh
    ./flash.sh
    ```

    Running `config.sh` will download a ton of stuff the first time.

    That's that. Time to go play with the phone.



  18. jedp revised this gist Sep 25, 2012. 1 changed file with 25 additions and 2 deletions.
    27 changes: 25 additions & 2 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -125,7 +125,7 @@ Now configure, build, and flash:
    Create a `.mozconfig` file containing:
    ```
    mk_add_options MOZ_OBJDIR=../build
    mk_add_options MOZ_MAKE_FLAGS="-j8 -s" # adjust for your number of cores
    mk_add_options MOZ_MAKE_FLAGS="-j8 -s" # adjust -j for your number of cores
    ac_add_options --enable-application=b2g
    ac_add_options --disable-libjpeg-turbo
    @@ -140,10 +140,33 @@ ac_add_options --enable-tests
    #ac_add_options --enable-b2g-ril
    ```

    If it crashes, try blowing away the build dir and makeing again.

    Great! You've already built Gaia, so you can just run b2g like so:

    ```
    build/dist/bin/b2g -profile gaia/profile --no-remote
    ```

    You should see the emulator appear in all its glory.

    Hotkeys:
    - ESC for "back" button
    - Home for to go to home screen. On the Mac, use Fn + left-arrow

    MDN has more about [using the B2G desktop client] [8].





    [1]: https://developer.mozilla.org/en-US/docs/Mozilla/Boot_to_Gecko/Choosing_how_to_run_Gaia_or_B2G "Running Gaia"
    [2]: https://intranet.mozilla.org/B2G_Team/Otoro "Building and flashing the target to the phone"
    [3]: https://hg.mozilla.org/users/jparsons_mozilla.com/b2g-payments-identity "Jed's clone of mozilla-inbound"
    [4]: https://github.com/jedp/gaia "Jed's fork of Gaia"
    [5]: https://github.com/mozilla-b2g/B2G "The B2G project that builds the phone target"
    [6]: https://developer.mozilla.org/en-US/docs/Mercurial_Queues#Introduction
    [7]: https://developer.mozilla.org/en-US/docs/Creating_Mercurial_User_Repositories#Mercurial_Queue_User_Repository_Workflow
    [7]: https://developer.mozilla.org/en-US/docs/Creating_Mercurial_User_Repositories#Mercurial_Queue_User_Repository_Workflow
    [8]: https://developer.mozilla.org/en-US/docs/Mozilla/Boot_to_Gecko/Using_the_B2G_desktop_client


  19. jedp revised this gist Sep 25, 2012. 1 changed file with 13 additions and 2 deletions.
    15 changes: 13 additions & 2 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -89,12 +89,14 @@ DEBUG=1 make

    You need network to build, since packages will be downloaded from nightly.

    ## Setting up `b2g` to build the device target
    ## Building B2G

    Cool. Now we will use our `mozilla-inbound` and `gaia` repos to build B2G.
    Now we will use our `mozilla-inbound` and `gaia` repos to build B2G.

    `cd $HOME/b2g`

    We can build either for the device (and flash the build to the phone), or for the desktop. Desktop builds are useful for testing and more rapid development.

    ### Device builds

    Create `.userconfig` and add these lines (adjusting paths accordingly):
    @@ -109,6 +111,15 @@ VARIANT=user # 'user' strangely means 'production'
    # this option omits the test apps from the phone
    ```

    If this is your first time flashing a phone, be sure to follow the [preliminary instructions] [2].

    Now configure, build, and flash:
    ```
    ./config.sh otoro # assuming otoro is the correct target
    ./build.sh
    ./flash.sh
    ```

    ### Desktop builds

    Create a `.mozconfig` file containing:
  20. jedp revised this gist Sep 25, 2012. 1 changed file with 45 additions and 1 deletion.
    46 changes: 45 additions & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -41,7 +41,7 @@ hg init .
    hg qinit -c # initializes mercurial queues
    ```

    Create and edit `./hg/hgrc`, filling in your LDAP username correctly:
    Create and edit `.hg/hgrc`, filling in your LDAP username correctly:
    ```
    [paths]
    default = ssh://<LDAP_username>@[email protected]/users/jparsons_mozilla.com/b2g-payments-identity/
    @@ -63,16 +63,40 @@ hg update
    make -f client.mk
    ```

    Whoever is managing the shared user repo (me, in this case), would regularly do:

    ```
    hg pull mozilla-inbound
    hg update
    make -f client.mk
    ```

    You have to regularly blow away the `../build` directory. Try that first if `make`
    crashes.

    While that runs, set up Gaia.

    ## Setting up `gaia`

    `cd b2g-src`

    Update with a `git pull`.

    Build with:
    ```
    DEBUG=1 make
    ```

    You need network to build, since packages will be downloaded from nightly.

    ## Setting up `b2g` to build the device target

    Cool. Now we will use our `mozilla-inbound` and `gaia` repos to build B2G.

    `cd $HOME/b2g`

    ### Device builds

    Create `.userconfig` and add these lines (adjusting paths accordingly):

    ```shell
    @@ -85,6 +109,26 @@ VARIANT=user # 'user' strangely means 'production'
    # this option omits the test apps from the phone
    ```

    ### Desktop builds

    Create a `.mozconfig` file containing:
    ```
    mk_add_options MOZ_OBJDIR=../build
    mk_add_options MOZ_MAKE_FLAGS="-j8 -s" # adjust for your number of cores
    ac_add_options --enable-application=b2g
    ac_add_options --disable-libjpeg-turbo
    # This option is required if you want to be able to run Gaia's tests
    ac_add_options --enable-tests
    # turn on mozTelephony/mozSms interfaces
    # Only turn this line on if you actually have a dev phone
    # you want to forward to. If you get crashes at startup,
    # make sure this line is commented.
    #ac_add_options --enable-b2g-ril
    ```

    [1]: https://developer.mozilla.org/en-US/docs/Mozilla/Boot_to_Gecko/Choosing_how_to_run_Gaia_or_B2G "Running Gaia"
    [2]: https://intranet.mozilla.org/B2G_Team/Otoro "Building and flashing the target to the phone"
    [3]: https://hg.mozilla.org/users/jparsons_mozilla.com/b2g-payments-identity "Jed's clone of mozilla-inbound"
  21. jedp revised this gist Sep 24, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -67,7 +67,7 @@ While that runs, set up Gaia.

    ## Setting up `gaia`


    `cd b2g-src`

    ## Setting up `b2g` to build the device target

    @@ -91,4 +91,4 @@ VARIANT=user # 'user' strangely means 'production'
    [4]: https://github.com/jedp/gaia "Jed's fork of Gaia"
    [5]: https://github.com/mozilla-b2g/B2G "The B2G project that builds the phone target"
    [6]: https://developer.mozilla.org/en-US/docs/Mercurial_Queues#Introduction
    [7]: Read this: https://developer.mozilla.org/en-US/docs/Creating_Mercurial_User_Repositories#Mercurial_Queue_User_Repository_Workflow
    [7]: https://developer.mozilla.org/en-US/docs/Creating_Mercurial_User_Repositories#Mercurial_Queue_User_Repository_Workflow
  22. jedp revised this gist Sep 24, 2012. 1 changed file with 26 additions and 6 deletions.
    32 changes: 26 additions & 6 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # B2G Quickstart for Payments and Identity

    This sets you up to make two separate targets:
    - One for a desktop [simulator] [1]
    - One for the ZTE [device] [2]
    @@ -7,7 +9,7 @@ These are the moving parts:
    - [gaia repo] [4] fork (git)
    - [B2G project clone] [5] (git)

    # Basic organization
    ## Basic organization

    I've structured my directories like so:

    @@ -20,11 +22,13 @@ b2g-src/
    b2g/ # git clone of mozilla-b2g/B2G
    ```

    # Prep steps: Setting up Mercurial Queues
    ## Prep steps: Setting up Mercurial Queues

    Follow the steps in the [introduction to Mercurial queues] [6].

    Do this: https://developer.mozilla.org/en-US/docs/Mercurial_Queues#Introduction
    Read the [Mercurial queue workflow] [7] documentation.

    # Setting up the `mozilla-inbound` repo
    ## Setting up the `mozilla-inbound` repo

    This is where we will be working on `navigator.id` and friends.

    @@ -51,7 +55,21 @@ default = http://hg.mozilla.org/users/jparsons_mozilla.com/b2g-payments-identity
    default-push = ssh://hg.mozilla.org/users/jparsons_mozilla.com/b2g-payments-identity
    ```

    # Setting up `b2g` to build the device target
    Now you should be able to pull and build:

    ```
    hg pull
    hg update
    make -f client.mk
    ```

    While that runs, set up Gaia.

    ## Setting up `gaia`



    ## Setting up `b2g` to build the device target

    `cd $HOME/b2g`

    @@ -71,4 +89,6 @@ VARIANT=user # 'user' strangely means 'production'
    [2]: https://intranet.mozilla.org/B2G_Team/Otoro "Building and flashing the target to the phone"
    [3]: https://hg.mozilla.org/users/jparsons_mozilla.com/b2g-payments-identity "Jed's clone of mozilla-inbound"
    [4]: https://github.com/jedp/gaia "Jed's fork of Gaia"
    [5]: https://github.com/mozilla-b2g/B2G "The B2G project that builds the phone target"
    [5]: https://github.com/mozilla-b2g/B2G "The B2G project that builds the phone target"
    [6]: https://developer.mozilla.org/en-US/docs/Mercurial_Queues#Introduction
    [7]: Read this: https://developer.mozilla.org/en-US/docs/Creating_Mercurial_User_Repositories#Mercurial_Queue_User_Repository_Workflow
  23. jedp revised this gist Sep 24, 2012. 1 changed file with 59 additions and 0 deletions.
    59 changes: 59 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,65 @@ These are the moving parts:
    - [gaia repo] [4] fork (git)
    - [B2G project clone] [5] (git)

    # Basic organization

    I've structured my directories like so:

    ```
    b2g-src/
    gaia/ # git clone of my gaia fork
    mi/ # hg clone of my mozilla-inbound user repo
    build/ # build dir that mi will create
    b2g/ # git clone of mozilla-b2g/B2G
    ```

    # Prep steps: Setting up Mercurial Queues

    Do this: https://developer.mozilla.org/en-US/docs/Mercurial_Queues#Introduction

    # Setting up the `mozilla-inbound` repo

    This is where we will be working on `navigator.id` and friends.

    First, `cd b2g-src; mkdir mi; cd mi`

    In the `mi` directory:

    ```
    hg init .
    hg qinit -c # initializes mercurial queues
    ```

    Create and edit `./hg/hgrc`, filling in your LDAP username correctly:
    ```
    [paths]
    default = ssh://<LDAP_username>@[email protected]/users/jparsons_mozilla.com/b2g-payments-identity/
    mozilla-inbound = https://hg.mozilla.org/integration/mozilla-inbound/
    ```

    Create and edit `.hg/patches/.hg/hgrc`
    ```
    [paths]
    default = http://hg.mozilla.org/users/jparsons_mozilla.com/b2g-payments-identity
    default-push = ssh://hg.mozilla.org/users/jparsons_mozilla.com/b2g-payments-identity
    ```

    # Setting up `b2g` to build the device target

    `cd $HOME/b2g`

    Create `.userconfig` and add these lines (adjusting paths accordingly):

    ```shell
    # Configuration for custom device builds; Desktop builds ignore this.

    GAIA_PATH=/path/to/b2g-src/gaia
    GECKO_PATH=/path/to/b2g-src/mi

    VARIANT=user # 'user' strangely means 'production'
    # this option omits the test apps from the phone
    ```

    [1]: https://developer.mozilla.org/en-US/docs/Mozilla/Boot_to_Gecko/Choosing_how_to_run_Gaia_or_B2G "Running Gaia"
    [2]: https://intranet.mozilla.org/B2G_Team/Otoro "Building and flashing the target to the phone"
  24. jedp created this gist Sep 24, 2012.
    15 changes: 15 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    This sets you up to make two separate targets:
    - One for a desktop [simulator] [1]
    - One for the ZTE [device] [2]

    These are the moving parts:
    - [mozilla-inbound repo] [3] clone (hg)
    - [gaia repo] [4] fork (git)
    - [B2G project clone] [5] (git)


    [1]: https://developer.mozilla.org/en-US/docs/Mozilla/Boot_to_Gecko/Choosing_how_to_run_Gaia_or_B2G "Running Gaia"
    [2]: https://intranet.mozilla.org/B2G_Team/Otoro "Building and flashing the target to the phone"
    [3]: https://hg.mozilla.org/users/jparsons_mozilla.com/b2g-payments-identity "Jed's clone of mozilla-inbound"
    [4]: https://github.com/jedp/gaia "Jed's fork of Gaia"
    [5]: https://github.com/mozilla-b2g/B2G "The B2G project that builds the phone target"