• 2009-11-24 14:00:00

    Chromium OS - Part III

    Continued from Part II

    I had to shut the computer down because I had a train to catch. However booting up again the computer on the train and trying to enter the chroot environment produced some errors. It might very well be the fact that I do not have an Internet connection (at least a reliable one).

    So this post will have to wait until I get back home so that I can continue the installation. The key point here will be how to add the Chromium OS image over the second partition of my hard drive so that I can keep my dual boot system. I will run Image for DOS and clone my hard drive, in an effort to keep a mirror backup of my notebook at this particular point in time - you never know when you will use it.

    So I booted again into Ubuntu and started the process. I run

    ./create_chroot.sh
    

    but it complained that a chroot already exists. I then run

    ./create_chroot.sh --delete
    

    which effectively removed the existing chroot and replaced it with a new one. Little did I know that I only had to run

    ./enter_chroot.sh
    

    to re-enter my previous chroot and continue where I left off. Oh well, you live and learn :)

    Just to be on the safe side I rerun the ./build_platform_packages.sh, ./build_kernel.sh and ./build_image.sh scripts. I am now exactly where I was prior to shutting the computer off. I have built the platform packages, the kernel and the image.

    Using the image

    Check the contents of the image

    I will mount the image locally to ensure that everything is OK. Please note that the folder below is the one created on my machine and might very well be different than yours. At the end of the build_image.sh script you will see a message that will reveal where your image folder is.

    cd ~/trunk/src/build/images/999.999.32909.021312-a1/
    sudo mount -o loop rootfs.image rootfs
    sudo chroot rootfs
    

    Inside the image basic commands will reveal success or failure:

    df
    dpkg -l
    

    Once everything is OK (or at least seems OK) I exit and unmount the image.

    exit
    sudo umount rootfs
    

    Although I got a cannot read table of mounted file systems: No such file or directory when I run df, dpkg had a long list of packages installed. I will for the moment ignore the df output and proceed to the next steps.

    Copy the image to a USB key

    Somehow I have misplaced my 16GB USB drive so I had to borrow a 4GB one from a friend of mine. This step copies the actual image from the hard drive to the USB drive. The drive itself is wiped clean so make sure that you have backed up the data that you have on it prior to running this step.

    You need to find out the device that your USB drive corresponds to. Running:

    sudo fdisk -l
    

    will reveal which device is the USB drive. For my system it is /dev/sdc1. Outside the chroot you run the script image_to_usb.sh. The command is:

    ./image_to_usb.sh --from=~/chromiumos/src/build/images/SUBDIR --to=/dev/USBKEYDEV
    

    and for my system the command was:

    ./image_to_usb.sh --from=~/chromiumos/src/build/images/999.999.32909.021312-a1/ --to=/dev/sdc1
    

    The output on the screen running the above command is:

    ndimopoulos@ARGON:~/chromiumos/src/scripts$ ./image_to_usb.sh --from=~/chromiumos/src/build/images/999.999.32909.021312-a1/ --to=/dev/sdc1
    Copying USB image /usr/local/chromiumos/chromiumos.git/src/build/images/999.999.32909.021312-a1 to device /dev/sdc1...
    This will erase all data on this device:
    Disk /dev/sdc1: 4013 MB, 4013917184 bytes
    Are you sure (y/N)? y
    attempting to unmount any mounts on the USB device
    Copying root fs...
    opening for read /usr/local/chromiumos/chromiumos.git/src/build/images/999.999.32909.021312-a1/rootfs.image
    opening for write /dev/sdc1
    seeking to 1992294912 bytes in output file
    copy 996147200 bytes took 102.384 s
    speed: 9.7 MB/s
    Creating stateful partition...
    mke2fs 1.41.9 (22-Aug-2009)
    Filesystem label=C-STATE
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    60800 inodes, 243200 blocks
    12160 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=251658240
    8 block groups
    32768 blocks per group, 32768 fragments per group
    7600 inodes per group
    Superblock backups stored on blocks:
     32768, 98304, 163840, 229376
    
    Writing inode tables: done
    Creating journal (4096 blocks): done
    Writing superblocks and filesystem accounting information: done
    
    This filesystem will be automatically checked every 30 mounts or
    180 days, whichever comes first.  Use tune2fs -c or -i to override.
    Copying MBR...
    opening for read /usr/local/chromiumos/chromiumos.git/src/build/images/999.999.32909.021312-a1/mbr.image
    opening for write /dev/sdc1
    copy 512 bytes took 0.001 s
    speed: 0.0 MB/s
    Done.
    

    I have booted the system using the USB drive and I logged in the system using my google account. Using Ctrl+Alt+T I open a terminal and enter:

    /usr/sbin/chromeos-install
    

    This asks now for the password that I have set up earlier (the one stored in the text file) and then it nukes the hard drive replacing everything (make sure you backup your hard drive).

    A bit later I unpluged the USB drive and rebooted. Unfortunately things did not work very well but that is probably due to my particular hardware. I will retry this on my other notebook and update this blog post.

  • 2009-11-24 13:00:00

    Chromium OS - Part II

    Continued from Part I

    The download took quite a while, so I thought it might be a good idea to split this post in parts, so as to ensure good readability.

    I need to create some symlinks. Also a good place to add my repository is /usr/local hence the commands for Chromium OS and Chromium respectively.

    sudo mv chromiumos/ /usr/local/
    sudo mv chromium/ /usr/local/
    

    and now adding the symbolic links

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

    Creating the local repository

    All the scripts are in the src/script folder. So let's go to that folder (the symbolic link set earlier helps :))

    cd ~/chromiumos/src/scripts
    

    and running the command to create the local repository:

    ./make_local_repo.sh
    

    This command will ask you for your password - and bare in mind you must run all this as a normal user with sudo access - and then it will create a debootstrap. It will fetch the necessary packages from the Chromium OS Package Management.

    NOTE

    If something fails you will need to do

    rm -rf ~/chromiumos/repo
    

    and then rerun the ./make_local_repo.sh script again.

    Creating the build environment

    All we need to do is run the following command:

    ./make_chroot.sh
    

    The script will check if all the dependencies are satisfied, and if something is missing it will pull the necessary files and compile them as necessary. Although I did not encounter any problems, the documentation states that the /etc/apt/sources.list is used for retrieving the packages. If your setup is pulling packages from somewhere else then you may need to get the most recent packages from the repository. You can do that by running:

    ./make_chroot.sh --mirror=http://build.chromium.org/buildbot/packages --suite=chromeos_dev
    

    Building Chromium OS

    I need to build Chromium first (since I chose to download it too). This is necessary since your build will fail if you try it the other way around :)

    ./build_chrome.sh --chrome_dir ~/chromium
    
    Enter the chroot build environment

    Run the following command gets us back in the chroot environment (you will be asked for your password)

    ./enter_chroot.sh
    
    Set the shared user password

    This is a one-off step for those of us that want to be able to sudo from a terminal. I am setting the shared user password running the following script:

    ./set_shared_user_password.sh
    

    This will prompt for the password and the output will be stored in the ./shared_user_password.txt file. Don't worry the password is encrypted so if you do not have anyone watching over your shoulder while typing your password you are OK. Just to be on the safe side, clear the screen.

    clear
    
    Build the platform packages

    In the chroot environment run

    ./build_platform_packages.sh
    

    Unfortunately I hit a snag :( The build_platform_packages script produced an error:

    Checking for latest build of Chrome
    Downloading http://chrome-web/buildbot/snapshots/chromium-rel-linux-chromiumos/LATEST
    --2009-11-24 19:44:49--  http://chrome-web/buildbot/snapshots/chromium-rel-linux-chromiumos/LATEST
    Resolving chrome-web... failed: Name or service not known.
    wget: unable to resolve host address `chrome-web'
    make: *** [build-stamp] Error 1
    

    I quickly found what I need to do (Google is your friend :)). It appears that this is known bug and it is easily fixable. All I had to do is edit the copy_chrome_zip.sh file. I tried using nano in the chroot environment but it was not there. For that I exited the chroot and edited the file.

    exit
    nano -w ~/chromiumos/src/platform/chrome/copy_chrome_zip.sh
    

    Locate the line with the BASE_URL variable and change chrome-web to build.chromium.org and save the file. After that enter again the chroot and rerun the build_platform_packages.sh script.

    ./enter_chroot.sh
    ./build_platform_packages.sh</pre>
    

    Quite a bit later the script execution ended with All packages built :)

    Build the kernel

    In the chroot environment run

    ./build_kernel.sh
    

    A bit later I am looking at this message and grinning :)

    Kernel build successful, check /home/ndimopoulos/trunk/src/build/x86/local_packages/linux-image-2.6.30-chromeos-intel-menlow_002_i386.deb
    
    Build the image

    In the chroot environment run

    ./build_image.sh
    

    The script starts with validations, configurations, unpacking and compilations - all too fast for my eye to capture.

    The script finished compiling and there are warnings and errors :(. They all have to do with the disk geometry and partition 1 extends past the end of the disk /shrug again....

    In the end I get this on the screen which hopefully is OK...

    Re-reading the partition table ...
    BLKRRPART: Inappropriate ioctl for device
    
    If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
    to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
    (See fdisk(8).)
    Done.  Image created in /home/ndimopoulos/trunk/src/build/images/999.999.32809.203441-a1
    To copy to USB keyfob, outside the chroot, do something like:
      ./image_to_usb.sh --from=/usr/local/chromiumos/chromiumos.git/src/build/images/999.999.32809.203441-a1 --to=/dev/sdb
    To convert to VMWare image, outside the chroot, do something like:
      ./image_to_vmware.sh --from=/usr/local/chromiumos/chromiumos.git/src/build/images/999.999.32809.203441-a1
    

    Continued in Part III

  • 2009-11-24 12:00:00

    Chromium OS Part I

    A lot of hype has been generated on the Internet a few months back regarding Google's announcement that they are building a new operating system. The announcement was met with skepticism but also enthusiasm/anticipation by a lot of people who are puzzled as to what direction Google is taking and where are they looking themselves positioned in the computer industry.

    Google has already established themselves in the mobile operating system with Android which for many is better than Apple's iPhone. What managed to get Google very high up in user satisfaction with Android was the fact that it is open source. It is backed by Google and they are putting a lot of effort into this but the fact that anyone can download the source code and build the operating system themselves is amazing. Giving people the freedom to choose should be something that every company should do (personal opinion).

    On Friday I watched the Chromium OS Webcast. A lot of people have been waiting for a presentation from Google of the new operating system. Google provided just that but with a small twist. The presenters outlined the features of the new operating system: Fast, Fast, Fast.

    Although the presenters clearly stated that they will not provide any links to hardware, what is supported, where Chromium OS runs etc. they made sure to address one of the core features of Chromium OS. It is Open Sourced! That alone gives people again freedom. Freedom to choose what they want to have as their operating system in their computer.

    The website for the new operating system is located here and there are instructions on how you can build this new OS even in its current state - which is not production ready.

    Curious (as usual) I tried installing the Chromium OS on a virtual machine. My experience installing the new OS and other comments is outlined below:

    Prerequisites

    My DELL Studio 17 has two hard drives and because I really really do not like Windows Vista, I have installed Ubuntu 9.10 32bit on the second partition. The notebook enjoys a 2.4GHz Intel processor and 6GB RAM.

    I applied all the relevant updates (just to be on the safe side) and a couple of reboots later I am ready to venture in the unknown. The documentation outlines the minimum required packages: 

    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)

    Because I didn't want to go and check the version of every package mentioned above I run the following command (mentioned also in the documentation)

    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
    

    And then the optional extras:

    sudo apt-get install wdiff lighttpd php5-cgi sun-java6-fonts
    

    A few minutes later the necessary packages had been downloaded and installed. One step closer to my goal :)

    Getting the code

    Now that all the prerequisites have been satisfied. I need to get the code!

    Navigating to this link in the chromium.org wiki, I get all the instructions on how to get the code. There are some prerequisites there (i.e. your system needs to be able to uncompress tar files) but nothing out of the ordinary.

    I installed the depot_tools which was really a two step process - svn checkout the tools and add the tools path in the current path. After that I installed the git-core:

    sudo apt-get install git-core
    

    I will pull the source code from the SVN repository. I can just as easy download the tarball and unzip it. The instructions in the chromium.org wiki explain both options.

    I am ready to get the source code for the Chromium OS package. You can get the code with the Chromium browser or without it. I am opting to get it with the Chromium browser. The following commands retrieve the necessary files for the OS as well as dependencies for the browser:

    mkdir ~/chroomiumos
    cd ~/chromiumos
    gclient config http://src.chromium.org/git/chromiumos.git
    gclient sync --deps="unix,chromeos" --force
    

    The download takes a bit of time since there are a lot of files that we need to retrieve. In situations like these, browsing, reading a book, going to get something to eat or working on the other computer are some of the activities you can engage yourself in so as to kill time. That is of course if you do not have a T1 or FIOS at which point this step will be finished by the time you read this sentence :) (/sigh I miss FIOS).

    I open another terminal window in order to retrieve the Chromium source code (the browser now).

    mkdir ~/chromium
    cd ~/chromium
    gclient config http://src.chromium.org/svn/trunk/src
    gclient sync
    

    and the wait continues....

    Continued in Part II