B2g Os



TO: B2G OS community (for their weekly Tuesday meeting)
SUBJECT: B2G OS and Gecko


By the end of 2015 Mozilla leadership had come to the conclusion that our then Firefox OS initiative of shipping phones with commercial partners would not bring Mozilla the returns we sought. We made the first of a series of announcements about changes in the development of Firefox OS at Mozilla. Since then we have gradually wound down that work and, as of the end of July 2016 have stopped all commercial development on Firefox OS. This message recaps what transpired during that period of time and also describes what will happen with the Firefox OS code base going forward.

KaiOS is forked from B2G OS (Boot to Gecko OS), an open source community-driven fork of Firefox OS, which was discontinued by Mozilla in 2016. Firefox OS (ファイアフォックス オーエス、プロジェクト名:Boot to Gecko、B2G) とは、Mozillaによって開発されたスマートフォンとタブレットなどの携帯情報端末を主なターゲットとして開発されたオープンソース オペレーティングシステムである。.

B2G OS add-ons You should follow the below steps to get set up to start developing extensions. B2G OS APIs List of B2G OS APIs B2G OS architecture This article is a high-level overview of the architecture of the B2G OS platform, introducing key concepts and explaining how its components interact at a basic level. B2G OS build prerequisites. Building and Porting If you are doing B2G OS builds for any device this is your place to gather, talk and learn from others. Code Hacking on B2G OS? Come and share about it! Infrastructure The code (and machines) behind the code (and builds). Foxfooding Global dogfooding program where developers, hackers and open web enthusiasts can test the latest versions of Firefox OS and perform various. If you built b2g in your host OS, you can skip the following instructions. To mirror your b2g build into your host OS, first find out your guest VM's IP address by running the following command within your guest VM ifconfig You'll see a line printed that says something like inet addr:AAA.BBB.CCC.DDD.


In particular, through various channels we announced:

  • We would stop our efforts to build and ship smartphones through carrier partners and pivot our efforts with Firefox OS to explore opportunities for new use cases in the world of connected devices.

  • Firefox OS was transitioned to a Tier 3 platform from the perspective of support by Mozilla's Platform Engineering organization. That meant as of January 31, 2016 no Mozilla Platform Engineering resources would be engaged to provide ongoing support and all such work would be done by other contributors. For some period of time that work would be done by Mozilla’s Connected Devices team.

  • We had ideas for other opportunities for Firefox OS, perhaps as a platform for explorations in the world of connected devices, and perhaps for continued evolution of Firefox OS TV. To allow for those possibilities, and to provide a stable release for commercial TV partners, development would continue on a Firefox OS 2.6 release.

  • In parallel with continued explorations by the Connected Devices team, we recognized there was interest within the Mozilla community in carrying forward work on Firefox OS as a smartphone platform, and perhaps even for other purposes. A Firefox OS Transition Project was launched to perform a major clean-up of the B2G code bringing it to a stable end state so it could be passed into the hands of the community as an open source project.


In the spring and summer of 2016 the Connected Devices team dug deeper into opportunities for Firefox OS. They concluded that Firefox OS TV was a project to be run by our commercial partner and not a project to be led by Mozilla. Further, Firefox OS was determined to not be sufficiently useful for ongoing Connected Devices work to justify the effort to maintain it. This meant that development of the Firefox OS stack was no longer a part of Connected Devices, or Mozilla at all. Firefox OS 2.6 would be the last release from Mozilla.


Today we are announcing the next phase in that evolution. While work at Mozilla on Firefox OS has ceased, we very much need to continue to evolve the underlying code that comprises Gecko, our web platform engine, as part of the ongoing development of Firefox. In order to evolve quickly and enable substantial new architectural changes in Gecko, Mozilla’s Platform Engineering organization needs to remove all B2G-related code from mozilla-central. This certainly has consequences for B2G OS. For the community to continue working on B2G OS they will have to maintain a code base that includes a full version of Gecko, so will need to fork Gecko and proceed with development on their own, separate branch.


We realize that these decisions are painful for those of us who had high hopes and dreams and work tied up in Firefox OS — in the idea of an open source, user-centric, Mozilla mission-based operating system for the mobile space. We also recognize that this decision makes it much harder for the b2g community to continue its work. We wish we could have found another way. However, we believe that these have been necessary decisions and the best possible way for Mozilla to continue on its mission.


Ari Jaaksi

David Bryant

The B2G OS simulator lets you run Gaia and Web apps in a Gecko-based environment somewhat similar to an actual device. It doesn't emulate device hardware, so it's not adequate for testing device APIs, and isn't a replacement for testing on actual hardware. However, it does have several APIs enabled that aren't available on Firefox such as the Contacts and Settings APIs. It can therefore be useful during the development of your application, or while working on the Gaia user interface itself. This article covers downloading or building the Firefox OS simulator, as well as how to use it.

Note: The easiest way to use the Firefox OS desktop client is to use the Firefox OS Simulator add-on via WebIDE. It does not require you to build the simulator yourself.

Download nightly builds

Just like Firefox Nightlies, the B2G OS simulator desktop client (identified by b2g-) is automatically built every day from the latest source code. The latest build is available from the Mozilla FTP server. Be sure to pick the latest version and the right archive for your operating system. This lets you bypass having to build it yourself. In addition, you don't have to download Gaia on your own either.

Be sure to install the application in a writeable location; the application needs to be able to update the included Gaia profile.

You can now skip ahead to Running the simulator, unless you actually want to build it for yourself. This is necessary if you want to make and test changes to the codebase.

Building the simulator

The first thing you need to do is set up a standard Mozilla build environment. Once you have that, you can pull down the code you'll need and configure it to build the Firefox OS desktop client.

Downloading the code for the first time

In a directory where you'd like the source code to go, clone the mozilla-central repository that contains all of Gecko:

Alternatively, you can download the same code from Github:

Updating the code

When you do subsequent builds, you should make sure to pull in the latest changes:

or

Create a mozconfig

Next, you need to create a file called .mozconfig in the mozilla-central directory to configure the build system to build the Boot to Gecko client instead of Firefox. This file should contain the following:

You also need to include the line ENABLE_MARIONETTE=1 in the file if you want to run Mochitests in the B2G desktop client (either mochitest-b2g-desktop or mochitest-plain) or if you want to run Gaia unit tests.

Building

Now you can build the desktop client with the following command (run this from inside the mozilla-central directory):

The built client will be placed in the objdir/dist/bin directory (based on the value you specify for MOZ_OBJDIR in the mozconfig file).

Note: If you have any trouble first check the dependencies.

Downloading Gaia

By default the simulator desktop client will show an empty screen because it doesn't know which web app to load initially as the system app. The collection of system apps and default apps that come with Firefox OS — Gaia — needs to be downloaded.

To download Gaia for the first time, clone the source code repository on GitHub:

To update an already existing clone of Gaia, you can pull in the latest changes from GitHub:

Creating a custom-settings.json

If you know what you're doing and you want to set various config options you can create the file gaia/build/config/custom-settings.json and add them there, for example: Download maya for mac free.

This example is useful for bypassing the lockscreen, which is otherwise impossible to bypass on desktop because it can't be unlocked using a mouse or trackpad.

Generating a profile

Next we need to set up Gaia's apps for the desktop simulator. This includes packaging the Gaia apps in the same way as they would be installed on the device, as well as setting up the permissions for the privileged system apps. We do this by generating a profile. The following command (run in the downloaded gaia directory) will take care of that:

This should create a profile-debug directory below the gaia directory. The new profile contains a customized extension and other configuration details needed to make B2G run properly.

Note: There is currently a bug (bug 1180103) that causes Gaia debug profiles to render with an empty homescreen when run through the Firefox OS Simulator (through WebIDE, or whatever.) This can be worked around by building with DEBUG=1 DESKTOP=0 make instead of DEBUG=1.

Clone Operating System To Usb

Running the simulator

Once you've built the client (or downloaded and installed the nightly desktop application) and downloaded Gaia , you're ready to fire up the simulator.

Running on Linux

To run the simulator on Linux using the embedded Gaia profile, just run the b2g executable. The binary is in the archive you downloaded earlier or in the objdir/dist/bin directory if you built the client yourself.

You may experience annoying rendering problems. To avoid them, add the following line to your gaia/profile/user.js file:

Running on Mac

If you downloaded the Nightly build, you can simply launch it from the Finder as usual. Any console output is visible by running the standard Console utility program included with your Mac.

If you want to specify a different Gaia profile (such as your separate download Gaia from above), you need to bypass the b2g wrapper program and run the b2g binary. The command line is slightly more complicated due to the location of the b2g binary and the need for absolute paths when specifying the profile directory:

Running on Windows

B2g

Running the Nightly build on Windows is as simple as launching b2g.exe. If you want to customize the execution, you can do so by running the b2g.exe executable instead; this bypasses the wrapper program that automatically uses the bundled Gaia.

Command line options

There are a number of command line options you can use to adjust the runtime experience while using the desktop simulator. You can get a list by using the -help option. This section covers some of the particularly interesting ones.

Specifying the screen size

You can specify the screen size of the device you want to simulate using the -screen option:

B2g Oslo

Where <width>, <height>, and <dpi> are fairly self-explanatory parameters: the width and height of the device's screen in pixels and the device resolution in DPI. Here's some real examples:

Optionally, you can specify certain devices by name to simulate their screen size and resolution:

  • iphone
  • ipad
  • nexus_s
  • galaxy_nexus
  • galaxy_tab
  • wildfire
  • tattoo
  • salsa
  • chacha

These preset devices are defined in screen.js.

In order to select different screen you probably have to specify the profile path as follow:

./b2g-bin --profile ./gaia/profile/ --screen=galaxy_tab

Opening the JavaScript console

You can open the JavaScript console when launching the desktop simulator by launching it from the command line with the -jsconsole flag. After building, just do:

If you've installed the Nightly build on a Mac, you can do the following:

Note: On production builds of Firefox OS, console logging (for example console.log()) is disabled by default. In order to enable it, open the Developer settings and enable the Console Enabled preference.

Launching a specific application at startup

You can specify an application to be launched automatically when b2g starts up in the simulator. This is done as soon as the rest of the system is done loading up. To do this, just use the -runapp option, which takes as a parameter the name of the application to run. For example:

Note: The specified name is normalized by converting it to all lower case and removing all dashes and spaces. This normalized name is then compared to similarly normalized names from the manifests of available apps' manifests. For example, the name of the email app is currently 'E-mail', but -runapp email will work because of this normalization.

If you specify the -runapp option without an argument, or with an empty argument, the simulator will output to your terminal a list of the known applications as well as a brief usage message.

Note: Using the -runapp option disables the lock screen as a side effect and does not re-enable it. It's assumed that you won't use this command on a profile on which you will be testing the lock screen, or you will turn it back on manually using Settings > Screen Lock. Feel free to contribute a patch to change this behavior if it's a problem.

Usage tips

This section provides a few helpful tips to using the B2G desktop client.

B2g Os Apk

  • The Esc key performs the same function as the 'back' button.
  • The Home key performs the same function as the 'home' button; if you're on a Mac, the Home key is available as Fn + ← (Fn + Left Arrow).
  • The End key performs the same function as the 'power' button; if you're on a Mac, the End key is available as Fn + → (Fn + Right Arrow).
  • the Page Up and Page Down keys perform the same functions as the 'Volume Up' and 'Volume Down' buttons respectively; if you're on a Mac, the Page Up key is available as Fn + ↑ (Fn + Up Arrow) and the Page Down key is available as Fn + ↓ (Fn + Down Arrow).
  • A long press on the Home key opens the 'Card View'; if you're on Mac, Cmd + Fn + ← (Cmd + Fn + Left Arrow) opens the 'Card View'.

Troubleshooting: A blank screen when the simulator starts

B2g Sales

When you start b2g using b2g -profile gaia/path/to/gaia/profile a blank screen may show up along with an error 'Cannot reach app://system.gaiamobile.org'. To fix this there are a couple of things you can check:

  • Rebuild the gaia profile using the DEBUG=1 make profile in the gaia directory.
  • Run b2g again.
  • If this doesn't fix it, check if there is any other process listening on port 8080. The default profile of Gaia starts httpd.js, which listens on port 8080. When running a debug profile, B2G connects to localhost:8080. If some other process is running on port 8080, b2g will fail to display the home screen of gaia.
    1. To find out if this is the case, you can enable logging on httpd.js. The httpd.js in the profile resides in the location gaia/profile/extensions/httpd/content/httpd.js. Open this file for editing.
    2. Change the line var DEBUG=false; to var DEBUG=true;
    3. Save the file and restart B2G. On the console you will now be able to view the httpd's logs.

B2g Os Source Code

Next steps

Now that you have a simulated build of Boot to Gecko running, you can do testing, development, and other work in it: