diff options
author | Jan-Simon Möller <jsmoeller@linuxfoundation.org> | 2016-10-03 17:03:21 +0200 |
---|---|---|
committer | Jan-Simon Möller <jsmoeller@linuxfoundation.org> | 2016-10-03 20:18:27 +0200 |
commit | 53795ff651a4fcb847ac2d63648e2299c884560b (patch) | |
tree | c0def0b8192c44feb51da88f865cb767a8e63952 /packer/provision | |
parent | 9cb7c23d969e90b9b0f11cfcd744dfb6dc548feb (diff) |
Add /opt/AGL/lava-agl, its dependencies and json file
Change-Id: I65e5c48f91d0c4df084cfa3e66d43ae48e52bb9d
Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org>
Diffstat (limited to 'packer/provision')
-rw-r--r-- | packer/provision/agl_dependencies.sh | 170 | ||||
-rw-r--r-- | packer/provision/agl_mirror.sh | 8 |
2 files changed, 175 insertions, 3 deletions
diff --git a/packer/provision/agl_dependencies.sh b/packer/provision/agl_dependencies.sh index 05ad05b2..ed5cc254 100644 --- a/packer/provision/agl_dependencies.sh +++ b/packer/provision/agl_dependencies.sh @@ -1,14 +1,23 @@ #!/bin/bash +# vim: sw=2 ts=2 sts=2 et : set -x +cat /etc/apt/sources.list + +# Make sure that we aren't using the vexxhost mirrors as they have issues +echo "---> Removing Vexxhost Ubuntu mirrors" +sed -i 's/ubuntu.mirror.vexxhost.com/us.archive.ubuntu.com/g' /etc/apt/sources.list + +cat /etc/apt/sources.list + DEBIAN_FRONTEND=noninteractive apt-get update && apt-get -y -u dist-upgrade DEBIAN_FRONTEND=noninteractive apt-get update && \ apt-get -y install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat \ libsdl1.2-dev xterm make xsltproc docbook-utils fop dblatex xmlto autoconf automake \ libtool libglib2.0-dev libarchive-dev python-git git python python-minimal repo mc \ - tree rsync + tree rsync python-yaml python-requests curl # we have a build blocker wrt useradd - I assume it is caused by /bin/sh being dash # systemd: Performing useradd with @@ -21,3 +30,162 @@ cat <<EOFHOSTS >> /etc/hosts 199.19.213.77 download-new.automotivelinux.org EOFHOSTS + + +# clone lava-boot to /opt/AGL/ +mkdir -p /opt/AGL/ +cd /opt/AGL/ +git clone http://git.linaro.org/people/riku.voipio/lava-boot.git +cd lava-boot +sed -i '16iimport ssl' lava-boot +sed -i '17issl._create_default_https_context = ssl._create_unverified_context' lava-boot + + +mkdir -p /opt/AGL/lava-agl/ +cat <<EOFBR >> /opt/AGL/lava-agl/boardready.py +#!/usr/bin/python +import xmlrpclib +import ssl +import sys +import time + +# bug, ssl chain cannot be verified (letsencrypt) +# to be fixed +ssl._create_default_https_context = ssl._create_unverified_context + +username = "$LAVAUSER" +token = "$LAVATOKEN" +myhostname = "$LAVAHOST" + +print "Starting ..." +sys.stdout.flush() +arg = None +if len(sys.argv) > 1: + arg = sys.argv[1] + +if arg == None: + print("No argument, need lava jobnumber as argument.") + sys.stdout.flush() + sys.exit(1) + +server = xmlrpclib.ServerProxy("https://%s:%s@%s/RPC2" % (username, token, myhostname)) +#print(arg) +#sys.stdout.flush() + +# Poll loop +while True: + try: + x = server.scheduler.job_status(arg)['job_status'] + except: + print("Error, quitting.") + sys.stdout.flush() + sys.exit(1) + break + if 'Cancelled' in x: + sys.exit(1) + break + if 'Submitted' in x: + print("Job submitted - pending") + sys.stdout.flush() + time.sleep(20) + continue + if 'Running' in x: + print("Job Running now.") + print("Remote boot takes around 5 minutes to complete (download+boot) - waiting ...") + sys.stdout.flush() + time.sleep(300) + y = server.scheduler.job_status(arg)['job_status'] + if 'Running' in y: + break + else: + continue + break + break +# end +EOFBR + +cat <<EOFLAVAYAML > /opt/AGL/lava-agl/.lava.yaml +server: ${LAVAHOST} +user: ${LAVAUSER} +token: ${LAVATOKEN} +https: true +EOFLAVAYAML + +cat <<EOFPORTERUPLOADYAML > /opt/AGL/lava-agl/porter_nbd_upload.yaml +actions: + - command: deploy_linaro_kernel + parameters: + kernel: 'http://localhost/porter/upload/uImage+dtb' + nbdroot: 'http://localhost/porter/upload/agl-demo-platform-porter.ext4' + ramdisk: 'http://localhost/porter/upload/initramfs-netboot-image-porter.ext4.gz.u-boot' + login_prompt: 'porter login:' + username: 'root' + - command: boot_linaro_image + parameters: + test_image_prompt: 'root@porter:~#' + - command: lava_command_run + parameters: + commands: + - "while test ! -f /jta.done ; do echo \"Waiting for JTA to finish ... \" ; sleep 20 ; done" + timeout: 22100 +device_type: 'renesas-porter' +logging_level: INFO +job_name: '\${JOB_NAME}' +timeout: 22600 + +EOFPORTERUPLOADYAML + +cat <<EOFPORTERSNAPYAML > /opt/AGL/lava-agl/porter_nbd_snapshot.yaml +actions: + - command: deploy_linaro_kernel + parameters: + kernel: 'https://download.automotivelinux.org/AGL/snapshots/master/latest/porter-nogfx/deploy/images/porter/uImage+dtb' + nbdroot: 'https://download.automotivelinux.org/AGL/snapshots/master/latest/porter-nogfx/deploy/images/porter/core-image-minimal-porter.ext4' + ramdisk: 'https://download.automotivelinux.org/AGL/snapshots/master/latest/porter-nogfx/deploy/images/porter/initramfs-netboot-image-porter.ext4.gz.u-boot' + login_prompt: 'porter login:' + username: 'root' + - command: boot_linaro_image + parameters: + test_image_prompt: 'root@porter:~#' + - command: lava_command_run + parameters: + commands: + - "while test ! -f /jta.done ; do echo \"Waiting for JTA to finish ... \" ; sleep 20 ; done" + timeout: 22100 +device_type: 'renesas-porter' +logging_level: INFO +job_name: '\${JOB_NAME}' +timeout: 22600 +EOFPORTERSNAPYAML + +cat <<EOFUPLOAD > /opt/AGL/lava-agl/upload4lava.sh +#!/bin/bash +#set -x + +if test x"" != x"\$1"; then +Y=\$(echo "\$1" | sed -e "s#\.\.##g" -e "s#/##g") +curl -T "\$Y" https://porter.automotivelinux.org/porter/upload/jta/\$Y --insecure +else +echo "Help: \$0 file" +fi + +EOFUPLOAD + +cat <<EOFDEPLOY > /opt/AGL/lava-agl/deploy.sh +#!/bin/bash +#set -x +set -e +PORTERYAML="porter_nbd_snapshot.yaml" + +if test x"" != x"\$1" ; then + PORTERYAML="\$1" +fi +if test -f /opt/AGL/lava-agl/\${PORTERYAML}; then + /opt/AGL/lava-agl/boardready.py \$(/opt/AGL/lava-boot/lava-boot -j /opt/AGL/lava-agl/\${PORTERYAML} -a -q | sed -e "s#.*job/##g") +else + echo "\${PORTERYAML} not found." + exit 1 +fi +EOFDEPLOY + +chmod a+x /opt/AGL/lava-agl/* diff --git a/packer/provision/agl_mirror.sh b/packer/provision/agl_mirror.sh index 08a36844..a76245dc 100644 --- a/packer/provision/agl_mirror.sh +++ b/packer/provision/agl_mirror.sh @@ -13,7 +13,11 @@ cd mkdir -p /opt/AGL/sstate-mirror cd /opt/AGL/sstate-mirror wget --mirror -np -nH --convert-links "https://download-new.automotivelinux.org/sstate-mirror/" -A siginfo -A tgz --cut-dirs=1 -ls -ls * cd +#mirror downloads into /opt/AGL/premirror +#mkdir -p /opt/AGL/premirror +#cd /opt/AGL/premirror +#wget --mirror -r -l1 -np -nH --convert-links "https://download-new.automotivelinux.org/AGL/mirror/" -R 'done' -R 'O=A,O=D' --cut-dirs=2 +#cd + |