Virtual Guru's Blog – Home of Virtualization Workshops

September 5, 2010

12minutes: Building Chromium OS image in 12 steps on ATOM nettop HW using REPO

Filed under: 12minutes, ChromeOS — Tags: , — natiku @ 7:02 pm

12 Minutes: Chromium OS Here I will like to share my experience compiling and building Chromium OS image on
relatively low power ATOM netbook or nettop like HW using new REPO command.

Chromium OS is 32 bit system, but you need a 64bit Linux system to build it on,
you can also utilize tricks for low power systems bellow on old 64bit Duron/Athlon with similar power of my nettop like
1.6Ghz ATOM 230 and D510 configurations

Here is my 12 steps for Compiling and Building Chromium OS USB Image:

Last Update for: 0.9.125 2010/11/20 1314

Timing notes: Build process access Internet, my connection is DSL 3Mbit which I can in most cases fully utilize.

1. Use dedicated partition as building area

– You can have more versions (full copies) of build environments and just link right to home
– Dedicated partition can be more easily cleaned and reformatted to speed up again compiling after you will feel it slow

df -h /buildarea
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 45G 173M 45G 1% /buildarea

2. Use Linux in text mode to get more memory

I reboot my 64bit Ubuntu 10.04.1 TSL Desktop into text mode manually just by appending in grub text to default linux entry.

On my system with with 1GB of RAM I get around 800MB free memory right after boot, later I upgrade to upgrade to 2GB, but I still boot to text mode to also get more cpu power.

3. Use dedicated Linux User and configure system

I introduce my dedicated build user mainly due to dash issues with bash_completion in Ubuntu 10.04 GUI mode and also because I can add to it some useful lazy defaults 🙂

I will create my build user as chronocb

sudo useradd -m chronocb -G admin,cdrom,plugdev -s /bin/bash \
  -c "Chromium OS Compile and Build"
sudo passwd chronocb

Lazy stuff: Installing GPM, so I copy with mouse in terminal, because here is no mouse support in terminal by default in Ubuntu 10.04 Dekstop

sudo apt-get install gpm

Lazy stuff: By default, the Linux kernel will use terminal screen-save option to disable monitor after while,
I disable it for my LCD monitor VESA power saving features because my monitor have multiple inputs and monitor
will switch to others with signal when Linux terminal goes blank, I will add in at the and of ~/.profile

setterm -powersave off -blank 0 -powerdown 0

Lazy stuff: Allow build user to use sudo command without password

sudo visudo

Add this line at the end (change “chronocb” to your username):


Ctrl-X to leave, save your changes, and you're done! 

Lazy stuff: I disable automount of media in GUI (Gnome) ,
because it will harm signed root on Chromium OS USB disks, when
I will forget them plugged in and reboot into Desktop

gconftool-2 -R /apps/nautilus/preferences

gconftool-2 --type bool --set /apps/nautilus/preferences/media_automount false

4. Configure dedicated build user and get needed tools

– Log as your build user:

su -  chronocb

– Link dedicated build area to build user home ~/chromiumos

df -h /buildarea
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 28G 173M 26G 1% /buildarea

sudo mkdir /buildarea/chromiumos

sudo chown chronocb:chronocb /buildarea/chromiumos/

ln -s /buildarea/chromiumos/ ~/chromiumos

– Get needed tools

sudo apt-get install git-core subversion curl

cd ~/chromiumos
svn co

mkdir ~/etc
cd ~/etc
Get there bash_completion from bottom of this page

curl "" \
  -o bash_completion -L

cd ~/chromiumos

– Set tools in path and add git related stuff

Add to ~/.profile
export PATH=~/chromiumos/depot_tools:"$PATH"
[ -f "$HOME/etc/bash_completion" ] && . "$HOME/etc/bash_completion"
export PS1='\h:\W$(__git_ps1 "(%10s)") \u\$ '

5. Get Chromium source from git with new REPO command

cd ~/chromiumos
repo init -u -m minilayout.xml

  Your Name [root]: Name
  Your Email [root@server.(none)]:
  Your identity is: Name 
    is this correct [y/n]? y
  Enable color display in this user account (y/n)? y

time repo sync

Elapsed time: 52m05s

Note: If you will omit -m minilayout.xml source codes will be pulled during repo sync and not later in building packages phase.

6. Make chroot environment

– Single thread (verbose by default)

cd ./src/scripts
./make_chroot --jobs=1
Elapsed time: 62m05s

– 2 threads (descriptive by default)

cd ./src/scripts
./make_chroot --fast
Atom  230/1GB RAM = Elapsed time: 58m05s
Atom D510/1GB RAM = Elapsed time: 34m10s
Atom D510/2GB RAM = Elapsed time: 30m42s

make_chroot help

./make_chroot --help
usage: ./make_chroot [flags]
  --chroot:  Destination dir for the chroot environment.
             (default: '/buildarea/chromiumos/chroot')
  --[no]usepkg:  Use binary packages to bootstrap. (default: true)
  --[no]useworkon:  Enable use of the new cros_workon tool (
                    (default: true)
  --[no]delete:  Delete an existing chroot. (default: false)
  --[no]replace:  Overwrite existing chroot, if any. (default: false)
  --jobs:  How many packages to build in parallel at maximum. (default: -1)
  --[no]fast:  Call many emerges in parallel (default: true)
  --stage3_date:  Use the stage3 with the given date. (default: '2010.03.09')
  -h,--[no]help:  show this help (default: false)

6. Enter chroot


7. Set password for shared user and sudo

That password will become your sudo password for example for installation and also the the ‘chronos’ password in F2 console

(chroot) $ ./
Enter password for shared user account: justone1
Shared user password set in /home/chronocb/trunk/src/scripts/shared_user_passwd.txt

8. Setup board (target platform)

(chroot) $ time ./setup_board --board=x86-generic --default
Elapsed time: 5m56s

setup_board help

./setup_board --help
USAGE: setup_board [flags] args
  --board:  The name of the board to set up. (default: 'x86-generic')
  --build_root:  The root location for board sysroots. (default: '/build')
  --board_overlay:  Location of the board overlay. (default: '')
  --variant:  Board variant. (default: '')
  --toolchain:  Toolchain.  For example: i686-pc-linux-gnu, armv7a-softfloat-linux-gnueabi (default: '')
  --[no]usepkg:  Use binary packages to bootstrap. (default: true)
  --[no]force:  Force re-creating board root. (default: false)
  --binutils_version:  Version of binutils to use. (default: '')
  --gcc_version:  Version of gcc to use. (default: '')
  --libc_version:  Version of libc to use. (default: '2.10.1-r1')
  --kernel_version:  Version of kernel headers to use. (default: '2.6.30-r1')
  --[no]default:  Set board to the default board in your chroot (default: false)
  --[no]fast:  Call many emerges in parallel (default: true)
  --profile:  The portage configuration profile to use. Profile must be located in overlay-board/profiles (default: '')
  -h,--[no]help:  show this help (default: false)

9. Build packages

(chroot) $ ./build_packages
Atom  230/1GB RAM = Elapsed time: 141m18s
Atom D510/1GB RAM = Elapsed time: 112m22s
Atom D510/2GB RAM = Elapsed time: 106m11s

(chroot) $ ./build_packages --jobs=1
Elapsed time: 174m50s

Hint: You can call USE=”-build_tests” ./build_packages –fast –nowithtest –nowithautotest –oldchromebinary to make process faster, because you can’t now run autotests locally anyway.

build_packages help

./build_packages --help
usage: build_packages [flags]
  --board:  The board to build packages for. (default: 'x86-generic')
  --[no]chromefromsource:  Build Chrome browser from source. (default: false)
  --chromebuild:  The optional version or revision of Chrome to pull.
                  (default: '')
  --chromebase:  The optional base URL to pull chrome from. (default: '')
  --[no]usepkg:  Use binary packages to bootstrap when possible.
                 (default: true)
  --[no]withdev:  Build useful developer friendly utilities. (default: true)
  --[no]withautotest:  Build autotest client code. (default: true)
  --jobs:  How many packages to build in parallel at maximum. (default: -1)
  --retries:  On build failure, the number of times to retry. (default: -1)
  --[no]withtest:  Build packages required for testing. (default: true)
  --[no]withfactory:  Build factory installer. (default: true)
  --[no]fast:  Call many emerges in parallel. (default: true)
  --[no]norebuild:  Don't automatically rebuild dependencies. (default: false)
  --[no]showoutput:  Show all output from parallel_emerge. (default: false)
  --[no]noworkon:  Don't force-build workon packages. (default: false)
  --[no]withdebug:  Build debug versions of Chromium-OS-specific packages. (default: true)
  --[no]oldchromebinary:  Use the last prebuilt binary for Chrome produced by the buildbot. (default: false)
  -h,--[no]help:  show this help (default: false)

10. Build image

(chroot) $ ./build_image
Atom  230/1GB RAM = Elapsed time: 62m42s
Atom D510/1GB RAM = Elapsed time: 30m59s
Atom D510/2GB RAM = Elapsed time: 25m22s

(chroot) $ ./build_image --jobs=1
Elapsed time: 75m43s

Hint: Use ./build_image –noenable_rootfs_verification –usb dev/sda3 to disable root verification in initial experiments and to adjust boot device name to your BIOS order.

Note: There is ongoing discussion to make default image more close to release, t.m. to disable dev.
To get usefull dev & debug tools added back you can add –withdev –statefuldev to force it.

build_image help

./build_image --help
USAGE: /home/chronocb/trunk/src/scripts/build_image [flags] args
  --board:  The board to build an image for. (default: 'x86-generic')
  --build_root:  The root location for board sysroots. (default: '/build')
  --build_attempt:  The build attempt for this image build. (default: 1)
  --output_root:  Directory in which to place image result directories (named by version)
                  (default: '/home/chronocb/trunk/src/build/images')
  --[no]eclean:  Perform eclean- -d as part of this script to remove obsolete packages (default: true)
  --[no]replace:  Overwrite existing output, if any. (default: false)
  --[no]withdev:  Include useful developer friendly utilities in the image. (default: true)
  --[no]installmask:  Use INSTALL_MASK to shrink the resulting image. (default: true)
  --jobs:  How many packages to build in parallel at maximum. (default: -1)
  --[no]statefuldev:  Install development packages on stateful partition rather than the rootfs (default: true)
  --to:  The target image file or device (default: '')
  --[no]factory_install:  Build a smaller image to overlay the factory install shim on; this argument is also required 
      in image_to_usb.  (default: false)
  --[no]dev_install:  Build a smaller image to overlay the dev recovery install shim on (default: false)
  --rootfs_partition_size:  rootfs partition size in MiBs. (default: 1024)
  --rootfs_size:  rootfs filesystem size in MiBs. (default: 720)
  --rootfs_hash_pad:  MiBs reserved at the end of the rootfs image. (default: 8 )
  --statefulfs_size:  stateful filesystem size in MiBs. (default: 1024)
  --[no]preserve:  Attempt to preserve the previous build image if one can be found 
          (unstable, kernel/firmware not updated)  (default: false)
  --[no]fast:  Call many emerges in parallel (default: true)
  --usb_disk:  Path syslinux should use to do a usb boot. Default: /dev/sdb3 (default: '/dev/sdb3')
  --[no]enable_rootfs_verification:  Default all bootloaders to use kernel-based root fs integrity checking. (default: true)
  --verity_error_behavior:  Kernel verified boot error behavior (0: I/O errors, 1: reboot, 2: nothing) Default: 2
                            (default: 2)
  --verity_depth:  Kernel verified boot hash tree depth. Default: 1 (default: 1)
  --verity_max_ios:  Number of outstanding I/O operations dm-verity caps at. Default: 1024 (default: 1024)
  --verity_algorithm:  Cryptographic hash algorithm used for kernel vboot. Default : sha1 (default: 'sha1')
  --oem_customization:  Path to directory containing OEM partner partition contents (default: '')
  -h,--[no]help:  show this help (default: false)

11. Copy image to USB for evaluation

– Check latest image version and size

cd /home/chronocb/chromiumos/src/build/images/x86-generic/

ls -l ../latest
lrwxrwxrwx 1 chronocb 5000 25 2010-10-06 14:10 /home/chronocb/chromiumos/src/build/images/x86-generic/latest ->

du -m  ../latest/chromiumos_image.bin 
699	/home/chronocb/chromiumos/src/build/images/x86-generic/latest/chromiumos_image.bin

du --apparent-size -m ../latest/chromiumos_image.bin 
1803	/home/chronocb/chromiumos/src/build/images/x86-generic/latest/chromiumos_image.bin

– Copy image to USB flash disk

./ --to /dev/sdb
Copying USB image /buildarea/chromiumos/src/build/images/x86-generic/ to device /dev/sdb...
Disk /dev/sdb: 4018 MB, 4018143232 bytes
Manufacturer: Kingston
Product: DT Mini Slim
This will erase all data on this device:
Are you sure (y/N)? y
Attempting to unmount any mounts on the USB device...
Copying /buildarea/chromiumos/src/build/images/x86-generic/ to /dev/sdb...
1.76GB 0:02:21 [12.7MB/s] [==================== .. ==================>] 100%
450+1 records in
450+1 records out

Note: You can run ./ outside from chroot, in this case be sure then you have installed pv – Pipe Viewer

sudo apt-get install pv help

./ --help
USAGE: ./ [flags] args
  --board:  Board for which the image was built (default: 'x86-generic')
  --from:  Directory containing chromiumos_image.bin (default: '')
  --to:   (default: '/dev/sdX')
  -y,--[no]yes:  Answer yes to all prompts (default: false)
  --[no]force_copy:  Always rebuild test image (default: false)
  --[no]force_non_usb:  Write out image even if target (--to) doesn't look like a USB disk (default: false)
  --[no]factory_install:  Whether to generate a factory install shim. (default: false)
  --[no]factory:  Whether to generate a factory runin image. Implies aututest and test (default: false)
  --[no]copy_kernel:  Copy the kernel to the fourth partition. (default: false)
  --[no]test_image:  Copies normal image to chromiumos_test_image.bin, modifies it for test. (default: false)
  -i,--image_name:  Base name of the image (default: 'chromiumos_image.bin')
  --build_root:  The root location for board sysroots. (default: '/build')
  --[no]install:  Install to the usb device. (default: false)
  --arch:  Architecture of the image. (default: '')
  -h,--[no]help:  show this help (default: false)

12. Exit chroot environment

(chroot) $ exit

1 Comment »

  1. I followyour instructions to build the Chromium OS image. Does your USB image can run on Desktop or NB?
    I got some trouble. When booting the screen could’t display and show me a black. And some devices were reboot always.

    Comment by Trevor Yu — November 29, 2010 @ 2:30 am

RSS feed for comments on this post.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a free website or blog at

%d bloggers like this: