How to Build Chrome OS For Your Netbook or VM

A few weeks ago, Google announced that Chrome OS will be ready for release this fall. Like many Google products, Chrome OS is designed to be a game changer. There are no desktop applications, as we typically think of them. Instead, the entire user experience happens within the browser. Naturally, some people think this is ridiculous while others see it as the natural evolution of technology. The success or failure of Chrome OS might even be a major factor in determining whether or not that evolution happens. If you’d like to find out for yourself, here’s how to build the Chrome OS image.

Technically, we’re compiling Chromium OS, but the two terms are interchangeable within the scope of this guide.

What to Expect

We’re building a full operating system, not just an individual application, so you can expect more in terms of steps involved and time until completion. That said, it’s not a very difficult process, and most of the time involved will be waiting for downloads to finish and code to compile. It would be helpful to have prior experience compiling software on Linux, such as what’s described here. Depending on Internet and CPU speed, this process could take anywhere from 1-4 hours, but again, most of that time is spent waiting on downloads and compilation.

Prerequisites

To perform the build properly, you will need to be running a 64-bit Linux install. 32-bit is not currently supported as a build environment, but that may change in the future. Google recommends Ubuntu for this purpose, so that is the OS assumed by the rest of this guide.

To install all software needed to properly build Chrome OS, just run the following from a terminal:

sudo apt-get install bison fakeroot flex g++ g++-multilib gperf libapache2-mod-php5 libasound2-dev libbz2-dev libcairo2-dev libdbus-glib-1-dev libgconf2-dev libgl1-mesa-dev libglu1-mesa-dev libglib2.0-dev libgtk2.0-dev libjpeg62-dev libnspr4-dev libnss3-dev libpam0g-dev libsqlite3-dev libxslt1-dev libxss-dev   mesa-common-dev msttcorefonts patch perl pkg-config python python2.6-dev rpm subversion libcupsys2-dev libgnome-keyring-dev git-core subversion

One thing that’s not in Ubuntu’s repositories is Google’s depot-tools package, but that’s a simple download and extraction away. Click here to get the tar.gz file, and extract it to your home directory. You should now have a directory called depot_tools within your home.

Now just add that location to your command path with:

#Add this to your ~/.bashrc file to make it permanent
export PATH=$PATH:~/depot_tools

Getting the Source Code

We’re going to create a chrome directory within your home to hold all the files for this build, then download the source code. It’ll be downloading a few hundred megabytes, so this is probably going to take a while.

mkdir ~/chrome
cd ~/chrome
gclient config http://src.chromium.org/git/chromiumos.git
gclient sync

buildchrome-sync

Building the Source

In these next steps, we’re going to start the scripts that will actually build the code into usable binaries. The following commands will compile the source for a generic x86 processor, something that should run pretty well on your average CPU, but not optimized for any particular one.

cd  ~/chrome/chromiumos.git/src/scripts
./make_chroot #This creates the base environment, will take a few minutes
./enter_chroot.sh #Enters base environment

At this point you should have a prompt similar to the following:

buildchrome-enterchroot

And now to perform the real meat of this process, the actual build.

./setup_board --board=x86-generic #Define architecture 
./build_packages --board=x86-generic #This is the real build.  Will take a few minutes at least.

If all went well, you’re ready for the final step…

Generating the Image

Finally, we’ve got to create an image of this system that we can use on our devices or virtual machines. To build the base image, return to your shell and enter…

./build_image --board=x86-generic

… and sit down for some tea while you wait.

When finished, you’ll get some info on exactly where the image file was placed, along with some handy details on how to automatically generate a more specific image type for your needs, such as USB, VMWare or Virtualbox.

buildchrome-image

Before you can run those scripts, you’ll need to exit the chroot environment by typing

exit

In this example, we’re going to build for Virtualbox. Make sure you replace the directory location with the one on your system.

./image_to_virtualbox.sh \
 --from=~/chrome/chromiumos.git/src/build/images/x86-generic/YOURIMAGELOCATION \
--to=~/chromeOS.vdi

Problems?

VMWare/Virtualbox: Unfortunately, there appears to be a bug in some versions of the image_to_vmware script that also affects the image_to_virtualbox script. If you get an error about “Can’t open /usr/lib/shflags”, then you’ve got to do a quick edit of image_to_vmware.sh and change the line

sudo "$TEMP_MNT"/postinst /dev/sda3

to

sudo "$TEMP_MNT"/postinst /dev/sda3 –postcommit

.
USB: It seems the image_to_usb script does not like to have a tilde (~) in the from flag. If you get errors saying that it can’t find the image, make sure to use the full path in the from flag.

Will Chrome OS be the next big thing or is it a step in the wrong direction?

Do you like what you read here?

Receive the latest update in your inbox.

Or connect with us: