Build Chromium OS from behind a Proxy

Posted in google , howto

The problem is staring you right in the face!

chromium-os-logoIf you’re trying to build Chromium OS from behind an Internet proxy, you’re going to struggle with make_chroot.sh timing out.

When the script is in the chroot environment, any proxy settings you set in System -> Preferences -> Network Proxy are not going to work. (example from Ubuntu 10.04 Lucid Lynx)

Even if you have set them yourself with the http_proxy, ftp_proxy, and https_proxy environment variables, they will have no effect in the chroot.

You need to set them up within the chroot, and that means setting them in the user’s profile script that gets sourced. You also need to modify the build scripts since they’re implemented one workaround after another.

Run make_chroot.sh once

Start by running make_chroot.sh once and allow it to fail, or kill it with fire when it starts to timeout trying to connect to public IP addresses.

This will get you the basic chroot system layout with directories like sbin, tmp, home, etc., all under a new directory called chroot.

me@ubuntu:~$ ls -l chromiumos/

drwxr-xr-x 19 root root 4096 2010-05-07 chroot
-rw-r--r--  1 me me  585 2010-05-06 codereview.settings
-rw-r--r--  1 me me 5300 2010-05-06 DEPS
-rw-r--r--  1 me me 2995 2010-05-06 PRESUBMIT.py
drwxr-xr-x  9 me me 4096 2010-05-06 src
-rw-r--r--  1 me me 2420 2010-05-06 WATCHLISTS

Edit chroot user’s bash_profile

Google’s script creates a user within the chroot that matches the user that runs make_chroot.sh.

You need to add your proxy settings to your user’s home directory.

You can do this within the chrooted environment if you wish, like this:

me@ubuntu:~$ cd chromiumos/chroot/home/me
me@ubuntu:~$ echo “export ftp_proxy=http://proxy:81″ >> .bash_profile
me@ubuntu:~$ echo “export http_proxy=http://proxy:81″ >> .bash_profile
me@ubuntu:~$ echo “export https_proxy=http://proxy:81″ >> .bash_profile

VoilĂ 

If you’re the slightest bit familiar with Gentoo, you should recognize emerge. But what about make.conf? Don’t worry, it will just work because you’re using google’s build scripts.

After some time calculating dependencies, the packages should start to flow.


>>> Emerging binary (222 of 222) chromeos-base/hard-host-depends
* hard-host-depends-0.0.1-r33.tbz2 MD5 SHA1 size ;-) … [ ok ]
>>> Extracting info
* CPV: chromeos-base/hard-host-depends-0.0.1-r33
* REPO: chromiumos
* USE: amd64 elibc_glibc kernel_linux multilib userland_GNU
>>> Extracting chromeos-base/hard-host-depends-0.0.1-r33

>>> Installing (222 of 222) chromeos-base/hard-host-depends-0.0.1-r33
* checking 0 files for package collisions

make_chroot: All set up. To enter the chroot, run:
make_chroot: $ /home/recsys/google/chromiumos.git/src/scripts/enter_chroot.sh

Now run enter_chroot.sh and you should end up at:

(cros-chroot) recsys@ubuntu ~/trunk/src/scripts $

But wait, there’s more!

Now that you’re inside the chroot, configure emerge to use your proxy. Emerge doesn’t care about http_proxy as an environment variable, it only listens to what’s in make.conf.

Yet another workaround

The setup_board.sh script writes out its own make.conf.

Find the section where it’s writing out the file and add your proxy settings in after the line that begins with “cat << EOF" and before the "EOF" line.

cat << EOF | sudo dd of="${BOARD_ETC}/make.conf.board_setup"
# Created by setup_board
CHOST="${FLAGS_toolchain}"
ROOT="${BOARD_ROOT}/"
BOARD_OVERLAY="${BOARD_OVERLAY_LIST}"
RSYNC_PROXY=”http://myproxy:81″
http_proxy=”http://myproxy:81″

MAKEOPTS=”-j${NUM_JOBS}”
LIBC_VERSION=”$FLAGS_libc_version”
EOF

Now run the setup_board.sh script and emerge should talk to your proxy, however, you won’t know it’s working right away. You won’t see anything happening here, but give it a few minutes and instead of failing, it will move on to emerge the next package.

(cros-chroot) me@ubuntu $ ./setup_board –board=x86-generic

* Forcing the latest versions of {binutils,gcc}-config/gnuconfig … [ ok ]
* Log: /var/log/portage/cross-i686-pc-linux-gnu-binutils.log
* Emerging cross-binutils … [ ok ]
* Log: /var/log/portage/cross-i686-pc-linux-gnu-linux-headers-quick.log
* Emerging cross-linux-headers-quick … [ ok ]

If you want to be able to emerge anything from within the chroot, add your proxy to make.conf and make.defaults.

(cros-chroot) me@ubuntu:~$ sudo echo “export http_proxy=http://proxy:81” >> /etc/make.conf
(cros-chroot) me@ubuntu:~$ sudo echo “export http_proxy=http://proxy:81” >> /usr/local/portage/chromiumos/profiles/default/linux/make.defaults

Posted by admica   @   7 May 2010

Related Posts

Like this post? Share it!

Digg Twitter StumbleUpon Delicious Technorati Facebook RSS

0 Comments

No comments yet. Be the first to leave a comment !
Leave a Comment

Name

Email

Website

Previous Post
« Longest dumbest bash command ever
Next Post
Amazing Live Action Tilt Shift or Tilt Focus »
Powered by Wordpress   |   Lunated designed by ZenVerse