On Wed, Nov 27, 2013 at 02:54:05PM +1100, Petros wrote:
I bought a ZTE phone with Firefox on it (from eBay for
ca. $90, still
on the way to me),
mostly out of curiosity.
I am browsing around about licensing and source code.
Well, I find some information on the Mozilla website, with some hints
about using Linux and some components. I have not find "the" source
code yet.
I am curious about it, how much of it is "vanilla Linux" and userland,
how to get a shell, how to extend it, how to update etc.
Do you know more about it?
for fun I ported FirefoxOS (aka b2g/Boot to Gecko) to an older armv6
ZTE phone(*). it was a while ago, but +/- b2g having changed recently
I think I can still remember roughly how it works...
Firefox OS is Android based, but the user-visible layer has been
replaced. in particular surfaceflinger (like X11 + windowmanager) has
been replaced by gonk (a simple display server that uses android APIs)
with a lot of help from mozilla's gecko. they're started from the
android init system and /system/bin/b2g.sh
all the mozilla source is open eg.
https://github.com/mozilla-b2g/B2G
with ok guides
https://developer.mozilla.org/en-US/Firefox_OS/Porting
and there are plenty of patches for b2g in their normal bugzilla
https://bugzilla.mozilla.org/
using Android as a base ensures most hardware will be compatible. in
particular it means they can drive the GPU binary blob enough to get 2d
and 3d surfaces that gecko can render to. I guess they could re-visit
the android dependency later if it takes off...
FirefoxOS apps are html5 (IIRC) and the OS GUI code 'gaia' (settings,
desktop, inbuilt apps like phone dialer, contacts, etc.) is largely
css/js. android mostly uses sandboxed java for both.
kernel, busybox etc. are all just the same as android or cyanogenmod
for the phone.
almost all the native android daemons are still running too - eg. rild,
rilproxy (phone), netd (like NetworkManager), vold (fs mounts),
servicemanager (like init), drmserver, mediaserver, wpa_supplicant etc.
and gaia understands how to talk to these to make the phone function.
you can likely get a root shell by using a USB cable and 'adb' the same
as android. IIRC firefox OS phones ship with root shell enabled, but if
you happen to get a '%' prompt then try su. otherwise it's exploit time.
from the shell prompt it's all fairly 'linux like' (+/- busybox instead
of real tools, and the init system), same as android.
as for extending and updating I'm not sure how firefox folks want you to
handle it. updating the gaia code should be pretty easy - especially as
they seem to put that onto the read-write /data part of the phone.
the OS and gecko/gonk parts on /system would usually need a re-flash of
some sort.
overall it's mostly the same as android modifying. ie. usually quite a
pain as most of the 'good bits' with early or root access are in the
initramfs ramdisk and/or on the read-only /system. it's all quite
possible if you have root, but some of it depends on how much of the
phone's android-OS src you have from ZTE. it also depends whether you
want gui/phone/camera/wifi parts to work, and how much time you have to
spend.
I digress, but in general if you just want a small linux computer then
things like RPi, cubieboard are somewhat easier to get real OS's
(fedora, ubuntu, etc.) running on. even then, accelerated graphics
remains problematic. I think all small arm thingies still have binary
blob graphics, but some have linux/glibc blobs instead of android
blobs(?). kernel versions are typically frozen because of these blobs.
lima and freedreno etc. are making progress fast though :)
cheers,
robin
(*)
http://www.modaco.com/topic/364052-devrom-firefox-os-for-zte-v9-alpha-not-f…