~j-harbott/cirros/dev

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
This is a project to build a small cloud image that has useful tools and
function for debugging or developing cloud infrastructure.

The following works on Ubuntu 11.04 (Natty) and 11.10 (Oneiric).

To use it, you would do something like:
 * bzr branch lp:cirros
 * cd cirros

 * get some build dependencies:
   $ sudo apt-get -y install bison flex texinfo build-essential gettext ncurses-dev unzip

 * download buildroot and setup environment
   $ br_ver="2011.08"
   $ mkdir -p ../download
   $ ln -snf ../download download
   $ ( cd download && wget http://buildroot.uclibc.org/downloads/buildroot-${br_ver}.tar.gz )
   $ tar -xvf download/buildroot-${br_ver}.tar.gz
   $ ln -snf buildroot-${br_ver} buildroot

 $ download the buildroot sources
   $ make ARCH=i386 br-source

 * Build buildroot for a given arch
   # ARCH should be set to 'i386', 'x86_64' or 'arm'
   $ make ARCH=i386 OUT_D=$PWD/output/i386

   This will do a full buildroot build, which will take a while. The output
   that CirrOS is interested in is output/i386/rootfs.tar.
   That file is the full buildroot filesystem, and is used as input for
   subsequent steps here.

 * Download a kernel to use.
   The kernel input to bundle must be in deb format. The ubuntu '-virtual'
   kernel is used as a starting point.

   $ ARCH=i386
   $ xarch=$ARCH; [ "$xarch" = "x86_64" ] && xarch="amd64"
   $ url="http://launchpad.net/ubuntu/+archive/primary/+files/linux-image-3.0.0-12-virtual_3.0.0-12.20_$xarch.deb"
   $ [ "$ARCH" = "arm" ] && url=https://launchpad.net/ubuntu/+archive/primary/+files/linux-image-3.0.0-12-omap_3.0.0-12.20_armel.deb
   $ wget "$url" -O "download/${url##*/}"
   $ kernel_deb="download/${url##*/}"

 * build disk images using bin/bundle
   $ sudo ./bin/bundle -v output/$ARCH/rootfs.tar "$kernel_deb" output/$ARCH/images

 * Then, test using the images
   $ kvm -drive file=disk.img,if=virtio -curses
   $ kvm file=blank.img,if=virtio -curses \
      -kernel kernel -initrd initrd -drive -append "debug-initrd"