System Analysis of Firefox Mobile: architecture and development overview

Source: Internet
Author: User

1. Preface

Firefox OS is a new-generation open-source mobile operating system developed by Mozilla. It adopts the Linux kernel and Gecko-based operating environment, it provides users with applications fully based on HTML/JavaScript technology and other open Web application interfaces.

Mozilla is a non-profit organization that organizes and develops the famous Firefox browser and Gecko browser engine.

The analysis in this article is mainly based on public information on the Internet and my current understanding and experiment on Firefox OS, hoping to provide a reference for you to get a preliminary understanding of Firefox OS.

2. Introduction

2.1 Overview

Firefox OS was developed by the B2G (Boot to Gecko) project launched by Mozllia in 2011.7. It was officially named Firefox OS in 2012.7. Based on the Linux and Gecko engine technologies, this project was fully developed in an open and open source manner from the very beginning. Its core philosophy is that all applications accessible to users are Web-based, these applications use advanced HTML5 technology and hardware device interfaces to directly access mobile phone hardware devices through JavaScript.

For developers, the entire user interface of Firefox OS is a Web application that can display and activate other Web applications. Any modifications to the user interface and applications that can run on Firefox OS are Web pages, but these pages provide the ability to directly access hardware devices and services.

The motivation of the project development lies in Mozilla's belief that Web can replace an authorized application development ecosystem based on a single vendor. In order to make open Web technology the foundation for the future development of mobile and desktop applications, we need to continuously promote the development of Web, to possess and, in some respects, surpass the capabilities of competing ecosystems.

2.2 initial work completed

◆ Provides a new Web interface prototype to expose devices and operating systems, including phones, text messages, cameras, Bluetooth, and NFC ).

◆ Establish a security permission model to ensure that these new interfaces are securely exposed to upper-layer pages and applications.

◆ Provides an underlying basic framework for smartphones and tablets.

◆ Choose to transplant or build an application to prove or highlight the capabilities of the system.

2.3 Current Development Status and Development

◆ The project is currently under full development. The main developers are full-time Firefox developers and some vendors, and some open source enthusiasts.

◆ In early 2012, a prototype system was provided for the initial partner, which attracted the attention and favor of some telecom operators.

◆ ZTE and TCL plan to launch Firefox OS-based smartphones by the end of 2012 or early 2013.

3. Firefox OS architecture

The Firefox OS architecture consists of three layers: Gonk, Gecko, And Gaia, as shown in:

3.1 Gonk Layer

The Gonk layer is the underlying layer of Firefox OS. It consists of the Linux kernel and the user-state hardware abstraction layer. It is often derived from common open source projects such as the Linux kernel and libusb, some of them are shared with the android hardware abstraction layer, such as GPS and Camera, and may also include the code or libraries required for authorization provided by some hardware vendors, such as ril, OpenGLES, and Fm.

3.2 Gecko Layer

The Gecko layer refers to the application running environment of Firefox OS, which provides public-standard support such as HTML, CSS, and JavaScript. To ensure strong support for these interfaces, this layer also includes other content such as network processing, graphic image processing, Layout Engine, JavaScript virtual machine, and Gonk HAL support.

3.3 Gaia Layer

The Gaia layer refers to the user interface layer of Firefox OS. When Firefox OS is started, any content that can be displayed on the screen can be seen as an application of this layer. The Gaia layer provides standard applications for HomeScreen, ScreenLock, and even a modern smartphone. The Gaia application is fully implemented using HTML, CSS, and JavaScript. It uses open Web interfaces to access potential operating system functions. It is supported by the Gecko layer.

Third-party applications can be installed on the Gaia layer through the Web application market and used together with other applications.

4. Firefox OS running state analysis

4.1 BootStrap stage

When the power of the Firefox OS device is turned on, the Bootloader program starts to run, from displaying the startup screen and Logo until the operating system kernel image is loaded to the device.

4.2 Linux kernel startup phase

This phase is consistent with the kernel startup of mainstream Linux systems, especially the Startup Process of the Android kernel.

4.3 Init Initialization

This phase is used to load system services and core processes after the Linux kernel is started.

4.4 user-state core process interaction status

The main processes loaded by the Init stage include b2g, rild, rildproxy, mediaserver, netd, wpa_supplicant, and executor-daemon.

B2g is the main running environment process, and the running relationship between them is as follows:

4.5 b2g multi-process running model

To ensure the independence and security of different Web applications, Firefox OS adopts a multi-process model similar to Chrome browser and WebKit2. See Figure 3:

The main process is mainly responsible for displaying the main UI, receiving and distributing events, merging layers, final output of the screen, and network processing. The main process (called the b2g process) communication with content sub-processes is implemented based on the IPDL defined by Mozilla;

The content sub-process specifies the logic processing and Content Rendering of the Web application. when it needs to be displayed, the main process is notified for merging and screen output;

The main operation logic is shown in Figure 4:

5. Firefox OS Development

5.1 Development Background

◆ Implementation based on open source and open technology

The development of Firefox OS is based on open and open source methods from the very beginning, and its applications are mainly based on Web technology. Different developers, especially Web development, they can quickly get involved in the development of their applications.

In addition, because it fully implements Application Development Based on Open HTML/JavaScript, it is completely unrelated to Java, which leads to the essential difference between its ecosystem and Android, perhaps this is the biggest difference between Firefox OS and Android Application stacks.

◆ General hardware and Open Hardware Abstraction Layer

To adhere to the open Web spirit and its own advantages and disadvantages, Mozilla started Firefox OS development based on Android at the beginning in light of the current situation of open-source communities, especially the rapid popularization of Android, even its entire compilation and packaging flash machine tool is directly implemented using the existing Android system methods.

Why does Mozilla choose this approach? Perhaps the most fundamental reason is that it facilitates adaptation of different hardware. Different manufacturers provide Bootloader, FashBoot, kernel driver updates for different hardware platforms, as well as underlying support for mobile phones, text messages, Camera, Sensor, and video and image display processing for Android platforms. With the underlying support of these basic functions, it provides great convenience for the development of Firefox OS. From the perspective of technical implementation, the underlying implementation of Firefox OS can be based on the underlying implementation of Android to complete the Gonk layer in its architecture and the corresponding Gecko layer.

From porting Firefox OS to different platforms, it adopts a hardware abstraction layer similar to Android, and many interfaces are consistent with Android. In this way, when we promote and establish the Firefox OS ecosystem, we can use the Android platform for acceleration and popularization.

From the above analysis, this is the biggest commonality between Firefox OS and Android, and the formation of this commonality may be the key lies in that they are all operating system development based on the open source and open mind.

◆ Open development and testing platforms

Because Firefox OS is developed and applied based on Web technology, and Web technology has been tested and widely used in modern browsers, its application development and testing can even be carried out directly in desktop browsers.

If you are interested, you can use the Firefox browser to install an r2d2b2g extension plugin.

5.2 Web Application Development

Based on the development background mentioned above, as a Web application developer, you can easily get involved in FirefoxOS application development. However, the following points need some knowledge of Web application developers:

◆ Web applications are a brand new attempt

Although based on the same technology, Web applications are essentially quite different from Web pages. The author understands that the greatest benefit of a Web page is that you can jump to different pages at will based on the URL link in the page. In essence, Web applications should emphasize content concentration and application, like a local application, such as the mobile phone version of the magic intelligence forum, you should focus on completing certain functions and try to keep users in the application, such as game and social applications.

With this basic understanding, we need to make some adjustments to the layout and operations of Web pages to become an excellent Web application.

◆ Web application mobile challenges

Because Firefox OS is a mobile operating system, it will inevitably bring many mobile device features, such as touch operations, small screens, positioning, and Camera, in this way, many new devices or mobile-related Web interfaces are provided, which requires Web application developers to learn and use.

The main new Web interfaces are:

◆ Running Offline

◆ Online and Offline Events

◆ Drawing Graphics with Canvas

◆ Drawing 3D Graphics with WebGL

◆ Using Files from Web App

◆ Detecting Device Orientation

◆ Using Camera

◆ Customing Phone

For more information, see the reference provided in the appendix.

Performance challenges for Web applications and local applications

Currently, on IOS and Android platforms, the performance of applications differs from that of local applications. Web may be related to the selection of technical implementation solutions, however, it is likely that these two platforms are not developed for Web applications from the very beginning. Imagine why Safari is used on iOS to browse and use pages

The performance and experience of WebView page browsing vary greatly. The root cause is the uniqueness of the Safari browser, which is often reflected in its rendering method and the performance of the JavaScript engine. Firefox OS has made special optimizations and adjustments in rendering methods and JavaScript engine performance, mainly reflected in:

◆ Use the new Azure library to implement Canvas 2D;

◆ Enhance the multi-process architecture and provide Parallel Rendering and synthesis capabilities;

◆ Improve the support for WebWorker, WebSocket, and WebStorage.

This should be just the beginning. The advantages of Web applications will be highlighted over time, and the limitations of local applications will become increasingly unsatisfactory, this is also the fundamental starting point for Mozilla to launch the Firefox OS project and its mission. This is why the magic intelligence forum has been supporting the B2G project, and it is also the difference between it and HP webOS.

5.3 development for Firefox OS

If you want to participate in the development of Firefox OS itself, it may be a challenge because it is full of challenges, but if there is a little passion (because a bunch of passionate guys are currently involved in development), a little understanding of the Android system, and a little understanding of the browser engine, in particular, the Gecko engine is easy to understand. Because they are open-source projects after all. Can everything start from scratch? Do you want to hurry up.

Refer to B2G build prerequisites, Preparing for your first B2G build, Building Boot to Gecko, get the source code, and then run. /config. sh ,. /build. sh ,. /flash. sh, You can compile a simulator or a Rom of the specified Android model, and then flash the machine.

5.4 Firefox OS porting

Based on the above analysis, it is easier to port Firefox OS to other hardware platforms if Android BSP is provided. The key to its work is to compare and port the Android hardware abstraction layer and the Firefox OS hardware abstraction layer, that is, to improve the adaptation of the Gonk layer, you only need to make minor changes to the upper Gecko and Gaia layers.

Summary

◆ The Firefox OS project started a little more than a year ago and is still in fast iteration. It is preparing to launch the first mobile phone in the market.

◆ Firefox OS is strongly supported by Mozilla and developed in the spirit of open and open source. It can give full play to its ability to understand core Web technologies, it can be guided and recognized and supported by some Web communities, which is conducive to the establishment of the ecosystem.

◆ However, the Web application platform has not been fully recognized in the mobile market, and there are some market risks, along with the knowledge of Chrome OS and HP webOS, this also takes time to gain market recognition.

◆ Mozilla developers have poor understanding of the hardware platform or system underlying layer and need to work closely with hardware vendors. Fortunately, they chose the hardware abstraction layer of Android to reduce the resistance of Firefox OS in the initial stage.

◆ The Gecko engine in Firefox OS is currently at a disadvantage in mobile browser competition, including its multi-process model, new rendering and synthesis architecture, memory management, and smooth operation, all of which need to be further strengthened and verified. Mozilla has talented engineers and a unique Hack spirit, but the world has witnessed the emergence of Firefox browsers. Now they are brave enough to face all these issues and are working hard to tackle them. I believe they will bring another surprise to the world. Let's wait and see.

◆ The content in this article is only a preliminary analysis of Firefox OS. Due to time and personal reasons, it may be incorrect and is for your reference only. I hope you can understand and correct it, if you want to learn more about and pay attention to Firefox OS, you can discuss with the author.

References

1. https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_ OS

2. https://wiki.mozilla.org/B2G

3. http://www.mozilla.org/en-US/b2g/

4. https://developer.mozilla.org/en-US/docs/Apps/Getting_Started

________________________________________

Author: Zhong xueshu (sukzhong@gmail.com)

Modify: Pan aimin

Unit: Shanda Innovation Institute

Time: 2012.10

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.