Nexus 4 builds

(Alastair Pharo) #1

Hi Nexus 4 users,

First some disclaimers.

  1. I, the compiler of these images, have no affiliation with Mozilla. These are not official images, and nothing I say should be interpretted as being “official” in any way.
  2. As far as I personally am concerned, if you decide to flash your device, you are doing so at your own risk.
  3. B2G OS is not ready for use as a primary phone OS. The images shared here for those early birds who are interested in trying things out in their current state. You may find that the resulting system is not functional.

Blobfree build

Here’s a link for a blobfree build of B2G OS for the Nexus 4 (mako). A blobfree build doesn’t have any non-free binary blobs in it, so it’s not able to run by itself. The idea is that you should be able to use the B2G Installer to install this onto a device that already has the blobs. This image is untested, so I’m afraid I have no idea whether it works, and I haven’t tried using the B2G Installer either, so I can’t help you there.

The build is based on KitKat, so in order to use it your phone would need to have KitKat installed (otherwise you will have the wrong binary blobs). Also, my understanding is that the B2G installer will completely wipe your phone, so you should back-up anything important before trying this route. Please be aware once again that this build is not really usable as a day-to-day phone OS.

Download here.

Flashable ROM

This is a completely unsupported ROM which you may be able to install using ClockworkMod or TWRP (I have installed it myself using MultiROM). Please note that Mozilla does not support the use of MultiROM. If you want help from Mozilla, you should use the B2G Installer (see above).

Download here.

Building your own ROM

You can make your own ROM like the one above following the standard build instructions on MDN with the following changes. Please note once again that Mozilla does not support this.

Firstly, add these lines to your .userconfig (the “random settings” aren’t strictly necessary):

# This line tells the build system to put the boot image in the FOTA file
export B2G_FOTA_PARTS="/boot:boot.img"

# This makes sure gaia is included in the FOTA build
export VARIANT=userdebug

# These are some other random settings that seem to work well on the Nexus 4
export PRODUCTION=1 #to have a user build

You then build the gecko-update-fota-full target, instead of making a normal build, by executing

./ gecko-update-fota-full

The ROM will end up at out/target/product/mako/fota/full/; you can then use abd sideload or whatever to install it.

If you find that the resulting system thinks that you have no SIM card installed when you do, it may be necessary to do the “Run Restorecon” option in your TWRP, etc.

Note again that B2G OS is not yet fully functional, so some of the issues you will experience are shared by all devices.

(Lissyx) #2

Thanks! It’s not that Mozilla does not likes full ROM link, it is that by default it would be illegal. Now, Nexus 4 and 5 are a different story and the lawyers cleared it in the past. Since nothing has moved on that technically, that still holds.

It means that if you want, you can download a complete Nexus 5 L image from TaskCluster.

Now, by means of testing, consistency and ease of use, you could follow the documentation on MDN and provide a PR to add support for your blobfree build in B2G Installer :slight_smile:

(Lissyx) #3

Given you instructions, I think there is a few things you should change. I guess your point is to instruct how to build a recovery image that installs. May I ask why you are not recommending producing a fullimg recovery zip ?

Given you already bundle boot.img, why not just bundling the whole system ? That target is defined at And then you can achieve this with B2G_FOTA_FULLIMG_PARTS="/boot:boot.img /system:system.img /recovery:recovery.img" or the default that includes the cache partition which is good for a first flash.

Maybe it is because of the use of MultiROM, I have not checked if that has any impact here. If not, it might be simpler to use this.

(Alastair Pharo) #4

Hi @lissyx,

Firstly, I just want to say that I’ve pretty much just arrived at the method I use now by trial and error - I started using Firefox OS on my Nexus 4 probably about two years ago thanks to @yousef’s builds on the XDA forum (thanks!). Subsequently I became interested in doing my own builds in order to be able to get updates quickly. The gecko-update-fota-full approach was what I landed on because it worked for me. It probably isn’t the best way to this at all. I’m certainly more than happy to alter the OP to make it more inline with whatever the best practice is!

Concerning getting the above Blobfree build into the installer; I suppose I ought to test it before I open any PR! At present though I’m not in a position to wipe my device, so I can’t do so …

I have tried to use the fullimg target before, but as you guessed, it didn’t seem to work with MultiROM. Not sure why exactly. The good thing about MultiROM is that whilst it’s definitely a bit of a hack, it enables one to try out different OSes without losing data or the functionality of their main OS. This seems especially important to me for B2G OS at the moment, given that it’s at such an early stage at present. So MultiROM compatibility seems like a good idea.

The reason I don’t bother including the recovery partition in my builds is that I already have a custom TWRP recovery (required in order to be able to use MultiROM). I’m not sure what would happen if I did include the recovery, but for my own use case, I don’t need it, so I don’t bother.

As for the cache, I really wasn’t sure what the function of the cache partition was in B2G. Given that there didn’t seem to be any consequences to not adding it, I just left it out. Again, I did this as a totally uninformed person just trying to get something I could use.

Anyway, from what you are saying perhaps I should try building the fullimg build again with the cache and recovery and see if the install is still problematic or not.

Perhaps given his former experience building ROMs, @yousef will have some notes on what a useful Nexus 4 ROM ought to include?

(Lissyx) #5

Ok, just note we do not support the use of multiboot. Good if it works for you this way :slight_smile:

(Alastair Pharo) #6

Ok, so I’ve updated the OP now. Hopefully the post is no longer misrepresenting Mozilla, and also makes clear that most the content there is not supported by anyone.

Concerning making a change to the B2G Installer, I see that at present the installer looks for nexus-4-kk blobfree images in Taskcluster. Is there any prospect of Taskcluster resuming those builds? I’m sure a robot that compiles images nightly will be more reliable than me compiling every now and then when I feel like it…

(Lissyx) #7

No, we cannot have tons of builds on TaskCluster, because it consumes resources. So we have kept the strict minimum of Z3c KK port for KK/CAF builds and Nexus 5 L for AOSP/L builds.