em Sem categoria

Instalando o Google Chrome OS em um PC comum

Este artigo foi tirado da documentação oficial do Chromium project ( material em inglês ):

Instruções para instalanção do Google Chrome OS

This page covers building a Chromium-based OS. It assumes you have already downloaded the source for the OS (and optionally for the browser).

Note: When you produce a Chromium OS image, you need to fulfill the various attribution requirements of the third party licenses. Currently, the images generated by a build don’t automatically do this for you. You’ll need to modify ~/chromium/src/chrome/browser/resources/about_os_credits.html.

Additional Note: Do not run any of these scripts as root already.  These scripts were designed to be run by a user on the sudoers list.  When the scripts need root permissions, they will ask for your password.

Setting up your build environment

Set up symlinks (optional)

The rest of this document assumes you have created symlinks in your home directory for the OS and browser (only for the latter if you download the source). You can set these up with (note these directories depend on where you set up your repository or if you downloaded the tarball, where you unzipped it):

ln -s /usr/local/chromiumos/chromiumos.git ~/chromiumos
ln -s /usr/local/chromium/trunk ~/chromium

You don’t have to create the symlinks, but it makes paths much easier to reference. Once the symlinks exists, you should see src in each directory — for example, ~/chromiumos/src and ~/chromium/src should exist.

Make your local repository

All the necessary scripts to build a Chromium OS image are located in ~/chromiumos/src/scripts.  The rest of these instructions assume you have changed your directory to that directory:

cd ~/chromiumos/src/scripts

To get a reproducible build, we check in an exact list of packages to be used for the chroot build environment and image. To make sure debootstrap and apt-get install only those packages, run the following command to construct a local repository in ~/chromiumos/repo:
./make_local_repo.sh
Note: To modify the contents of that local repository, or create a chroot / image with a different set of packages, see Chromium OS Package Management. Note, check the output of this script to ensure that nothing failed.  If something fails you must sudo rm -rf ~/chromiumos/repo before recalling this script.
If you’re running an older Linux release, your version of debootstrap may not be able to install the newer Karmic version of Ubuntu that we use to build Chromium OS. If making the local repository or the chroot fails, here’s a workaround that installs the Karmic version:
# Create a karmic.list which pulls from chromeos-deb
cat >karmic.list <<EOF
deb http://build.chromium.org/buildbot/packages chromeos_dev main restricted
deb-src http://build.chromium.org/buildbot/packages chromeos_dev main restricted

EOF

# Install karmic debootstrap
sudo mv karmic.list /etc/apt/sources.list.d/karmic.list
sudo apt-get update
sudo apt-get install -y –force-yes debootstrap

# Remove temporary sources.list entry, so you don’t upgrade anything else
sudo rm /etc/apt/sources.list.d/karmic.list
sudo apt-get update

If you’re still having trouble, try this instead:
sudo ln -s /usr/share/debootstrap/scripts/gutsy /usr/share/debootstrap/scripts/karmic

Create your build environment

Chromium OS builds only in a chroot environment, so that its build output is less dependent on the particular flavor of Linux you have installed (Hardy or Jaunty, for example). Do the following to set up a chroot environment:

./make_chroot.sh
Note: By default, the setup script configures /etc/apt/sources.list to pull from the local repository you created in the previous step. If you’re pushing the boundaries of development (for example, attempting to compile for a different processor), you may need to get the most recent packages from the repository. In that case, run the following:
./make_chroot.sh --mirror=http://build.chromium.org/buildbot/packages --suite=chromeos_dev

That command pulls packages from the Chromium repository. Note that this is slower than a local repository. Also note you can use any of the official Ubuntu mirrors. You’ll need to specify the same --mirror and --suite options to the build_image.sh script below.

Building Chromium OS

Build Chromium (optional)

If you chose to download the source code for the browser, you’ll need to build the browser before you complete the rest of the build process:

./build_chrome.sh --chrome_dir ~/chromium

To build a debug version:

./build_chrome.sh --mode=Debug --chrome_dir ~/chromium

This builds Chromium, zips up the output, and puts it in the right place for build_platform_packages to pick up.

Download Chromium binary (you MUST do this if you didn’t use the step above)

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.

Enter the chroot build environment

Run the following to get into the chroot environment:
./enter_chroot.sh

Making development easier

The following steps make development a little easier. These only need to be done once; consult the scripts for information on how to undo these steps if you change your mind later. These steps have to be done before you build the rest of your system to have them take effect.

Enable a local user account

If you are customizing Chromium OS and having trouble logging in due to your customizations, it may be handy to be able to bypass authentication and log yourself in as a test user. This is disabled by default for security reasons, but if you want to enable it for a backdoor user USERNAME:
( cd ../platform/pam_google && ./enable_localaccount.sh USERNAME )

Set the shared user password

For security, the shared user password defaults to a long random string. If you want to be able to sudo from the terminal in Chromium OS (this also includes actually installing the OS on your device), need help debugging networking, or you have some other 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
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.

Build the packages (note you can use build_all.sh to run all these steps together)

Do this inside the chroot build environment. We build the platform packages and then the kernel. You can substitute a different config or kernel build number if you know what you are doing.

./build_platform_packages.sh
./build_kernel.sh

Build the image

Do this inside the chroot build environment.

./build_image.sh


The default output location for images is ~/chromiumos/src/build/images.

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.

Using your image

Check the contents of the image

To check the contents of your image, mount it locally. In this example, SUBDIR is the subdirectory created in the previous step.

cd ~/chromiumos/src/build/images/SUBDIR
sudo mount -o loop rootfs.image rootfs
sudo chroot rootfs

You’re now in the image, and can do things like see how much space is used in the image or what packages were installed:

df
dpkg -l

When done, exit the chroot shell and unmount the image:

exit
sudo umount rootfs

Copy the image to a USB key

Use image_to_usb.sh to copy the image to a USB key. Do this outside the chroot environment. (If your USB key seems blank, you’re probably inside the chroot environment.) Make sure you have a 4GB USB key.
./image_to_usb.sh –from=~/chromiumos/src/build/images/SUBDIR –to=/dev/USBKEYDEV

SUBDIR is the subdirectory created by build_image.sh, and USBKEYDEV is the device for the USB key.

To determine the value for USBKEYDEV, use:

sudo fdisk -l

or

dmesg

What you want is the device for the entire key (for example, /dev/sdb, not /dev/sdb1).

By default, image_to_usb.sh copies from the most recent image you’ve built to /dev/sdb, so you may be able to omit the --from and/or --to options.

Copy image to hard drive (see development hardware)

WARNING: this nukes your hard drive
Boot from the USB image you just burned. (If this is the first time you’ve booted from USB, you may need to go into the BIOS settings and change the boot order so that it’ll boot from the USB drive)
After logging in, use Ctrl+Alt+T to open a terminal window and type:
/usr/sbin/chromeos-install
Note: this will ask you for the password you set in the recommended step earlier. Unplug the USB drive, reboot and you’re there.

Convert the image for VMWare

Note:  The VMWare image may have missing functionality (e.g. no virtual terminal, slow keyboard response, etc).  We suggest that developers obtain development hardware

If you want to boot from the image in a vmware session you’ll need to first convert it to a vmware disk. First install qemu. Then execute these commands:


./image_to_vmware.sh –from=~/chromiumos/src/build/images/SUBDIR \
–to=~/chromiumos/src/build/images/SUBDIR/ide.vmdk
By default, image_to_vmware.sh will convert the most recent image you’ve built to ide.vmdk, so you may be able to omit the --from and/or --to options.

Delete an old chroot build environment

To delete an old chroot build environment, use:

./make_chroot.sh --delete
Do NOT use rm -rf, since if there are stale bind mounts, you may end up deleting your source tree.