Complete Guide To Compile & Run Google Chromium OS on Linux

Recently 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

View Comments

Share
Published by
Vimal Patel
Tags: google google chrome google chrome os linux

Recent Posts

  • Java

Java URL Encoder/Decoder Example

Java URL Encoder/Decoder Example - In this tutorial we will see how to URL encode/decode…

4 years ago
  • General

How to Show Multiple Examples in OpenAPI Spec

Show Multiple Examples in OpenAPI - OpenAPI (aka Swagger) Specifications has become a defecto standard…

4 years ago
  • General

How to Run Local WordPress using Docker

Local WordPress using Docker - Running a local WordPress development environment is crucial for testing…

4 years ago
  • Java

Create and Validate JWT Token in Java using JJWT

1. JWT Token Overview JSON Web Token (JWT) is an open standard defines a compact…

4 years ago
  • Spring Boot

Spring Boot GraphQL Subscription Realtime API

GraphQL Subscription provides a great way of building real-time API. In this tutorial we will…

4 years ago
  • Spring Boot

Spring Boot DynamoDB Integration Test using Testcontainers

1. Overview Spring Boot Webflux DynamoDB Integration tests - In this tutorial we will see…

5 years ago