B2G/Porting: Difference between revisions

no edit summary
No edit summary
 
(10 intermediate revisions by 5 users not shown)
Line 1: Line 1:
= B2G porting guide for new build system =
This page is for porting projects management. It should help you to setup a porting project and make it successful.
It then list all porting projects by device and progress.


This is a guide to support new device to [https://github.com/mozilla-b2g/B2G new B2G build system].
If you are looking for a guide to support a new device, you should check the MDN page [https://developer.mozilla.org/en-US/Firefox_OS/Developing_Firefox_OS/Porting Porting Firefox OS].
The actual porting details might differ a lot between different devices.


== Clone B2G repo ==
= Setting up a new porting project =


<pre>
== Announce your project ==
$ git clone https://github.com/mozilla-b2g/B2G.git
</pre>
 
== Create local backup of the original Android system ==
 
<pre>
$ mkdir my_device_backup
$ cd my_device_backup
$ adb pull /system system
</pre>
 
== Add new device in config.sh ==
 
You may refernece "galaxy-s2" in config.sh as a template.
 
== Create manifest file "default.xml" for new device ==
 
Add all required repos to manifest file for the new device.
You can reference https://github.com/mozilla-b2g/b2g-manifest as a template,
there are different branches for each device.
The [https://github.com/mozilla-b2g/b2g-manifest/tree/galaxy-s2 galaxy-s2] branch can be used as a reference.


== Create configuration tree for new device ==
The first thing to do is to get in touch with a mozillan responsible for porting, device or that already has port a device. You can do that over IRC channel [irc://irc://moznet/fxos #fxos] and ask for Dietrich Ayala (:dietrich).


You need to create a new configration tree for new device at device/<manufacturer>/<device_id>
== Build your project's tools ==


The tree should include at least:
You can then start by building your device porting project management wiki page as a sub page of the [https://wiki.mozilla.org/FirefoxOS/ Firefox OS one].
* AndroidBoard.mk
You can use the [https://wiki.mozilla.org/FirefoxOS/Fairphone Fairphone] one as a reference.
* AndroidProducts.mk
* BoardConfig.mk
* extract-files.sh
* full_<device_id>.mk
* idc files for touchscreen
* init files (init.rc, init.<target>.rc, uevent.rc...)


The content might differ a lot between devices, especially "BoardConfig.mk" and "extract-files.mk".
The proposed structure of that page is:
It requires some hacking/testing/debugging to know which binary blobs should be extracted.
*Initial project todo list: everything you have to do before starting porting. After building this page that could be:
If you can find some existing reference on [http://www.cyanogenmod.com CyanogenMod] for the device, it will speed up the porting progress.
**Contact the device maker: coordinate and improve collaboration.
The [http://forum.xda-developers.com XDA Forum] is also a good place to discuss and check for resource.
**Announce your project on the dev-fxos mailing-list.
 
*Device targeted: make it clear which one it is, especially if there are different versions, releases, editions.
== The need to rebuild boot.img ==
*Resources:
 
**Project coordinator & evangelist: Provide your name and ways to contact you.
Basically no change is required for kernel, the purpose to rebuild boot.img is for required init.rc change.
**Technical lead: if that's not you, please identify who the contact is.
 
**Wiki page: link here the page you are creating
=== Required change on init.rc ===
**IRC channel: link here any specific IRC relevant channel. You can find any relevant information on the [https://wiki.mozilla.org/IRC IRC wiki page].
 
**Mozillian group: if you are a [https://mozillians.org/ mozillian] (or became one) you can join/setup a group about this device.
Main things to modify on init.rc:
**Meta/tracking bug: Open a bug in [https://bugzilla.mozilla.org/enter_bug.cgi bmo] with Product=Firefox OS & Component=General.
* Import init.b2g.rc
**Porting community page: link to any porting page like XDA-Forums.
<pre>
**SUMO thread: if there is one started, list it here.
on early-init
*Contributing: Tell others that want to get involved in the project how to.
    start ueventd
*Progress:
    import /init.b2g.rc
**Starting point: Update the state of the porting or give info about anything that gives a root to your porting project.
</pre>
**Bug table: Add a bugzilla table to give an overview of the bugs. Adapt the following code and add it to you wiki page:
 
* chmod 755 on /system/b2g/b2g, /system/b2g/updater, /system/b2g/plugin-container
<pre>
<pre>
chmod 0755 /system/b2g/b2g
$<bugzilla>
chmod 0755 /system/b2g/updater
$    {
chmod 0755 /system/b2g/plugin-container
$        "blocks": "1_your_bug_number_2",
$        "include_fields": "id, summary, status, blocks, whiteboard, cf_blocking_b2g"
$    }
$</bugzilla>
</pre>
</pre>
*Other ports: Link to Android, Cyanogen, Ubuntu... ports that could be an helping resource or give the state about porting for this device.
*Additional information: Add here links to related pages that can't enter other items.


You might want to modify from init.rc of new device, instead of using the init.rc provided by the
== Device info requirements ==
build system.  In this case, you need to set TARGET_PROVIDES_B2G_INIT_RC in BoardConfig.mk.


=== Prebuilt kernel vs building kernel from source ===
(More to come soon)


A prebuilt kernel can be used, or you may also build kernel from source by the build system.
== Contributing ==
To build kernel by build system, add AndroidKernel.mk and kernel config in device configuration tree.
We weclome you involvement in improving this starting guide.


The [https://github.com/andreasgal/B2G/tree/master/glue/gonk/device/toro/maguro maguro] on old build system is an example that builds kernel from source.
= Start porting =
 
== Add new device in flash.sh ==
 
Add the new device, depending on what flash tool required by new device.
 
== Config/build/flash for new device ==
 
<pre>
$ ANDROIDFS_DIR=my_device_backup ./config.sh <device_id> default.xml
$ ./build.sh
$ ./flash.sh
</pre>


== Test and debug ==
To start doing the technical work, you can follow the guide to support a new device on MDN page [https://developer.mozilla.org/en-US/Firefox_OS/Developing_Firefox_OS/Porting Porting Firefox OS].


Have fun!
= Porting projects =


= Frequency asked questions =
== Projects underway ==


To be added.
*[https://wiki.mozilla.org/FirefoxOS/Fairphone Fairphone]
*(More to come: this section is under construction)
canmove, Confirmed users
7,108

edits