Complete Guide To Compile & Run Google Chromium OS on Linux

google-chrome-osRecently Google declared its Chromium OS open source. Chromium is their own version of Linux specially build for netbooks/pcs to access internet in a better and faster way. Since I was free for the day & had no plans ahead of me, I decided to give it a shot. Some Googling led me to the Google Chrome OS Home Site chromium.org of all information for chromium os. You can download the source code in form of trall-balls from the website, or make a repository from the site, or just browse the latest code. It also has same kind of stuff for the Chrome browser. I decided to compile the OS and run it on VMPlayer, but I found the instructions on chromium’s build page a bit less accurate or vague, so decided to write them down myself. I faced a few issues in compilation process which I will highlight in the tutorial as well. So to begin with, here are list of stuffs you will need to compile and run your own Google Chrome OS.

Things You Need

  1. latest Linux ( Ubuntu 9.04 used for this experiment )
  2. root access on the computer.
  3. other chromium prerequisite from here for building the Chromium OS .
following the above page , install which ever package are necessary for your Linux distribution.. Building on Linux requires the following software.
  • Python >= 2.4
  • Perl >= 5.x
  • gcc/g++ >= 4.2
  • g++-multilib >=4.2
  • bison >= 2.3
  • flex >= 2.5.34
  • gperf >= 3.0.4
  • pkg-config >= 0.20
  • libnss3-dev >= 3.12
  • libasound2-dev
  • libgconf2-dev
  • libglib2.0-dev
  • libgtk2.0-dev
  • libnspr4-0d >= 4.7.1+1.9-0ubuntu0.8.04.5 (ubuntu0.8.04.1 causes duplicate dtoa references)
  • libnspr4-dev >= 4.7.1+1.9-0ubuntu0.8.04.5
  • msttcorefonts (Microsoft fonts)
  • freetype-dev
  • libcairo2-dev
  • libdbus-1-dev
Optional (currently, all of these are only used by layout tests):
  • wdiff
  • lighttpd
  • php5-cgi
  • sun-java6-fonts (needed for Lucida)
You will also need to install VMPlayer from here , and some Qemu tools like qemu-img,etc.. After installation of all this packages, download the trall-ball of source code for Chromium os from here. and un tarr it at location /usr/local/chromiumos/ in your file system. Now make a symlink in your home directory chromiuos with the following command:
ln -s /usr/local/chromiumos/<path to src dir inside chromium untared>/ ~/chromiumos
Code language: Bash (bash)
Since we have downloaded the source code, we wont need to build our repository. Now go in the ~chromiumos/src/scripts/ directory, where you will get many *.sh shell scripts , some of which require you to be a sudoer.

Creating the Build Environment

Execute the following in the scripts directory:
./make_chroot.sh
Code language: Bash (bash)
ISSUES: A problem that I faced with this script is , every time I ran this script , it ended with error saying “useradd : root already exists”. So I opened up the script and wrote some echo statements as check points inside the script. and reran it untill I found out where the script was giving me trouble. It was around statement that was creating a user with UID = 0 and name as root,it also added some groups to the user. so, I replaced the uid with “1000” & user name with “vimal”, both without quotes. the previous statement in the script was commented out & replaced by something like this.
#in_chroot useradd -G ${DEFGROUPS} -g eng -u `id -u` -s \ # /bin/bash -m -c "${FULLNAME}" -p ${CRYPTED_PASSWD} ${USER} in_chroot useradd -G eng,admin,adm,dialout,cdrom,floppy,audio,dip,video -g eng -u 1000 -s \ /bin/bash -m -c "${FULLNAME}" -p ${CRYPTED_PASSWD} vimal in_chroot mkdir /home/root in_chroot mkdir /home/root/trunk
Code language: Bash (bash)
The id -u was giving the value 0(zero) & ${USER} giving root. This fix solved the issue, only thing that user “vimal” had membership of admin group. Whatever be the output, the script must end successfully. When the chroot environment is made up you will have to chroot into it.

Download Chromium Binary

I decided not to compile chrome browser, instead download the binaries & use them as is in the Chromium OS. Download the binary and copy it into ~/chromiumos/src/build/x86/local_assets as chrome-chromeos.zip (you have to create this directory). This will give you a recent copy of the browser for use with Chromium OS.

One Critical Step

The chromium OS build page dosen’t tell this, but you will have to copy the <chromium>/*.* all the files & directories to the <chromium>/chroot/usr/local/chromiumos/*.* except <chromium>/chroot, if the directory doesn’t exist then make them . And then ch dir to <chromium>/chroot/usr/local/chromiumos/src/scripts/ . From here onwards all the scripts that will be run ,will be from inside the new chroot environment.

Enter the chroot Environment

Execute the script in the terminal with src/scripts as your present working derictory.
./enter_chroot.sh
Code language: Bash (bash)

Backdoor User

By default for security reasons the backdoor user USERNAME is off, you can turn it on , in case you have trouble logging into system. use following command:
cd ../platform/pam_google &amp;&amp; ./enable_localaccount.sh USERNAME
Code language: Bash (bash)
You can experiment to substitute the USERNAME with your name like I did “vimal”.

Set the Shared User Password

You may have some reason for needing to log on directly as the shared user, you need to set up the password for the shared user:
./set_shared_user_password.sh
Code language: Bash (bash)
This will prompt you for a password. The encrypted password will be stored in ./shared_user_password.txt, so you only need to do this once.

Building the Packages for Chromium OS

Execute following script to build all softwares and packages that will be used in the Chromium OS.
./build_platform_packages.sh
Code language: Bash (bash)
ISSUE: I faced Issue over here like many others on the net, reporting gcc and other packages not found inside the chroot environment. If it says any thing like this while executing the script:
checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking whether to enable maintainer-specific portions of Makefiles... no checking for pkg-config... no checking for gcc... no checking for cc... no checking for cl.exe... no configure: error: in `/home/root/trunk/src/third_party/connman/connman-0.42': configure: error: no acceptable C compiler found in $PATH See `config.log' for more details. /home/root/trunk/src/third_party/connman /home/root/trunk/src/third_party/connman ./../../scripts/common.sh: line 147: dpkg-buildpackage: command not found
Code language: Bash (bash)
Than it means that you have not made the directory structure <chroot>/home/root/trunk and you have not copied <chromium>/*.* into <chromium>/chroot/usr/local/chromium/*.* or you have not changed dir to <chromium>/chroot/usr/local/chromium/src/scripts/ before entering the chroot environment.

Building the Chromium Kernel

I expected this process to take long just like linux kernel but it was apparent quickly done. Execute the script
./build_kernel.sh
Code language: Bash (bash)

Another Important Step

Now you will need to copy all the directory & files in <chroot>/usr/local/chromiumos/*.* to <chroot>/home/root/trunk/*.* , and chdir to <chroot>/home/root/trunk/src/scripts . I am not sure whether we should have done this in the fist place itself, but anyways it worked for me.

Build the Image for Chromium Kernel

/build_image.sh
Code language: Bash (bash)
Using the above script you can make the kernel image that will actually boot up the pc or netbook. On success this script will generate a unique number in the last line of its output. ISSUE: I face a problem here, while running this script, it abruptly ended with no successful output. Again the echo checkpoint came to rescue. The group of statements pinpointed here was the one that customized the root file system. So I copied the stuff in <chroot>/usr/local/chromiumos/*.* to <chroot>/home/root/trunk/*.* & executed the script form new location. Hence the previous step was added in this tutorial. If every thing works out smooth then src/build/images. directory will have some files & directories. The output of build_image.sh will 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). Check the output of build_image.sh to find the corresponding directory where your new image has been placed. Copy this new directory from images to some other convinient place, like /home/vimal/Desktop/image/*.* for later use.

Check your New Image

cd <chroot>/home/root/trunk/src/build/images/<SUBDIR with unique number> sudo mount -o loop rootfs.image rootfs sudo chroot rootfs dpkg -l
Code language: Bash (bash)
It should print some where that all the packages are properly built with no issues in any of the packages.
exit sudo umount rootf
Code language: Bash (bash)
Now we are done with building the Chromium OS , but we still need to make a bootable image for VMPlayer. So copy the image_to_vmware.sh to the place where you had kept the copied root image in the convenient place and execute.
./image_to_vmware.sh --from=<path to image>/images/SUBDIR \ --to=<path to image>/images/SUBDIR/ide.vmdk
Code language: Bash (bash)
You will need qemu-img package to be installed on your Linux system. Use this ide.vmdk as your bootables in any virtual machine for the VMPlayer. You can find some of the screenshots on my home page blog at too. Enjoy compilation :)

Few Screen Shots

Get our Articles via Email. Enter your email address.

You may also like...

1 Comment

  1. Vatsal Parekh says:

    Dear Viral Patel , you have to be standard user and call ‘./make_chroot.sh’ as follows
    >sudo ./make_chroot.sh

    Note:
    Please help.
    After calling following script
    > sudo ./make_local_repo.sh
    After verifying and retrieving packages following happens (this is just a snippet not a complete detail) what is this? and it’s causing me more than 200 MB.

    28474/128474] -> “/var/cache/make_local_repo/libgl1-mesa-glx_7.5-1ubuntu1_i386.deb” [1]
    Exporting indices…
    Adding libglib2.0-0…
    2009-12-18 11:27:12 URL:http://build.chromium.org/buildbot/packages/pool/main/g/glib2.0/libglib2.0-0_2.21.2-0ubuntu1_i386.deb [938568/938568] -> “/var/cache/make_local_repo/libglib2.0-0_2.21.2-0ubuntu1_i386.deb” [1]
    Exporting indices…
    Adding libglib2.0-dev…
    2009-12-18 11:27:25 URL:http://build.chromium.org/buildbot/packages/pool/main/g/glib2.0/libglib2.0-dev_2.21.2-0ubuntu1_i386.deb [1094702/1094702] -> “/var/cache/make_local_repo/libglib2.0-dev_2.21.2-0ubuntu1_i386.deb” [1]
    Exporting indices…

Leave a Reply

Your email address will not be published. Required fields are marked *