B2G/Porting: Difference between revisions
(Created page with "= B2G porting guide for new build system = This is a guide to support new device to [https://github.com/mozilla-b2g/B2G new B2G build system]. The actual porting details might d...") |
No edit summary |
||
| Line 29: | Line 29: | ||
The [https://github.com/mozilla-b2g/b2g-manifest/tree/galaxy-s2 galaxy-s2] branch can be used as a reference. | The [https://github.com/mozilla-b2g/b2g-manifest/tree/galaxy-s2 galaxy-s2] branch can be used as a reference. | ||
== Create | == Create configuration tree for new device == | ||
You need to create a new configration tree for new device at device/<manufacturer>/<device_id> | |||
The tree should include at least: | |||
* AndroidBoard.mk | * AndroidBoard.mk | ||
* AndroidProducts.mk | * AndroidProducts.mk | ||
| Line 45: | Line 47: | ||
The [http://forum.xda-developers.com XDA Forum] is also a good place to discuss and check for resource. | The [http://forum.xda-developers.com XDA Forum] is also a good place to discuss and check for resource. | ||
== | === How to create BoradConfig.mk === | ||
To be added. | |||
=== How to create extract-files.sh === | |||
To be added. | |||
=== How to create idc files for touch screen === | |||
To be added. | |||
== The need to rebuild boot.img == | |||
Basically no change is required for kernel, the purpose to rebuild boot.img is for required init.rc change. | Basically no change is required for kernel, the purpose to rebuild boot.img is for required init.rc change. | ||
=== Required change on init.rc === | |||
Main things to modify on init.rc: | Main things to modify on init.rc: | ||
* Import init.b2g.rc | * Import init.b2g.rc | ||
<pre> | |||
on early-init | |||
start ueventd | |||
import /init.b2g.rc | |||
</pre> | |||
* chmod 755 on /system/b2g/b2g, /system/b2g/updater, /system/b2g/plugin-container | * chmod 755 on /system/b2g/b2g, /system/b2g/updater, /system/b2g/plugin-container | ||
<pre> | |||
chmod 0755 /system/b2g/b2g | |||
chmod 0755 /system/b2g/updater | |||
chmod 0755 /system/b2g/plugin-container | |||
</pre> | |||
You might want to modify from init.rc of new device, instead of using the init.rc provided by the | You might want to modify from init.rc of new device, instead of using the init.rc provided by the | ||
build system. In this case, you need to set TARGET_PROVIDES_B2G_INIT_RC in BoardConfig.mk. | build system. In this case, you need to set TARGET_PROVIDES_B2G_INIT_RC in BoardConfig.mk. | ||
A | === Prebuilt kernel vs building kernel from source === | ||
To build | |||
A prebuilt kernel can be used, or you may also build kernel from source by the build system. | |||
To build kernel by build system, add AndroidKernel.mk and kernel config in device configuration tree. | |||
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. | 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. | ||
Revision as of 13:02, 31 May 2012
B2G porting guide for new build system
This is a guide to support new device to new B2G build system. The actual porting details might differ a lot between different devices.
Clone B2G repo
$ git clone https://github.com/mozilla-b2g/B2G.git
Create local backup of the original Android system
$ mkdir my_device_backup $ cd my_device_backup $ adb pull /system system
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 galaxy-s2 branch can be used as a reference.
Create configuration tree for new device
You need to create a new configration tree for new device at device/<manufacturer>/<device_id>
The tree should include at least:
- AndroidBoard.mk
- 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". It requires some hacking/testing/debugging to know which binary blobs should be extracted. If you can find some existing reference on CyanogenMod for the device, it will speed up the porting progress. The XDA Forum is also a good place to discuss and check for resource.
How to create BoradConfig.mk
To be added.
How to create extract-files.sh
To be added.
How to create idc files for touch screen
To be added.
The need to rebuild boot.img
Basically no change is required for kernel, the purpose to rebuild boot.img is for required init.rc change.
Required change on init.rc
Main things to modify on init.rc:
- Import init.b2g.rc
on early-init
start ueventd
import /init.b2g.rc
- chmod 755 on /system/b2g/b2g, /system/b2g/updater, /system/b2g/plugin-container
chmod 0755 /system/b2g/b2g chmod 0755 /system/b2g/updater chmod 0755 /system/b2g/plugin-container
You might want to modify from init.rc of new device, instead of using the init.rc provided by the build system. In this case, you need to set TARGET_PROVIDES_B2G_INIT_RC in BoardConfig.mk.
Prebuilt kernel vs building kernel from source
A prebuilt kernel can be used, or you may also build kernel from source by the build system. To build kernel by build system, add AndroidKernel.mk and kernel config in device configuration tree.
The maguro on old build system is an example that builds kernel from source.
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
$ ANDROIDFS_DIR=my_device_backup ./config.sh <device_id> default.xml $ ./build.sh $ ./flash.sh
Test and debug
Have fun!
Frequency asked questions
To be added.