Google Chrome OS will only be released officially by end of 2010. However, the Chrome OS is an open-source operating system, where its source code can be downloaded by anybody and everybody from chromium.org. It means that everybody can get and download Chrome OS source, then compile the Chrome OS to install Chrome OS on their system, despite it’s still in its early development.

For people familiar with Linux especially Ubuntu, compiling Chrome OS is easy and straight forward, as the comprehensive build instructions have been posted by the developers. Here’s the brief steps to download and build the Chrome OS to a bootable USB flash drive as setup installer to install on new hard disk drive or system, or as VMWave image to boot in virtual machine in VMWare Server or Player or VirtualBox.

Step 1: Create a Ubuntu System

For user already with a system running Ubuntu on Hardy 8.04 or newer, this step can be skipped. Else, download and install Ubuntu 9.10 (Karmir) from ubuntu.com. For user without extra machine, it’s possible to create a virtual machine with free VMWare Server or VirtualBox.

Install Ubuntu

As a prerequisite, user must have an account with root access on the Ubuntu system in order to run chroot and modify the mount table.

Step 2: Download the Chromium OS Source Code

Tip: The following steps are mostly done in Terminal (command-line interface) of Ubuntu.

In the Ubuntu system, download the Chrome OS source code. There are two methods to download the ChromiumOS source. Users who just want to compile the ChromeOS can just stick to method 1, which download the complete source code in a tarball. Method 2 is for developers who want to contribute the code and want to commit changes.

Method One: Download the code directly (cannot commit changes)

Download the tarball from the following URL:

http://sites.google.com/a/chromium.org/dev/chromium-os/building-chromium-os/getting-the-chromium-os-source-code

Currently, the Chrome OS tarball version 0.4.22.8 direct download link is chromiumos-0.4.22.8.tar.gz.

wget http://build.chromium.org/buildbot/archives/chromiumos-x.x.xx.x.tar.gz

Then, unpack the tarball into a local directory called chromiumos with the following command in the Terminal:

tar -zxf chromiumos-x.x.xx.x.tar.gz

Use the following command to rename extracted directory:

mv chromiumos-x.x.xx.x chromiumos

Download Chrome OS Source Code

Method Two: Using Git to get the source

  1. Download and install the Chromium depot tools to manage checkouts and code reviews.

    Note: Depot tools have to be earlier in the path environment than any other gcl binaries on the system.

  2. Install git onto local machine:

    sudo apt-get install git-core

  3. Get a copy of the Chromium OS repository:

    mkdir [chromiumos] cd [chromiumos] gclient config http://src.chromium.org/git/chromiumos.git
    gclient sync

Step 3: Compile and Build the Chrome OS

  1. Optionally, set up the following symlinks so that paths are easier to reference and user can search src in each directory:

    ln -s /home/user/chromiumos/chromiumos.git ~/chromiumos

    Note: The directory where extracted Chrome OS source located may be different.

  2. Change into the Chromium OS scripts directory:

    cd ~/chromiumos/src/scripts

  3. Make a local respository in ~/chromiumos/repo with the following command, in order to make sure debootstrap and apt-get install only exact list of packages to be used for the chroot build environment and image:

    ./make_local_repo.sh

    Make Local Repository to Build Chromium OS

    Note: root access password may be required to install debootstrap if it’s required to be installed. Ensure that the output of this script to ensure that nothing failed, such as E: wget: unable to resolve host address “build.chromium.org” error. If something fails you must sudo rm -rf ~/chromiumos/repo before recalling this script.

    Troubleshooting: Some system may face E: unmet dependencies. try ‘apt-get -f install’ with no packages (or specify a solution). Here’s the solution to fix unmet dependencies error in Ubuntu.

    Troubleshooting: The version of debootstrap on older release of Linux may not be able to install the newer Karmic version of Ubuntu required to build Chromium OS. If making the local repository or the chroot fails, here’s a workaround that installs the Karmic version:

    # Create a karmic.list which pulls from chromeos-deb
    cat >karmic.list <

    # Install karmic debootstrap
    sudo mv karmic.list /etc/apt/sources.list.d/karmic.list
    sudo apt-get update
    sudo apt-get install -y --force-yes debootstrap

    # Remove temporary sources.list entry, so you don't upgrade anything else
    sudo rm /etc/apt/sources.list.d/karmic.list
    sudo apt-get update

    If you're still having trouble, try this instead:

    sudo ln -s /usr/share/debootstrap/scripts/gutsy /usr/share/debootstrap/scripts/karmic

  4. Create a chroot build environment so that Chrome OS build output is less dependant on the particular flavor of Linux:

    ./make_chroot.sh

    Make Chroot

    Note: By default, the setup script configures /etc/apt/sources.list to pull from the local repository you created in the previous step. If you're pushing the boundaries of development (for example, attempting to compile for a different processor), you may need to get the most recent packages from the Chromium repository. In that case, run the following:

    ./make_chroot.sh --mirror=http://build.chromium.org/buildbot/packages --suite=chromeos_dev

  5. Download the latest version of Google Chrome web browser into ~/chromiumos/src/build/x86/local_assets directory:

    wget http://build.chromium.org/buildbot/archives/chromium-chromiumos-r32516/chrome-linux.zip

    The download link above may get outdated due to newer build of Chromium been released. To ensure always getting the latest version of Chrome browser available, use the following command instead:

    wget http://build.chromium.org/buildbot/continuous/linux/LATEST/chrome-linux.zip

  6. Move the downloaded chrome-linux.zip to ~/chromiumos/src/build/x86/local_assets directory:

    mkdir -p ~/chromiumos/src/build/x86/local_assets
    mv chrome-linux.zip ~/chromiumos/src/build/x86/local_assets/chrome-chromeos.zip

    Download Chrome Web Browser

  7. Enter the chroot build environment:

    ./enter_chroot.sh

    Enter Chroot Environment

  8. Create and enable a local user account as a backdoor access to logon to Chrome OS bypassing authentication and without having to login to Google account:

    ( cd ../platform/pam_google && ./enable_localaccount.sh USERNAME )

    Enable Chrome OS Local Account

    Note: Change USERNAME to a preferred user name. Remove chromeos_pam_localaccount.h to disable local account to force all users to sign in with Google Account.

  9. In order to be able to sudo from the terminal in Chromium OS (required for installing the Chrome operating system into device), need help debugging networking, or have some other reason for needing to log on directly as the shared user, users need to set up the password for the shared user:

    ./set_shared_user_password.sh

    Set Shared User Password for Chromium OS

    And enter a password when prompted. The encrypted password will be stored in ./shared_user_password.txt, so you only need to do this once.

  10. Build the packages:

    ./build_all.sh

    Build Chrome OS

    Alternatively, built the platform packages, the kernel and then the image separately with the following commands:

    ./build_platform_packages.sh
    ./build_kernel.sh

    Build the image to create a unique monotonically increasingly numbered subdir under the output location which contains the master boot record (mbr.image) and the root filesystem image (rootfs.image)

    ./build_image.sh

    Note: The default output location for images is ~/chromiumos/src/build/images.

    Troubleshooting: In some environment, the build process may fails with the following error:

    Downloading http://codf196.jail.google.com/archive/chrome-official/4.0.250.2/chrome-linux.zip

    Downloading http://codf196.jail.google.com/archive/chrome-official/4.0.250.2/chrome-linux.zip
    --2009-11-22 08:08:08-- http://codf196.jail.google.com/archive/chrome-official/4.0.250.2/chrome-linux.zip
    Resolving codf196.jail.google.com... failed: Name or service not known.
    wget: unable to resolve host address `codf196.jail.google.com'
    make: *** [build-stamp] Error 1
    dpkg-buildpackage: failure: debian/rules build gave error exit status 2

    or,

    Downloading http://chrome-web/buildbot/snapshots/chromium-rel-linux-chromiumos/LATEST
    --2009-11-20 16:47:37-- http://chrome-web/buildbot/snapshots/chromium-rel-linux-chromiumos/LATEST
    Resolving chrome-web... failed: Name or service not known.
    wget: unable to resolve host address `chrome-web'
    make: *** [build-stamp] Error 1
    dpkg-buildpackage: failure: debian/rules build gave error exit status 2

    To resolve and fix the problem above, edit the ~/chromium/src/platform/chrome/copy_chrome_zip.sh file. Search for the following line:

    USE_RELEASE_CHROME=0

    Change it to:

    USE_RELEASE_CHROME=1

    Alternatively, it's also possible to change the URL from which the build process used to download the Chrome. Locate the following line:

    BASE_FROM="http://chrome-web/buildbot/snapshots/chromium-rel-linux-chromiumos"

    or,

    BASE_FROM="http://codf196.jail.google.com/archive/chrome-official"

    And change it to:

    BASE_FROM="http://build.chromium.org/buildbot/snapshots/chromium-rel-linux-chromiumos/"

  11. Exit from chroot shell:

    exit

    Exit from Chroot

Step 4: Make a bootable USB Chrome OS Installation Flash Key

Use image_to_usb.sh to copy the image to a USB key:

./image_to_usb.sh --from=~/chromiumos/src/build/images/SUBDIR --to=/dev/USBKEYDEV

For example,

./image_to_usb.sh --from=~/chromiumos/src/build/images/999.999.32709.042837-a1 --to=/dev/sdb

Transfer Chrome OS to USB Flash Drive

Note: SUBDIR is the subdirectory created by build_image.sh, and USBKEYDEV is the device for the USB key (can be determined via "sudo fdisk -l" or "dmesg" command), e.g. /dev/sdb. A 4GB USB flash drive is required.

Tip: By default, image_to_usb.sh copies from the most recent image you've built to /dev/sdb, so you may be able to omit the --from and/or --to options.

Warning: The whole USB drive will be wiped off, and all data will be erased.

Step 5: Install Chrome OS (or Chromium OS)

  1. Boot from the USB flash key with Chrome OS image. (Change of boot order or boot sequence in the BIOS may be required).
  2. After logging in, use Ctrl+Alt+T to open a terminal window.
  3. Run the following command:

    /usr/sbin/chromeos-install

    Enter the shared user password created in earlier step when prompted.

    Warning: Installation of Chromium OS will wipe off entire hard disk drive.

  4. Once installation completes, unplug the USB drive and reboot.

Step 6: Convert Chrome OS Image to VMWare Image

Note: Perform the following steps in the Ubuntu system which used to build the Chrome OS.

  1. Download and install qemu, an open source machine emulator and virtualizer:

    sudo apt-get install qemu

  2. In Terminal, run the following command:

    ./image_to_vmware.sh --from=~/chromiumos/src/build/images/SUBDIR \
    --to=~/chromiumos/src/build/images/SUBDIR/ide.vmdk

    For example,

    ./image_to_vmware.sh --from=~/chromeos/src/build/images/999.999.32709.042837-a1

    Tip: By default, image_to_vmware.sh will convert the most recent image you've built to ide.vmdk, so you may be able to omit the --from and/or --to options.

The .vmdk VMWare disk image created can be used to boot from a VMWare virtual machine session.

Note: The VMWare image may have missing functionality (e.g. no virtual terminal, slow keyboard response, etc).

Step 7: Delete an old chroot build environment

This step is not essential for many people who just want the Chrome OS and dump the Ubuntu. However, when there are newer revision and newer build of Chrome OS, chroot needs to be cleaned. To delete an old chroot build environment, run the following command in the Terminal of Ubuntu system:

./make_chroot.sh --delete

Delete and Clean Chroot

Note: Do NOT use "rm -rf", since if there are stale bind mounts, you may end up deleting your source tree.

Related Posts