2009年12月3日 星期四

How to Build Chrome OS

Here, I will show how to build Google Chrome OS in a simple way.

Enviroment:
  1. Ubuntu 8.04 or Ubuntu 9.10, but it was fine to use Ubuntu 9.04 to build (it works fine with me).
  2. An account which can use "sudo" command.
  3. Internet environment, since we get all the source on the cloud.
Notice, there should have no error for the following steps.  If you have the problem, you should try to resolve it rather than skip it.

(1) Install packages by following command.
sudo apt-get install subversion pkg-config python perl g++ g++-multilib bison flex gperf libnss3-dev libgtk2.0-dev libnspr4-0d libasound2-dev libnspr4-dev msttcorefonts libgconf2-dev libcairo2-dev libdbus-1-dev wdiff lighttpd php5-cgi sun-java6-fonts git-core;
  For the builder in Taiwan, there will be a problem while installing msttcorefonts.  It is a problem of the server, not your problem.  Try the method below to solve the problem.
$ host ncu.dl.sourceforge.net;
ncu.dl.sourceforge.net has address 140.115.17.45
$host nchc.dl.sourceforge.net
nchc.dl.sourceforge.net has address 211.79.60.17
nchc.dl.sourceforge.net has IPv6 address 2001:e10:ffff:1f02::17
$echo "211.79.60.17 ncu.dl.sourceforge.net" >> /etc/hosts;
$sudo apt-get install msttcorefonts;
  For further information, please refer to this website(chinese).

(2) Get gclinet(depot_tools)

  Get the depot_tools by download it and unzip it in your home folder.  Here, we provide the easiest way to get the tool.  For further information, please refer to the website(english).

  Next, modify the file in /home/<Your Account>/.bashrc by following command.

sudo gedit ~/.bashrc;
  Add the following line in the end of the file, and save it

export PATH=${PATH}:/home/<your account>/<path to depot_tools>/depot_tools

  Remeber to restart the terminal window to reload the bash file.  You should try typing "gclient" first to try if it is setting properly.

(3) Get the source of Google Chrome OS

  Use the following command to get the newest Google Ghrome OS's source code.
mkdir chromiumos;
cd chromiumos;
gclient config http://src.chromium.org/git/chromiumos.git;
gclient sync;
  This will take a while.

(4) Build the Google Chrome OS

  Use the following command to build Google Chrome OS. All the command has been written in the directory chromiumos/chromiumos.git/src/script . You switch to there first.
./make_local_repo.sh;
./make_chroot.sh;
  If you failed on the first command, before re-build it, you should remove a folder by following command.
sudo rm -rf ~/chromiumos/chromiumos.git/repo/;
  If you failed on the second command, you should use the following command instead.
./make_chroot.sh --replace;

(5) Download Chrome Browser

  This step is simple, just goto this link and download the file like chromium-chromiumos-rxxxxx.zip, save it in ~/chromiumos/chromiumos.git/src/build/x86/local_assets, and than rename it into chromium-chromiumos.zip.

(6) Make the image

  Use the folling commands to make the image of Google Chrome OS
./enter_chroot.sh;
( cd ../platform/pam_google && ./enable_localaccount.sh USERNAME );
./set_shared_user_password.sh;
./build_platform_packages.sh;
./build_kernel.sh;
./build_image.sh;
exit;
  The image will be saved in ~/chromiumos/src/build/images/ .

(7) Use the image
  Here, we just simply put the image into a usb drive by following command.
./image_to_usb.sh --from=~/chromiumos/src/build/images/SUBDIR --to=/dev/USBKEYDEV;
  You can find the value of your usb drive by "sudo fdisk -l;".

  At last, your Chrome OS is finally done.
 
  To test it, you can plug in the usb drive to any computer, boot it by usb. than you will see the Chrome OS login screen.  The user name and password is what you type before, not the google account.