From patchwork Tue Sep 19 06:58:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajiv Ranganath X-Patchwork-Id: 9958301 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EA5056038F for ; Tue, 19 Sep 2017 07:01:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFD7F28D1C for ; Tue, 19 Sep 2017 07:01:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4CBC28D21; Tue, 19 Sep 2017 07:01:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 43F9D28D2E for ; Tue, 19 Sep 2017 07:01:07 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1duCUL-0004qJ-4W; Tue, 19 Sep 2017 06:58:33 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1duCUJ-0004pP-LA for xen-devel@lists.xen.org; Tue, 19 Sep 2017 06:58:31 +0000 Received: from [193.109.254.147] by server-9.bemta-6.messagelabs.com id 5E/87-03422-610C0C95; Tue, 19 Sep 2017 06:58:30 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprKKsWRWlGSWpSXmKPExsXiVRvsoit64EC kwZVHbBZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8bizX+ZClocKg7tOsjUwPjMtIuRi0NIoJ9R 4vv1CywgDovAPlaJvbefM4I4EgIHWSVOzH8LlOEEcvIkVr/oZ4Kw0yT+rDjMCmFXSTRd+ckOY gsJaEk0LjjIBjH2A6PE9uXvwBrYBIwllhx6zAZiiwhIS1z7fBloAwcHs4CUxOmD5iBhYYFwiW VPJoPtYhFQlbh1+hEjiM0r4Cqxf+sZRohdchIN5+8zg9icAu4S689sYILY6yYx7c9ssBtEgWp WXm5hhegVlDg58wkLxCpNifW79EHCzALyEtvfzmGewCg6C0nVLISqWUiqFjAyr2JUL04tKkst 0jXTSyrKTM8oyU3MzNE1NDDTy00tLk5MT81JTCrWS87P3cQIjAoGINjBOO+E/yFGSQ4mJVHes E0HIoX4kvJTKjMSizPii0pzUosPMWpwcAjcXdK7gVGKJS8/L1VJgvfSPqA6waLU9NSKtMwcYN zClEpw8CiJ8JaCpHmLCxJzizPTIVKnGC05jm26/IeJY9+eW0Cy4+bdP0xCYPOkxHmzQRoEQBo ySvPgxsFSyyVGWSlhXkagY4V4ClKLcjNLUOVfMYpzMCoJ89aDTOHJzCuB2/oK6CAmoIOyN4Ad VJKIkJJqYDQ5rFJyQK1397Or89mXry9c5nn1Edt+M02D7OvlIq93zrZoer9oqfvBE9bTr71nL 431LPAp6n7x6LPczA0X1y3d+M4z7uO3Vp5tbv5p/TuqL6/enrQ56s+PFNfQTc2Tv0heme3IwX Nsc9ccxhIT/q+zZz7MP32Fi014u63x/QWB6Z89YtJz7hQpsRRnJBpqMRcVJwIAlgSgySgDAAA = X-Env-Sender: rajiv.ranganath@atihita.com X-Msg-Ref: server-7.tower-27.messagelabs.com!1505804307!112822608!1 X-Originating-IP: [74.125.83.68] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 64221 invoked from network); 19 Sep 2017 06:58:28 -0000 Received: from mail-pg0-f68.google.com (HELO mail-pg0-f68.google.com) (74.125.83.68) by server-7.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 19 Sep 2017 06:58:28 -0000 Received: by mail-pg0-f68.google.com with SMTP id d8so1566966pgt.3 for ; Mon, 18 Sep 2017 23:58:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atihita-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=ZmUj3e6vu/yeHGLTm25iUnqadirEKiN3gsCWgzNCf/w=; b=lfuZ5jOO+ledg/fJByIwy6nBmpp6RTW0MKAsr5Oy88x8gYpypEsxnxxafnjTZqr5vn u/5ShTmHtCSAxOjfAQTV6yuGCibjKE6QVh25vh0h+bwwDCGLId3KNxQInVlspImhoqNW 8KmkWYCTLJ9MUVkXHAK23IyRFBbhTCR75u5QzBYnzqReWyUHEFH46qqHul9BU8ejU2HC WxeITD7LiGyZS19TxE8XX7lr5vnzQTaPi9e/WgQ5mBHPZ/1ifg8qWl2HKVevOWetSSws qy0MU6KYOCEB2s04lbczoSBV8k8bwoPThQHk+3JJLISywVe/4UYzqFyWsbs7bWjAJKih um1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=ZmUj3e6vu/yeHGLTm25iUnqadirEKiN3gsCWgzNCf/w=; b=Urr+iFGnNxe9TdK54OZTBu1X6BVgVgTxpmjOeolRlyJUP1HY2+zpWaqASQkFgLwUhb UvXToZJPGoNgHAVgjRo2jOyp6aTNVI5Zd6yXd7ZAKbhcCxhGmFMJpc35O+JxoYdb5cXG qIp23uPIEOZwwCOQhjeL+wSLb+pKqrDi3wfs/+Ds5nQoTHf0xuQDcWXBXAo3LGuwvPC/ cCR/jhrCUOApz7Uvf7XeJ2NrcCjJTYv8N4B5hi1M9GB58+O/SoKMCARnh/R1CQDLyEq3 WBrBwdbmH9Er+DKb2ajkI+tkMIZketsuzbzsvaJS6x75D/7mdysLr5zAA66LibeoALLp fzTA== X-Gm-Message-State: AHPjjUhaB8kjyjtQ5d2QIrnKdbBi5TYlmtAVLns/3LdahGVk5+9LM/99 XdRJvwHUPAGvseJgf1rLOsPOMoTpflI= X-Google-Smtp-Source: AOwi7QASkqnjXMGEmQwO6cNmlAZDRKJC3Xqp9wMFQoccB4baM85FU+/4NWQBu3SG0mq7z1cGndXuNg== X-Received: by 10.159.204.141 with SMTP id t13mr418540plo.129.1505804307147; Mon, 18 Sep 2017 23:58:27 -0700 (PDT) Received: from localhost ([59.93.108.6]) by smtp.gmail.com with ESMTPSA id l3sm2560164pgn.36.2017.09.18.23.58.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 23:58:26 -0700 (PDT) From: Rajiv Ranganath To: xen-devel@lists.xen.org Date: Tue, 19 Sep 2017 12:28:24 +0530 Message-Id: <20170919065824.1913.7093.stgit@rajivs-macbook-pro.local> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170919065749.1913.30583.stgit@Rajivs-MacBook-Pro.local> References: <20170919065749.1913.30583.stgit@Rajivs-MacBook-Pro.local> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: sstabellini@kernel.org Subject: [Xen-devel] [stage1-xen PATCH v2 04/11] build/fedora: Add `run` and `components/*` scripts X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Rajiv M Ranganath In order to build stage1-xen we require three components - 1. Xen 2. Qemu 3. Rkt These components are built using scripts in `build/fedora/components/` directory. These scripts have constants (for example `XEN_PREFIX`) that can be used to customize the build either on the host or while building inside a container. `run` script makes use of scripts in `components/` directory to build stage1-xen artifacts in a container. Signed-off-by: Rajiv Ranganath Reviewed-by: Stefano Stabellini --- build/fedora/components/qemu | 52 +++++++++++++++++++++++++++++++++++++ build/fedora/components/rkt | 59 ++++++++++++++++++++++++++++++++++++++++++ build/fedora/components/xen | 47 +++++++++++++++++++++++++++++++++ build/fedora/run | 56 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 214 insertions(+) create mode 100755 build/fedora/components/qemu create mode 100755 build/fedora/components/rkt create mode 100755 build/fedora/components/xen create mode 100755 build/fedora/run diff --git a/build/fedora/components/qemu b/build/fedora/components/qemu new file mode 100755 index 0000000..06538d8 --- /dev/null +++ b/build/fedora/components/qemu @@ -0,0 +1,52 @@ +#!/usr/bin/python2 + +import shlex +import subprocess +import sys +import os + +# Modify this if you would like to install Qemu elsewhere on your filesystem or +# a different version of Qemu +QEMU_PREFIX = '/opt/qemu-2.10.0' +# This can be a git tag or branch +QEMU_BRANCH = 'v2.10.0' + +# This should correspond to your Xen install prefix +XEN_PREFIX = '/opt/xen-4.9.0' + + +# helper function to capture stdout from a long running process +def subprocess_stdout(cmd, cwd, env): + p = subprocess.Popen( + shlex.split(cmd), cwd=cwd, env=env, stdout=subprocess.PIPE) + while p.poll() is None: + l = p.stdout.readline() + sys.stdout.write(l) + if p.returncode != 0: + sys.exit(1) + + +env = os.environ.copy() + +# build and install qemu +print "Cloning qemu..." +cmd = "git clone --branch %(branch)s git://git.qemu.org/qemu.git" % { + 'branch': QEMU_BRANCH +} +subprocess.check_output(shlex.split(cmd), cwd='/root') + +steps = [ + "./configure --prefix=%(qemu_prefix)s --enable-xen --target-list=i386-softmmu --extra-cflags=\"-I%(xen_prefix)s/include\" --extra-ldflags=\"-L%(xen_prefix)s/lib -Wl,-rpath,%(xen_prefix)s/lib\" --disable-kvm --enable-virtfs --enable-linux-aio" + % { + 'qemu_prefix': QEMU_PREFIX, + 'xen_prefix': XEN_PREFIX + }, 'make', 'make install' +] +for cmd in steps: + cwd = '/root/qemu' + subprocess_stdout(cmd, cwd, env) + +cmd = "cp i386-softmmu/qemu-system-i386 %(xen_prefix)s/lib/xen/bin/qemu-system-i386" % { + 'xen_prefix': XEN_PREFIX +} +subprocess.check_output(shlex.split(cmd), cwd='/root/qemu') diff --git a/build/fedora/components/rkt b/build/fedora/components/rkt new file mode 100755 index 0000000..a8d6541 --- /dev/null +++ b/build/fedora/components/rkt @@ -0,0 +1,59 @@ +#!/usr/bin/python2 + +import shlex +import subprocess +import sys +import os + +# `rkt` is installed in the same prefix as `stage1-xen`. Modify this if you +# would like to install rkt elsewhere on your filesystem. +STAGE1_XEN_PREFIX = '/opt/stage1-xen' +RKT_PREFIX = STAGE1_XEN_PREFIX +# This can be a git tag or branch +RKT_BRANCH = 'v1.28.1' + +# Adjust this according to what RKT_BRANCH generates (see configure.ac) +RKT_BUILD_VER = 'rkt-1.28.1' + + +# helper function to capture stdout from a long running process +def subprocess_stdout(cmd, cwd, env): + p = subprocess.Popen( + shlex.split(cmd), cwd=cwd, env=env, stdout=subprocess.PIPE) + while p.poll() is None: + l = p.stdout.readline() + sys.stdout.write(l) + if p.returncode != 0: + sys.exi(1) + + +env = os.environ.copy() + +# build rkt +print "Cloning rkt..." +cmd = "git clone --branch %(branch)s https://github.com/rkt/rkt.git" % { + 'branch': RKT_BRANCH +} +subprocess.check_output(shlex.split(cmd), cwd='/root') + +steps = [ + './autogen.sh', './configure --disable-tpm --with-stage1-flavors=coreos', + 'make' +] +for cmd in steps: + cwd = '/root/rkt' + subprocess_stdout(cmd, cwd, env) + +# install rkt build artifacts to RKT_PREFIX +steps = [ + "mkdir -p %(prefix)s/bin" % { + 'prefix': RKT_PREFIX + }, + "cp /root/rkt/build-%(build_ver)s/target/bin/rkt %(prefix)s/bin/rkt" % { + 'build_ver': RKT_BUILD_VER, + 'prefix': RKT_PREFIX + } +] +for cmd in steps: + cwd = '/root/rkt' + subprocess_stdout(cmd, cwd, env) diff --git a/build/fedora/components/xen b/build/fedora/components/xen new file mode 100755 index 0000000..45d11f2 --- /dev/null +++ b/build/fedora/components/xen @@ -0,0 +1,47 @@ +#!/usr/bin/python2 + +import shlex +import subprocess +import sys +import os + +# Modify this if you would like to install Xen elsewhere on your filesystem or +# a different version of Xen +XEN_PREFIX = '/opt/xen-4.9.0' +# This can be a git tag or branch +XEN_BRANCH = 'RELEASE-4.9.0' + + +# helper function to capture stdout from a long running process +def subprocess_stdout(cmd, cwd, env): + p = subprocess.Popen( + shlex.split(cmd), cwd=cwd, env=env, stdout=subprocess.PIPE) + while p.poll() is None: + l = p.stdout.readline() + sys.stdout.write(l) + if p.returncode != 0: + sys.exit(1) + + +env = os.environ.copy() + +# build and install xen +print "Cloning xen..." +cmd = "git clone --branch %(branch)s git://xenbits.xen.org/xen.git" % { + 'branch': XEN_BRANCH +} +subprocess.check_output(shlex.split(cmd), cwd='/root') + +steps = [ + "./configure --prefix=%(prefix)s --with-system-qemu=%(prefix)s/lib/xen/bin/qemu-system-i386 --disable-stubdom --disable-qemu-traditional --disable-rombios --sysconfdir=%(prefix)s/etc --enable-rpath --disable-systemd" + % { + 'prefix': XEN_PREFIX + }, 'make', + "make install BOOT_DIR=%(prefix)s/boot DEBUG_DIR=%(prefix)s/lib/debug EFI_DIR=%(prefix)s/boot/efi/EFI/xen" + % { + 'prefix': XEN_PREFIX + } +] +for cmd in steps: + cwd = '/root/xen' + subprocess_stdout(cmd, cwd, env) diff --git a/build/fedora/run b/build/fedora/run new file mode 100755 index 0000000..dc2d201 --- /dev/null +++ b/build/fedora/run @@ -0,0 +1,56 @@ +#!/usr/bin/python2 + +import shlex +import subprocess +import sys +import os + +# This scripts calls out to `xen`, `qemu` and `rkt` scripts in the +# `components/` directory within a container. It is expected that components +# directory is present at the same directory level as run script. +STAGE1_XEN_COMPONENTS = ['xen', 'qemu', 'rkt'] + + +# helper function to capture stdout from a long running process +def subprocess_stdout(cmd, cwd, env): + p = subprocess.Popen( + shlex.split(cmd), cwd=cwd, env=env, stdout=subprocess.PIPE) + while p.poll() is None: + l = p.stdout.readline() + sys.stdout.write(l) + if p.returncode != 0: + sys.exit(1) + + +env = os.environ.copy() + +dirname = os.path.dirname(os.path.realpath(__file__)) +steps = [os.path.join(dirname, 'components', x) for x in STAGE1_XEN_COMPONENTS] +for cmd in steps: + cwd = '/root' + subprocess_stdout(cmd, cwd, env) + +# build stage1-xen +env['GOPATH'] = '/root/gopath' +cwd = '/root/gopath/src/github.com/rkt/stage1-xen' +cmd = 'bash build.sh' +subprocess_stdout(cmd, cwd, env) + +# install build artifacts to `/opt/stage1-xen/aci` and create a tarball +steps = [ + 'mkdir -p /opt/stage1-xen/aci', + 'cp /root/gopath/src/github.com/rkt/stage1-xen/stage1-xen.aci /opt/stage1-xen/aci/stage1-xen.aci', + 'cp /root/gopath/src/github.com/rkt/stage1-xen/build/fedora/source_path.sh /opt/stage1-xen/bin/source_path.sh', + 'cp -r /root/gopath/src/github.com/rkt/stage1-xen/build/fedora/xen-4.9.0-runit /opt/xen-4.9.0-runit' +] +for cmd in steps: + cwd = '/root' + subprocess_stdout(cmd, cwd, env) + +cwd = '/opt' +cmd = 'tar zcvf /root/stage1-xen-build.tar.gz qemu-2.10.0/ stage1-xen/ xen-4.9.0/ xen-4.9.0-runit/' +subprocess_stdout(cmd, cwd, env) + +cwd = '/root' +cmd = 'mv /root/stage1-xen-build.tar.gz /tmp' +subprocess_stdout(cmd, cwd, env)