Here’s a step by step breakdown of how to build Chrome OS under Ubuntu 9.10 (running as a virtual machine with VMware Fusion on Mac OS X) and testing the built image also via VMware Fusion. At this time of the original post I couldn’t get chromium (the browser portion) to actually build, as it had compilation errors, and it required a pre-built browser binary, which was graciously provided by Mohamed Mansour. I have now updated the steps to list how to build the browser from source, or use the pre-built binary.
Most, if not all, of this information is available via the Chromium OS pages, gdgt, and some other sources, however, these instructions are meant to be easier to follow for anyone with this specific build environment (using VMware Fusion on Mac OS X). I like VMs for these purposes, while there may be a performance tax, it allows easy snapshots (can roll back to a snapshot if need be) and help avoids adding too much clutter on my main machine.
Lastly, the Chromium OS discussion group and the #chromium-os channel on irc.freenode.net are good resources for getting quick answers from knowledgeable people.
1. Create Ubuntu 9.10 virtual machine under VMware Fusion 3 (Mac OS X)
- Download 9.10 .iso file for Ubuntu
- In VMware fusion, click File -> New
- Continue without disc
- Use an operating system installation disc image file
- Choose .iso file downloaded previously
- Operating System: Linux, Version: Ubuntu
- Assign Easy Install password
- Click “Customize Settings”
- Save Settings as desired
- Enable sharing, create a folder on the Mac to share with Read/Write access. In this example, I have created a Desktop folder named “Ubuntu Share”
- Change networking to bridged (if desired, leaving as NAT should work fine as well)
- Increase the disk size as 20 GB is a bit small for a build machine, 100 GB should be fine. There’s really no reason to go conservative if you are using a dynamically expanding VMware virtual disk, the complete size will only be used if needed. Also be sure to check the option to split the VMDK into 2 GB chunks, which makes backup/restore more granular and easier to manage.
- Start up Virtual Machine
- Installation will start and proceed, eventually it will restart and you will receive a login prompt, login with the user and password specified above
- VMware Tools will install automatically, you will be placed at a login prompt, wait while it installs, it will eventually restart into the GUI. If it doesn’t finish after quite some time, just power off and restart, it should boot into the GUI
- Login when prompted
2. Configure dependencies and tools (Ubuntu 9.10)
- Start a terminal session: Applications -> Accessories -> Terminal
- (http://www.chromium.org/chromium-os/building-chromium-os)
- Install chromium prerequesites: http://src.chromium.org/svn/trunk/src/build/install-build-deps.sh
- Save file as install-build-deps.sh. It will save to ~/Downloads, so cd to that directory.
- Run chmods +x install-build-deps.sh
- Execute with sudo ./install-build-deps.sh
- Select y for debugging symbols
- When prompted for REPLACE SYSTEM LINKER ld with gold and back up ld, select y or press enter
- If prompted do you want to continue, press y
- It will run for a considerable amount of time, when complete you will be returned to a command prompt
- install qemu: sudo apt-get install qemu (if prompted select y)
3. Download / sync source code (Ubuntu 9.10)
- Download the chromium depot tools: http://sites.google.com/a/chromium.org/dev/developers/how-tos/install-gclient
- cd ~
svn co http://src.chromium.org/svn/trunk/tools/depot_tools
- Add the new dir to your path via: export PATH=`pwd`/depot_tools:”$PATH”
- You must run that command in the ~ directory. Use echo $PATH to see the results. The depot_tools dir in your home directory should be at the front of the path. You can add this to .profile or .bashrc so that it will occur next session
- Install git: sudo apt-get install git-core. If prompted to continue, choose y
- If you wish to build the chromium (browser) from source do the following
- mkdir ~/chromium
- cd chromium
- gclient config http://src.chromium.org/svn/trunk/src http://build.chromium.org/buildbot/continuous/LATEST/REVISION (Get a known good)
- export GYP_DEFINES=”chromeos=1″ (consider adding to .profile or .bashrc)
- gclient sync –deps=”chromeos,unix”
- (will run for a long time)
- (end of steps to retrieve browser source)
- Get the chromium OS repository as follows:
- mkdir chromiumos
- cd chromiumos
- gclient config http://src.chromium.org/git/chromiumos.git
- gclient sync
- The sync will take a long time, and will appear to stall at several points, just allow it to continue
4. Build (Ubuntu 9.10)
- http://sites.google.com/a/chromium.org/dev/chromium-os/building-chromium-os/build-instructions
- Make Local Repository as follows:
- cd ~/chromiumos/chromiumos.git/src/scripts
- ./make_local_repo.sh (may need to enter sudo password)
- Create build environment
- ./make_chroot.sh
- If you did not download the chromium browser source, you must incorporate a pre-built browser binary:
- Download chromium browser binary: http://mohamedmansour.com/chrome/builds/chrome-linux.zip or http://build.chromium.org/buildbot/continuous/linux/LATEST/chrome-linux.zip
- cp ~/Downloads/chrome-linux.zip ~/chromiumos/chromiumos.git/src/build/x86/local_assets
- If you did download the chromium browser source, you will now build it:
- cd ~/chromiumos/chromiumos.git/src/scripts
./build_chrome.sh --chrome_dir ~/chromium
- (This will take quite some time. It must complete successfully. If it doesn’t you’ll likely get a blank blue gradient screen after signing in to Chromium OS)
- Now we will build the OS
- cd ~/chromiumos/chromiumos.git/src/scripts
- ./enter_chroot.sh
- Create a debug user (called USERNAME)
- ( cd ../platform/pam_google && ./enable_localaccount.sh USERNAME)
- ./set_shared_user_password.sh (set any password)
- ./build_platform_packages.sh
- ./build_kernel.sh
- ./build_image.sh
- When complete, a short blurb on how to convert for vmware. Note that path will have to be changed (see next instructions)
5. Convert to VMware VDK (Ubuntu 9.10)
- Open another terminal (must do this outside of the chroot)
- cd ~/chromiumos/chromiumos.git/src/scripts
- ./image_to_vmware.sh –from=/chromiumos/chromiumos.git/src/build/images/999.999.32609.025303-a1 (NOTE: Last part will change see the output from the ./build_image.sh to confirm the specific build name)
- Copy the resulting vmdk file to the VMware shared folder
- cp ~/chromiumos/chromiumos.git/src/build/images/999.999.32609.025303-a1/ide.vmdk “/mnt/hgfs/Ubuntu Share”
- NOTE: in the previous command “hgfs” of the “/mnt/hgfs” path stands for host guest file system, and is how you access shared folders in Linux under VMware.
6. Test image using VMware Fusion (Mac OS X)
- In VMware Fusion, click File -> New
- Continue Without Disc
- Use an existing virtual disk
- Select the file created, ide.vdmk (will be in ~/Desktop/Ubuntu Share)
- Select option: Share this virtual disk with the virtual machine that created it
- If prompted to convert, choose “Don’t convert”
- Continue
- Leave Linux, Ubuntu
- Change disk size if desired, the default 20 GB is plenty of space. Click Finish
- Save as Chrome OS 1 (or name of your liking)
- Start up the virtual machine
- After booting, Chromium OS login screen should appear
Login with your google account (gmail e-mail address and password), if you receive a blank blue screen , try Ctrl-Alt-N or Ctrl-Alt-T for virtual terminal (must be a debug build for virtual terminal to work). If your gmail account doesn’t work, try logging in with the USERNAME and password set during build.