Chromium OS‎ > ‎

Developing Chromium on ChromiumOS Using Repo

This flow is DEPRECATED. For the official way to build Chromium on ChromiumOS, go here.


Syncing sources

If you don't already have a checkout of ChromeOS, refer to the ChromiumOS Developer Guide on how to do so.

Once you've got a checkout, re-init your existing repository to the 'gerrit-source.xml' manifest. Then, once you run 'repo sync', the chrome sources will appear in <repo_root>/chromium/src.

repo selfupdate
repo init -m gerrit-source.xml
repo sync -j8


Building Chrome

cros_sdk --enter
setup_board --board=<board>
cros_workon --board=<board> start chromeos-chrome
export CHROME_ORIGIN=GERRIT_SOURCE

....make changes to <repo_root>/chromium/src....

If you are working on a freshly synced checkout and have not run build_packages, build Chromium by running:

./build_packages --board=<board> # To build all packages for a board using prebuilts when available.

If you want to do a quick incremental compile, run:

cros_chrome_make --board=<board> [--runhooks] [--build_tests] # Build incrementally - does not perform install step.
The output directory will be located at /var/lib/portage/distfiles-target/chrome-src/src/out_<board> inside the chroot (<repo_root>/chroot/var/lib/... outside the chroot). (or /var/cache/chromeos-chrome/chrome-src/src/out_<board>)
A common workflow is to 'scp' the chrome binary generated by cros_chrome_make directly to the target device.

To build tests, run cros_chrome_make with the --build_tests flag.

To emerge just the Chromium package run:

emerge-<board> chromeos-chrome # To build incrementally and install Chromium for a board

NOTE: If you are at Google, and want to build internal chrome, set the chrome_internal use flag:
export USE='chrome_internal'
cros_chrome_make --board=<board>
or
USE='chrome_internal' cros_chrome_make --board=<board>


Building outside the chroot for ChromeOS is not recommended, but you can build Chromium/Linux:

(working in <repo_root>/chromium/src/)

chrome_set_ver --runhooks

...make changes...

make chrome
        
* The chrome_set_ver script is located in depot_tools. Run chrome_set_ver --help for more info.


Making Changes

With git you should make all your changes in a local branch. Once your change is committed, you can delete this branch.

Create a local branch named "mywork" and make changes to it.

cd src repo start mywork . vi ...

Commit your change locally (this doesn't commit your change to the SVN or Git server)

  git commit -a -v

If you added new files, you should tell git so by running 
git add <files> before committing.

Note:  If you made changes to gyp files, and you are compiling incrementally using cros_chrome_make, you need to run with the --runhooks option to regenerate Makefiles.


Keeping Your Source Up to Date

  repo sync --jobs=<jobs>  


Sending CL's Out for Review and Committing

Uploading CL's for review

git cl upload

You will need to authenticate yourself with your @chromium.org account.  For internal reviews, use your @google.com account and generate an application-specific password at https://www.google.com/accounts/IssuedAuthSubTokens.

Send a try-job

 git try

Set up your checkout for commit

Run this outside the chroot (git-svn is not installed inside the chroot yet):

 sudo aptitude install git-svn # Make sure git-svn is installed
cd src
  rm .git/svn #temp hack since a dummy .git/svn is created.
  git svn init --prefix=origin/ -T trunk/src svn://svn.chromium.org/chrome
  git config svn-remote.svn.fetch trunk/src:refs/remotes/cros/master
  git svn fetch
  git cl config

Committing

The preferred way to commit changes is by using the commit queue. If this is not an option, you can commit directly from your git checkout.

To do so, you first need to update your branch.

cd src repo sync . repo rebase .

You can then commit your change for real (In SVN).

git cl dcommit


Doing a bisect of Chrome

It is possible to do a standard git bisect of chrome given two SVN revision numbers.  

If you don't have SVN revision numbers but do have Chrome version numbers, you can use this tool to find the svn revision numbers:
http://omahaproxy.appspot.com/changelog First, follow the above instructions in setting up the checkout for commit using git svn.
Then from outside the chroot you can use git-svn to find the git SHA1 hashes which correspond with the known good revision and the known broken revision.

For example if the last known good revision of chrome was r116107 you would run:

git svn find-rev r116107

which will output the git SHA1 for that version

After finding the two hashes, you can enter the chroot and start working on chrome

cros_workon --board=$BOARD start chromeos-chrome

then start a bisect from ~/trunk/src/chromium/src

git bisect start <known bad commit> <known good commit>

and then git bisect will set up the first revision to test.

Note that sometimes multiple SVN revision numbers seem to map to a single git hash, especially in the case of a merge in svn. So the git bisect start command will indicate fewer commits to be searched than the numerical difference in the SVN revision numbers would lead you to believe at first.

after git bisect start sets the first version to test, proceed to use cros_chrome_make or emerge to build chrome and if the resulting binary passes use 

git bisect good

or if it fails

git bisect bad

to proceed to the next test.

Finally after you are done, use

git bisect reset

to go back to regular operating mode.

Upcoming Features
  • Having stable ebuilds also use the Gerrit source checkout.

Old Workflow
In the old flow, if developers want to develop Chromium on ChromeOS they need to use gclient to sync down a copy of Chromium, and pass it into the chroot by running:

cros_sdk --enter --chrome_root=.../path/to/chrome/dir

Then they need to run emerge with the CHROME_ORIGIN=LOCAL_SOURCE:

CHROME_ORIGIN=LOCAL_SOURCE emerge-x86-generic chromeos-chrome
Comments