On 2/5/14, 5:06 AM, Jose Vidal wrote:
Hi everyone,
What's the Firefox OS source code directory tree structure ?
Hey Jose,
The structure of the directory in which you build Firefox OS is indeed
quite hard to understand. The directory does several things at once and
then the Mozilla team decided that, since it was a mess anyway, they
were welcome to make more of a mess of things.
You need to understand, first, that the "Firefox OS directory" will do
several things:
* it is a "repo directory" that will be used by the Android project's
'repo' tool which means that:
- it will have, by default, a hidden .repo/ dir with:
1. a new copy of the 'repo' tool
2. a manifest.xml file describing the project
3. a directory full of Git version control repositories
- it will end up with *working copies* of all the source code used
to build the project
* it is a "source code directory" which you could use to work on the
source code of the different projects, which you could do either
using the 'repo' tool to manage work on many of the projects at
once or using the 'git' tool to work on a single or few projects
together,
* it is a "Make directory tree" in which the source code will all be
built using the Android project's Makefile system,
* it is a "build directory" which will, after the build, include the
output directories with the source code results, notably in the
./out/ and ./gecko_objdir/ directories,
* it is a "runtime directory" which holds a mess of undocumented
scripts used to run and profile the result of a build.
Note also that the project is building not just Firefox OS but a bunch
of Android tools including the 'adb' and 'fastboot' tools to interact
with a device over USB, some tools used to assemble images, and a bunch
of profiling tools based on Eclipse. This latter means that the
directory requires two build chains, one for Firefox OS based on the
architecture of the device you are targeting and another for the tools
based on the architecture of the machine on which you are running the build.
Note also that the contents of the directory will depend on the device
you are targeting since each device gets a different 'manifest.xml' file
listing the project contents.
Finally, note the the builds are all dysfunctional to various,
undocumented, extents. By default, the builds only go so far and then
expect you to blindly trust the ./flash.sh script which will copy over
what you have built to the device, something that only will work if you
have root permissions on the phone. The builds will not, by default,
build the four cannoical files:
boot.img
recovery.img
system.img
userdata.img
but instead will try to copy the files over to the system/ and data/
partitions on the device. There are a mess of undocumented targets for
'make' that you can magically call to try and make those images, except
that for some projects you can't actually generate the boot.img file.
(Actually, forget the recovery.img; you should be able to leave that
alone and use the one on your phone.)
If you take the time, it turns out you can start from an empty directory
to build Firefox OS!
Note that this is only a vague outline: I don't want to take the time to
look all this up right now. I spent a month and a half working on a
build tool with better documentation that the scripts provided by
Mozilla but got discouraged when I discovered that the scripts silently
skipped building the kernel on the device I was working on building.
From what I remember, the steps are something like:
1) use curl or wget to get the repo tool launcher (a single file)
wget src-of-repo ./bin/.
2) run the repo launcher pointing at the source of manifest files
./bin/repo -u .... -b ... -m ....
=> this will add to the repo directory (.repo/ by default)
(1) a full copy of the repo tool
(2) a copy of the manifest.xml at the right branch
3) run 'repo sync' with the right flags
=> this will get a clone of all the git projects and put the
git repository in the .repo/projects/ dir and put a working
copy of the source code in the top level directory
(WARNING THIS IS AROUND 10GB OF CODE!)
4) configure the system
5) optionally copy files from a working device locally
6) build the system by (1) setting up the right environmental
variables and (2) running make
(WARNING THIS WILL TAKE A WHILE AND WILL FIRST TRY TO SYNC
UP THE SOURCE CODE OVER THE NETWORK.)
7) get the build results onto a device. This depends on how deeply
you built the projects: you may brutally copy files over to the
existing partitions of the device or you might actually use the
'fastboot' tool to copy over full images overwriting the
partitions.
The scripts in the B2G git project (the one on GitHub not the one on
Mozilla.org) aim to 'facilitate' this but really are not targeted at
third party users so use them at your own risk.
Eventually, we need to write an industrially robust set of project build
scripts for Firefox OS usable by all those working on the project: those
who just want recent builds, those who want to customize their builds,
those working on the Firefox OS source code, those working on porting to
new devices, those working on building production releases for
distribution, ...
For now, the project leaves you on your own to figure things out.
cheers,
~adrian
BTW, you will have to understand the Android setup pretty well to
understand what is going on. Meanwhile a lot of that documentation has
been withdrawn by Google, supposedly because it was out of date, but
possibly because they want to limit third party forks like Firefox OS.
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g