FirefoxOS/RPiB2: Difference between revisions

Correction in a command line
(Reduce boot partition size requirements)
(Correction in a command line)
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== State of the project ==
<font color="red">'''READ FIRST'''</font>
This project is officially on HOLD. It will be active again after transition branch is completely merged. If you want to know more details about this project and next steps, please check this [http://gioyik.com/p/raspberrypi-final-state blog post]
== About The Project ==
== About The Project ==
[[File:Fxpi.png|250px|thumbnail|right]]
[[File:Fxpi.png|250px|thumbnail|right]]
Line 40: Line 45:
* Not all device capabilities are exposed through Web APIs  
* Not all device capabilities are exposed through Web APIs  
* Small/integrated display not planned to support soon
* Small/integrated display not planned to support soon
== Follow-up projects ==
Working on something with a Raspberry Pi + Firefox OS? Let us know. :)


== Development Sprints ==
== Development Sprints ==
Line 58: Line 60:
* '''Android devices files for RP2''' <font color="green">'''[DONE]'''</font>
* '''Android devices files for RP2''' <font color="green">'''[DONE]'''</font>
** B2G build system uses AOSP that requires a repo with device configuration. Folder and files like AndroidBoard.mk, AndroidProducts.mk, BoardConfig.mk, device_rpi2.mk, recovery.fstab, and more will be created or adapted to RPI 2 architecture
** B2G build system uses AOSP that requires a repo with device configuration. Folder and files like AndroidBoard.mk, AndroidProducts.mk, BoardConfig.mk, device_rpi2.mk, recovery.fstab, and more will be created or adapted to RPI 2 architecture
* '''Make RPI 2 kernel build from source''' <font color="orange">'''[WORKING]'''</font>
* '''Make RPI 2 kernel build from source''' <font color="green">'''[DONE]'''</font>
** Create a sync configuration for BoardConfig.mk file to build the kernel and any required kernel modules automatically.  
** Create a sync configuration for BoardConfig.mk file to build the kernel and any required kernel modules automatically.  
* '''Create manifest file for RPI 2''' <font color="orange">'''[WORKING]'''</font>
* '''Create manifest file for RPI 2''' <font color="green">'''[DONE]'''</font>
** Create the rpi2.xml in b2g-manifest with all the sources for the first build
** Create the rpi2.xml in b2g-manifest with all the sources for the first build


Line 86: Line 88:
* '''Gecko Port''' <font color="green">'''[DONE]'''</font>
* '''Gecko Port''' <font color="green">'''[DONE]'''</font>
** Having a basic Android base system the next priority is get Gecko working. This will help to identify easily more problems in the final ROM
** Having a basic Android base system the next priority is get Gecko working. This will help to identify easily more problems in the final ROM
* '''Graphics support'''
* '''Graphics support''' <font color="green">'''[DONE]'''</font>
** Use hardware default renderer.  
** Use hardware default renderer.  
** In this project there is a challenge, and that’s the correct graphics support. RPI 2 has a VideoCore with a Broadcom BCM2739 that changed a lot in this latest version of the RPI 2. Will be necessary take a look of Broadcom reference guides <font color="orange">'''[WORKING]'''</font>
** In this project there is a challenge, and that’s the correct graphics support. RPI 2 has a VideoCore with a Broadcom BCM2739 that changed a lot in this latest version of the RPI 2. Will be necessary take a look of Broadcom reference guides  
* '''Update documentation'''
* '''Update documentation''' <font color="green">'''[DONE]'''</font>
** Create page about Firefox OS architecture on the Raspberry PI 2
** Create page about Firefox OS architecture on the Raspberry PI 2


==== Phase 2 ====
==== Phase 2 ====
* '''Input support'''
* '''Input support''' <font color="blue">'''[PARTIAL DONE]'''</font>
** Keyboard and mouse support is one of the P1 for Raspberry PI port. The basic support for Keyboard would be on early stages of Android building.
** Keyboard and mouse support is one of the P1 for Raspberry PI port. The basic support for Keyboard would be on early stages of Android building.
* '''Storage support'''
** Mouse support: https://bugzilla.mozilla.org/show_bug.cgi?id=1082892
* '''Storage support''' <font color="green">'''[DONE]'''</font>
** Add support to SD Card recognition and USB storage devices
** Add support to SD Card recognition and USB storage devices
* '''Connection support'''
* '''Connection support''' <font color="blue">'''[PARTIAL DONE]'''</font>
** Work on WiFi and Ethernet support and add listeners for every time you plug or unplug it to the board. Usually it recognizes Ethernet connection if is connected before booting.
** Work on WiFi and Ethernet support and add listeners for every time you plug or unplug it to the board. Usually it recognizes Ethernet connection if is connected before booting.
* '''ADB Push'''
* '''ADB Push''' <font color="green">'''[DONE]'''</font>
** Enable support to push apps by ADB connection
** Enable support to push apps by ADB connection


==== Phase 3 ====
==== Phase 3 ====
* '''Generate complete/stable/usable Firefox OS build'''
* '''Generate complete/stable/usable Firefox OS build''' <font color="green">'''[DONE]'''</font>
** After all the base system is working and running, I will create builds to distribute and publish them.
** After all the base system is working and running, I will create builds to distribute and publish them.
* '''Flashing files''' <font color="green">'''[DONE]'''</font>
* '''Flashing files''' <font color="green">'''[DONE]'''</font>
** The Raspberry PI could not be flashed correctly with common Fastboot method, is necessary to create a filesystem that will be copied to the SD card
** The Raspberry PI could not be flashed correctly with common Fastboot method, is necessary to create a filesystem that will be copied to the SD card
* '''Update documentation'''
* '''Update documentation''' <font color="green">'''[DONE]'''</font>
** Update flashing guide with steps for Raspberry PI 2
** Update flashing guide with steps for Raspberry PI 2


==== Phase 4 ====
==== Phase 4 ====
* '''Gaia Port'''
* '''Gaia Port''' <font color="green">'''[DONE]'''</font>
** The Gaia port will be ready only when the graphics support is done, added to this, maybe will be some display/resolution limitations if the graphic support is not fully implemented or there are missing parts.
** The Gaia port will be ready only when the graphics support is done, added to this, maybe will be some display/resolution limitations if the graphic support is not fully implemented or there are missing parts.
* '''Remove unnecessary apps'''
* '''Remove unnecessary apps'''
** Apps like Radio, Dialer, Messages and others are not necessary due Raspberry PI 2 itself doesn’t have hardware components to be used with those apps.
** Apps like Radio, Dialer, Messages and others are not necessary due Raspberry PI 2 itself doesn’t have hardware components to be used with those apps.
* '''Update documentation'''
* '''NOOBS installer''' <font color="green">'''[DONE]'''</font>
** Create page with benchmarks of the port
** Add support to install B2G using NOOBs installer
** Create page about Known Issues with Raspberry PI 2 builds and how to fix common problems
* '''Update documentation''' <font color="orange">'''[WORKING]'''</font>
* '''Video review (?=optional)'''
** Blog post on Hacks Blog
** Produce a short video reviewing the state of Firefox OS on Raspberry PI 2
* '''Benchmark report (?=optional)'''
** With a working/stable build would be great to create Benchmark reports to show improvements on performance and speed
 
== Getting Started ==
 
0. You need a Raspberry Pi B+ 2, of course. :)
 
1. TBD


== Build From Source ==
== Build From Source ==
Line 148: Line 142:


  cd B2G
  cd B2G
  ./config.sh rpi2b
  ./config.sh rpi2b-l


The config.sh step can take quite a while, because it downloads a large amount of data. Finally, build b2g
The config.sh step can take quite a while, because it downloads a large amount of data. Finally, build b2g
Line 161: Line 155:


You need a 4Gb SD card at least, if has more space better. Then create partitions and copy the files to let the Raspberry PI boot Firefox OS.
You need a 4Gb SD card at least, if has more space better. Then create partitions and copy the files to let the Raspberry PI boot Firefox OS.
=== Configure UDEV rules for the SD card ===
By configuring udev rules for the specific SD card you are going to use for B2G, you will avoid the need to pass via root access (e.g., '''sudo dd''') to be able to copy data. This also limits the risks of doing '''dd''' to the wrong device and mess with everything. This is documented for use with a sd card integrated reader, but this should be able to work elsewhere.
First, plug your sdcard and identify its serial:
$ udisksctl status
MODEL                    REVISION  SERIAL              DEVICE
--------------------------------------------------------------------------
[...]
SL08G                              0xa0442a9f          mmcblk0
So in this case, '''/dev/mmcblk0''' has serial number '''0xa0442a9f'''. You can now unplug the card for now.
The populate a file in '''/etc/udev/rules.d/''', let be its name '''52-mmcblk.rules'''. And put the following content:
# µSD B2G
SUBSYSTEM=="block", SUBSYSTEMS=="mmc", DRIVERS=="mmcblk", ATTRS{serial}=="0xa0442a9f", MODE="0666", GROUP="plugdev"
Make sure you have '''ATTRS{serial}=="0xa0442a9f"'''. Rule will match any '''mmcblk''' exposed device whose attribute serial is 0xa0442a9f. If it matches, then it will set permissions 0666 and group plugdev. Save this file, and issue a udev reload:
# udevadm control --reload
Now, if you replug the sdcard, it should be set with the proper permissions in /dev.


=== Partitions for the SD card ===
=== Partitions for the SD card ===
Line 171: Line 188:
  data (Partition 4) = Size [Rest of free space] = format as ext4
  data (Partition 4) = Size [Rest of free space] = format as ext4


=== Copying data to SD card ===
=== Installing on the SD card ===


Copy the following files to each partition.
For a first time installation, you will have to flash all partitions. Images have been produced in the '''out/target/product/rpi2b''' directory and you should flash:
# boot.img to Partition 1
# system.img to Partition 2
# cache.img to Partition 3
# userdata.img to Partition 4


1. Everything inside '''device/raspberrypi/rpi2b/boot/''' is copied into '''boot (Partition 1)'''
Please proceed with the '''dd''' command (and replace '''file''' with the proper file name):


  device/raspberrypi/rpi2b/boot/* => boot
  dd if=file of=/dev/XpY bs=1m


2. '''zImage''' is copied into '''boot (Partition 1)'''
Be sure of check that everything is copied successfully on the partition. For this port we create a ''userdebug'' build, so, everything is inside system image. Usually, '''X''' will be the name of your device and '''pY''' should be replaced by the partition number. For example, a SD card reader might expose this as: '''/dev/mmcblk0p1''' for boot partition (Partition 1).


kernel/raspberrypi/rpi2b/arch/arm/boot/zImage => boot
Remember to NOT flash cache and/or userdata images if you are just '''updating''' your system, except if you are sure or instructed to do so. Doing this will result in your data being erased.


3. '''bcm2709-rpi-2-b.dtb''' is copied into '''boot (Partition 1)'''
=== Faster flashing ===


kernel/raspberrypi/rpi2b/arch/arm/boot/dts/bcm2709-rpi-2-b.dtb => boot
You can also make use of '''bmaptool''' to flash faster than with '''dd'''. [http://git.infradead.org/users/dedekind/bmap-tools.git bmaptool repo].


4. '''ramdisk.img''' is copied into '''is copied into '''boot (Partition 1)'''
==== Produce bmap files ====


  out/target/product/rpi2b/ramdisk.img => boot
Once you have built the system, produce bmap files:
  $ bmaptool create -o out/target/product/rpi2b/PARTITION.bmap out/target/product/rpi2b/PARTITION.img


=== Flashing system to SD card ===
You can do this for each '''PARTITION''' that we have: boot, system, cache and userdata.


1. Flash the image'''out/target/product/rpi2b/system.img''' to '''system (Partition 2)''' with '''dd''' command
==== Flashing with bmaptool ====


  dd if=system.img of=/dev/disk# bs=1m
Then flash using bmaptool (here only boot partition):
  $ sudo bmaptool copy out/target/product/rpi2b/boot.img /dev/mmcblk0p1
bmaptool: info: discovered bmap file 'out/target/product/rpi2b/boot.bmap'
bmaptool: info: block map format version 2.0
bmaptool: info: 12288 blocks of size 4096 (48.0 MiB), mapped 2358 blocks (9.2 MiB or 19.2%)
bmaptool: info: copying image 'boot.img' to block device '/dev/mmcblk0p1' using bmap file 'boot.bmap'
bmaptool: info: 100% copied
bmaptool: info: synchronizing '/dev/mmcblk0p1'
bmaptool: info: copying time: 0.6s, copying speed 16.1 MiB/sec


2. Be sure of check that everything is copied successfully on the partition. For this port we create a ''userdebug'' build, so, everything is inside system image.
Using '''dd''' on the same partition reports a write speed of 5.0MiB/s.


== Debugging ==
== Debugging ==
Line 280: Line 310:
Attach the leads as shown below:
Attach the leads as shown below:


[[File:Putty-settings.png]]
[[File:Rpi2-serial-cable-connection.jpg|250px]]


The connections are to the outside pin connections of the GPIO header.  
The connections are to the outside pin connections of the GPIO header.  
Line 289: Line 319:
* The <font color="green">'''green'''</font> lead to RXD.
* The <font color="green">'''green'''</font> lead to RXD.


Now plug in the USB lead and you will see the Pi's power LED should light.  
Now plug in the USB lead and you will see the Pi's power LED should light.


===Boot messages===
===Boot messages===
153

edits