blog darkness...

words, music, food

Building Firefox OS (B2G) for the Nexus 5 (Hammerhead) using MultiROM

This is documented elsewhere, but only in bits and pieces and in various languages.  Basically, instead of using the flash utility that comes with B2G, we want to build a zip file that we can flash from multirom.

  1. Set up your build environment.  Note that you're going to need plenty of disk space here.  On my linux machine, it currently takes up close to 20GB.
  2. Pull from git and configure for your device.  This will take a little time.  The only sticky point for me was that i needed an old version of make (3.81-8.2 for an ubuntu derivative).
  3. Build.  For me, this was as simple as running build.sh, no options.  Your results may vary.
Now, you have a built version for your phone -- how to get it into a zip that will do the job? Starting in your cloned B2G directory:
mkdir rom
cd rom
rsync -rL ../out/target/product/hammerhead/system .
rsync -rL ../out/target/product/hammerhead/data .
cp ../out/target/product/hammerhead/boot.img .
Above we're copying our built boot image and system and data directories.
mkdir -p META-INF/com/google/android/
cp ../tools/update-tools/bin/gonk/update-binary META-INF/com/google/android/
curl http://bluishcoder.co.nz/b2g/updater-script >META-INF/com/google/android/updater-script
Above we're borrowing the updater script from bluish coder and setting up the META-INF path that recovery will look for when trying to flash. For the next step, we're going to use signapk.jar.  If you already have this setup, this should be straight forward.  If not, you can read a how-to guide here.
zip -r9 b2g.zip *
java -jar ../prebuilts/sdk/tools/lib/signapk.jar 
            ../build/target/product/security/testkey.x509.pem 
            ../build/target/product/security/testkey.pk8 
             b2g.zip signed_b2g.zip
Now our signed_b2g.zip is ready to copy to our phone and flash with TWRP. Yay! 2015-11-28-08-53-10 2015-11-28-08-53-01
blog comments powered by Disqus