--
Chromium OS Developers mailing list: chromiu...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-os-dev?hl=en
On Tue, 05 Oct 2010 11:47:13 -0700, Greg Spencer <gspe...@chromium.org>
wrote:
for a quick rationale, FEATURES is about the build system, USE and
RESTRICT are about the ebuild itself.
every entry does have the option to + and -, so please clarify the
question there if you have a specific issue.
i doubt there is a tool, there is a great feature request you could make,
that would document all the iuse flags available for all ebuilds available
in the overlay.
the features is part of portage itself. in addition to being part of the
handbook
<http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=3> you
can also use 'man make.conf' inside of the chroot.
-- trevor
On Tue, 05 Oct 2010 11:58:53 -0700, Greg Spencer <gspe...@chromium.org>
wrote:
--
Using Opera's revolutionary email client: http://www.opera.com/mail/
There are quite a few man pages in addition to the some excellent
docs referred to here:
and here:
http://dev.chromium.org/chromium-os/building-chromium-os/portage-based-build#TOC-Further-Reading
The following docs are required reading:
http://devmanual.gentoo.org
http://www.gentoo.org/proj/en/devrel/handbook/handbook.xml
Man pages:
==========
FEATURES (Global config options in general) :
$ man 5 make.conf
RESTRCIT (ebuild config options in general):
$ man 5 ebuild
Portage (build system in general):
$ man 5 portage
Emerge command:
$ man 1 emerge
Ebuild command:
$ man 1 ebuild
Equery command (super awesome command for querying package db):
$ man 1 equery
Show me all the use flags for a particular ebuild
$ equery-<board> uses <ebuild-name>
I often google search using one of the following conditions:
site:gentoo.org
site:devmanual.gentoo.org
site:bugzilla.gentoo.org
Hope that helps:)
Mandeep
[large list of docs...]Hope that helps:)
"Make everything as simple as possible, but no simpler."
- Albert Einstein
Sincere apologies for all the churn on build but I think we're
past all that now. Thanks to anush, davidjames, sosa, zbehan, tgao, and
nsanders we now have a pretty amazing build system. We are able to
build 300+ packages from source using safe (i.e. -fPIE) CFLAGS, for
two different architectures, supporting multiple boards and multiple
different build targets and have a pre-flight build bot (aka
commit queue) which guarantees that a fresh build always works.
For the most part we're using two off-the-shelf tools: repo and portage.
repo is used by Anroid as well as many of its partners and has users
outside of the android community. portage has had 10 tens of development
with thousands of users and a ton of google searchable docs and some
great man pages.
We decided to abstract the mastering step a bit and so wrote our
own scripts there: build_package and build_image. These scripts
are kinda ugly so folks are working on cleaning that up but that won't
happen for a while (mostly to reduce build system churn).
We also created cros_workon to let the build system know which packages
to build from local source and which packages to build from known good
sources.
While gentoo's docs are great ours are OK. So we appreciate it when
folks update/clarify them when they are incorrect.
Sounds like you are really passionate about build and have ideas. The
build team is always looking for 20% help:)
There has been a lot of churn on build over the last few months but its
all been for the better. I think we're at a "happy" place now (minus some
doc cleanup) so would prefer not to rip it all out now.
Folks just need to understand a few commands:
* make/enter_chroot
* build_packages
* build_image
* cros_workon
* git
* repo
* git_cl
Each command solves one problem. There is work in progess to sqash the
first three and the last two. So we should be down to 4 commands.
But not in the short term.
The learning curve for ebuilds is a little steep but necessary. Its
solving a difficult problem. But its well designed and comes with
great documenation (not to mention man pages).
For the most part we're using two off-the-shelf tools: repo and portage.
repo is used by Anroid as well as many of its partners and has users
outside of the android community. portage has had 10 tens of development
with thousands of users and a ton of google searchable docs and some
great man pages.
We decided to abstract the mastering step a bit and so wrote our
own scripts there: build_package and build_image. These scripts
are kinda ugly so folks are working on cleaning that up but that won't
happen for a while (mostly to reduce build system churn).
We also created cros_workon to let the build system know which packages
to build from local source and which packages to build from known good
sources.
While gentoo's docs are great ours are OK. So we appreciate it when
folks update/clarify them when they are incorrect.
Sounds like you are really passionate about build and have ideas. The
build team is always looking for 20% help:)
There has been a lot of churn on build over the last few months but its
all been for the better. I think we're at a "happy" place now (minus some
doc cleanup) so would prefer not to rip it all out now.
Folks just need to understand a few commands:
* make/enter_chroot
* build_packages
* build_image
* cros_workon
* git
* repo
* git_cl
Each command solves one problem. There is work in progess to sqash the
first three and the last two. So we should be down to 4 commands.
But not in the short term.
The learning curve for ebuilds is a little steep but necessary. Its
solving a difficult problem. But its well designed and comes with
great documenation (not to mention man pages).
> When building it should build the fastest possible build that meets the
> configuration I specified (e.g. if I specify tests, then build the tests,
> but don't otherwise). It shouldn't build anything extra, and it shouldn't
> run anything (e.g. tests) unless I ask it to. I don't want to have to
> optimize the build steps myself, because it means every team member has to
> separately learn what to do to optimize it when the person who thought up
> the optimization could just have added it to the build tool.
>
> There should be a way to 'name' popular build types so that groups of
> parameters don't need to be specified (e.g. I should be able to build a
> vanilla chromeos release image with one argument). bonus points if I can
> set up my own names.
>
> Basically, I think we've come to a place where only a person who knows
> hundreds (gross exaggeration, perhaps :) of different tools and languages
> can possibly work effectively in our codebase, and I'd like it to be more
> like 20.
>
> -Greg.
Hmm, it would be interesting to see your script. You must be doing something
different from the workflow documented here:
http://sites.google.com/a/chromium.org/dev/chromium-os/building-chromium-os/using-cros_workon
My workflow looks like this:
Done once:
==========
$ repo init -u http://git.chromium.org/git/manifest -m minilayout.xml
$ repo sync
$ ./make_chroot
$ ./enter_chroot
(chroot) $ ./setup_board --board=x86-generic --default
(chroot) $ ./cros_workon start kernel
Done for every change:
======================
$ repo sync
$ repo start bug45 .
$ git commit -a
$ git cl upload --send-mail -r te...@example.com
$ git cl push
$ repo abandon bug45 .
Done for every compile:
=======================
(chroot) $ ./build_packages && ./build_image
(chroot) $ ./image_to_usb --test_image --from=blah --to=/dev/sdX
Hmm, there are things that can be done to make emerge faster (ccache).
Otherwise, its trivial to wrap ebuild to take a package name instead of
a filename. The ebuild workflow (if folks need to use it) is pretty simple.
We just need to write a nice tutorial.
I guess the disconnect is that folks are using undocumented worfkflows.
If you are using ebuild-, write a doc on how you are using it. You'll
benefit others that are doing similar things. If your workflow
sucks, document it and point folks to it. There may be a better way.
Its difficult to solve a problem you don't know exists.
> We need to bring homogeneity to our packages. Pick scons or make. Provide
> some shared infrastructure so that every package doesn't roll its own
> mechanism to pull in state from the build environment. Get everyone's unit
> tests to be runnable in the same way. We need to provide a usable developer
> workflow that doesn't involve packaging. Our tools right now optimize for
> the need to build and package a distro, which makes sense because that was
> absolutely the P0. Now, though, we need to acknowledge that this has slowed
> down our ability to develop Chrome OS and start optimizing that.
>
What portage does is abstract the underlying build into a homogeneous
framework. It implements the adapter pattern. src_unpack, src_compile,
src_configure, etc, should do semantically the same thing regardless
of whether or not the underlying build is raw Makefiles, scons,
autotools, or a shell script.
I'm not sure standardizing on scons or make is feasible. We don't
have a choice on upstream bits or bits we went to get upstream. For
example, if you want to get a package into xorg, I believe it must
be autotools.
I guess the disconnect is that folks are using undocumented worfkflows.
If you are using ebuild-, write a doc on how you are using it. You'll
benefit others that are doing similar things. If your workflow
sucks, document it and point folks to it. There may be a better way.
Its difficult to solve a problem you don't know exists.
What portage does is abstract the underlying build into a homogeneous
> We need to bring homogeneity to our packages. Pick scons or make. Provide
> some shared infrastructure so that every package doesn't roll its own
> mechanism to pull in state from the build environment. Get everyone's unit
> tests to be runnable in the same way. We need to provide a usable developer
> workflow that doesn't involve packaging. Our tools right now optimize for
> the need to build and package a distro, which makes sense because that was
> absolutely the P0. Now, though, we need to acknowledge that this has slowed
> down our ability to develop Chrome OS and start optimizing that.
>
framework. It implements the adapter pattern. src_unpack, src_compile,
src_configure, etc, should do semantically the same thing regardless
of whether or not the underlying build is raw Makefiles, scons,
autotools, or a shell script.
I'm not sure standardizing on scons or make is feasible. We don't
have a choice on upstream bits or bits we went to get upstream. For
example, if you want to get a package into xorg, I believe it must
be autotools.
Cool. Doc URL or bug number?
These aren't the only choices. I'm sure we could come up with something
better. One idea would be symlink in the sources for worked on packages
if an configuration variable is set instead of copying them into portage's
temp directory. Anyway, I'm sure a good solution can be developed. Maybe
schedule some time for a brainstorming session?
I'm sure we could come up with something
better. One idea would be symlink in the sources for worked on packages
if an configuration variable is set instead of copying them into portage's
temp directory. Anyway, I'm sure a good solution can be developed. Maybe
schedule some time for a brainstorming session?
Thanks.
Actually, our super-intern zbehan did devote cycles to it. He disabled some
unnecessary elf checks in the chrome ebuild. He added support for
pbzip2 to speed up package create time and various other speedups I'm
forgetting right now.
He opened this bug here:
http://code.google.com/p/chromium-os/issues/detail?id=6665
I think he cut chrome build time down by at least half, probably
even more. His last comment in the bug is encouraging:
"There probably still is significant space for improvements."
On Wed, Oct 6, 2010 at 11:22 AM, Mandeep Singh Baines <m...@chromium.org> wrote:
[large list of docs...]Hope that helps:)Yes, that does help, and a sincere thank you for the list.[the following comes from a genuine interest in making things better -- I know how f-ing hard it is to get all this stuff to line up, so please don't read it like a rant]I guess my lament here is that as a developer it's waaaaay complex to build our stuff, and there's no single place to get information. I'm totally used to learning lots of things to work on a large project: it's not the amount of reading (although it's a toss-up whether or not I'll be done reading by the time we release! LOL), it's just getting impossible to hold it all in my head and to keep up to date on the way to build things each week.I've been writing a command line tool for my own use that allows me to do my builds without having to remember all the flags I need to use. It now has almost 300 lines of code in it, and all it does is build release or debug of chromeos with chrome from local sources. I find myself editing how this script works at least once a week, either because I learned something new or because something changed. I'm happy to try and write something for general use that does this, but it seems that would just be yet another band-aid wrapper script, and that's not what we need.It seems to me that something is broken if I have to write my own script to build: I should be able to build the ~10 most common build types with a single command and three or less arguments that don't keep changing from week to week and have reasonable defaults. I should be able to start with an empty directory, type one command, walk away, and come back to a built image and local sources I can modify (hopefully not two days later! :-). I should be able to re-run that command and get a fast incremental build that only builds the things that changed. If I'm working on something esoteric, then fine, let me specify more arguments.Is the problem that we are ALL building something that would be considered esoteric by someone else on the team? And if that's the case, are we sure we're testing all of these esoteric combinations in try bots, etc?Is the problem that we just haven't converged yet on one tool (well, obviously this is one problem, but I mean: will it all go away when we do, and will it ever really happen)?Part of my frustration comes from the heterogeneous environment and the home-grown scripts that wrap them. I currently have five tools that deal with repos (git, svn, repo, gclient, cros_workon), all of which I still have to use, and remember which directories require which tools, and know how they all interact. I have two different build systems I need to deal with (make, scons), and three meta-build systems (gyp, portage, configure). All of them have reams of parameters, switches and modes where some are "built in" and some are added locally, and some are configured per build or computed on the fly from something else -- there is no central place to find out what they all are, let alone document what each one implies. And then there's the rest of the home grown wrappers (build_packages, build_image, make_chroot) that all have their part in building stuff.I realize we build a lot of configurations, but shouldn't it be possible to classify orthogonal categories for the configuration parameters (e.g. board type, debug/release, test/no test etc) and just specify one or two arguments to set the kind of build you want, defaulting to the most common type for each parameter?After thinking about this for a whole five minutes, my ideal environment is something like:- use only git to deal with repos and create, upload and submit CLs (and I would love it if we had only one git repo, but I know that ship has sailed.)- use one other tool (probably homegrown) to build our entire source base (chrome + chromeos) soup to nuts, with a minimum of clear, orthogonal, (self) documented, immutable arguments.
When building it should build the fastest possible build that meets the configuration I specified (e.g. if I specify tests, then build the tests, but don't otherwise). It shouldn't build anything extra, and it shouldn't run anything (e.g. tests) unless I ask it to. I don't want to have to optimize the build steps myself, because it means every team member has to separately learn what to do to optimize it when the person who thought up the optimization could just have added it to the build tool.There should be a way to 'name' popular build types so that groups of parameters don't need to be specified (e.g. I should be able to build a vanilla chromeos release image with one argument). bonus points if I can set up my own names.Basically, I think we've come to a place where only a person who knows hundreds (gross exaggeration, perhaps :) of different tools and languages can possibly work effectively in our codebase, and I'd like it to be more like 20.-Greg.
--
On Wed, Oct 6, 2010 at 1:15 PM, Greg Spencer <gspe...@chromium.org> wrote:On Wed, Oct 6, 2010 at 11:22 AM, Mandeep Singh Baines <m...@chromium.org> wrote:
[large list of docs...]Hope that helps:)Yes, that does help, and a sincere thank you for the list.[the following comes from a genuine interest in making things better -- I know how f-ing hard it is to get all this stuff to line up, so please don't read it like a rant]I guess my lament here is that as a developer it's waaaaay complex to build our stuff, and there's no single place to get information. I'm totally used to learning lots of things to work on a large project: it's not the amount of reading (although it's a toss-up whether or not I'll be done reading by the time we release! LOL), it's just getting impossible to hold it all in my head and to keep up to date on the way to build things each week.I've been writing a command line tool for my own use that allows me to do my builds without having to remember all the flags I need to use. It now has almost 300 lines of code in it, and all it does is build release or debug of chromeos with chrome from local sources. I find myself editing how this script works at least once a week, either because I learned something new or because something changed. I'm happy to try and write something for general use that does this, but it seems that would just be yet another band-aid wrapper script, and that's not what we need.It seems to me that something is broken if I have to write my own script to build: I should be able to build the ~10 most common build types with a single command and three or less arguments that don't keep changing from week to week and have reasonable defaults. I should be able to start with an empty directory, type one command, walk away, and come back to a built image and local sources I can modify (hopefully not two days later! :-). I should be able to re-run that command and get a fast incremental build that only builds the things that changed. If I'm working on something esoteric, then fine, let me specify more arguments.Is the problem that we are ALL building something that would be considered esoteric by someone else on the team? And if that's the case, are we sure we're testing all of these esoteric combinations in try bots, etc?Is the problem that we just haven't converged yet on one tool (well, obviously this is one problem, but I mean: will it all go away when we do, and will it ever really happen)?Part of my frustration comes from the heterogeneous environment and the home-grown scripts that wrap them. I currently have five tools that deal with repos (git, svn, repo, gclient, cros_workon), all of which I still have to use, and remember which directories require which tools, and know how they all interact. I have two different build systems I need to deal with (make, scons), and three meta-build systems (gyp, portage, configure). All of them have reams of parameters, switches and modes where some are "built in" and some are added locally, and some are configured per build or computed on the fly from something else -- there is no central place to find out what they all are, let alone document what each one implies. And then there's the rest of the home grown wrappers (build_packages, build_image, make_chroot) that all have their part in building stuff.I realize we build a lot of configurations, but shouldn't it be possible to classify orthogonal categories for the configuration parameters (e.g. board type, debug/release, test/no test etc) and just specify one or two arguments to set the kind of build you want, defaulting to the most common type for each parameter?After thinking about this for a whole five minutes, my ideal environment is something like:- use only git to deal with repos and create, upload and submit CLs (and I would love it if we had only one git repo, but I know that ship has sailed.)- use one other tool (probably homegrown) to build our entire source base (chrome + chromeos) soup to nuts, with a minimum of clear, orthogonal, (self) documented, immutable arguments.
Thanks for the good summary of your pain points as a developer. This is exactly what we want to address and move our build system towards.We currently have a started a 20%ish project to enhance the build system called "Chromite". Our current build system did wonders for when it was first written (getting a full working cross compile environment etc). However now we need it to scale and be efficient for the developers. Firstly the build config exists in the build tool itself. For example this requires changing build_image for every new image type that we come across.Without going into all the problems here long term we want to do just what you asked. You check out the code, and you call the equivalent of "make <target>" and it spews out an image. Even stepping into a chroot should be optional (i.e the tool will drop into a chroot, and if a chroot isn't available, try to fetch the last know good chroot build or build it from source). It is not a silver bullet and doesn't address concerns of quick turnaround of development iteration cmasone brought up later in the thread nor does it solve the "bolt on" chrome on chrome OS dev model.Here is the Chromite "design" doc.So I would say the problem is acknowledged.
Yeah, but it takes much less time than it did.
> Like...why am I zipping anything at all if I just want to rebuild my binary
> and run the unit tests locally?
>
> It remains the case that no one has spent any cycles on excising packaging
> time from our edit/compile/test cycle. The fact that you hold up zdenek's
Not sure its necessary to excise this. I think the pbzip2 work cut down
this time substationally.
> work as an example of someone working on the problem indicates to me that
> we're still talking past one another :-/
>
Bottom line: we want faster chrome build from ChromeOS, no? I think
you are getting too hung up on details of the solution rather than
solving the problem. Yeah, we do some unneccessary stuff. But if
that stuff is only consuming a fraction of the cycle time its OK.
I think the goal should be to reduce build time to the same order
as the incremental build time. I don't think its necessary to
have parity or do what an incremental build does and nothing more.
Just get close enough that's its no longer an issue.
If I'm interpretting zbehan's data correctly, we're currently at:
Noop emerge - 18m24
Noop make - 3m48s
So 4.5x. I think if we can get it down to 1.5 or 2x, we can put a fork
in it.
Not sure its necessary to excise this. I think the pbzip2 work cut down
> Like...why am I zipping anything at all if I just want to rebuild my binary
> and run the unit tests locally?
>
> It remains the case that no one has spent any cycles on excising packaging
> time from our edit/compile/test cycle. The fact that you hold up zdenek's
this time substationally.
Bottom line: we want faster chrome build from ChromeOS, no?
> work as an example of someone working on the problem indicates to me that
> we're still talking past one another :-/
>
I think
you are getting too hung up on details of the solution rather than
solving the problem. Yeah, we do some unneccessary stuff. But if
that stuff is only consuming a fraction of the cycle time its OK.
I think the goal should be to reduce build time to the same order
as the incremental build time. I don't think its necessary to
have parity or do what an incremental build does and nothing more.
Just get close enough that's its no longer an issue.
If I'm interpretting zbehan's data correctly, we're currently at:
Noop emerge - 18m24
Noop make - 3m48s
So 4.5x. I think if we can get it down to 1.5 or 2x, we can put a fork
in it.
Yeah, we can optimize here. Maybe have a NOCLEAN flag for cros_workon
packages. I have some ideas on how to implement this. The bug to
follow is:
http://code.google.com/p/chromium-os/issues/detail?id=6843
Hi Greg,
Thanks for attaching this script.
It looks like building from LOCAL_SOURCE is quite complex. There are a
lot of options here that you're specifying on the command-line that
maybe should just be the default.
Here's a few of the options which should be unnecessary already:
1. RESTRICT="bincheck". We already disable the slow QA checks for
Chrome, thanks to Zdenek. So you don't need to specify this manually.
2. FEATURES="test". Does this do anything for Chrome? I believe
chrome uses the "build_tests" flag instead, so this should be
unnecessary.
3. --jobs=16. By default, parallel_emerge launches 1 job per core.
So no need to specify this anymore.
Here's a few places where we could improve the build system:
1. make_chroot should not be flaky. I see in your script that you
ignore the return code because you're concerned about flakiness. Can
you file a bug for this with the errors that you get?
2. setup_board should have a flag to 'setup if missing'. This will
save your script from flakiness in case the setup_board genuinely
fails.
3. We should have an official method for building 'Debug',
'DebugTest', and 'Release' options of Chrome. This way you don't need
to specify arguments on the command-line. This would handle things
like FEATURES="strip" and FEATURES="nostrip" for you and
FEATURES="-build_tests". It should also handle FEATURES="-usersandbox"
if that's really necessary.
4. Looks like you're using --chrome-root=$CHROME_DIR. This option
doesn't work very well because the chrome build tries to use hardlinks
to copy between that dir and /build/x86-foo, so you get "Invalid
cross-device link" warnings. We should find a better way for mounting
your source code into the chroot so that we recognize that it's on the
same filesystem as /build/x86-foo and can efficiently do hardlinks and
such.
5. USE="gold" should be the default soon. We are waiting until after
the official branch before we do this. This should be addressed as
part of 6665.
We should file bugs for 1-4. Greg, if you're interested in doing
this, please assign the bugs to me and mark with milestone R10.
I also have some suggestions on how to improve your script:
1. my_tee seems like a general useful utility. Maybe it should be
moved into a common area?
2. There's a lot of repeated flags for building Chrome. These should
be moved into a function or at least a variable so you don't need to
change it in every place.
And some questions:
- What's the sync_chrome function? Why do you need to 'sleep 15s' to
"let git catch up"? Do all Chrome developers need to do this or is
this just specific to your environment?
Cheers,
David
Here's a few of the options which should be unnecessary already:1. RESTRICT="bincheck". We already disable the slow QA checks for
Chrome, thanks to Zdenek. So you don't need to specify this manually.
2. FEATURES="test". Does this do anything for Chrome? I believe
chrome uses the "build_tests" flag instead, so this should be
unnecessary.
3. --jobs=16. By default, parallel_emerge launches 1 job per core.
So no need to specify this anymore.
Here's a few places where we could improve the build system:
1. make_chroot should not be flaky. I see in your script that you
ignore the return code because you're concerned about flakiness. Can
you file a bug for this with the errors that you get?
2. setup_board should have a flag to 'setup if missing'. This will
save your script from flakiness in case the setup_board genuinely
fails.
3. We should have an official method for building 'Debug',
'DebugTest', and 'Release' options of Chrome. This way you don't need
to specify arguments on the command-line. This would handle things
like FEATURES="strip" and FEATURES="nostrip" for you and
FEATURES="-build_tests". It should also handle FEATURES="-usersandbox"
if that's really necessary.
4. Looks like you're using --chrome-root=$CHROME_DIR. This option
doesn't work very well because the chrome build tries to use hardlinks
to copy between that dir and /build/x86-foo, so you get "Invalid
cross-device link" warnings. We should find a better way for mounting
your source code into the chroot so that we recognize that it's on the
same filesystem as /build/x86-foo and can efficiently do hardlinks and
such.
5. USE="gold" should be the default soon. We are waiting until after
the official branch before we do this. This should be addressed as
part of 6665.
We should file bugs for 1-4. Greg, if you're interested in doing
this, please assign the bugs to me and mark with milestone R10.
I also have some suggestions on how to improve your script:
1. my_tee seems like a general useful utility. Maybe it should be
moved into a common area?
2. There's a lot of repeated flags for building Chrome. These should
be moved into a function or at least a variable so you don't need to
change it in every place.
And some questions:
- What's the sync_chrome function? Why do you need to 'sleep 15s' to
"let git catch up"? Do all Chrome developers need to do this or is
this just specific to your environment?
How do I build packages without building tests?I thought that if I just removed "test" from the FEATURES that it would do that, but it doesn't. I tried adding "-test" to the features as well, to no avail.Here's what I use to build release packages with:--
$SCRIPT_DIR/enter_chroot.sh --chrome_root=${CHROME_DIR} -- \BUILDTYPE="Release" \RESTRICT="binchecks" \FEATURES="strip\ -usersandbox" \
USE="gold" \
CHROME_ORIGIN="LOCAL_SOURCE" \$CHROOT_SCRIPT_DIR/build_packages --board=${BOARD} --jobs=16
--
--