summaryrefslogtreecommitdiffstats
path: root/external/meta-virtualization/recipes-containers/lxc
diff options
context:
space:
mode:
authorToshikazuOhiwa <toshikazu_ohiwa@mail.toyota.co.jp>2020-03-30 09:24:26 +0900
committerToshikazuOhiwa <toshikazu_ohiwa@mail.toyota.co.jp>2020-03-30 09:24:26 +0900
commit5b80bfd7bffd4c20d80b7c70a7130529e9a755dd (patch)
treeb4bb18dcd1487dbf1ea8127e5671b7bb2eded033 /external/meta-virtualization/recipes-containers/lxc
parent706ad73eb02caf8532deaf5d38995bd258725cb8 (diff)
agl-basesystem
Diffstat (limited to 'external/meta-virtualization/recipes-containers/lxc')
-rw-r--r--external/meta-virtualization/recipes-containers/lxc/files/dnsmasq.conf2
-rw-r--r--external/meta-virtualization/recipes-containers/lxc/files/logs-optionally-use-base-filenames-to-report-src-fil.patch69
-rw-r--r--external/meta-virtualization/recipes-containers/lxc/files/lxc-1.0.0-disable-udhcp-from-busybox-template.patch21
-rw-r--r--external/meta-virtualization/recipes-containers/lxc/files/lxc-doc-upgrade-to-use-docbook-3.1-DTD.patch29
-rw-r--r--external/meta-virtualization/recipes-containers/lxc/files/lxc-fix-B-S.patch24
-rw-r--r--external/meta-virtualization/recipes-containers/lxc/files/lxc-net9
-rw-r--r--external/meta-virtualization/recipes-containers/lxc/files/run-ptest57
-rw-r--r--external/meta-virtualization/recipes-containers/lxc/files/template-make-busybox-template-compatible-with-core-.patch58
-rw-r--r--external/meta-virtualization/recipes-containers/lxc/files/templates-actually-create-DOWNLOAD_TEMP-directory.patch37
-rw-r--r--external/meta-virtualization/recipes-containers/lxc/files/tests-add-no-validate-when-using-download-template.patch85
-rw-r--r--external/meta-virtualization/recipes-containers/lxc/files/tests-our-init-is-not-busybox.patch29
-rw-r--r--external/meta-virtualization/recipes-containers/lxc/lxc_3.1.0.bb196
12 files changed, 616 insertions, 0 deletions
diff --git a/external/meta-virtualization/recipes-containers/lxc/files/dnsmasq.conf b/external/meta-virtualization/recipes-containers/lxc/files/dnsmasq.conf
new file mode 100644
index 00000000..124f7ebe
--- /dev/null
+++ b/external/meta-virtualization/recipes-containers/lxc/files/dnsmasq.conf
@@ -0,0 +1,2 @@
+bind-interfaces
+except-interface=lxcbr0
diff --git a/external/meta-virtualization/recipes-containers/lxc/files/logs-optionally-use-base-filenames-to-report-src-fil.patch b/external/meta-virtualization/recipes-containers/lxc/files/logs-optionally-use-base-filenames-to-report-src-fil.patch
new file mode 100644
index 00000000..648193b4
--- /dev/null
+++ b/external/meta-virtualization/recipes-containers/lxc/files/logs-optionally-use-base-filenames-to-report-src-fil.patch
@@ -0,0 +1,69 @@
+From c50ddb2b2cf22a29e4c671b1efbd338eeba694aa Mon Sep 17 00:00:00 2001
+From: Jim Somerville <Jim.Somerville@windriver.com>
+Date: Fri, 25 Sep 2015 15:08:17 -0400
+Subject: [PATCH] logs: optionally use base filenames to report src files
+
+Message-Id: <4729d0f4c4d1dacd150ddfd7061dda875eb94e34.1443216870.git.Jim.Somerville@windriver.com>
+
+Problem: Logs are nice in that they report the source file,
+routine, and line number where an issue occurs. But the
+file is printed as the absolute filename. Users do not
+need to see a long spew of path directory names where the package
+was built. It just confuses things.
+
+Solution: Optionally chop off all leading directories so that just
+the source filename ie. basename is printed. This is done by
+setting a #ifdef LXC_LOG_USE_BASENAME check in the code. That
+define is done via the optional --enable-log-src-basename provided
+at configure time.
+
+Using __BASE_FILE__ instead of __FILE__ did not work. It
+refers to the file name as presented to the compile
+machinery, and that may still be the absolute pathname to
+the file.
+
+Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
+
+---
+ configure.ac | 9 +++++++++
+ src/lxc/log.h | 5 +++++
+ 2 files changed, 14 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index 74b976a..9c561f7 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -356,6 +356,15 @@ AC_ARG_ENABLE([examples],
+ [], [enable_examples=yes])
+ AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"])
+
++# Enable basenames in the logs for source files
++AC_ARG_ENABLE([log-src-basename],
++ [AC_HELP_STRING([--enable-log-src-basename], [Use the shorter source file basename in the logs [default=no]])],
++ [], [enable_log_src_basename=no])
++
++if test "x$enable_log_src_basename" = "xyes"; then
++ AC_DEFINE([LXC_LOG_USE_BASENAME], 1, [Enabling shorter src filenames in the logs])
++fi
++
+ # Enable dumping stack traces
+ AC_ARG_ENABLE([mutex-debugging],
+ [AC_HELP_STRING([--enable-mutex-debugging], [Makes mutexes to report error and provide stack trace [default=no]])],
+diff --git a/src/lxc/log.h b/src/lxc/log.h
+index 4654fd9..6885d78 100644
+--- a/src/lxc/log.h
++++ b/src/lxc/log.h
+@@ -77,8 +77,13 @@ struct lxc_log_locinfo {
+ int line;
+ };
+
++#ifdef LXC_LOG_USE_BASENAME
++#define LXC_LOG_LOCINFO_INIT \
++ { .file = (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), .func = __func__, .line = __LINE__ }
++#else
+ #define LXC_LOG_LOCINFO_INIT \
+ { .file = __FILE__, .func = __func__, .line = __LINE__ }
++#endif
+
+ /* brief logging event object */
+ struct lxc_log_event {
diff --git a/external/meta-virtualization/recipes-containers/lxc/files/lxc-1.0.0-disable-udhcp-from-busybox-template.patch b/external/meta-virtualization/recipes-containers/lxc/files/lxc-1.0.0-disable-udhcp-from-busybox-template.patch
new file mode 100644
index 00000000..85177c8f
--- /dev/null
+++ b/external/meta-virtualization/recipes-containers/lxc/files/lxc-1.0.0-disable-udhcp-from-busybox-template.patch
@@ -0,0 +1,21 @@
+From 74efbe7f47379375c51948dd0f86248fb9429a1b Mon Sep 17 00:00:00 2001
+From: Bogdan Purcareata <bogdan.purcareata@freescale.com>
+Date: Mon, 8 Apr 2013 18:30:19 +0300
+Subject: [PATCH] lxc-0.9.0-disable-udhcp-from-busybox-template
+
+---
+ templates/lxc-busybox.in | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in
+index 7243b36..9637a71 100644
+--- a/templates/lxc-busybox.in
++++ b/templates/lxc-busybox.in
+@@ -111,7 +111,6 @@ EOF
+ #!/bin/sh
+ /bin/syslogd
+ /bin/mount -a
+-/bin/udhcpc
+ EOF
+
+ # executable
diff --git a/external/meta-virtualization/recipes-containers/lxc/files/lxc-doc-upgrade-to-use-docbook-3.1-DTD.patch b/external/meta-virtualization/recipes-containers/lxc/files/lxc-doc-upgrade-to-use-docbook-3.1-DTD.patch
new file mode 100644
index 00000000..085ffe80
--- /dev/null
+++ b/external/meta-virtualization/recipes-containers/lxc/files/lxc-doc-upgrade-to-use-docbook-3.1-DTD.patch
@@ -0,0 +1,29 @@
+From 5190dce1a675dfcdf88e3b94bd48070ac180bacc Mon Sep 17 00:00:00 2001
+From: Jim Somerville <Jim.Somerville@windriver.com>
+Date: Tue, 11 Aug 2015 14:05:00 -0400
+Subject: [PATCH] lxc: doc: upgrade to use docbook 3.1 DTD
+
+docbook2man fails to build the man pages in poky
+due to missing the ancient Davenport 3.0 DTD.
+Poky meta has the Oasis 3.1 version so upgrade
+to use that instead.
+
+Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
+
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 1acc461..74b976a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -213,7 +213,7 @@ AM_CONDITIONAL([ENABLE_DOCBOOK], [test "x$db2xman" != "x"])
+ AM_CONDITIONAL([USE_DOCBOOK2X], [test "x$db2xman" != "xdocbook2man"])
+
+ if test "x$db2xman" = "xdocbook2man"; then
+- docdtd="\"-//Davenport//DTD DocBook V3.0//EN\""
++ docdtd="\"-//OASIS//DTD DocBook V3.1//EN\""
+ else
+ docdtd="\"-//OASIS//DTD DocBook XML\" \"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\""
+ fi
diff --git a/external/meta-virtualization/recipes-containers/lxc/files/lxc-fix-B-S.patch b/external/meta-virtualization/recipes-containers/lxc/files/lxc-fix-B-S.patch
new file mode 100644
index 00000000..6b09193a
--- /dev/null
+++ b/external/meta-virtualization/recipes-containers/lxc/files/lxc-fix-B-S.patch
@@ -0,0 +1,24 @@
+From 2fa77a1803939de2d155a14cf680b53140b92f06 Mon Sep 17 00:00:00 2001
+From: Dmitry Eremin-Solenikov <dmitry_eremin@mentor.com>
+Date: Thu, 9 Apr 2015 23:01:48 +0300
+
+---
+ config/init/upstart/Makefile.am | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/config/init/upstart/Makefile.am b/config/init/upstart/Makefile.am
+index 5552d32..186ae3d 100644
+--- a/config/init/upstart/Makefile.am
++++ b/config/init/upstart/Makefile.am
+@@ -3,9 +3,9 @@ EXTRA_DIST = lxc.conf lxc-instance.conf lxc-net.conf.in
+ if INIT_SCRIPT_UPSTART
+ install-upstart: lxc.conf lxc-instance.conf lxc-net.conf
+ $(MKDIR_P) $(DESTDIR)$(sysconfdir)/init/
+- $(INSTALL_DATA) lxc.conf $(DESTDIR)$(sysconfdir)/init/
++ $(INSTALL_DATA) $(srcdir)/lxc.conf $(DESTDIR)$(sysconfdir)/init/
+ $(INSTALL_DATA) $(srcdir)/lxc-instance.conf $(DESTDIR)$(sysconfdir)/init/
+- $(INSTALL_DATA) lxc-net.conf $(DESTDIR)$(sysconfdir)/init/
++ $(INSTALL_DATA) $(srcdir)/lxc-net.conf $(DESTDIR)$(sysconfdir)/init/
+
+ uninstall-upstart:
+ rm -f $(DESTDIR)$(sysconfdir)/init/lxc.conf
diff --git a/external/meta-virtualization/recipes-containers/lxc/files/lxc-net b/external/meta-virtualization/recipes-containers/lxc/files/lxc-net
new file mode 100644
index 00000000..1c59b705
--- /dev/null
+++ b/external/meta-virtualization/recipes-containers/lxc/files/lxc-net
@@ -0,0 +1,9 @@
+USE_LXC_BRIDGE="true"
+LXC_BRIDGE="lxcbr0"
+LXC_ADDR="10.0.3.1"
+LXC_NETMASK="255.255.255.0"
+LXC_NETWORK="10.0.3.0/24"
+LXC_DHCP_RANGE="10.0.3.2,10.0.3.254"
+LXC_DHCP_MAX="253"
+LXC_DHCP_CONFILE=""
+LXC_DOMAIN=""
diff --git a/external/meta-virtualization/recipes-containers/lxc/files/run-ptest b/external/meta-virtualization/recipes-containers/lxc/files/run-ptest
new file mode 100644
index 00000000..3f3a75f2
--- /dev/null
+++ b/external/meta-virtualization/recipes-containers/lxc/files/run-ptest
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+# Network interfaces come up and down and can be quite noisy
+# and since we are often on the console when running ptests
+# let's just quiet things some
+dmesg -n 1
+
+# Blacklisted test will be skipped
+blacklist=""
+# Not applicable
+blacklist="$blacklist lxc-test-apparmor"
+# These currently hang so skip them until someone fixes them up
+blacklist="$blacklist lxc-test-shutdowntest"
+blacklist="$blacklist lxc-test-state-server"
+
+passed=0
+failed=0
+skipped=0
+
+# Create logs dir and clear old logs if any
+mkdir logs 2> /dev/null
+rm -f logs/*
+
+echo "### Starting LXC ptest ###"
+
+for test in ./tests/*
+do
+ if [[ ! $blacklist = *$(basename $test)* ]]
+ then
+ $test >logs/$(basename $test).log 2>&1
+ else
+ echo "SKIPPED: $(basename $test)"
+ skipped=$((skipped+1))
+ continue
+ fi
+
+ if [ $? -eq 0 ]
+ then
+ echo "PASS: $(basename $test)"
+ passed=$((passed+1))
+ else
+ echo "FAIL: $(basename $test)"
+ failed=$((failed+1))
+ fi
+done
+
+echo ""
+echo "Results:"
+echo " PASSED = $passed"
+echo " FAILED = $failed"
+echo " SKIPPED = $skipped"
+echo "(for details check individual test log in ./logs directory)"
+echo ""
+echo "### LXC ptest complete ###"
+
+# restore dmesg to console
+dmesg -n 6
diff --git a/external/meta-virtualization/recipes-containers/lxc/files/template-make-busybox-template-compatible-with-core-.patch b/external/meta-virtualization/recipes-containers/lxc/files/template-make-busybox-template-compatible-with-core-.patch
new file mode 100644
index 00000000..e4bb72a0
--- /dev/null
+++ b/external/meta-virtualization/recipes-containers/lxc/files/template-make-busybox-template-compatible-with-core-.patch
@@ -0,0 +1,58 @@
+From 3a7112a38d2c44b6fa49e0da1dc4765defd88dbb Mon Sep 17 00:00:00 2001
+From: Mark Asselstine <mark.asselstine@windriver.com>
+Date: Thu, 31 May 2018 11:44:44 -0400
+Subject: [PATCH] template: make busybox template compatible with
+
+ core-image-minimal
+
+The busybox template makes a lot of assumptions about how the busybox
+binary found on the host was configured. Building core-image-minimal
+"out of the box" does not configure busybox's 'passwd' or 'init'
+applets so we need to work around this.
+
+Chances are if you attempt to use the busybox template with a host
+which is note core-image-minimal it will fail but we are making these
+changes here to at least have the template work with
+core-image-minimal to be able to demonstrate that it can work as well
+as to have it available for the ptests.
+
+Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
+
+---
+ templates/lxc-busybox.in | 16 +++++++++++++---
+ 1 file changed, 13 insertions(+), 3 deletions(-)
+
+diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in
+index 9637a71..45b386f 100644
+--- a/templates/lxc-busybox.in
++++ b/templates/lxc-busybox.in
+@@ -181,6 +181,19 @@ configure_busybox()
+ return 1
+ fi
+
++ # copy host passwd
++ if ! cp "$(which passwd)" "${rootfs}/bin"; then
++ echo "ERROR: Failed to copy passwd binary"
++ return 1
++ fi
++
++ # copy bash binary as the container init
++ if ! cp "$(which bash)" "${rootfs}/sbin/init"; then
++ echo "ERROR: Failed to copy bash binary"
++ return 1
++ fi
++
++
+ # symlink busybox for the commands it supports
+ # it would be nice to just use "chroot $rootfs busybox --install -s /bin"
+ # but that only works right in a chroot with busybox >= 1.19.0
+@@ -189,9 +202,6 @@ configure_busybox()
+ ./busybox --list | grep -v busybox | xargs -n1 ln -s busybox
+ )
+
+- # relink /sbin/init
+- ln "${rootfs}/bin/busybox" "${rootfs}/sbin/init"
+-
+ # /etc/fstab must exist for "mount -a"
+ touch "${rootfs}/etc/fstab"
+
diff --git a/external/meta-virtualization/recipes-containers/lxc/files/templates-actually-create-DOWNLOAD_TEMP-directory.patch b/external/meta-virtualization/recipes-containers/lxc/files/templates-actually-create-DOWNLOAD_TEMP-directory.patch
new file mode 100644
index 00000000..756cddc3
--- /dev/null
+++ b/external/meta-virtualization/recipes-containers/lxc/files/templates-actually-create-DOWNLOAD_TEMP-directory.patch
@@ -0,0 +1,37 @@
+From 68b0dd97130ffc5776de9219a42188b4a140d446 Mon Sep 17 00:00:00 2001
+From: Mark Asselstine <mark.asselstine@windriver.com>
+Date: Thu, 31 May 2018 16:21:45 -0400
+Subject: [PATCH] templates: actually create DOWNLOAD_TEMP directory
+
+The way 'mktemp' is currently used you will get a temp directory in
+$TMPDIR or '/tmp' and DOWNLOAD_TEMP will not be pointing to an actual
+directory. This will result in the wget operations failing and the
+container will fail to create:
+
+ ERROR: Failed to download http://....
+
+Instead we want to use the '-p' option for mktemp to set the base path
+and this will ensure that the temp directory is created in the correct
+location and DOWNLOAD_TEMP will be consistent with this location.
+
+Upstream-Status: Pending
+
+Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
+
+---
+ templates/lxc-download.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/templates/lxc-download.in b/templates/lxc-download.in
+index 973783b..015a679 100644
+--- a/templates/lxc-download.in
++++ b/templates/lxc-download.in
+@@ -323,7 +323,7 @@ elif [ -n "${DOWNLOAD_TEMP}" ]; then
+ mkdir -p "${DOWNLOAD_TEMP}"
+ DOWNLOAD_TEMP="$(mktemp -p ${DOWNLOAD_TEMP} -d)"
+ else
+- DOWNLOAD_TEMP="${DOWNLOAD_TEMP}$(mktemp -d)"
++ DOWNLOAD_TEMP="$(mktemp -p ${DOWNLOAD_TEMP} -d)"
+ fi
+
+ # Simply list images
diff --git a/external/meta-virtualization/recipes-containers/lxc/files/tests-add-no-validate-when-using-download-template.patch b/external/meta-virtualization/recipes-containers/lxc/files/tests-add-no-validate-when-using-download-template.patch
new file mode 100644
index 00000000..abddef6e
--- /dev/null
+++ b/external/meta-virtualization/recipes-containers/lxc/files/tests-add-no-validate-when-using-download-template.patch
@@ -0,0 +1,85 @@
+From 1b334bdaf598600314a678509a702728721001a2 Mon Sep 17 00:00:00 2001
+From: Mark Asselstine <mark.asselstine@windriver.com>
+Date: Thu, 31 May 2018 15:14:26 -0400
+Subject: [PATCH] tests: add '--no-validate' when using download template
+
+We are usually running the ptests with core-image-minimal which has no
+mechanism to validate the downloads. Validation isn't really of
+interest to this test at any rate so simply add '--no-validate' to
+avoid failing due to no GPG validation.
+
+Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
+
+---
+ src/tests/lxc-test-apparmor-mount | 2 +-
+ src/tests/lxc-test-autostart | 2 +-
+ src/tests/lxc-test-no-new-privs | 2 +-
+ src/tests/lxc-test-unpriv | 2 +-
+ src/tests/lxc-test-usernic.in | 2 +-
+ 5 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/tests/lxc-test-apparmor-mount b/src/tests/lxc-test-apparmor-mount
+index 56d598f..573cff8 100755
+--- a/src/tests/lxc-test-apparmor-mount
++++ b/src/tests/lxc-test-apparmor-mount
+@@ -169,7 +169,7 @@ if [ -f /etc/lsb-release ]; then
+ done
+ fi
+
+-run_cmd lxc-create -t download -n $cname -- -d ubuntu -r $release -a $ARCH
++run_cmd lxc-create -t download -n $cname -- --no-validate -d ubuntu -r $release -a $ARCH
+
+ echo "test default confined container"
+ run_cmd lxc-start -n $cname -d -lDEBUG -o "$logfile"
+diff --git a/src/tests/lxc-test-autostart b/src/tests/lxc-test-autostart
+index e5b651b..d15b79b 100755
+--- a/src/tests/lxc-test-autostart
++++ b/src/tests/lxc-test-autostart
+@@ -55,7 +55,7 @@ if [ -f /etc/lsb-release ]; then
+ done
+ fi
+
+-lxc-create -t download -n $CONTAINER_NAME -B dir -- -d ubuntu -r $release -a $ARCH
++lxc-create -t download -n $CONTAINER_NAME -B dir -- --no-validate -d ubuntu -r $release -a $ARCH
+ CONTAINER_PATH=$(dirname $(lxc-info -n $CONTAINER_NAME -c lxc.rootfs.path -H) | sed -e 's/dir://')
+ cp $CONTAINER_PATH/config $CONTAINER_PATH/config.bak
+
+diff --git a/src/tests/lxc-test-no-new-privs b/src/tests/lxc-test-no-new-privs
+index 8642992..e72bdf0 100755
+--- a/src/tests/lxc-test-no-new-privs
++++ b/src/tests/lxc-test-no-new-privs
+@@ -47,7 +47,7 @@ if type dpkg >/dev/null 2>&1; then
+ ARCH=$(dpkg --print-architecture)
+ fi
+
+-lxc-create -t download -n c1 -- -d ubuntu -r xenial -a $ARCH
++lxc-create -t download -n c1 -- --no-validate -d ubuntu -r xenial -a $ARCH
+ echo "lxc.no_new_privs = 1" >> /var/lib/lxc/c1/config
+
+ lxc-start -n c1
+diff --git a/src/tests/lxc-test-unpriv b/src/tests/lxc-test-unpriv
+index 16ff12d..0958d48 100755
+--- a/src/tests/lxc-test-unpriv
++++ b/src/tests/lxc-test-unpriv
+@@ -173,7 +173,7 @@ run_cmd mkdir -p $HDIR/.cache/lxc
+ cp -R /var/cache/lxc/download $HDIR/.cache/lxc && \
+ chown -R $TUSER: $HDIR/.cache/lxc
+
+-run_cmd lxc-create -t download -n c1 -- -d ubuntu -r $release -a $ARCH
++run_cmd lxc-create -t download -n c1 -- --no-validate -d ubuntu -r $release -a $ARCH
+
+ # Make sure we can start it - twice
+
+diff --git a/src/tests/lxc-test-usernic.in b/src/tests/lxc-test-usernic.in
+index 3e35008..f489286 100755
+--- a/src/tests/lxc-test-usernic.in
++++ b/src/tests/lxc-test-usernic.in
+@@ -146,7 +146,7 @@ if [ -f /etc/lsb-release ]; then
+ fi
+
+ # Create three containers
+-run_cmd "lxc-create -t download -n b1 -- -d ubuntu -r $release -a $ARCH"
++run_cmd "lxc-create -t download -n b1 -- --no-validate -d ubuntu -r $release -a $ARCH"
+ run_cmd "lxc-start -n b1 -d"
+ p1=$(run_cmd "lxc-info -n b1 -p -H")
+
diff --git a/external/meta-virtualization/recipes-containers/lxc/files/tests-our-init-is-not-busybox.patch b/external/meta-virtualization/recipes-containers/lxc/files/tests-our-init-is-not-busybox.patch
new file mode 100644
index 00000000..e6c71d3d
--- /dev/null
+++ b/external/meta-virtualization/recipes-containers/lxc/files/tests-our-init-is-not-busybox.patch
@@ -0,0 +1,29 @@
+From 51d88d9741c30ff4a798698514cac831ae61680b Mon Sep 17 00:00:00 2001
+From: Mark Asselstine <mark.asselstine@windriver.com>
+Date: Thu, 31 May 2018 15:00:34 -0400
+Subject: [PATCH] tests: our init is not busybox
+
+Since we are using 'bash' as the init (see our updates to the busybox
+template) we can't compare '/sbin/init' and 'busybox'. Actually we are
+really only interested in the fact 'cmp' is being run and not the
+result, so simplify by comparing '/sbin/init' to itself.
+
+Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
+
+---
+ src/tests/attach.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/tests/attach.c b/src/tests/attach.c
+index 07e641d..aac609f 100644
+--- a/src/tests/attach.c
++++ b/src/tests/attach.c
+@@ -248,7 +248,7 @@ static int test_attach_cmd(struct lxc_container *ct)
+ {
+ int ret;
+ pid_t pid;
+- char *argv[] = {"cmp", "-s", "/sbin/init", "/bin/busybox", NULL};
++ char *argv[] = {"cmp", "-s", "/sbin/init", "/sbin/init", NULL};
+ lxc_attach_command_t command = {"cmp", argv};
+ lxc_attach_options_t attach_options = LXC_ATTACH_OPTIONS_DEFAULT;
+
diff --git a/external/meta-virtualization/recipes-containers/lxc/lxc_3.1.0.bb b/external/meta-virtualization/recipes-containers/lxc/lxc_3.1.0.bb
new file mode 100644
index 00000000..977583f2
--- /dev/null
+++ b/external/meta-virtualization/recipes-containers/lxc/lxc_3.1.0.bb
@@ -0,0 +1,196 @@
+DESCRIPTION = "lxc aims to use these new functionnalities to provide an userspace container object"
+SECTION = "console/utils"
+LICENSE = "LGPLv2.1"
+LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
+DEPENDS = "libxml2 libcap"
+RDEPENDS_${PN} = " \
+ rsync \
+ gzip \
+ xz \
+ tar \
+ wget \
+ libcap-bin \
+ bridge-utils \
+ dnsmasq \
+ perl-module-strict \
+ perl-module-getopt-long \
+ perl-module-vars \
+ perl-module-exporter \
+ perl-module-constant \
+ perl-module-overload \
+ perl-module-exporter-heavy \
+ gmp \
+ libidn \
+ gnutls \
+ nettle \
+ util-linux-mountpoint \
+ util-linux-getopt \
+"
+
+RDEPENDS_${PN}_append_libc-glibc = " glibc-utils"
+
+RDEPENDS_${PN}-ptest += "file make gmp nettle gnutls bash libgcc"
+
+RDEPENDS_${PN}-networking += "iptables"
+
+SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz \
+ file://lxc-1.0.0-disable-udhcp-from-busybox-template.patch \
+ file://run-ptest \
+ file://lxc-fix-B-S.patch \
+ file://lxc-doc-upgrade-to-use-docbook-3.1-DTD.patch \
+ file://logs-optionally-use-base-filenames-to-report-src-fil.patch \
+ file://templates-actually-create-DOWNLOAD_TEMP-directory.patch \
+ file://template-make-busybox-template-compatible-with-core-.patch \
+ file://tests-our-init-is-not-busybox.patch \
+ file://tests-add-no-validate-when-using-download-template.patch \
+ file://dnsmasq.conf \
+ file://lxc-net \
+ "
+
+SRC_URI[md5sum] = "e83e302a801494276f3772e687a3b8b0"
+SRC_URI[sha256sum] = "4d8772c25baeaea2c37a954902b88c05d1454c91c887cb6a0997258cfac3fdc5"
+
+S = "${WORKDIR}/${BPN}-${PV}"
+
+# Let's not configure for the host distro.
+#
+PTEST_CONF = "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '--enable-tests', '', d)}"
+EXTRA_OECONF += "--with-distro=${DISTRO} ${PTEST_CONF}"
+
+EXTRA_OECONF += "--with-init-script=\
+${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'sysvinit,', '', d)}\
+${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}"
+
+EXTRA_OECONF += "--enable-log-src-basename"
+
+CFLAGS_append = " -Wno-error=deprecated-declarations"
+
+PACKAGECONFIG ??= "templates \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \
+"
+PACKAGECONFIG[doc] = "--enable-doc --enable-api-docs,--disable-doc --disable-api-docs,,"
+PACKAGECONFIG[rpath] = "--enable-rpath,--disable-rpath,,"
+PACKAGECONFIG[apparmor] = "--enable-apparmor,--disable-apparmor,apparmor,apparmor"
+PACKAGECONFIG[templates] = ",,, ${PN}-templates"
+PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux,libselinux"
+PACKAGECONFIG[seccomp] ="--enable-seccomp,--disable-seccomp,libseccomp,libseccomp"
+PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/,--without-systemdsystemunitdir,systemd,"
+
+# required by python3 to run setup.py
+export BUILD_SYS
+export HOST_SYS
+export STAGING_INCDIR
+export STAGING_LIBDIR
+
+inherit autotools pkgconfig ptest update-rc.d systemd python3native
+
+SYSTEMD_PACKAGES = "${PN} ${PN}-networking"
+SYSTEMD_SERVICE_${PN} = "lxc.service"
+SYSTEMD_AUTO_ENABLE_${PN} = "disable"
+SYSTEMD_SERVICE_${PN}-networking = "lxc-net.service"
+SYSTEMD_AUTO_ENABLE_${PN}-networking = "enable"
+
+INITSCRIPT_PACKAGES = "${PN} ${PN}-networking"
+INITSCRIPT_NAME_${PN} = "lxc-containers"
+INITSCRIPT_PARAMS_${PN} = "defaults"
+INITSCRIPT_NAME_${PN}-networking = "lxc-net"
+INITSCRIPT_PARAMS_${PN}-networking = "defaults"
+
+FILES_${PN}-doc = "${mandir} ${infodir}"
+# For LXC the docdir only contains example configuration files and should be included in the lxc package
+FILES_${PN} += "${docdir}"
+FILES_${PN} += "${libdir}/python3*"
+FILES_${PN} += "${datadir}/bash-completion"
+FILES_${PN}-dbg += "${libexecdir}/lxc/.debug"
+FILES_${PN}-dbg += "${libexecdir}/lxc/hooks/.debug"
+PACKAGES =+ "${PN}-templates ${PN}-networking ${PN}-lua"
+FILES_lua-${PN} = "${datadir}/lua ${libdir}/lua"
+FILES_lua-${PN}-dbg += "${libdir}/lua/lxc/.debug"
+FILES_${PN}-templates += "${datadir}/lxc/templates"
+RDEPENDS_${PN}-templates += "bash"
+
+FILES_${PN}-networking += " \
+ ${sysconfdir}/init.d/lxc-net \
+ ${sysconfdir}/default/lxc-net \
+"
+
+CACHED_CONFIGUREVARS += " \
+ ac_cv_path_PYTHON='${STAGING_BINDIR_NATIVE}/python3-native/python3' \
+ am_cv_python_pyexecdir='${exec_prefix}/${libdir}/python3.5/site-packages' \
+ am_cv_python_pythondir='${prefix}/${libdir}/python3.5/site-packages' \
+"
+
+do_install_append() {
+ # The /var/cache/lxc directory created by the Makefile
+ # is wiped out in volatile, we need to create this at boot.
+ rm -rf ${D}${localstatedir}/cache
+ install -d ${D}${sysconfdir}/default/volatiles
+ echo "d root root 0755 ${localstatedir}/cache/lxc none" \
+ > ${D}${sysconfdir}/default/volatiles/99_lxc
+
+ for i in `grep -l "#! */bin/bash" ${D}${datadir}/lxc/hooks/*`; do \
+ sed -e 's|#! */bin/bash|#!/bin/sh|' -i $i; done
+
+ install -d ${D}${sysconfdir}/init.d
+ install -m 755 config/init/sysvinit/lxc* ${D}${sysconfdir}/init.d
+
+ # since python3-native is used for install location this will not be
+ # suitable for the target and we will have to correct the package install
+ if ${@bb.utils.contains('PACKAGECONFIG', 'python', 'true', 'false', d)}; then
+ if [ -d ${D}${exec_prefix}/lib/python* ]; then mv ${D}${exec_prefix}/lib/python* ${D}${libdir}/; fi
+ rmdir --ignore-fail-on-non-empty ${D}${exec_prefix}/lib
+ fi
+
+ # /etc/default/lxc sources lxc-net, this allows lxc bridge when lxc-networking
+ # is not installed this results in no lxcbr0, but when lxc-networking is installed
+ # lxcbr0 will be fully configured.
+ install -m 644 ${WORKDIR}/lxc-net ${D}${sysconfdir}/default/
+
+ # Force the main dnsmasq instance to bind only to specified interfaces and
+ # to not bind to virbr0. Libvirt will run its own instance on this interface.
+ install -d ${D}/${sysconfdir}/dnsmasq.d
+ install -m 644 ${WORKDIR}/dnsmasq.conf ${D}/${sysconfdir}/dnsmasq.d/lxc
+}
+
+EXTRA_OEMAKE += "TEST_DIR=${D}${PTEST_PATH}/src/tests"
+
+do_install_ptest() {
+ # Move tests to the "ptest directory"
+ install -d ${D}/${PTEST_PATH}/tests
+ mv ${D}/usr/bin/lxc-test-* ${D}/${PTEST_PATH}/tests/.
+}
+
+pkg_postinst_${PN}() {
+ if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
+ /etc/init.d/populate-volatile.sh update
+ fi
+}
+
+pkg_postinst_ontarget_${PN}-networking() {
+if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
+cat >> /etc/network/interfaces << EOF
+
+auto lxcbr0
+iface lxcbr0 inet dhcp
+ bridge_ports eth0
+ bridge_fd 0
+ bridge_maxwait 0
+EOF
+
+cat<<EOF>/etc/network/if-pre-up.d/lxcbr0
+#! /bin/sh
+
+if test "x\$IFACE" = xlxcbr0 ; then
+ brctl show |grep lxcbr0 > /dev/null 2>/dev/null
+ if [ \$? != 0 ] ; then
+ brctl addbr lxcbr0
+ brctl addif lxcbr0 eth0
+ ip addr flush eth0
+ ifconfig eth0 up
+ fi
+fi
+EOF
+chmod 755 /etc/network/if-pre-up.d/lxcbr0
+fi
+}