aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew McDermott <andrew.mcdermott@linaro.org>2014-11-27 15:09:23 +0000
committerAndrew McDermott <andrew.mcdermott@linaro.org>2014-11-27 15:09:23 +0000
commitc60eed7d6a9ae8de2525cbbd99b7d2d3bb439c37 (patch)
tree187591691c213c34f77358de2f3a4f7a3b3076a6
initial import
-rw-r--r--README4
-rwxr-xr-xbuild33
-rwxr-xr-xpost-debootstrap35
3 files changed, 72 insertions, 0 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..aa966b5
--- /dev/null
+++ b/README
@@ -0,0 +1,4 @@
+Generates an arm64 ubuntu chroot via debootstrap for the nfsboot of
+the lava-deploy-cloudimg[1] LAVA job.
+
+[1] https://git.linaro.org/leg/openstack/lava-deploy-cloudimg.git
diff --git a/build b/build
new file mode 100755
index 0000000..9ea6bc1
--- /dev/null
+++ b/build
@@ -0,0 +1,33 @@
+#!/bin/bash -x
+
+name=ubuntu-arm64-chroot
+d=$(mktemp -d --tmpdir XXXXXX-${name})
+
+: ${DEST:=${d}/$name}
+
+# On trusty you will need to install an update of the qemu package -
+# or one that has qemu-aarch64-static(1). You can search for an update
+# using:
+#
+# http://packages.ubuntu.com/search?suite=trusty-updates&keywords=qemu
+#
+# Last time I tried this the following .deb worked OK on trusty:
+#
+# qemu-user-static_2.0.0+dfsg-2ubuntu1.7_amd64.deb
+
+xchroot="DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C chroot"
+
+sudo apt-get install -y debootstrap qemu-user-static binfmt-support
+sudo debootstrap --include=wget,qemu-utils,cloud-guest-utils,eatmydata --foreign --arch arm64 trusty $DEST
+sudo cp /usr/bin/qemu-aarch64-static $DEST/usr/bin
+sudo cp post-debootstrap $DEST
+sudo $xchroot $DEST /debootstrap/debootstrap --second-stage
+sudo $xchroot $DEST dpkg-reconfigure -a
+sudo cp post-debootstrap $DEST/post-debootstrap
+sudo $xchroot $DEST /post-debootstrap
+sudo rm $DEST/post-debootstrap
+sudo rm $DEST/etc/resolvconf/resolv.conf.d/original
+sudo rm $DEST/etc/resolvconf/resolv.conf.d/tail
+echo localhost | sudo tee $DEST/etc/hostname
+sudo tar -C $d -acf $(basename $DEST).tar.bz2 $(basename $DEST)
+sudo rm -rf $d
diff --git a/post-debootstrap b/post-debootstrap
new file mode 100755
index 0000000..38c9705
--- /dev/null
+++ b/post-debootstrap
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+set -xe
+
+adduser --disabled-password --gecos "" ubuntu
+echo "ubuntu:ubuntu" | chpasswd
+
+cat >> /etc/sudoers <<EOF
+ubuntu ALL=(root) NOPASSWD:ALL
+Defaults:ubuntu secure_path=/sbin:/usr/sbin:/usr/bin:/bin:/usr/local/sbin:/usr/local/bin
+Defaults:ubuntu !requiretty
+EOF
+
+cat >> /root/.bashrc <<EOF
+export PS1="\u@linaro-test:\W\$ "
+EOF
+
+cat > /etc/init/ttyS0.conf <<EOF
+# ttyS0 - getty
+#
+# This service maintains a getty on ttyS0 from the point the system is
+# started until it is shut down again.
+
+start on stopped rc RUNLEVEL=[2345] and (
+ not-container or
+ container CONTAINER=lxc or
+ container CONTAINER=lxc-libvirt)
+
+stop on runlevel [!2345]
+
+respawn
+exec /sbin/getty -L ttyS0 115200 vt102
+EOF
+
+apt-get clean