diff options
Diffstat (limited to 'external/meta-virtualization/recipes-extended')
120 files changed, 10772 insertions, 0 deletions
diff --git a/external/meta-virtualization/recipes-extended/ceph/ceph/0001-Correct-the-path-to-find-version.h-in-rocksdb.patch b/external/meta-virtualization/recipes-extended/ceph/ceph/0001-Correct-the-path-to-find-version.h-in-rocksdb.patch new file mode 100644 index 00000000..788505b2 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/ceph/ceph/0001-Correct-the-path-to-find-version.h-in-rocksdb.patch @@ -0,0 +1,40 @@ +From a53605694d5301b7bb543464b17f74bbbd35d372 Mon Sep 17 00:00:00 2001 +From: Dengke Du <dengke.du@windriver.com> +Date: Tue, 28 Aug 2018 10:04:40 +0800 +Subject: [PATCH] Correct the path to find version.h in rocksdb + +Signed-off-by: Dengke Du <dengke.du@windriver.com> +--- + cmake/modules/Findrocksdb.cmake | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/cmake/modules/Findrocksdb.cmake b/cmake/modules/Findrocksdb.cmake +index f8369f7..36b67ea 100644 +--- a/cmake/modules/Findrocksdb.cmake ++++ b/cmake/modules/Findrocksdb.cmake +@@ -9,17 +9,17 @@ + # ROCKSDB_VERSION_MINOR + # ROCKSDB_VERSION_PATCH + +-find_path(ROCKSDB_INCLUDE_DIR rocksdb/db.h) ++find_path(ROCKSDB_INCLUDE_DIR rocksdb/db.h ${CMAKE_SYSROOT}) + +-find_library(ROCKSDB_LIBRARIES rocksdb) ++find_library(ROCKSDB_LIBRARIES rocksdb ${CMAKE_SYSROOT}) + + if(ROCKSDB_INCLUDE_DIR AND EXISTS "${ROCKSDB_INCLUDE_DIR}/rocksdb/version.h") + foreach(ver "MAJOR" "MINOR" "PATCH") +- file(STRINGS "${ROCKSDB_INCLUDE_DIR}/version.h" ROCKSDB_VER_${ver}_LINE ++ file(STRINGS "${ROCKSDB_INCLUDE_DIR}/rocksdb/version.h" ROCKSDB_VER_${ver}_LINE + REGEX "^#define[ \t]+ROCKSDB_${ver}[ \t]+[0-9]+$") + string(REGEX REPLACE "^#define[ \t]+ROCKSDB_${ver}[ \t]+([0-9]+)$" +- "\\1" ROCKSDB_VERSION_${ver} "${ROCKDB_VER_${ver}_LINE}") +- unset(${ROCKDB_VER_${ver}_LINE}) ++ "\\1" ROCKSDB_VERSION_${ver} "${ROCKSDB_VER_${ver}_LINE}") ++ unset(ROCKSDB_VER_${ver}_LINE) + endforeach() + set(ROCKSDB_VERSION_STRING + "${ROCKSDB_VERSION_MAJOR}.${ROCKSDB_VERSION_MINOR}.${ROCKSDB_VERSION_PATCH}") +-- +2.7.4 + diff --git a/external/meta-virtualization/recipes-extended/ceph/ceph/0001-ceph-add-pybind-support-in-OE.patch b/external/meta-virtualization/recipes-extended/ceph/ceph/0001-ceph-add-pybind-support-in-OE.patch new file mode 100644 index 00000000..f9c53406 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/ceph/ceph/0001-ceph-add-pybind-support-in-OE.patch @@ -0,0 +1,129 @@ +From 00d44940c2e83bf73101a05d2aa8f88c2e2fca58 Mon Sep 17 00:00:00 2001 +From: Dengke Du <dengke.du@windriver.com> +Date: Tue, 23 Oct 2018 15:34:53 +0800 +Subject: [PATCH] ceph: add pybind support in OE + +1. add sysroot to CFLAGS when cross compiling pybind +2. change the pybind's INSTALL path to OE's INSTALL path +3. delete the check for header files, because the check method using + host compiler. + +Signed-off-by: Dengke Du <dengke.du@windriver.com> +Upstream-Status: Inappropriate [oe specific] +--- + cmake/modules/Distutils.cmake | 12 +++--------- + src/pybind/cephfs/setup.py | 8 -------- + src/pybind/rados/setup.py | 8 -------- + src/pybind/rbd/setup.py | 8 -------- + src/pybind/rgw/setup.py | 8 -------- + 5 files changed, 3 insertions(+), 41 deletions(-) + +diff --git a/cmake/modules/Distutils.cmake b/cmake/modules/Distutils.cmake +index d6e9f38..3091d97 100644 +--- a/cmake/modules/Distutils.cmake ++++ b/cmake/modules/Distutils.cmake +@@ -47,7 +47,7 @@ function(distutils_add_cython_module name src) + LDFLAGS=-L${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + CYTHON_BUILD_DIR=${CMAKE_CURRENT_BINARY_DIR} + CEPH_LIBDIR=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} +- CFLAGS=\"-iquote${CMAKE_SOURCE_DIR}/src/include -w\" ++ CFLAGS=\"-iquote${CMAKE_SOURCE_DIR}/src/include -w --sysroot=${CMAKE_SYSROOT}\" + ${PYTHON${PYTHON_VERSION}_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/setup.py + build --verbose --build-base ${CYTHON_MODULE_DIR} + --build-platlib ${CYTHON_MODULE_DIR}/lib.${PYTHON${PYTHON_VERSION}_VERSION_MAJOR} +@@ -69,14 +69,8 @@ function(distutils_install_cython_module name) + set(ENV{CEPH_LIBDIR} \"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}\") + + set(options --prefix=${CMAKE_INSTALL_PREFIX}) +- if(DEFINED ENV{DESTDIR}) +- if(EXISTS /etc/debian_version) +- list(APPEND options --install-layout=deb) +- endif() +- list(APPEND options --root=\$ENV{DESTDIR}) +- else() +- list(APPEND options --root=/) +- endif() ++ list(APPEND options --root=${CMAKE_DESTDIR}) ++ list(APPEND options --install-lib=${PYTHON_SITEPACKAGES_DIR}) + execute_process( + COMMAND + ${PYTHON${PYTHON_VERSION}_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/setup.py +diff --git a/src/pybind/cephfs/setup.py b/src/pybind/cephfs/setup.py +index 6533f41..1ee4a59 100755 +--- a/src/pybind/cephfs/setup.py ++++ b/src/pybind/cephfs/setup.py +@@ -121,14 +121,6 @@ def check_sanity(): + finally: + shutil.rmtree(tmp_dir) + +- +-if 'BUILD_DOC' in os.environ.keys(): +- pass +-elif check_sanity(): +- pass +-else: +- sys.exit(1) +- + cmdclass = {} + try: + from Cython.Build import cythonize +diff --git a/src/pybind/rados/setup.py b/src/pybind/rados/setup.py +index ef7c307..5204017 100755 +--- a/src/pybind/rados/setup.py ++++ b/src/pybind/rados/setup.py +@@ -117,14 +117,6 @@ def check_sanity(): + finally: + shutil.rmtree(tmp_dir) + +- +-if 'BUILD_DOC' in os.environ.keys(): +- pass +-elif check_sanity(): +- pass +-else: +- sys.exit(1) +- + cmdclass = {} + try: + from Cython.Build import cythonize +diff --git a/src/pybind/rbd/setup.py b/src/pybind/rbd/setup.py +index bcf96f2..d4cbbeb 100755 +--- a/src/pybind/rbd/setup.py ++++ b/src/pybind/rbd/setup.py +@@ -120,14 +120,6 @@ def check_sanity(): + finally: + shutil.rmtree(tmp_dir) + +- +-if 'BUILD_DOC' in os.environ.keys(): +- pass +-elif check_sanity(): +- pass +-else: +- sys.exit(1) +- + cmdclass = {} + try: + from Cython.Build import cythonize +diff --git a/src/pybind/rgw/setup.py b/src/pybind/rgw/setup.py +index f14f30c..ee7570b 100755 +--- a/src/pybind/rgw/setup.py ++++ b/src/pybind/rgw/setup.py +@@ -120,14 +120,6 @@ def check_sanity(): + finally: + shutil.rmtree(tmp_dir) + +- +-if 'BUILD_DOC' in os.environ.keys(): +- pass +-elif check_sanity(): +- pass +-else: +- sys.exit(1) +- + cmdclass = {} + try: + from Cython.Build import cythonize +-- +2.7.4 + diff --git a/external/meta-virtualization/recipes-extended/ceph/ceph/0001-ceph-detect-init-correct-the-installation-for-OE.patch b/external/meta-virtualization/recipes-extended/ceph/ceph/0001-ceph-detect-init-correct-the-installation-for-OE.patch new file mode 100644 index 00000000..875501bf --- /dev/null +++ b/external/meta-virtualization/recipes-extended/ceph/ceph/0001-ceph-detect-init-correct-the-installation-for-OE.patch @@ -0,0 +1,36 @@ +From 6aaf04036f0affbeddda123bff111990c4d5fd72 Mon Sep 17 00:00:00 2001 +From: Dengke Du <dengke.du@windriver.com> +Date: Fri, 26 Oct 2018 14:31:10 +0800 +Subject: [PATCH] ceph-detect-init: correct the installation for OE + +Signed-off-by: Dengke Du <dengke.du@windriver.com> +Upstream-Status: Inappropriate [oe specific] +--- + cmake/modules/Distutils.cmake | 11 ++--------- + 1 file changed, 2 insertions(+), 9 deletions(-) + +diff --git a/cmake/modules/Distutils.cmake b/cmake/modules/Distutils.cmake +index 3091d97..c50fe77 100644 +--- a/cmake/modules/Distutils.cmake ++++ b/cmake/modules/Distutils.cmake +@@ -16,15 +16,8 @@ function(distutils_install_module name) + cmake_parse_arguments(DU "" INSTALL_SCRIPT "" ${ARGN}) + install(CODE " + set(options --prefix=${CMAKE_INSTALL_PREFIX}) +- if(DEFINED ENV{DESTDIR}) +- if(EXISTS /etc/debian_version) +- list(APPEND options --install-layout=deb) +- endif() +- list(APPEND options --root=\$ENV{DESTDIR}) +- if(NOT \"${DU_INSTALL_SCRIPT}\" STREQUAL \"\") +- list(APPEND options --install-script=${DU_INSTALL_SCRIPT}) +- endif() +- endif() ++ list(APPEND options --root=${CMAKE_DESTDIR}) ++ list(APPEND options --install-lib=${PYTHON_SITEPACKAGES_DIR}) + execute_process( + COMMAND ${PYTHON${PYTHON_VERSION}_EXECUTABLE} + setup.py install \${options} +-- +2.7.4 + diff --git a/external/meta-virtualization/recipes-extended/ceph/ceph/0001-zstd-fix-error-for-cross-compile.patch b/external/meta-virtualization/recipes-extended/ceph/ceph/0001-zstd-fix-error-for-cross-compile.patch new file mode 100644 index 00000000..66b5f0a5 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/ceph/ceph/0001-zstd-fix-error-for-cross-compile.patch @@ -0,0 +1,26 @@ +From 3e86b6d9db2682b123839e38e9bf45060e2bb2ab Mon Sep 17 00:00:00 2001 +From: Dengke Du <dengke.du@windriver.com> +Date: Wed, 29 Aug 2018 16:57:52 +0800 +Subject: [PATCH] zstd: fix error for cross compile + +Signed-off-by: Dengke Du <dengke.du@windriver.com> +--- + src/compressor/zstd/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/compressor/zstd/CMakeLists.txt b/src/compressor/zstd/CMakeLists.txt +index e30cb89..b298a3d 100644 +--- a/src/compressor/zstd/CMakeLists.txt ++++ b/src/compressor/zstd/CMakeLists.txt +@@ -9,7 +9,7 @@ ExternalProject_Add(zstd_ext + CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_C_FLAGS=${ZSTD_C_FLAGS} +- -DCMAKE_AR=${CMAKE_AR} ++ -DCMAKE_SYSROOT=${CMAKE_SYSROOT} + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/libzstd + BUILD_COMMAND $(MAKE) libzstd_static + INSTALL_COMMAND "true") +-- +2.7.4 + diff --git a/external/meta-virtualization/recipes-extended/ceph/ceph/ceph.conf b/external/meta-virtualization/recipes-extended/ceph/ceph/ceph.conf new file mode 100644 index 00000000..fd9de6ce --- /dev/null +++ b/external/meta-virtualization/recipes-extended/ceph/ceph/ceph.conf @@ -0,0 +1,70 @@ +[global] + # Unique ID for the cluster. Run uuidgen to get this string. + fsid = %CLUSTER_UUID% + # Initial monitor + mon initial members = node1 + # IP address of the initial monitor, i.e. 128.224.149.xx + mon host = %PUBLIC_IP% + # Public network where the monitor is connected to, i.e, 128.224.0.0/16 + public network = %PUBLIC_DOMAIN% + # For version 0.55 and beyond, you must explicitly enable + # or disable authentication with "auth" entries in [global]. + auth cluster required = cephx + auth service required = cephx + auth client required = cephx + osd journal size = 1024 + + # Uncomment the following line if you are mounting with ext4 + # filestore xattr use omap = true + + # Number of replicas of objects. Write an object 2 times. + # Cluster cannot reach an active + clean state until there's enough OSDs + # to handle the number of copies of an object. In this case, it requires + # at least 2 OSDs + osd pool default size = 2 + + # Allow writing one copy in a degraded state. + osd pool default min size = 1 + + # Ensure you have a realistic number of placement groups. We recommend + # approximately 100 per OSD. E.g., total number of OSDs multiplied by 100 + # divided by the number of replicas (i.e., osd pool default size). So for + # 10 OSDs and osd pool default size = 2, we'd recommend approximately + # (100 * 10) / 2 = 500. + osd pool default pg num = 500 + osd pool default pgp num = 500 + osd crush chooseleaf type = 1 + +[osd] + osd mkfs type = xfs + osd mkfs options xfs = "-f" + osd mount options xfs = "rw,noatime,inode64,logbufs=8,logbsize=256k" + +# All port numbers below are not hard-coded, but expected by ceph, so please +# do not change the numbers. +[mon.node1] + host = node1 + mon addr = %PUBLIC_IP%:6789 + +[osd.0] + host = node1 + public addr = %PUBLIC_IP%:6800 + cluster addr = %PRIVATE_IP%:6800 + devs = /dev/sda1 + +[osd.1] + host = node1 + public addr = %PUBLIC_IP%:6801 + cluster addr = %PRIVATE_IP%:6801 + devs = /dev/sda2 + +[osd.2] + host = node1 + public addr = %PUBLIC_IP%:6802 + cluster addr = %PRIVATE_IP%:6802 + devs = /dev/sda3 + +[mds.a] + host = node1 + devs = /dev/sda4 + diff --git a/external/meta-virtualization/recipes-extended/ceph/ceph_13.2.2.bb b/external/meta-virtualization/recipes-extended/ceph/ceph_13.2.2.bb new file mode 100644 index 00000000..08021cf7 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/ceph/ceph_13.2.2.bb @@ -0,0 +1,103 @@ +SUMMARY = "User space components of the Ceph file system" +LICENSE = "LGPLv2.1 & GPLv2 & Apache-2.0 & MIT" +LIC_FILES_CHKSUM = "file://COPYING-LGPL2.1;md5=fbc093901857fcd118f065f900982c24 \ + file://COPYING-GPL2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://COPYING;md5=92d301c8fccd296f2221a68a8dd53828 \ +" +inherit cmake pythonnative python-dir systemd +# Disable python pybind support for ceph temporary, when corss compiling pybind, +# pybind mix cmake and python setup environment, would case a lot of errors. + +SRC_URI = "http://download.ceph.com/tarballs/ceph-${PV}.tar.gz \ + file://0001-Correct-the-path-to-find-version.h-in-rocksdb.patch \ + file://0001-zstd-fix-error-for-cross-compile.patch \ + file://0001-ceph-add-pybind-support-in-OE.patch \ + file://0001-ceph-detect-init-correct-the-installation-for-OE.patch \ + file://ceph.conf \ +" +SRC_URI[md5sum] = "ce118be451dcb6b89e9e0a45057827dd" +SRC_URI[sha256sum] = "f3a61db4c90e00c38a2dac7239b956ec367ef56f601e07335ed3011f931d8840" + +DEPENDS = "boost bzip2 curl expat gperf-native \ + keyutils libaio libibverbs lz4 \ + nspr nss \ + oath openldap openssl \ + python python-cython-native rocksdb snappy udev \ + valgrind xfsprogs zlib \ +" +SYSTEMD_SERVICE_${PN} = " \ + ceph-radosgw@.service \ + ceph-radosgw.target \ + ceph-mon@.service \ + ceph-mon.target \ + ceph-mds@.service \ + ceph-mds.target \ + ceph-disk@.service \ + ceph-osd@.service \ + ceph-osd.target \ + ceph.target \ + ceph-fuse@.service \ + ceph-fuse.target \ + ceph-rbd-mirror@.service \ + ceph-rbd-mirror.target \ + ceph-volume@.service \ + ceph-mgr@.service \ + ceph-mgr.target \ + rbdmap.service \ +" +OECMAKE_GENERATOR = "Unix Makefiles" + +EXTRA_OECMAKE = "-DWITH_MANPAGE=OFF \ + -DWITH_FUSE=OFF \ + -DWITH_SPDK=OFF \ + -DWITH_LEVELDB=OFF \ + -DWITH_LTTNG=OFF \ + -DWITH_BABELTRACE=OFF \ + -DWITH_TESTS=OFF \ + -DWITH_MGR=OFF \ + -DWITH_MGR_DASHBOARD_FRONTEND=OFF \ + -DWITH_SYSTEM_BOOST=ON \ + -DWITH_SYSTEM_ROCKSDB=ON \ +" + +do_configure_prepend () { + echo "set( CMAKE_SYSROOT \"${RECIPE_SYSROOT}\" )" >> ${WORKDIR}/toolchain.cmake + echo "set( CMAKE_DESTDIR \"${D}\" )" >> ${WORKDIR}/toolchain.cmake + echo "set( PYTHON_SITEPACKAGES_DIR \"${PYTHON_SITEPACKAGES_DIR}\" )" >> ${WORKDIR}/toolchain.cmake +} + +do_install_append () { + sed -i -e 's:${WORKDIR}.*python2:${bindir}/python:' ${D}${bindir}/ceph + sed -i -e 's:${WORKDIR}.*python2:${bindir}/python:' ${D}${bindir}/ceph-disk + sed -i -e 's:${WORKDIR}.*python2:${bindir}/python:' ${D}${bindir}/ceph-detect-init + find ${D} -name SOURCES.txt | xargs sed -i -e 's:${WORKDIR}::' + install -d ${D}${sysconfdir}/ceph + install -m 644 ${WORKDIR}/ceph.conf ${D}${sysconfdir}/ceph/ + install -d ${D}${systemd_unitdir} + mv ${D}${libexecdir}/systemd/system ${D}${systemd_unitdir} + mv ${D}${libexecdir}/ceph/ceph-osd-prestart.sh ${D}${libdir}/ceph + mv ${D}${libexecdir}/ceph/ceph_common.sh ${D}${libdir}/ceph +} + +FILES_${PN} += "\ + ${libdir}/rados-classes/*.so.* \ + ${libdir}/ceph/compressor/*.so \ + ${libdir}/rados-classes/*.so \ + ${libdir}/ceph/*.so \ +" +FILES_${PN}-python = "\ + ${PYTHON_SITEPACKAGES_DIR}/* \ +" +RDEPENDS_${PN} += "\ + python \ + python-misc \ + python-modules \ + python-prettytable \ + ${PN}-python \ +" +COMPATIBLE_HOST = "(x86_64).*" +PACKAGES += " \ + ${PN}-python \ +" +INSANE_SKIP_${PN}-python += "ldflags" +INSANE_SKIP_${PN} += "dev-so" diff --git a/external/meta-virtualization/recipes-extended/dev86/dev86_0.16.20.bb b/external/meta-virtualization/recipes-extended/dev86/dev86_0.16.20.bb new file mode 100644 index 00000000..38dbf8d4 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/dev86/dev86_0.16.20.bb @@ -0,0 +1,38 @@ +DESCRIPTION = "This is a cross development C compiler, assembler and linker environment for the production of 8086 executables (Optionally MSDOS COM)" +HOMEPAGE = "http://www.debath.co.uk/dev86/" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b" +SECTION = "console/tools" +PR="r0" + +SRC_URI="http://v3.sk/~lkundrak/dev86/archive/Dev86src-${PV}.tar.gz" + +SRC_URI[md5sum] = "567cf460d132f9d8775dd95f9208e49a" +SRC_URI[sha256sum] = "61817a378c8c8ba65f36c6792d457a305dc4eedae8cdc8b6233bf2bb28e5fe8d" + +S = "${WORKDIR}/dev86-${PV}" + +BBCLASSEXTEND = "native" +EXTRA_OEMAKE = "VERSION=${PV} PREFIX=${prefix} DIST=${D}" + +do_compile() { + + oe_runmake make.fil + oe_runmake -f make.fil bcc86 as86 ld86 + +} + +do_install() { + + if [ "${prefix}"=="" ] ; then + export prefix=/usr + fi + + oe_runmake install-bcc + ln -s ../lib/bcc/bcc-cpp ${D}${prefix}/bin/bcc-cpp + ln -s ../lib/bcc/bcc-cc1 ${D}${prefix}/bin/bcc-cc1 + +} +COMPATIBLE_HOST = "(i.86|x86_64).*-linux" +FILES_${PN} += "${libdir}/bcc" +INSANE_SKIP_${PN} = "already-stripped" diff --git a/external/meta-virtualization/recipes-extended/diod/diod_1.0.24.bb b/external/meta-virtualization/recipes-extended/diod/diod_1.0.24.bb new file mode 100644 index 00000000..bb5707e5 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/diod/diod_1.0.24.bb @@ -0,0 +1,33 @@ +SUMMARY = "Diod is a user space server for the kernel v9fs client." +DESCRIPTION = "\ +Diod is a user space server for the kernel v9fs client (9p.ko, 9pnet.ko). \ +Although the kernel client supports several 9P variants, diod only supports \ +9P2000.L, and only in its feature-complete form, as it appeared in 2.6.38." +SECTION = "console/network" + +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552" + +PV = "1.0.24+git${SRCPV}" +SRCREV = "0ea3fe3d829b5085307cd27a512708d99ef48199" +SRC_URI = "git://github.com/chaos/diod.git;protocol=git \ + file://diod \ + file://diod.conf \ + file://0001-build-allow-builds-to-work-with-separate-build-dir.patch \ + file://0002-auto.diod.in-remove-bashisms.patch \ + file://0001-diod-ops.c-add-header-file-for-makedev.patch \ + " +DEPENDS = "libcap ncurses tcp-wrappers lua" + +S = "${WORKDIR}/git" + +inherit autotools systemd + +do_install_append () { + # install our init based on start-stop-daemon + install -D -m 0755 ${WORKDIR}/diod ${D}${sysconfdir}/init.d/diod + # install a real(not commented) configuration file for diod + install -m 0644 ${WORKDIR}/diod.conf ${D}${sysconfdir}/diod.conf +} + +FILES_${PN} += "${systemd_unitdir}" diff --git a/external/meta-virtualization/recipes-extended/diod/files/0001-build-allow-builds-to-work-with-separate-build-dir.patch b/external/meta-virtualization/recipes-extended/diod/files/0001-build-allow-builds-to-work-with-separate-build-dir.patch new file mode 100644 index 00000000..f40e0eb5 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/diod/files/0001-build-allow-builds-to-work-with-separate-build-dir.patch @@ -0,0 +1,126 @@ +From 43403468298ef4167baa5d84de2ee2eaf7f4007a Mon Sep 17 00:00:00 2001 +From: Mark Asselstine <mark.asselstine@windriver.com> +Date: Fri, 9 Jan 2015 18:34:04 +0000 +Subject: [PATCH 1/2] build: allow builds to work with separate build dir + +Remove assumptions in include paths that assume the build +is happening in the source directories. + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> +--- + diod/Makefile.am | 2 +- + libdiod/Makefile.am | 2 +- + liblsd/Makefile.am | 2 +- + libnpclient/Makefile.am | 2 +- + scripts/Makefile.am | 6 +++--- + tests/kern/dbench/Makefile.am | 4 ++-- + utils/Makefile.am | 2 +- + 7 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/diod/Makefile.am b/diod/Makefile.am +index 7644be7..fdaf130 100644 +--- a/diod/Makefile.am ++++ b/diod/Makefile.am +@@ -1,7 +1,7 @@ + AM_CFLAGS = @GCCWARN@ + + AM_CPPFLAGS = \ +- -I../libnpfs -I../liblsd -I../libdiod ++ -I$(srcdir)/../libnpfs -I$(srcdir)/../liblsd -I$(srcdir)/../libdiod + + sbin_PROGRAMS = diod + +diff --git a/libdiod/Makefile.am b/libdiod/Makefile.am +index 4810e14..6905cdd 100644 +--- a/libdiod/Makefile.am ++++ b/libdiod/Makefile.am +@@ -1,7 +1,7 @@ + AM_CFLAGS = @GCCWARN@ + + AM_CPPFLAGS = \ +- -I../libnpfs -I../libnpclient -I../liblsd ++ -I$(srcdir)/../libnpfs -I$(srcdir)/../libnpclient -I$(srcdir)/../liblsd + + noinst_LIBRARIES = libdiod.a + +diff --git a/liblsd/Makefile.am b/liblsd/Makefile.am +index c3e5658..7e18bf8 100644 +--- a/liblsd/Makefile.am ++++ b/liblsd/Makefile.am +@@ -1,6 +1,6 @@ + AM_CFLAGS = @GCCWARN@ + +-AM_CPPFLAGS = -I../libdiod ++AM_CPPFLAGS = -I$(srcdir)/../libdiod + + noinst_LIBRARIES = liblsd.a + +diff --git a/libnpclient/Makefile.am b/libnpclient/Makefile.am +index 5305df9..cbaf266 100644 +--- a/libnpclient/Makefile.am ++++ b/libnpclient/Makefile.am +@@ -1,7 +1,7 @@ + AM_CFLAGS = @GCCWARN@ + + AM_CPPFLAGS = \ +- -I../libnpfs ++ -I$(srcdir)/../libnpfs + + noinst_LIBRARIES = libnpclient.a + +diff --git a/scripts/Makefile.am b/scripts/Makefile.am +index 51c24a3..2aba728 100644 +--- a/scripts/Makefile.am ++++ b/scripts/Makefile.am +@@ -1,9 +1,9 @@ +-systemddir=$(sysconfdir)/systemd/system ++systemddir=/lib/systemd/system + + install-data-local: +- $(top_srcdir)/config/install-sh -m 755 $(srcdir)/auto.diod \ ++ $(top_srcdir)/config/install-sh -m 755 ./auto.diod \ + $(DESTDIR)$(sysconfdir)/auto.diod +- $(top_srcdir)/config/install-sh -m 755 $(srcdir)/diod.service \ ++ $(top_srcdir)/config/install-sh -m 644 ./diod.service \ + $(DESTDIR)$(systemddir)/diod.service + + uninstall-local: +diff --git a/tests/kern/dbench/Makefile.am b/tests/kern/dbench/Makefile.am +index e0cdefa..1704f9f 100644 +--- a/tests/kern/dbench/Makefile.am ++++ b/tests/kern/dbench/Makefile.am +@@ -2,7 +2,7 @@ AM_CFLAGS = -w + + # VERSION=4.00 + +-AM_CPPFLAGS = -DDATADIR=\"$(X_DATADIR)\" ++AM_CPPFLAGS = -I. -DDATADIR=\"$(X_DATADIR)\" + + LDADD = $(LIBPOPT) + +@@ -25,6 +25,6 @@ BUILT_SOURCES = proto.h + CLEANFILES = proto.h + + proto.h: $(dbench_SOURCES) mkproto.pl +- perl mkproto.pl $(dbench_SOURCES) > proto.h ++ $(srcdir)/mkproto.pl $(patsubst %,$(srcdir),$(dbench_SOURCES)) > proto.h + + EXTRA_DIST = mkproto.pl +diff --git a/utils/Makefile.am b/utils/Makefile.am +index 169b6c4..91d571d 100644 +--- a/utils/Makefile.am ++++ b/utils/Makefile.am +@@ -1,7 +1,7 @@ + AM_CFLAGS = @GCCWARN@ + + AM_CPPFLAGS = \ +- -I../libnpfs -I../liblsd -I../libdiod -I../libnpclient ++ -I$(srcdir)/../libnpfs -I$(srcdir)/../liblsd -I$(srcdir)/../libdiod -I$(srcdir)/../libnpclient + + sbin_PROGRAMS = diodmount diodcat dtop diodload diodls diodshowmount dioddate + +-- +2.11.0 + diff --git a/external/meta-virtualization/recipes-extended/diod/files/0001-diod-ops.c-add-header-file-for-makedev.patch b/external/meta-virtualization/recipes-extended/diod/files/0001-diod-ops.c-add-header-file-for-makedev.patch new file mode 100644 index 00000000..e6f7ece2 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/diod/files/0001-diod-ops.c-add-header-file-for-makedev.patch @@ -0,0 +1,40 @@ +From f75836731d6051d85e6317eb4c12465bafb4973e Mon Sep 17 00:00:00 2001 +From: "Hongzhi.Song" <hongzhi.song@windriver.com> +Date: Fri, 31 Aug 2018 05:47:02 -0400 +Subject: [PATCH] diod/ops.c: add header file for makedev + +Error: +diod/ops.c:845: undefined reference to `makedev' + +Fixed: +Glibc removes sys/sysmacros.h which defines makedev from sys/types.h +since v2.28. [Commit ID: e16deca62e16f] + +And then glibc suggestions us to include <sys/sysmacros.h> directly if +code needs it. + +Upstream-Status: Submitted +[diod: +mail: v9fs-developer@lists.sourceforge.net +author: hongzhi.song@windriver.com] + +Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com> +--- + diod/ops.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/diod/ops.c b/diod/ops.c +index c6c8291..469a502 100644 +--- a/diod/ops.c ++++ b/diod/ops.c +@@ -74,6 +74,7 @@ + #include <pthread.h> + #include <errno.h> + #include <sys/types.h> ++#include <sys/sysmacros.h> + + #ifdef __FreeBSD__ + #if !__BSD_VISIBLE +-- +2.8.1 + diff --git a/external/meta-virtualization/recipes-extended/diod/files/0002-auto.diod.in-remove-bashisms.patch b/external/meta-virtualization/recipes-extended/diod/files/0002-auto.diod.in-remove-bashisms.patch new file mode 100644 index 00000000..65d6ff6b --- /dev/null +++ b/external/meta-virtualization/recipes-extended/diod/files/0002-auto.diod.in-remove-bashisms.patch @@ -0,0 +1,47 @@ +From 5a9e09dc5de833db11607530351cd87cecbfd17e Mon Sep 17 00:00:00 2001 +From: Roy Li <rongqing.li@windriver.com> +Date: Thu, 22 Jun 2017 06:32:30 +0000 +Subject: [PATCH 2/2] auto.diod.in: remove bashisms + +Upstream-Status: Pending + +Signed-off-by: Roy Li <rongqing.li@windriver.com> +--- + scripts/auto.diod.in | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/scripts/auto.diod.in b/scripts/auto.diod.in +index f63e004..4d5fc3a 100755 +--- a/scripts/auto.diod.in ++++ b/scripts/auto.diod.in +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # + # auto.diod - executable automounter map for diod file systems + # +@@ -41,15 +41,15 @@ dcatopts="${DIOD_TIMEOUT:+-t $DIOD_TIMEOUT}" + for server in $DIOD_SERVERS; do + $DIOD_DIODCAT -s $server $dcatopts exports | awk '{print $1}' |\ + while read path; do +- if [ "$path" == "/" ]; then +- if [ "$key" == "ROOT" ]; then ++ if [ "$path" = "/" ]; then ++ if [ "$key" = "ROOT" ]; then + echo "$prefix $server:$path" + exit 0 + fi +- elif [ "$key" == "$(echo $path|sed -e's/^\///' -e's/\//./g')" ] \ +- || [ "$key" == "$(echo $path|sed -e's/^\///' -e's/\//_/g')" ] \ +- || [ "$key" == "$(echo $path|sed -e's/^\///' -e's/\//-/g')" ] \ +- || [ "$key" == "$(basename $path)" ]; then ++ elif [ "$key" = "$(echo $path|sed -e's/^\///' -e's/\//./g')" ] \ ++ || [ "$key" = "$(echo $path|sed -e's/^\///' -e's/\//_/g')" ] \ ++ || [ "$key" = "$(echo $path|sed -e's/^\///' -e's/\//-/g')" ] \ ++ || [ "$key" = "$(basename $path)" ]; then + echo "$prefix $server:$path" + exit 0 + fi +-- +2.11.0 + diff --git a/external/meta-virtualization/recipes-extended/diod/files/diod b/external/meta-virtualization/recipes-extended/diod/files/diod new file mode 100644 index 00000000..cd0bf987 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/diod/files/diod @@ -0,0 +1,75 @@ +#!/bin/sh +# +# chkconfig: 35 20 80 +# description: Distributed Input Output Daemon +# + +# Get function from functions library +. /etc/init.d/functions + +BASE=diod +PIDFILE=/var/run/$BASE.pid +PID=`test -f $PIDFILE && cat $PIDFILE` +DIOD_BIN=/usr/sbin/$BASE +DIOD_CONF=/etc/$BASE.conf +DIOD_OPTS="-c $DIOD_CONF" +DIOD="$DIOD_BIN $DIOD_OPTS" +RETVAL=0 + +# Start the service $BASE +start() +{ + # Force creation of the log directory even on a tmpfs /var/log. + mkdir -p /var/log/diod + + start-stop-daemon --stop --test --quiet --pidfile $PIDFILE + status=$? + if [ $status -eq 0 ]; then + echo "diod service is already running with pid $PID" + exit 1 + else + echo -n "Starting $BASE:" + start-stop-daemon --start --pidfile $PIDFILE \ + --exec $DIOD_BIN -- $DIOD_OPTS + RETVAL=$? + echo + [ $RETVAL -ne 0 ] && exit $RETVAL + fi +} + +# Stop the service $BASE +stop() +{ + echo -n "Stopping $BASE:" + start-stop-daemon --stop --test --quiet --pidfile $PIDFILE + status=$? + if [ $status -eq 0 ]; then + start-stop-daemon --stop --quiet --pidfile $PIDFILE + [ -w $PIDFILE ] && rm -f $PIDFILE + else + start-stop-daemon --stop --quiet --name $BASE + fi +} + + +### service arguments ### +case $1 in + start) + start + ;; + stop) + stop + ;; + status) + status $BASE + ;; + restart | force-reload) + $0 stop + $0 start + ;; + *) + echo "Usage: $0 {start|stop|status|restart}." + exit 1 +esac + +exit 0 diff --git a/external/meta-virtualization/recipes-extended/diod/files/diod.conf b/external/meta-virtualization/recipes-extended/diod/files/diod.conf new file mode 100644 index 00000000..e97743a0 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/diod/files/diod.conf @@ -0,0 +1,15 @@ +-- +-- /etc/diod.conf - config file for diod distributed I/O daemon +-- +-- NOTE: This config file is a lua script that diod runs, then extracts +-- the value of certain globally defined variables. See diod.conf(5). + +listen = { "0.0.0.0:564" } +nwthreads = 16 +auth_required = 1 +logdest = "syslog:daemon:err" + +exports = { "/g/g0", "/g/g10" } + +allsquash = 0 +squashuser = "nobody" diff --git a/external/meta-virtualization/recipes-extended/hyperstart/hyperstart/0001-container.c-Fix-compiler-errors-that-gcc-8.1.0-repor.patch b/external/meta-virtualization/recipes-extended/hyperstart/hyperstart/0001-container.c-Fix-compiler-errors-that-gcc-8.1.0-repor.patch new file mode 100644 index 00000000..4a01de5b --- /dev/null +++ b/external/meta-virtualization/recipes-extended/hyperstart/hyperstart/0001-container.c-Fix-compiler-errors-that-gcc-8.1.0-repor.patch @@ -0,0 +1,230 @@ +From 11f5089300c1c368d896c95890827dc85a67f132 Mon Sep 17 00:00:00 2001 +From: Jason Wessel <jason.wessel@windriver.com> +Date: Fri, 15 Jun 2018 08:04:35 -0700 +Subject: [PATCH] container.c: Fix compiler errors that gcc 8.1.0 reports + +gcc 8.1.0 reports the following compiler errors/warnings. They can be +fixed by using snprintf and checking the result for truncation. This +patch also uses a named constant instead of inserting the value 512 in +many locations. + +container.c: In function 'hyper_setup_container_rootfs': +container.c:630:24: error: '/' directive writing 1 byte into a region of size between 0 and 511 [-Werror=format-overflow=] + sprintf(rootfs, "%s/%s/", root, container->rootfs); + ^ +container.c:630:2: note: 'sprintf' output 3 or more bytes (assuming 514) into a destination of size 512 + sprintf(rootfs, "%s/%s/", root, container->rootfs); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +container.c:262:18: error: '%s' directive writing up to 511 bytes into a region of size 510 [-Werror=format-overflow=] + sprintf(dst, "./%s", src); + ^~ ~~~ +container.c:262:2: note: 'sprintf' output between 3 and 514 bytes into a destination of size 512 + sprintf(dst, "./%s", src); + ^~~~~~~~~~~~~~~~~~~~~~~~~ +container.c:218:24: error: '/_data' directive writing 6 bytes into a region of size between 1 and 512 [-Werror=format-overflow=] + sprintf(volume, "%s/_data", path); + ^~~~~~ +container.c:218:5: note: 'sprintf' output between 7 and 518 bytes into a destination of size 512 + sprintf(volume, "%s/_data", path); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +container.c:149:24: error: '/_data' directive writing 6 bytes into a region of size between 0 and 511 [-Werror=format-overflow=] + sprintf(volume, "/%s/_data", path); + ^~~~~~ +container.c:149:4: note: 'sprintf' output between 8 and 519 bytes into a destination of size 512 + sprintf(volume, "/%s/_data", path); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +container.c:131:24: error: '/' directive writing 1 byte into a region of size between 0 and 511 [-Werror=format-overflow=] + sprintf(volume, "/%s/", path); + ^ +container.c:131:4: note: 'sprintf' output between 3 and 514 bytes into a destination of size 512 + sprintf(volume, "/%s/", path); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +container.c:176:24: error: '/_data/' directive writing 7 bytes into a region of size between 0 and 511 [-Werror=format-overflow=] + sprintf(volume, "/%s/_data/%s", path, filevolume); + ^~~~~~~ +container.c:176:4: note: 'sprintf' output 9 or more bytes (assuming 520) into a destination of size 512 + sprintf(volume, "/%s/_data/%s", path, filevolume); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Signed-off-by: Jason Wessel <jason.wessel@windriver.com> +--- + src/container.c | 47 ++++++++++++++++++++++++++++------------------- + 1 file changed, 28 insertions(+), 19 deletions(-) + +diff --git a/src/container.c b/src/container.c +index 0938d82..b1c52d4 100644 +--- a/src/container.c ++++ b/src/container.c +@@ -22,6 +22,8 @@ + #include "syscall.h" + #include "netlink.h" + ++#define MAX_PBUF 512 ++ + static int container_populate_volume(char *src, char *dest) + { + struct stat st; +@@ -99,12 +101,12 @@ static int container_setup_volume(struct hyper_pod *pod, + struct hyper_container *container) + { + int i; +- char dev[512], path[512]; ++ char dev[MAX_PBUF], path[MAX_PBUF]; + struct volume *vol; + + for (i = 0; i < container->vols_num; i++) { +- char volume[512]; +- char mountpoint[512]; ++ char volume[MAX_PBUF]; ++ char mountpoint[MAX_PBUF]; + char *options = NULL; + const char *filevolume = NULL; + vol = &container->vols[i]; +@@ -128,7 +130,8 @@ static int container_setup_volume(struct hyper_pod *pod, + if (hyper_mount_nfs(vol->device, path) < 0) + return -1; + /* nfs export has implicitly included _data part of the volume */ +- sprintf(volume, "/%s/", path); ++ if (snprintf(volume, MAX_PBUF, "/%s/", path) >= MAX_PBUF) ++ return -1; + } else { + fprintf(stdout, "mount %s to %s, tmp path %s\n", + dev, vol->mountpoint, path); +@@ -137,7 +140,7 @@ static int container_setup_volume(struct hyper_pod *pod, + options = "nouuid"; + + if (access(dev, R_OK) < 0) { +- char device[512]; ++ char device[MAX_PBUF]; + sprintf(device, "/block/%s", vol->device); + hyper_netlink_wait_dev(pod->ueventfd, device); + } +@@ -146,7 +149,8 @@ static int container_setup_volume(struct hyper_pod *pod, + perror("mount volume device failed"); + return -1; + } +- sprintf(volume, "/%s/_data", path); ++ if (snprintf(volume, MAX_PBUF, "/%s/_data", path) >= MAX_PBUF) ++ return -1; + } + + if (container_check_file_volume(volume, &filevolume) < 0) +@@ -173,7 +177,8 @@ static int container_setup_volume(struct hyper_pod *pod, + perror("create volume file failed"); + return -1; + } +- sprintf(volume, "/%s/_data/%s", path, filevolume); ++ if (snprintf(volume, MAX_PBUF, "/%s/_data/%s", path, filevolume) >= MAX_PBUF) ++ return -1; + /* 0777 so that any user can read/write the new file volume */ + if (chmod(volume, 0777) < 0) { + fprintf(stderr, "fail to chmod directory %s\n", volume); +@@ -197,9 +202,9 @@ static int container_setup_volume(struct hyper_pod *pod, + + for (i = 0; i < container->maps_num; i++) { + struct stat st; +- char *src, path[512], volume[512]; ++ char *src, path[MAX_PBUF], volume[MAX_PBUF]; + struct fsmap *map = &container->maps[i]; +- char mountpoint[512]; ++ char mountpoint[MAX_PBUF]; + + sprintf(path, "%s/%s", SHARED_DIR, map->source); + sprintf(mountpoint, "./%s", map->path); +@@ -215,7 +220,8 @@ static int container_setup_volume(struct hyper_pod *pod, + } + if (map->docker) { + /* converted from volume */ +- sprintf(volume, "%s/_data", path); ++ if (snprintf(volume, MAX_PBUF, "%s/_data", path) >= MAX_PBUF) ++ return -1; + src = volume; + if (container->initialize && + (container_populate_volume(mountpoint, volume) < 0)) { +@@ -251,7 +257,7 @@ static int container_setup_modules(struct hyper_container *container) + { + struct stat st; + struct utsname uts; +- char src[512], dst[512]; ++ char src[MAX_PBUF], dst[MAX_PBUF]; + + if (uname(&uts) < 0) { + perror("fail to call uname"); +@@ -259,7 +265,8 @@ static int container_setup_modules(struct hyper_container *container) + } + + sprintf(src, "/lib/modules/%s", uts.release); +- sprintf(dst, "./%s", src); ++ if (snprintf(dst, MAX_PBUF, "./%s", src) >= MAX_PBUF) ++ return -1; + + if (stat(dst, &st) == 0) { + struct dirent **list; +@@ -291,7 +298,7 @@ static int container_setup_modules(struct hyper_container *container) + + static int container_setup_mount(struct hyper_container *container) + { +- char src[512]; ++ char src[MAX_PBUF]; + + // current dir is container rootfs, the operations on "./PATH" are the operations on container's "/PATH" + if (!container->readonly) { +@@ -546,7 +553,7 @@ static int hyper_setup_container_rootfs(void *data) + { + struct hyper_container_arg *arg = data; + struct hyper_container *container = arg->c; +- char root[512], rootfs[512]; ++ char root[MAX_PBUF], rootfs[MAX_PBUF]; + int setup_dns; + + /* wait for ns-opened ready message */ +@@ -609,7 +616,7 @@ static int hyper_setup_container_rootfs(void *data) + goto fail; + } + } else { +- char path[512]; ++ char path[MAX_PBUF]; + + sprintf(path, "%s/%s/", SHARED_DIR, container->image); + fprintf(stdout, "src directory %s\n", path); +@@ -627,7 +634,9 @@ static int hyper_setup_container_rootfs(void *data) + fprintf(stdout, "root directory for container is %s/%s, init task %s\n", + root, container->rootfs, container->exec.argv[0]); + +- sprintf(rootfs, "%s/%s/", root, container->rootfs); ++ if (snprintf(rootfs, MAX_PBUF, "%s/%s/", root, container->rootfs) >= MAX_PBUF) ++ goto fail; ++ + if (mount(rootfs, rootfs, NULL, MS_BIND|MS_REC, NULL) < 0) { + perror("failed to bind rootfs"); + goto fail; +@@ -710,7 +719,7 @@ fail: + + static int hyper_setup_pty(struct hyper_container *c) + { +- char root[512]; ++ char root[MAX_PBUF]; + + sprintf(root, "/tmp/hyper/%s/devpts/", c->id); + +@@ -730,7 +739,7 @@ static int hyper_setup_pty(struct hyper_container *c) + + static void hyper_cleanup_pty(struct hyper_container *c) + { +- char path[512]; ++ char path[MAX_PBUF]; + + sprintf(path, "/tmp/hyper/%s/devpts/", c->id); + if (umount(path) < 0) +@@ -739,7 +748,7 @@ static void hyper_cleanup_pty(struct hyper_container *c) + + int container_prepare_rootfs_dev(struct hyper_container *container, struct hyper_pod *pod) + { +- char dev[512]; ++ char dev[MAX_PBUF]; + + if (container->fstype == NULL) + return 0; +-- +2.17.1 + diff --git a/external/meta-virtualization/recipes-extended/hyperstart/hyperstart_git.bb b/external/meta-virtualization/recipes-extended/hyperstart/hyperstart_git.bb new file mode 100644 index 00000000..3c64f24e --- /dev/null +++ b/external/meta-virtualization/recipes-extended/hyperstart/hyperstart_git.bb @@ -0,0 +1,26 @@ +SUMMARY = "The tiny Init service for HyperContainer" +DESCRIPTION = "The init Task for HyperContainer" + +LICENSE = "Apache-2" +LIC_FILES_CHKSUM = "file://LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464fc" + +inherit autotools-brokensep + +SRC_URI = "git://github.com/hyperhq/hyperstart.git" +SRC_URI += "file://0001-container.c-Fix-compiler-errors-that-gcc-8.1.0-repor.patch" + +SRCREV = "15bb718ad34045aa1962a8204f602c6afe9a76ab" +PV = "v0.2+git${SRCREV}" + +S = "${WORKDIR}/git" + +CACHED_CONFIGUREVARS = "ac_cv_file__usr_include_linux_vm_sockets_h=true" + +do_install() { + install -d ${D}/var/lib/hyper/ + + install -m644 ${S}/build/hyper-initrd.img ${D}/var/lib/hyper/ + install -m644 ${S}/build/arch/x86_64/kernel ${D}/var/lib/hyper/ +} + +FILES_${PN} += "/var/lib/hyper" diff --git a/external/meta-virtualization/recipes-extended/images/cloud-image-compute.bb b/external/meta-virtualization/recipes-extended/images/cloud-image-compute.bb new file mode 100644 index 00000000..197624f9 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/images/cloud-image-compute.bb @@ -0,0 +1,14 @@ +IMAGE_FEATURES += "ssh-server-openssh" +EXTRA_IMAGE_FEATURES = "tools-debug debug-tweaks" + +IMAGE_INSTALL = "\ + ${CORE_IMAGE_BASE_INSTALL} \ + packagegroup-core-basic \ + openvswitch \ + libvirt \ + openflow \ + " + +inherit core-image + +IMAGE_FSTYPES = "tar.gz" diff --git a/external/meta-virtualization/recipes-extended/images/cloud-image-controller.bb b/external/meta-virtualization/recipes-extended/images/cloud-image-controller.bb new file mode 100644 index 00000000..c816545f --- /dev/null +++ b/external/meta-virtualization/recipes-extended/images/cloud-image-controller.bb @@ -0,0 +1,32 @@ +IMAGE_FEATURES += "ssh-server-openssh package-management" +EXTRA_IMAGE_FEATURES = "tools-debug debug-tweaks" + +IMAGE_INSTALL = "\ + ${CORE_IMAGE_BASE_INSTALL} \ + packagegroup-core-basic \ + openvswitch \ + openvswitch-controller \ + openvswitch-switch \ + openvswitch-brcompat \ + criu \ + libvirt \ + libvirt-libvirtd \ + libvirt-python \ + libvirt-virsh \ + openflow \ + qemu \ + kernel-modules \ + dhcp-client \ + perl-modules \ + grub \ + mysql5 \ + python-twisted \ + python-lxml \ + " + +inherit core-image + +IMAGE_FSTYPES = "wic.vmdk tar.gz" + +# Ensure extra space for guest images +#IMAGE_ROOTFS_EXTRA_SPACE = "41943040" diff --git a/external/meta-virtualization/recipes-extended/images/cloud-image-guest.bb b/external/meta-virtualization/recipes-extended/images/cloud-image-guest.bb new file mode 100644 index 00000000..2957506d --- /dev/null +++ b/external/meta-virtualization/recipes-extended/images/cloud-image-guest.bb @@ -0,0 +1,16 @@ +IMAGE_FEATURES += "ssh-server-openssh package-management" +EXTRA_IMAGE_FEATURES = "tools-debug debug-tweaks" + +IMAGE_INSTALL = "\ + ${CORE_IMAGE_BASE_INSTALL} \ + packagegroup-core-basic \ + openflow \ + qemu \ + kernel-modules \ + tcpdump \ + dhcp-client \ + " + +inherit core-image + +IMAGE_FSTYPES += "wic.vmdk" diff --git a/external/meta-virtualization/recipes-extended/images/kvm-image-minimal.bb b/external/meta-virtualization/recipes-extended/images/kvm-image-minimal.bb new file mode 100644 index 00000000..b28cc309 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/images/kvm-image-minimal.bb @@ -0,0 +1,22 @@ +DESCRIPTION = "A minimal kvm image" + +IMAGE_INSTALL = " \ + packagegroup-core-boot \ + qemu \ + libvirt \ + libvirt-libvirtd \ + libvirt-virsh \ + kernel-module-kvm \ + kernel-module-kvm-intel \ + kernel-module-kvm-amd \ + " + +IMAGE_FEATURES += "ssh-server-openssh" + +IMAGE_LINGUAS = " " + +LICENSE = "MIT" + +inherit core-image + +IMAGE_ROOTFS_SIZE = "8192" diff --git a/external/meta-virtualization/recipes-extended/images/xen-guest-image-minimal.bb b/external/meta-virtualization/recipes-extended/images/xen-guest-image-minimal.bb new file mode 100644 index 00000000..d311eaef --- /dev/null +++ b/external/meta-virtualization/recipes-extended/images/xen-guest-image-minimal.bb @@ -0,0 +1,21 @@ +DESCRIPTION = "A Xen guest image." + +inherit core-image distro_features_check + +IMAGE_INSTALL += " \ + packagegroup-core-boot \ + ${@bb.utils.contains('MACHINE_FEATURES', 'acpi', 'kernel-module-xen-acpi-processor', '', d)} \ + " + +IMAGE_INSTALL += "${@bb.utils.contains('IMAGE_FEATURES', 'x11', ' xf86-video-fbdev', '', d)}" + +# Install xf86-video-vesa on x86 platforms. +IMAGE_INSTALL_append_x86-64 = "${@bb.utils.contains('IMAGE_FEATURES', 'x11', ' xf86-video-vesa', '', d)}" +IMAGE_INSTALL_append_x86 = "${@bb.utils.contains('IMAGE_FEATURES', 'x11', ' xf86-video-vesa', '', d)}" + +REQUIRED_DISTRO_FEATURES += "${@bb.utils.contains('IMAGE_FEATURES', 'x11', ' x11', '', d)} xen" + +LICENSE = "MIT" + +# Send console messages to xen console +APPEND += "console=hvc0" diff --git a/external/meta-virtualization/recipes-extended/images/xen-image-minimal.bb b/external/meta-virtualization/recipes-extended/images/xen-image-minimal.bb new file mode 100644 index 00000000..c39d3782 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/images/xen-image-minimal.bb @@ -0,0 +1,66 @@ +DESCRIPTION = "A minimal xen image" + +INITRD_IMAGE = "core-image-minimal-initramfs" + +IMAGE_INSTALL += " \ + packagegroup-core-boot \ + packagegroup-core-ssh-openssh \ + ${@bb.utils.contains('MACHINE_FEATURES', 'acpi', 'kernel-module-xen-acpi-processor', '', d)} \ + kernel-module-xen-blkback \ + kernel-module-xen-gntalloc \ + kernel-module-xen-gntdev \ + kernel-module-xen-netback \ + ${@bb.utils.contains('MACHINE_FEATURES', 'pci', "${XEN_PCIBACK_MODULE}", '', d)} \ + kernel-module-xen-wdt \ + xen-base \ + qemu \ + " + +# Linux kernel option CONFIG_XEN_PCIDEV_BACKEND depends on X86 +XEN_PCIBACK_MODULE = "" +XEN_PCIBACK_MODULE_x86 = "kernel-module-xen-pciback" +XEN_PCIBACK_MODULE_x86-64 = "kernel-module-xen-pciback" + +LICENSE = "MIT" + +inherit core-image + +do_check_xen_state() { + if [ "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' yes', 'no', d)}" = "no" ]; then + die "DISTRO_FEATURES does not contain 'xen'" + fi +} + +addtask check_xen_state before do_rootfs + +syslinux_iso_populate_append() { + install -m 0444 ${STAGING_DATADIR}/syslinux/libcom32.c32 ${ISODIR}${ISOLINUXDIR} + install -m 0444 ${STAGING_DATADIR}/syslinux/mboot.c32 ${ISODIR}${ISOLINUXDIR} +} + +syslinux_hddimg_populate_append() { + install -m 0444 ${STAGING_DATADIR}/syslinux/libcom32.c32 ${HDDDIR}${SYSLINUXDIR} + install -m 0444 ${STAGING_DATADIR}/syslinux/mboot.c32 ${HDDDIR}${SYSLINUXDIR} +} + +grubefi_populate_append() { + install -m 0644 ${DEPLOY_DIR_IMAGE}/xen-${MACHINE}.gz ${DEST}${EFIDIR}/xen.gz +} + +syslinux_populate_append() { + install -m 0644 ${DEPLOY_DIR_IMAGE}/xen-${MACHINE}.gz ${DEST}/xen.gz +} + +SYSLINUX_XEN_ARGS ?= "loglvl=all guest_loglvl=all console=com1,vga com1=115200,8n1" +SYSLINUX_KERNEL_ARGS ?= "ramdisk_size=32768 root=/dev/ram0 rw console=hvc0 earlyprintk=xen console=tty0 panic=10 LABEL=boot debugshell=5" + +build_syslinux_cfg () { + echo "ALLOWOPTIONS 1" > ${SYSLINUX_CFG} + echo "DEFAULT boot" >> ${SYSLINUX_CFG} + echo "TIMEOUT 10" >> ${SYSLINUX_CFG} + echo "PROMPT 1" >> ${SYSLINUX_CFG} + echo "LABEL boot" >> ${SYSLINUX_CFG} + echo " KERNEL mboot.c32" >> ${SYSLINUX_CFG} + echo " APPEND /xen.gz ${SYSLINUX_XEN_ARGS} --- /vmlinuz ${SYSLINUX_KERNEL_ARGS} --- /initrd" >> ${SYSLINUX_CFG} +} + diff --git a/external/meta-virtualization/recipes-extended/iptables/iptables-meta-virtualization.inc b/external/meta-virtualization/recipes-extended/iptables/iptables-meta-virtualization.inc new file mode 100644 index 00000000..8fd521c9 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/iptables/iptables-meta-virtualization.inc @@ -0,0 +1,19 @@ +RRECOMMENDS_${PN} += "kernel-module-ip6-tables \ + kernel-module-ip-tables \ + kernel-module-ip6table-filter \ + kernel-module-iptable-filter \ + kernel-module-ip6table-raw \ + kernel-module-iptable-raw \ + kernel-module-ip6table-nat \ + kernel-module-iptable-nat \ + kernel-module-ip6table-mangle \ + kernel-module-iptable-magle \ + kernel-module-ip6table-security \ + kernel-module-iptable-security \ + kernel-module-ipt-reject \ + kernel-module-iptable-mangle \ + kernel-module-xt-checksum \ + kernel-module-xt-conntrack \ + kernel-module-xt-state \ + kernel-module-xt-tcpudp \ + " diff --git a/external/meta-virtualization/recipes-extended/iptables/iptables_1.%.bbappend b/external/meta-virtualization/recipes-extended/iptables/iptables_1.%.bbappend new file mode 100644 index 00000000..9a15e60c --- /dev/null +++ b/external/meta-virtualization/recipes-extended/iptables/iptables_1.%.bbappend @@ -0,0 +1 @@ +require ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', '${BPN}-meta-virtualization.inc', '', d)} diff --git a/external/meta-virtualization/recipes-extended/ipxe/files/ipxe-fix-hostcc-nopie-cflags.patch b/external/meta-virtualization/recipes-extended/ipxe/files/ipxe-fix-hostcc-nopie-cflags.patch new file mode 100644 index 00000000..da154a6f --- /dev/null +++ b/external/meta-virtualization/recipes-extended/ipxe/files/ipxe-fix-hostcc-nopie-cflags.patch @@ -0,0 +1,68 @@ +Fix detection of host compiler "no-pie"/"nopie" and link flags. + +Detection of the "no-pie" vs "nopie" flag needs to be performed for both +the host and target compilers; cannot assume that one works for the other. + +Use EXTRA_HOST_CFLAGS and EXTRA_HOST_LDFLAGS variables for passing +host tool parameters if required. Removes previous hardcoded "-O2 -g". + +Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com> +diff --git a/Makefile.housekeeping b/Makefile.housekeeping +index f833492..5451c39 100644 +--- a/Makefile.housekeeping ++++ b/Makefile.housekeeping +@@ -133,6 +133,7 @@ eval : + WORKAROUND_CFLAGS := + WORKAROUND_ASFLAGS := + WORKAROUND_LDFLAGS := ++WORKAROUND_HOST_CFLAGS := + + # Make syntax does not allow use of comma or space in certain places. + # This ugly workaround is suggested in the manual. +@@ -445,7 +446,7 @@ endif + CFLAGS += $(WORKAROUND_CFLAGS) $(EXTRA_CFLAGS) + ASFLAGS += $(WORKAROUND_ASFLAGS) $(EXTRA_ASFLAGS) + LDFLAGS += $(WORKAROUND_LDFLAGS) $(EXTRA_LDFLAGS) +-HOST_CFLAGS += $(WORKAROUND_CFLAGS) -O2 -g ++HOST_CFLAGS += $(WORKAROUND_HOST_CFLAGS) $(EXTRA_HOST_CFLAGS) + + # Inhibit -Werror if NO_WERROR is specified on make command line + # +@@ -1375,7 +1376,7 @@ endif # defined(BIN) + # The compression utilities + # + +-ZBIN_LDFLAGS := -llzma ++ZBIN_LDFLAGS := -llzma $(EXTRA_HOST_LDFLAGS) + + $(ZBIN) : util/zbin.c $(MAKEDEPS) + $(QM)$(ECHO) " [HOSTCC] $@" +diff --git a/arch/i386/Makefile b/arch/i386/Makefile +index b7c2792..4a637ad 100644 +--- a/arch/i386/Makefile ++++ b/arch/i386/Makefile +@@ -78,11 +78,20 @@ CFLAGS += -Ui386 + # -nopie. We therefore test for both. + # + ifeq ($(CCTYPE),gcc) +-PIE_TEST = [ -z "`$(CC) -fno-PIE -no-pie -x c -c /dev/null -o /dev/null 2>&1`" ] +-PIE_FLAGS := $(shell $(PIE_TEST) && $(ECHO) '-fno-PIE -no-pie') +-PIE_TEST2 = [ -z "`$(CC) -fno-PIE -nopie -x c -c /dev/null -o /dev/null 2>&1`" ] ++PIE_TEST1_FLAGS = "-fno-PIE -no-pie -x c -c /dev/null -o /dev/null 2>&1" ++PIE_TEST2_FLAGS = "-fno-PIE -nopie -x c -c /dev/null -o /dev/null 2>&1" ++ ++PIE_TEST1 = [ -z "`$(CC) "$(PIE_TEST1_FLAGS)"`" ] ++PIE_TEST2 = [ -z "`$(CC) "$(PIE_TEST2_FLAGS)"`" ] ++PIE_FLAGS1 := $(shell $(PIE_TEST1) && $(ECHO) '-fno-PIE -no-pie') + PIE_FLAGS2 := $(shell $(PIE_TEST2) && $(ECHO) '-fno-PIE -nopie') +-WORKAROUND_CFLAGS += $(PIE_FLAGS) $(PIE_FLAGS2) ++WORKAROUND_CFLAGS += $(PIE_FLAGS1) $(PIE_FLAGS2) ++ ++HOST_PIE_TEST1 = [ -z "`$(HOSTCC) "$(PIE_TEST1_FLAGS)"`" ] ++HOST_PIE_TEST2 = [ -z "`$(HOSTCC) "$(PIE_TEST2_FLAGS)"`" ] ++HOST_PIE_FLAGS1 := $(shell $(HOST_PIE_TEST1) && $(ECHO) '-fno-PIE -no-pie') ++HOST_PIE_FLAGS2 := $(shell $(HOST_PIE_TEST2) && $(ECHO) '-fno-PIE -nopie') ++WORKAROUND_HOST_CFLAGS += $(HOST_PIE_FLAGS1) $(HOST_PIE_FLAGS2) + endif + + # i386-specific directories containing source files diff --git a/external/meta-virtualization/recipes-extended/ipxe/ipxe_git.bb b/external/meta-virtualization/recipes-extended/ipxe/ipxe_git.bb new file mode 100644 index 00000000..1de0f21e --- /dev/null +++ b/external/meta-virtualization/recipes-extended/ipxe/ipxe_git.bb @@ -0,0 +1,35 @@ +DESCRIPTION = "Open source network boot firmware" +HOMEPAGE = "http://ipxe.org" +LICENSE = "GPLv2" +DEPENDS = "binutils-native perl-native syslinux mtools-native cdrtools-native xz" +LIC_FILES_CHKSUM = "file://../COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +SRCREV = "64b4452bca04af433f1c98ab782c0e93cd5c88c0" +PV = "gitr${SRCPV}" +PR = "r0" + +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +SRC_URI = " \ + git://git.ipxe.org/ipxe.git;protocol=https \ + file://ipxe-fix-hostcc-nopie-cflags.patch \ + " + +FILES_${PN} = "/usr/share/firmware/*.rom" + +EXTRA_OEMAKE = " \ + ISOLINUX_BIN="${STAGING_DIR_TARGET}/usr/share/syslinux/isolinux.bin" \ + CROSS_COMPILE="${TARGET_PREFIX}" \ + EXTRA_HOST_CFLAGS="${BUILD_CFLAGS}" \ + EXTRA_HOST_LDFLAGS="${BUILD_LDFLAGS}"" + +S = "${WORKDIR}/git/src" + +do_compile() { + oe_runmake +} + +do_install() { + install -d ${D}/usr/share/firmware + install ${S}/bin/*.rom ${D}/usr/share/firmware/ +} diff --git a/external/meta-virtualization/recipes-extended/irqbalance/irqbalance.inc b/external/meta-virtualization/recipes-extended/irqbalance/irqbalance.inc new file mode 100644 index 00000000..53275d12 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/irqbalance/irqbalance.inc @@ -0,0 +1,47 @@ +# +# Copyright (C) 2013 Wind River Systems, Inc. +# +SUMMARY = "IRQ allocation daemon" +DESCRIPTION = "A daemon to balance interrupts across multiple CPUs, \ +which can lead to better performance and IO balance on SMP systems." + +HOMEPAGE = "http://code.google.com/p/irqbalance/" +BUGTRACKER = "http://code.google.com/p/irqbalance/issues/list" + +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \ + file://irqbalance.c;beginline=6;endline=8;md5=b94e153694672307b503b1bc87dc9e24 \ + " + +DEPENDS = "glib-2.0" + +INITSCRIPT_NAME = "irqbalanced" +INITSCRIPT_PARAMS = "defaults" + +inherit autotools update-rc.d pkgconfig systemd + +SYSTEMD_PACKAGES = "irqbalance" +SYSTEMD_SERVICE_irqbalance = "irqbalanced.service" + +EXTRA_OECONF = "--program-transform-name= \ + " + +# let the recipes or appends define options +# +PACKAGECONFIG ?= "" + +# enable,disable,depends,rdepends +# +PACKAGECONFIG[numa] = "--enable-numa,--disable-numa,numactl," +PACKAGECONFIG[libcap-ng] = "--with-libcap-ng,--without-libcap-ng,libcap-ng," + +do_install () { + oe_runmake 'DESTDIR=${D}' install + install -d ${D}${sysconfdir}/init.d + cat ${S}/irqbalance.init | sed -e's,/usr/sbin,${sbindir},g' > ${D}${sysconfdir}/init.d/irqbalanced + chmod 755 ${D}${sysconfdir}/init.d/irqbalanced + + install -d ${D}${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/irqbalanced.service ${D}${systemd_unitdir}/system + sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/irqbalanced.service +} diff --git a/external/meta-virtualization/recipes-extended/irqbalance/irqbalance/add-initscript.patch b/external/meta-virtualization/recipes-extended/irqbalance/irqbalance/add-initscript.patch new file mode 100644 index 00000000..b0e608e6 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/irqbalance/irqbalance/add-initscript.patch @@ -0,0 +1,56 @@ +From 80c45eecc193c6c13430ddeb40b9b0fd1841ceee Mon Sep 17 00:00:00 2001 +From: Mark Asselstine <mark.asselstine@windriver.com> +Date: Thu, 14 Mar 2013 23:31:38 -0700 +Subject: [PATCH] irqbalance: add basic init script + +The upstream irqbalance release package does not contain an +init script so we create a basic one here. + +Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> + +--- + irqbalance.init | 35 +++++++++++++++++++++++++++++++++++ + 1 file changed, 35 insertions(+) + create mode 100644 irqbalance.init + +diff --git a/irqbalance.init b/irqbalance.init +new file mode 100644 +index 0000000..d12d62c +--- /dev/null ++++ b/irqbalance.init +@@ -0,0 +1,35 @@ ++#!/bin/sh ++# ++# Copyright (c) 2012 Wind River Systems, Inc. ++# ++### BEGIN INIT INFO ++# Provides: irqbalance ++# Required-Start: ++# Required-Stop: ++# Default-Start: 2 3 4 5 ++# Default-Stop: 0 1 6 ++# Short-Description: IRQ allocation daemon ++### END INIT INFO ++ ++case "$1" in ++ start) ++ echo -n "Starting irqbalance: " ++ start-stop-daemon -S -b -n irqbalance -a /usr/sbin/irqbalance ++ echo "done" ++ ;; ++ stop) ++ echo -n "Shutting down irqbalance: " ++ start-stop-daemon -K -n irqbalance ++ echo "done" ++ ;; ++ restart) ++ $0 stop ++ $0 start ++ ;; ++ *) ++ echo "Usage: $0 {start | stop | restart}" >&2 ++ exit 1 ++ ;; ++esac ++ ++exit 0 diff --git a/external/meta-virtualization/recipes-extended/irqbalance/irqbalance/fix-configure-libcap-ng.patch b/external/meta-virtualization/recipes-extended/irqbalance/irqbalance/fix-configure-libcap-ng.patch new file mode 100644 index 00000000..fb22d7a2 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/irqbalance/irqbalance/fix-configure-libcap-ng.patch @@ -0,0 +1,29 @@ +From 20a1b2ff2e6d80924824983c363c80f66e05c0d0 Mon Sep 17 00:00:00 2001 +From: Ming Liu <ming.liu@windriver.com> +Date: Sun, 6 Sep 2015 14:43:24 +0800 +Subject: [PATCH] grasp withval for libcap-ng + +Upstream-Status: Pending + +Signed-off-by: Ming Liu <ming.liu@windriver.com> + +--- + configure.ac | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 38a1bee..95f1488 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -62,7 +62,10 @@ AS_IF( + ]) + + AC_ARG_WITH([libcap-ng], +- AS_HELP_STRING([libcap-ng], [Add libcap-ng-support @<:@default=auto@:>@])) ++ [AS_HELP_STRING([libcap-ng], [Add libcap-ng-support @<:@default=auto@:>@])], ++ [libcap_ng=$withval], ++ [libcap_ng=$withval] ++) + + AS_IF( + [test "x$libcap_ng" != "xno"], diff --git a/external/meta-virtualization/recipes-extended/irqbalance/irqbalance/irqbalance-Add-status-and-reload-commands.patch b/external/meta-virtualization/recipes-extended/irqbalance/irqbalance/irqbalance-Add-status-and-reload-commands.patch new file mode 100644 index 00000000..ec01448f --- /dev/null +++ b/external/meta-virtualization/recipes-extended/irqbalance/irqbalance/irqbalance-Add-status-and-reload-commands.patch @@ -0,0 +1,53 @@ +From 9a16da2628cc4fddf37fe0368b4f6424270f0b2d Mon Sep 17 00:00:00 2001 +From: Yang Shi <yang.shi@windriver.com> +Date: Mon, 26 Aug 2013 10:58:02 -0700 +Subject: [PATCH] irqbalance: Add status and reload commands + +Add status and reload commands for irqbalanced init script + +Signed-off-by: Yang Shi <yang.shi@windriver.com> + +--- + irqbalance.init | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/irqbalance.init b/irqbalance.init +index d12d62c..f58bf55 100644 +--- a/irqbalance.init ++++ b/irqbalance.init +@@ -1,6 +1,6 @@ + #!/bin/sh + # +-# Copyright (c) 2012 Wind River Systems, Inc. ++# Copyright (c) 2013 Wind River Systems, Inc. + # + ### BEGIN INIT INFO + # Provides: irqbalance +@@ -11,6 +11,8 @@ + # Short-Description: IRQ allocation daemon + ### END INIT INFO + ++. /etc/init.d/functions ++ + case "$1" in + start) + echo -n "Starting irqbalance: " +@@ -22,12 +24,16 @@ case "$1" in + start-stop-daemon -K -n irqbalance + echo "done" + ;; +- restart) ++ restart|reload) + $0 stop + $0 start + ;; ++ status) ++ status irqbalance ++ echo "done" ++ ;; + *) +- echo "Usage: $0 {start | stop | restart}" >&2 ++ echo "Usage: $0 {start | stop | restart | reload | status}" >&2 + exit 1 + ;; + esac diff --git a/external/meta-virtualization/recipes-extended/irqbalance/irqbalance/irqbalanced.service b/external/meta-virtualization/recipes-extended/irqbalance/irqbalance/irqbalanced.service new file mode 100644 index 00000000..5b284faa --- /dev/null +++ b/external/meta-virtualization/recipes-extended/irqbalance/irqbalance/irqbalanced.service @@ -0,0 +1,9 @@ +[Unit] +Description=irqbalance daemon +After=syslog.target + +[Service] +ExecStart=@SBINDIR@/irqbalance --foreground + +[Install] +WantedBy=multi-user.target diff --git a/external/meta-virtualization/recipes-extended/irqbalance/irqbalance_1.4.0.bb b/external/meta-virtualization/recipes-extended/irqbalance/irqbalance_1.4.0.bb new file mode 100644 index 00000000..1aee7cab --- /dev/null +++ b/external/meta-virtualization/recipes-extended/irqbalance/irqbalance_1.4.0.bb @@ -0,0 +1,15 @@ +# +# Copyright (C) 2015 Wind River Systems, Inc. +# + +require irqbalance.inc + +SRC_URI[md5sum] = "26ee6db57c4509737e541e98773a39f5" +SRC_URI[sha256sum] = "62de71510a2496fcf027efb0b288dd48e53e9efc931fa573c95580cad6264d07" + +SRC_URI = "https://github.com/Irqbalance/irqbalance/archive/v${PV}.tar.gz;downloadfilename=irqbalance-${PV}.tar.gz \ + file://add-initscript.patch \ + file://irqbalance-Add-status-and-reload-commands.patch \ + file://fix-configure-libcap-ng.patch \ + file://irqbalanced.service \ + " diff --git a/external/meta-virtualization/recipes-extended/kvmtool/files/0001-Avoid-pointers-for-address-of-packed-members.patch b/external/meta-virtualization/recipes-extended/kvmtool/files/0001-Avoid-pointers-for-address-of-packed-members.patch new file mode 100644 index 00000000..863e86a8 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/kvmtool/files/0001-Avoid-pointers-for-address-of-packed-members.patch @@ -0,0 +1,39 @@ +From 2e22df7c24dadf5e16004cd832cabca76a699d4d Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 21 Mar 2017 23:32:39 -0700 +Subject: [PATCH] Avoid pointers for address of packed members + +Fixes Clang warning due to -Waddress-of-packed-member + +virtio/blk.c:161:37: error: taking address of packed member 'geometry' of class or structure 'virtio_blk_config' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member] + struct virtio_blk_geometry *geo = &conf->geometry; + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + virtio/blk.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/virtio/blk.c b/virtio/blk.c +index c485e4f..1f7365d 100644 +--- a/virtio/blk.c ++++ b/virtio/blk.c +@@ -158,7 +158,6 @@ static void set_guest_features(struct kvm *kvm, void *dev, u32 features) + { + struct blk_dev *bdev = dev; + struct virtio_blk_config *conf = &bdev->blk_config; +- struct virtio_blk_geometry *geo = &conf->geometry; + + bdev->features = features; + +@@ -167,7 +166,7 @@ static void set_guest_features(struct kvm *kvm, void *dev, u32 features) + conf->seg_max = virtio_host_to_guest_u32(&bdev->vdev, conf->seg_max); + + /* Geometry */ +- geo->cylinders = virtio_host_to_guest_u16(&bdev->vdev, geo->cylinders); ++ conf->geometry.cylinders = virtio_host_to_guest_u16(&bdev->vdev, conf->geometry.cylinders); + + conf->blk_size = virtio_host_to_guest_u32(&bdev->vdev, conf->blk_size); + conf->min_io_size = virtio_host_to_guest_u16(&bdev->vdev, conf->min_io_size); +-- +2.12.0 + diff --git a/external/meta-virtualization/recipes-extended/kvmtool/files/0001-kvmtool-9p-fixed-compilation-error.patch b/external/meta-virtualization/recipes-extended/kvmtool/files/0001-kvmtool-9p-fixed-compilation-error.patch new file mode 100644 index 00000000..63911fc2 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/kvmtool/files/0001-kvmtool-9p-fixed-compilation-error.patch @@ -0,0 +1,27 @@ +From bcd954ffdb9383030e02d356b51e09e4e2a7105a Mon Sep 17 00:00:00 2001 +From: Dariusz Pelowski <dariusz.pelowski@gmail.com> +Date: Sun, 5 Nov 2017 12:39:52 +0100 +Subject: [PATCH 1/2] kvmtool: 9p: fixed compilation error + +makedev is defined in sys/sysmacros.h + +Signed-off-by: Dariusz Pelowski <dariusz.pelowski@gmail.com> +--- + virtio/9p.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/virtio/9p.c b/virtio/9p.c +index 6acbfdd..1dee2c2 100644 +--- a/virtio/9p.c ++++ b/virtio/9p.c +@@ -15,6 +15,7 @@ + #include <string.h> + #include <errno.h> + #include <sys/vfs.h> ++#include <sys/sysmacros.h> + + #include <linux/virtio_ring.h> + #include <linux/virtio_9p.h> +-- +2.15.0 + diff --git a/external/meta-virtualization/recipes-extended/kvmtool/files/0002-kvmtool-add-EXTRA_CFLAGS-variable.patch b/external/meta-virtualization/recipes-extended/kvmtool/files/0002-kvmtool-add-EXTRA_CFLAGS-variable.patch new file mode 100644 index 00000000..262531ca --- /dev/null +++ b/external/meta-virtualization/recipes-extended/kvmtool/files/0002-kvmtool-add-EXTRA_CFLAGS-variable.patch @@ -0,0 +1,29 @@ +From 977a4d41012d1814f5a5330cacc2e4944de387cc Mon Sep 17 00:00:00 2001 +From: Dariusz Pelowski <dariusz.pelowski@gmail.com> +Date: Sun, 5 Nov 2017 12:39:21 +0100 +Subject: [PATCH 2/2] kvmtool: add EXTRA_CFLAGS variable + +to avoid CFLAGS overriding introduce new EXTRA_CFLAGS variable +for setting via command argument + +Signed-off-by: Dariusz Pelowski <dariusz.pelowski@gmail.com> +--- + Makefile | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Makefile b/Makefile +index 64a0a16..bca1b26 100644 +--- a/Makefile ++++ b/Makefile +@@ -2,6 +2,8 @@ + # Define WERROR=0 to disable -Werror. + # + ++CFLAGS += $(EXTRA_CFLAGS) ++ + ifeq ($(strip $(V)),) + E = @echo + Q = @ +-- +2.15.0 + diff --git a/external/meta-virtualization/recipes-extended/kvmtool/files/external-crosscompiler.patch b/external/meta-virtualization/recipes-extended/kvmtool/files/external-crosscompiler.patch new file mode 100644 index 00000000..75cef3b1 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/kvmtool/files/external-crosscompiler.patch @@ -0,0 +1,31 @@ +Upstream-Status: Inappropriate [embedded specific] + +This allows OpenEmbedded to pass in cross compiler configuration using +the default envirnment variables. It is required so that kvmtool can +be linked against the cross-compiled libfdt library. + +diff --git a/Makefile b/Makefile +index 1f0196f..8bfb068 100644 +--- a/Makefile ++++ b/Makefile +@@ -14,11 +14,6 @@ export E Q + include config/utilities.mak + include config/feature-tests.mak + +-CC := $(CROSS_COMPILE)gcc +-CFLAGS := +-LD := $(CROSS_COMPILE)ld +-LDFLAGS := +- + FIND := find + CSCOPE := cscope + TAGS := ctags +@@ -297,7 +292,7 @@ $(warning No static libc found. Skipping guest init) + endif + + ifeq (y,$(ARCH_WANT_LIBFDT)) +- ifneq ($(call try-build,$(SOURCE_LIBFDT),$(CFLAGS),-lfdt),y) ++ ifneq ($(call try-build,$(SOURCE_LIBFDT),$(CPPFLAGS) $(CFLAGS),-lfdt),y) + $(error No libfdt found. Please install libfdt-dev package) + else + CFLAGS_DYNOPT += -DCONFIG_HAS_LIBFDT diff --git a/external/meta-virtualization/recipes-extended/kvmtool/kvmtool.bb b/external/meta-virtualization/recipes-extended/kvmtool/kvmtool.bb new file mode 100644 index 00000000..d487ee27 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/kvmtool/kvmtool.bb @@ -0,0 +1,29 @@ +SUMMARY = "Native Linux KVM tool" +DESCRIPTION = "kvmtool is a lightweight tool for hosting KVM guests." + +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=fcb02dc552a041dee27e4b85c7396067" + +DEPENDS = "dtc libaio zlib" +do_configure[depends] += "virtual/kernel:do_shared_workdir" + +inherit kernel-arch + +SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/will/kvmtool.git \ + file://external-crosscompiler.patch \ + file://0001-Avoid-pointers-for-address-of-packed-members.patch \ + file://0001-kvmtool-9p-fixed-compilation-error.patch \ + file://0002-kvmtool-add-EXTRA_CFLAGS-variable.patch \ + " + +SRCREV = "0e1882a49f81cb15d328ef83a78849c0ea26eecc" +PV = "4.14.0+git${SRCREV}" + +S = "${WORKDIR}/git" + +EXTRA_OEMAKE='V=1 EXTRA_CFLAGS="-I${STAGING_KERNEL_BUILDDIR}/include/generated -I${STAGING_KERNEL_BUILDDIR}/arch/${ARCH}/include/generated"' + +do_install() { + install -d ${D}${bindir} + install -m 0755 ${S}/lkvm ${D}${bindir}/ +} diff --git a/external/meta-virtualization/recipes-extended/libvirt/libvirt-python.inc b/external/meta-virtualization/recipes-extended/libvirt/libvirt-python.inc new file mode 100644 index 00000000..be9079d7 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/libvirt/libvirt-python.inc @@ -0,0 +1,55 @@ +inherit pythonnative python-dir + +export STAGING_INCDIR +export STAGING_LIBDIR +export BUILD_SYS +export HOST_SYS + +RDEPENDS_${PN}-python += "python" +PACKAGECONFIG_${PN}-python[xen] = ",,,xen-python" + +PACKAGES += "${PN}-python-staticdev ${PN}-python-dev ${PN}-python-dbg ${PN}-python" + +FILES_${PN}-python-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a" +FILES_${PN}-python-dev += "${PYTHON_SITEPACKAGES_DIR}/*.la" +FILES_${PN}-python-dbg += "${PYTHON_SITEPACKAGES_DIR}/.debug/" +FILES_${PN}-python = "${bindir}/* ${libdir}/* ${libdir}/${PYTHON_DIR}/*" + +SRC_URI += "http://libvirt.org/sources/python/libvirt-python-${PV}.tar.gz;name=libvirt_python" +SRC_URI += "file://libvirt_api_xml_path.patch;patchdir=../libvirt-python-${PV}" + +SRC_URI[libvirt_python.md5sum] = "32cf281199367aec2881c96d1bd80dc6" +SRC_URI[libvirt_python.sha256sum] = "e36fee5898de3550ed7e63d5d0a8447f9d78f06574634855dee59eae27930908" + +export LIBVIRT_API_PATH = "${S}/docs/libvirt-api.xml" +export LIBVIRT_CFLAGS = "-I${S}/include" +export LIBVIRT_LIBS = "-L${B}/src/.libs -lvirt -ldl" +export LDFLAGS="-L${B}/src/.libs" + +LIBVIRT_INSTALL_ARGS = "--root=${D} \ + --prefix=${prefix} \ + --install-lib=${PYTHON_SITEPACKAGES_DIR} \ + --install-data=${datadir}" + +python __anonymous () { + pkgconfig = d.getVar('PACKAGECONFIG') + if ('python') in pkgconfig.split(): + d.setVar('LIBVIRT_PYTHON_ENABLE', '1') + else: + d.setVar('LIBVIRT_PYTHON_ENABLE', '0') +} + +do_compile_append() { + if [ "${LIBVIRT_PYTHON_ENABLE}" = "1" ]; then + cd ${WORKDIR}/${BPN}-python-${PV} && \ + ${STAGING_BINDIR_NATIVE}/python-native/python setup.py build + fi +} + +do_install_append() { + if [ "${LIBVIRT_PYTHON_ENABLE}" = "1" ]; then + cd ${WORKDIR}/${BPN}-python-${PV} && \ + ${STAGING_BINDIR_NATIVE}/python-native/python setup.py install \ + --install-lib=${D}/${PYTHON_SITEPACKAGES_DIR} ${LIBVIRT_INSTALL_ARGS} + fi +} diff --git a/external/meta-virtualization/recipes-extended/libvirt/libvirt/0001-ptest-Remove-Windows-1252-check-from-esxutilstest.patch b/external/meta-virtualization/recipes-extended/libvirt/libvirt/0001-ptest-Remove-Windows-1252-check-from-esxutilstest.patch new file mode 100644 index 00000000..217bdbc5 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/libvirt/libvirt/0001-ptest-Remove-Windows-1252-check-from-esxutilstest.patch @@ -0,0 +1,28 @@ +From ffc71da15c3da068f85d16617b6e0c0175fc0110 Mon Sep 17 00:00:00 2001 +From: He Zhe <zhe.he@windriver.com> +Date: Tue, 23 Aug 2016 02:28:47 -0400 +Subject: [PATCH] ptest: Remove Windows-1252 check from esxutilstest + +Currently we use iconv from glibc-locale and it does not support +Windows-1252 and we don't need support windows character encoding. + +Signed-off-by: He Zhe <zhe.he@windriver.com> +--- + tests/esxutilstest.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/tests/esxutilstest.c b/tests/esxutilstest.c +index 44bdc84..3223de3 100644 +--- a/tests/esxutilstest.c ++++ b/tests/esxutilstest.c +@@ -258,7 +258,6 @@ mymain(void) + DO_TEST(ParseDatastorePath); + DO_TEST(ConvertDateTimeToCalendarTime); + DO_TEST(EscapeDatastoreItem); +- DO_TEST(ConvertWindows1252ToUTF8); + + return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE; + } +-- +2.8.1 + diff --git a/external/meta-virtualization/recipes-extended/libvirt/libvirt/0001-to-fix-build-error.patch b/external/meta-virtualization/recipes-extended/libvirt/libvirt/0001-to-fix-build-error.patch new file mode 100644 index 00000000..c920139e --- /dev/null +++ b/external/meta-virtualization/recipes-extended/libvirt/libvirt/0001-to-fix-build-error.patch @@ -0,0 +1,49 @@ +From 8353dc1e642011199c3b3ba057d51d8768e4cd54 Mon Sep 17 00:00:00 2001 +From: Lei Maohui <leimaohui@cn.fujitsu.com> +Date: Fri, 31 Jul 2015 03:17:07 +0900 +Subject: [PATCH] to fix build error + +The error likes as following + +| Generating internals/command.html.tmp +| /bin/sh: line 3: internals/command.html.tmp: No such file or directory +| rm: Generating internals/locking.html.tmp +| cannot remove `internals/command.html.tmp': No such file or directory +| make[3]: *** [internals/command.html.tmp] Error 1 +| make[3]: *** Waiting for unfinished jobs.... + +Signed-off-by: Lei Maohui <leimaohui@cn.fujitsu.com> +[ywei: rebased to libvirt-1.3.2] +Signed-off-by: Yunguo Wei <yunguo.wei@windriver.com> +[MA: rebase to v4.3.0] +Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> +--- + docs/Makefile.am | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/docs/Makefile.am b/docs/Makefile.am +index 9620587..060a82b 100644 +--- a/docs/Makefile.am ++++ b/docs/Makefile.am +@@ -183,7 +183,7 @@ EXTRA_DIST= \ + hvsupport.pl \ + $(schema_DATA) + +-acl_generated = aclperms.htmlinc ++acl.html:: $(srcdir)/aclperms.htmlinc + + $(srcdir)/aclperms.htmlinc: $(top_srcdir)/src/access/viraccessperm.h \ + $(srcdir)/genaclperms.pl Makefile.am +@@ -247,8 +247,7 @@ MAINTAINERCLEANFILES += \ + %.png: %.fig + convert -rotate 90 $< $@ + +-%.html.tmp: %.html.in site.xsl subsite.xsl page.xsl \ +- $(acl_generated) ++%.html.tmp: %.html.in site.xsl subsite.xsl page.xsl + $(AM_V_GEN)name=`echo $@ | sed -e 's/.tmp//'`; \ + dir=`dirname $@` ; \ + if test "$$dir" = "."; \ +-- +1.9.1 + diff --git a/external/meta-virtualization/recipes-extended/libvirt/libvirt/CVE-2019-3840.patch b/external/meta-virtualization/recipes-extended/libvirt/libvirt/CVE-2019-3840.patch new file mode 100644 index 00000000..8cca8216 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/libvirt/libvirt/CVE-2019-3840.patch @@ -0,0 +1,39 @@ +From 9ed175fbc2deecfdaeabca7bc77c7e7ae33a3377 Mon Sep 17 00:00:00 2001 +From: John Ferlan <jferlan@redhat.com> +Date: Fri, 7 Sep 2018 16:01:27 -0400 +Subject: [PATCH] qemu: Remove duplicated qemuAgentCheckError + +Commit 5b3492fadb moved qemuAgentCheckError calls into +qemuAgentCommand for various reasons; however, subsequent +commit 0977b8aa0 adding a new command made call again +So let's just remove the duplicitous call from +qemuAgentGetInterfaces. + +Signed-off-by: John Ferlan <jferlan@redhat.com> +ACKed-by: Michal Privoznik <mprivozn@redhat.com> + +Upstream-Status: Backport +CVE: CVE-2019-3840 +Signed-off-by: Armin Kuster <akuster@mvista.com> + +--- + src/qemu/qemu_agent.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +Index: libvirt-4.7.0/src/qemu/qemu_agent.c +=================================================================== +--- libvirt-4.7.0.orig/src/qemu/qemu_agent.c ++++ libvirt-4.7.0/src/qemu/qemu_agent.c +@@ -1987,10 +1987,9 @@ qemuAgentGetInterfaces(qemuAgentPtr mon, + if (!(cmd = qemuAgentMakeCommand("guest-network-get-interfaces", NULL))) + goto cleanup; + +- if (qemuAgentCommand(mon, cmd, &reply, false, VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK) < 0 || +- qemuAgentCheckError(cmd, reply) < 0) { ++ if (qemuAgentCommand(mon, cmd, &reply, false, ++ VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK) < 0) + goto cleanup; +- } + + if (!(ret_array = virJSONValueObjectGet(reply, "return"))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", diff --git a/external/meta-virtualization/recipes-extended/libvirt/libvirt/configure.ac-search-for-rpc-rpc.h-in-the-sysroot.patch b/external/meta-virtualization/recipes-extended/libvirt/libvirt/configure.ac-search-for-rpc-rpc.h-in-the-sysroot.patch new file mode 100644 index 00000000..0a9d5f48 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/libvirt/libvirt/configure.ac-search-for-rpc-rpc.h-in-the-sysroot.patch @@ -0,0 +1,36 @@ +From f10477f0fe5e4b7487a4a41faa216d10cd2bc7c3 Mon Sep 17 00:00:00 2001 +From: Mark Asselstine <mark.asselstine@windriver.com> +Date: Thu, 10 May 2018 12:05:04 -0400 +Subject: [PATCH] configure.ac: search for rpc/rpc.h in the sysroot + +We want to avoid host contamination and use the sysroot as the base +directory for our search so add the '=' the the '-I' when searching +for libtirpc's rpc.h header. + +Upstream-Status: Inappropriate [old release] + +Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> +--- + m4/virt-xdr.m4 | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/m4/virt-xdr.m4 b/m4/virt-xdr.m4 +index 5a6408c..6c19f6d 100644 +--- a/m4/virt-xdr.m4 ++++ b/m4/virt-xdr.m4 +@@ -33,10 +33,10 @@ if test x"$with_remote" = x"yes" || test x"$with_libvirtd" = x"yes"; then + dnl check for cygwin's variation in xdr function names + AC_CHECK_FUNCS([xdr_u_int64_t],[],[],[#include <rpc/xdr.h>]) + +- dnl Cygwin/recent glibc requires -I/usr/include/tirpc for <rpc/rpc.h> ++ dnl Cygwin/recent glibc requires -I=/usr/include/tirpc for <rpc/rpc.h> + old_CFLAGS=$CFLAGS + AC_CACHE_CHECK([where to find <rpc/rpc.h>], [lv_cv_xdr_cflags], [ +- for add_CFLAGS in '' '-I/usr/include/tirpc' 'missing'; do ++ for add_CFLAGS in '' '-I=/usr/include/tirpc' 'missing'; do + if test x"$add_CFLAGS" = xmissing; then + lv_cv_xdr_cflags=missing; break + fi +-- +2.7.4 + diff --git a/external/meta-virtualization/recipes-extended/libvirt/libvirt/dnsmasq.conf b/external/meta-virtualization/recipes-extended/libvirt/libvirt/dnsmasq.conf new file mode 100644 index 00000000..a7c30598 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/libvirt/libvirt/dnsmasq.conf @@ -0,0 +1,2 @@ +bind-interfaces +except-interface=virbr0 diff --git a/external/meta-virtualization/recipes-extended/libvirt/libvirt/install-missing-file.patch b/external/meta-virtualization/recipes-extended/libvirt/libvirt/install-missing-file.patch new file mode 100644 index 00000000..cb5a20e3 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/libvirt/libvirt/install-missing-file.patch @@ -0,0 +1,51 @@ +From 0780181a3285511f166487a54ebc231fc657edfe Mon Sep 17 00:00:00 2001 +From: Catalin Enache <catalin.enache@windriver.com> +Date: Mon, 25 Jul 2016 16:38:51 +0300 +Subject: [PATCH] Install missing conf file + +openvzutilstest.conf file is needed by openvzutilstest test. + +Upstream-Status: Inapproriate + +Signed-off-by: Catalin Enache <catalin.enache@windriver.com> +[KK: Update context for 1.3.5.] +Signed-off-by: Kai Kang <kai.kang@windriver.com> +[MA: Update context for v4.3.0] +Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> +--- + tests/Makefile.am | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 65f776e..8a6fd44 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -173,6 +173,7 @@ EXTRA_DIST = \ + $(NULL) + + test_helpers = commandhelper ssh ++test_misc = + test_programs = virshtest sockettest \ + virhostcputest virbuftest \ + commandtest seclabeltest \ +@@ -305,6 +306,7 @@ endif WITH_LXC + + if WITH_OPENVZ + test_programs += openvzutilstest ++test_misc += openvzutilstest.conf + endif WITH_OPENVZ + + if WITH_ESX +@@ -1488,7 +1490,7 @@ endif ! WITH_CIL + + buildtest-TESTS: $(TESTS) $(test_libraries) $(test_helpers) + +-PTESTS = $(TESTS) $(test_helpers) test-lib.sh virschematest ++PTESTS = $(TESTS) $(test_helpers) $(test_misc) test-lib.sh virschematest + + install-ptest: + list='$(TESTS) $(test_helpers) test-lib.sh virschematest' + +-- +2.7.4 + diff --git a/external/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt-1.0.3-fix-thread-safety-in-lxc-callback-handling.patch b/external/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt-1.0.3-fix-thread-safety-in-lxc-callback-handling.patch new file mode 100644 index 00000000..558d5ef6 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt-1.0.3-fix-thread-safety-in-lxc-callback-handling.patch @@ -0,0 +1,63 @@ +From ad5d9cee87357f9f38f62583119606ef95ba10df Mon Sep 17 00:00:00 2001 +From: Bogdan Purcareata <bogdan.purcareata@freescale.com> +Date: Fri, 24 May 2013 16:46:00 +0300 +Subject: [PATCH] Fix thread safety in LXC callback handling + +Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com> +--- + src/lxc/lxc_process.c | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c +index aaa81a7..0eadc67 100644 +--- a/src/lxc/lxc_process.c ++++ b/src/lxc/lxc_process.c +@@ -609,8 +609,13 @@ static void virLXCProcessMonitorExitNotify(virLXCMonitorPtr mon ATTRIBUTE_UNUSED + virLXCProtocolExitStatus status, + virDomainObjPtr vm) + { ++ virLXCDriverPtr driver = lxc_driver; + virLXCDomainObjPrivatePtr priv = vm->privateData; + ++ lxcDriverLock(driver); ++ virObjectLock(vm); ++ lxcDriverUnlock(driver); ++ + switch (status) { + case VIR_LXC_PROTOCOL_EXIT_STATUS_SHUTDOWN: + priv->stopReason = VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN; +@@ -628,6 +633,8 @@ static void virLXCProcessMonitorExitNotify(virLXCMonitorPtr mon ATTRIBUTE_UNUSED + } + VIR_DEBUG("Domain shutoff reason %d (from status %d)", + priv->stopReason, status); ++ ++ virObjectUnlock(vm); + } + + /* XXX a little evil */ +@@ -636,12 +643,21 @@ static void virLXCProcessMonitorInitNotify(virLXCMonitorPtr mon ATTRIBUTE_UNUSED + pid_t initpid, + virDomainObjPtr vm) + { +- virLXCDomainObjPrivatePtr priv = vm->privateData; ++ virLXCDriverPtr driver = lxc_driver; ++ virLXCDomainObjPrivatePtr priv; ++ ++ lxcDriverLock(driver); ++ virObjectLock(vm); ++ lxcDriverUnlock(driver); ++ ++ priv = vm->privateData; + priv->initpid = initpid; + virDomainAuditInit(vm, initpid); + + if (virDomainSaveStatus(lxc_driver->caps, lxc_driver->stateDir, vm) < 0) + VIR_WARN("Cannot update XML with PID for LXC %s", vm->def->name); ++ ++ virObjectUnlock(vm); + } + + static virLXCMonitorCallbacks monitorCallbacks = { +-- +1.7.11.7 + diff --git a/external/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt-use-pkg-config-to-locate-libcap.patch b/external/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt-use-pkg-config-to-locate-libcap.patch new file mode 100644 index 00000000..635d1e81 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt-use-pkg-config-to-locate-libcap.patch @@ -0,0 +1,45 @@ +From 3e271f6db12ffe34843428ec2f0bca7a8fe3aa65 Mon Sep 17 00:00:00 2001 +From: Bruce Ashfield <bruce.ashfield@windriver.com> +Date: Wed, 8 Apr 2015 13:03:03 -0400 +Subject: [PATCH] libvirt: use pkg-config to locate libcap + +libvirt wants to use pcap-config to locate the exisence and location +of libpcap. oe-core stubs this script and replaces it with pkg-config, +which can lead to the host pcap-config triggering and either breaking +the build or introducing host contamination. + +To fix this issue, we patch configure to use 'pkg-config libcap' to +locate the correct libraries. + +Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> +[MA: Update to apply agains v4.3.0] +Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> +--- + m4/virt-libpcap.m4 | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/m4/virt-libpcap.m4 b/m4/virt-libpcap.m4 +index 8fa4889..08b2f53 100644 +--- a/m4/virt-libpcap.m4 ++++ b/m4/virt-libpcap.m4 +@@ -23,14 +23,14 @@ AC_DEFUN([LIBVIRT_ARG_LIBPCAP], [ + + AC_DEFUN([LIBVIRT_CHECK_LIBPCAP], [ + LIBPCAP_REQUIRED="1.0.0" +- LIBPCAP_CONFIG="pcap-config" ++ LIBPCAP_CONFIG="pkg-config libpcap" + LIBPCAP_CFLAGS="" + LIBPCAP_LIBS="" + + if test "x$with_libpcap" != "xno"; then + case $with_libpcap in +- ''|yes|check) LIBPCAP_CONFIG="pcap-config" ;; +- *) LIBPCAP_CONFIG="$with_libpcap/bin/pcap-config" ;; ++ ''|yes|check) LIBPCAP_CONFIG="pkg-config libpcap" ;; ++ *) LIBPCAP_CONFIG="$with_libpcap/bin/pkg-config libpcap" ;; + esac + AS_IF([test "x$LIBPCAP_CONFIG" != "x"], [ + AC_MSG_CHECKING(libpcap $LIBPCAP_CONFIG >= $LIBPCAP_REQUIRED ) +-- +2.1.0 + diff --git a/external/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt_api_xml_path.patch b/external/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt_api_xml_path.patch new file mode 100644 index 00000000..30c30e88 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt_api_xml_path.patch @@ -0,0 +1,87 @@ +Adding support for LIBVIRT_CFLAGS and LIBVIRT_LIBS + +Signed-off-by: Amy Fong <amy.fong@windriver.com> + + +Adding a support for LIBVIRT_API_PATH evironment variable, which can +control where the script should look for the 'libvirt-api.xml' file. +This allows building libvirt-python against different libvirt than the +one installed in the system. This may be used for example in autotest +or by packagers without the need to install libvirt into the system. + +Signed-off-by: Martin Kletzander <mkletzan redhat com> +[ywei: rebased to 1.3.2] +Signed-off-by: Yunguo Wei <yunguo.wei@windriver.com> +--- + setup.py | 35 ++++++++++++++++++++++++----------- + 1 file changed, 24 insertions(+), 11 deletions(-) + +diff --git a/setup.py b/setup.py +index eff9d54..48ec4fe 100755 +--- a/setup.py ++++ b/setup.py +@@ -43,13 +43,7 @@ def check_minimum_libvirt_version(): + "libvirt"]) + + def have_libvirt_lxc(): +- try: +- spawn([get_pkgcfg(), +- "--atleast-version=%s" % MIN_LIBVIRT_LXC, +- "libvirt"]) +- return True +- except DistutilsExecError: +- return False ++ return True + + def have_libvirtaio(): + # This depends on asyncio, which in turn depends on "yield from" syntax. +@@ -77,7 +71,17 @@ def get_api_xml_files(): + """Check with pkg-config that libvirt is present and extract + the API XML file paths we need from it""" + +- libvirt_api = get_pkgconfig_data(["--variable", "libvirt_api"], "libvirt") ++ libvirt_api = os.getenv("LIBVIRT_API_PATH") ++ ++ if libvirt_api: ++ if not libvirt_api.endswith("-api.xml"): ++ raise ValueError("Invalid path '%s' for API XML" % libvirt_api) ++ if not os.path.exists(libvirt_api): ++ raise ValueError("API XML '%s' does not exist, " ++ "have you built libvirt?" % libvirt_api) ++ else: ++ libvirt_api = get_pkgconfig_data(["--variable", "libvirt_api"], ++ "libvirt") + + offset = libvirt_api.index("-api.xml") + libvirt_qemu_api = libvirt_api[0:offset] + "-qemu-api.xml" +@@ -97,8 +101,17 @@ def get_module_lists(): + + c_modules = [] + py_modules = [] +- ldflags = get_pkgconfig_data(["--libs-only-L"], "libvirt", False).split() +- cflags = get_pkgconfig_data(["--cflags"], "libvirt", False).split() ++ libvirt_cflags = os.getenv("LIBVIRT_CFLAGS") ++ if libvirt_cflags: ++ cflags = libvirt_cflags.split() ++ else: ++ cflags = get_pkgconfig_data(["--cflags"], "libvirt", False).split() ++ ++ libvirt_libs = os.getenv("LIBVIRT_LIBS") ++ if libvirt_libs: ++ ldflags = libvirt_libs.split() ++ else: ++ ldflags = get_pkgconfig_data(["--libs-only-L"], "libvirt", False).split() + + module = Extension('libvirtmod', + sources = ['libvirt-override.c', 'build/libvirt.c', 'typewrappers.c', 'libvirt-utils.c'], +@@ -144,7 +157,7 @@ def get_module_lists(): + class my_build(build): + + def run(self): +- check_minimum_libvirt_version() ++# check_minimum_libvirt_version() + apis = get_api_xml_files() + + self.spawn([sys.executable, "generator.py", "libvirt", apis[0]]) +-- +2.17.0 diff --git a/external/meta-virtualization/recipes-extended/libvirt/libvirt/libvirtd.conf b/external/meta-virtualization/recipes-extended/libvirt/libvirt/libvirtd.conf new file mode 100644 index 00000000..c0462b47 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/libvirt/libvirt/libvirtd.conf @@ -0,0 +1,393 @@ +# Master libvirt daemon configuration file +# +# For further information consult http://libvirt.org/format.html +# +# NOTE: the tests/daemon-conf regression test script requires +# that each "PARAMETER = VALUE" line in this file have the parameter +# name just after a leading "#". + +################################################################# +# +# Network connectivity controls +# + +# Flag listening for secure TLS connections on the public TCP/IP port. +# NB, must pass the --listen flag to the libvirtd process for this to +# have any effect. +# +# It is necessary to setup a CA and issue server certificates before +# using this capability. +# +# This is enabled by default, uncomment this to disable it +listen_tls = 0 + +# Listen for unencrypted TCP connections on the public TCP/IP port. +# NB, must pass the --listen flag to the libvirtd process for this to +# have any effect. +# +# Using the TCP socket requires SASL authentication by default. Only +# SASL mechanisms which support data encryption are allowed. This is +# DIGEST_MD5 and GSSAPI (Kerberos5) +# +# This is disabled by default, uncomment this to enable it. +listen_tcp = 1 + + + +# Override the port for accepting secure TLS connections +# This can be a port number, or service name +# +#tls_port = "16514" + +# Override the port for accepting insecure TCP connections +# This can be a port number, or service name +# +#tcp_port = "16509" + + +# Override the default configuration which binds to all network +# interfaces. This can be a numeric IPv4/6 address, or hostname +# +#listen_addr = "192.168.0.1" + + +# Flag toggling mDNS advertizement of the libvirt service. +# +# Alternatively can disable for all services on a host by +# stopping the Avahi daemon +# +# This is enabled by default, uncomment this to disable it +#mdns_adv = 0 + +# Override the default mDNS advertizement name. This must be +# unique on the immediate broadcast network. +# +# The default is "Virtualization Host HOSTNAME", where HOSTNAME +# is subsituted for the short hostname of the machine (without domain) +# +#mdns_name = "Virtualization Host Joe Demo" + + +################################################################# +# +# UNIX socket access controls +# + +# Set the UNIX domain socket group ownership. This can be used to +# allow a 'trusted' set of users access to management capabilities +# without becoming root. +# +# This is restricted to 'root' by default. +#unix_sock_group = "libvirt" + +# Set the UNIX socket permissions for the R/O socket. This is used +# for monitoring VM status only +# +# Default allows any user. If setting group ownership may want to +# restrict this to: +#unix_sock_ro_perms = "0777" + +# Set the UNIX socket permissions for the R/W socket. This is used +# for full management of VMs +# +# Default allows only root. If PolicyKit is enabled on the socket, +# the default will change to allow everyone (eg, 0777) +# +# If not using PolicyKit and setting group ownership for access +# control then you may want to relax this to: +#unix_sock_rw_perms = "0770" + +# Set the name of the directory in which sockets will be found/created. +#unix_sock_dir = "/var/run/libvirt" + +################################################################# +# +# Authentication. +# +# - none: do not perform auth checks. If you can connect to the +# socket you are allowed. This is suitable if there are +# restrictions on connecting to the socket (eg, UNIX +# socket permissions), or if there is a lower layer in +# the network providing auth (eg, TLS/x509 certificates) +# +# - sasl: use SASL infrastructure. The actual auth scheme is then +# controlled from /etc/sasl2/libvirt.conf. For the TCP +# socket only GSSAPI & DIGEST-MD5 mechanisms will be used. +# For non-TCP or TLS sockets, any scheme is allowed. +# +# - polkit: use PolicyKit to authenticate. This is only suitable +# for use on the UNIX sockets. The default policy will +# require a user to supply their own password to gain +# full read/write access (aka sudo like), while anyone +# is allowed read/only access. +# +# Set an authentication scheme for UNIX read-only sockets +# By default socket permissions allow anyone to connect +# +# To restrict monitoring of domains you may wish to enable +# an authentication mechanism here +#auth_unix_ro = "none" + +# Set an authentication scheme for UNIX read-write sockets +# By default socket permissions only allow root. If PolicyKit +# support was compiled into libvirt, the default will be to +# use 'polkit' auth. +# +# If the unix_sock_rw_perms are changed you may wish to enable +# an authentication mechanism here +#auth_unix_rw = "none" + +# Change the authentication scheme for TCP sockets. +# +# If you don't enable SASL, then all TCP traffic is cleartext. +# Don't do this outside of a dev/test scenario. For real world +# use, always enable SASL and use the GSSAPI or DIGEST-MD5 +# mechanism in /etc/sasl2/libvirt.conf +#auth_tcp = "sasl" + +# Change the authentication scheme for TLS sockets. +# +# TLS sockets already have encryption provided by the TLS +# layer, and limited authentication is done by certificates +# +# It is possible to make use of any SASL authentication +# mechanism as well, by using 'sasl' for this option +#auth_tls = "none" + + + +################################################################# +# +# TLS x509 certificate configuration +# + + +# Override the default server key file path +# +#key_file = "/etc/pki/libvirt/private/serverkey.pem" + +# Override the default server certificate file path +# +#cert_file = "/etc/pki/libvirt/servercert.pem" + +# Override the default CA certificate path +# +#ca_file = "/etc/pki/CA/cacert.pem" + +# Specify a certificate revocation list. +# +# Defaults to not using a CRL, uncomment to enable it +#crl_file = "/etc/pki/CA/crl.pem" + + + +################################################################# +# +# Authorization controls +# + + +# Flag to disable verification of our own server certificates +# +# When libvirtd starts it performs some sanity checks against +# its own certificates. +# +# Default is to always run sanity checks. Uncommenting this +# will disable sanity checks which is not a good idea +#tls_no_sanity_certificate = 1 + +# Flag to disable verification of client certificates +# +# Client certificate verification is the primary authentication mechanism. +# Any client which does not present a certificate signed by the CA +# will be rejected. +# +# Default is to always verify. Uncommenting this will disable +# verification - make sure an IP whitelist is set +#tls_no_verify_certificate = 1 + + +# A whitelist of allowed x509 Distinguished Names +# This list may contain wildcards such as +# +# "C=GB,ST=London,L=London,O=Red Hat,CN=*" +# +# See the POSIX fnmatch function for the format of the wildcards. +# +# NB If this is an empty list, no client can connect, so comment out +# entirely rather than using empty list to disable these checks +# +# By default, no DN's are checked +#tls_allowed_dn_list = ["DN1", "DN2"] + + +# A whitelist of allowed SASL usernames. The format for usernames +# depends on the SASL authentication mechanism. Kerberos usernames +# look like username@REALM +# +# This list may contain wildcards such as +# +# "*@EXAMPLE.COM" +# +# See the POSIX fnmatch function for the format of the wildcards. +# +# NB If this is an empty list, no client can connect, so comment out +# entirely rather than using empty list to disable these checks +# +# By default, no Username's are checked +#sasl_allowed_username_list = ["joe@EXAMPLE.COM", "fred@EXAMPLE.COM" ] + + + +################################################################# +# +# Processing controls +# + +# The maximum number of concurrent client connections to allow +# over all sockets combined. +#max_clients = 20 + + +# The minimum limit sets the number of workers to start up +# initially. If the number of active clients exceeds this, +# then more threads are spawned, upto max_workers limit. +# Typically you'd want max_workers to equal maximum number +# of clients allowed +#min_workers = 5 +#max_workers = 20 + + +# The number of priority workers. If all workers from above +# pool will stuck, some calls marked as high priority +# (notably domainDestroy) can be executed in this pool. +#prio_workers = 5 + +# Total global limit on concurrent RPC calls. Should be +# at least as large as max_workers. Beyond this, RPC requests +# will be read into memory and queued. This directly impact +# memory usage, currently each request requires 256 KB of +# memory. So by default upto 5 MB of memory is used +# +# XXX this isn't actually enforced yet, only the per-client +# limit is used so far +#max_requests = 20 + +# Limit on concurrent requests from a single client +# connection. To avoid one client monopolizing the server +# this should be a small fraction of the global max_requests +# and max_workers parameter +#max_client_requests = 5 + +################################################################# +# +# Logging controls +# + +# Logging level: 4 errors, 3 warnings, 2 information, 1 debug +# basically 1 will log everything possible +#log_level = 3 + +# Logging filters: +# A filter allows to select a different logging level for a given category +# of logs +# The format for a filter is: +# x:name +# where name is a match string e.g. remote or qemu +# the x prefix is the minimal level where matching messages should be logged +# 1: DEBUG +# 2: INFO +# 3: WARNING +# 4: ERROR +# +# Multiple filter can be defined in a single @filters, they just need to be +# separated by spaces. +# +# e.g: +# log_filters="3:remote 4:event" +# to only get warning or errors from the remote layer and only errors from +# the event layer. + +# Logging outputs: +# An output is one of the places to save logging information +# The format for an output can be: +# x:stderr +# output goes to stderr +# x:syslog:name +# use syslog for the output and use the given name as the ident +# x:file:file_path +# output to a file, with the given filepath +# In all case the x prefix is the minimal level, acting as a filter +# 1: DEBUG +# 2: INFO +# 3: WARNING +# 4: ERROR +# +# Multiple output can be defined, they just need to be separated by spaces. +# e.g.: +# log_outputs="3:syslog:libvirtd" +# to log all warnings and errors to syslog under the libvirtd ident + +# Log debug buffer size: default 64 +# The daemon keeps an internal debug log buffer which will be dumped in case +# of crash or upon receiving a SIGUSR2 signal. This setting allows to override +# the default buffer size in kilobytes. +# If value is 0 or less the debug log buffer is deactivated +#log_buffer_size = 64 + + +################################################################## +# +# Auditing +# +# This setting allows usage of the auditing subsystem to be altered: +# +# audit_level == 0 -> disable all auditing +# audit_level == 1 -> enable auditing, only if enabled on host (default) +# audit_level == 2 -> enable auditing, and exit if disabled on host +# +#audit_level = 2 +# +# If set to 1, then audit messages will also be sent +# via libvirt logging infrastructure. Defaults to 0 +# +#audit_logging = 1 + +################################################################### +# UUID of the host: +# Provide the UUID of the host here in case the command +# 'dmidecode -s system-uuid' does not provide a valid uuid. In case +# 'dmidecode' does not provide a valid UUID and none is provided here, a +# temporary UUID will be generated. +# Keep the format of the example UUID below. UUID must not have all digits +# be the same. + +# NB This default all-zeros UUID will not work. Replace +# it with the output of the 'uuidgen' command and then +# uncomment this entry +#host_uuid = "00000000-0000-0000-0000-000000000000" + +################################################################### +# Keepalive protocol: +# This allows libvirtd to detect broken client connections or even +# dead client. A keepalive message is sent to a client after +# keepalive_interval seconds of inactivity to check if the client is +# still responding; keepalive_count is a maximum number of keepalive +# messages that are allowed to be sent to the client without getting +# any response before the connection is considered broken. In other +# words, the connection is automatically closed approximately after +# keepalive_interval * (keepalive_count + 1) seconds since the last +# message received from the client. If keepalive_interval is set to +# -1, libvirtd will never send keepalive requests; however clients +# can still send them and the deamon will send responses. When +# keepalive_count is set to 0, connections will be automatically +# closed after keepalive_interval seconds of inactivity without +# sending any keepalive messages. +# +#keepalive_interval = 5 +#keepalive_count = 5 +# +# If set to 1, libvirtd will refuse to talk to clients that do not +# support keepalive protocol. Defaults to 0. +# +#keepalive_required = 1 diff --git a/external/meta-virtualization/recipes-extended/libvirt/libvirt/libvirtd.sh b/external/meta-virtualization/recipes-extended/libvirt/libvirt/libvirtd.sh new file mode 100755 index 00000000..29dbf391 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/libvirt/libvirt/libvirtd.sh @@ -0,0 +1,103 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: libvirtd +# Required-Start: $local_fs $network dbus +# Required-Stop: $local_fs $network dbus +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +### END INIT INFO + +if [ -f /lib/lsb/init-functions ] +then + . /lib/lsb/init-functions +else + # int log_begin_message (char *message) + log_begin_msg () { + if [ -z "$1" ]; then + return 1 + fi + echo " * $@" + } + + # int log_end_message (int exitstatus) + log_end_msg () { + + # If no arguments were passed, return + [ -z "$1" ] && return 1 + + # Only do the fancy stuff if we have an appropriate terminal + # and if /usr is already mounted + TPUT=/usr/bin/tput + EXPR=/usr/bin/expr + if [ -x $TPUT ] && [ -x $EXPR ] && $TPUT hpa 60 >/dev/null 2>&1; then + COLS=`$TPUT cols` + if [ -n "$COLS" ]; then + COL=`$EXPR $COLS - 7` + else + COL=73 + fi + UP=`$TPUT cuu1` + END=`$TPUT hpa $COL` + START=`$TPUT hpa 0` + RED=`$TPUT setaf 1` + NORMAL=`$TPUT op` + if [ $1 -eq 0 ]; then + echo "$UP$END[ ok ]" + else + echo -e "$UP$START $RED*$NORMAL$END[${RED}fail${NORMAL}]" + fi + else + if [ $1 -eq 0 ]; then + echo " ...done." + else + echo " ...fail!" + fi + fi + return $1 + } + + log_warning_msg () { + if log_use_fancy_output; then + YELLOW=`$TPUT setaf 3` + NORMAL=`$TPUT op` + echo "$YELLOW*$NORMAL $@" + else + echo "$@" + fi + } + +fi + +case "$1" in + start) + if [ -e /var/run/libvirtd.pid ]; then + if [ -d /proc/$(cat /var/run/libvirtd.pid) ]; then + echo "virtualization library already started; not starting." + else + echo "Removing stale PID file /var/run/libvirtd.pid." + rm -f /var/run/libvirtd.pid + fi + fi + log_begin_msg "Starting virtualization library daemon: libvirtd" + if [ ! -e /var/run/libvirtd.pid ]; then + start-stop-daemon -K -x /usr/bin/dnsmasq --pidfile /var/run/libvirt/network/default.pid + fi + start-stop-daemon --start --quiet --pidfile /var/run/libvirtd.pid --exec /usr/sbin/libvirtd -- --daemon --listen + log_end_msg $? + ;; + stop) + log_begin_msg "Stopping virtualization library daemon: libvirtd" + start-stop-daemon --stop --quiet --retry 3 --exec /usr/sbin/libvirtd --pidfile /var/run/libvirtd.pid + log_end_msg $? + rm -f /var/run/libvirtd.pid + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac diff --git a/external/meta-virtualization/recipes-extended/libvirt/libvirt/lxc_monitor-Avoid-AB-BA-lock-race.patch b/external/meta-virtualization/recipes-extended/libvirt/libvirt/lxc_monitor-Avoid-AB-BA-lock-race.patch new file mode 100644 index 00000000..fc3880fb --- /dev/null +++ b/external/meta-virtualization/recipes-extended/libvirt/libvirt/lxc_monitor-Avoid-AB-BA-lock-race.patch @@ -0,0 +1,106 @@ +From 7882c6eca53fe9abe253497a50f6c5ae062176d3 Mon Sep 17 00:00:00 2001 +From: Mark Asselstine <mark.asselstine@windriver.com> +Date: Mon, 24 Sep 2018 11:11:35 -0400 +Subject: [PATCH] lxc_monitor: Avoid AB / BA lock race + +A deadlock situation can occur when autostarting a LXC domain 'guest' +due to two threads attempting to take opposing locks while holding +opposing locks (AB BA problem). Thread A takes and holds the 'vm' lock +while attempting to take the 'client' lock, meanwhile, thread B takes +and holds the 'client' lock while attempting to take the 'vm' lock. + +The potential for this can be seen as follows: + +Thread A: +virLXCProcessAutostartDomain (takes vm lock) + --> virLXCProcessStart + --> virLXCProcessConnectMonitor + --> virLXCMonitorNew + --> virNetClientSetCloseCallback (wants client lock) + +Thread B: +virNetClientIncomingEvent (takes client lock) + --> virNetClientIOHandleInput + --> virNetClientCallDispatch + --> virNetClientCallDispatchMessage + --> virNetClientProgramDispatch + --> virLXCMonitorHandleEventInit + --> virLXCProcessMonitorInitNotify (wants vm lock) + +Since these threads are scheduled independently and are preemptible it +is possible for the deadlock scenario to occur where each thread locks +their first lock but both will fail to get their second lock and just +spin forever. You get something like: + +virLXCProcessAutostartDomain (takes vm lock) + --> virLXCProcessStart + --> virLXCProcessConnectMonitor + --> virLXCMonitorNew +<...> +virNetClientIncomingEvent (takes client lock) + --> virNetClientIOHandleInput + --> virNetClientCallDispatch + --> virNetClientCallDispatchMessage + --> virNetClientProgramDispatch + --> virLXCMonitorHandleEventInit + --> virLXCProcessMonitorInitNotify (wants vm lock but spins) +<...> + --> virNetClientSetCloseCallback (wants client lock but spins) + +Neither thread ever gets the lock it needs to be able to continue +while holding the lock that the other thread needs. + +The actual window for preemption which can cause this deadlock is +rather small, between the calls to virNetClientProgramNew() and +execution of virNetClientSetCloseCallback(), both in +virLXCMonitorNew(). But it can be seen in real world use that this +small window is enough. + +By moving the call to virNetClientSetCloseCallback() ahead of +virNetClientProgramNew() we can close any possible chance of the +deadlock taking place. There should be no other implications to the +move since the close callback (in the unlikely event was called) will +spin on the vm lock. The remaining work that takes place between the +old call location of virNetClientSetCloseCallback() and the new +location is unaffected by the move. + +Upstream-Status: Backport commit 7882c6eca53f + +Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> +Signed-off-by: Michal Privoznik <mprivozn@redhat.com> +--- + src/lxc/lxc_monitor.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/src/lxc/lxc_monitor.c b/src/lxc/lxc_monitor.c +index e765c16..0b18a14 100644 +--- a/src/lxc/lxc_monitor.c ++++ b/src/lxc/lxc_monitor.c +@@ -161,6 +161,13 @@ virLXCMonitorPtr virLXCMonitorNew(virDomainObjPtr vm, + if (virNetClientRegisterAsyncIO(mon->client) < 0) + goto error; + ++ /* avoid deadlock by making this call before assigning virLXCMonitorEvents */ ++ virNetClientSetCloseCallback(mon->client, virLXCMonitorEOFNotify, mon, ++ virLXCMonitorCloseFreeCallback); ++ ++ /* close callback now has its own reference */ ++ virObjectRef(mon); ++ + if (!(mon->program = virNetClientProgramNew(VIR_LXC_MONITOR_PROGRAM, + VIR_LXC_MONITOR_PROGRAM_VERSION, + virLXCMonitorEvents, +@@ -175,10 +182,6 @@ virLXCMonitorPtr virLXCMonitorNew(virDomainObjPtr vm, + mon->vm = virObjectRef(vm); + memcpy(&mon->cb, cb, sizeof(mon->cb)); + +- virObjectRef(mon); +- virNetClientSetCloseCallback(mon->client, virLXCMonitorEOFNotify, mon, +- virLXCMonitorCloseFreeCallback); +- + cleanup: + VIR_FREE(sockpath); + return mon; +-- +2.7.4 + diff --git a/external/meta-virtualization/recipes-extended/libvirt/libvirt/qemu-fix-crash-in-qemuOpen.patch b/external/meta-virtualization/recipes-extended/libvirt/libvirt/qemu-fix-crash-in-qemuOpen.patch new file mode 100644 index 00000000..3cf9e839 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/libvirt/libvirt/qemu-fix-crash-in-qemuOpen.patch @@ -0,0 +1,39 @@ +From 74bff2509080912ea8abf1de8fd95fa2412b659a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com> +Date: Thu, 11 Apr 2013 11:37:25 +0200 +Subject: [PATCH] qemu: fix crash in qemuOpen + +commit 74bff2509080912ea8abf1de8fd95fa2412b659a from upsteam +git://libvirt.org/libvirt.git + +If the path part of connection URI is not present, cfg is used +unitialized. + +https://bugzilla.redhat.com/show_bug.cgi?id=950855 +--- + src/qemu/qemu_driver.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 2c0d7d1..0d41e39 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -1026,6 +1026,7 @@ static virDrvOpenStatus qemuOpen(virConnectPtr conn, + goto cleanup; + } + ++ cfg = virQEMUDriverGetConfig(qemu_driver); + if (conn->uri->path == NULL) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no QEMU URI path given, try %s"), +@@ -1033,7 +1034,6 @@ static virDrvOpenStatus qemuOpen(virConnectPtr conn, + goto cleanup; + } + +- cfg = virQEMUDriverGetConfig(qemu_driver); + if (cfg->privileged) { + if (STRNEQ(conn->uri->path, "/system") && + STRNEQ(conn->uri->path, "/session")) { +-- +1.7.1 + diff --git a/external/meta-virtualization/recipes-extended/libvirt/libvirt/run-ptest b/external/meta-virtualization/recipes-extended/libvirt/libvirt/run-ptest new file mode 100644 index 00000000..a434b186 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/libvirt/libvirt/run-ptest @@ -0,0 +1,3 @@ +#!/bin/sh + +make -C tests -k check-TESTS diff --git a/external/meta-virtualization/recipes-extended/libvirt/libvirt/runptest.patch b/external/meta-virtualization/recipes-extended/libvirt/libvirt/runptest.patch new file mode 100644 index 00000000..457e8218 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/libvirt/libvirt/runptest.patch @@ -0,0 +1,135 @@ +From 94478517c4f9950b28be3a348387db6ede3db812 Mon Sep 17 00:00:00 2001 +From: Mark Asselstine <mark.asselstine@windriver.com> +Date: Mon, 4 Jun 2018 11:55:37 -0400 +Subject: [PATCH] Add 'install-ptest' rule. + +Change TESTS_ENVIRONMENT to allow running outside build dir. + +Upstream-status: Pending +Signed-off-by: Mihaela Sendrea <mihaela.sendrea@enea.com> +[KK: Update context for 1.3.5.] +Signed-off-by: Kai Kang <kai.kang@windriver.com> +[MA: Allow separate source and build dirs] +Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> +[ZH: add missing test_helper files] +Signed-off-by: He Zhe <zhe.he@windriver.com> +[MA: Update context for v4.3.0] +Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> +--- + tests/Makefile.am | 74 +++++++++++++++++++++++++++++++++++++++++++++---------- + 1 file changed, 61 insertions(+), 13 deletions(-) + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 7b93fbd..edc1eb9 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -35,11 +35,13 @@ INCLUDES = \ + + WARN_CFLAGS += $(RELAXED_FRAME_LIMIT_CFLAGS) + ++PTEST_DIR ?= $(libdir)/libvirt/ptest ++ + AM_CFLAGS = \ +- -Dabs_builddir="\"$(abs_builddir)\"" \ +- -Dabs_topbuilddir="\"$(abs_topbuilddir)\"" \ +- -Dabs_srcdir="\"$(abs_srcdir)\"" \ +- -Dabs_topsrcdir="\"$(abs_topsrcdir)\"" \ ++ -Dabs_builddir="\"$(PTEST_DIR)/tests\"" \ ++ -Dabs_topbuilddir="\"$(PTEST_DIR)\"" \ ++ -Dabs_srcdir="\"$(PTEST_DIR)/tests\"" \ ++ -Dabs_topsrcdir="\"$(PTEST_DIR)\"" \ + $(LIBXML_CFLAGS) \ + $(LIBNL_CFLAGS) \ + $(GNUTLS_CFLAGS) \ +@@ -64,7 +66,7 @@ QEMULIB_LDFLAGS = \ + $(MINGW_EXTRA_LDFLAGS) + + INCLUDES += \ +- -DTEST_DRIVER_DIR=\"$(top_builddir)/src/.libs\" ++ -DTEST_DRIVER_DIR=\"$(PTEST_DIR)/src/.libs\" + + PROBES_O = + if WITH_DTRACE_PROBES +@@ -466,17 +468,15 @@ TESTS = $(test_programs) \ + # Also, BSD sh doesn't like 'a=b b=$$a', so we can't use an + # intermediate shell variable, but must do all the expansion in make + +-lv_abs_top_builddir=$(shell cd '$(top_builddir)' && pwd) +- + VIR_TEST_EXPENSIVE ?= $(VIR_TEST_EXPENSIVE_DEFAULT) + TESTS_ENVIRONMENT = \ +- abs_top_builddir=$(lv_abs_top_builddir) \ +- abs_top_srcdir=`cd '$(top_srcdir)'; pwd` \ +- abs_builddir=$(abs_builddir) \ +- abs_srcdir=$(abs_srcdir) \ +- CONFIG_HEADER="$(lv_abs_top_builddir)/config.h" \ ++ abs_top_builddir="$(PTEST_DIR)" \ ++ abs_top_srcdir="$(PTEST_DIR)" \ ++ abs_builddir="$(PTEST_DIR)/tests" \ ++ abs_srcdir="$(PTEST_DIR)/tests" \ ++ CONFIG_HEADER="$(PTEST_DIR)/config.h" \ + SHELL="$(SHELL)" \ +- LIBVIRT_DRIVER_DIR="$(lv_abs_top_builddir)/src/.libs" \ ++ LIBVIRT_DRIVER_DIR="$(PTEST_DIR)/src/.libs" \ + LIBVIRT_AUTOSTART=0 \ + LC_ALL=C \ + VIR_TEST_EXPENSIVE=$(VIR_TEST_EXPENSIVE) \ +@@ -1486,5 +1486,55 @@ else ! WITH_CIL + EXTRA_DIST += objectlocking.ml + endif ! WITH_CIL + ++buildtest-TESTS: $(TESTS) $(test_libraries) $(test_helpers) ++ ++PTESTS = $(TESTS) $(test_helpers) test-lib.sh virschematest ++ ++install-ptest: ++ list='$(TESTS) $(test_helpers) test-lib.sh virschematest' ++ install -d $(DEST_DIR)/tools ++ @(if [ -d ../tools/.libs ] ; then cd ../tools/.libs; fi; \ ++ install * $(DEST_DIR)/tools) ++ install -d $(DEST_DIR)/src/network ++ cp $(top_srcdir)/src/network/*.xml $(DEST_DIR)/src/network ++ install -d $(DEST_DIR)/src/cpu_map ++ cp $(top_srcdir)/src/cpu_map/*.xml $(DEST_DIR)/src/cpu_map ++ install ../src/libvirt_iohelper $(DEST_DIR)/src ++ install -D ../src/libvirtd $(DEST_DIR)/src/libvirtd ++ install -d $(DEST_DIR)/src/remote ++ install -D $(top_srcdir)/src/remote/libvirtd.conf $(DEST_DIR)/src/remote/libvirtd.conf ++ install -d $(DEST_DIR)/src/remote/.libs ++ @(if [ -d ../src/remote/.libs ] ; then cd ../src/remote/.libs; fi; \ ++ install * $(DEST_DIR)/src/remote/.libs) ++ install -d $(DEST_DIR)/src/.libs ++ @(if [ -d ../src/.libs ] ; then cd ../src/.libs; fi; \ ++ install * $(DEST_DIR)/src/.libs) ++ install -d $(DEST_DIR)/docs/schemas ++ cp $(top_srcdir)/docs/schemas/*.rng $(DEST_DIR)/docs/schemas ++ cp -r $(top_srcdir)/build-aux $(DEST_DIR) ++ install -d $(DEST_DIR)/examples/xml ++ cp -r $(top_srcdir)/examples/xml/test $(DEST_DIR)/examples/xml ++ install -d $(DEST_DIR)/tests/.libs ++ find . -type d -name "*xml2xml*" -exec cp -r {} $(DEST_DIR)/tests \; ++ find . -type d -name "*data" -exec cp -r {} $(DEST_DIR)/tests \; ++ @(for file in $(PTESTS); do \ ++ if [ -f .libs/$$file ]; then \ ++ install .libs/$$file $(DEST_DIR)/tests; \ ++ elif [ -f $(srcdir)/$$file ]; then \ ++ install $(srcdir)/$$file $(DEST_DIR)/tests; \ ++ else \ ++ install $(builddir)/$$file $(DEST_DIR)/tests; \ ++ fi; \ ++ done;) ++ @(if [ -d .libs ]; then install .libs/*.so $(DEST_DIR)/tests/.libs; fi;) ++ cp ../config.h $(DEST_DIR) ++ cp Makefile $(DEST_DIR)/tests ++ sed -i -e 's/^Makefile:/_Makefile:/' $(DEST_DIR)/tests/Makefile ++ cp ../Makefile $(DEST_DIR) ++ sed -i -e 's|^Makefile:|_Makefile:|' $(DEST_DIR)/Makefile ++ sed -i -e 's|$(BUILD_DIR)|$(PTEST_DIR)|g' $(DEST_DIR)/tests/Makefile ++ sed -i -e 's|$(BUILD_DIR)|$(PTEST_DIR)|g' $(DEST_DIR)/Makefile ++ sed -i -e 's|^\(.*\.log:\) \(.*EXEEXT.*\)|\1|g' $(DEST_DIR)/tests/Makefile ++ + CLEANFILES = *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda *.cmi *.cmx \ + objectlocking-files.txt +-- +2.7.4 + diff --git a/external/meta-virtualization/recipes-extended/libvirt/libvirt/tools-add-libvirt-net-rpc-to-virt-host-validate-when.patch b/external/meta-virtualization/recipes-extended/libvirt/libvirt/tools-add-libvirt-net-rpc-to-virt-host-validate-when.patch new file mode 100644 index 00000000..5f6f9502 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/libvirt/libvirt/tools-add-libvirt-net-rpc-to-virt-host-validate-when.patch @@ -0,0 +1,91 @@ +From f73c5c61c921bf773dcba5e4234e23afce5dbe7f Mon Sep 17 00:00:00 2001 +From: Bruce Ashfield <bruce.ashfield@windriver.com> +Date: Fri, 2 Aug 2013 11:38:43 -0400 +Subject: [PATCH] tools: add libvirt-net-rpc to virt-host-validate when TLS is + enabled + +When gnu-tls is enabled for libvirt references to virNetTLSInit are +generated in libvirt. Any binaries linking against libvirt, must also +link against libvirt-net-rpc which provides the implementation. + +Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> +[ywei: rebased to libvirt-1.3.2] +Signed-off-by: Yunguo Wei <yunguo.wei@windriver.com> +[MA: rebase to v4.3.0] +Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> +--- + examples/Makefile.am | 19 +++++++++++++++++++ + tools/Makefile.am | 13 +++++++++++++ + 2 files changed, 32 insertions(+) + +diff --git a/examples/Makefile.am b/examples/Makefile.am +index 7069d74..c8893e3 100644 +--- a/examples/Makefile.am ++++ b/examples/Makefile.am +@@ -39,6 +39,10 @@ LDADD = $(STATIC_BINARIES) $(WARN_CFLAGS) $(COVERAGE_LDFLAGS) \ + $(top_builddir)/src/libvirt.la $(top_builddir)/gnulib/lib/libgnu.la \ + $(top_builddir)/src/libvirt-admin.la + ++if WITH_GNUTLS ++LDADD += $(top_builddir)/src/libvirt-net-rpc.la ++endif ++ + noinst_PROGRAMS=dominfo/info1 dommigrate/dommigrate domsuspend/suspend \ + domtop/domtop hellolibvirt/hellolibvirt object-events/event-test \ + openauth/openauth rename/rename admin/list_servers admin/list_clients \ +@@ -70,6 +74,21 @@ admin_logging_SOURCES = admin/logging.c + INSTALL_DATA_LOCAL = + UNINSTALL_LOCAL = + ++if WITH_GNUTLS ++dominfo_info1_LDADD = $(top_builddir)/src/libvirt-net-rpc.la \ ++ $(LDADD) \ ++ $(NULL) ++domsuspend_suspend_LDADD = $(top_builddir)/src/libvirt-net-rpc.la \ ++ $(LDADD) \ ++ $(NULL) ++hellolibvirt_hellolibvirt_LDADD = $(top_builddir)/src/libvirt-net-rpc.la \ ++ $(LDADD) \ ++ $(NULL) ++openauth_openauth_LDADD = $(top_builddir)/src/libvirt-net-rpc.la \ ++ $(LDADD) \ ++ $(NULL) ++endif ++ + if WITH_APPARMOR_PROFILES + apparmordir = $(sysconfdir)/apparmor.d/ + apparmor_DATA = \ +diff --git a/tools/Makefile.am b/tools/Makefile.am +index 1452d98..204e772 100644 +--- a/tools/Makefile.am ++++ b/tools/Makefile.am +@@ -188,6 +188,13 @@ virt_host_validate_LDADD = \ + ../gnulib/lib/libgnu.la \ + $(NULL) + ++if WITH_GNUTLS ++virt_host_validate_LDADD += ../src/libvirt-net-rpc.la \ ++ ../gnulib/lib/libgnu.la \ ++ $(NULL) ++endif ++ ++ + virt_host_validate_CFLAGS = \ + $(AM_CFLAGS) \ + $(NULL) +@@ -268,6 +275,12 @@ virt_admin_CFLAGS = \ + $(READLINE_CFLAGS) + BUILT_SOURCES = + ++if WITH_GNUTLS ++virsh_LDADD += ../src/libvirt-net-rpc.la \ ++ ../gnulib/lib/libgnu.la \ ++ $(NULL) ++endif ++ + if WITH_WIN_ICON + virsh_LDADD += virsh_win_icon.$(OBJEXT) + +-- +2.7.4 + diff --git a/external/meta-virtualization/recipes-extended/libvirt/libvirt_4.7.0.bb b/external/meta-virtualization/recipes-extended/libvirt/libvirt_4.7.0.bb new file mode 100644 index 00000000..270dc725 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/libvirt/libvirt_4.7.0.bb @@ -0,0 +1,328 @@ +DESCRIPTION = "A toolkit to interact with the virtualization capabilities of recent versions of Linux." +HOMEPAGE = "http://libvirt.org" +LICENSE = "LGPLv2.1+ & GPLv2+" +LICENSE_${PN}-ptest = "GPLv2+ & LGPLv2.1+" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://COPYING.LESSER;md5=4b54a1fd55a448865a0b32d41598759d" +SECTION = "console/tools" + +DEPENDS = "bridge-utils gnutls libxml2 lvm2 avahi parted curl libpcap util-linux e2fsprogs pm-utils \ + iptables dnsmasq readline libtasn1 libxslt-native acl libdevmapper libtirpc \ + ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'shadow-native', '', d)}" + +# libvirt-guests.sh needs gettext.sh +# +RDEPENDS_${PN} = "gettext-runtime" + +RDEPENDS_${PN}-ptest += "make gawk perl bash" + +RDEPENDS_libvirt-libvirtd += "bridge-utils iptables pm-utils dnsmasq netcat-openbsd" +RDEPENDS_libvirt-libvirtd_append_x86-64 = " dmidecode" +RDEPENDS_libvirt-libvirtd_append_x86 = " dmidecode" + +#connman blocks the 53 port and libvirtd can't start its DNS service +RCONFLICTS_${PN}_libvirtd = "connman" + +SRC_URI = "http://libvirt.org/sources/libvirt-${PV}.tar.xz;name=libvirt \ + file://tools-add-libvirt-net-rpc-to-virt-host-validate-when.patch \ + file://libvirtd.sh \ + file://libvirtd.conf \ + file://dnsmasq.conf \ + file://runptest.patch \ + file://run-ptest \ + file://libvirt-use-pkg-config-to-locate-libcap.patch \ + file://0001-to-fix-build-error.patch \ + file://install-missing-file.patch \ + file://0001-ptest-Remove-Windows-1252-check-from-esxutilstest.patch \ + file://configure.ac-search-for-rpc-rpc.h-in-the-sysroot.patch \ + file://lxc_monitor-Avoid-AB-BA-lock-race.patch \ + file://CVE-2019-3840.patch \ + " + +SRC_URI[libvirt.md5sum] = "38da6c33250dcbc0a6d68de5c758262b" +SRC_URI[libvirt.sha256sum] = "92c279f7321624ac5a37a81f8bbe8c8d2a16781da04c63c99c92d3de035767e4" + +inherit autotools gettext update-rc.d pkgconfig ptest systemd + +# Override the default set in autotools.bbclass so that we will use relative pathnames +# to our local m4 files. This prevents an "Argument list too long" error during configuration +# if our project is in a directory with an absolute pathname of more than about 125 characters. +# +acpaths = "-I ./m4" + +CACHED_CONFIGUREVARS += "\ +ac_cv_path_XMLCATLOG=/usr/bin/xmlcatalog \ +ac_cv_path_AUGPARSE=/usr/bin/augparse \ +ac_cv_path_DNSMASQ=/usr/bin/dnsmasq \ +ac_cv_path_BRCTL=/usr/sbin/brctl \ +ac_cv_path_TC=/sbin/tc \ +ac_cv_path_UDEVADM=/sbin/udevadm \ +ac_cv_path_MODPROBE=/sbin/modprobe \ +ac_cv_path_IP_PATH=/bin/ip \ +ac_cv_path_IPTABLES_PATH=/usr/sbin/iptables \ +ac_cv_path_IP6TABLES_PATH=/usr/sbin/ip6tables \ +ac_cv_path_MOUNT=/bin/mount \ +ac_cv_path_UMOUNT=/bin/umount \ +ac_cv_path_MKFS=/usr/sbin/mkfs \ +ac_cv_path_SHOWMOUNT=/usr/sbin/showmount \ +ac_cv_path_PVCREATE=/usr/sbin/pvcreate \ +ac_cv_path_VGCREATE=/usr/sbin/vgcreate \ +ac_cv_path_LVCREATE=/usr/sbin/lvcreate \ +ac_cv_path_PVREMOVE=/usr/sbin/pvremove \ +ac_cv_path_VGREMOVE=/usr/sbin/vgremove \ +ac_cv_path_LVREMOVE=/usr/sbin/lvremove \ +ac_cv_path_LVCHANGE=/usr/sbin/lvchange \ +ac_cv_path_VGCHANGE=/usr/sbin/vgchange \ +ac_cv_path_VGSCAN=/usr/sbin/vgscan \ +ac_cv_path_PVS=/usr/sbin/pvs \ +ac_cv_path_VGS=/usr/sbin/vgs \ +ac_cv_path_LVS=/usr/sbin/lvs \ +ac_cv_path_PARTED=/usr/sbin/parted \ +ac_cv_path_DMSETUP=/usr/sbin/dmsetup" + +# Ensure that libvirt uses polkit rather than policykit, whether the host has +# pkcheck installed or not, and ensure the path is correct per our config. +CACHED_CONFIGUREVARS += "ac_cv_path_PKCHECK_PATH=${bindir}/pkcheck" + +# Some other possible paths we are not yet setting +#ac_cv_path_RPCGEN= +#ac_cv_path_XSLTPROC= +#ac_cv_path_RADVD= +#ac_cv_path_UDEVSETTLE= +#ac_cv_path_EBTABLES_PATH= +#ac_cv_path_PKG_CONFIG= +#ac_cv_path_ac_pt_PKG_CONFIG +#ac_cv_path_POLKIT_AUTH= +#ac_cv_path_DTRACE= +#ac_cv_path_ISCSIADM= +#ac_cv_path_MSGFMT= +#ac_cv_path_GMSGFMT= +#ac_cv_path_XGETTEXT= +#ac_cv_path_MSGMERGE= +#ac_cv_path_SCRUB= +#ac_cv_path_PYTHON= + +ALLOW_EMPTY_${PN} = "1" + +PACKAGES =+ "${PN}-libvirtd ${PN}-virsh" + +ALLOW_EMPTY_${PN}-libvirtd = "1" + +FILES_${PN}-libvirtd = " \ + ${sysconfdir}/init.d \ + ${sysconfdir}/sysctl.d \ + ${sysconfdir}/logrotate.d \ + ${sysconfdir}/libvirt/libvirtd.conf \ + /usr/lib/sysctl.d/60-libvirtd.conf \ + ${sbindir}/libvirtd \ + ${systemd_unitdir}/system/* \ + ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', '${libexecdir}/libvirt-guests.sh', d)} \ + " + +FILES_${PN}-virsh = " \ + ${bindir}/virsh \ + ${datadir}/bash-completion/completions/virsh \ +" + +FILES_${PN} += "${libdir}/libvirt/connection-driver \ + ${datadir}/augeas \ + ${@bb.utils.contains('PACKAGECONFIG', 'polkit', '${datadir}/polkit-1', '', d)} \ + ${datadir}/bash-completion/completions/vsh \ + ${datadir}/bash-completion/completions/virt-admin \ + " + +FILES_${PN}-dbg += "${libdir}/libvirt/connection-driver/.debug ${libdir}/libvirt/lock-driver/.debug" +FILES_${PN}-staticdev += "${libdir}/*.a ${libdir}/libvirt/connection-driver/*.a ${libdir}/libvirt/lock-driver/*.a" + +CONFFILES_${PN} += "${sysconfdir}/libvirt/libvirt.conf \ + ${sysconfdir}/libvirt/lxc.conf \ + ${sysconfdir}/libvirt/qemu-lockd.conf \ + ${sysconfdir}/libvirt/qemu.conf \ + ${sysconfdir}/libvirt/virt-login-shell.conf \ + ${sysconfdir}/libvirt/virtlockd.conf" + +CONFFILES_${PN}-libvirtd = "${sysconfdir}/logrotate.d/libvirt ${sysconfdir}/logrotate.d/libvirt.lxc \ + ${sysconfdir}/logrotate.d/libvirt.qemu ${sysconfdir}/logrotate.d/libvirt.uml \ + ${sysconfdir}/libvirt/libvirtd.conf \ + /usr/lib/sysctl.d/libvirtd.conf" + +INITSCRIPT_PACKAGES = "${PN}-libvirtd" +INITSCRIPT_NAME_${PN}-libvirtd = "libvirtd" +INITSCRIPT_PARAMS_${PN}-libvirtd = "defaults 72" + +SYSTEMD_PACKAGES = "${PN}-libvirtd" +SYSTEMD_SERVICE_${PN}-libvirtd = " \ + libvirtd.service \ + virtlockd.service \ + libvirt-guests.service \ + virtlockd.socket \ + " + + +PRIVATE_LIBS_${PN}-ptest = " \ + libvirt-lxc.so.0 \ + libvirt.so.0 \ + libvirt-qemu.so.0 \ + lockd.so \ + libvirt_driver_secret.so \ + libvirt_driver_nodedev.so \ + libvirt_driver_vbox.so \ + libvirt_driver_interface.so \ + libvirt_driver_uml.so \ + libvirt_driver_network.so \ + libvirt_driver_nwfilter.so \ + libvirt_driver_qemu.so \ + libvirt_driver_storage.so \ + libvirt_driver_lxc.so \ + " + +# xen-minimal config +#PACKAGECONFIG ??= "xen libxl xen-inotify test remote libvirtd" + +# full config +PACKAGECONFIG ??= "qemu yajl uml openvz vmware vbox esx iproute2 lxc test \ + remote macvtap libvirtd netcf udev python ebtables \ + ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux audit libcap-ng', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'xen', 'libxl', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'polkit', '', d)} \ + " + +# qemu is NOT compatible with mips64 +PACKAGECONFIG_remove_mipsarchn32 = "qemu" +PACKAGECONFIG_remove_mipsarchn64 = "qemu" + +# enable,disable,depends,rdepends +# +PACKAGECONFIG[qemu] = "--with-qemu,--without-qemu,qemu," +PACKAGECONFIG[yajl] = "--with-yajl,--without-yajl,yajl,yajl" +PACKAGECONFIG[xenapi] = "--with-xenapi,--without-xenapi,," +PACKAGECONFIG[libxl] = "--with-libxl=${STAGING_DIR_TARGET}/lib,--without-libxl,libxl," +PACKAGECONFIG[uml] = "--with-uml, --without-uml,," +PACKAGECONFIG[openvz] = "--with-openvz,--without-openvz,," +PACKAGECONFIG[vmware] = "--with-vmware,--without-vmware,," +PACKAGECONFIG[phyp] = "--with-phyp,--without-phyp,," +PACKAGECONFIG[vbox] = "--with-vbox,--without-vbox,," +PACKAGECONFIG[esx] = "--with-esx,--without-esx,," +PACKAGECONFIG[hyperv] = "--with-hyperv,--without-hyperv,," +PACKAGECONFIG[polkit] = "--with-polkit,--without-polkit,polkit,polkit" +PACKAGECONFIG[lxc] = "--with-lxc,--without-lxc, lxc," +PACKAGECONFIG[test] = "--with-test=yes,--with-test=no,," +PACKAGECONFIG[remote] = "--with-remote,--without-remote,," +PACKAGECONFIG[macvtap] = "--with-macvtap=yes,--with-macvtap=no,libnl,libnl" +PACKAGECONFIG[libvirtd] = "--with-libvirtd,--without-libvirtd,," +PACKAGECONFIG[netcf] = "--with-netcf,--without-netcf,netcf,netcf" +PACKAGECONFIG[dtrace] = "--with-dtrace,--without-dtrace,," +PACKAGECONFIG[udev] = "--with-udev --with-pciaccess,--without-udev,udev libpciaccess," +PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux," +PACKAGECONFIG[ebtables] = "ac_cv_path_EBTABLES_PATH=/sbin/ebtables,ac_cv_path_EBTABLES_PATH=,ebtables,ebtables" +PACKAGECONFIG[python] = ",,python," +PACKAGECONFIG[sasl] = "--with-sasl,--without-sasl,cyrus-sasl,cyrus-sasl" +PACKAGECONFIG[iproute2] = "ac_cv_path_IP_PATH=/sbin/ip,ac_cv_path_IP_PATH=,iproute2,iproute2" +PACKAGECONFIG[numactl] = "--with-numactl,--without-numactl,numactl," +PACKAGECONFIG[fuse] = "--with-fuse,--without-fuse,fuse," +PACKAGECONFIG[audit] = "--with-audit,--without-audit,audit," +PACKAGECONFIG[libcap-ng] = "--with-capng,--without-capng,libcap-ng," +PACKAGECONFIG[wireshark] = "--with-wireshark-dissector,--without-wireshark-dissector,wireshark libwsutil," + +# Enable the Python tool support +require libvirt-python.inc + +do_install_append() { + install -d ${D}/etc/init.d + install -d ${D}/etc/libvirt + install -d ${D}/etc/dnsmasq.d + + install -m 0755 ${WORKDIR}/libvirtd.sh ${D}/etc/init.d/libvirtd + install -m 0644 ${WORKDIR}/libvirtd.conf ${D}/etc/libvirt/libvirtd.conf + + if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then + # This will wind up in the libvirtd package, but will NOT be invoked by default. + # + mv ${D}/${libexecdir}/libvirt-guests.sh ${D}/${sysconfdir}/init.d + fi + + if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then + # This variable is used by libvirtd.service to start libvirtd in the right mode + sed -i '/#LIBVIRTD_ARGS="--listen"/a LIBVIRTD_ARGS="--listen --daemon"' ${D}/${sysconfdir}/sysconfig/libvirtd + + # We can't use 'notify' when we don't support 'sd_notify' dbus capabilities. + sed -i -e 's/Type=notify/Type=forking/' \ + -e '/Type=forking/a PIDFile=${localstatedir}/run/libvirtd.pid' \ + ${D}/${systemd_unitdir}/system/libvirtd.service + fi + + # The /var/run/libvirt directories created by the Makefile + # are wiped out in volatile, we need to create these at boot. + rm -rf ${D}${localstatedir}/run + install -d ${D}${sysconfdir}/default/volatiles + echo "d root root 0755 ${localstatedir}/run/libvirt none" \ + > ${D}${sysconfdir}/default/volatiles/99_libvirt + echo "d root root 0755 ${localstatedir}/run/libvirt/lockd none" \ + >> ${D}${sysconfdir}/default/volatiles/99_libvirt + echo "d root root 0755 ${localstatedir}/run/libvirt/lxc none" \ + >> ${D}${sysconfdir}/default/volatiles/99_libvirt + echo "d root root 0755 ${localstatedir}/run/libvirt/network none" \ + >> ${D}${sysconfdir}/default/volatiles/99_libvirt + echo "d root root 0755 ${localstatedir}/run/libvirt/qemu none" \ + >> ${D}${sysconfdir}/default/volatiles/99_libvirt + + # Manually set permissions and ownership to match polkit recipe + if ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'true', 'false', d)}; then + install -d -m 0700 ${D}/${datadir}/polkit-1/rules.d + chown polkitd ${D}/${datadir}/polkit-1/rules.d + chgrp root ${D}/${datadir}/polkit-1/rules.d + else + rm -rf ${D}/${datadir}/polkit-1 + fi + + # disable seccomp_sandbox + if [ -e ${D}${sysconfdir}/libvirt/qemu.conf ] ; then + sed -i '/^#seccomp_sandbox = 1/aseccomp_sandbox = 0' \ + ${D}${sysconfdir}/libvirt/qemu.conf + fi + + # Add hook support for libvirt + mkdir -p ${D}/etc/libvirt/hooks + + # 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 -m 644 ${WORKDIR}/dnsmasq.conf ${D}/${sysconfdir}/dnsmasq.d/libvirt-daemon + + # remove .la references to our working diretory + for i in `find ${D}${libdir} -type f -name *.la`; do + sed -i -e 's#-L${B}/src/.libs##g' $i + done +} + +EXTRA_OECONF += " \ + --with-init-script=systemd \ + --with-test-suite \ + " + +EXTRA_OEMAKE = "BUILD_DIR=${B} DEST_DIR=${D}${PTEST_PATH} PTEST_DIR=${PTEST_PATH} SYSTEMD_UNIT_DIR=${systemd_system_unitdir}" + +do_compile_ptest() { + oe_runmake -C tests buildtest-TESTS +} + +do_install_ptest() { + oe_runmake -C tests install-ptest + + find ${S}/tests -maxdepth 1 -type d -exec cp -r {} ${D}${PTEST_PATH}/tests/ \; + + # remove .la files for ptest, they aren't required and can trigger QA errors + for i in `find ${D}${PTEST_PATH} -type f \( -name *.la -o -name *.o \)`; do + rm -f $i + done +} + +pkg_postinst_${PN}() { + if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then + /etc/init.d/populate-volatile.sh update + fi +} + +python () { + if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): + d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") +} diff --git a/external/meta-virtualization/recipes-extended/libvmi/libvmi_git.bb b/external/meta-virtualization/recipes-extended/libvmi/libvmi_git.bb new file mode 100644 index 00000000..88fa5d30 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/libvmi/libvmi_git.bb @@ -0,0 +1,41 @@ +DESCRIPTION = "An introspection library, written in C, focused on reading \ + and writing memory from virtual machines (VM's)." +HOMEPAGE = "https://github.com/libvmi/libvmi" +LICENSE = "LGPLv3" +LIC_FILES_CHKSUM = "file://COPYING.LESSER;md5=e6a600fd5e1d9cbde2d983680233ad02" +SECTION = "console/tools" +PV = "0.12.0" + +DEPENDS = "libvirt libcheck bison fuse byacc-native" + +SRC_URI = "git://github.com/libvmi/libvmi.git \ +" + +SRCREV = "6934e8a4758018983ec53ec791dd14a7d6ac31a9" + +S = "${WORKDIR}/git" + +inherit autotools-brokensep pkgconfig + +# Noramlly dynamic libs would be of the form libXX.so.1.0.0 in which case +# bitbake should be able to properly populate the -dev package and the main +# packages. Since libvmi uses the form libXX.1.0.0.so it breaks this automatic +# packaging so we need to be more explicit about what goes where. +FILES_${PN} += "${libdir}/libvmi-0.9.so" +FILES_${PN}-dev = "${includedir} ${libdir}/${BPN}.so ${libdir}/*.la \ + ${libdir}/*.o ${libdir}/pkgconfig ${datadir}/pkgconfig \ + ${datadir}/aclocal ${base_libdir}/*.o \ + ${libdir}/${BPN}/*.la ${base_libdir}/*.la" + +PACKAGECONFIG ??= "json-c" +PACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen," +PACKAGECONFIG[json-c] = ",,json-c," + +# We include a sample conf file to which we have added +do_install_append () { + mkdir ${D}${sysconfdir} + cp etc/*.conf ${D}${sysconfdir} +} + +# Construction of grammar.h is not parallel safe. +PARALLEL_MAKE = "-j1" diff --git a/external/meta-virtualization/recipes-extended/nagios/nagios-common.inc b/external/meta-virtualization/recipes-extended/nagios/nagios-common.inc new file mode 100644 index 00000000..c173041c --- /dev/null +++ b/external/meta-virtualization/recipes-extended/nagios/nagios-common.inc @@ -0,0 +1,26 @@ +NAGIOS_CONF_DIR = "${sysconfdir}/nagios" +NAGIOS_PLUGIN_DIR = "${libdir}/nagios/plugins" +NAGIOS_PLUGIN_CONF_DIR = "${NAGIOS_CONF_DIR}/plugins" +NAGIOS_STATE_DIR = "${localstatedir}/nagios" + +NAGIOS_USER = "nagios" +NAGIOS_GROUP = "nagios" + +EXTRA_OECONF += "--sysconfdir=${NAGIOS_CONF_DIR} \ + --libexecdir=${NAGIOS_PLUGIN_DIR} \ + --localstatedir=${NAGIOS_STATE_DIR} \ +" + +FILES_${PN}-dbg += "${NAGIOS_PLUGIN_DIR}/.debug" + +DEPENDS = "nagios-core" + +COMPATIBLE_HOST_aarch64 = "null" + +inherit useradd + +USERADD_PACKAGES = "${PN}" +GROUPADD_PARAM_${PN} = "-r ${NAGIOS_GROUP}; -r nagcmd" +USERADD_PARAM_${PN} = "-r -M -g ${NAGIOS_GROUP} ${NAGIOS_USER}" + +FILESYSTEM_PERMS_TABLES_append = " files/fs-perms-nagios.txt" diff --git a/external/meta-virtualization/recipes-extended/nagios/nagios-core/0001-fix-autoheader-error.patch b/external/meta-virtualization/recipes-extended/nagios/nagios-core/0001-fix-autoheader-error.patch new file mode 100644 index 00000000..014ed1d8 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/nagios/nagios-core/0001-fix-autoheader-error.patch @@ -0,0 +1,63 @@ +From 3c51d942f6da08045351ce61cc7f426fa0855489 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Fri, 31 Aug 2018 10:51:36 +0800 +Subject: [PATCH] fix autoheader error + +Upstream-Status: Pending + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + configure.ac | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 17e436d..16b3e71 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -388,7 +388,7 @@ AC_ARG_WITH(iobroker, + case $IOBROKER_METHOD in + epoll*) + if test "$GLIBC_NEWER_2_4" -eq 1 -a "x$ac_cv_header_sys_epoll_h" = "xyes"; then +- AC_DEFINE([IOBROKER_USES_EPOLL]) ++ AC_DEFINE([IOBROKER_USES_EPOLL], [1], [iobroker uses epoll]) + else + echo "\"epoll\" is not available as an iobroker method." + echo "Please use one of the other options." +@@ -397,7 +397,7 @@ epoll*) + ;; + poll*) + if test "x$ac_cv_header_sys_poll_h" = "xyes" -o "x$ac_cv_header_poll_h" = "xyes"; then +- AC_DEFINE([IOBROKER_USES_POLL]) ++ AC_DEFINE([IOBROKER_USES_POLL], [1], [iobroker uses poll]) + else + echo "\"poll\" is not available as an iobroker method." + echo "Please use one of the other options." +@@ -406,7 +406,7 @@ poll*) + ;; + select*) + if test "x$ac_cv_header_sys_select_h" = "xyes"; then +- AC_DEFINE([IOBROKER_USES_SELECT]) ++ AC_DEFINE([IOBROKER_USES_SELECT], [1], [iobroker uses select]) + else + echo "\"select\" is not available as an iobroker method." + echo "Please use one of the other options." +@@ -415,13 +415,13 @@ select*) + ;; + none*) + if test "$GLIBC_NEWER_2_4" -eq 1 -a "x$ac_cv_header_sys_epoll_h" = "xyes"; then +- AC_DEFINE([IOBROKER_USES_EPOLL]) ++ AC_DEFINE([IOBROKER_USES_EPOLL], [1], [iobroker uses epoll]) + IOBROKER_METHOD="epoll" + elif test "x$ac_cv_header_sys_poll_h" = "xyes" -o "x$ac_cv_header_poll_h" = "xyes"; then +- AC_DEFINE([IOBROKER_USES_POLL]) ++ AC_DEFINE([IOBROKER_USES_POLL], [1], [iobroker uses poll]) + IOBROKER_METHOD="poll" + elif test "x$ac_cv_header_sys_select_h" = "xyes"; then +- AC_DEFINE([IOBROKER_USES_SELECT]) ++ AC_DEFINE([IOBROKER_USES_SELECT], [1], [iobroker uses select]) + IOBROKER_METHOD="select" + else + echo "There are no available options for iobroker polling" +-- +2.7.4 + diff --git a/external/meta-virtualization/recipes-extended/nagios/nagios-core/0001-fix-compile-error-of-missing-headers.patch b/external/meta-virtualization/recipes-extended/nagios/nagios-core/0001-fix-compile-error-of-missing-headers.patch new file mode 100644 index 00000000..7f4cfbd7 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/nagios/nagios-core/0001-fix-compile-error-of-missing-headers.patch @@ -0,0 +1,75 @@ +From a5e12350cb25b2f9289c0d27e26afc337652d42e Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Fri, 31 Aug 2018 13:33:31 +0800 +Subject: [PATCH] fix compile error of missing headers + +Upstream-Status: Pending + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + cgi/getcgi.c | 3 ++- + include/shared.h | 31 +++++++++++++++++++++++++++++++ + 2 files changed, 33 insertions(+), 1 deletion(-) + +diff --git a/cgi/getcgi.c b/cgi/getcgi.c +index 37b479f..1f83e11 100644 +--- a/cgi/getcgi.c ++++ b/cgi/getcgi.c +@@ -7,10 +7,11 @@ + + #include "../include/config.h" + #include "../include/getcgi.h" ++#include "../include/shared.h" ++ + #include <stdio.h> + #include <stdlib.h> + +- + #undef PARANOID_CGI_INPUT + + +diff --git a/include/shared.h b/include/shared.h +index 84836c7..1dfa0c7 100644 +--- a/include/shared.h ++++ b/include/shared.h +@@ -1,6 +1,37 @@ + #ifndef NAGIOS_SHARED_H_INCLUDED + #define NAGIOS_SHARED_H_INCLUDED + ++#include <stdio.h> ++#include <sys/types.h> ++#include <sys/stat.h> ++#include <sys/socket.h> ++#include <sys/mman.h> ++#include <stdlib.h> ++#include <stddef.h> ++#include <stdlib.h> ++#include <memory.h> ++#include <string.h> ++#include <strings.h> ++#include <inttypes.h> ++#include <stdint.h> ++#include <unistd.h> ++#include <dirent.h> ++#include <math.h> ++#include <fcntl.h> ++#include <regex.h> ++#include <ctype.h> ++#include <sys/prctl.h> ++#include <stdarg.h> ++#include <dlfcn.h> ++#include <getopt.h> ++#include <syslog.h> ++#include <pwd.h> ++#include <grp.h> ++#include <netdb.h> ++#include <wchar.h> ++#include <locale.h> ++#include <limits.h> ++ + #include <time.h> + #include "lib/libnagios.h" + +-- +2.7.4 + diff --git a/external/meta-virtualization/recipes-extended/nagios/nagios-core/0001-fix-segment-fault.patch b/external/meta-virtualization/recipes-extended/nagios/nagios-core/0001-fix-segment-fault.patch new file mode 100644 index 00000000..1ea8da9c --- /dev/null +++ b/external/meta-virtualization/recipes-extended/nagios/nagios-core/0001-fix-segment-fault.patch @@ -0,0 +1,54 @@ +From 65e4539c6eca215d8d79ef8acc5c8842b886752a Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Mon, 3 Sep 2018 13:15:29 +0800 +Subject: [PATCH] fix segment fault + +When using strdup(dirname(cfgfile)) directly, we will have segment +fault. This happens at least for glibc 2.28. So we do it step by +step, and this would avoid the segment fault. + +Upstream-Status: Pending + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + include/shared.h | 1 + + xdata/xodtemplate.c | 4 +++- + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/include/shared.h b/include/shared.h +index 1dfa0c7..0188c7d 100644 +--- a/include/shared.h ++++ b/include/shared.h +@@ -31,6 +31,7 @@ + #include <wchar.h> + #include <locale.h> + #include <limits.h> ++#include <libgen.h> + + #include <time.h> + #include "lib/libnagios.h" +diff --git a/xdata/xodtemplate.c b/xdata/xodtemplate.c +index 33d51f4..da32e69 100644 +--- a/xdata/xodtemplate.c ++++ b/xdata/xodtemplate.c +@@ -187,6 +187,7 @@ static void xodtemplate_free_template_skiplists(void) { + int xodtemplate_read_config_data(const char *main_config_file, int options) { + #ifdef NSCORE + char *cfgfile = NULL; ++ char *cfgfile_dir = NULL; + char *config_base_dir = NULL; + char *input = NULL; + char *var = NULL; +@@ -261,7 +262,8 @@ int xodtemplate_read_config_data(const char *main_config_file, int options) { + printf("Unable to allocate memory!\n"); + return ERROR; + } +- config_base_dir = (char *)strdup(dirname(cfgfile)); ++ cfgfile_dir = dirname(cfgfile); ++ config_base_dir = (char *)strdup(cfgfile_dir); + my_free(cfgfile); + + /* open the main config file for reading (we need to find all the config files to read) */ +-- +2.7.4 + diff --git a/external/meta-virtualization/recipes-extended/nagios/nagios-core/eventhandlers_nagioscmd_path.patch b/external/meta-virtualization/recipes-extended/nagios/nagios-core/eventhandlers_nagioscmd_path.patch new file mode 100644 index 00000000..c767162c --- /dev/null +++ b/external/meta-virtualization/recipes-extended/nagios/nagios-core/eventhandlers_nagioscmd_path.patch @@ -0,0 +1,73 @@ +change eventhandlers nagioscmd path + +Modify nagios.cmd path to the right location +at "/var/nagios/rw/nagios.cmd" + +Signed-off-by: Rickard Engberg <rickard.engberg@windriver.com> +Signed-off-by: Vu Tran <vu.tran@windriver.com> + +diff --git a/contrib/eventhandlers/disable_active_service_checks b/contrib/eventhandlers/disable_active_service_checks +index c01f2be..2c2880b 100755 +--- a/contrib/eventhandlers/disable_active_service_checks ++++ b/contrib/eventhandlers/disable_active_service_checks +@@ -16,7 +16,7 @@ + + printfcmd="/usr/bin/printf" + +-CommandFile="/usr/local/nagios/var/rw/nagios.cmd" ++CommandFile="/var/nagios/rw/nagios.cmd" + + # get the current date/time in seconds since UNIX epoch + datetime=`date +%s` +diff --git a/contrib/eventhandlers/disable_notifications b/contrib/eventhandlers/disable_notifications +index a92bb7a..b2c9c06 100755 +--- a/contrib/eventhandlers/disable_notifications ++++ b/contrib/eventhandlers/disable_notifications +@@ -14,7 +14,7 @@ + + printfcmd="/usr/bin/printf" + +-CommandFile="/usr/local/nagios/var/rw/nagios.cmd" ++CommandFile="/var/nagios/rw/nagios.cmd" + + # get the current date/time in seconds since UNIX epoch + datetime=`date +%s` +diff --git a/contrib/eventhandlers/enable_active_service_checks b/contrib/eventhandlers/enable_active_service_checks +index 423c8d9..631fa00 100755 +--- a/contrib/eventhandlers/enable_active_service_checks ++++ b/contrib/eventhandlers/enable_active_service_checks +@@ -16,7 +16,7 @@ + + printfcmd="/usr/bin/printf" + +-CommandFile="/usr/local/nagios/var/rw/nagios.cmd" ++CommandFile="/var/nagios/rw/nagios.cmd" + + # get the current date/time in seconds since UNIX epoch + datetime=`date +%s` +diff --git a/contrib/eventhandlers/enable_notifications b/contrib/eventhandlers/enable_notifications +index 0d3f13d..2cc0b47 100755 +--- a/contrib/eventhandlers/enable_notifications ++++ b/contrib/eventhandlers/enable_notifications +@@ -14,7 +14,7 @@ + + printfcmd="/usr/bin/printf" + +-CommandFile="/usr/local/nagios/var/rw/nagios.cmd" ++CommandFile="/var/nagios/rw/nagios.cmd" + + # get the current date/time in seconds since UNIX epoch + datetime=`date +%s` +diff --git a/contrib/eventhandlers/submit_check_result b/contrib/eventhandlers/submit_check_result +index 5d89f31..790a988 100755 +--- a/contrib/eventhandlers/submit_check_result ++++ b/contrib/eventhandlers/submit_check_result +@@ -24,7 +24,7 @@ + + echocmd="/bin/echo" + +-CommandFile="/usr/local/nagios/var/rw/nagios.cmd" ++CommandFile="/var/nagios/rw/nagios.cmd" + + # get the current date/time in seconds since UNIX epoch + datetime=`date +%s` diff --git a/external/meta-virtualization/recipes-extended/nagios/nagios-core/nagios-core-systemd-volatile.conf b/external/meta-virtualization/recipes-extended/nagios/nagios-core/nagios-core-systemd-volatile.conf new file mode 100644 index 00000000..134fb854 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/nagios/nagios-core/nagios-core-systemd-volatile.conf @@ -0,0 +1,2 @@ +d /var/nagios 0755 nagios nagios - +d /var/run/nagios 0755 nagios nagios - diff --git a/external/meta-virtualization/recipes-extended/nagios/nagios-core/nagios-core.service b/external/meta-virtualization/recipes-extended/nagios/nagios-core/nagios-core.service new file mode 100644 index 00000000..61fda3f7 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/nagios/nagios-core/nagios-core.service @@ -0,0 +1,18 @@ +[Unit] +Description=Nagios core +After=network.target local-fs.target + +[Service] +Type=forking +User=nagios +Group=nagios +PIDFile=/var/run/nagios/nagios.pid +# Verify Nagios config before start as upstream suggested +ExecStartPre=/usr/bin/nagios -v /etc/nagios/nagios.cfg +ExecStart=/usr/bin/nagios -d /etc/nagios/nagios.cfg +ExecStop=/bin/kill -TERM ${MAINPID} +ExecStopPost=/bin/rm -f /var/spool/nagios/cmd/nagios.cmd +ExecReload=/bin/kill -HUP ${MAINPID} + +[Install] +WantedBy=multi-user.target diff --git a/external/meta-virtualization/recipes-extended/nagios/nagios-core/volatiles b/external/meta-virtualization/recipes-extended/nagios/nagios-core/volatiles new file mode 100644 index 00000000..e9bb7680 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/nagios/nagios-core/volatiles @@ -0,0 +1,2 @@ +d nagios nagios 0755 /var/nagios none +d nagios nagios 0755 /var/run/nagios none diff --git a/external/meta-virtualization/recipes-extended/nagios/nagios-core_4.4.2.bb b/external/meta-virtualization/recipes-extended/nagios/nagios-core_4.4.2.bb new file mode 100644 index 00000000..b2196eb3 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/nagios/nagios-core_4.4.2.bb @@ -0,0 +1,151 @@ +require nagios-common.inc + +DESCRIPTION = "A host/service/network monitoring and management system core files" +HOMEPAGE = "http://www.nagios.org" +SECTION = "console/network" +PRIORITY = "optional" +LICENSE = "GPLv2" + +LIC_FILES_CHKSUM = "file://LICENSE;md5=4c4203caac58013115c9ca4b85f296ae" + +SRCNAME = "nagios" + +SRC_URI = "http://prdownloads.sourceforge.net/sourceforge/${SRCNAME}/${SRCNAME}-${PV}.tar.gz \ + file://eventhandlers_nagioscmd_path.patch \ + file://0001-fix-autoheader-error.patch \ + file://0001-fix-compile-error-of-missing-headers.patch \ + file://0001-fix-segment-fault.patch \ + file://volatiles \ + file://nagios-core.service \ + file://nagios-core-systemd-volatile.conf \ + " + +SRC_URI[md5sum] = "7a9736281d4e2ebe4f4569a782f733c5" +SRC_URI[sha256sum] = "3418923f326aa86dc8c84cfd0df788fa495a90d772f8071acf40fdbef0736853" + +S = "${WORKDIR}/${SRCNAME}-${PV}" + +inherit autotools-brokensep update-rc.d systemd + +DEPENDS = "gd unzip-native" + +RDEPENDS_${PN} += "\ + gd \ + libpng \ + fontconfig \ + apache2 \ + php \ + nagios-base \ +" + +acpaths = "-I ${S}/autoconf-macros" + +# Set default password for the hardcoded Nagios admin user "nagiosadmin". +# If this variable is empty then will prompt user for password. +NAGIOS_DEFAULT_ADMINUSER_PASSWORD ??= "password" +NAGIOS_CGIBIN_DIR = "${libdir}/nagios/cgi-bin" + +EXTRA_OECONF += "--sbindir=${NAGIOS_CGIBIN_DIR} \ + --datadir=${datadir}/nagios/htdocs \ + --with-command-group=nagcmd \ + --with-httpd-conf=${sysconfdir}/apache2/conf.d \ + --with-lockfile=${localstatedir}/run/nagios/nagios.pid \ + --with-init-dir=${sysconfdir}/init.d \ +" + +# Prevent nagios from stripping binaries, bitbake will take care of that +EXTRA_OECONF += "ac_cv_path_STRIP=true" + +# Prevent nagios from using dynamic libtool library +EXTRA_OECONF += "ac_cv_header_ltdl_h=no" + +# Prevent nagios from suffering host contamination if host has /bin/perl +EXTRA_OECONF += "ac_cv_path_PERL=${bindir}/perl" + +# Set to "1" to allow nagios-core post-init to modify Apache configuration +NAGIOS_MODIFY_APACHE ??= "1" + +do_configure_prepend() { + # rename these macros to have .m4 suffix so that autoreconf could recognize them + for macro in `ls ${S}/autoconf-macros/ax_nagios_get_*`; do + mv $macro $macro.m4 + done +} + +do_compile() { + oe_runmake all +} + +do_install() { + oe_runmake 'DESTDIR=${D}' install + oe_runmake 'DESTDIR=${D}' install-init + oe_runmake 'DESTDIR=${D}' install-config + oe_runmake 'DESTDIR=${D}' install-commandmode + + install -d ${D}${sysconfdir}/apache2/conf.d + oe_runmake 'DESTDIR=${D}' install-webconf + + install -d ${D}${NAGIOS_PLUGIN_CONF_DIR} + + # There is no install target for the contributed eventhandlers so we + # just do it. + install -d ${D}${NAGIOS_PLUGIN_DIR}/eventhandlers + for f in ${S}/contrib/eventhandlers/* ; do + if ! [ -f $f ] ; then + continue; + fi + install $f ${D}${NAGIOS_PLUGIN_DIR}/eventhandlers/ + done + + echo "cfg_dir=${NAGIOS_PLUGIN_CONF_DIR}" >> ${D}${NAGIOS_CONF_DIR}/nagios.cfg + + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}${systemd_unitdir}/system + install -m 644 ${WORKDIR}/nagios-core.service ${D}${systemd_unitdir}/system/ + # use our own service file + rm -f ${D}${systemd_unitdir}/system/nagios.service + install -d ${D}${sysconfdir}/tmpfiles.d + install -m 755 ${WORKDIR}/nagios-core-systemd-volatile.conf ${D}${sysconfdir}/tmpfiles.d/nagios-core-volatile.conf + else + install -d ${D}${sysconfdir}/default/volatiles + install -m 0644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/99_nagios + fi +} + +pkg_postinst_ontarget_${PN}-setup () { + # Set password for nagiosadmin user + if [ -z "${NAGIOS_DEFAULT_ADMINUSER_PASSWORD}" ]; then + htpasswd -c ${NAGIOS_CONF_DIR}/htpasswd.users nagiosadmin + else + htpasswd -b -c ${NAGIOS_CONF_DIR}/htpasswd.users nagiosadmin \ + "${NAGIOS_DEFAULT_ADMINUSER_PASSWORD}" + fi + + # Apache2 might by default turn off CGI + if [ "${NAGIOS_MODIFY_APACHE}" == "1" ] && [ -f "${sysconfdir}/apache2/httpd.conf" ]; then + sed -e 's/^#LoadModule cgid_module/LoadModule cgid_module/g' -i ${sysconfdir}/apache2/httpd.conf + fi +} + +PACKAGES += "${SRCNAME}-base ${PN}-setup" + +FILES_${PN} += "${datadir} \ + ${NAGIOS_PLUGIN_DIR} \ + ${NAGIOS_CGIBIN_DIR} \ +" + +FILES_${PN}-dbg += "${NAGIOS_CGIBIN_DIR}/.debug" + +ALLOW_EMPTY_${SRCNAME}-base = "1" +ALLOW_EMPTY_${PN}-setup = "1" + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE_${PN} = "nagios-core.service" +SYSTEMD_AUTO_ENABLE_${PN} = "enable" + +USERADD_PACKAGES += "${SRCNAME}-base" +GROUPADD_PARAM_${SRCNAME}-base = "-r ${NAGIOS_GROUP}" +USERADD_PARAM_${SRCNAME}-base = "-r -M -g ${NAGIOS_GROUP} ${NAGIOS_USER}" + +INITSCRIPT_NAME = "nagios" +INITSCRIPT_PARAMS = "defaults" diff --git a/external/meta-virtualization/recipes-extended/nagios/nagios-nrpe/check_nrpe.cfg b/external/meta-virtualization/recipes-extended/nagios/nagios-nrpe/check_nrpe.cfg new file mode 100644 index 00000000..48f3fa5a --- /dev/null +++ b/external/meta-virtualization/recipes-extended/nagios/nagios-nrpe/check_nrpe.cfg @@ -0,0 +1,11 @@ +# this command runs a program $ARG1$ with arguments $ARG2$ +define command { + command_name check_nrpe + command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$ +} + +# this command runs a program $ARG1$ with no arguments +define command { + command_name check_nrpe_1arg + command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ +} diff --git a/external/meta-virtualization/recipes-extended/nagios/nagios-nrpe/fix-compile-without-openssl.patch b/external/meta-virtualization/recipes-extended/nagios/nagios-nrpe/fix-compile-without-openssl.patch new file mode 100644 index 00000000..ab913a8f --- /dev/null +++ b/external/meta-virtualization/recipes-extended/nagios/nagios-nrpe/fix-compile-without-openssl.patch @@ -0,0 +1,43 @@ +fix compile without openssl + +Build with --disable-ssl causes the build to break with +this error: + +error: unknown type name 'SSL' + void complete_SSL_shutdown( SSL *); + +Signed-off-by: Rickard Engberg <rickard.engberg@windriver.com> +Signed-off-by: Vu Tran <vu.tran@windriver.com> + +Index: nrpe-2.15/src/nrpe.c +=================================================================== +--- nrpe-2.15.orig/src/nrpe.c 2013-09-06 17:27:13.000000000 +0200 ++++ nrpe-2.15/src/nrpe.c 2013-11-20 23:22:49.546791020 +0100 +@@ -99,9 +99,9 @@ + int debug=FALSE; + int use_src=FALSE; /* Define parameter for SRC option */ + +- ++#ifdef HAVE_SSL + void complete_SSL_shutdown( SSL *); +- ++#endif + + int main(int argc, char **argv){ + int result=OK; +@@ -1796,6 +1796,7 @@ + return OK; + } + ++#ifdef HAVE_SSL + void complete_SSL_shutdown( SSL *ssl) { + + /* +@@ -1816,6 +1817,7 @@ + if( SSL_shutdown( ssl)) break; + } + } ++#endif + + /* bail if daemon is running as root */ + int check_privileges(void){ diff --git a/external/meta-virtualization/recipes-extended/nagios/nagios-nrpe/fix-configure-uses-host-openssl.patch b/external/meta-virtualization/recipes-extended/nagios/nagios-nrpe/fix-configure-uses-host-openssl.patch new file mode 100644 index 00000000..920aabfc --- /dev/null +++ b/external/meta-virtualization/recipes-extended/nagios/nagios-nrpe/fix-configure-uses-host-openssl.patch @@ -0,0 +1,52 @@ +fix configure uses host openssl + +include/dh.h file is needed to be generated with command: + +openssl dhparam -C 512 + +just do not use openssl from host. + +Signed-off-by: Rickard Engberg <rickard.engberg@windriver.com> +Signed-off-by: Vu Tran <vu.tran@windriver.com> + +Index: nrpe-2.15/configure.in +=================================================================== +--- nrpe-2.15.orig/configure.in 2013-09-06 17:27:13.000000000 +0200 ++++ nrpe-2.15/configure.in 2013-11-21 14:09:31.798606782 +0100 +@@ -330,17 +330,6 @@ + + AC_DEFINE_UNQUOTED(HAVE_SSL,[1],[Have SSL support]) + AC_SUBST(HAVE_SSL) +- +- dnl Generate DH parameters +- echo "" +- echo "*** Generating DH Parameters for SSL/TLS ***" +- if test -f "$ssldir/sbin/openssl"; then +- sslbin=$ssldir/sbin/openssl +- else +- sslbin=$ssldir/bin/openssl +- fi +- # awk to strip off meta data at bottom of dhparam output +- $sslbin dhparam -C 512 | awk '/^-----/ {exit} {print}' > include/dh.h + fi + fi + +Index: nrpe-2.15/configure +=================================================================== +--- nrpe-2.15.orig/configure 2013-09-06 17:27:13.000000000 +0200 ++++ nrpe-2.15/configure 2013-11-21 14:11:45.491269701 +0100 +@@ -6738,14 +6738,6 @@ + + + echo "" +- echo "*** Generating DH Parameters for SSL/TLS ***" +- if test -f "$ssldir/sbin/openssl"; then +- sslbin=$ssldir/sbin/openssl +- else +- sslbin=$ssldir/bin/openssl +- fi +- # awk to strip off meta data at bottom of dhparam output +- $sslbin dhparam -C 512 | awk '/^-----/ {exit} {print}' > include/dh.h + fi + fi + diff --git a/external/meta-virtualization/recipes-extended/nagios/nagios-nrpe/nagios-nrpe.service b/external/meta-virtualization/recipes-extended/nagios/nagios-nrpe/nagios-nrpe.service new file mode 100644 index 00000000..c5a0bdac --- /dev/null +++ b/external/meta-virtualization/recipes-extended/nagios/nagios-nrpe/nagios-nrpe.service @@ -0,0 +1,10 @@ +[Unit] +Description=Nagios nrpe plugin +After=syslog.target network.target + +[Service] +ExecStart=/usr/bin/nrpe -c /etc/nagios/nrpe.cfg -f +TimeoutSec=60 + +[Install] +WantedBy=multi-user.target diff --git a/external/meta-virtualization/recipes-extended/nagios/nagios-nrpe_3.2.1.bb b/external/meta-virtualization/recipes-extended/nagios/nagios-nrpe_3.2.1.bb new file mode 100644 index 00000000..94933367 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/nagios/nagios-nrpe_3.2.1.bb @@ -0,0 +1,100 @@ +require nagios-common.inc + +DESCRIPTION = "Nagios Remote Plugin Executor" +HOMEPAGE = "http://exchange.nagios.org" +SECTION = "console/network" +PRIORITY = "optional" +LICENSE = "GPLv2" + +LIC_FILES_CHKSUM = "file://src/nrpe.c;beginline=1;endline=35;md5=0dadd78599abbc737af81432702e9161" + +SRCNAME = "nrpe" + +SRC_URI = "https://github.com/NagiosEnterprises/nrpe/releases/download/${SRCNAME}-${PV}/${SRCNAME}-${PV}.tar.gz \ + file://check_nrpe.cfg \ + file://nagios-nrpe.service \ +" + +SRC_URI[md5sum] = "8997e195fea93cdceb8c7ed8ac1d43bc" +SRC_URI[sha256sum] = "8ad2d1846ab9011fdd2942b8fc0c99dfad9a97e57f4a3e6e394a4ead99c0f1f0" + +S = "${WORKDIR}/${SRCNAME}-${PV}" + +inherit autotools-brokensep update-rc.d systemd + +# IP address of server which proxy should connect to +MONITORING_PROXY_SERVER_IP ??= "192.168.7.2" + +# IP address of server which agent should connect to +MONITORING_AGENT_SERVER_IP ??= "192.168.7.4" + +EXTRA_OECONF += "--with-nrpe-user=${NAGIOS_USER} \ + --with-nrpe-group=${NAGIOS_GROUP} \ + ac_cv_lib_wrap_main=no \ + ac_cv_path_PERL=${bindir}/perl \ +" + +EXTRA_OECONF_SSL = "--with-ssl=${STAGING_DIR_HOST} \ + --with-ssl-inc=${STAGING_DIR_HOST}${includedir} \ + --with-ssl-lib=${STAGING_DIR_HOST}${libdir} \ +" + +PACKAGECONFIG[ssl] = "${EXTRA_OECONF_SSL},--disable-ssl,openssl," +PACKAGECONFIG[cmdargs] = "--enable-command-args,--disable-command-args,," +PACKAGECONFIG[bashcomp] = "--enable-bash-command-substitution,--disable-bash-command-substitution,," + +PACKAGECONFIG ??= "cmdargs bashcomp" + +do_configure() { + oe_runconf || die "make failed" +} + +do_compile() { + oe_runmake all +} + +do_install_append() { + oe_runmake 'DESTDIR=${D}' install-daemon + oe_runmake 'DESTDIR=${D}' install-config + + install -d ${D}${sysconfdir}/init.d + install -m 755 ${B}/startup/debian-init ${D}${sysconfdir}/init.d/nrpe + + install -d ${D}${NAGIOS_CONF_DIR}/nrpe.d + echo "include_dir=${NAGIOS_CONF_DIR}/nrpe.d" >> ${D}${NAGIOS_CONF_DIR}/nrpe.cfg + + sed -e "s/^allowed_hosts=.*/allowed_hosts=${MONITORING_AGENT_SERVER_IP}/g" \ + -i ${D}${NAGIOS_CONF_DIR}/nrpe.cfg + + install -d ${D}${NAGIOS_PLUGIN_CONF_DIR} + install -m 664 ${WORKDIR}/check_nrpe.cfg ${D}${NAGIOS_PLUGIN_CONF_DIR} + + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}${systemd_unitdir}/system + install -m 644 ${WORKDIR}/nagios-nrpe.service ${D}${systemd_unitdir}/system/ + fi + + rmdir -p --ignore-fail-on-non-empty ${D}${localstatedir}/nagios +} + +PACKAGES = "${PN}-dbg ${PN}-plugin ${PN}-daemon" + +FILES_${PN}-plugin = "${NAGIOS_PLUGIN_DIR} \ + ${NAGIOS_PLUGIN_CONF_DIR} \ +" + +FILES_${PN}-daemon = "${sysconfdir} \ + ${bindir} \ + ${nonarch_libdir}/tmpfiles.d/ \ +" + +RDEPENDS_${PN}-daemon = "nagios-base" +RDEPENDS_${PN}-plugin = "nagios-base" + +SYSTEMD_PACKAGES = "${PN}-daemon" +SYSTEMD_SERVICE_${PN}-daemon = "nagios-nrpe.service" +SYSTEMD_AUTO_ENABLE_${PN}-daemon = "enable" + +INITSCRIPT_PACKAGES = "${PN}-daemon" +INITSCRIPT_NAME_${PN}-daemon = "nrpe" +INITSCRIPT_PARAMS_${PN}-daemon = "defaults" diff --git a/external/meta-virtualization/recipes-extended/nagios/nagios-nsca/0001-Fix-missing-argument-in-open-calls.patch b/external/meta-virtualization/recipes-extended/nagios/nagios-nsca/0001-Fix-missing-argument-in-open-calls.patch new file mode 100644 index 00000000..6b39fec5 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/nagios/nagios-nsca/0001-Fix-missing-argument-in-open-calls.patch @@ -0,0 +1,52 @@ +From da37e6ce2a8cc315845440488cd2f8dab0a17bfe Mon Sep 17 00:00:00 2001 +From: "John C. Frickson" <jfrickson@nagios.com> +Date: Wed, 7 Oct 2015 14:06:58 -0500 +Subject: [PATCH] Fix missing argument in open calls + +Commit b9f2c08dfdf31430f972a48781fc115c4af13cfe +from https://github.com/NagiosEnterprises/nsca + +Fix for issue http://tracker.nagios.org/view.php?id=286 + +Upstream-Status: Backport + +Singed-off-by: John C. Frickson <jfrickson@nagios.com> +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[MA: Context updated to allow application to older version] +Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> +--- + Changelog | 4 ++++ + src/nsca.c | 2 +- + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/Changelog b/Changelog +index 3a7edd4..00ea11e 100644 +--- a/Changelog ++++ b/Changelog +@@ -2,6 +2,10 @@ + NSCA Changelog + ************** + ++2.9.x - xx/xx/xxxx ++------------------ ++- Fix missing argument in open calls (Xavier Bachelot / John Frickson) ++ + 2.9.1 - 01/27/2012 + ------------------ + - Applied patch to allow packets arriving with a future time stamp (Daniel Wittenberg) +diff --git a/src/nsca.c b/src/nsca.c +index 6b0e436..0e70b8b 100644 +--- a/src/nsca.c ++++ b/src/nsca.c +@@ -477,7 +477,7 @@ static int read_config_file(char *filename){ + int checkresult_test_fd=-1; + char *checkresult_test=NULL; + asprintf(&checkresult_test,"%s/nsca.test.%i",check_result_path,getpid()); +- checkresult_test_fd=open(checkresult_test,O_WRONLY|O_CREAT); ++ checkresult_test_fd=open(checkresult_test,O_WRONLY|O_CREAT,S_IWUSR); + if (checkresult_test_fd>0){ + unlink(checkresult_test); + } +-- +2.11.0 + diff --git a/external/meta-virtualization/recipes-extended/nagios/nagios-nsca/init-script.in b/external/meta-virtualization/recipes-extended/nagios/nagios-nsca/init-script.in new file mode 100644 index 00000000..a76b34ed --- /dev/null +++ b/external/meta-virtualization/recipes-extended/nagios/nagios-nsca/init-script.in @@ -0,0 +1,67 @@ +#!/bin/sh +# +# Last Modified 01-07-2003 Ethan Galstad (nagios@nagios.org) +# Notes +# This script takes care of starting and stopping the NSCA daemon. +# Modeled after init script for NRPE written by jaclu@grm.se +# +# chkconfig: 2345 80 30 +# description: nsca is a daemon for accepting service check results \ +# from applications running on other hosts. +# processname: nsca +# config: /usr/local/nagios/etc/nsca.cfg + +### BEGIN INIT INFO +# Provides: nsca +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: start and stop nagios nsca daemon +# Description: start and stop nagios nsca daemon +### END INIT INFO + + +# Source function library +if [ -f /etc/rc.d/init.d/functions ]; then +. /etc/rc.d/init.d/functions +elif [ -f /etc/init.d/functions ]; then +. /etc/init.d/functions +elif [ -f /etc/rc.d/functions ]; then +. /etc/rc.d/functions +fi + +NscaBin=@bindir@/nsca +NscaCfg=@sysconfdir@/nsca.cfg +LockFile=/var/lock/nsca + +# See how we were called. +case "$1" in + start) + # Start daemons. + echo -n "Starting nsca: " + start-stop-daemon --start --exec $NscaBin -- -s -c $NscaCfg + RETVAL=$? + echo + touch $LockFile + ;; + stop) + # Stop daemons. + echo -n "Shutting down nsca: " + start-stop-daemon --stop --exec $NscaBin + echo + rm -f $LockFile + ;; + restart) + $0 stop + $0 start + ;; + status) + status nsca + ;; + *) + echo "Usage: nsca {start|stop|restart|status}" + exit 1 +esac + +exit 0 diff --git a/external/meta-virtualization/recipes-extended/nagios/nagios-nsca/nagios-nsca.service b/external/meta-virtualization/recipes-extended/nagios/nagios-nsca/nagios-nsca.service new file mode 100644 index 00000000..aa38b7f2 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/nagios/nagios-nsca/nagios-nsca.service @@ -0,0 +1,12 @@ +[Unit] +Description=Nagios nsca plugin +After=syslog.target network.target + +[Service] +Type=forking +ExecStart=/usr/bin/nsca -s -c /etc/nagios/nsca.cfg +PIDFile=/var/run/nsca.pid +TimeoutSec=60 + +[Install] +WantedBy=multi-user.target diff --git a/external/meta-virtualization/recipes-extended/nagios/nagios-nsca_2.9.1.bb b/external/meta-virtualization/recipes-extended/nagios/nagios-nsca_2.9.1.bb new file mode 100644 index 00000000..f53a47a0 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/nagios/nagios-nsca_2.9.1.bb @@ -0,0 +1,85 @@ +require nagios-common.inc + +DESCRIPTION = "Nagios Service Check Acceptor" +HOMEPAGE = "http://exchange.nagios.org" +SECTION = "console/network" +PRIORITY = "optional" +LICENSE = "GPLv2" + +LIC_FILES_CHKSUM = "file://src/nsca.c;beginline=1;endline=16;md5=c1bd17485c5c1dd42f664fe8b3528674" + +SRCNAME = "nsca" + +SRC_URI = "http://prdownloads.sourceforge.net/sourceforge/nagios/${SRCNAME}-${PV}.tar.gz \ + file://init-script.in \ + file://nagios-nsca.service \ + file://0001-Fix-missing-argument-in-open-calls.patch \ +" + +SRC_URI[md5sum] = "3fe2576a8cc5b252110a93f4c8d978c6" +SRC_URI[sha256sum] = "fb12349e50838c37954fe896ba6a026c09eaeff2f9408508ad7ede53e9ea9580" + +S = "${WORKDIR}/${SRCNAME}-${PV}" + +inherit update-rc.d autotools-brokensep systemd dos2unix + +DEPENDS = "libmcrypt" + +EXTRA_OECONF += "--with-nsca-user=${NAGIOS_USER} \ + --with-nsca-group=${NAGIOS_GROUP} \ + --with-libmcrypt-prefix=${STAGING_DIR_HOST} \ + ac_cv_path_LIBMCRYPT_CONFIG=${STAGING_BINDIR_CROSS}/libmcrypt-config \ + ac_cv_lib_wrap_main=no \ + ac_cv_path_PERL=${bindir}/perl \ +" + +do_configure() { + cp ${WORKDIR}/init-script.in ${S}/init-script.in + oe_runconf || die "make failed" +} + +do_install() { + CONF_DIR=${D}${NAGIOS_CONF_DIR} + + install -d ${CONF_DIR} + install -d ${D}${sysconfdir}/init.d + install -d ${D}${bindir} + + install -m 755 ${S}/sample-config/nsca.cfg ${CONF_DIR} + install -m 755 ${S}/sample-config/send_nsca.cfg ${CONF_DIR} + install -m 755 ${S}/init-script ${D}${sysconfdir}/init.d/nsca + + install -m 755 ${S}/src/nsca ${D}${bindir} + install -m 755 ${S}/src/send_nsca ${D}${bindir} + + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}${systemd_unitdir}/system + install -m 644 ${WORKDIR}/nagios-nsca.service ${D}${systemd_unitdir}/system/ + fi +} + +PACKAGES = "${PN}-dbg ${PN}-daemon ${PN}-client" + +FILES_${PN}-daemon = "${sysconfdir}/init.d \ + ${NAGIOS_CONF_DIR}/nsca.cfg \ + ${bindir}/nsca \ +" + +FILES_${PN}-client = "${NAGIOS_CONF_DIR}/send_nsca.cfg \ + ${bindir}/send_nsca \ +" + +RDEPENDS_${PN}-daemon += "libmcrypt \ + nagios-base \ +" +RDEPENDS_${PN}-client += "libmcrypt \ + nagios-base \ +" + +SYSTEMD_PACKAGES = "${PN}-daemon" +SYSTEMD_SERVICE_${PN}-daemon = "nagios-nsca.service" +SYSTEMD_AUTO_ENABLE_${PN}-daemon = "enable" + +INITSCRIPT_PACKAGES = "${PN}-daemon" +INITSCRIPT_NAME_${PN}-daemon = "nsca" +INITSCRIPT_PARAMS_${PN}-daemon = "defaults" diff --git a/external/meta-virtualization/recipes-extended/nagios/nagios-plugins_2.2.1.bb b/external/meta-virtualization/recipes-extended/nagios/nagios-plugins_2.2.1.bb new file mode 100644 index 00000000..07933654 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/nagios/nagios-plugins_2.2.1.bb @@ -0,0 +1,73 @@ +require nagios-common.inc + +DESCRIPTION = "A host/service/network monitoring and management system plugins" +HOMEPAGE = "http://www.nagios-plugins.org" +SECTION = "console/network" +PRIORITY = "optional" +LICENSE = "GPLv3" + +LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" + +SRC_URI = "https://www.nagios-plugins.org/download/${BPN}-${PV}.tar.gz \ +" + +SRC_URI[md5sum] = "fb521d5c05897f165b0b1862c1e5cb27" +SRC_URI[sha256sum] = "647c0ba4583d891c965fc29b77c4ccfeccc21f409fdf259cb8af52cb39c21e18" + +S = "${WORKDIR}/${BPN}-${PV}" + +inherit autotools gettext + +EXTRA_OECONF += "--with-sysroot=${STAGING_DIR_HOST} \ + --with-nagios-user=${NAGIOS_USER} \ + --with-nagios-group=${NAGIOS_GROUP} \ + --without-apt-get-command \ + --with-trusted-path=/bin:/sbin:/usr/bin:/usr/sbin \ + ac_cv_path_PERL=${bindir}/perl \ +" + +# IPv6 +PACKAGECONFIG[ipv6] = "--with-ipv6,--without-ipv6,," + +# Enable check_ldaps, check_http --ssl, check_tcp --ssl +PACKAGECONFIG[ssl] = "--with-openssl=${STAGING_DIR_HOST},--without-openssl,openssl,libssl" + +# Enable check_ldaps +PACKAGECONFIG[ldap] = "--with-ldap,--without-ldap,openldap" + +# Enable check_smtp --starttls +PACKAGECONFIG[gnutls] = "--with-gnutls=${STAGING_DIR_HOST},--without-gnutls,gnutls,gnutls" + +# Enable check_pgsql +PACKAGECONFIG[pgsql] = "--with-pgsql=${STAGING_DIR_HOST},--without-pgsql,postgresql,libpq" + +# Enable check_mysql, check_mysql_query +PACKAGECONFIG[mysql] = "--with-mysql=${STAGING_DIR_HOST},--without-mysql,mysql5,libmysqlclient" + +# Enable check_snmp +PACKAGECONFIG[snmp] = "\ + --with-snmpget-command=${bindir}/snmpget --with-snmpgetnext-command=${bindir}/snmpgetnext, \ + --without-snmpget-command --without-snmpgetnext-command, \ + , net-snmp-utils \ +" + +PACKAGECONFIG ??= "ssl gnutls" + +do_configure() { + oe_runconf || die "make failed" +} + +do_install_append() { + sed -i '1s,#! /usr/bin/perl -w.*,#! ${bindir}/env perl,' ${D}${libdir}/nagios/plugins/* +} + +RDEPENDS_${PN} += "\ + iputils \ + nagios-base \ + perl \ + bash \ +" + +FILES_${PN} += "${datadir} \ + ${NAGIOS_PLUGIN_DIR} \ +" diff --git a/external/meta-virtualization/recipes-extended/oath/oath/0001-oath-fix-macro-definition-error.patch b/external/meta-virtualization/recipes-extended/oath/oath/0001-oath-fix-macro-definition-error.patch new file mode 100644 index 00000000..37f9d753 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/oath/oath/0001-oath-fix-macro-definition-error.patch @@ -0,0 +1,32 @@ +From ba86973a3014caa9a4110611f470d4d9af5c2982 Mon Sep 17 00:00:00 2001 +From: Dengke Du <dengke.du@windriver.com> +Date: Thu, 27 Sep 2018 09:37:08 +0800 +Subject: [PATCH] oath: fix macro definition error + +Signed-off-by: Dengke Du <dengke.du@windriver.com> +--- + oathtool/gl/intprops.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/oathtool/gl/intprops.h b/oathtool/gl/intprops.h +index e1fce5c..cee4997 100644 +--- a/oathtool/gl/intprops.h ++++ b/oathtool/gl/intprops.h +@@ -230,11 +230,11 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); + (e.g., A and B) have the same type as MIN and MAX. Instead, they assume + that the result (e.g., A + B) has that type. */ + #if _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL +-# define _GL_ADD_OVERFLOW(a, b, min, max) ++# define _GL_ADD_OVERFLOW(a, b, min, max) \ + __builtin_add_overflow (a, b, (__typeof__ ((a) + (b)) *) 0) +-# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) ++# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ + __builtin_sub_overflow (a, b, (__typeof__ ((a) - (b)) *) 0) +-# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) ++# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ + __builtin_mul_overflow (a, b, (__typeof__ ((a) * (b)) *) 0) + #else + # define _GL_ADD_OVERFLOW(a, b, min, max) \ +-- +2.7.4 + diff --git a/external/meta-virtualization/recipes-extended/oath/oath_2.6.2.bb b/external/meta-virtualization/recipes-extended/oath/oath_2.6.2.bb new file mode 100644 index 00000000..f4230449 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/oath/oath_2.6.2.bb @@ -0,0 +1,19 @@ +LICENSE = "GPLv3 & LGPLv2.1" +LIC_FILES_CHKSUM = "file://COPYING;md5=62e1e33aebac5b1bc9fc48a866e2f61b \ + file://oathtool/COPYING;md5=d32239bcb673463ab874e80d47fae504 \ + file://liboath/COPYING;md5=4fbd65380cdd255951079008b364516c \ + file://pam_oath/COPYING;md5=d32239bcb673463ab874e80d47fae504" + +SRC_URI = "http://download.savannah.nongnu.org/releases/oath-toolkit/oath-toolkit-${PV}.tar.gz \ + file://0001-oath-fix-macro-definition-error.patch \ +" + +S = "${WORKDIR}/${BPN}-toolkit-${PV}" +SRC_URI[md5sum] = "4a05cd4768764843bd5493609a6bdb17" +SRC_URI[sha256sum] = "b03446fa4b549af5ebe4d35d7aba51163442d255660558cd861ebce536824aa0" + +inherit autotools + +# Specify any options you want to pass to the configure script using EXTRA_OECONF: +EXTRA_OECONF = "" +DEPENDS = "gtk-doc-native" diff --git a/external/meta-virtualization/recipes-extended/seabios/seabios/hostcc.patch b/external/meta-virtualization/recipes-extended/seabios/seabios/hostcc.patch new file mode 100644 index 00000000..f665e1a3 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/seabios/seabios/hostcc.patch @@ -0,0 +1,21 @@ +diff -ur a/Makefile b/Makefile +--- a/Makefile 2015-02-02 22:02:58.651041951 -0500 ++++ b/Makefile 2015-02-02 23:08:13.884514003 -0500 +@@ -8,7 +8,7 @@ + OUT=out/ + + # Common command definitions +-export HOSTCC := $(CC) ++export HOSTCC ?= $(CC) + export CONFIG_SHELL := sh + export KCONFIG_AUTOHEADER := autoconf.h + export KCONFIG_CONFIG := $(CURDIR)/.config +@@ -22,7 +22,7 @@ + OBJDUMP=$(CROSS_PREFIX)objdump + STRIP=$(CROSS_PREFIX)strip + PYTHON=python +-CPP=cpp ++CPP=$(CROSS_PREFIX)cpp + IASL:=iasl + LD32BIT_FLAG:=-melf_i386 + diff --git a/external/meta-virtualization/recipes-extended/seabios/seabios_1.11.2.bb b/external/meta-virtualization/recipes-extended/seabios/seabios_1.11.2.bb new file mode 100644 index 00000000..81eaec96 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/seabios/seabios_1.11.2.bb @@ -0,0 +1,44 @@ +DESCRIPTION = "SeaBIOS" +HOMEPAGE = "http://www.coreboot.org/SeaBIOS" +LICENSE = "LGPLv3" +SECTION = "firmware" + +SRC_URI = " \ + https://github.com/qemu/seabios/archive/rel-${PV}.tar.gz \ + file://hostcc.patch \ + " +S = "${WORKDIR}/${PN}-rel-${PV}" + +LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.LESSER;md5=6a6a8e020838b23406c81b19c1d46df6 \ + " + +SRC_URI[md5sum] = "3f78065837dbd8873513a1b7d5276e78" +SRC_URI[sha256sum] = "73e73c8e406d97265782f6c942b3c1d178ed4f4afc9f381b22336c3968291693" + +FILES_${PN} = "/usr/share/firmware" + +DEPENDS = "util-linux-native file-native bison-native flex-native gettext-native acpica-native python-native" + +TUNE_CCARGS = "" +EXTRA_OEMAKE += "HOSTCC='${BUILD_CC}'" +EXTRA_OEMAKE += "CROSS_PREFIX=${TARGET_PREFIX}" + +COMPATIBLE_HOST = "(i.86|x86_64).*-linux" + +do_configure() { + oe_runmake defconfig +} + +do_compile() { + unset CPP + unset CPPFLAGS + oe_runmake +} + +do_install() { + oe_runmake + install -d ${D}/usr/share/firmware + install -m 0644 out/bios.bin ${D}/usr/share/firmware/ +} + diff --git a/external/meta-virtualization/recipes-extended/vgabios/biossums_0.7a.bb b/external/meta-virtualization/recipes-extended/vgabios/biossums_0.7a.bb new file mode 100644 index 00000000..e66bade7 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/vgabios/biossums_0.7a.bb @@ -0,0 +1,37 @@ +DESCRIPTION = "biossums tool for building Plex86/Bochs LGPL VGABios" +HOMEPAGE = "http://www.nongnu.org/vgabios/" +LICENSE = "LGPLv2.1" +SECTION = "firmware" + +LIC_FILES_CHKSUM = "file://COPYING;md5=dcf3c825659e82539645da41a7908589" + +SRC_URI = "http://savannah.gnu.org/download/vgabios/vgabios-${PV}.tgz" + +SRC_URI[md5sum] = "2c0fe5c0ca08082a9293e3a7b23dc900" +SRC_URI[sha256sum] = "9d24c33d4bfb7831e2069cf3644936a53ef3de21d467872b54ce2ea30881b865" + +BBCLASSEXTEND = "native" + +FILES_${PN} = "${bindir}/biossums" + +S = "${WORKDIR}/vgabios-${PV}" + +do_configure() { + # Don't override the compiler or its flags: + sed 's,^CC,DISABLED_CC,' -i Makefile + sed 's,^CFLAGS,DISABLED_CFLAGS,' -i Makefile + sed 's,^LDFLAGS,DISABLED_LDFLAGS,' -i Makefile + # Supply the C flags to the compiler: + sed 's,-o biossums,$(CFLAGS) -o biossums,' -i Makefile +} + +do_compile() { + # clean removes binaries distributed with source + oe_runmake clean + oe_runmake biossums +} + +do_install() { + mkdir -p "${D}${bindir}" + install -m 0755 biossums "${D}${bindir}" +} diff --git a/external/meta-virtualization/recipes-extended/vgabios/vgabios_0.7a.bb b/external/meta-virtualization/recipes-extended/vgabios/vgabios_0.7a.bb new file mode 100644 index 00000000..3394173c --- /dev/null +++ b/external/meta-virtualization/recipes-extended/vgabios/vgabios_0.7a.bb @@ -0,0 +1,33 @@ +DESCRIPTION = "Plex86/Bochs LGPL VGABios" +HOMEPAGE = "http://www.nongnu.org/vgabios/" +LICENSE = "LGPLv2.1" +SECTION = "firmware" + +DEPENDS = "dev86-native biossums-native" + +LIC_FILES_CHKSUM = "file://COPYING;md5=dcf3c825659e82539645da41a7908589" + +SRC_URI = "http://savannah.gnu.org/download/vgabios/${BPN}-${PV}.tgz" + +SRC_URI[md5sum] = "2c0fe5c0ca08082a9293e3a7b23dc900" +SRC_URI[sha256sum] = "9d24c33d4bfb7831e2069cf3644936a53ef3de21d467872b54ce2ea30881b865" + +PR = "r0" + +FILES_${PN} = "/usr/share/firmware/${PN}-${PV}*.bin" +FILES_${PN}-dbg = "/usr/share/firmware/${PN}-${PV}*.debug.bin" + +S = "${WORKDIR}/${PN}-${PV}" + +do_configure() { + # Override to use the native-built biossums tool: + sed 's,./biossums,biossums,' -i Makefile + sed 's,$(CC) -o biossums biossums.c,touch biossums,' -i Makefile +} + +do_install() { + install -d ${D}/usr/share/firmware + install -m 0644 VGABIOS-lgpl-latest.bin ${D}/usr/share/firmware/${PN}-${PV}.bin + install -m 0644 VGABIOS-lgpl-latest.cirrus.bin ${D}/usr/share/firmware/${PN}-${PV}.cirrus.bin +} + diff --git a/external/meta-virtualization/recipes-extended/xen/README b/external/meta-virtualization/recipes-extended/xen/README new file mode 100644 index 00000000..3686530c --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/README @@ -0,0 +1,24 @@ +Xen +--- + +For any issues with the xen recipes please make sure you CC cardoe@gentoo.org + +configuring the hypervisor +-------------------------- + +Since 4.7.0 Xen supports using Kconfig to configure the hypervisor. Similarly +to how the recipe for busybox works, you can provide a .config as a defconfig +to override the default configuration of the hypervisor. The easiest way +for you to take advantage of this is to create a .config for Xen and then +copy it to your Yocto layer as 'defconfig' inside of +'recipes-extended/xen/files/' and then create a bbappend adding +'file://defconfig' to your SRC_URI. + +security patches +---------------- + +The base recipe does not include security fixes that the Xen community releases +as XSAs (http://xenbits.xen.org/xsa/). The easiest way to include those is to +drop patches in 'recipes-extened/xen/files' and create a bbappend adding those +patches to SRC_URI and they will be applied. Alternatively, you can override +the SRC_URI to a git repo you provide that contains the patches. diff --git a/external/meta-virtualization/recipes-extended/xen/files/0001-python-pygrub-pass-DISTUTILS-env-vars-as-setup.py-ar.patch b/external/meta-virtualization/recipes-extended/xen/files/0001-python-pygrub-pass-DISTUTILS-env-vars-as-setup.py-ar.patch new file mode 100644 index 00000000..03c39fe7 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/files/0001-python-pygrub-pass-DISTUTILS-env-vars-as-setup.py-ar.patch @@ -0,0 +1,63 @@ +From d79dcc2002008c58683de82f06c168d6eea57991 Mon Sep 17 00:00:00 2001 +From: Maciej Pijanowski <maciej.pijanowski@3mdeb.com> +Date: Fri, 19 Oct 2018 11:01:37 +0200 +Subject: [PATCH] python,pygrub: pass DISTUTILS env vars as setup.py args + +Allow to respect the target install dir (PYTHON_SITEPACKAGES_DIR) +as well as other parameters set by the OpenEmbedded build system. +This is especially useful when the target libdir is not the default one +(/usr/lib), but for example /usr/lib64. + +Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com> +--- + tools/pygrub/Makefile | 5 +++-- + tools/python/Makefile | 4 ++-- + 2 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/tools/pygrub/Makefile b/tools/pygrub/Makefile +index 536af07932b4..e1c773101412 100644 +--- a/tools/pygrub/Makefile ++++ b/tools/pygrub/Makefile +@@ -10,14 +10,15 @@ INSTALL_LOG = build/installed_files.txt + all: build + .PHONY: build + build: +- CC="$(CC)" CFLAGS="$(PY_CFLAGS)" $(PYTHON) setup.py build ++ CC="$(CC)" CFLAGS="$(PY_CFLAGS)" $(PYTHON) setup.py build $(DISTUTILS_BUILD_ARGS) + + .PHONY: install + install: all + $(INSTALL_DIR) $(DESTDIR)/$(bindir) + CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) \ + setup.py install --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \ +- --root="$(DESTDIR)" --install-scripts=$(LIBEXEC_BIN) --force ++ --root="$(DESTDIR)" --install-scripts=$(LIBEXEC_BIN) --force \ ++ $(DISTUTILS_INSTALL_ARGS) + set -e; if [ $(bindir) != $(LIBEXEC_BIN) -a \ + "`readlink -f $(DESTDIR)/$(bindir)`" != \ + "`readlink -f $(LIBEXEC_BIN)`" ]; then \ +diff --git a/tools/python/Makefile b/tools/python/Makefile +index 541858e2f886..4d4a344f1d33 100644 +--- a/tools/python/Makefile ++++ b/tools/python/Makefile +@@ -10,7 +10,7 @@ INSTALL_LOG = build/installed_files.txt + + .PHONY: build + build: +- CC="$(CC)" CFLAGS="$(PY_CFLAGS)" $(PYTHON) setup.py build ++ CC="$(CC)" CFLAGS="$(PY_CFLAGS)" $(PYTHON) setup.py build $(DISTUTILS_BUILD_ARGS) + + .PHONY: install + install: +@@ -18,7 +18,7 @@ install: + + CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) \ + setup.py install --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \ +- --root="$(DESTDIR)" --force ++ --root="$(DESTDIR)" --force $(DISTUTILS_INSTALL_ARGS) + + $(INSTALL_PROG) scripts/convert-legacy-stream $(DESTDIR)$(LIBEXEC_BIN) + $(INSTALL_PROG) scripts/verify-stream-v2 $(DESTDIR)$(LIBEXEC_BIN) +-- +2.7.4 + diff --git a/external/meta-virtualization/recipes-extended/xen/files/lwip.dhcp_create_request-hwaddr_len.patch b/external/meta-virtualization/recipes-extended/xen/files/lwip.dhcp_create_request-hwaddr_len.patch new file mode 100644 index 00000000..4bbf21a1 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/files/lwip.dhcp_create_request-hwaddr_len.patch @@ -0,0 +1,13 @@ +Index: src/core/dhcp.c +=================================================================== +--- a/src/core/dhcp.c ++++ b/src/core/dhcp.c +@@ -1356,7 +1358,7 @@ dhcp_create_request(struct netif *netif) + dhcp->msg_out->giaddr.addr = 0; + for (i = 0; i < DHCP_CHADDR_LEN; i++) { + /* copy netif hardware address, pad with zeroes */ +- dhcp->msg_out->chaddr[i] = (i < netif->hwaddr_len) ? netif->hwaddr[i] : 0/* pad byte*/; ++ dhcp->msg_out->chaddr[i] = (i < (netif->hwaddr_len > NETIF_MAX_HWADDR_LEN ? NETIF_MAX_HWADDR_LEN : netif->hwaddr_len)) ? netif->hwaddr[i] : 0/* pad byte*/; + } + for (i = 0; i < DHCP_SNAME_LEN; i++) { + dhcp->msg_out->sname[i] = 0; diff --git a/external/meta-virtualization/recipes-extended/xen/files/lwip.patch-cvs b/external/meta-virtualization/recipes-extended/xen/files/lwip.patch-cvs new file mode 100644 index 00000000..b2718778 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/files/lwip.patch-cvs @@ -0,0 +1,2398 @@ +? .ChangeLog.swp +? ChangeLog +Index: CHANGELOG +=================================================================== +RCS file: /sources/lwip/lwip/CHANGELOG,v +retrieving revision 1.300 +retrieving revision 1.318 +diff -u -p -r1.300 -r1.318 +--- a/CHANGELOG 23 Mar 2008 13:49:39 -0000 1.300 ++++ b/CHANGELOG 14 Jul 2008 20:12:36 -0000 1.318 +@@ -19,9 +19,77 @@ HISTORY + + ++ New features: + ++ 2008-06-30 Simon Goldschmidt ++ * mem.c, opt.h, stats.h: fixed bug #21433: Calling mem_free/pbuf_free from ++ interrupt context isn't safe: LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT allows ++ mem_free to run between mem_malloc iterations. Added illegal counter for ++ mem stats. ++ ++ 2008-06-27 Simon Goldschmidt ++ * stats.h/.c, some other files: patch #6483: stats module improvement: ++ Added defines to display each module's statistic individually, added stats ++ defines for MEM, MEMP and SYS modules, removed (unused) rexmit counter. ++ ++ 2008-06-17 Simon Goldschmidt ++ * err.h: patch #6459: Made err_t overridable to use a more efficient type ++ (define LWIP_ERR_T in cc.h) ++ ++ 2008-06-17 Simon Goldschmidt ++ * slipif.c: patch #6480: Added a configuration option for slipif for symmetry ++ to loopif ++ ++ 2008-06-17 Simon Goldschmidt (patch by Luca Ceresoli) ++ * netif.c, loopif.c, ip.c, netif.h, loopif.h, opt.h: Checked in slightly ++ modified version of patch # 6370: Moved loopif code to netif.c so that ++ loopback traffic is supported on all netifs (all local IPs). ++ Added option to limit loopback packets for each netifs. ++ + + ++ Bugfixes: + ++ 2008-08-14 Simon Goldschmidt ++ * api_msg.c: fixed bug #23847: do_close_internal references freed memory (when ++ tcp_close returns != ERR_OK) ++ ++ 2008-07-08 Frédéric Bernon ++ * stats.h: Fix some build bugs introduced with patch #6483 (missing some parameters ++ in macros, mainly if MEM_STATS=0 and MEMP_STATS=0). ++ ++ 2008-06-24 Jonathan Larmour ++ * tcp_in.c: Fix for bug #23693 as suggested by Art R. Ensure cseg is unused ++ if tcp_seg_copy fails. ++ ++ 2008-06-17 Simon Goldschmidt ++ * inet_chksum.c: Checked in some ideas of patch #6460 (loop optimizations) ++ and created defines for swapping bytes and folding u32 to u16. ++ ++ 2008-05-30 Kieran Mansley ++ * tcp_in.c Remove redundant "if" statement, and use real rcv_wnd ++ rather than rcv_ann_wnd when deciding if packets are in-window. ++ Contributed by <arasmussen@consultant.datasys.swri.edu> ++ ++ 2008-05-30 Kieran Mansley ++ * mem.h: Fix BUG#23254. Change macro definition of mem_* to allow ++ passing as function pointers when MEM_LIBC_MALLOC is defined. ++ ++ 2008-05-09 Jonathan Larmour ++ * err.h, err.c, sockets.c: Fix bug #23119: Reorder timeout error code to ++ stop it being treated as a fatal error. ++ ++ 2008-04-15 Simon Goldschmidt ++ * dhcp.c: fixed bug #22804: dhcp_stop doesn't clear NETIF_FLAG_DHCP ++ (flag now cleared) ++ ++ 2008-03-27 Simon Goldschmidt ++ * mem.c, tcpip.c, tcpip.h, opt.h: fixed bug #21433 (Calling mem_free/pbuf_free ++ from interrupt context isn't safe): set LWIP_USE_HEAP_FROM_INTERRUPT to 1 ++ in lwipopts.h or use pbuf_free_callback(p)/mem_free_callback(m) to free pbufs ++ or heap memory from interrupt context ++ ++ 2008-03-26 Simon Goldschmidt ++ * tcp_in.c, tcp.c: fixed bug #22249: division by zero could occur if a remote ++ host sent a zero mss as TCP option. ++ + + (STABLE-1.3.0) + +Index: src/api/api_msg.c +=================================================================== +RCS file: /sources/lwip/lwip/src/api/api_msg.c,v +retrieving revision 1.102 +retrieving revision 1.104 +diff -u -p -r1.102 -r1.104 +--- a/src/api/api_msg.c 21 Mar 2008 16:23:14 -0000 1.102 ++++ b/src/api/api_msg.c 15 Jul 2008 11:18:58 -0000 1.104 +@@ -598,11 +598,16 @@ do_close_internal(struct netconn *conn) + LWIP_ASSERT("pcb already closed", (conn->pcb.tcp != NULL)); + + /* Set back some callback pointers */ ++ tcp_arg(conn->pcb.tcp, NULL); + if (conn->pcb.tcp->state == LISTEN) { +- tcp_arg(conn->pcb.tcp, NULL); + tcp_accept(conn->pcb.tcp, NULL); + } else { + tcp_recv(conn->pcb.tcp, NULL); ++ tcp_accept(conn->pcb.tcp, NULL); ++ /* some callbacks have to be reset if tcp_close is not successful */ ++ tcp_sent(conn->pcb.tcp, NULL); ++ tcp_poll(conn->pcb.tcp, NULL, 4); ++ tcp_err(conn->pcb.tcp, NULL); + } + /* Try to close the connection */ + err = tcp_close(conn->pcb.tcp); +@@ -610,11 +615,6 @@ do_close_internal(struct netconn *conn) + /* Closing succeeded */ + conn->state = NETCONN_NONE; + /* Set back some callback pointers as conn is going away */ +- tcp_err(conn->pcb.tcp, NULL); +- tcp_poll(conn->pcb.tcp, NULL, 4); +- tcp_sent(conn->pcb.tcp, NULL); +- tcp_recv(conn->pcb.tcp, NULL); +- tcp_arg(conn->pcb.tcp, NULL); + conn->pcb.tcp = NULL; + conn->err = ERR_OK; + /* Trigger select() in socket layer. This send should something else so the +@@ -623,6 +623,14 @@ do_close_internal(struct netconn *conn) + API_EVENT(conn, NETCONN_EVT_SENDPLUS, 0); + /* wake up the application task */ + sys_sem_signal(conn->op_completed); ++ } else { ++ /* Closing failed, restore some of the callbacks */ ++ /* Closing of listen pcb will never fail! */ ++ LWIP_ASSERT("Closing a listen pcb may not fail!", (conn->pcb.tcp->state != LISTEN)); ++ tcp_sent(conn->pcb.tcp, sent_tcp); ++ tcp_poll(conn->pcb.tcp, poll_tcp, 4); ++ tcp_err(conn->pcb.tcp, err_tcp); ++ tcp_arg(conn->pcb.tcp, conn); + } + /* If closing didn't succeed, we get called again either + from poll_tcp or from sent_tcp */ +Index: src/api/err.c +=================================================================== +RCS file: /sources/lwip/lwip/src/api/err.c,v +retrieving revision 1.11 +retrieving revision 1.12 +diff -u -p -r1.11 -r1.12 +--- a/src/api/err.c 13 Dec 2007 23:06:50 -0000 1.11 ++++ b/src/api/err.c 9 May 2008 12:14:23 -0000 1.12 +@@ -44,17 +44,17 @@ static const char *err_strerr[] = { + "Ok.", /* ERR_OK 0 */ + "Out of memory error.", /* ERR_MEM -1 */ + "Buffer error.", /* ERR_BUF -2 */ +- "Routing problem.", /* ERR_RTE -3 */ +- "Connection aborted.", /* ERR_ABRT -4 */ +- "Connection reset.", /* ERR_RST -5 */ +- "Connection closed.", /* ERR_CLSD -6 */ +- "Not connected.", /* ERR_CONN -7 */ +- "Illegal value.", /* ERR_VAL -8 */ +- "Illegal argument.", /* ERR_ARG -9 */ +- "Address in use.", /* ERR_USE -10 */ +- "Low-level netif error.", /* ERR_IF -11 */ +- "Already connected.", /* ERR_ISCONN -12 */ +- "Timeout.", /* ERR_TIMEOUT -13 */ ++ "Timeout.", /* ERR_TIMEOUT -3 */ ++ "Routing problem.", /* ERR_RTE -4 */ ++ "Connection aborted.", /* ERR_ABRT -5 */ ++ "Connection reset.", /* ERR_RST -6 */ ++ "Connection closed.", /* ERR_CLSD -7 */ ++ "Not connected.", /* ERR_CONN -8 */ ++ "Illegal value.", /* ERR_VAL -9 */ ++ "Illegal argument.", /* ERR_ARG -10 */ ++ "Address in use.", /* ERR_USE -11 */ ++ "Low-level netif error.", /* ERR_IF -12 */ ++ "Already connected.", /* ERR_ISCONN -13 */ + "Operation in progress." /* ERR_INPROGRESS -14 */ + }; + +Index: src/api/netdb.c +=================================================================== +RCS file: /sources/lwip/lwip/src/api/netdb.c,v +retrieving revision 1.4 +retrieving revision 1.5 +diff -u -p -r1.4 -r1.5 +--- a/src/api/netdb.c 26 Jan 2008 16:11:39 -0000 1.4 ++++ b/src/api/netdb.c 16 Jul 2008 20:36:12 -0000 1.5 +@@ -326,7 +326,8 @@ lwip_getaddrinfo(const char *nodename, c + if (nodename != NULL) { + /* copy nodename to canonname if specified */ + size_t namelen = strlen(nodename); +- ai->ai_canonname = mem_malloc(namelen + 1); ++ LWIP_ASSERT("namelen is too long", (namelen + 1) <= (mem_size_t)-1); ++ ai->ai_canonname = mem_malloc((mem_size_t)(namelen + 1)); + if (ai->ai_canonname == NULL) { + goto memerr; + } +Index: src/api/sockets.c +=================================================================== +RCS file: /sources/lwip/lwip/src/api/sockets.c,v +retrieving revision 1.116 +retrieving revision 1.117 +diff -u -p -r1.116 -r1.117 +--- a/src/api/sockets.c 13 Mar 2008 20:03:57 -0000 1.116 ++++ b/src/api/sockets.c 9 May 2008 12:14:24 -0000 1.117 +@@ -128,17 +128,17 @@ static const int err_to_errno_table[] = + 0, /* ERR_OK 0 No error, everything OK. */ + ENOMEM, /* ERR_MEM -1 Out of memory error. */ + ENOBUFS, /* ERR_BUF -2 Buffer error. */ +- EHOSTUNREACH, /* ERR_RTE -3 Routing problem. */ +- ECONNABORTED, /* ERR_ABRT -4 Connection aborted. */ +- ECONNRESET, /* ERR_RST -5 Connection reset. */ +- ESHUTDOWN, /* ERR_CLSD -6 Connection closed. */ +- ENOTCONN, /* ERR_CONN -7 Not connected. */ +- EINVAL, /* ERR_VAL -8 Illegal value. */ +- EIO, /* ERR_ARG -9 Illegal argument. */ +- EADDRINUSE, /* ERR_USE -10 Address in use. */ +- -1, /* ERR_IF -11 Low-level netif error */ +- -1, /* ERR_ISCONN -12 Already connected. */ +- ETIMEDOUT, /* ERR_TIMEOUT -13 Timeout */ ++ ETIMEDOUT, /* ERR_TIMEOUT -3 Timeout */ ++ EHOSTUNREACH, /* ERR_RTE -4 Routing problem. */ ++ ECONNABORTED, /* ERR_ABRT -5 Connection aborted. */ ++ ECONNRESET, /* ERR_RST -6 Connection reset. */ ++ ESHUTDOWN, /* ERR_CLSD -7 Connection closed. */ ++ ENOTCONN, /* ERR_CONN -8 Not connected. */ ++ EINVAL, /* ERR_VAL -9 Illegal value. */ ++ EIO, /* ERR_ARG -10 Illegal argument. */ ++ EADDRINUSE, /* ERR_USE -11 Address in use. */ ++ -1, /* ERR_IF -12 Low-level netif error */ ++ -1, /* ERR_ISCONN -13 Already connected. */ + EINPROGRESS /* ERR_INPROGRESS -14 Operation in progress */ + }; + +Index: src/api/tcpip.c +=================================================================== +RCS file: /sources/lwip/lwip/src/api/tcpip.c,v +retrieving revision 1.70 +retrieving revision 1.73 +diff -u -p -r1.70 -r1.73 +--- a/src/api/tcpip.c 12 Jan 2008 11:52:22 -0000 1.70 ++++ b/src/api/tcpip.c 27 Jun 2008 20:34:51 -0000 1.73 +@@ -518,4 +518,42 @@ tcpip_init(void (* initfunc)(void *), vo + sys_thread_new(TCPIP_THREAD_NAME, tcpip_thread, NULL, TCPIP_THREAD_STACKSIZE, TCPIP_THREAD_PRIO); + } + ++/** ++ * Simple callback function used with tcpip_callback to free a pbuf ++ * (pbuf_free has a wrong signature for tcpip_callback) ++ * ++ * @param p The pbuf (chain) to be dereferenced. ++ */ ++static void ++pbuf_free_int(void *p) ++{ ++ struct pbuf *q = p; ++ pbuf_free(q); ++} ++ ++/** ++ * A simple wrapper function that allows you to free a pbuf from interrupt context. ++ * ++ * @param p The pbuf (chain) to be dereferenced. ++ * @return ERR_OK if callback could be enqueued, an err_t if not ++ */ ++err_t ++pbuf_free_callback(struct pbuf *p) ++{ ++ return tcpip_callback_with_block(pbuf_free_int, p, 0); ++} ++ ++/** ++ * A simple wrapper function that allows you to free heap memory from ++ * interrupt context. ++ * ++ * @param m the heap memory to free ++ * @return ERR_OK if callback could be enqueued, an err_t if not ++ */ ++err_t ++mem_free_callback(void *m) ++{ ++ return tcpip_callback_with_block(mem_free, m, 0); ++} ++ + #endif /* !NO_SYS */ +Index: src/core/dhcp.c +=================================================================== +RCS file: /sources/lwip/lwip/src/core/dhcp.c,v +retrieving revision 1.86 +retrieving revision 1.87 +diff -u -p -r1.86 -r1.87 +--- a/src/core/dhcp.c 4 Mar 2008 14:25:58 -0000 1.86 ++++ b/src/core/dhcp.c 15 Apr 2008 17:24:55 -0000 1.87 +@@ -568,6 +568,8 @@ dhcp_start(struct netif *netif) + LWIP_ERROR("netif != NULL", (netif != NULL), return ERR_ARG;); + dhcp = netif->dhcp; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_start(netif=%p) %c%c%"U16_F"\n", (void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num)); ++ /* Remove the flag that says this netif is handled by DHCP, ++ it is set when we succeeded starting. */ + netif->flags &= ~NETIF_FLAG_DHCP; + + /* no DHCP client attached yet? */ +@@ -609,6 +611,7 @@ dhcp_start(struct netif *netif) + dhcp_stop(netif); + return ERR_MEM; + } ++ /* Set the flag that says this netif is handled by DHCP. */ + netif->flags |= NETIF_FLAG_DHCP; + return result; + } +@@ -1063,6 +1066,8 @@ dhcp_stop(struct netif *netif) + { + struct dhcp *dhcp = netif->dhcp; + LWIP_ERROR("dhcp_stop: netif != NULL", (netif != NULL), return;); ++ /* Remove the flag that says this netif is handled by DHCP. */ ++ netif->flags &= ~NETIF_FLAG_DHCP; + + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | 3, ("dhcp_stop()\n")); + /* netif is DHCP configured? */ +Index: src/core/mem.c +=================================================================== +RCS file: /sources/lwip/lwip/src/core/mem.c,v +retrieving revision 1.59 +retrieving revision 1.62 +diff -u -p -r1.59 -r1.62 +--- a/src/core/mem.c 4 Mar 2008 16:31:32 -0000 1.59 ++++ b/src/core/mem.c 30 Jun 2008 18:16:51 -0000 1.62 +@@ -177,9 +177,36 @@ static u8_t *ram; + static struct mem *ram_end; + /** pointer to the lowest free block, this is used for faster search */ + static struct mem *lfree; ++ + /** concurrent access protection */ + static sys_sem_t mem_sem; + ++#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT ++ ++static volatile u8_t mem_free_count; ++ ++/* Allow mem_free from other (e.g. interrupt) context */ ++#define LWIP_MEM_FREE_DECL_PROTECT() SYS_ARCH_DECL_PROTECT(lev_free) ++#define LWIP_MEM_FREE_PROTECT() SYS_ARCH_PROTECT(lev_free) ++#define LWIP_MEM_FREE_UNPROTECT() SYS_ARCH_UNPROTECT(lev_free) ++#define LWIP_MEM_ALLOC_DECL_PROTECT() SYS_ARCH_DECL_PROTECT(lev_alloc) ++#define LWIP_MEM_ALLOC_PROTECT() SYS_ARCH_PROTECT(lev_alloc) ++#define LWIP_MEM_ALLOC_UNPROTECT() SYS_ARCH_UNPROTECT(lev_alloc) ++ ++#else /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ ++ ++/* Protect the heap only by using a semaphore */ ++#define LWIP_MEM_FREE_DECL_PROTECT() ++#define LWIP_MEM_FREE_PROTECT() sys_arch_sem_wait(mem_sem, 0) ++#define LWIP_MEM_FREE_UNPROTECT() sys_sem_signal(mem_sem) ++/* mem_malloc is protected using semaphore AND LWIP_MEM_ALLOC_PROTECT */ ++#define LWIP_MEM_ALLOC_DECL_PROTECT() ++#define LWIP_MEM_ALLOC_PROTECT() ++#define LWIP_MEM_ALLOC_UNPROTECT() ++ ++#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ ++ ++ + /** + * "Plug holes" by combining adjacent empty struct mems. + * After this function is through, there should not exist +@@ -255,9 +282,7 @@ mem_init(void) + /* initialize the lowest-free pointer to the start of the heap */ + lfree = (struct mem *)ram; + +-#if MEM_STATS +- lwip_stats.mem.avail = MEM_SIZE_ALIGNED; +-#endif /* MEM_STATS */ ++ MEM_STATS_AVAIL(avail, MEM_SIZE_ALIGNED); + } + + /** +@@ -270,6 +295,7 @@ void + mem_free(void *rmem) + { + struct mem *mem; ++ LWIP_MEM_FREE_DECL_PROTECT(); + + if (rmem == NULL) { + LWIP_DEBUGF(MEM_DEBUG | LWIP_DBG_TRACE | 2, ("mem_free(p == NULL) was called.\n")); +@@ -277,20 +303,20 @@ mem_free(void *rmem) + } + LWIP_ASSERT("mem_free: sanity check alignment", (((mem_ptr_t)rmem) & (MEM_ALIGNMENT-1)) == 0); + +- /* protect the heap from concurrent access */ +- sys_arch_sem_wait(mem_sem, 0); +- + LWIP_ASSERT("mem_free: legal memory", (u8_t *)rmem >= (u8_t *)ram && + (u8_t *)rmem < (u8_t *)ram_end); + + if ((u8_t *)rmem < (u8_t *)ram || (u8_t *)rmem >= (u8_t *)ram_end) { ++ SYS_ARCH_DECL_PROTECT(lev); + LWIP_DEBUGF(MEM_DEBUG | 3, ("mem_free: illegal memory\n")); +-#if MEM_STATS +- ++lwip_stats.mem.err; +-#endif /* MEM_STATS */ +- sys_sem_signal(mem_sem); ++ /* protect mem stats from concurrent access */ ++ SYS_ARCH_PROTECT(lev); ++ MEM_STATS_INC(illegal); ++ SYS_ARCH_UNPROTECT(lev); + return; + } ++ /* protect the heap from concurrent access */ ++ LWIP_MEM_FREE_PROTECT(); + /* Get the corresponding struct mem ... */ + mem = (struct mem *)((u8_t *)rmem - SIZEOF_STRUCT_MEM); + /* ... which has to be in a used state ... */ +@@ -303,13 +329,14 @@ mem_free(void *rmem) + lfree = mem; + } + +-#if MEM_STATS +- lwip_stats.mem.used -= mem->next - ((u8_t *)mem - ram); +-#endif /* MEM_STATS */ ++ MEM_STATS_DEC_USED(used, mem->next - ((u8_t *)mem - ram)); + + /* finally, see if prev or next are free also */ + plug_holes(mem); +- sys_sem_signal(mem_sem); ++#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT ++ mem_free_count = 1; ++#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ ++ LWIP_MEM_FREE_UNPROTECT(); + } + + /** +@@ -321,6 +348,8 @@ mem_free(void *rmem) + * @param newsize required size after shrinking (needs to be smaller than or + * equal to the previous size) + * @return for compatibility reasons: is always == rmem, at the moment ++ * or NULL if newsize is > old size, in which case rmem is NOT touched ++ * or freed! + */ + void * + mem_realloc(void *rmem, mem_size_t newsize) +@@ -328,6 +357,8 @@ mem_realloc(void *rmem, mem_size_t newsi + mem_size_t size; + mem_size_t ptr, ptr2; + struct mem *mem, *mem2; ++ /* use the FREE_PROTECT here: it protects with sem OR SYS_ARCH_PROTECT */ ++ LWIP_MEM_FREE_DECL_PROTECT(); + + /* Expand the size of the allocated memory region so that we can + adjust for alignment. */ +@@ -346,7 +377,12 @@ mem_realloc(void *rmem, mem_size_t newsi + (u8_t *)rmem < (u8_t *)ram_end); + + if ((u8_t *)rmem < (u8_t *)ram || (u8_t *)rmem >= (u8_t *)ram_end) { ++ SYS_ARCH_DECL_PROTECT(lev); + LWIP_DEBUGF(MEM_DEBUG | 3, ("mem_realloc: illegal memory\n")); ++ /* protect mem stats from concurrent access */ ++ SYS_ARCH_PROTECT(lev); ++ MEM_STATS_INC(illegal); ++ SYS_ARCH_UNPROTECT(lev); + return rmem; + } + /* Get the corresponding struct mem ... */ +@@ -366,11 +402,9 @@ mem_realloc(void *rmem, mem_size_t newsi + } + + /* protect the heap from concurrent access */ +- sys_arch_sem_wait(mem_sem, 0); ++ LWIP_MEM_FREE_PROTECT(); + +-#if MEM_STATS +- lwip_stats.mem.used -= (size - newsize); +-#endif /* MEM_STATS */ ++ MEM_STATS_DEC_USED(used, (size - newsize)); + + mem2 = (struct mem *)&ram[mem->next]; + if(mem2->used == 0) { +@@ -426,7 +460,10 @@ mem_realloc(void *rmem, mem_size_t newsi + -> don't do anyhting. + -> the remaining space stays unused since it is too small + } */ +- sys_sem_signal(mem_sem); ++#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT ++ mem_free_count = 1; ++#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ ++ LWIP_MEM_FREE_UNPROTECT(); + return rmem; + } + +@@ -444,6 +481,10 @@ mem_malloc(mem_size_t size) + { + mem_size_t ptr, ptr2; + struct mem *mem, *mem2; ++#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT ++ u8_t local_mem_free_count = 0; ++#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ ++ LWIP_MEM_ALLOC_DECL_PROTECT(); + + if (size == 0) { + return NULL; +@@ -464,88 +505,101 @@ mem_malloc(mem_size_t size) + + /* protect the heap from concurrent access */ + sys_arch_sem_wait(mem_sem, 0); ++ LWIP_MEM_ALLOC_PROTECT(); ++#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT ++ /* run as long as a mem_free disturbed mem_malloc */ ++ do { ++ local_mem_free_count = 0; ++#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ ++ ++ /* Scan through the heap searching for a free block that is big enough, ++ * beginning with the lowest free block. ++ */ ++ for (ptr = (u8_t *)lfree - ram; ptr < MEM_SIZE_ALIGNED - size; ++ ptr = ((struct mem *)&ram[ptr])->next) { ++ mem = (struct mem *)&ram[ptr]; ++#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT ++ mem_free_count = 0; ++ LWIP_MEM_ALLOC_UNPROTECT(); ++ /* allow mem_free to run */ ++ LWIP_MEM_ALLOC_PROTECT(); ++ if (mem_free_count != 0) { ++ local_mem_free_count = mem_free_count; ++ } ++ mem_free_count = 0; ++#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ + +- /* Scan through the heap searching for a free block that is big enough, +- * beginning with the lowest free block. +- */ +- for (ptr = (u8_t *)lfree - ram; ptr < MEM_SIZE_ALIGNED - size; +- ptr = ((struct mem *)&ram[ptr])->next) { +- mem = (struct mem *)&ram[ptr]; +- +- if ((!mem->used) && +- (mem->next - (ptr + SIZEOF_STRUCT_MEM)) >= size) { +- /* mem is not used and at least perfect fit is possible: +- * mem->next - (ptr + SIZEOF_STRUCT_MEM) gives us the 'user data size' of mem */ +- +- if (mem->next - (ptr + SIZEOF_STRUCT_MEM) >= (size + SIZEOF_STRUCT_MEM + MIN_SIZE_ALIGNED)) { +- /* (in addition to the above, we test if another struct mem (SIZEOF_STRUCT_MEM) containing +- * at least MIN_SIZE_ALIGNED of data also fits in the 'user data space' of 'mem') +- * -> split large block, create empty remainder, +- * remainder must be large enough to contain MIN_SIZE_ALIGNED data: if +- * mem->next - (ptr + (2*SIZEOF_STRUCT_MEM)) == size, +- * struct mem would fit in but no data between mem2 and mem2->next +- * @todo we could leave out MIN_SIZE_ALIGNED. We would create an empty +- * region that couldn't hold data, but when mem->next gets freed, +- * the 2 regions would be combined, resulting in more free memory +- */ +- ptr2 = ptr + SIZEOF_STRUCT_MEM + size; +- /* create mem2 struct */ +- mem2 = (struct mem *)&ram[ptr2]; +- mem2->used = 0; +- mem2->next = mem->next; +- mem2->prev = ptr; +- /* and insert it between mem and mem->next */ +- mem->next = ptr2; +- mem->used = 1; +- +- if (mem2->next != MEM_SIZE_ALIGNED) { +- ((struct mem *)&ram[mem2->next])->prev = ptr2; +- } +-#if MEM_STATS +- lwip_stats.mem.used += (size + SIZEOF_STRUCT_MEM); +- if (lwip_stats.mem.max < lwip_stats.mem.used) { +- lwip_stats.mem.max = lwip_stats.mem.used; ++ if ((!mem->used) && ++ (mem->next - (ptr + SIZEOF_STRUCT_MEM)) >= size) { ++ /* mem is not used and at least perfect fit is possible: ++ * mem->next - (ptr + SIZEOF_STRUCT_MEM) gives us the 'user data size' of mem */ ++ ++ if (mem->next - (ptr + SIZEOF_STRUCT_MEM) >= (size + SIZEOF_STRUCT_MEM + MIN_SIZE_ALIGNED)) { ++ /* (in addition to the above, we test if another struct mem (SIZEOF_STRUCT_MEM) containing ++ * at least MIN_SIZE_ALIGNED of data also fits in the 'user data space' of 'mem') ++ * -> split large block, create empty remainder, ++ * remainder must be large enough to contain MIN_SIZE_ALIGNED data: if ++ * mem->next - (ptr + (2*SIZEOF_STRUCT_MEM)) == size, ++ * struct mem would fit in but no data between mem2 and mem2->next ++ * @todo we could leave out MIN_SIZE_ALIGNED. We would create an empty ++ * region that couldn't hold data, but when mem->next gets freed, ++ * the 2 regions would be combined, resulting in more free memory ++ */ ++ ptr2 = ptr + SIZEOF_STRUCT_MEM + size; ++ /* create mem2 struct */ ++ mem2 = (struct mem *)&ram[ptr2]; ++ mem2->used = 0; ++ mem2->next = mem->next; ++ mem2->prev = ptr; ++ /* and insert it between mem and mem->next */ ++ mem->next = ptr2; ++ mem->used = 1; ++ ++ if (mem2->next != MEM_SIZE_ALIGNED) { ++ ((struct mem *)&ram[mem2->next])->prev = ptr2; ++ } ++ MEM_STATS_INC_USED(used, (size + SIZEOF_STRUCT_MEM)); ++ } else { ++ /* (a mem2 struct does no fit into the user data space of mem and mem->next will always ++ * be used at this point: if not we have 2 unused structs in a row, plug_holes should have ++ * take care of this). ++ * -> near fit or excact fit: do not split, no mem2 creation ++ * also can't move mem->next directly behind mem, since mem->next ++ * will always be used at this point! ++ */ ++ mem->used = 1; ++ MEM_STATS_INC_USED(used, mem->next - ((u8_t *)mem - ram)); + } +-#endif /* MEM_STATS */ +- } else { +- /* (a mem2 struct does no fit into the user data space of mem and mem->next will always +- * be used at this point: if not we have 2 unused structs in a row, plug_holes should have +- * take care of this). +- * -> near fit or excact fit: do not split, no mem2 creation +- * also can't move mem->next directly behind mem, since mem->next +- * will always be used at this point! +- */ +- mem->used = 1; +-#if MEM_STATS +- lwip_stats.mem.used += mem->next - ((u8_t *)mem - ram); +- if (lwip_stats.mem.max < lwip_stats.mem.used) { +- lwip_stats.mem.max = lwip_stats.mem.used; +- } +-#endif /* MEM_STATS */ +- } + +- if (mem == lfree) { +- /* Find next free block after mem and update lowest free pointer */ +- while (lfree->used && lfree != ram_end) { +- lfree = (struct mem *)&ram[lfree->next]; ++ if (mem == lfree) { ++ /* Find next free block after mem and update lowest free pointer */ ++ while (lfree->used && lfree != ram_end) { ++ LWIP_MEM_ALLOC_UNPROTECT(); ++ /* prevent high interrupt latency... */ ++ LWIP_MEM_ALLOC_PROTECT(); ++ lfree = (struct mem *)&ram[lfree->next]; ++ } ++ LWIP_ASSERT("mem_malloc: !lfree->used", ((lfree == ram_end) || (!lfree->used))); + } +- LWIP_ASSERT("mem_malloc: !lfree->used", ((lfree == ram_end) || (!lfree->used))); +- } +- sys_sem_signal(mem_sem); +- LWIP_ASSERT("mem_malloc: allocated memory not above ram_end.", +- (mem_ptr_t)mem + SIZEOF_STRUCT_MEM + size <= (mem_ptr_t)ram_end); +- LWIP_ASSERT("mem_malloc: allocated memory properly aligned.", +- (unsigned long)((u8_t *)mem + SIZEOF_STRUCT_MEM) % MEM_ALIGNMENT == 0); +- LWIP_ASSERT("mem_malloc: sanity check alignment", +- (((mem_ptr_t)mem) & (MEM_ALIGNMENT-1)) == 0); ++ LWIP_MEM_ALLOC_UNPROTECT(); ++ sys_sem_signal(mem_sem); ++ LWIP_ASSERT("mem_malloc: allocated memory not above ram_end.", ++ (mem_ptr_t)mem + SIZEOF_STRUCT_MEM + size <= (mem_ptr_t)ram_end); ++ LWIP_ASSERT("mem_malloc: allocated memory properly aligned.", ++ (unsigned long)((u8_t *)mem + SIZEOF_STRUCT_MEM) % MEM_ALIGNMENT == 0); ++ LWIP_ASSERT("mem_malloc: sanity check alignment", ++ (((mem_ptr_t)mem) & (MEM_ALIGNMENT-1)) == 0); + +- return (u8_t *)mem + SIZEOF_STRUCT_MEM; ++ return (u8_t *)mem + SIZEOF_STRUCT_MEM; ++ } + } +- } ++#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT ++ /* if we got interrupted by a mem_free, try again */ ++ } while(local_mem_free_count != 0); ++#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ + LWIP_DEBUGF(MEM_DEBUG | 2, ("mem_malloc: could not allocate %"S16_F" bytes\n", (s16_t)size)); +-#if MEM_STATS +- ++lwip_stats.mem.err; +-#endif /* MEM_STATS */ ++ MEM_STATS_INC(err); ++ LWIP_MEM_ALLOC_UNPROTECT(); + sys_sem_signal(mem_sem); + return NULL; + } +Index: src/core/memp.c +=================================================================== +RCS file: /sources/lwip/lwip/src/core/memp.c,v +retrieving revision 1.55 +retrieving revision 1.56 +diff -u -p -r1.55 -r1.56 +--- a/src/core/memp.c 25 Nov 2007 10:43:28 -0000 1.55 ++++ b/src/core/memp.c 27 Jun 2008 18:37:54 -0000 1.56 +@@ -252,13 +252,12 @@ memp_init(void) + struct memp *memp; + u16_t i, j; + +-#if MEMP_STATS + for (i = 0; i < MEMP_MAX; ++i) { +- lwip_stats.memp[i].used = lwip_stats.memp[i].max = +- lwip_stats.memp[i].err = 0; +- lwip_stats.memp[i].avail = memp_num[i]; ++ MEMP_STATS_AVAIL(used, i, 0); ++ MEMP_STATS_AVAIL(max, i, 0); ++ MEMP_STATS_AVAIL(err, i, 0); ++ MEMP_STATS_AVAIL(avail, i, memp_num[i]); + } +-#endif /* MEMP_STATS */ + + memp = LWIP_MEM_ALIGN(memp_memory); + /* for every pool: */ +@@ -315,20 +314,13 @@ memp_malloc_fn(memp_t type, const char* + memp->file = file; + memp->line = line; + #endif /* MEMP_OVERFLOW_CHECK */ +-#if MEMP_STATS +- ++lwip_stats.memp[type].used; +- if (lwip_stats.memp[type].used > lwip_stats.memp[type].max) { +- lwip_stats.memp[type].max = lwip_stats.memp[type].used; +- } +-#endif /* MEMP_STATS */ ++ MEMP_STATS_INC_USED(used, type); + LWIP_ASSERT("memp_malloc: memp properly aligned", + ((mem_ptr_t)memp % MEM_ALIGNMENT) == 0); + memp = (struct memp*)((u8_t*)memp + MEMP_SIZE); + } else { + LWIP_DEBUGF(MEMP_DEBUG | 2, ("memp_malloc: out of memory in pool %s\n", memp_desc[type])); +-#if MEMP_STATS +- ++lwip_stats.memp[type].err; +-#endif /* MEMP_STATS */ ++ MEMP_STATS_INC(err, type); + } + + SYS_ARCH_UNPROTECT(old_level); +@@ -365,9 +357,7 @@ memp_free(memp_t type, void *mem) + #endif /* MEMP_OVERFLOW_CHECK >= 2 */ + #endif /* MEMP_OVERFLOW_CHECK */ + +-#if MEMP_STATS +- lwip_stats.memp[type].used--; +-#endif /* MEMP_STATS */ ++ MEMP_STATS_DEC(used, type); + + memp->next = memp_tab[type]; + memp_tab[type] = memp; +Index: src/core/netif.c +=================================================================== +RCS file: /sources/lwip/lwip/src/core/netif.c,v +retrieving revision 1.65 +retrieving revision 1.68 +diff -u -p -r1.65 -r1.68 +--- a/src/core/netif.c 9 Oct 2007 20:00:55 -0000 1.65 ++++ b/src/core/netif.c 19 Jun 2008 16:27:18 -0000 1.68 +@@ -45,6 +45,12 @@ + #include "lwip/snmp.h" + #include "lwip/igmp.h" + #include "netif/etharp.h" ++#if ENABLE_LOOPBACK ++#include "lwip/sys.h" ++#if LWIP_NETIF_LOOPBACK_MULTITHREADING ++#include "lwip/tcpip.h" ++#endif /* LWIP_NETIF_LOOPBACK_MULTITHREADING */ ++#endif /* ENABLE_LOOPBACK */ + + #if LWIP_NETIF_STATUS_CALLBACK + #define NETIF_STATUS_CALLBACK(n) { if (n->status_callback) (n->status_callback)(n); } +@@ -106,6 +112,10 @@ netif_add(struct netif *netif, struct ip + #if LWIP_IGMP + netif->igmp_mac_filter = NULL; + #endif /* LWIP_IGMP */ ++#if ENABLE_LOOPBACK ++ netif->loop_first = NULL; ++ netif->loop_last = NULL; ++#endif /* ENABLE_LOOPBACK */ + + /* remember netif specific state information data */ + netif->state = state; +@@ -114,6 +124,9 @@ netif_add(struct netif *netif, struct ip + #if LWIP_NETIF_HWADDRHINT + netif->addr_hint = NULL; + #endif /* LWIP_NETIF_HWADDRHINT*/ ++#if ENABLE_LOOPBACK && LWIP_LOOPBACK_MAX_PBUFS ++ netif->loop_cnt_current = 0; ++#endif /* ENABLE_LOOPBACK && LWIP_LOOPBACK_MAX_PBUFS */ + + netif_set_addr(netif, ipaddr, netmask, gw); + +@@ -493,7 +506,158 @@ u8_t netif_is_link_up(struct netif *neti + */ + void netif_set_link_callback(struct netif *netif, void (* link_callback)(struct netif *netif )) + { +- if ( netif ) +- netif->link_callback = link_callback; ++ if (netif) { ++ netif->link_callback = link_callback; ++ } + } + #endif /* LWIP_NETIF_LINK_CALLBACK */ ++ ++#if ENABLE_LOOPBACK ++/** ++ * Send an IP packet to be received on the same netif (loopif-like). ++ * The pbuf is simply copied and handed back to netif->input. ++ * In multithreaded mode, this is done directly since netif->input must put ++ * the packet on a queue. ++ * In callback mode, the packet is put on an internal queue and is fed to ++ * netif->input by netif_poll(). ++ * ++ * @param netif the lwip network interface structure ++ * @param p the (IP) packet to 'send' ++ * @param ipaddr the ip address to send the packet to (not used) ++ * @return ERR_OK if the packet has been sent ++ * ERR_MEM if the pbuf used to copy the packet couldn't be allocated ++ */ ++err_t ++netif_loop_output(struct netif *netif, struct pbuf *p, ++ struct ip_addr *ipaddr) ++{ ++ struct pbuf *r; ++ err_t err; ++ struct pbuf *last; ++#if LWIP_LOOPBACK_MAX_PBUFS ++ u8_t clen = 0; ++#endif /* LWIP_LOOPBACK_MAX_PBUFS */ ++ SYS_ARCH_DECL_PROTECT(lev); ++ LWIP_UNUSED_ARG(ipaddr); ++ ++ /* Allocate a new pbuf */ ++ r = pbuf_alloc(PBUF_LINK, p->tot_len, PBUF_RAM); ++ if (r == NULL) { ++ return ERR_MEM; ++ } ++#if LWIP_LOOPBACK_MAX_PBUFS ++ clen = pbuf_clen(r); ++ /* check for overflow or too many pbuf on queue */ ++ if(((netif->loop_cnt_current + clen) < netif->loop_cnt_current) || ++ ((netif->loop_cnt_current + clen) > LWIP_LOOPBACK_MAX_PBUFS)) { ++ pbuf_free(r); ++ r = NULL; ++ return ERR_MEM; ++ } ++ netif->loop_cnt_current += clen; ++#endif /* LWIP_LOOPBACK_MAX_PBUFS */ ++ ++ /* Copy the whole pbuf queue p into the single pbuf r */ ++ if ((err = pbuf_copy(r, p)) != ERR_OK) { ++ pbuf_free(r); ++ r = NULL; ++ return err; ++ } ++ ++ /* Put the packet on a linked list which gets emptied through calling ++ netif_poll(). */ ++ ++ /* let last point to the last pbuf in chain r */ ++ for (last = r; last->next != NULL; last = last->next); ++ ++ SYS_ARCH_PROTECT(lev); ++ if(netif->loop_first != NULL) { ++ LWIP_ASSERT("if first != NULL, last must also be != NULL", netif->loop_last != NULL); ++ netif->loop_last->next = r; ++ netif->loop_last = last; ++ } else { ++ netif->loop_first = r; ++ netif->loop_last = last; ++ } ++ SYS_ARCH_UNPROTECT(lev); ++ ++#if LWIP_NETIF_LOOPBACK_MULTITHREADING ++ /* For multithreading environment, schedule a call to netif_poll */ ++ tcpip_callback(netif_poll, netif); ++#endif /* LWIP_NETIF_LOOPBACK_MULTITHREADING */ ++ ++ return ERR_OK; ++} ++ ++/** ++ * Call netif_poll() in the main loop of your application. This is to prevent ++ * reentering non-reentrant functions like tcp_input(). Packets passed to ++ * netif_loop_output() are put on a list that is passed to netif->input() by ++ * netif_poll(). ++ */ ++void ++netif_poll(struct netif *netif) ++{ ++ struct pbuf *in; ++ SYS_ARCH_DECL_PROTECT(lev); ++ ++ do { ++ /* Get a packet from the list. With SYS_LIGHTWEIGHT_PROT=1, this is protected */ ++ SYS_ARCH_PROTECT(lev); ++ in = netif->loop_first; ++ if(in != NULL) { ++ struct pbuf *in_end = in; ++#if LWIP_LOOPBACK_MAX_PBUFS ++ u8_t clen = pbuf_clen(in); ++ /* adjust the number of pbufs on queue */ ++ LWIP_ASSERT("netif->loop_cnt_current underflow", ++ ((netif->loop_cnt_current - clen) < netif->loop_cnt_current)); ++ netif->loop_cnt_current -= clen; ++#endif /* LWIP_LOOPBACK_MAX_PBUFS */ ++ while(in_end->len != in_end->tot_len) { ++ LWIP_ASSERT("bogus pbuf: len != tot_len but next == NULL!", in_end->next != NULL); ++ in_end = in_end->next; ++ } ++ /* 'in_end' now points to the last pbuf from 'in' */ ++ if(in_end == netif->loop_last) { ++ /* this was the last pbuf in the list */ ++ netif->loop_first = netif->loop_last = NULL; ++ } else { ++ /* pop the pbuf off the list */ ++ netif->loop_first = in_end->next; ++ LWIP_ASSERT("should not be null since first != last!", netif->loop_first != NULL); ++ } ++ /* De-queue the pbuf from its successors on the 'loop_' list. */ ++ in_end->next = NULL; ++ } ++ SYS_ARCH_UNPROTECT(lev); ++ ++ if(in != NULL) { ++ /* loopback packets are always IP packets! */ ++ if(ip_input(in, netif) != ERR_OK) { ++ pbuf_free(in); ++ } ++ /* Don't reference the packet any more! */ ++ in = NULL; ++ } ++ /* go on while there is a packet on the list */ ++ } while(netif->loop_first != NULL); ++} ++ ++#if !LWIP_NETIF_LOOPBACK_MULTITHREADING ++/** ++ * Calls netif_poll() for every netif on the netif_list. ++ */ ++void ++netif_poll_all(void) ++{ ++ struct netif *netif = netif_list; ++ /* loop through netifs */ ++ while (netif != NULL) { ++ netif_poll(netif); ++ /* proceed to next network interface */ ++ netif = netif->next; ++ } ++} ++#endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */ ++#endif /* ENABLE_LOOPBACK */ +Index: src/core/pbuf.c +=================================================================== +RCS file: /sources/lwip/lwip/src/core/pbuf.c,v +retrieving revision 1.127 +retrieving revision 1.128 +diff -u -p -r1.127 -r1.128 +--- a/src/core/pbuf.c 4 Mar 2008 16:37:46 -0000 1.127 ++++ b/src/core/pbuf.c 1 Apr 2008 19:05:40 -0000 1.128 +@@ -667,8 +667,8 @@ pbuf_dechain(struct pbuf *p) + * + * @note Only one packet is copied, no packet queue! + * +- * @param p_to pbuf source of the copy +- * @param p_from pbuf destination of the copy ++ * @param p_to pbuf destination of the copy ++ * @param p_from pbuf source of the copy + * + * @return ERR_OK if pbuf was copied + * ERR_ARG if one of the pbufs is NULL or p_to is not big +Index: src/core/stats.c +=================================================================== +RCS file: /sources/lwip/lwip/src/core/stats.c,v +retrieving revision 1.27 +retrieving revision 1.28 +diff -u -p -r1.27 -r1.28 +--- a/src/core/stats.c 4 Mar 2008 16:31:32 -0000 1.27 ++++ b/src/core/stats.c 27 Jun 2008 18:37:54 -0000 1.28 +@@ -54,7 +54,6 @@ stats_display_proto(struct stats_proto * + { + LWIP_PLATFORM_DIAG(("\n%s\n\t", name)); + LWIP_PLATFORM_DIAG(("xmit: %"STAT_COUNTER_F"\n\t", proto->xmit)); +- LWIP_PLATFORM_DIAG(("rexmit: %"STAT_COUNTER_F"\n\t", proto->rexmit)); + LWIP_PLATFORM_DIAG(("recv: %"STAT_COUNTER_F"\n\t", proto->recv)); + LWIP_PLATFORM_DIAG(("fw: %"STAT_COUNTER_F"\n\t", proto->fw)); + LWIP_PLATFORM_DIAG(("drop: %"STAT_COUNTER_F"\n\t", proto->drop)); +@@ -68,6 +67,7 @@ stats_display_proto(struct stats_proto * + LWIP_PLATFORM_DIAG(("cachehit: %"STAT_COUNTER_F"\n", proto->cachehit)); + } + ++#if IGMP_STATS + void + stats_display_igmp(struct stats_igmp *igmp) + { +@@ -82,7 +82,9 @@ stats_display_igmp(struct stats_igmp *ig + LWIP_PLATFORM_DIAG(("report_rxed: %"STAT_COUNTER_F"\n\t", igmp->report_rxed)); + LWIP_PLATFORM_DIAG(("group_query_rxed: %"STAT_COUNTER_F"\n", igmp->group_query_rxed)); + } ++#endif /* IGMP_STATS */ + ++#if MEM_STATS || MEMP_STATS + void + stats_display_mem(struct stats_mem *mem, char *name) + { +@@ -93,48 +95,53 @@ stats_display_mem(struct stats_mem *mem, + LWIP_PLATFORM_DIAG(("err: %"U32_F"\n", (u32_t)mem->err)); + } + ++#if MEMP_STATS + void +-stats_display(void) ++stats_display_memp(struct stats_mem *mem, int index) + { +-#if MEMP_STATS +- s16_t i; + char * memp_names[] = { + #define LWIP_MEMPOOL(name,num,size,desc) desc, + #include "lwip/memp_std.h" + }; +-#endif +-#if LINK_STATS +- stats_display_proto(&lwip_stats.link, "LINK"); +-#endif +-#if ETHARP_STATS +- stats_display_proto(&lwip_stats.etharp, "ETHARP"); +-#endif +-#if IPFRAG_STATS +- stats_display_proto(&lwip_stats.ip_frag, "IP_FRAG"); +-#endif +-#if IP_STATS +- stats_display_proto(&lwip_stats.ip, "IP"); +-#endif +-#if ICMP_STATS +- stats_display_proto(&lwip_stats.icmp, "ICMP"); +-#endif +-#if IGMP_STATS +- stats_display_igmp(&lwip_stats.igmp); +-#endif +-#if UDP_STATS +- stats_display_proto(&lwip_stats.udp, "UDP"); +-#endif +-#if TCP_STATS +- stats_display_proto(&lwip_stats.tcp, "TCP"); +-#endif +-#if MEM_STATS +- stats_display_mem(&lwip_stats.mem, "HEAP"); +-#endif +-#if MEMP_STATS ++ if(index < MEMP_MAX) { ++ stats_display_mem(mem, memp_names[index]); ++ } ++} ++#endif /* MEMP_STATS */ ++#endif /* MEM_STATS || MEMP_STATS */ ++ ++#if SYS_STATS ++void ++stats_display_sys(struct stats_sys *sys) ++{ ++ LWIP_PLATFORM_DIAG(("\nSYS\n\t")); ++ LWIP_PLATFORM_DIAG(("sem.used: %"U32_F"\n\t", (u32_t)sys->sem.used)); ++ LWIP_PLATFORM_DIAG(("sem.max: %"U32_F"\n\t", (u32_t)sys->sem.max)); ++ LWIP_PLATFORM_DIAG(("sem.err: %"U32_F"\n\t", (u32_t)sys->sem.err)); ++ LWIP_PLATFORM_DIAG(("mbox.used: %"U32_F"\n\t", (u32_t)sys->mbox.used)); ++ LWIP_PLATFORM_DIAG(("mbox.max: %"U32_F"\n\t", (u32_t)sys->mbox.max)); ++ LWIP_PLATFORM_DIAG(("mbox.err: %"U32_F"\n\t", (u32_t)sys->mbox.err)); ++} ++#endif /* SYS_STATS */ ++ ++void ++stats_display(void) ++{ ++ s16_t i; ++ ++ LINK_STATS_DISPLAY(); ++ ETHARP_STATS_DISPLAY(); ++ IPFRAG_STATS_DISPLAY(); ++ IP_STATS_DISPLAY(); ++ IGMP_STATS_DISPLAY(); ++ ICMP_STATS_DISPLAY(); ++ UDP_STATS_DISPLAY(); ++ TCP_STATS_DISPLAY(); ++ MEM_STATS_DISPLAY(); + for (i = 0; i < MEMP_MAX; i++) { +- stats_display_mem(&lwip_stats.memp[i], memp_names[i]); ++ MEMP_STATS_DISPLAY(i); + } +-#endif ++ SYS_STATS_DISPLAY(); + } + #endif /* LWIP_STATS_DISPLAY */ + +Index: src/core/sys.c +=================================================================== +RCS file: /sources/lwip/lwip/src/core/sys.c,v +retrieving revision 1.32 +retrieving revision 1.33 +diff -u -p -r1.32 -r1.33 +--- a/src/core/sys.c 25 Nov 2007 13:57:05 -0000 1.32 ++++ b/src/core/sys.c 16 Jul 2008 20:36:12 -0000 1.33 +@@ -65,7 +65,7 @@ struct sswt_cb + void + sys_mbox_fetch(sys_mbox_t mbox, void **msg) + { +- u32_t time; ++ u32_t time_needed; + struct sys_timeouts *timeouts; + struct sys_timeo *tmptimeout; + sys_timeout_handler h; +@@ -76,18 +76,18 @@ sys_mbox_fetch(sys_mbox_t mbox, void **m + + if (!timeouts || !timeouts->next) { + UNLOCK_TCPIP_CORE(); +- time = sys_arch_mbox_fetch(mbox, msg, 0); ++ time_needed = sys_arch_mbox_fetch(mbox, msg, 0); + LOCK_TCPIP_CORE(); + } else { + if (timeouts->next->time > 0) { + UNLOCK_TCPIP_CORE(); +- time = sys_arch_mbox_fetch(mbox, msg, timeouts->next->time); ++ time_needed = sys_arch_mbox_fetch(mbox, msg, timeouts->next->time); + LOCK_TCPIP_CORE(); + } else { +- time = SYS_ARCH_TIMEOUT; ++ time_needed = SYS_ARCH_TIMEOUT; + } + +- if (time == SYS_ARCH_TIMEOUT) { ++ if (time_needed == SYS_ARCH_TIMEOUT) { + /* If time == SYS_ARCH_TIMEOUT, a timeout occured before a message + could be fetched. We should now call the timeout handler and + deallocate the memory allocated for the timeout. */ +@@ -107,8 +107,8 @@ sys_mbox_fetch(sys_mbox_t mbox, void **m + /* If time != SYS_ARCH_TIMEOUT, a message was received before the timeout + occured. The time variable is set to the number of + milliseconds we waited for the message. */ +- if (time < timeouts->next->time) { +- timeouts->next->time -= time; ++ if (time_needed < timeouts->next->time) { ++ timeouts->next->time -= time_needed; + } else { + timeouts->next->time = 0; + } +@@ -125,7 +125,7 @@ sys_mbox_fetch(sys_mbox_t mbox, void **m + void + sys_sem_wait(sys_sem_t sem) + { +- u32_t time; ++ u32_t time_needed; + struct sys_timeouts *timeouts; + struct sys_timeo *tmptimeout; + sys_timeout_handler h; +@@ -139,12 +139,12 @@ sys_sem_wait(sys_sem_t sem) + sys_arch_sem_wait(sem, 0); + } else { + if (timeouts->next->time > 0) { +- time = sys_arch_sem_wait(sem, timeouts->next->time); ++ time_needed = sys_arch_sem_wait(sem, timeouts->next->time); + } else { +- time = SYS_ARCH_TIMEOUT; ++ time_needed = SYS_ARCH_TIMEOUT; + } + +- if (time == SYS_ARCH_TIMEOUT) { ++ if (time_needed == SYS_ARCH_TIMEOUT) { + /* If time == SYS_ARCH_TIMEOUT, a timeout occured before a message + could be fetched. We should now call the timeout handler and + deallocate the memory allocated for the timeout. */ +@@ -164,8 +164,8 @@ sys_sem_wait(sys_sem_t sem) + /* If time != SYS_ARCH_TIMEOUT, a message was received before the timeout + occured. The time variable is set to the number of + milliseconds we waited for the message. */ +- if (time < timeouts->next->time) { +- timeouts->next->time -= time; ++ if (time_needed < timeouts->next->time) { ++ timeouts->next->time -= time_needed; + } else { + timeouts->next->time = 0; + } +Index: src/core/tcp.c +=================================================================== +RCS file: /sources/lwip/lwip/src/core/tcp.c,v +retrieving revision 1.85 +retrieving revision 1.86 +diff -u -p -r1.85 -r1.86 +--- a/src/core/tcp.c 22 Jan 2008 21:15:15 -0000 1.85 ++++ b/src/core/tcp.c 26 Mar 2008 11:57:13 -0000 1.86 +@@ -509,7 +509,8 @@ tcp_connect(struct tcp_pcb *pcb, struct + pcb->rcv_wnd = TCP_WND; + pcb->rcv_ann_wnd = TCP_WND; + pcb->snd_wnd = TCP_WND; +- /* The send MSS is updated when an MSS option is received. */ ++ /* As initial send MSS, we use TCP_MSS but limit it to 536. ++ The send MSS is updated when an MSS option is received. */ + pcb->mss = (TCP_MSS > 536) ? 536 : TCP_MSS; + #if TCP_CALCULATE_EFF_SEND_MSS + pcb->mss = tcp_eff_send_mss(pcb->mss, ipaddr); +@@ -991,7 +992,8 @@ tcp_alloc(u8_t prio) + pcb->rcv_ann_wnd = TCP_WND; + pcb->tos = 0; + pcb->ttl = TCP_TTL; +- /* The send MSS is updated when an MSS option is received. */ ++ /* As initial send MSS, we use TCP_MSS but limit it to 536. ++ The send MSS is updated when an MSS option is received. */ + pcb->mss = (TCP_MSS > 536) ? 536 : TCP_MSS; + pcb->rto = 3000 / TCP_SLOW_INTERVAL; + pcb->sa = 0; +Index: src/core/tcp_in.c +=================================================================== +RCS file: /sources/lwip/lwip/src/core/tcp_in.c,v +retrieving revision 1.97 +retrieving revision 1.100 +diff -u -p -r1.97 -r1.100 +--- a/src/core/tcp_in.c 22 Jan 2008 21:15:15 -0000 1.97 ++++ b/src/core/tcp_in.c 24 Jun 2008 15:46:39 -0000 1.100 +@@ -511,7 +511,7 @@ tcp_process(struct tcp_pcb *pcb) + } + } else { + if (TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt, +- pcb->rcv_nxt+pcb->rcv_ann_wnd)) { ++ pcb->rcv_nxt+pcb->rcv_wnd)) { + acceptable = 1; + } + } +@@ -1038,7 +1038,7 @@ tcp_receive(struct tcp_pcb *pcb) + and below rcv_nxt + rcv_wnd) in order to be further + processed. */ + if (TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt, +- pcb->rcv_nxt + pcb->rcv_ann_wnd - 1)){ ++ pcb->rcv_nxt + pcb->rcv_wnd - 1)){ + if (pcb->rcv_nxt == seqno) { + accepted_inseq = 1; + /* The incoming segment is the next in sequence. We check if +@@ -1195,14 +1195,14 @@ tcp_receive(struct tcp_pcb *pcb) + } else { + pcb->ooseq = cseg; + } +- } +- tcp_seg_free(next); +- if (cseg->next != NULL) { +- next = cseg->next; +- if (TCP_SEQ_GT(seqno + cseg->len, next->tcphdr->seqno)) { +- /* We need to trim the incoming segment. */ +- cseg->len = (u16_t)(next->tcphdr->seqno - seqno); +- pbuf_realloc(cseg->p, cseg->len); ++ tcp_seg_free(next); ++ if (cseg->next != NULL) { ++ next = cseg->next; ++ if (TCP_SEQ_GT(seqno + cseg->len, next->tcphdr->seqno)) { ++ /* We need to trim the incoming segment. */ ++ cseg->len = (u16_t)(next->tcphdr->seqno - seqno); ++ pbuf_realloc(cseg->p, cseg->len); ++ } + } + } + break; +@@ -1282,10 +1282,7 @@ tcp_receive(struct tcp_pcb *pcb) + + } + } else { +- if(!TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt, +- pcb->rcv_nxt + pcb->rcv_ann_wnd-1)){ +- tcp_ack_now(pcb); +- } ++ tcp_ack_now(pcb); + } + } else { + /* Segments with length 0 is taken care of here. Segments that +@@ -1331,7 +1328,8 @@ tcp_parseopt(struct tcp_pcb *pcb) + opts[c + 1] == 0x04) { + /* An MSS option with the right option length. */ + mss = (opts[c + 2] << 8) | opts[c + 3]; +- pcb->mss = mss > TCP_MSS? TCP_MSS: mss; ++ /* Limit the mss to the configured TCP_MSS and prevent division by zero */ ++ pcb->mss = ((mss > TCP_MSS) || (mss == 0)) ? TCP_MSS : mss; + + /* And we are done processing options. */ + break; +Index: src/core/ipv4/autoip.c +=================================================================== +RCS file: /sources/lwip/lwip/src/core/ipv4/autoip.c,v +retrieving revision 1.16 +retrieving revision 1.17 +diff -u -p -r1.16 -r1.17 +--- a/src/core/ipv4/autoip.c 26 Jan 2008 16:11:40 -0000 1.16 ++++ b/src/core/ipv4/autoip.c 17 Jun 2008 20:16:23 -0000 1.17 +@@ -395,8 +395,8 @@ autoip_arp_reply(struct netif *netif, st + /* Copy struct ip_addr2 to aligned ip_addr, to support compilers without + * structure packing (not using structure copy which breaks strict-aliasing rules). + */ +- MEMCPY(&sipaddr, &hdr->sipaddr, sizeof(sipaddr)); +- MEMCPY(&dipaddr, &hdr->dipaddr, sizeof(dipaddr)); ++ SMEMCPY(&sipaddr, &hdr->sipaddr, sizeof(sipaddr)); ++ SMEMCPY(&dipaddr, &hdr->dipaddr, sizeof(dipaddr)); + + if ((netif->autoip->state == AUTOIP_STATE_PROBING) || + ((netif->autoip->state == AUTOIP_STATE_ANNOUNCING) && +Index: src/core/ipv4/inet_chksum.c +=================================================================== +RCS file: /sources/lwip/lwip/src/core/ipv4/inet_chksum.c,v +retrieving revision 1.4 +retrieving revision 1.5 +diff -u -p -r1.4 -r1.5 +--- a/src/core/ipv4/inet_chksum.c 10 Mar 2008 16:12:31 -0000 1.4 ++++ b/src/core/ipv4/inet_chksum.c 17 Jun 2008 20:06:25 -0000 1.5 +@@ -41,8 +41,6 @@ + #include "lwip/inet_chksum.h" + #include "lwip/inet.h" + +-#include <string.h> +- + /* These are some reference implementations of the checksum algorithm, with the + * aim of being simple, correct and fully portable. Checksumming is the + * first thing you would want to optimize for your platform. If you create +@@ -65,6 +63,11 @@ + # define LWIP_CHKSUM_ALGORITHM 0 + #endif + ++/** Like the name says... */ ++#define SWAP_BYTES_IN_WORD(w) ((w & 0xff) << 8) | ((w & 0xff00) >> 8) ++/** Split an u32_t in two u16_ts and add them up */ ++#define FOLD_U32T(u) ((u >> 16) + (u & 0x0000ffffUL)) ++ + #if (LWIP_CHKSUM_ALGORITHM == 1) /* Version #1 */ + /** + * lwip checksum +@@ -86,8 +89,7 @@ lwip_standard_chksum(void *dataptr, u16_ + acc = 0; + /* dataptr may be at odd or even addresses */ + octetptr = (u8_t*)dataptr; +- while (len > 1) +- { ++ while (len > 1) { + /* declare first octet as most significant + thus assume network order, ignoring host order */ + src = (*octetptr) << 8; +@@ -98,8 +100,7 @@ lwip_standard_chksum(void *dataptr, u16_ + acc += src; + len -= 2; + } +- if (len > 0) +- { ++ if (len > 0) { + /* accumulate remaining octet */ + src = (*octetptr) << 8; + acc += src; +@@ -154,19 +155,22 @@ lwip_standard_chksum(void *dataptr, int + } + + /* Consume left-over byte, if any */ +- if (len > 0) ++ if (len > 0) { + ((u8_t *)&t)[0] = *(u8_t *)ps;; ++ } + + /* Add end bytes */ + sum += t; + +- /* Fold 32-bit sum to 16 bits */ +- while ((sum >> 16) != 0) +- sum = (sum & 0xffff) + (sum >> 16); ++ /* Fold 32-bit sum to 16 bits ++ calling this twice is propably faster than if statements... */ ++ sum = FOLD_U32T(sum); ++ sum = FOLD_U32T(sum); + + /* Swap if alignment was odd */ +- if (odd) +- sum = ((sum & 0xff) << 8) | ((sum & 0xff00) >> 8); ++ if (odd) { ++ sum = SWAP_BYTES_IN_WORD(sum); ++ } + + return sum; + } +@@ -211,18 +215,20 @@ lwip_standard_chksum(void *dataptr, int + + while (len > 7) { + tmp = sum + *pl++; /* ping */ +- if (tmp < sum) ++ if (tmp < sum) { + tmp++; /* add back carry */ ++ } + + sum = tmp + *pl++; /* pong */ +- if (sum < tmp) ++ if (sum < tmp) { + sum++; /* add back carry */ ++ } + + len -= 8; + } + + /* make room in upper bits */ +- sum = (sum >> 16) + (sum & 0xffff); ++ sum = FOLD_U32T(sum); + + ps = (u16_t *)pl; + +@@ -233,16 +239,20 @@ lwip_standard_chksum(void *dataptr, int + } + + /* dangling tail byte remaining? */ +- if (len > 0) /* include odd byte */ ++ if (len > 0) { /* include odd byte */ + ((u8_t *)&t)[0] = *(u8_t *)ps; ++ } + + sum += t; /* add end bytes */ + +- while ((sum >> 16) != 0) /* combine halves */ +- sum = (sum >> 16) + (sum & 0xffff); ++ /* Fold 32-bit sum to 16 bits ++ calling this twice is propably faster than if statements... */ ++ sum = FOLD_U32T(sum); ++ sum = FOLD_U32T(sum); + +- if (odd) +- sum = ((sum & 0xff) << 8) | ((sum & 0xff00) >> 8); ++ if (odd) { ++ sum = SWAP_BYTES_IN_WORD(sum); ++ } + + return sum; + } +@@ -277,18 +287,18 @@ inet_chksum_pseudo(struct pbuf *p, + (void *)q, (void *)q->next)); + acc += LWIP_CHKSUM(q->payload, q->len); + /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): unwrapped lwip_chksum()=%"X32_F" \n", acc));*/ +- while ((acc >> 16) != 0) { +- acc = (acc & 0xffffUL) + (acc >> 16); +- } ++ /* just executing this next line is probably faster that the if statement needed ++ to check whether we really need to execute it, and does no harm */ ++ acc = FOLD_U32T(acc); + if (q->len % 2 != 0) { + swapped = 1 - swapped; +- acc = ((acc & 0xff) << 8) | ((acc & 0xff00UL) >> 8); ++ acc = SWAP_BYTES_IN_WORD(acc); + } + /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): wrapped lwip_chksum()=%"X32_F" \n", acc));*/ + } + + if (swapped) { +- acc = ((acc & 0xff) << 8) | ((acc & 0xff00UL) >> 8); ++ acc = SWAP_BYTES_IN_WORD(acc); + } + acc += (src->addr & 0xffffUL); + acc += ((src->addr >> 16) & 0xffffUL); +@@ -297,9 +307,10 @@ inet_chksum_pseudo(struct pbuf *p, + acc += (u32_t)htons((u16_t)proto); + acc += (u32_t)htons(proto_len); + +- while ((acc >> 16) != 0) { +- acc = (acc & 0xffffUL) + (acc >> 16); +- } ++ /* Fold 32-bit sum to 16 bits ++ calling this twice is propably faster than if statements... */ ++ acc = FOLD_U32T(acc); ++ acc = FOLD_U32T(acc); + LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): pbuf chain lwip_chksum()=%"X32_F"\n", acc)); + return (u16_t)~(acc & 0xffffUL); + } +@@ -340,18 +351,17 @@ inet_chksum_pseudo_partial(struct pbuf * + chksum_len -= chklen; + LWIP_ASSERT("delete me", chksum_len < 0x7fff); + /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): unwrapped lwip_chksum()=%"X32_F" \n", acc));*/ +- while ((acc >> 16) != 0) { +- acc = (acc & 0xffffUL) + (acc >> 16); +- } ++ /* fold the upper bit down */ ++ acc = FOLD_U32T(acc); + if (q->len % 2 != 0) { + swapped = 1 - swapped; +- acc = ((acc & 0xff) << 8) | ((acc & 0xff00UL) >> 8); ++ acc = SWAP_BYTES_IN_WORD(acc); + } + /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): wrapped lwip_chksum()=%"X32_F" \n", acc));*/ + } + + if (swapped) { +- acc = ((acc & 0xff) << 8) | ((acc & 0xff00UL) >> 8); ++ acc = SWAP_BYTES_IN_WORD(acc); + } + acc += (src->addr & 0xffffUL); + acc += ((src->addr >> 16) & 0xffffUL); +@@ -360,9 +370,10 @@ inet_chksum_pseudo_partial(struct pbuf * + acc += (u32_t)htons((u16_t)proto); + acc += (u32_t)htons(proto_len); + +- while ((acc >> 16) != 0) { +- acc = (acc & 0xffffUL) + (acc >> 16); +- } ++ /* Fold 32-bit sum to 16 bits ++ calling this twice is propably faster than if statements... */ ++ acc = FOLD_U32T(acc); ++ acc = FOLD_U32T(acc); + LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): pbuf chain lwip_chksum()=%"X32_F"\n", acc)); + return (u16_t)~(acc & 0xffffUL); + } +@@ -380,13 +391,7 @@ inet_chksum_pseudo_partial(struct pbuf * + u16_t + inet_chksum(void *dataptr, u16_t len) + { +- u32_t acc; +- +- acc = LWIP_CHKSUM(dataptr, len); +- while ((acc >> 16) != 0) { +- acc = (acc & 0xffff) + (acc >> 16); +- } +- return (u16_t)~(acc & 0xffff); ++ return ~LWIP_CHKSUM(dataptr, len); + } + + /** +@@ -407,17 +412,15 @@ inet_chksum_pbuf(struct pbuf *p) + swapped = 0; + for(q = p; q != NULL; q = q->next) { + acc += LWIP_CHKSUM(q->payload, q->len); +- while ((acc >> 16) != 0) { +- acc = (acc & 0xffffUL) + (acc >> 16); +- } ++ acc = FOLD_U32T(acc); + if (q->len % 2 != 0) { + swapped = 1 - swapped; +- acc = (acc & 0x00ffUL << 8) | (acc & 0xff00UL >> 8); ++ acc = SWAP_BYTES_IN_WORD(acc); + } + } + + if (swapped) { +- acc = ((acc & 0x00ffUL) << 8) | ((acc & 0xff00UL) >> 8); ++ acc = SWAP_BYTES_IN_WORD(acc); + } + return (u16_t)~(acc & 0xffffUL); + } +Index: src/core/ipv4/ip.c +=================================================================== +RCS file: /sources/lwip/lwip/src/core/ipv4/ip.c,v +retrieving revision 1.66 +retrieving revision 1.68 +diff -u -p -r1.66 -r1.68 +--- a/src/core/ipv4/ip.c 14 Jan 2008 20:53:23 -0000 1.66 ++++ b/src/core/ipv4/ip.c 17 Jun 2008 19:39:22 -0000 1.68 +@@ -531,9 +531,19 @@ ip_output_if(struct pbuf *p, struct ip_a + LWIP_DEBUGF(IP_DEBUG, ("ip_output_if: %c%c%"U16_F"\n", netif->name[0], netif->name[1], netif->num)); + ip_debug_print(p); + +- LWIP_DEBUGF(IP_DEBUG, ("netif->output()")); ++#if (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF) ++ if (ip_addr_cmp(dest, &netif->ip_addr)) { ++ /* Packet to self, enqueue it for loopback */ ++ LWIP_DEBUGF(IP_DEBUG, ("netif_loop_output()")); ++ ++ return netif_loop_output(netif, p, dest); ++ } else ++#endif /* (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF) */ ++ { ++ LWIP_DEBUGF(IP_DEBUG, ("netif->output()")); + +- return netif->output(netif, p, dest); ++ return netif->output(netif, p, dest); ++ } + } + + /** +Index: src/include/lwip/debug.h +=================================================================== +RCS file: /sources/lwip/lwip/src/include/lwip/debug.h,v +retrieving revision 1.37 +retrieving revision 1.39 +diff -u -p -r1.37 -r1.39 +--- a/src/include/lwip/debug.h 22 Sep 2007 11:16:07 -0000 1.37 ++++ b/src/include/lwip/debug.h 16 Jul 2008 20:36:22 -0000 1.39 +@@ -61,26 +61,28 @@ + #define LWIP_DBG_HALT 0x08U + + #ifndef LWIP_NOASSERT +-#define LWIP_ASSERT(x,y) do { if(!(y)) LWIP_PLATFORM_ASSERT(x); } while(0) ++#define LWIP_ASSERT(message, assertion) do { if(!(assertion)) \ ++ LWIP_PLATFORM_ASSERT(message); } while(0) + #else /* LWIP_NOASSERT */ +-#define LWIP_ASSERT(x,y) ++#define LWIP_ASSERT(message, assertion) + #endif /* LWIP_NOASSERT */ + +-/** print "m" message only if "e" is true, and execute "h" expression */ ++/** if "expression" isn't true, then print "message" and execute "handler" expression */ + #ifndef LWIP_ERROR +-#define LWIP_ERROR(m,e,h) do { if (!(e)) { LWIP_PLATFORM_ASSERT(m); h;}} while(0) ++#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \ ++ LWIP_PLATFORM_ASSERT(message); handler;}} while(0) + #endif /* LWIP_ERROR */ + + #ifdef LWIP_DEBUG + /** print debug message only if debug message type is enabled... + * AND is of correct type AND is at least LWIP_DBG_LEVEL + */ +-#define LWIP_DEBUGF(debug,x) do { \ ++#define LWIP_DEBUGF(debug, message) do { \ + if ( \ + ((debug) & LWIP_DBG_ON) && \ + ((debug) & LWIP_DBG_TYPES_ON) && \ + ((s16_t)((debug) & LWIP_DBG_MASK_LEVEL) >= LWIP_DBG_MIN_LEVEL)) { \ +- LWIP_PLATFORM_DIAG(x); \ ++ LWIP_PLATFORM_DIAG(message); \ + if ((debug) & LWIP_DBG_HALT) { \ + while(1); \ + } \ +@@ -88,7 +90,7 @@ + } while(0) + + #else /* LWIP_DEBUG */ +-#define LWIP_DEBUGF(debug,x) ++#define LWIP_DEBUGF(debug, message) + #endif /* LWIP_DEBUG */ + + #endif /* __LWIP_DEBUG_H__ */ +Index: src/include/lwip/err.h +=================================================================== +RCS file: /sources/lwip/lwip/src/include/lwip/err.h,v +retrieving revision 1.13 +retrieving revision 1.15 +diff -u -p -r1.13 -r1.15 +--- a/src/include/lwip/err.h 13 Dec 2007 23:06:50 -0000 1.13 ++++ b/src/include/lwip/err.h 17 Jun 2008 20:27:32 -0000 1.15 +@@ -33,37 +33,43 @@ + #define __LWIP_ERR_H__ + + #include "lwip/opt.h" ++#include "lwip/arch.h" + + #ifdef __cplusplus + extern "C" { + #endif + +-typedef s8_t err_t; ++/** Define LWIP_ERR_T in cc.h if you want to use ++ * a different type for your platform (must be signed). */ ++#ifdef LWIP_ERR_T ++typedef LWIP_ERR_T err_t; ++#else /* LWIP_ERR_T */ ++ typedef s8_t err_t; ++#endif /* LWIP_ERR_T*/ + + /* Definitions for error constants. */ + + #define ERR_OK 0 /* No error, everything OK. */ + #define ERR_MEM -1 /* Out of memory error. */ + #define ERR_BUF -2 /* Buffer error. */ +-#define ERR_RTE -3 /* Routing problem. */ ++#define ERR_TIMEOUT -3 /* Timeout. */ ++#define ERR_RTE -4 /* Routing problem. */ + + #define ERR_IS_FATAL(e) ((e) < ERR_RTE) + +-#define ERR_ABRT -4 /* Connection aborted. */ +-#define ERR_RST -5 /* Connection reset. */ +-#define ERR_CLSD -6 /* Connection closed. */ +-#define ERR_CONN -7 /* Not connected. */ ++#define ERR_ABRT -5 /* Connection aborted. */ ++#define ERR_RST -6 /* Connection reset. */ ++#define ERR_CLSD -7 /* Connection closed. */ ++#define ERR_CONN -8 /* Not connected. */ + +-#define ERR_VAL -8 /* Illegal value. */ ++#define ERR_VAL -9 /* Illegal value. */ + +-#define ERR_ARG -9 /* Illegal argument. */ ++#define ERR_ARG -10 /* Illegal argument. */ + +-#define ERR_USE -10 /* Address in use. */ ++#define ERR_USE -11 /* Address in use. */ + +-#define ERR_IF -11 /* Low-level netif error */ +-#define ERR_ISCONN -12 /* Already connected. */ +- +-#define ERR_TIMEOUT -13 /* Timeout. */ ++#define ERR_IF -12 /* Low-level netif error */ ++#define ERR_ISCONN -13 /* Already connected. */ + + #define ERR_INPROGRESS -14 /* Operation in progress */ + +Index: src/include/lwip/mem.h +=================================================================== +RCS file: /sources/lwip/lwip/src/include/lwip/mem.h,v +retrieving revision 1.21 +retrieving revision 1.22 +diff -u -p -r1.21 -r1.22 +--- a/src/include/lwip/mem.h 4 Mar 2008 16:31:32 -0000 1.21 ++++ b/src/include/lwip/mem.h 30 May 2008 11:37:15 -0000 1.22 +@@ -50,16 +50,16 @@ typedef size_t mem_size_t; + * allow these defines to be overridden. + */ + #ifndef mem_free +-#define mem_free(x) free(x) ++#define mem_free free + #endif + #ifndef mem_malloc +-#define mem_malloc(x) malloc(x) ++#define mem_malloc malloc + #endif + #ifndef mem_calloc +-#define mem_calloc(x, y) calloc(x, y) ++#define mem_calloc calloc + #endif + #ifndef mem_realloc +-#define mem_realloc(x, size) (x) ++#define mem_realloc realloc + #endif + #else /* MEM_LIBC_MALLOC */ + +Index: src/include/lwip/netif.h +=================================================================== +RCS file: /sources/lwip/lwip/src/include/lwip/netif.h,v +retrieving revision 1.43 +retrieving revision 1.46 +diff -u -p -r1.43 -r1.46 +--- a/src/include/lwip/netif.h 9 Oct 2007 19:59:59 -0000 1.43 ++++ b/src/include/lwip/netif.h 19 Jun 2008 16:27:23 -0000 1.46 +@@ -34,6 +34,8 @@ + + #include "lwip/opt.h" + ++#define ENABLE_LOOPBACK (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF) ++ + #include "lwip/err.h" + + #include "lwip/ip_addr.h" +@@ -165,6 +167,14 @@ struct netif { + #if LWIP_NETIF_HWADDRHINT + u8_t *addr_hint; + #endif /* LWIP_NETIF_HWADDRHINT */ ++#if ENABLE_LOOPBACK ++ /* List of packets to be queued for ourselves. */ ++ struct pbuf *loop_first; ++ struct pbuf *loop_last; ++#if LWIP_LOOPBACK_MAX_PBUFS ++ u16_t loop_cnt_current; ++#endif /* LWIP_LOOPBACK_MAX_PBUFS */ ++#endif /* ENABLE_LOOPBACK */ + }; + + #if LWIP_SNMP +@@ -242,4 +252,12 @@ void netif_set_link_callback(struct neti + } + #endif + ++#if ENABLE_LOOPBACK ++err_t netif_loop_output(struct netif *netif, struct pbuf *p, struct ip_addr *dest_ip); ++void netif_poll(struct netif *netif); ++#if !LWIP_NETIF_LOOPBACK_MULTITHREADING ++void netif_poll_all(void); ++#endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */ ++#endif /* ENABLE_LOOPBACK */ ++ + #endif /* __LWIP_NETIF_H__ */ +Index: src/include/lwip/opt.h +=================================================================== +RCS file: /sources/lwip/lwip/src/include/lwip/opt.h,v +retrieving revision 1.116 +retrieving revision 1.122 +diff -u -p -r1.116 -r1.122 +--- a/src/include/lwip/opt.h 31 Jan 2008 18:19:29 -0000 1.116 ++++ b/src/include/lwip/opt.h 30 Jun 2008 18:16:52 -0000 1.122 +@@ -155,6 +155,27 @@ + #define MEMP_USE_CUSTOM_POOLS 0 + #endif + ++/** ++ * Set this to 1 if you want to free PBUF_RAM pbufs (or call mem_free()) from ++ * interrupt context (or another context that doesn't allow waiting for a ++ * semaphore). ++ * If set to 1, mem_malloc will be protected by a semaphore and SYS_ARCH_PROTECT, ++ * while mem_free will only use SYS_ARCH_PROTECT. mem_malloc SYS_ARCH_UNPROTECTs ++ * with each loop so that mem_free can run. ++ * ++ * ATTENTION: As you can see from the above description, this leads to dis-/ ++ * enabling interrupts often, which can be slow! Also, on low memory, mem_malloc ++ * can need longer. ++ * ++ * If you don't want that, at least for NO_SYS=0, you can still use the following ++ * functions to enqueue a deallocation call which then runs in the tcpip_thread ++ * context: ++ * - pbuf_free_callback(p); ++ * - mem_free_callback(m); ++ */ ++#ifndef LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT ++#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 0 ++#endif + + /* + ------------------------------------------------ +@@ -815,6 +836,39 @@ + #define LWIP_NETIF_HWADDRHINT 0 + #endif + ++/** ++ * LWIP_NETIF_LOOPBACK==1: Support sending packets with a destination IP ++ * address equal to the netif IP address, looping them back up the stack. ++ */ ++#ifndef LWIP_NETIF_LOOPBACK ++#define LWIP_NETIF_LOOPBACK 0 ++#endif ++ ++/** ++ * LWIP_LOOPBACK_MAX_PBUFS: Maximum number of pbufs on queue for loopback ++ * sending for each netif (0 = disabled) ++ */ ++#ifndef LWIP_LOOPBACK_MAX_PBUFS ++#define LWIP_LOOPBACK_MAX_PBUFS 0 ++#endif ++ ++/** ++ * LWIP_NETIF_LOOPBACK_MULTITHREADING: Indicates whether threading is enabled in ++ * the system, as netifs must change how they behave depending on this setting ++ * for the LWIP_NETIF_LOOPBACK option to work. ++ * Setting this is needed to avoid reentering non-reentrant functions like ++ * tcp_input(). ++ * LWIP_NETIF_LOOPBACK_MULTITHREADING==1: Indicates that the user is using a ++ * multithreaded environment like tcpip.c. In this case, netif->input() ++ * is called directly. ++ * LWIP_NETIF_LOOPBACK_MULTITHREADING==0: Indicates a polling (or NO_SYS) setup. ++ * The packets are put on a list and netif_poll() must be called in ++ * the main application loop. ++ */ ++#ifndef LWIP_NETIF_LOOPBACK_MULTITHREADING ++#define LWIP_NETIF_LOOPBACK_MULTITHREADING (!NO_SYS) ++#endif ++ + /* + ------------------------------------ + ---------- LOOPIF options ---------- +@@ -827,20 +881,16 @@ + #define LWIP_HAVE_LOOPIF 0 + #endif + ++/* ++ ------------------------------------ ++ ---------- SLIPIF options ---------- ++ ------------------------------------ ++*/ + /** +- * LWIP_LOOPIF_MULTITHREADING: Indicates whether threading is enabled in +- * the system, as LOOPIF must change how it behaves depending on this setting. +- * Setting this is needed to avoid reentering non-reentrant functions like +- * tcp_input(). +- * LWIP_LOOPIF_MULTITHREADING==1: Indicates that the user is using a +- * multithreaded environment like tcpip.c. In this case, netif->input() +- * is called directly. +- * LWIP_LOOPIF_MULTITHREADING==0: Indicates a polling (or NO_SYS) setup. +- * The packets are put on a list and loopif_poll() must be called in +- * the main application loop. ++ * LWIP_HAVE_SLIPIF==1: Support slip interface and slipif.c + */ +-#ifndef LWIP_LOOPIF_MULTITHREADING +-#define LWIP_LOOPIF_MULTITHREADING 1 ++#ifndef LWIP_HAVE_SLIPIF ++#define LWIP_HAVE_SLIPIF 0 + #endif + + /* +Index: src/include/lwip/sio.h +=================================================================== +RCS file: /sources/lwip/lwip/src/include/lwip/sio.h,v +retrieving revision 1.7 +retrieving revision 1.8 +diff -u -p -r1.7 -r1.8 +--- a/src/include/lwip/sio.h 6 Sep 2007 16:43:44 -0000 1.7 ++++ b/src/include/lwip/sio.h 27 Mar 2008 18:06:02 -0000 1.8 +@@ -32,16 +32,24 @@ + * It needs to be implemented by those platforms which need SLIP or PPP + */ + ++#ifndef __SIO_H__ ++#define __SIO_H__ ++ + #include "lwip/arch.h" + + #ifdef __cplusplus + extern "C" { + #endif + ++/* If you want to define sio_fd_t elsewhere or differently, ++ define this in your cc.h file. */ + #ifndef __sio_fd_t_defined + typedef void * sio_fd_t; + #endif + ++/* The following functions can be defined to something else in your cc.h file ++ or be implemented in your custom sio.c file. */ ++ + #ifndef sio_open + sio_fd_t sio_open(u8_t); + #endif +@@ -69,3 +77,5 @@ void sio_read_abort(sio_fd_t); + #ifdef __cplusplus + } + #endif ++ ++#endif /* __SIO_H__ */ +Index: src/include/lwip/sockets.h +=================================================================== +RCS file: /sources/lwip/lwip/src/include/lwip/sockets.h,v +retrieving revision 1.38 +retrieving revision 1.39 +diff -u -p -r1.38 -r1.39 +--- a/src/include/lwip/sockets.h 2 Dec 2007 15:24:02 -0000 1.38 ++++ b/src/include/lwip/sockets.h 26 Apr 2008 10:46:23 -0000 1.39 +@@ -177,7 +177,22 @@ typedef struct ip_mreq { + } ip_mreq; + #endif /* LWIP_IGMP */ + +-/* Unimplemented for now... */ ++/* ++ * The Type of Service provides an indication of the abstract ++ * parameters of the quality of service desired. These parameters are ++ * to be used to guide the selection of the actual service parameters ++ * when transmitting a datagram through a particular network. Several ++ * networks offer service precedence, which somehow treats high ++ * precedence traffic as more important than other traffic (generally ++ * by accepting only traffic above a certain precedence at time of high ++ * load). The major choice is a three way tradeoff between low-delay, ++ * high-reliability, and high-throughput. ++ * The use of the Delay, Throughput, and Reliability indications may ++ * increase the cost (in some sense) of the service. In many networks ++ * better performance for one of these parameters is coupled with worse ++ * performance on another. Except for very unusual cases at most two ++ * of these three indications should be set. ++ */ + #define IPTOS_TOS_MASK 0x1E + #define IPTOS_TOS(tos) ((tos) & IPTOS_TOS_MASK) + #define IPTOS_LOWDELAY 0x10 +@@ -187,7 +202,13 @@ typedef struct ip_mreq { + #define IPTOS_MINCOST IPTOS_LOWCOST + + /* +- * Definitions for IP precedence (also in ip_tos) (Unimplemented) ++ * The Network Control precedence designation is intended to be used ++ * within a network only. The actual use and control of that ++ * designation is up to each network. The Internetwork Control ++ * designation is intended for use by gateway control originators only. ++ * If the actual use of these precedence designations is of concern to ++ * a particular network, it is the responsibility of that network to ++ * control the access to, and use of, those precedence designations. + */ + #define IPTOS_PREC_MASK 0xe0 + #define IPTOS_PREC(tos) ((tos) & IPTOS_PREC_MASK) +Index: src/include/lwip/stats.h +=================================================================== +RCS file: /sources/lwip/lwip/src/include/lwip/stats.h,v +retrieving revision 1.19 +retrieving revision 1.23 +diff -u -p -r1.19 -r1.23 +--- a/src/include/lwip/stats.h 28 Nov 2007 21:25:07 -0000 1.19 ++++ b/src/include/lwip/stats.h 8 Jul 2008 09:15:57 -0000 1.23 +@@ -57,7 +57,6 @@ extern "C" { + + struct stats_proto { + STAT_COUNTER xmit; /* Transmitted packets. */ +- STAT_COUNTER rexmit; /* Retransmitted packets. */ + STAT_COUNTER recv; /* Received packets. */ + STAT_COUNTER fw; /* Forwarded packets. */ + STAT_COUNTER drop; /* Dropped packets. */ +@@ -87,7 +86,8 @@ struct stats_mem { + mem_size_t avail; + mem_size_t used; + mem_size_t max; +- mem_size_t err; ++ STAT_COUNTER err; ++ STAT_COUNTER illegal; + }; + + struct stats_syselem { +@@ -142,64 +142,138 @@ extern struct stats_ lwip_stats; + #define stats_init() /* Compatibility define, not init needed. */ + + #define STATS_INC(x) ++lwip_stats.x ++#define STATS_DEC(x) --lwip_stats.x + #else + #define stats_init() + #define STATS_INC(x) ++#define STATS_DEC(x) + #endif /* LWIP_STATS */ + + #if TCP_STATS + #define TCP_STATS_INC(x) STATS_INC(x) ++#define TCP_STATS_DISPLAY() stats_display_proto(&lwip_stats.tcp, "TCP") + #else + #define TCP_STATS_INC(x) ++#define TCP_STATS_DISPLAY() + #endif + + #if UDP_STATS + #define UDP_STATS_INC(x) STATS_INC(x) ++#define UDP_STATS_DISPLAY() stats_display_proto(&lwip_stats.udp, "UDP") + #else + #define UDP_STATS_INC(x) ++#define UDP_STATS_DISPLAY() + #endif + + #if ICMP_STATS + #define ICMP_STATS_INC(x) STATS_INC(x) ++#define ICMP_STATS_DISPLAY() stats_display_proto(&lwip_stats.icmp, "ICMP") + #else + #define ICMP_STATS_INC(x) ++#define ICMP_STATS_DISPLAY() + #endif + + #if IGMP_STATS + #define IGMP_STATS_INC(x) STATS_INC(x) ++#define IGMP_STATS_DISPLAY() stats_display_igmp(&lwip_stats.igmp) + #else + #define IGMP_STATS_INC(x) ++#define IGMP_STATS_DISPLAY() + #endif + + #if IP_STATS + #define IP_STATS_INC(x) STATS_INC(x) ++#define IP_STATS_DISPLAY() stats_display_proto(&lwip_stats.ip, "IP") + #else + #define IP_STATS_INC(x) ++#define IP_STATS_DISPLAY() + #endif + + #if IPFRAG_STATS + #define IPFRAG_STATS_INC(x) STATS_INC(x) ++#define IPFRAG_STATS_DISPLAY() stats_display_proto(&lwip_stats.ip_frag, "IP_FRAG") + #else + #define IPFRAG_STATS_INC(x) ++#define IPFRAG_STATS_DISPLAY() + #endif + + #if ETHARP_STATS + #define ETHARP_STATS_INC(x) STATS_INC(x) ++#define ETHARP_STATS_DISPLAY() stats_display_proto(&lwip_stats.etharp, "ETHARP") + #else + #define ETHARP_STATS_INC(x) ++#define ETHARP_STATS_DISPLAY() + #endif + + #if LINK_STATS + #define LINK_STATS_INC(x) STATS_INC(x) ++#define LINK_STATS_DISPLAY() stats_display_proto(&lwip_stats.link, "LINK") + #else + #define LINK_STATS_INC(x) ++#define LINK_STATS_DISPLAY() ++#endif ++ ++#if MEM_STATS ++#define MEM_STATS_AVAIL(x, y) lwip_stats.mem.x = y ++#define MEM_STATS_INC(x) STATS_INC(mem.x) ++#define MEM_STATS_INC_USED(x, y) do { lwip_stats.mem.used += y; \ ++ if (lwip_stats.mem.max < lwip_stats.mem.used) { \ ++ lwip_stats.mem.max = lwip_stats.mem.used; \ ++ } \ ++ } while(0) ++#define MEM_STATS_DEC_USED(x, y) lwip_stats.mem.x -= y ++#define MEM_STATS_DISPLAY() stats_display_mem(&lwip_stats.mem, "HEAP") ++#else ++#define MEM_STATS_AVAIL(x, y) ++#define MEM_STATS_INC(x) ++#define MEM_STATS_INC_USED(x, y) ++#define MEM_STATS_DEC_USED(x, y) ++#define MEM_STATS_DISPLAY() ++#endif ++ ++#if MEMP_STATS ++#define MEMP_STATS_AVAIL(x, i, y) lwip_stats.memp[i].x = y ++#define MEMP_STATS_INC(x, i) STATS_INC(memp[i].x) ++#define MEMP_STATS_DEC(x, i) STATS_DEC(memp[i].x) ++#define MEMP_STATS_INC_USED(x, i) do { ++lwip_stats.memp[i].used; \ ++ if (lwip_stats.memp[i].max < lwip_stats.memp[i].used) { \ ++ lwip_stats.memp[i].max = lwip_stats.memp[i].used; \ ++ } \ ++ } while(0) ++#define MEMP_STATS_DISPLAY(i) stats_display_memp(&lwip_stats.memp[i], i) ++#else ++#define MEMP_STATS_AVAIL(x, i, y) ++#define MEMP_STATS_INC(x, i) ++#define MEMP_STATS_DEC(x, i) ++#define MEMP_STATS_INC_USED(x, i) ++#define MEMP_STATS_DISPLAY(i) ++#endif ++ ++#if SYS_STATS ++#define SYS_STATS_INC(x) STATS_INC(sys.x) ++#define SYS_STATS_DEC(x) STATS_DEC(sys.x) ++#define SYS_STATS_DISPLAY() stats_display_sys(&lwip_stats.sys) ++#else ++#define SYS_STATS_INC(x) ++#define SYS_STATS_DEC(x) ++#define SYS_STATS_DISPLAY() + #endif + + /* Display of statistics */ + #if LWIP_STATS_DISPLAY + void stats_display(void); ++void stats_display_proto(struct stats_proto *proto, char *name); ++void stats_display_igmp(struct stats_igmp *igmp); ++void stats_display_mem(struct stats_mem *mem, char *name); ++void stats_display_memp(struct stats_mem *mem, int index); ++void stats_display_sys(struct stats_sys *sys); + #else + #define stats_display() ++#define stats_display_proto(proto, name) ++#define stats_display_igmp(igmp) ++#define stats_display_mem(mem, name) ++#define stats_display_memp(mem, index) ++#define stats_display_sys(sys) + #endif /* LWIP_STATS_DISPLAY */ + + #ifdef __cplusplus +Index: src/include/lwip/tcpip.h +=================================================================== +RCS file: /sources/lwip/lwip/src/include/lwip/tcpip.h,v +retrieving revision 1.24 +retrieving revision 1.27 +diff -u -p -r1.24 -r1.27 +--- a/src/include/lwip/tcpip.h 12 Jan 2008 11:52:22 -0000 1.24 ++++ b/src/include/lwip/tcpip.h 27 Jun 2008 20:34:55 -0000 1.27 +@@ -83,7 +83,11 @@ err_t tcpip_netifapi_lock(struct netifap + #endif /* LWIP_NETIF_API */ + + err_t tcpip_callback_with_block(void (*f)(void *ctx), void *ctx, u8_t block); +-#define tcpip_callback(f,ctx) tcpip_callback_with_block(f,ctx,1) ++#define tcpip_callback(f, ctx) tcpip_callback_with_block(f, ctx, 1) ++ ++/* free pbufs or heap memory from another context without blocking */ ++err_t pbuf_free_callback(struct pbuf *p); ++err_t mem_free_callback(void *m); + + err_t tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg); + #define tcpip_untimeout(h, arg) tcpip_timeout(0xffffffff, h, arg) +Index: src/include/netif/loopif.h +=================================================================== +RCS file: /sources/lwip/lwip/src/include/netif/loopif.h,v +retrieving revision 1.7 +retrieving revision 1.9 +diff -u -p -r1.7 -r1.9 +--- a/src/include/netif/loopif.h 10 May 2007 10:59:20 -0000 1.7 ++++ b/src/include/netif/loopif.h 17 Jun 2008 20:12:22 -0000 1.9 +@@ -32,6 +32,7 @@ + #ifndef __NETIF_LOOPIF_H__ + #define __NETIF_LOOPIF_H__ + ++#include "lwip/opt.h" + #include "lwip/netif.h" + #include "lwip/err.h" + +@@ -39,9 +40,9 @@ + extern "C" { + #endif + +-#if !LWIP_LOOPIF_MULTITHREADING +-void loopif_poll(struct netif *netif); +-#endif ++#if !LWIP_NETIF_LOOPBACK_MULTITHREADING ++#define loopif_poll netif_poll ++#endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */ + + err_t loopif_init(struct netif *netif); + +Index: src/netif/etharp.c +=================================================================== +RCS file: /sources/lwip/lwip/src/netif/etharp.c,v +retrieving revision 1.145 +retrieving revision 1.148 +diff -u -p -r1.145 -r1.148 +--- a/src/netif/etharp.c 4 Mar 2008 13:41:24 -0000 1.145 ++++ b/src/netif/etharp.c 19 Jun 2008 16:40:59 -0000 1.148 +@@ -353,7 +353,7 @@ find_entry(struct ip_addr *ipaddr, u8_t + * 1) empty entry + * 2) oldest stable entry + * 3) oldest pending entry without queued packets +- * 4) oldest pending entry without queued packets ++ * 4) oldest pending entry with queued packets + * + * { ETHARP_TRY_HARD is set at this point } + */ +@@ -1130,7 +1130,14 @@ ethernet_input(struct pbuf *p, struct ne + + /* points to packet payload, which starts with an Ethernet header */ + ethhdr = p->payload; +- ++ LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ++ ("ethernet_input: dest:%02x:%02x:%02x:%02x:%02x:%02x, src:%02x:%02x:%02x:%02x:%02x:%02x, type:%2hx\n", ++ (unsigned)ethhdr->dest.addr[0], (unsigned)ethhdr->dest.addr[1], (unsigned)ethhdr->dest.addr[2], ++ (unsigned)ethhdr->dest.addr[3], (unsigned)ethhdr->dest.addr[4], (unsigned)ethhdr->dest.addr[5], ++ (unsigned)ethhdr->src.addr[0], (unsigned)ethhdr->src.addr[1], (unsigned)ethhdr->src.addr[2], ++ (unsigned)ethhdr->src.addr[3], (unsigned)ethhdr->src.addr[4], (unsigned)ethhdr->src.addr[5], ++ (unsigned)htons(ethhdr->type))); ++ + switch (htons(ethhdr->type)) { + /* IP packet? */ + case ETHTYPE_IP: +@@ -1165,6 +1172,8 @@ ethernet_input(struct pbuf *p, struct ne + #endif /* PPPOE_SUPPORT */ + + default: ++ ETHARP_STATS_INC(etharp.proterr); ++ ETHARP_STATS_INC(etharp.drop); + pbuf_free(p); + p = NULL; + break; +Index: src/netif/loopif.c +=================================================================== +RCS file: /sources/lwip/lwip/src/netif/loopif.c,v +retrieving revision 1.26 +retrieving revision 1.27 +diff -u -p -r1.26 -r1.27 +--- a/src/netif/loopif.c 31 Aug 2007 10:14:09 -0000 1.26 ++++ b/src/netif/loopif.c 12 Jun 2008 20:10:10 -0000 1.27 +@@ -40,149 +40,8 @@ + #if LWIP_HAVE_LOOPIF + + #include "netif/loopif.h" +-#include "lwip/pbuf.h" + #include "lwip/snmp.h" + +-#include <string.h> +- +-#if !LWIP_LOOPIF_MULTITHREADING +- +-#include "lwip/sys.h" +-#include "lwip/mem.h" +- +-/* helper struct for the linked list of pbufs */ +-struct loopif_private { +- struct pbuf *first; +- struct pbuf *last; +-}; +- +-/** +- * Call loopif_poll() in the main loop of your application. This is to prevent +- * reentering non-reentrant functions like tcp_input(). Packets passed to +- * loopif_output() are put on a list that is passed to netif->input() by +- * loopif_poll(). +- * +- * @param netif the lwip network interface structure for this loopif +- */ +-void +-loopif_poll(struct netif *netif) +-{ +- SYS_ARCH_DECL_PROTECT(lev); +- struct pbuf *in, *in_end; +- struct loopif_private *priv = (struct loopif_private*)netif->state; +- +- LWIP_ERROR("priv != NULL", (priv != NULL), return;); +- +- do { +- /* Get a packet from the list. With SYS_LIGHTWEIGHT_PROT=1, this is protected */ +- SYS_ARCH_PROTECT(lev); +- in = priv->first; +- if(in) { +- in_end = in; +- while(in_end->len != in_end->tot_len) { +- LWIP_ASSERT("bogus pbuf: len != tot_len but next == NULL!", in_end->next != NULL); +- in_end = in_end->next; +- } +- /* 'in_end' now points to the last pbuf from 'in' */ +- if(in_end == priv->last) { +- /* this was the last pbuf in the list */ +- priv->first = priv->last = NULL; +- } else { +- /* pop the pbuf off the list */ +- priv->first = in_end->next; +- LWIP_ASSERT("should not be null since first != last!", priv->first != NULL); +- } +- } +- SYS_ARCH_UNPROTECT(lev); +- +- if(in != NULL) { +- if(in_end->next != NULL) { +- /* De-queue the pbuf from its successors on the 'priv' list. */ +- in_end->next = NULL; +- } +- if(netif->input(in, netif) != ERR_OK) { +- pbuf_free(in); +- } +- /* Don't reference the packet any more! */ +- in = NULL; +- in_end = NULL; +- } +- /* go on while there is a packet on the list */ +- } while(priv->first != NULL); +-} +-#endif /* LWIP_LOOPIF_MULTITHREADING */ +- +-/** +- * Send an IP packet over the loopback interface. +- * The pbuf is simply copied and handed back to netif->input. +- * In multithreaded mode, this is done directly since netif->input must put +- * the packet on a queue. +- * In callback mode, the packet is put on an internal queue and is fed to +- * netif->input by loopif_poll(). +- * +- * @param netif the lwip network interface structure for this loopif +- * @param p the (IP) packet to 'send' +- * @param ipaddr the ip address to send the packet to (not used for loopif) +- * @return ERR_OK if the packet has been sent +- * ERR_MEM if the pbuf used to copy the packet couldn't be allocated +- */ +-static err_t +-loopif_output(struct netif *netif, struct pbuf *p, +- struct ip_addr *ipaddr) +-{ +-#if !LWIP_LOOPIF_MULTITHREADING +- SYS_ARCH_DECL_PROTECT(lev); +- struct loopif_private *priv; +- struct pbuf *last; +-#endif /* LWIP_LOOPIF_MULTITHREADING */ +- struct pbuf *r; +- err_t err; +- +- LWIP_UNUSED_ARG(ipaddr); +- +- /* Allocate a new pbuf */ +- r = pbuf_alloc(PBUF_RAW, p->tot_len, PBUF_RAM); +- if (r == NULL) { +- return ERR_MEM; +- } +- +- /* Copy the whole pbuf queue p into the single pbuf r */ +- if ((err = pbuf_copy(r, p)) != ERR_OK) { +- pbuf_free(r); +- r = NULL; +- return err; +- } +- +-#if LWIP_LOOPIF_MULTITHREADING +- /* Multithreading environment, netif->input() is supposed to put the packet +- into a mailbox, so we can safely call it here without risking to re-enter +- functions that are not reentrant (TCP!!!) */ +- if(netif->input(r, netif) != ERR_OK) { +- pbuf_free(r); +- r = NULL; +- } +-#else /* LWIP_LOOPIF_MULTITHREADING */ +- /* Raw API without threads: put the packet on a linked list which gets emptied +- through calling loopif_poll(). */ +- priv = (struct loopif_private*)netif->state; +- +- /* let last point to the last pbuf in chain r */ +- for (last = r; last->next != NULL; last = last->next); +- SYS_ARCH_PROTECT(lev); +- if(priv->first != NULL) { +- LWIP_ASSERT("if first != NULL, last must also be != NULL", priv->last != NULL); +- priv->last->next = r; +- priv->last = last; +- } else { +- priv->first = r; +- priv->last = last; +- } +- SYS_ARCH_UNPROTECT(lev); +-#endif /* LWIP_LOOPIF_MULTITHREADING */ +- +- return ERR_OK; +-} +- + /** + * Initialize a lwip network interface structure for a loopback interface + * +@@ -193,16 +52,6 @@ loopif_output(struct netif *netif, struc + err_t + loopif_init(struct netif *netif) + { +-#if !LWIP_LOOPIF_MULTITHREADING +- struct loopif_private *priv; +- +- priv = (struct loopif_private*)mem_malloc(sizeof(struct loopif_private)); +- if(priv == NULL) +- return ERR_MEM; +- priv->first = priv->last = NULL; +- netif->state = priv; +-#endif /* LWIP_LOOPIF_MULTITHREADING */ +- + /* initialize the snmp variables and counters inside the struct netif + * ifSpeed: no assumption can be made! + */ +@@ -210,7 +59,7 @@ loopif_init(struct netif *netif) + + netif->name[0] = 'l'; + netif->name[1] = 'o'; +- netif->output = loopif_output; ++ netif->output = netif_loop_output; + return ERR_OK; + } + +Index: src/netif/slipif.c +=================================================================== +RCS file: /sources/lwip/lwip/src/netif/slipif.c,v +retrieving revision 1.29 +retrieving revision 1.30 +diff -u -p -r1.29 -r1.30 +--- a/src/netif/slipif.c 30 Nov 2007 17:22:21 -0000 1.29 ++++ b/src/netif/slipif.c 17 Jun 2008 20:14:05 -0000 1.30 +@@ -44,6 +44,9 @@ + + #include "netif/slipif.h" + #include "lwip/opt.h" ++ ++#if LWIP_HAVE_SLIPIF ++ + #include "lwip/def.h" + #include "lwip/pbuf.h" + #include "lwip/sys.h" +@@ -273,3 +276,4 @@ slipif_init(struct netif *netif) + sys_thread_new(SLIPIF_THREAD_NAME, slipif_loop, netif, SLIPIF_THREAD_STACKSIZE, SLIPIF_THREAD_PRIO); + return ERR_OK; + } ++#endif /* LWIP_HAVE_SLIPIF */ diff --git a/external/meta-virtualization/recipes-extended/xen/files/newlib-chk.patch b/external/meta-virtualization/recipes-extended/xen/files/newlib-chk.patch new file mode 100644 index 00000000..a5d01495 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/files/newlib-chk.patch @@ -0,0 +1,155 @@ +--- a/newlib/libc/stdio/fprintf_chk.c 1969-12-31 19:00:00.000000000 -0500 ++++ b/newlib/libc/stdio/fprintf_chk.c 2009-02-26 19:02:53.000000000 -0500 +@@ -0,0 +1,21 @@ ++#include <stdarg.h> ++#include <stdio.h> ++ ++/* ++ * Stub implementation of __fprintf_chk adapted from glibc 2.7. This ++ * doesn't actually implement any buffer overflow protection. It just makes ++ * the linker happy :) ++*/ ++int ++__fprintf_chk (FILE *fp, int flag, const char *format, ...) ++{ ++ va_list ap; ++ int done; ++ ++ va_start (ap, format); ++ done = vfprintf (fp, format, ap); ++ va_end (ap); ++ ++ return done; ++} ++ +--- a/newlib/libc/stdio/Makefile.am 2007-08-02 16:23:06.000000000 -0400 ++++ b/newlib/libc/stdio/Makefile.am 2009-02-26 18:14:53.000000000 -0500 +@@ -20,6 +20,7 @@ + flags.c \ + fopen.c \ + fprintf.c \ ++ fprintf_chk.c \ + fputc.c \ + fputs.c \ + fread.c \ +@@ -65,6 +66,7 @@ + sniprintf.c \ + snprintf.c \ + sprintf.c \ ++ sprintf_chk.c \ + sscanf.c \ + stdio.c \ + tmpfile.c \ +--- a/newlib/libc/stdio/Makefile.in 2007-12-19 17:36:38.000000000 -0500 ++++ b/newlib/libc/stdio/Makefile.in 2009-02-26 18:43:52.000000000 -0500 +@@ -63,7 +63,8 @@ + lib_a-fgets.$(OBJEXT) lib_a-fileno.$(OBJEXT) \ + lib_a-findfp.$(OBJEXT) lib_a-fiprintf.$(OBJEXT) \ + lib_a-flags.$(OBJEXT) lib_a-fopen.$(OBJEXT) \ +- lib_a-fprintf.$(OBJEXT) lib_a-fputc.$(OBJEXT) \ ++ lib_a-fprintf.$(OBJEXT) lib_a-fprintf_chk.$(OBJEXT) \ ++ lib_a-fputc.$(OBJEXT) \ + lib_a-fputs.$(OBJEXT) lib_a-fread.$(OBJEXT) \ + lib_a-freopen.$(OBJEXT) lib_a-fscanf.$(OBJEXT) \ + lib_a-fiscanf.$(OBJEXT) lib_a-fseek.$(OBJEXT) \ +@@ -86,6 +87,7 @@ + lib_a-setvbuf.$(OBJEXT) lib_a-siprintf.$(OBJEXT) \ + lib_a-siscanf.$(OBJEXT) lib_a-sniprintf.$(OBJEXT) \ + lib_a-snprintf.$(OBJEXT) lib_a-sprintf.$(OBJEXT) \ ++ lib_a-sprintf_chk.$(OBJEXT) \ + lib_a-sscanf.$(OBJEXT) lib_a-stdio.$(OBJEXT) \ + lib_a-tmpfile.$(OBJEXT) lib_a-tmpnam.$(OBJEXT) \ + lib_a-ungetc.$(OBJEXT) lib_a-vdiprintf.$(OBJEXT) \ +@@ -122,15 +124,15 @@ + LTLIBRARIES = $(noinst_LTLIBRARIES) + am__objects_4 = clearerr.lo fclose.lo fdopen.lo feof.lo ferror.lo \ + fflush.lo fgetc.lo fgetpos.lo fgets.lo fileno.lo findfp.lo \ +- fiprintf.lo flags.lo fopen.lo fprintf.lo fputc.lo fputs.lo \ +- fread.lo freopen.lo fscanf.lo fiscanf.lo fseek.lo fsetpos.lo \ ++ fiprintf.lo flags.lo fopen.lo fprintf.lo fprintf_chk.lo fputc.lo \ ++ fputs.lo fread.lo freopen.lo fscanf.lo fiscanf.lo fseek.lo fsetpos.lo \ + ftell.lo fvwrite.lo fwalk.lo fwrite.lo getc.lo getchar.lo \ + getc_u.lo getchar_u.lo getdelim.lo getline.lo gets.lo \ + iprintf.lo iscanf.lo makebuf.lo perror.lo printf.lo putc.lo \ + putchar.lo putc_u.lo putchar_u.lo puts.lo refill.lo remove.lo \ + rename.lo rewind.lo rget.lo scanf.lo sccl.lo setbuf.lo \ + setbuffer.lo setlinebuf.lo setvbuf.lo siprintf.lo siscanf.lo \ +- sniprintf.lo snprintf.lo sprintf.lo sscanf.lo stdio.lo \ ++ sniprintf.lo snprintf.lo sprintf.lo sprintf_chk.lo sscanf.lo stdio.lo \ + tmpfile.lo tmpnam.lo ungetc.lo vdiprintf.lo vdprintf.lo \ + viprintf.lo viscanf.lo vprintf.lo vscanf.lo vsiprintf.lo \ + vsiscanf.lo vsnprintf.lo vsniprintf.lo vsprintf.lo vsscanf.lo \ +@@ -344,6 +346,7 @@ + flags.c \ + fopen.c \ + fprintf.c \ ++ fprintf_chk.c \ + fputc.c \ + fputs.c \ + fread.c \ +@@ -389,6 +392,7 @@ + sniprintf.c \ + snprintf.c \ + sprintf.c \ ++ sprintf_chk.c \ + sscanf.c \ + stdio.c \ + tmpfile.c \ +@@ -508,6 +512,7 @@ + siprintf.def \ + siscanf.def \ + sprintf.def \ ++ sprintf_chk.def \ + sscanf.def \ + tmpfile.def \ + tmpnam.def \ +@@ -678,6 +683,12 @@ + lib_a-fprintf.obj: fprintf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf.obj `if test -f 'fprintf.c'; then $(CYGPATH_W) 'fprintf.c'; else $(CYGPATH_W) '$(srcdir)/fprintf.c'; fi` + ++lib_a-fprintf_chk.o: fprintf_chk.c ++ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf_chk.o `test -f 'fprintf_chk.c' || echo '$(srcdir)/'`fprintf_chk.c ++ ++lib_a-fprintf_chk.obj: fprintf_chk.c ++ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf_chk.obj `if test -f 'fprintf_chk.c'; then $(CYGPATH_W) 'fprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/fprintf_chk.c'; fi` ++ + lib_a-fputc.o: fputc.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fputc.o `test -f 'fputc.c' || echo '$(srcdir)/'`fputc.c + +@@ -948,6 +959,12 @@ + lib_a-sprintf.obj: sprintf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf.obj `if test -f 'sprintf.c'; then $(CYGPATH_W) 'sprintf.c'; else $(CYGPATH_W) '$(srcdir)/sprintf.c'; fi` + ++lib_a-sprintf_chk.o: sprintf_chk.c ++ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.o `test -f 'sprintf_chk.c' || echo '$(srcdir)/'`sprintf_chk.c ++ ++lib_a-sprintf_chk.obj: sprintf_chk.c ++ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.obj `if test -f 'sprintf_chk.c'; then $(CYGPATH_W) 'sprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/sprintf_chk.c'; fi` ++ + lib_a-sscanf.o: sscanf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sscanf.o `test -f 'sscanf.c' || echo '$(srcdir)/'`sscanf.c + +--- a/newlib/libc/stdio/sprintf_chk.c 1969-12-31 19:00:00.000000000 -0500 ++++ b/newlib/libc/stdio/sprintf_chk.c 2009-02-26 19:02:26.000000000 -0500 +@@ -0,0 +1,21 @@ ++#include <stdarg.h> ++#include <stdio.h> ++ ++/* ++ * Stub implementation of __sprintf_chk adapted from glibc 2.7. This ++ * doesn't actually implement any buffer overflow protection. It just makes ++ * the linker happy :) ++*/ ++int ++__sprintf_chk (char *s, int flags, size_t slen, const char *format, ...) ++{ ++ va_list arg; ++ int done; ++ ++ va_start (arg, format); ++ done = vsprintf (s, format, arg); ++ va_end (arg); ++ ++ return done; ++} ++ diff --git a/external/meta-virtualization/recipes-extended/xen/files/newlib-stdint-size_max-fix-from-1.17.0.patch b/external/meta-virtualization/recipes-extended/xen/files/newlib-stdint-size_max-fix-from-1.17.0.patch new file mode 100644 index 00000000..3610d646 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/files/newlib-stdint-size_max-fix-from-1.17.0.patch @@ -0,0 +1,16 @@ +--- a/newlib/libc/include/stdint.h.orig 2006-08-17 00:39:43.000000000 +0300 ++++ b/newlib/libc/include/stdint.h 2009-08-25 17:33:23.000000000 +0300 +@@ -348,8 +348,11 @@ + #endif + + /* This must match size_t in stddef.h, currently long unsigned int */ +-#define SIZE_MIN (-__STDINT_EXP(LONG_MAX) - 1L) +-#define SIZE_MAX __STDINT_EXP(LONG_MAX) ++#ifdef __SIZE_MAX__ ++#define SIZE_MAX __SIZE_MAX__ ++#else ++#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1) ++#endif + + /* This must match sig_atomic_t in <signal.h> (currently int) */ + #define SIG_ATOMIC_MIN (-__STDINT_EXP(INT_MAX) - 1) diff --git a/external/meta-virtualization/recipes-extended/xen/files/newlib.patch b/external/meta-virtualization/recipes-extended/xen/files/newlib.patch new file mode 100644 index 00000000..dbf409a2 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/files/newlib.patch @@ -0,0 +1,727 @@ +There is a mix between longs and long longs. + +Index: newlib/libc/include/inttypes.h +=================================================================== +RCS file: /cvs/src/src/newlib/libc/include/inttypes.h,v +retrieving revision 1.3 +diff -u -p -r1.3 inttypes.h +--- a/newlib/libc/include/inttypes.h 16 Dec 2005 19:03:12 -0000 1.3 ++++ b/newlib/libc/include/inttypes.h 8 Nov 2007 16:32:44 -0000 +@@ -163,12 +163,12 @@ + + + /* 64-bit types */ +-#if __have_longlong64 +-#define __PRI64(x) __STRINGIFY(ll##x) +-#define __SCN64(x) __STRINGIFY(ll##x) +-#elif __have_long64 ++#if __have_long64 + #define __PRI64(x) __STRINGIFY(l##x) + #define __SCN64(x) __STRINGIFY(l##x) ++#elif __have_longlong64 ++#define __PRI64(x) __STRINGIFY(ll##x) ++#define __SCN64(x) __STRINGIFY(ll##x) + #else + #define __PRI64(x) __STRINGIFY(x) + #define __SCN64(x) __STRINGIFY(x) +@@ -217,12 +217,12 @@ + #endif + + /* max-bit types */ +-#if __have_longlong64 +-#define __PRIMAX(x) __STRINGIFY(ll##x) +-#define __SCNMAX(x) __STRINGIFY(ll##x) +-#elif __have_long64 ++#if __have_long64 + #define __PRIMAX(x) __STRINGIFY(l##x) + #define __SCNMAX(x) __STRINGIFY(l##x) ++#elif __have_longlong64 ++#define __PRIMAX(x) __STRINGIFY(ll##x) ++#define __SCNMAX(x) __STRINGIFY(ll##x) + #else + #define __PRIMAX(x) __STRINGIFY(x) + #define __SCNMAX(x) __STRINGIFY(x) +@@ -242,12 +242,12 @@ + #define SCNxMAX __SCNMAX(x) + + /* ptr types */ +-#if __have_longlong64 +-#define __PRIPTR(x) __STRINGIFY(ll##x) +-#define __SCNPTR(x) __STRINGIFY(ll##x) +-#elif __have_long64 ++#if __have_long64 + #define __PRIPTR(x) __STRINGIFY(l##x) + #define __SCNPTR(x) __STRINGIFY(l##x) ++#elif __have_longlong64 ++#define __PRIPTR(x) __STRINGIFY(ll##x) ++#define __SCNPTR(x) __STRINGIFY(ll##x) + #else + #define __PRIPTR(x) __STRINGIFY(x) + #define __SCNPTR(x) __STRINGIFY(x) + +We don't want u?int32_t to be long as our code assume in a lot of places to be +int. + +Index: newlib/libc/include/stdint.h +=================================================================== +RCS file: /cvs/src/src/newlib/libc/include/stdint.h,v +retrieving revision 1.10 +diff -u -p -r1.10 stdint.h +--- a/newlib/libc/include/stdint.h 16 Aug 2006 21:39:43 -0000 1.10 ++++ b/newlib/libc/include/stdint.h 12 Feb 2008 13:07:52 -0000 +@@ -38,7 +38,7 @@ extern "C" { + #if __STDINT_EXP(LONG_MAX) > 0x7fffffff + #define __have_long64 1 + #elif __STDINT_EXP(LONG_MAX) == 0x7fffffff && !defined(__SPU__) +-#define __have_long32 1 ++/* #define __have_long32 1 */ + #endif + + #if __STDINT_EXP(SCHAR_MAX) == 0x7f + +Define the basic ia64 jump buffer + +Index: newlib/libc/include/sys/config.h +=================================================================== +RCS file: /cvs/src/src/newlib/libc/include/sys/config.h,v +retrieving revision 1.47 +diff -u -p -r1.47 config.h +--- a/newlib/libc/include/sys/config.h 15 Mar 2007 21:32:12 -0000 1.47 ++++ b/newlib/libc/include/sys/config.h 8 Nov 2007 16:32:44 -0000 +@@ -71,6 +71,10 @@ + #endif + #endif + ++#ifndef __DYNAMIC_REENT__ ++#define __DYNAMIC_REENT__ ++#endif ++ + #ifdef __mn10200__ + #define __SMALL_BITFIELDS + #endif + +Dynamic pointer to our reentrancy zone + +Index: newlib/libc/reent/getreent.c +=================================================================== +RCS file: /cvs/src/src/newlib/libc/reent/getreent.c,v +retrieving revision 1.2 +diff -u -p -r1.2 getreent.c +--- a/newlib/libc/reent/getreent.c 7 Sep 2007 00:45:55 -0000 1.2 ++++ b/newlib/libc/reent/getreent.c 8 Nov 2007 16:32:44 -0000 +@@ -3,12 +3,20 @@ + #include <_ansi.h> + #include <reent.h> + ++#define weak_alias(name, aliasname) \ ++ extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); ++ + #ifdef __getreent + #undef __getreent + #endif ++#ifdef __libc_getreent ++#undef __libc_getreent ++#endif + + struct _reent * +-_DEFUN_VOID(__getreent) ++__libc_getreent (void) + { + return _impure_ptr; + } ++weak_alias(__libc_getreent,__getreent) ++ + +We can't provide a red zone in mini-os. + +Index: newlib/libc/machine/x86_64/memcpy.S +=================================================================== +RCS file: /cvs/src/src/newlib/libc/machine/x86_64/memcpy.S,v +retrieving revision 1.1 +diff -u -p -r1.1 memcpy.S +--- a/newlib/libc/machine/x86_64/memcpy.S 28 Aug 2007 21:56:49 -0000 1.1 ++++ b/newlib/libc/machine/x86_64/memcpy.S 8 Nov 2007 16:32:44 -0000 +@@ -30,10 +30,18 @@ quadword_aligned: + cmpq $256, rdx + jb quadword_copy + ++#if 1 ++ subq $32, rsp ++ movq rax, 24 (rsp) ++ movq r12, 16 (rsp) ++ movq r13, 8 (rsp) ++ movq r14, 0 (rsp) ++#else + movq rax, -8 (rsp) + movq r12, -16 (rsp) + movq r13, -24 (rsp) + movq r14, -32 (rsp) ++#endif + + movq rdx, rcx /* Copy 128 bytes at a time with minimum cache polution */ + shrq $7, rcx +@@ -89,10 +97,18 @@ loop: + movq rdx, rcx + andq $127, rcx + rep movsb ++#if 1 ++ movq 24 (rsp), rax ++ movq 16 (rsp), r12 ++ movq 8 (rsp), r13 ++ movq 0 (rsp), r14 ++ addq $32, rsp ++#else + movq -8 (rsp), rax + movq -16 (rsp), r12 + movq -24 (rsp), r13 + movq -32 (rsp), r14 ++#endif + ret + + +--- a/newlib/libc/machine/x86_64/x86_64mach.h.orig 2008-07-11 14:57:23.062269000 +0100 ++++ b/newlib/libc/machine/x86_64/x86_64mach.h 2008-07-11 14:58:01.262503000 +0100 +@@ -22,81 +22,81 @@ + + #define REG(x) CONCAT1(__REG_PREFIX__, x) + +-#define rax REG(rax) +-#define rbx REG(rbx) +-#define rcx REG(rcx) +-#define rdx REG(rdx) +-#define rsi REG(rsi) +-#define rdi REG(rdi) +-#define rbp REG(rbp) +-#define rsp REG(rsp) +- +-#define r8 REG(r8) +-#define r9 REG(r9) +-#define r10 REG(r10) +-#define r11 REG(r11) +-#define r12 REG(r12) +-#define r13 REG(r13) +-#define r14 REG(r14) +-#define r15 REG(r15) +- +-#define eax REG(eax) +-#define ebx REG(ebx) +-#define ecx REG(ecx) +-#define edx REG(edx) +-#define esi REG(esi) +-#define edi REG(edi) +-#define ebp REG(ebp) +-#define esp REG(esp) +- +-#define st0 REG(st) +-#define st1 REG(st(1)) +-#define st2 REG(st(2)) +-#define st3 REG(st(3)) +-#define st4 REG(st(4)) +-#define st5 REG(st(5)) +-#define st6 REG(st(6)) +-#define st7 REG(st(7)) +- +-#define ax REG(ax) +-#define bx REG(bx) +-#define cx REG(cx) +-#define dx REG(dx) +- +-#define ah REG(ah) +-#define bh REG(bh) +-#define ch REG(ch) +-#define dh REG(dh) +- +-#define al REG(al) +-#define bl REG(bl) +-#define cl REG(cl) +-#define dl REG(dl) +- +-#define sil REG(sil) +- +-#define mm1 REG(mm1) +-#define mm2 REG(mm2) +-#define mm3 REG(mm3) +-#define mm4 REG(mm4) +-#define mm5 REG(mm5) +-#define mm6 REG(mm6) +-#define mm7 REG(mm7) +- +-#define xmm0 REG(xmm0) +-#define xmm1 REG(xmm1) +-#define xmm2 REG(xmm2) +-#define xmm3 REG(xmm3) +-#define xmm4 REG(xmm4) +-#define xmm5 REG(xmm5) +-#define xmm6 REG(xmm6) +-#define xmm7 REG(xmm7) +- +-#define cr0 REG(cr0) +-#define cr1 REG(cr1) +-#define cr2 REG(cr2) +-#define cr3 REG(cr3) +-#define cr4 REG(cr4) ++#define rax %rax ++#define rbx %rbx ++#define rcx %rcx ++#define rdx %rdx ++#define rsi %rsi ++#define rdi %rdi ++#define rbp %rbp ++#define rsp %rsp ++ ++#define r8 %r8 ++#define r9 %r9 ++#define r10 %r10 ++#define r11 %r11 ++#define r12 %r12 ++#define r13 %r13 ++#define r14 %r14 ++#define r15 %r15 ++ ++#define eax %eax ++#define ebx %ebx ++#define ecx %ecx ++#define edx %edx ++#define esi %esi ++#define edi %edi ++#define ebp %ebp ++#define esp %esp ++ ++#define st0 %st ++#define st1 %st(1) ++#define st2 %st(2) ++#define st3 %st(3) ++#define st4 %st(4) ++#define st5 %st(5) ++#define st6 %st(6) ++#define st7 %st(7) ++ ++#define ax %ax ++#define bx %bx ++#define cx %cx ++#define dx %dx ++ ++#define ah %ah ++#define bh %bh ++#define ch %ch ++#define dh %dh ++ ++#define al %al ++#define bl %bl ++#define cl %cl ++#define dl %dl ++ ++#define sil %sil ++ ++#define mm1 %mm1 ++#define mm2 %mm2 ++#define mm3 %mm3 ++#define mm4 %mm4 ++#define mm5 %mm5 ++#define mm6 %mm6 ++#define mm7 %mm7 ++ ++#define xmm0 %xmm0 ++#define xmm1 %xmm1 ++#define xmm2 %xmm2 ++#define xmm3 %xmm3 ++#define xmm4 %xmm4 ++#define xmm5 %xmm5 ++#define xmm6 %xmm6 ++#define xmm7 %xmm7 ++ ++#define cr0 %cr0 ++#define cr1 %cr1 ++#define cr2 %cr2 ++#define cr3 %cr3 ++#define cr4 %cr4 + + #ifdef _I386MACH_NEED_SOTYPE_FUNCTION + #define SOTYPE_FUNCTION(sym) .type SYM(sym),@function +--- a/newlib/libc/machine/x86_64/memcpy.S.orig 2008-07-11 15:12:27.494693000 +0100 ++++ b/newlib/libc/machine/x86_64/memcpy.S 2008-07-11 15:12:29.448706000 +0100 +@@ -60,14 +60,14 @@ + movq 48 (rsi), r13 + movq 56 (rsi), r14 + +- movntiq rax, (rdi) +- movntiq r8 , 8 (rdi) +- movntiq r9 , 16 (rdi) +- movntiq r10, 24 (rdi) +- movntiq r11, 32 (rdi) +- movntiq r12, 40 (rdi) +- movntiq r13, 48 (rdi) +- movntiq r14, 56 (rdi) ++ movnti rax, (rdi) ++ movnti r8 , 8 (rdi) ++ movnti r9 , 16 (rdi) ++ movnti r10, 24 (rdi) ++ movnti r11, 32 (rdi) ++ movnti r12, 40 (rdi) ++ movnti r13, 48 (rdi) ++ movnti r14, 56 (rdi) + + movq 64 (rsi), rax + movq 72 (rsi), r8 +@@ -78,14 +78,14 @@ + movq 112 (rsi), r13 + movq 120 (rsi), r14 + +- movntiq rax, 64 (rdi) +- movntiq r8 , 72 (rdi) +- movntiq r9 , 80 (rdi) +- movntiq r10, 88 (rdi) +- movntiq r11, 96 (rdi) +- movntiq r12, 104 (rdi) +- movntiq r13, 112 (rdi) +- movntiq r14, 120 (rdi) ++ movnti rax, 64 (rdi) ++ movnti r8 , 72 (rdi) ++ movnti r9 , 80 (rdi) ++ movnti r10, 88 (rdi) ++ movnti r11, 96 (rdi) ++ movnti r12, 104 (rdi) ++ movnti r13, 112 (rdi) ++ movnti r14, 120 (rdi) + + leaq 128 (rsi), rsi + leaq 128 (rdi), rdi +--- a/newlib/libc/machine/i386/i386mach.h 2000-08-28 18:50:06.000000000 +0100 ++++ b/newlib/libc/machine/i386/i386mach.h 2008-07-11 15:17:13.874409000 +0100 +@@ -27,46 +27,46 @@ + + #define REG(x) CONCAT1(__REG_PREFIX__, x) + +-#define eax REG(eax) +-#define ebx REG(ebx) +-#define ecx REG(ecx) +-#define edx REG(edx) +-#define esi REG(esi) +-#define edi REG(edi) +-#define ebp REG(ebp) +-#define esp REG(esp) +- +-#define st0 REG(st) +-#define st1 REG(st(1)) +-#define st2 REG(st(2)) +-#define st3 REG(st(3)) +-#define st4 REG(st(4)) +-#define st5 REG(st(5)) +-#define st6 REG(st(6)) +-#define st7 REG(st(7)) +- +-#define ax REG(ax) +-#define bx REG(bx) +-#define cx REG(cx) +-#define dx REG(dx) +- +-#define ah REG(ah) +-#define bh REG(bh) +-#define ch REG(ch) +-#define dh REG(dh) +- +-#define al REG(al) +-#define bl REG(bl) +-#define cl REG(cl) +-#define dl REG(dl) +- +-#define mm1 REG(mm1) +-#define mm2 REG(mm2) +-#define mm3 REG(mm3) +-#define mm4 REG(mm4) +-#define mm5 REG(mm5) +-#define mm6 REG(mm6) +-#define mm7 REG(mm7) ++#define eax %eax ++#define ebx %ebx ++#define ecx %ecx ++#define edx %edx ++#define esi %esi ++#define edi %edi ++#define ebp %ebp ++#define esp %esp ++ ++#define st0 %st ++#define st1 %st(1) ++#define st2 %st(2) ++#define st3 %st(3) ++#define st4 %st(4) ++#define st5 %st(5) ++#define st6 %st(6) ++#define st7 %st(7) ++ ++#define ax %ax ++#define bx %bx ++#define cx %cx ++#define dx %dx ++ ++#define ah %ah ++#define bh %bh ++#define ch %ch ++#define dh %dh ++ ++#define al %al ++#define bl %bl ++#define cl %cl ++#define dl %dl ++ ++#define mm1 %mm1 ++#define mm2 %mm2 ++#define mm3 %mm3 ++#define mm4 %mm4 ++#define mm5 %mm5 ++#define mm6 %mm6 ++#define mm7 %mm7 + + #ifdef _I386MACH_NEED_SOTYPE_FUNCTION + #define SOTYPE_FUNCTION(sym) .type SYM(sym),@function +--- a/newlib/libc/machine/x86_64/memset.S 2007-08-28 22:56:49.000000000 +0100 ++++ b/newlib/libc/machine/x86_64/memset.S 2008-07-11 15:16:59.098320000 +0100 +@@ -40,22 +40,22 @@ + + .p2align 4 + loop: +- movntiq rax, (rdi) +- movntiq rax, 8 (rdi) +- movntiq rax, 16 (rdi) +- movntiq rax, 24 (rdi) +- movntiq rax, 32 (rdi) +- movntiq rax, 40 (rdi) +- movntiq rax, 48 (rdi) +- movntiq rax, 56 (rdi) +- movntiq rax, 64 (rdi) +- movntiq rax, 72 (rdi) +- movntiq rax, 80 (rdi) +- movntiq rax, 88 (rdi) +- movntiq rax, 96 (rdi) +- movntiq rax, 104 (rdi) +- movntiq rax, 112 (rdi) +- movntiq rax, 120 (rdi) ++ movnti rax, (rdi) ++ movnti rax, 8 (rdi) ++ movnti rax, 16 (rdi) ++ movnti rax, 24 (rdi) ++ movnti rax, 32 (rdi) ++ movnti rax, 40 (rdi) ++ movnti rax, 48 (rdi) ++ movnti rax, 56 (rdi) ++ movnti rax, 64 (rdi) ++ movnti rax, 72 (rdi) ++ movnti rax, 80 (rdi) ++ movnti rax, 88 (rdi) ++ movnti rax, 96 (rdi) ++ movnti rax, 104 (rdi) ++ movnti rax, 112 (rdi) ++ movnti rax, 120 (rdi) + + leaq 128 (rdi), rdi + +--- a/newlib/libm/machine/i386/i386mach.h.orig 2008-07-11 15:30:37.367227000 +0100 ++++ b/newlib/libm/machine/i386/i386mach.h 2008-07-11 15:30:55.232337000 +0100 +@@ -27,46 +27,46 @@ + + #define REG(x) CONCAT1(__REG_PREFIX__, x) + +-#define eax REG(eax) +-#define ebx REG(ebx) +-#define ecx REG(ecx) +-#define edx REG(edx) +-#define esi REG(esi) +-#define edi REG(edi) +-#define ebp REG(ebp) +-#define esp REG(esp) +- +-#define st0 REG(st) +-#define st1 REG(st(1)) +-#define st2 REG(st(2)) +-#define st3 REG(st(3)) +-#define st4 REG(st(4)) +-#define st5 REG(st(5)) +-#define st6 REG(st(6)) +-#define st7 REG(st(7)) +- +-#define ax REG(ax) +-#define bx REG(bx) +-#define cx REG(cx) +-#define dx REG(dx) +- +-#define ah REG(ah) +-#define bh REG(bh) +-#define ch REG(ch) +-#define dh REG(dh) +- +-#define al REG(al) +-#define bl REG(bl) +-#define cl REG(cl) +-#define dl REG(dl) +- +-#define mm1 REG(mm1) +-#define mm2 REG(mm2) +-#define mm3 REG(mm3) +-#define mm4 REG(mm4) +-#define mm5 REG(mm5) +-#define mm6 REG(mm6) +-#define mm7 REG(mm7) ++#define eax %eax ++#define ebx %ebx ++#define ecx %ecx ++#define edx %edx ++#define esi %esi ++#define edi %edi ++#define ebp %ebp ++#define esp %esp ++ ++#define st0 %st ++#define st1 %st(1) ++#define st2 %st(2) ++#define st3 %st(3) ++#define st4 %st(4) ++#define st5 %st(5) ++#define st6 %st(6) ++#define st7 %st(7) ++ ++#define ax %ax ++#define bx %bx ++#define cx %cx ++#define dx %dx ++ ++#define ah %ah ++#define bh %bh ++#define ch %ch ++#define dh %dh ++ ++#define al %al ++#define bl %bl ++#define cl %cl ++#define dl %dl ++ ++#define mm1 %mm1 ++#define mm2 %mm2 ++#define mm3 %mm3 ++#define mm4 %mm4 ++#define mm5 %mm5 ++#define mm6 %mm6 ++#define mm7 %mm7 + + #ifdef _I386MACH_NEED_SOTYPE_FUNCTION + #define SOTYPE_FUNCTION(sym) .type SYM(sym),@function + + +We want to have a 64bit offsets libc even on 32bit platforms. + +--- ./newlib/configure.host.orig 2008-08-07 16:01:17.801946000 +0100 ++++ ./newlib/configure.host 2008-08-07 16:01:34.181064000 +0100 +@@ -317,6 +317,8 @@ + oext=lo + lpfx= + aext=la ;; ++ i[34567]86-xen-elf) ++ stdio64_dir=stdio64 ;; + *) ;; #shared library not supported for ${host} + esac + +--- a/newlib/libc/include/sys/_types.h.orig 2008-08-07 15:22:44.925008000 +0100 ++++ b/newlib/libc/include/sys/_types.h 2008-08-07 15:22:50.824044000 +0100 +@@ -13,8 +13,12 @@ + #include <sys/lock.h> + + #ifndef __off_t_defined ++#ifdef __MINIOS__ ++typedef long long _off_t; ++#else + typedef long _off_t; + #endif ++#endif + + #if defined(__rtems__) + /* device numbers are 32-bit major and and 32-bit minor */ +--- ./newlib/libc/include/sys/config.h.orig 2008-08-07 14:43:25.915866000 +0100 ++++ ./newlib/libc/include/sys/config.h 2008-08-07 14:44:13.508154000 +0100 +@@ -69,6 +69,10 @@ + /* we use some glibc header files so turn on glibc large file feature */ + #define _LARGEFILE64_SOURCE 1 + #endif ++#ifdef __MINIOS__ ++#define __LARGE64_FILES 1 ++#define _LARGEFILE64_SOURCE 1 ++#endif + #endif + + #ifndef __DYNAMIC_REENT__ +--- ./newlib/libc/include/sys/_default_fcntl.h.orig 2008-08-07 15:08:22.377836000 +0100 ++++ ./newlib/libc/include/sys/_default_fcntl.h 2008-08-07 15:08:31.651890000 +0100 +@@ -170,7 +170,11 @@ + /* Provide _<systemcall> prototypes for functions provided by some versions + of newlib. */ + #ifdef _COMPILING_NEWLIB +-extern int _open _PARAMS ((const char *, int, ...)); ++extern int _open _PARAMS ((const char *, int, ...)) ++#ifdef __MINIOS__ ++ asm("open64") ++#endif ++ ; + extern int _fcntl _PARAMS ((int, int, ...)); + #ifdef __LARGE64_FILES + extern int _open64 _PARAMS ((const char *, int, ...)); +--- ./newlib/libc/include/sys/unistd.h.orig 2008-08-07 15:09:36.449280000 +0100 ++++ ./newlib/libc/include/sys/unistd.h 2008-08-07 15:09:51.210370000 +0100 +@@ -101,7 +101,11 @@ + int _EXFUN(link, (const char *__path1, const char *__path2 )); + int _EXFUN(nice, (int __nice_value )); + #if !defined(__INSIDE_CYGWIN__) +-off_t _EXFUN(lseek, (int __fildes, off_t __offset, int __whence )); ++off_t _EXFUN(lseek, (int __fildes, off_t __offset, int __whence )) ++#ifdef __MINIOS__ ++ asm("lseek64") ++#endif ++ ; + #endif + #if defined(__SPU__) + #define F_ULOCK 0 +--- ./newlib/libc/include/sys/stat.h.orig 2008-08-07 16:08:50.495116000 +0100 ++++ ./newlib/libc/include/sys/stat.h 2008-08-07 16:10:21.799753000 +0100 +@@ -49,6 +49,9 @@ + long st_spare4[2]; + #endif + }; ++#ifdef __MINIOS__ ++#define stat64 stat ++#endif + #endif + + #define _IFMT 0170000 /* type of file */ +@@ -132,7 +135,11 @@ + /* Provide prototypes for most of the _<systemcall> names that are + provided in newlib for some compilers. */ + #ifdef _COMPILING_NEWLIB +-int _EXFUN(_fstat,( int __fd, struct stat *__sbuf )); ++int _EXFUN(_fstat,( int __fd, struct stat *__sbuf )) ++#ifdef __MINIOS__ ++ asm("fstat64") ++#endif ++ ; + int _EXFUN(_stat,( const char *__path, struct stat *__sbuf )); + #ifdef __LARGE64_FILES + struct stat64; +--- ./newlib/libc/include/_syslist.h.orig 2008-08-07 16:24:19.122605000 +0100 ++++ ./newlib/libc/include/_syslist.h 2008-08-07 16:24:21.548628000 +0100 +@@ -14,6 +14,7 @@ + #define _kill kill + #define _link link + #define _lseek lseek ++#define _lseek64 lseek64 + #define _open open + #define _read read + #define _sbrk sbrk +--- a/newlib/libc/include/reent.h.orig 2008-08-07 16:28:49.846502000 +0100 ++++ b/newlib/libc/include/reent.h 2008-08-07 16:29:02.096586000 +0100 +@@ -87,6 +87,9 @@ + #if defined(__CYGWIN__) && defined(_COMPILING_NEWLIB) + #define stat64 __stat64 + #endif ++#if defined(__MINIOS__) ++#define stat64 stat ++#endif + + struct stat64; + diff --git a/external/meta-virtualization/recipes-extended/xen/files/polarssl.patch b/external/meta-virtualization/recipes-extended/xen/files/polarssl.patch new file mode 100644 index 00000000..95487308 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/files/polarssl.patch @@ -0,0 +1,64 @@ +diff -Naur polarssl-1.1.4/include/polarssl/config.h polarssl-x86_64/include/polarssl/config.h +--- a/include/polarssl/config.h 2011-12-22 05:06:27.000000000 -0500 ++++ b/include/polarssl/config.h 2012-10-30 17:18:07.567001000 -0400 +@@ -164,8 +164,8 @@ + * application. + * + * Uncomment this macro to prevent loading of default entropy functions. +-#define POLARSSL_NO_DEFAULT_ENTROPY_SOURCES + */ ++#define POLARSSL_NO_DEFAULT_ENTROPY_SOURCES + + /** + * \def POLARSSL_NO_PLATFORM_ENTROPY +@@ -175,8 +175,8 @@ + * standards like the /dev/urandom or Windows CryptoAPI. + * + * Uncomment this macro to disable the built-in platform entropy functions. +-#define POLARSSL_NO_PLATFORM_ENTROPY + */ ++#define POLARSSL_NO_PLATFORM_ENTROPY + + /** + * \def POLARSSL_PKCS1_V21 +@@ -426,8 +426,8 @@ + * Requires: POLARSSL_TIMING_C + * + * This module enables the HAVEGE random number generator. +- */ + #define POLARSSL_HAVEGE_C ++ */ + + /** + * \def POLARSSL_MD_C +@@ -490,7 +490,7 @@ + * + * This module provides TCP/IP networking routines. + */ +-#define POLARSSL_NET_C ++//#define POLARSSL_NET_C + + /** + * \def POLARSSL_PADLOCK_C +@@ -644,8 +644,8 @@ + * Caller: library/havege.c + * + * This module is used by the HAVEGE random number generator. +- */ + #define POLARSSL_TIMING_C ++ */ + + /** + * \def POLARSSL_VERSION_C +diff -Naur polarssl-1.1.4/library/bignum.c polarssl-x86_64/library/bignum.c +--- a/library/bignum.c 2012-04-29 16:15:55.000000000 -0400 ++++ b/library/bignum.c 2012-10-30 17:21:52.135000999 -0400 +@@ -1101,7 +1101,7 @@ + Z.p[i - t - 1] = ~0; + else + { +-#if defined(POLARSSL_HAVE_LONGLONG) ++#if 0 //defined(POLARSSL_HAVE_LONGLONG) + t_udbl r; + + r = (t_udbl) X.p[i] << biL; diff --git a/external/meta-virtualization/recipes-extended/xen/files/tools-xentop-vwprintw.patch b/external/meta-virtualization/recipes-extended/xen/files/tools-xentop-vwprintw.patch new file mode 100644 index 00000000..5d5d0116 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/files/tools-xentop-vwprintw.patch @@ -0,0 +1,25 @@ +tools/xentop : fix vwprintw -Werror=deprecated-declarations warning + +gcc-8.1 complains: + +| xentop.c: In function 'print': +| xentop.c:304:4: error: 'vwprintw' is deprecated [-Werror=deprecated-declarations] +| vwprintw(stdscr, (curses_str_t)fmt, args); +| ^~~~~~~~ + +vw_printw is the non-deprecated alternative. + +Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com> +diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c +index 2fd2b67..c465810 100644 +--- a/tools/xenstat/xentop/xentop.c ++++ b/tools/xenstat/xentop/xentop.c +@@ -301,7 +301,7 @@ static void print(const char *fmt, ...) + if (!batch) { + if((current_row() < lines()-1)) { + va_start(args, fmt); +- vwprintw(stdscr, (curses_str_t)fmt, args); ++ vw_printw(stdscr, (curses_str_t)fmt, args); + va_end(args); + } + } else { diff --git a/external/meta-virtualization/recipes-extended/xen/files/tpmemu-0.7.4.patch b/external/meta-virtualization/recipes-extended/xen/files/tpmemu-0.7.4.patch new file mode 100644 index 00000000..622b34f5 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/files/tpmemu-0.7.4.patch @@ -0,0 +1,12 @@ +diff -Naur tpm_emulator-x86_64-back/tpm/tpm_emulator_extern.c tpm_emulator-x86_64/tpm/tpm_emulator_extern.c +--- a/tpm/tpm_emulator_extern.c 2012-04-27 10:55:46.581963398 -0400 ++++ b/tpm/tpm_emulator_extern.c 2012-04-27 10:56:02.193034152 -0400 +@@ -249,7 +249,7 @@ + #else /* TPM_NO_EXTERN */ + + int (*tpm_extern_init)(void) = NULL; +-int (*tpm_extern_release)(void) = NULL; ++void (*tpm_extern_release)(void) = NULL; + void* (*tpm_malloc)(size_t size) = NULL; + void (*tpm_free)(/*const*/ void *ptr) = NULL; + void (*tpm_log)(int priority, const char *fmt, ...) = NULL; diff --git a/external/meta-virtualization/recipes-extended/xen/files/vtpm-bufsize.patch b/external/meta-virtualization/recipes-extended/xen/files/vtpm-bufsize.patch new file mode 100644 index 00000000..9c9304cf --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/files/vtpm-bufsize.patch @@ -0,0 +1,13 @@ +diff --git a/config.h.in b/config.h.in +index d16a997..8088a2a 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -27,7 +27,7 @@ + #define TPM_STORAGE_NAME "${TPM_STORAGE_NAME}" + #define TPM_DEVICE_NAME "${TPM_DEVICE_NAME}" + #define TPM_LOG_FILE "${TPM_LOG_FILE}" +-#define TPM_CMD_BUF_SIZE 4096 ++#define TPM_CMD_BUF_SIZE 4088 + + #endif /* _CONFIG_H_ */ + diff --git a/external/meta-virtualization/recipes-extended/xen/files/vtpm-cmake-Wextra.patch b/external/meta-virtualization/recipes-extended/xen/files/vtpm-cmake-Wextra.patch new file mode 100644 index 00000000..5fee4e9a --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/files/vtpm-cmake-Wextra.patch @@ -0,0 +1,21 @@ +--- + CMakeLists.txt | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +Index: tpm_emulator-x86_64/CMakeLists.txt +=================================================================== +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -40,10 +40,11 @@ set(TPM_STORAGE_NAME "/var/lib/tpm/tpm_e + set(TPM_DEVICE_NAME "/dev/tpm") + endif() + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) +-add_definitions(-Wall -Werror -Wno-unused-parameter -Wpointer-arith -Wcast-align -Wwrite-strings) ++add_definitions(-Wall -Werror) + if("${CMAKE_SYSTEM}" MATCHES "Linux") + add_definitions(-Wextra) + endif() ++add_definitions(-Wno-unused-parameter -Wpointer-arith -Wcast-align -Wwrite-strings) + if(USE_OPENSSL) + add_definitions(-DUSE_OPENSSL) + endif() diff --git a/external/meta-virtualization/recipes-extended/xen/files/vtpm-deepquote-anyloc.patch b/external/meta-virtualization/recipes-extended/xen/files/vtpm-deepquote-anyloc.patch new file mode 100644 index 00000000..b1cbf66e --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/files/vtpm-deepquote-anyloc.patch @@ -0,0 +1,127 @@ +diff --git a/tpm/tpm_cmd_handler.c b/tpm/tpm_cmd_handler.c +index 69511d1..7545d51 100644 +--- a/tpm/tpm_cmd_handler.c ++++ b/tpm/tpm_cmd_handler.c +@@ -3347,12 +3347,13 @@ static TPM_RESULT execute_TPM_DeepQuote(TPM_REQUEST *req, TPM_RESPONSE *rsp) + { + TPM_NONCE nonce; + TPM_RESULT res; +- UINT32 sigSize; +- BYTE *sig; ++ UINT32 quote_blob_size; ++ BYTE *quote_blob; + BYTE *ptr; + UINT32 len; + TPM_PCR_SELECTION myPCR; + TPM_PCR_SELECTION ptPCR; ++ UINT32 extraInfoFlags = 0; + + tpm_compute_in_param_digest(req); + +@@ -3361,17 +3362,19 @@ static TPM_RESULT execute_TPM_DeepQuote(TPM_REQUEST *req, TPM_RESPONSE *rsp) + if (tpm_unmarshal_TPM_NONCE(&ptr, &len, &nonce) + || tpm_unmarshal_TPM_PCR_SELECTION(&ptr, &len, &myPCR) + || tpm_unmarshal_TPM_PCR_SELECTION(&ptr, &len, &ptPCR) ++ || tpm_unmarshal_TPM_DEEP_QUOTE_INFO(&ptr, &len, &extraInfoFlags) + || len != 0) return TPM_BAD_PARAMETER; + +- res = TPM_DeepQuote(&nonce, &myPCR, &ptPCR, &req->auth1, &sigSize, &sig); ++ res = TPM_DeepQuote(&nonce, &myPCR, &ptPCR, &req->auth1, extraInfoFlags, ++ "e_blob_size, "e_blob); + if (res != TPM_SUCCESS) return res; +- rsp->paramSize = len = sigSize; ++ rsp->paramSize = len = quote_blob_size; + rsp->param = ptr = tpm_malloc(len); +- if (ptr == NULL || tpm_marshal_BLOB(&ptr, &len, sig, sigSize)) { ++ if (ptr == NULL || tpm_marshal_BLOB(&ptr, &len, quote_blob, quote_blob_size)) { + tpm_free(rsp->param); + res = TPM_FAIL; + } +- tpm_free(sig); ++ tpm_free(quote_blob); + + return res; + } +diff --git a/tpm/tpm_commands.h b/tpm/tpm_commands.h +index 328d1be..a56dd5f 100644 +--- a/tpm/tpm_commands.h ++++ b/tpm/tpm_commands.h +@@ -3077,6 +3077,7 @@ TPM_RESULT TPM_ParentSignEK( + * @myPCR: [in] PCR selection for the virtual TPM + * @ptPCR: [in] PCR selection for the hardware TPM + * @auth1: [in, out] Authorization protocol parameters ++ * @extraInfoFlags [in] Flags for including, kernel hash, group info, etc + * @sigSize: [out] The length of the returned digital signature + * @sig: [out] The resulting digital signature and PCR values + * Returns: TPM_SUCCESS on success, a TPM error code otherwise. +@@ -3086,6 +3087,7 @@ TPM_RESULT TPM_DeepQuote( + TPM_PCR_SELECTION *myPCR, + TPM_PCR_SELECTION *ptPCR, + TPM_AUTH *auth1, ++ UINT32 extraInfoFlags, + UINT32 *sigSize, + BYTE **sig + ); +diff --git a/tpm/tpm_credentials.c b/tpm/tpm_credentials.c +index c0d62e7..6586c22 100644 +--- a/tpm/tpm_credentials.c ++++ b/tpm/tpm_credentials.c +@@ -183,7 +183,8 @@ TPM_RESULT TPM_OwnerReadInternalPub(TPM_KEY_HANDLE keyHandle, TPM_AUTH *auth1, + + int endorsementKeyFresh = 0; + +-TPM_RESULT VTPM_GetParentQuote(TPM_DIGEST* data, TPM_PCR_SELECTION *sel, UINT32 *sigSize, BYTE **sig); ++TPM_RESULT VTPM_GetParentQuote(TPM_NONCE *data, TPM_PCR_SELECTION *sel, ++ UINT32 extraInfoFlags, UINT32 *sigSize, BYTE **sig); + + TPM_RESULT TPM_ParentSignEK(TPM_NONCE *externalData, TPM_PCR_SELECTION *sel, + TPM_AUTH *auth1, UINT32 *sigSize, BYTE **sig) +@@ -191,7 +192,7 @@ TPM_RESULT TPM_ParentSignEK(TPM_NONCE *externalData, TPM_PCR_SELECTION *sel, + TPM_PUBKEY pubKey; + TPM_RESULT res; + TPM_DIGEST hres; +- ++ UINT32 extraInfoFlags = 0; + info("TPM_ParentSignEK()"); + + res = tpm_verify_auth(auth1, tpmData.permanent.data.ownerAuth, TPM_KH_OWNER); +@@ -206,7 +207,7 @@ TPM_RESULT TPM_ParentSignEK(TPM_NONCE *externalData, TPM_PCR_SELECTION *sel, + res = TPM_FAIL; + + if (res == TPM_SUCCESS) +- res = VTPM_GetParentQuote(&hres, sel, sigSize, sig); ++ res = VTPM_GetParentQuote((TPM_NONCE*)&hres, sel, extraInfoFlags, sigSize, sig); + + free_TPM_PUBKEY(pubKey); + return res; +@@ -218,7 +219,7 @@ static const BYTE dquot_hdr[] = { + + TPM_RESULT TPM_DeepQuote(TPM_NONCE *externalData, TPM_PCR_SELECTION *myPCR, + TPM_PCR_SELECTION *ptPCR, TPM_AUTH *auth1, +- UINT32 *sigSize, BYTE **sig) ++ UINT32 extraInfoFlags, UINT32 *quote_blob_size, BYTE **quote_blob) + { + TPM_RESULT res; + TPM_DIGEST hres; +@@ -253,7 +254,7 @@ TPM_RESULT TPM_DeepQuote(TPM_NONCE *externalData, TPM_PCR_SELECTION *myPCR, + + tpm_free(buf); + +- res = VTPM_GetParentQuote(&hres, ptPCR, sigSize, sig); ++ res = VTPM_GetParentQuote((TPM_NONCE*)&hres, ptPCR, extraInfoFlags, quote_blob_size, quote_blob); + + return res; + } +diff --git a/tpm/tpm_marshalling.h b/tpm/tpm_marshalling.h +index d510ebe..2e0c008 100644 +--- a/tpm/tpm_marshalling.h ++++ b/tpm/tpm_marshalling.h +@@ -268,6 +268,8 @@ static inline int tpm_unmarshal_BOOL(BYTE **ptr, UINT32 *length, BOOL *v) + #define tpm_unmarshal_TPM_REDIR_COMMAND tpm_unmarshal_UINT32 + #define tpm_marshal_DAAHANDLE tpm_marshal_UINT32 + #define tpm_unmarshal_DAAHANDLE tpm_unmarshal_UINT32 ++#define tpm_marshal_TPM_DEEP_QUOTE_INFO tpm_marshal_UINT32 ++#define tpm_unmarshal_TPM_DEEP_QUOTE_INFO tpm_unmarshal_UINT32 + + int tpm_marshal_UINT32_ARRAY(BYTE **ptr, UINT32 *length, UINT32 *v, UINT32 n); + int tpm_unmarshal_UINT32_ARRAY(BYTE **ptr, UINT32 *length, UINT32 *v, UINT32 n); diff --git a/external/meta-virtualization/recipes-extended/xen/files/vtpm-deepquote.patch b/external/meta-virtualization/recipes-extended/xen/files/vtpm-deepquote.patch new file mode 100644 index 00000000..6344f387 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/files/vtpm-deepquote.patch @@ -0,0 +1,187 @@ +diff --git a/tpm/tpm_cmd_handler.c b/tpm/tpm_cmd_handler.c +index 0fabf98..69511d1 100644 +--- a/tpm/tpm_cmd_handler.c ++++ b/tpm/tpm_cmd_handler.c +@@ -3343,6 +3343,39 @@ static TPM_RESULT execute_TPM_ParentSignEK(TPM_REQUEST *req, TPM_RESPONSE *rsp) + return res; + } + ++static TPM_RESULT execute_TPM_DeepQuote(TPM_REQUEST *req, TPM_RESPONSE *rsp) ++{ ++ TPM_NONCE nonce; ++ TPM_RESULT res; ++ UINT32 sigSize; ++ BYTE *sig; ++ BYTE *ptr; ++ UINT32 len; ++ TPM_PCR_SELECTION myPCR; ++ TPM_PCR_SELECTION ptPCR; ++ ++ tpm_compute_in_param_digest(req); ++ ++ ptr = req->param; ++ len = req->paramSize; ++ if (tpm_unmarshal_TPM_NONCE(&ptr, &len, &nonce) ++ || tpm_unmarshal_TPM_PCR_SELECTION(&ptr, &len, &myPCR) ++ || tpm_unmarshal_TPM_PCR_SELECTION(&ptr, &len, &ptPCR) ++ || len != 0) return TPM_BAD_PARAMETER; ++ ++ res = TPM_DeepQuote(&nonce, &myPCR, &ptPCR, &req->auth1, &sigSize, &sig); ++ if (res != TPM_SUCCESS) return res; ++ rsp->paramSize = len = sigSize; ++ rsp->param = ptr = tpm_malloc(len); ++ if (ptr == NULL || tpm_marshal_BLOB(&ptr, &len, sig, sigSize)) { ++ tpm_free(rsp->param); ++ res = TPM_FAIL; ++ } ++ tpm_free(sig); ++ ++ return res; ++} ++ + static void tpm_setup_rsp_auth(TPM_COMMAND_CODE ordinal, TPM_RESPONSE *rsp) + { + tpm_hmac_ctx_t hmac; +@@ -4098,6 +4131,11 @@ void tpm_execute_command(TPM_REQUEST *req, TPM_RESPONSE *rsp) + res = execute_TPM_ParentSignEK(req, rsp); + break; + ++ case TPM_ORD_DeepQuote: ++ debug("[TPM_ORD_DeepQuote]"); ++ res = execute_TPM_DeepQuote(req, rsp); ++ break; ++ + default: + #ifdef MTM_EMULATOR + res = mtm_execute_command(req, rsp); +diff --git a/tpm/tpm_commands.h b/tpm/tpm_commands.h +index 7fef934..328d1be 100644 +--- a/tpm/tpm_commands.h ++++ b/tpm/tpm_commands.h +@@ -3071,6 +3071,25 @@ TPM_RESULT TPM_ParentSignEK( + BYTE **sig + ); + ++/** ++ * TPM_DeepQuote - gets a hardware TPM quote of a vTPM's PCRs ++ * @externalData: [in] AntiReplay nonce to prevent replay of messages ++ * @myPCR: [in] PCR selection for the virtual TPM ++ * @ptPCR: [in] PCR selection for the hardware TPM ++ * @auth1: [in, out] Authorization protocol parameters ++ * @sigSize: [out] The length of the returned digital signature ++ * @sig: [out] The resulting digital signature and PCR values ++ * Returns: TPM_SUCCESS on success, a TPM error code otherwise. ++ */ ++TPM_RESULT TPM_DeepQuote( ++ TPM_NONCE *externalData, ++ TPM_PCR_SELECTION *myPCR, ++ TPM_PCR_SELECTION *ptPCR, ++ TPM_AUTH *auth1, ++ UINT32 *sigSize, ++ BYTE **sig ++); ++ + /* + * Error handling + * [tpm_error.c] +diff --git a/tpm/tpm_credentials.c b/tpm/tpm_credentials.c +index 01f29e6..c0d62e7 100644 +--- a/tpm/tpm_credentials.c ++++ b/tpm/tpm_credentials.c +@@ -211,3 +211,49 @@ TPM_RESULT TPM_ParentSignEK(TPM_NONCE *externalData, TPM_PCR_SELECTION *sel, + free_TPM_PUBKEY(pubKey); + return res; + } ++ ++static const BYTE dquot_hdr[] = { ++ 0, 0, 0, 0, 'D', 'Q', 'U', 'T' ++}; ++ ++TPM_RESULT TPM_DeepQuote(TPM_NONCE *externalData, TPM_PCR_SELECTION *myPCR, ++ TPM_PCR_SELECTION *ptPCR, TPM_AUTH *auth1, ++ UINT32 *sigSize, BYTE **sig) ++{ ++ TPM_RESULT res; ++ TPM_DIGEST hres; ++ TPM_PCR_INFO_SHORT pcrData; ++ tpm_sha1_ctx_t ctx; ++ BYTE *buf, *ptr; ++ UINT32 size, len; ++ ++ info("TPM_DeepQuote()"); ++ ++ res = tpm_verify_auth(auth1, tpmData.permanent.data.ownerAuth, TPM_KH_OWNER); ++ if (res != TPM_SUCCESS) return res; ++ ++ res = tpm_compute_pcr_digest(myPCR, &pcrData.digestAtRelease, NULL); ++ if (res != TPM_SUCCESS) return res; ++ ++ pcrData.pcrSelection.sizeOfSelect = myPCR->sizeOfSelect; ++ memcpy(pcrData.pcrSelection.pcrSelect, myPCR->pcrSelect, myPCR->sizeOfSelect); ++ pcrData.localityAtRelease = 1 << tpmData.stany.flags.localityModifier; ++ ++ size = len = sizeof_TPM_PCR_INFO_SHORT(pcrData); ++ buf = ptr = tpm_malloc(size); ++ if (buf == NULL) return TPM_NOSPACE; ++ if (tpm_marshal_TPM_PCR_INFO_SHORT(&ptr, &len, &pcrData)) ++ return TPM_FAIL; ++ ++ tpm_sha1_init(&ctx); ++ tpm_sha1_update(&ctx, dquot_hdr, 8); ++ tpm_sha1_update(&ctx, externalData->nonce, 20); ++ tpm_sha1_update(&ctx, buf, size); ++ tpm_sha1_final(&ctx, hres.digest); ++ ++ tpm_free(buf); ++ ++ res = VTPM_GetParentQuote(&hres, ptPCR, sigSize, sig); ++ ++ return res; ++} +diff --git a/tpm/tpm_structures.h b/tpm/tpm_structures.h +index b0f4625..dfb1894 100644 +--- a/tpm/tpm_structures.h ++++ b/tpm/tpm_structures.h +@@ -660,6 +660,42 @@ typedef struct tdTPM_CMK_MA_APPROVAL { + + /* VTPM-only commands: */ + /* ++ * Deep Quote - Create quote of PCRs ++ * Input: ++ * TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND ++ * UINT32 paramSize Total size of request ++ * TPM_COMMAND_CODE ordinal TPM_ORD_DeepQuote ++ * TPM_NONCE externData 20 bytes of external data ++ * TPM_PCR_SELECTION vtSel PCR selection for virtual TPM ++ * TPM_PCR_SELECTION ptSel PCR selection for physical TPM ++ * --- ++ * UINT32 authHandle Owner authorization session (OIAP) ++ * TPM_NONCE nonceOdd Nonce for authHandle ++ * BOOL continueAuth Continue flag for authHandle ++ * TPM_AUTHDATA privAuth Authorization digest for command ++ * ++ * Output: ++ * TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND ++ * UINT32 paramSize Total size of response ++ * TPM_RESULT returnCode Return code of the operation ++ * BYTE[] sig Signature provided by physical TPM ++ * TPM_PCRVALUE[] pcrValue Values of hardware PCRs used in the quote ++ * --- ++ * TPM_NONCE nonceEven Nonce for authHandle ++ * BOOL continueAuth Continue flag for authHandle ++ * TPM_AUTHDATA resAuth Authorization digest for response ++ * ++ * The values of the virutal TPM's PCRs are not included in the response. ++ * The signature is a standard TPM_Quote response from the physical TPM; its ++ * externalData is the SHA1 hash of the following structure: ++ * TPM_STRUCT_VER version MUST be 0.0.0.0 ++ * BYTE[4] fixed MUST be the string "DQUT" ++ * TPM_NONCE externData From input to the deep quote ++ * TPM_PCR_INFO_SHORT pcrData Virtual TPM's PCRs ++ */ ++#define TPM_ORD_DeepQuote (TPM_VENDOR_COMMAND | TPM_ORD_Quote) ++ ++/* + * ParentSignEK - Proof of fresh provisioning and EK value + * + * Input: diff --git a/external/meta-virtualization/recipes-extended/xen/files/vtpm-implicit-fallthrough.patch b/external/meta-virtualization/recipes-extended/xen/files/vtpm-implicit-fallthrough.patch new file mode 100644 index 00000000..e95d41fc --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/files/vtpm-implicit-fallthrough.patch @@ -0,0 +1,10 @@ +--- a/tpm/tpm_cmd_handler.c.orig 2017-04-27 13:37:14.408000000 +0200 ++++ b/tpm/tpm_cmd_handler.c 2017-04-27 13:39:53.585000000 +0200 +@@ -3397,6 +3397,7 @@ + sizeof(rsp->auth2->nonceOdd.nonce)); + tpm_hmac_update(&hmac, (BYTE*)&rsp->auth2->continueAuthSession, 1); + tpm_hmac_final(&hmac, rsp->auth2->auth); ++ /* fall-thru */ + case TPM_TAG_RSP_AUTH1_COMMAND: + tpm_hmac_init(&hmac, rsp->auth1->secret, sizeof(rsp->auth1->secret)); + tpm_hmac_update(&hmac, rsp->auth1->digest, sizeof(rsp->auth1->digest)); diff --git a/external/meta-virtualization/recipes-extended/xen/files/vtpm-locality.patch b/external/meta-virtualization/recipes-extended/xen/files/vtpm-locality.patch new file mode 100644 index 00000000..8ab7dea6 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/files/vtpm-locality.patch @@ -0,0 +1,50 @@ +diff --git a/tpm/tpm_capability.c b/tpm/tpm_capability.c +index 60bbb90..f8f7f0f 100644 +--- a/tpm/tpm_capability.c ++++ b/tpm/tpm_capability.c +@@ -949,6 +949,8 @@ static TPM_RESULT set_vendor(UINT32 subCap, BYTE *setValue, + UINT32 setValueSize, BOOL ownerAuth, + BOOL deactivated, BOOL disabled) + { ++ if (tpmData.stany.flags.localityModifier != 8) ++ return TPM_BAD_PARAMETER; + /* set the capability area with the specified data, on failure + deactivate the TPM */ + switch (subCap) { +diff --git a/tpm/tpm_cmd_handler.c b/tpm/tpm_cmd_handler.c +index 288d1ce..9e1cfb4 100644 +--- a/tpm/tpm_cmd_handler.c ++++ b/tpm/tpm_cmd_handler.c +@@ -4132,7 +4132,7 @@ void tpm_emulator_shutdown() + tpm_extern_release(); + } + +-int tpm_handle_command(const uint8_t *in, uint32_t in_size, uint8_t **out, uint32_t *out_size) ++int tpm_handle_command(const uint8_t *in, uint32_t in_size, uint8_t **out, uint32_t *out_size, int locality) + { + TPM_REQUEST req; + TPM_RESPONSE rsp; +@@ -4140,7 +4140,9 @@ int tpm_handle_command(const uint8_t *in, uint32_t in_size, uint8_t **out, uint3 + UINT32 len; + BOOL free_out; + +- debug("tpm_handle_command()"); ++ debug("tpm_handle_command(%d)", locality); ++ if (locality != -1) ++ tpmData.stany.flags.localityModifier = locality; + + /* we need the whole packet at once, otherwise unmarshalling will fail */ + if (tpm_unmarshal_TPM_REQUEST((uint8_t**)&in, &in_size, &req) != 0) { +diff --git a/tpm/tpm_emulator.h b/tpm/tpm_emulator.h +index eed749e..4c228bd 100644 +--- a/tpm/tpm_emulator.h ++++ b/tpm/tpm_emulator.h +@@ -59,7 +59,7 @@ void tpm_emulator_shutdown(void); + * its usage. In case of an error, all internally allocated memory + * is released and the the state of out and out_size is unspecified. + */ +-int tpm_handle_command(const uint8_t *in, uint32_t in_size, uint8_t **out, uint32_t *out_size); ++int tpm_handle_command(const uint8_t *in, uint32_t in_size, uint8_t **out, uint32_t *out_size, int locality); + + #endif /* _TPM_EMULATOR_H_ */ + diff --git a/external/meta-virtualization/recipes-extended/xen/files/vtpm-parent-sign-ek.patch b/external/meta-virtualization/recipes-extended/xen/files/vtpm-parent-sign-ek.patch new file mode 100644 index 00000000..14e66eee --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/files/vtpm-parent-sign-ek.patch @@ -0,0 +1,196 @@ +diff --git a/tpm/tpm_cmd_handler.c b/tpm/tpm_cmd_handler.c +index 9e1cfb4..0fabf98 100644 +--- a/tpm/tpm_cmd_handler.c ++++ b/tpm/tpm_cmd_handler.c +@@ -3312,6 +3312,37 @@ static TPM_RESULT execute_TPM_OwnerReadPubek(TPM_REQUEST *req, TPM_RESPONSE *rsp + return res; + } + ++static TPM_RESULT execute_TPM_ParentSignEK(TPM_REQUEST *req, TPM_RESPONSE *rsp) ++{ ++ TPM_NONCE nonce; ++ TPM_RESULT res; ++ UINT32 sigSize; ++ BYTE *sig; ++ BYTE *ptr; ++ UINT32 len; ++ TPM_PCR_SELECTION targetPCR; ++ ++ tpm_compute_in_param_digest(req); ++ ++ ptr = req->param; ++ len = req->paramSize; ++ if (tpm_unmarshal_TPM_NONCE(&ptr, &len, &nonce) ++ || tpm_unmarshal_TPM_PCR_SELECTION(&ptr, &len, &targetPCR) ++ || len != 0) return TPM_BAD_PARAMETER; ++ ++ res = TPM_ParentSignEK(&nonce, &targetPCR, &req->auth1, &sigSize, &sig); ++ if (res != TPM_SUCCESS) return res; ++ rsp->paramSize = len = sigSize; ++ rsp->param = ptr = tpm_malloc(len); ++ if (ptr == NULL || tpm_marshal_BLOB(&ptr, &len, sig, sigSize)) { ++ tpm_free(rsp->param); ++ res = TPM_FAIL; ++ } ++ tpm_free(sig); ++ ++ return res; ++} ++ + static void tpm_setup_rsp_auth(TPM_COMMAND_CODE ordinal, TPM_RESPONSE *rsp) + { + tpm_hmac_ctx_t hmac; +@@ -4062,6 +4093,11 @@ void tpm_execute_command(TPM_REQUEST *req, TPM_RESPONSE *rsp) + res = execute_TPM_OwnerReadPubek(req, rsp); + break; + ++ case TPM_ORD_ParentSignEK: ++ debug("[TPM_ORD_ParentSignEK]"); ++ res = execute_TPM_ParentSignEK(req, rsp); ++ break; ++ + default: + #ifdef MTM_EMULATOR + res = mtm_execute_command(req, rsp); +diff --git a/tpm/tpm_commands.h b/tpm/tpm_commands.h +index a7666f6..7fef934 100644 +--- a/tpm/tpm_commands.h ++++ b/tpm/tpm_commands.h +@@ -3054,6 +3054,23 @@ TPM_RESULT TPM_OwnerReadPubek( + TPM_PUBKEY *pubEndorsementKey + ); + ++/** ++ * TPM_ParentSignEK - gets a hardware TPM quote of a vTPM's EK ++ * @externalData: [in] AntiReplay nonce to prevent replay of messages ++ * @sel: [in] PCR selection for the hardware TPM's quote ++ * @auth1: [in, out] Authorization protocol parameters ++ * @sigSize: [out] The length of the returned digital signature ++ * @sig: [out] The resulting digital signature and PCR values ++ * Returns: TPM_SUCCESS on success, a TPM error code otherwise. ++ */ ++TPM_RESULT TPM_ParentSignEK( ++ TPM_NONCE *externalData, ++ TPM_PCR_SELECTION *sel, ++ TPM_AUTH *auth1, ++ UINT32 *sigSize, ++ BYTE **sig ++); ++ + /* + * Error handling + * [tpm_error.c] +diff --git a/tpm/tpm_credentials.c b/tpm/tpm_credentials.c +index 9cd64af..01f29e6 100644 +--- a/tpm/tpm_credentials.c ++++ b/tpm/tpm_credentials.c +@@ -180,3 +180,34 @@ TPM_RESULT TPM_OwnerReadInternalPub(TPM_KEY_HANDLE keyHandle, TPM_AUTH *auth1, + return TPM_BAD_PARAMETER; + } + } ++ ++int endorsementKeyFresh = 0; ++ ++TPM_RESULT VTPM_GetParentQuote(TPM_DIGEST* data, TPM_PCR_SELECTION *sel, UINT32 *sigSize, BYTE **sig); ++ ++TPM_RESULT TPM_ParentSignEK(TPM_NONCE *externalData, TPM_PCR_SELECTION *sel, ++ TPM_AUTH *auth1, UINT32 *sigSize, BYTE **sig) ++{ ++ TPM_PUBKEY pubKey; ++ TPM_RESULT res; ++ TPM_DIGEST hres; ++ ++ info("TPM_ParentSignEK()"); ++ ++ res = tpm_verify_auth(auth1, tpmData.permanent.data.ownerAuth, TPM_KH_OWNER); ++ if (res != TPM_SUCCESS) return res; ++ ++ if (!endorsementKeyFresh) return TPM_DISABLED_CMD; ++ ++ res = tpm_get_pubek(&pubKey); ++ if (res != TPM_SUCCESS) return res; ++ ++ if (tpm_compute_pubkey_checksum(externalData, &pubKey, &hres)) ++ res = TPM_FAIL; ++ ++ if (res == TPM_SUCCESS) ++ res = VTPM_GetParentQuote(&hres, sel, sigSize, sig); ++ ++ free_TPM_PUBKEY(pubKey); ++ return res; ++} +diff --git a/tpm/tpm_data.c b/tpm/tpm_data.c +index 50c9697..6a0c499 100644 +--- a/tpm/tpm_data.c ++++ b/tpm/tpm_data.c +@@ -76,6 +76,8 @@ static void init_timeouts(void) + tpmData.permanent.data.cmd_durations[2] = 1000; + } + ++extern int endorsementKeyFresh; ++ + void tpm_init_data(void) + { + /* endorsement key */ +@@ -157,6 +159,7 @@ void tpm_init_data(void) + if (tpmConf & TPM_CONF_GENERATE_EK) { + /* generate a new endorsement key */ + tpm_rsa_generate_key(&tpmData.permanent.data.endorsementKey, 2048); ++ endorsementKeyFresh = 1; + } else { + /* setup endorsement key */ + tpm_rsa_import_key(&tpmData.permanent.data.endorsementKey, +diff --git a/tpm/tpm_structures.h b/tpm/tpm_structures.h +index f746c05..b0f4625 100644 +--- a/tpm/tpm_structures.h ++++ b/tpm/tpm_structures.h +@@ -658,6 +658,49 @@ typedef struct tdTPM_CMK_MA_APPROVAL { + #define TPM_ORD_TickStampBlob 242 + #define TPM_ORD_MAX 256 + ++/* VTPM-only commands: */ ++/* ++ * ParentSignEK - Proof of fresh provisioning and EK value ++ * ++ * Input: ++ * TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND ++ * UINT32 paramSize Total size of request ++ * TPM_COMMAND_CODE ordinal TPM_ORD_ParentSignEK ++ * TPM_NONCE externData 20 bytes of external data ++ * TPM_PCR_SELECTION ptSel PCR selection for physical TPM ++ * --- ++ * UINT32 authHandle Owner authorization session (OIAP) ++ * TPM_NONCE nonceOdd Nonce for authHandle ++ * BOOL continueAuth Continue flag for authHandle ++ * TPM_AUTHDATA privAuth Authorization digest for command ++ * ++ * Output: ++ * TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND ++ * UINT32 paramSize Total size of response ++ * TPM_RESULT returnCode Return code of the operation ++ * BYTE[] sig Signature provided by physical TPM ++ * TPM_PCRVALUE[] pcrValue Values of hardware PCRs used in the quote ++ * --- ++ * TPM_NONCE nonceEven Nonce for authHandle ++ * BOOL continueAuth Continue flag for authHandle ++ * TPM_AUTHDATA resAuth Authorization digest for response ++ * ++ * This command is only valid on the first boot of a vTPM; on any subsequent ++ * boot, the command returns TPM_DISABLED_CMD. It is intended to be used to ++ * provide evidence of proper platform configuration to the verifier/CA which is ++ * responsible for the creation of the vTPM's endorsement credential, which will ++ * be used on subsequent boots to certify AIKs via the usual Privacy CA protocol. ++ * ++ * The values of the virtual TPM's PCRs are not included in the response. ++ * The signature is a standard TPM_Quote response from the physical TPM; its ++ * externalData is the SHA1 hash of the following structure: ++ * TPM_PUBKEY pubEK The vTPM's public EK ++ * TPM_NONCE externData From input to the deep quote ++ * ++ * This structure was chosen to match the return of TPM_ReadPubek ++ */ ++#define TPM_ORD_ParentSignEK (TPM_VENDOR_COMMAND | TPM_ORD_ReadPubek) ++ + /* + * TCS Ordinals ([TPM_Part2], Section 17.1) + * diff --git a/external/meta-virtualization/recipes-extended/xen/files/vtpm_TPM_ChangeAuthAsymFinish.patch b/external/meta-virtualization/recipes-extended/xen/files/vtpm_TPM_ChangeAuthAsymFinish.patch new file mode 100644 index 00000000..aefca284 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/files/vtpm_TPM_ChangeAuthAsymFinish.patch @@ -0,0 +1,28 @@ +Patch derived from below Xen changeset. +Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com> + +commit 22bf5be3237cb482a2ffd772ffd20ce37285eebf +Author: Olaf Hering <olaf@aepfle.de> +Date: Mon Jun 18 14:55:36 2018 +0200 + +stubdom/vtpm: fix memcmp in TPM_ChangeAuthAsymFinish + +gcc8 spotted this error: +error: 'memcmp' reading 20 bytes from a region of size 8 [-Werror=stringop-overflow=] + +Signed-off-by: Olaf Hering <olaf@aepfle.de> +Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> + +diff --git a/tpm/tpm_deprecated.c b/tpm/tpm_deprecated.c +index c362b56..4c49f54 100644 +--- a/tpm/tpm_deprecated.c ++++ b/tpm/tpm_deprecated.c +@@ -434,7 +434,7 @@ TPM_RESULT TPM_ChangeAuthAsymFinish(TPM_KEY_HANDLE parentHandle, + tpm_hmac_final(&hmac_ctx, b1.digest); + /* 6. The TPM SHALL compare b1 with newAuthLink. The TPM SHALL + indicate a failure if the values do not match. */ +- if (memcmp(&b1, &newAuthLink, sizeof(TPM_HMAC))) { ++ if (memcmp(&b1, newAuthLink, sizeof(TPM_HMAC))) { + debug("TPM_ChangeAuthAsymFinish(): newAuthLink value does not match."); + return TPM_FAIL; + } diff --git a/external/meta-virtualization/recipes-extended/xen/files/xen-4.11-arm-acpi-fix-string-lengths.patch b/external/meta-virtualization/recipes-extended/xen/files/xen-4.11-arm-acpi-fix-string-lengths.patch new file mode 100644 index 00000000..ece64071 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/files/xen-4.11-arm-acpi-fix-string-lengths.patch @@ -0,0 +1,101 @@ +From 5e1a00969afe98a713bf14d1ba1902403b60e287 Mon Sep 17 00:00:00 2001 +From: Christopher Clark <christopher.w.clark@gmail.com> +Date: Thu, 16 Aug 2018 13:04:52 -0700 +Subject: [PATCH v2] libxl/arm: Fix build on arm64 + acpi w/ gcc 8.2 +To: xen-devel@lists.xenproject.org +Cc: wei.liu2@citrix.com, + ian.jackson@eu.citrix.com, + julien.grall@arm.com, + sstabellini@kernel.org + +[modified for Xen 4.11 to add required: #include <xen-tools/libs.h>] + +Add zero-padding to #defined ACPI table strings that are copied. +Provides sufficient characters to satisfy the length required to +fully populate the destination and prevent array-bounds warnings. +Add BUILD_BUG_ON sizeof checks for compile-time length checking. + +Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com> +Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> +Acked-by: Wei Liu <wei.liu2@citrix.com> +--- +v2: add BUILD_BUG_ON length checks, requested by Wei. + +v1: Please add this patch to the backport list for the next minor + 4.11 release. + +Prior to this: gcc 8.2 objects to memcpy past bounds: + +| libxl_arm_acpi.c: In function 'make_acpi_header': +| libxl_arm_acpi.c:208:5: error: 'memcpy' forming offset [5, 6] is out +of the bounds [0, 4] [-Werror=array-bounds] +| memcpy(h->oem_id, ACPI_OEM_ID, sizeof(h->oem_id)); +| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +| libxl_arm_acpi.c:209:5: error: 'memcpy' forming offset [5, 8] is out +of the bounds [0, 4] [-Werror=array-bounds] +| memcpy(h->oem_table_id, ACPI_OEM_TABLE_ID, +sizeof(h->oem_table_id)); +| +^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +| libxl_arm_acpi.c:211:5: error: 'memcpy' forming offset 4 is out of the +bounds [0, 3] [-Werror=array-bounds] +| memcpy(h->asl_compiler_id, ACPI_ASL_COMPILER_ID, +| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +| sizeof(h->asl_compiler_id)); +| ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +| In function 'make_acpi_rsdp.isra.4', +| inlined from 'libxl__prepare_acpi' at libxl_arm_acpi.c:389:5: +| libxl_arm_acpi.c:193:5: error: 'memcpy' forming offset [5, 6] is out +of the bounds [0, 4] [-Werror=array-bounds] +| memcpy(rsdp->oem_id, ACPI_OEM_ID, sizeof(rsdp->oem_id)); +| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + tools/libxl/libxl_arm_acpi.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c +index 636f724..8924396 100644 +--- a/tools/libxl/libxl_arm_acpi.c ++++ b/tools/libxl/libxl_arm_acpi.c +@@ -29,6 +29,7 @@ typedef int64_t s64; + + #include <acpi/acconfig.h> + #include <acpi/actbl.h> ++#include <xen-tools/libs.h> + + #ifndef BITS_PER_LONG + #ifdef _LP64 +@@ -48,9 +49,9 @@ extern const unsigned char dsdt_anycpu_arm[]; + _hidden + extern const int dsdt_anycpu_arm_len; + +-#define ACPI_OEM_ID "Xen" +-#define ACPI_OEM_TABLE_ID "ARM" +-#define ACPI_ASL_COMPILER_ID "XL" ++#define ACPI_OEM_ID "Xen\0\0" ++#define ACPI_OEM_TABLE_ID "ARM\0\0\0\0" ++#define ACPI_ASL_COMPILER_ID "XL\0" + + enum { + RSDP, +@@ -190,6 +191,7 @@ static void make_acpi_rsdp(libxl__gc *gc, struct xc_dom_image *dom, + struct acpi_table_rsdp *rsdp = (void *)dom->acpi_modules[0].data + offset; + + memcpy(rsdp->signature, "RSD PTR ", sizeof(rsdp->signature)); ++ BUILD_BUG_ON(sizeof(ACPI_OEM_ID) != sizeof(rsdp->oem_id)); + memcpy(rsdp->oem_id, ACPI_OEM_ID, sizeof(rsdp->oem_id)); + rsdp->length = acpitables[RSDP].size; + rsdp->revision = 0x02; +@@ -205,9 +207,12 @@ static void make_acpi_header(struct acpi_table_header *h, const char *sig, + memcpy(h->signature, sig, 4); + h->length = len; + h->revision = rev; ++ BUILD_BUG_ON(sizeof(ACPI_OEM_ID) != sizeof(h->oem_id)); + memcpy(h->oem_id, ACPI_OEM_ID, sizeof(h->oem_id)); ++ BUILD_BUG_ON(sizeof(ACPI_OEM_TABLE_ID) != sizeof(h->oem_table_id)); + memcpy(h->oem_table_id, ACPI_OEM_TABLE_ID, sizeof(h->oem_table_id)); + h->oem_revision = 0; ++ BUILD_BUG_ON(sizeof(ACPI_ASL_COMPILER_ID) != sizeof(h->asl_compiler_id)); + memcpy(h->asl_compiler_id, ACPI_ASL_COMPILER_ID, + sizeof(h->asl_compiler_id)); + h->asl_compiler_revision = 0; diff --git a/external/meta-virtualization/recipes-extended/xen/files/xen-disable-sse-before-inlines.patch b/external/meta-virtualization/recipes-extended/xen/files/xen-disable-sse-before-inlines.patch new file mode 100644 index 00000000..54a28ee4 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/files/xen-disable-sse-before-inlines.patch @@ -0,0 +1,140 @@ +From 6d50ae155c0f736aa6239eabf1bc8c8e3704742d Mon Sep 17 00:00:00 2001 +From: Christopher Clark <christopher.w.clark@gmail.com> +Date: Fri, 21 Sep 2018 08:28:02 -0700 +Subject: [PATCH v2] fuzz, test x86_emulator: disable sse before including + always_inline fns +To: xen-devel@lists.xenproject.org, + jbeulich@suse.com +Cc: ian.jackson@eu.citrix.com, + wei.liu2@citrix.com, + andrew.cooper3@citrix.com + +Workaround for compiler rejection of SSE-using always_inlines defined before +SSE is disabled. + +Compiling with _FORTIFY_SOURCE or higher levels of optimization enabled +will always_inline several library fns (memset, memcpy, ...) +(with gcc 8.2.0 and glibc 2.28). + +In fuzz and x86_emulator test, the compiler is instructed not +to generate SSE instructions via: #pragma GCC target("no-sse") +because those registers are needed for use by the workload. + +The combination above causes compilation failure as the inline functions +use those instructions. This is resolved by reordering the inclusion of +<stdio.h> and <string.h> to after the pragma disabling SSE generation. + +It would be preferable to locate the no-sse pragma within x86-emulate.h at the +top of the file, prior to including any other headers; unfortunately doing so +before <stdlib.h> causes compilation failure due to declaration of 'atof' with: + "SSE register return with SSE disabled". +Fortunately there is no (known) current dependency on any always_inline +SSE-inclined function declared in <stdlib.h> or any of its dependencies, so the +pragma is therefore issued immediately after inclusion of <stdlib.h> with a +comment introduced to explain its location there. + +Add compile-time checks for unwanted prior inclusion of <string.h> and +<stdio.h>, which are the two headers that provide the library functions that +are handled with wrappers and listed within "x86-emulate.h" as ones "we think +might access any of the FPU state". +* Use standard-defined "EOF" macro to detect prior <stdio.h> inclusion. +* Use "_STRING_H" (non-standardized guard macro) as best-effort + for detection of prior <string.h> inclusion. This is non-universally + viable but will provide error output on common GLIBC systems, so + provides some defensive coverage. + +Adds conditional #include <stdio.h> to x86-emulate.h because fwrite, printf, +etc. are referenced when WRAP has been defined. + +Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com> +Reviewed-by: Jan Beulich <jbeulich@suse.com> +--- + tools/fuzz/x86_instruction_emulator/fuzz-emul.c | 10 +++++++-- + tools/tests/x86_emulator/wrappers.c | 1 - + tools/tests/x86_emulator/x86-emulate.h | 28 +++++++++++++++++++++++-- + 3 files changed, 34 insertions(+), 5 deletions(-) + +diff --git a/tools/fuzz/x86_instruction_emulator/fuzz-emul.c b/tools/fuzz/x86_instruction_emulator/fuzz-emul.c +index 03a2473..0ffd0fb 100644 +--- a/tools/fuzz/x86_instruction_emulator/fuzz-emul.c ++++ b/tools/fuzz/x86_instruction_emulator/fuzz-emul.c +@@ -6,9 +6,7 @@ + #include <stdbool.h> + #include <stddef.h> + #include <stdint.h> +-#include <stdio.h> + #include <stdlib.h> +-#include <string.h> + #include <sys/types.h> + #include <sys/stat.h> + #include <sys/mman.h> +@@ -16,6 +14,14 @@ + #include <xen/xen.h> + + #include "x86-emulate.h" ++/* ++ * include "x86-emulate.h" prior to <stdio.h> and <string.h>: ++ * x86-emulate.h disables use of SSE registers, while <stdio.h> and <string.h> ++ * declare functions that may be always_inline and use those registers ++ * unless they have been disabled earlier, which can fail to compile. ++ */ ++#include <stdio.h> ++#include <string.h> + #include "fuzz-emul.h" + + #define MSR_INDEX_MAX 16 +diff --git a/tools/tests/x86_emulator/wrappers.c b/tools/tests/x86_emulator/wrappers.c +index d02013c..eba7cc9 100644 +--- a/tools/tests/x86_emulator/wrappers.c ++++ b/tools/tests/x86_emulator/wrappers.c +@@ -1,5 +1,4 @@ + #include <stdarg.h> +-#include <stdio.h> + + #define WRAP(x) typeof(x) emul_##x + #include "x86-emulate.h" +diff --git a/tools/tests/x86_emulator/x86-emulate.h b/tools/tests/x86_emulator/x86-emulate.h +index b249e46..07ea1e8 100644 +--- a/tools/tests/x86_emulator/x86-emulate.h ++++ b/tools/tests/x86_emulator/x86-emulate.h +@@ -3,11 +3,35 @@ + #include <stddef.h> + #include <stdint.h> + #include <stdlib.h> +-#include <string.h> +- ++/* ++ * Use of sse registers must be disabled prior to the definition of ++ * always_inline functions that would use them (memcpy, memset, etc), ++ * so do this as early as possible, aiming to be before any always_inline ++ * functions that are used are declared. ++ * Unfortunately, this cannot be done prior to inclusion of <stdlib.h> ++ * due to functions such as 'atof' that have SSE register return declared, ++ * so do so here, immediately after that. ++ */ + #if __GNUC__ >= 6 + #pragma GCC target("no-sse") + #endif ++ /* ++ * Attempt detection of unwanted prior inclusion of some headers known to use ++ * always_inline with SSE registers in some library / compiler / optimization ++ * combinations. ++ */ ++#ifdef _STRING_H ++#error "Must not include <string.h> before x86-emulate.h" ++#endif ++#include <string.h> ++ ++/* EOF is a standard macro defined in <stdio.h> so use it for detection */ ++#ifdef EOF ++#error "Must not include <stdio.h> before x86-emulate.h" ++#endif ++#ifdef WRAP ++#include <stdio.h> ++#endif + + #include <xen/xen.h> + +-- +2.1.4 + diff --git a/external/meta-virtualization/recipes-extended/xen/files/xen-tools-xenpmd-snprintf.patch b/external/meta-virtualization/recipes-extended/xen/files/xen-tools-xenpmd-snprintf.patch new file mode 100644 index 00000000..aac7282f --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/files/xen-tools-xenpmd-snprintf.patch @@ -0,0 +1,78 @@ +From e4d78a67ffbacf30b66464080898227f18f6bf49 Mon Sep 17 00:00:00 2001 +From: Christopher Clark <christopher.w.clark@gmail.com> +Date: Fri, 17 Aug 2018 17:46:10 -0700 +Subject: [PATCH] xenpmd: prevent format-truncation warning with gcc 8.2 + ARM + 32-bit +To: xen-devel@lists.xenproject.org +Cc: ian.jackson@eu.citrix.com, + wei.liu2@citrix.com + +xenpmd writes battery information to xenstore, including a string with a +formatted hex value calculated from summing the lengths of four strings, +plus some constants. + +Each of the four strings has a maximum length of 31 bytes, excluding the +terminating zero byte. The strings are stored in 32-byte arrays in a +struct that is zeroed before it is populated, and logic that writes to +the strings uses strncpy and explicit zero termination. + +The maximum value to be supplied to the xenstore string is: + (9 * 4) + (31 * 4) + 4 , which is 164, ie. 0xa4. + +When used with this value, '%02x' will always fit within 3 bytes, but +gcc 8.2 is apparently not able to deduce this (observed when building +for a 32-bit ARM platform). + +This commit assists the compiler by applying a mask (0xff) to the value, +enabling it to observe a lower maximum value and so pass the truncation +length check. + +Prior to this change, building fails with the compiler warning: + +| xenpmd.c: In function 'write_battery_info_to_xenstore': +| xenpmd.c:354:23: error: '%02x' directive output may be truncated +writing between 2 and 8 bytes into a region of size 3 +[-Werror=format-truncation=] +| snprintf(val, 3, "%02x", +| ^~~~ +| xenpmd.c:354:22: note: directive argument in the range [40, 2147483778] +| snprintf(val, 3, "%02x", +| ^~~~~~ +| xenpmd.c:354:5: note: 'snprintf' output between 3 and 9 bytes into a +destination of size 3 +| snprintf(val, 3, "%02x", +| ^~~~~~~~~~~~~~~~~~~~~~~~ +| (unsigned int)(9*4 + +| ~~~~~~~~~~~~~~~~~~~~ +| strlen(info->model_number) + +| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +| strlen(info->serial_number) + +| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +| strlen(info->battery_type) + +| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +| strlen(info->oem_info) + 4)); +| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +| cc1: all warnings being treated as errors + +Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com> +--- + tools/xenpmd/xenpmd.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c +index 56412a9..0c0787e 100644 +--- a/tools/xenpmd/xenpmd.c ++++ b/tools/xenpmd/xenpmd.c +@@ -350,8 +350,10 @@ void write_battery_info_to_xenstore(struct battery_info *info) + + memset(val, 0, 1024); + memset(string_info, 0, 256); +- /* write 9 dwords (so 9*4) + length of 4 strings + 4 null terminators */ +- snprintf(val, 3, "%02x", ++ /* write 9 dwords (so 9*4) + length of 4 strings + 4 null terminators. ++ * mask informs the compiler that format truncation will not occur. ++ */ ++ snprintf(val, 3, "%02x", 0xff & + (unsigned int)(9*4 + + strlen(info->model_number) + + strlen(info->serial_number) + diff --git a/external/meta-virtualization/recipes-extended/xen/lwip.inc b/external/meta-virtualization/recipes-extended/xen/lwip.inc new file mode 100644 index 00000000..e0836332 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/lwip.inc @@ -0,0 +1,24 @@ +# Copyright (C) 2018 kebodiker <kurt.bodiker@braintrust-us.com> +# Released under the MIT license (see COPYING.MIT for the terms) + +require stubdom.inc + +# clear this out to break dependency circle +DEPENDS = "" + +# Nothing to configure or compile +# For stubdoms, lwip is basically a source package with a couple of patches applied. +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +# needed because this directory isn't typically part of a sysroot +SYSROOT_DIRS += "${prefix}/lwip" + +FILES_${PN} = "\ + ${prefix} \ +" + +do_install() { + install -d ${D}${prefix}/lwip + cp -r -t ${D}${prefix}/lwip ${S}/src/* +} diff --git a/external/meta-virtualization/recipes-extended/xen/lwip_1.3.0.bb b/external/meta-virtualization/recipes-extended/xen/lwip_1.3.0.bb new file mode 100644 index 00000000..b7d8e95d --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/lwip_1.3.0.bb @@ -0,0 +1,19 @@ +# Copyright (C) 2018 kebodiker <kurt.bodiker@braintrust-us.com> +# Released under the MIT license (see COPYING.MIT for the terms) + +DESCRIPTION = "LWIP" +HOMEPAGE = "https://savannah.nongnu.org/projects/lwip" +LICENSE = "BSD" +LIC_FILES_CHKSUM = "file://COPYING;md5=59a383b05013356e0c9899b06dc5da3f" + +SRCREV_lwip = "bcb4afa886408bf0a1dde9c2a4a00323c8b07eb1" +SRC_URI = "\ + git://git.savannah.gnu.org/lwip.git;protocol=git;nobranch=1;destsuffix=lwip;name=lwip \ + file://lwip.patch-cvs \ + file://lwip.dhcp_create_request-hwaddr_len.patch \ +" + +S="${WORKDIR}/${PN}" +B="${S}" + +require lwip.inc diff --git a/external/meta-virtualization/recipes-extended/xen/mini-os.inc b/external/meta-virtualization/recipes-extended/xen/mini-os.inc new file mode 100644 index 00000000..61c27041 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/mini-os.inc @@ -0,0 +1,28 @@ +# Copyright (C) 2018 kebodiker <kurt.bodiker@braintrust-us.com> +# Released under the MIT license (see COPYING.MIT for the terms) + +require stubdom.inc + +# clear this out to break dependency circle +DEPENDS = "" + +do_configure() { + ${MAKE} -C ${WORKDIR}/mini-os links +} + +# Nothing to configure or compile +do_compile[noexec] = "1" + +# needed because this directory isn't typically part of a sysroot +SYSROOT_DIRS += "${prefix}/mini-os" +RDEPENDS_${PN}-dev = "perl" + +FILES_${PN}-dev = "\ + ${prefix} \ +" + +do_install() { + install -d ${D}${prefix}/mini-os + cp -r -t ${D}${prefix}/mini-os ${S}/* + rm -rf ${D}${prefix}/mini-os/scripts +} diff --git a/external/meta-virtualization/recipes-extended/xen/mini-os_4.11.0.bb b/external/meta-virtualization/recipes-extended/xen/mini-os_4.11.0.bb new file mode 100644 index 00000000..85a06a79 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/mini-os_4.11.0.bb @@ -0,0 +1,17 @@ +# Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> +# Released under the MIT license (see COPYING.MIT for the terms) + +DESCRIPTION = "Mini-OS is a tiny OS kernel distributed with the Xen Project" +HOMEPAGE = "https://wiki.xenproject.org/wiki/Mini-OS" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=8a437231894440a8f7629caa372243d0" + +# git commit hash for: xen-RELEASE-4.11.0 +SRCREV_minios = "0b4b7897e08b967a09bed2028a79fabff82342dd" +SRC_URI = "\ + git://xenbits.xen.org/mini-os.git;protocol=git;nobranch=1;destsuffix=mini-os;name=minios \ +" +S="${WORKDIR}/mini-os" +B="${S}" + +require mini-os.inc diff --git a/external/meta-virtualization/recipes-extended/xen/newlib.inc b/external/meta-virtualization/recipes-extended/xen/newlib.inc new file mode 100644 index 00000000..1fdbd0aa --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/newlib.inc @@ -0,0 +1,64 @@ +# Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> +# Released under the MIT license (see COPYING.MIT for the terms) + +require stubdom.inc + +CPPFLAGS_INCLUDE_DIR = "-isystem `${HOST_PREFIX}gcc -print-file-name=include`" +STUBDOM_CFLAGS += "-D_I386MACH_ALLOW_HW_INTERRUPTS" + +export ac_cv_path_CC_FOR_TARGET="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT} ${STUBDOM_CPPFLAGS} ${STUBDOM_CFLAGS}" +export CC_FOR_TARGET="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT} ${STUBDOM_CPPFLAGS} ${STUBDOM_CFLAGS}" + +export ac_cv_path_CXX_FOR_TARGET="${HOST_PREFIX}g++ --sysroot=${RECIPE_SYSROOT}" +export CXX_FOR_TARGET="${HOST_PREFIX}g++ --sysroot=${RECIPE_SYSROOT}" + +export ac_cv_path_CPP_FOR_TARGET="${HOST_PREFIX}gcc -E --sysroot=${RECIPE_SYSROOT}" +export CPP_FOR_TARGET="${HOST_PREFIX}gcc -E --sysroot=${RECIPE_SYSROOT}" + +export ac_cv_path_LD_FOR_TARGET="${HOST_PREFIX}ld --sysroot=${RECIPE_SYSROOT}" +export LD_FOR_TARGET="${HOST_PREFIX}ld --sysroot=${RECIPE_SYSROOT}" + +export ac_cv_path_AS_FOR_TARGET="${HOST_PREFIX}as" +export AS_FOR_TARGET="${HOST_PREFIX}as" + +export ac_cv_path_AR_FOR_TARGET="${HOST_PREFIX}ar" +export AR_FOR_TARGET="${HOST_PREFIX}ar" + +export ac_cv_path_NM_FOR_TARGET="${HOST_PREFIX}nm" +export NM_FOR_TARGET="${HOST_PREFIX}nm" + +export ac_cv_path_RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib" +export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib" + +export ac_cv_path_OBJDUMP_FOR_TARGET="${HOST_PREFIX}objdump" +export OBJDUMP_FOR_TARGET="${HOST_PREFIX}objdump" + +export ac_cv_path_OBJCOPY_FOR_TARGET="${HOST_PREFIX}objcopy" +export OBJCOPY_FOR_TARGET="${HOST_PREFIX}objcopy" + +export ac_cv_path_STRIP_FOR_TARGET="${HOST_PREFIX}strip" +export STRIP_FOR_TARGET="${HOST_PREFIX}strip" + +export ac_cv_path_STRINGS_FOR_TARGET="${HOST_PREFIX}strings" +export STRINGS_FOR_TARGET="${HOST_PREFIX}strings" + +export ac_cv_path_READELF_FOR_TARGET="${HOST_PREFIX}readelf" +export READELF_FOR_TARGET="${HOST_PREFIX}readelf" + +do_configure() { + ${S}/configure --verbose --prefix=${prefix} --target=${GNU_TARGET_ARCH}-xen-elf --enable-newlib-io-long-long --disable-multilib + find ${S} -type f | xargs perl -i.bak -pe 's/\b_(tzname|daylight|timezone)\b/$1/g' +} + +do_compile() { + ${MAKE} +} + +do_install() { + ${MAKE} DESTDIR=${D} install + rm -rf ${D}/cross-root-${GNU_TARGET_ARCH}/share + rm -rf ${D}/cross-root-${GNU_TARGET_ARCH}/info + install -m 644 `${HOST_PREFIX}gcc -print-file-name=include`/stdarg.h -t ${D}/${includedir} + install -m 644 `${HOST_PREFIX}gcc -print-file-name=include`/stddef.h -t ${D}/${includedir} + install -m 644 `${HOST_PREFIX}gcc -print-file-name=include`/stdbool.h -t ${D}/${includedir} +} diff --git a/external/meta-virtualization/recipes-extended/xen/newlib_1.16.0.bb b/external/meta-virtualization/recipes-extended/xen/newlib_1.16.0.bb new file mode 100644 index 00000000..60672bea --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/newlib_1.16.0.bb @@ -0,0 +1,21 @@ +# Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> +# Released under the MIT license (see COPYING.MIT for the terms) + +DESCRIPTION = "Newlib is a C library intended for use on embedded systems." +HOMEPAGE = "http://sourceware.org/newlib" +LICENSE = "GPLv2 & LGPLv3 & GPLv3 & LGPLv2" +LIC_FILES_CHKSUM = "file://COPYING.NEWLIB;md5=950f50b290e8fcf7a2d3fff61775de9b" + +# this is the hash of version tag 1_16_0 +SRCREV_newlib = "07b4b67a88f386ce4716a14e0ff2c2bce992b985" +SRC_URI = "\ + git://sourceware.org/git/newlib-cygwin.git;protocol=git;nobranch=1;destsuffix=newlib;name=newlib \ + file://newlib.patch \ + file://newlib-chk.patch \ + file://newlib-stdint-size_max-fix-from-1.17.0.patch \ +" + +S="${WORKDIR}/newlib" +B="${WORKDIR}/build" + +require newlib.inc diff --git a/external/meta-virtualization/recipes-extended/xen/polarssl.inc b/external/meta-virtualization/recipes-extended/xen/polarssl.inc new file mode 100644 index 00000000..eae95f40 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/polarssl.inc @@ -0,0 +1,27 @@ +# Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> +# Released under the MIT license (see COPYING.MIT for the terms) + +require stubdom.inc + +DEPENDS += "\ + newlib \ +" +STUBDOM_CFLAGS += "\ + -Wno-memset-elt-size \ + -Wno-implicit-fallthrough \ +" + +# nothing to configure +do_configure[noexec] = "1" + +do_compile() { + ${MAKE} CC="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT} ${STUBDOM_CPPFLAGS} ${STUBDOM_CFLAGS}" +} + +do_install() { + install -d ${D}${includedir} + cp -r -t ${D}${includedir} ${S}/include/polarssl + + install -d ${D}/${libdir} + install -m 644 -t ${D}/${libdir} ${S}/library/libpolarssl.a +} diff --git a/external/meta-virtualization/recipes-extended/xen/polarssl_1.1.4.bb b/external/meta-virtualization/recipes-extended/xen/polarssl_1.1.4.bb new file mode 100644 index 00000000..80ea45a7 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/polarssl_1.1.4.bb @@ -0,0 +1,19 @@ +# Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> +# Released under the MIT license (see COPYING.MIT for the terms) + +DESCRIPTION = "PolarSSL (now 'mbed TLS') is an open source, portable, easy to use, readable and flexible SSL library." +HOMEPAGE = "https://tls.mbed.org" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://LICENSE;md5=751419260aa954499f7abaabaa882bbe" + +# git hash for release tag polarssl-1.1.4 +SRCREV_polarssl = "d36da11125a9c85c572a4fdf63e0a25e76d7bb18" +SRC_URI = "\ + git://github.com/ARMmbed/mbedtls.git;protocol=https;nobranch=1;destsuffix=polarssl;name=polarssl \ + file://polarssl.patch; \ +" + +S="${WORKDIR}/${PN}" +B="${S}/library" + +require polarssl.inc diff --git a/external/meta-virtualization/recipes-extended/xen/stubdom-gmp.inc b/external/meta-virtualization/recipes-extended/xen/stubdom-gmp.inc new file mode 100644 index 00000000..ef6473d4 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/stubdom-gmp.inc @@ -0,0 +1,37 @@ +# Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> +# Released under the MIT license (see COPYING.MIT for the terms) + +require stubdom.inc + +DEPENDS += "\ + newlib \ +" + +do_configure() { + # need to modify prefix here during configure otherwise OE-level variables + # (prefix, libdir, includedir, etc...) defined in stubdom.inc get messed up + CPPFLAGS="-isystem ${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/include ${STUBDOM_CPPFLAGS}" \ + CFLAGS="${STUBDOM_CFLAGS}" \ + CC="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT}" \ + ${S}/configure \ + --disable-shared \ + --enable-static \ + --disable-fft \ + --without-readline \ + --with-gnu-ld \ + --prefix=${prefix}/${GNU_TARGET_ARCH}-xen-elf \ + --libdir=${libdir} \ + --build=`${HOST_PREFIX}gcc -dumpmachine` \ + --host=${GNU_TARGET_ARCH}-xen-elf + + sed -i 's/#define HAVE_OBSTACK_VPRINTF 1/\/\/#define HAVE_OBSTACK_VPRINTF 1/' ${S}/config.h +} + +do_compile() { + ${MAKE} +} + +do_install() { + ${MAKE} DESTDIR=${D} install + rm -rf ${D}${prefix}/${GNU_TARGET_ARCH}-xen-elf/share +} diff --git a/external/meta-virtualization/recipes-extended/xen/stubdom-gmp_4.3.2.bb b/external/meta-virtualization/recipes-extended/xen/stubdom-gmp_4.3.2.bb new file mode 100644 index 00000000..d9a2adbd --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/stubdom-gmp_4.3.2.bb @@ -0,0 +1,20 @@ +# Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> +# Released under the MIT license (see COPYING.MIT for the terms) + +DESCRIPTION = "GMP library for Xen vTPM's." +HOMEPAGE = "http://gmp" +LICENSE = "GPLv3" +LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \ +" + +SRC_URI = "\ + https://gmplib.org/download/gmp/archive/gmp-${PV}.tar.bz2 \ +" +SRC_URI[md5sum] = "dd60683d7057917e34630b4a787932e8" +SRC_URI[sha256sum] = "936162c0312886c21581002b79932829aa048cfaf9937c6265aeaa14f1cd1775" + +S="${WORKDIR}/gmp-${PV}" +B="${S}" + +require stubdom-gmp.inc diff --git a/external/meta-virtualization/recipes-extended/xen/stubdom.inc b/external/meta-virtualization/recipes-extended/xen/stubdom.inc new file mode 100644 index 00000000..bfc67527 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/stubdom.inc @@ -0,0 +1,152 @@ +# Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> +# Released under the MIT license (see COPYING.MIT for the terms) + +COMPATIBLE_HOST = '(x86_64.*).*-linux' + +require xen-arch.inc + +# many of the xen stubdom related recipes build and package static instead of shared libraries +EXCLUDE_FROM_SHLIBS = "1" + +# base set of dependencies to be used for xen stubdom recipes +DEPENDS += "\ + lwip \ + mini-os \ +" + +# unset EVERYTHING from the OE environment. +# Weird things happen when these are exported into the environment. +unset CFLAGS +unset BUILD_CFLAGS +unset TARGET_CFLAGS +unset CFLAGS_FOR_BUILD + +unset CPPFLAGS +unset BUILD_CPPFLAGS +unset TARGET_CPPFLAGS +unset CPPFLAGS_FOR_BUILD + +unset LDFLAGS +unset BUILD_LDFLAGS +unset TARGET_LDFLAGS +unset LDFLAGS_FOR_BUILD + +unset CXXFLAGS +unset TARGET_CXXFLAGS +unset BUILD_CXXFLAGS +unset CXXFLAGS_FOR_BUILD + +unset BUILD_CC +unset BUILD_CPP +unset BUILD_CXX +unset BUILD_LD +unset BUILD_AR +unset BUILD_AS +unset BUILD_CCLD +unset BUILD_FC +unset BUILD_RANLIB +unset BUILD_NM +unset BUILD_STRIP +unset BUILD_READELF +unset BUILD_OBJCOPY +unset BUILD_OBJDUMP +unset CC +unset CPP +unset CXX +unset LD +unset AR +unset AS +unset NM +unset RANLIB +unset STRIP +unset STRINGS +unset READELF +unset OBJCOPY +unset OBJDUMP +unset READELF +unset CCLD +unset FC + +# Provide support to build both 32-bit and 64-bit stubdoms +python () { + gnu_dict = { + 'x86_32': 'i686', + 'x86_64': 'x86_64', + } + + if d.expand('${XEN_TARGET_ARCH}') == 'x86_32': + d.setVar("GNU_TARGET_ARCH",gnu_dict[d.expand('${XEN_TARGET_ARCH}')]) + d.setVar("PACKAGE_ARCH","core2-32") + elif d.expand('${XEN_TARGET_ARCH}') == 'x86_64': + d.setVar("GNU_TARGET_ARCH",gnu_dict[d.expand('${XEN_TARGET_ARCH}')]) +} + +export GNU_TARGET_ARCH +export XEN_TARGET_ARCH="${@map_xen_arch(d.getVar('TARGET_ARCH'), d)}" +export XEN_COMPILE_ARCH="${@map_xen_arch(d.getVar('BUILD_ARCH'), d)}" + +LWIP_SRCDIR = "${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/lwip" +MINIOS_SRCDIR = "${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/mini-os" + +# Base set of CPPFLAGS, CFLAGS needed for each component used to build MiniOS-based stubdoms +# LDFLAGS are only used when building stubdoms, so only used in stubdom recipes +# Generic name given because each library uses DEF_, BUILD_, TARGET_, and xxxFLAGS differently +CPPFLAGS_INCLUDE_DIR = "-isystem ${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/include" + +STUBDOM_CPPFLAGS += "\ + -isystem ${MINIOS_SRCDIR}/include \ + -D__MINIOS__ \ + -DHAVE_LIBC \ + -isystem ${MINIOS_SRCDIR}/include/posix \ + -isystem ${MINIOS_SRCDIR}/include/xen \ + -isystem ${MINIOS_SRCDIR}/include/x86 \ + -isystem ${MINIOS_SRCDIR}/include/x86/${XEN_TARGET_ARCH} \ + -U __linux__ \ + -U __FreeBSD__ \ + -U __sun__ \ + -nostdinc \ + ${CPPFLAGS_INCLUDE_DIR} \ + -isystem ${LWIP_SRCDIR}/include \ + -isystem ${LWIP_SRCDIR}/include/ipv4 \ +" + +STUBDOM_CFLAGS += "\ + -mno-red-zone \ + -O1 \ + -fno-omit-frame-pointer \ + -m64 \ + -fno-reorder-blocks \ + -fno-asynchronous-unwind-tables \ + -DBUILD_ID \ + -fno-strict-aliasing \ + -std=gnu99 \ + -Wall \ + -Wstrict-prototypes \ + -Wdeclaration-after-statement \ + -Wno-unused-but-set-variable \ + -Wno-unused-local-typedefs \ + -fno-stack-protector \ + -fno-exceptions \ +" + +STUBDOM_LDFLAGS = "\ + -nostdlib \ + -L${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/lib \ +" + +# Need to redefine these for stubdom-related builds. It all starts because of +# the prefix used in newlib and then continues because we don't want to +# cross-contaminate stubdom-related recipes with headers and libraries found in +# the OE-defined locations +export prefix="/cross-root-${GNU_TARGET_ARCH}" +export includedir="${prefix}/${GNU_TARGET_ARCH}-xen-elf/include" +export libdir="${prefix}/${GNU_TARGET_ARCH}-xen-elf/lib" +export libexecdir="${libdir}" +export STAGING_INCDIR +export STAGING_LIBDIR + +# Typically defined in Xen and Minios .mk files that aren't sourced/read, +# defined to trigger some values and paths in Makefiles +export debug="y" +export stubdom="y" +export XEN_OS="MiniOS" diff --git a/external/meta-virtualization/recipes-extended/xen/tpm-emulator.inc b/external/meta-virtualization/recipes-extended/xen/tpm-emulator.inc new file mode 100644 index 00000000..f58a2763 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/tpm-emulator.inc @@ -0,0 +1,37 @@ +# Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> +# Released under the MIT license (see COPYING.MIT for the terms) + +require stubdom.inc + +DEPENDS += "\ + cmake-native \ + newlib \ + stubdom-gmp \ +" + +# nothing to configure +do_configure[noexec] = "1" + +export CMAKE_C_FLAGS = "\ + -std=c99 \ + -DTPM_NO_EXTERN \ + ${STUBDOM_CPPFLAGS} \ + ${STUBDOM_CFLAGS} \ + -Wno-declaration-after-statement \ + -Wno-implicit-fallthrough \ +" + +do_compile() { + CC="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT}" cmake .. -DCMAKE_C_FLAGS:STRING="${CMAKE_C_FLAGS}" + ${MAKE} VERBOSE=1 tpm_crypto tpm +} + +do_install() { + install -d ${D}/${libdir} + install -m 644 -t ${D}/${libdir} ${B}/crypto/libtpm_crypto.a + install -m 644 -t ${D}/${libdir} ${B}/tpm/libtpm.a + + install -D -m 644 -t ${D}/${includedir}/tpm-emulator/build ${S}/build/config.h + install -D -m 644 -t ${D}/${includedir}/tpm-emulator/crypto ${S}/crypto/*.h + install -D -m 644 -t ${D}/${includedir}/tpm-emulator/tpm ${S}/tpm/*.h +} diff --git a/external/meta-virtualization/recipes-extended/xen/tpm-emulator_0.7.4.bb b/external/meta-virtualization/recipes-extended/xen/tpm-emulator_0.7.4.bb new file mode 100644 index 00000000..96a40905 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/tpm-emulator_0.7.4.bb @@ -0,0 +1,27 @@ +# Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> +# Released under the MIT license (see COPYING.MIT for the terms) + +DESCRIPTION = "TPM Emulator" +HOMEPAGE = "http://xenbits.xen.org/xen-extfiles" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://README;md5=eeabd77cf8fd8a8bc42983884cb09863" + +SRC_URI = "\ + http://xenbits.xen.org/xen-extfiles/tpm_emulator-${PV}.tar.gz;name=tpm-emulator \ + file://tpmemu-0.7.4.patch \ + file://vtpm-bufsize.patch \ + file://vtpm-locality.patch \ + file://vtpm-parent-sign-ek.patch \ + file://vtpm-deepquote.patch \ + file://vtpm-deepquote-anyloc.patch \ + file://vtpm-cmake-Wextra.patch \ + file://vtpm-implicit-fallthrough.patch \ + file://vtpm_TPM_ChangeAuthAsymFinish.patch \ +" +SRC_URI[tpm-emulator.md5sum] = "e26becb8a6a2b6695f6b3e8097593db8" +SRC_URI[tpm-emulator.sha256sum] = "4e48ea0d83dd9441cc1af04ab18cd6c961b9fa54d5cbf2c2feee038988dea459" + +S="${WORKDIR}/tpm_emulator-${PV}" +B="${S}/build" + +require tpm-emulator.inc diff --git a/external/meta-virtualization/recipes-extended/xen/xen-arch.inc b/external/meta-virtualization/recipes-extended/xen/xen-arch.inc new file mode 100644 index 00000000..fb0093e3 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/xen-arch.inc @@ -0,0 +1,18 @@ + +valid_xen_archs = " \ + x86_64 x86_32 \ + arm32 arm64 \ + " + +def map_xen_arch(a, d): + import re + valid_archs = d.getVar('valid_xen_archs').split() + + if re.match("i.86", a): return "x86_32" + elif re.match("x86.64", a): return "x86_64" + elif re.match("arm.*", a): return "arm32" + elif re.match("aarch64.*", a): return "arm64" + elif a in valid_archs: return a + else: + return "INVALID" + diff --git a/external/meta-virtualization/recipes-extended/xen/xen-vtpm.inc b/external/meta-virtualization/recipes-extended/xen/xen-vtpm.inc new file mode 100644 index 00000000..a94c7503 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/xen-vtpm.inc @@ -0,0 +1,111 @@ +# Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> +# Released under the MIT license (see COPYING.MIT for the terms) + +require stubdom.inc + +DEPENDS = "\ + newlib \ + lwip \ + mini-os \ + polarssl \ + stubdom-gmp \ + tpm-emulator \ +" +# These were unset by stubdom.inc to allow us to scope them per recipe +export CC="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT}" +export CCLD="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT}" +export CXX="${HOST_PREFIX}g++ --sysroot=${RECIPE_SYSROOT}" +export CPP="${HOST_PREFIX}gcc -E --sysroot=${RECIPE_SYSROOT}" +export LD="${HOST_PREFIX}ld --sysroot=${RECIPE_SYSROOT}" +export LD_LTO="${HOST_PREFIX}ld --sysroot=${RECIPE_SYSROOT}" +export AS="${HOST_PREFIX}as" +export AR="${HOST_PREFIX}ar" +export NM="${HOST_PREFIX}nm" +export RANLIB="${HOST_PREFIX}ranlib" +export OBJDUMP="${HOST_PREFIX}objdump" +export OBJCOPY="${HOST_PREFIX}objcopy" +export STRIP="${HOST_PREFIX}strip" +export STRINGS="${HOST_PREFIX}strings" +export READELF="${HOST_PREFIX}readelf" + + +# Required for some of the config stuff +export STUBDOM_TARGETS="vtpm vtpmmgr" + +VTPM_CPPFLAGS = "\ + -I${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/include/tpm-emulator/build \ + -I${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/include/tpm-emulator/crypto \ + -I${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/include/tpm-emulator/tpm \ + -I${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/include/tpm-emulator \ +" + +# The includes from this Xen directory are not in the MiniOS repo, although they probably should be. +STUBDOM_CPPFLAGS += "-isystem ${B}/include/" + +do_configure() { + + # GCC 7 fails linking header defined inlines if not declared 'static' or 'extern' + # This appears to be fixed in Xen 4.10.0+, so let's look at version of Xen source + # to determine if we need to modify inline declarations. + # + # 'echo -e' to enable interpretation of backslashes + # 'sort -V' to natural sort version numbers + # 'head -n1' to capture the first line of output from sort command + + if [ "${PV}" = "$(echo "${PV};4.9.999" | sed 's/;/\n/' | sort -V | head -n1)" ]; then + sed -i "s/^inline/static inline/g" ${B}/vtpmmgr/*.h + fi + + for i in AR AS NM RANLIB OBJDUMP OBJCOPY STRIP STRINGS READELF CXX LD LD_LTO CC CPP; do + sed -i "s/^\($i\s\s*\).*=/\1?=/" ${MINIOS_SRCDIR}/Config.mk + done + + # replicate the TARGETS_MINIOS target in xen/stubdom/Makefile + for i in ${STUBDOM_TARGETS}; do + [ -d ${B}/mini-os-${XEN_TARGET_ARCH}-$i ] || + for j in $(cd ${MINIOS_SRCDIR} ; find . -type d) ; do \ + mkdir -p ${B}/mini-os-${XEN_TARGET_ARCH}-$i/$j; \ + done + done +} + +do_compile() { + ${MAKE} MINIOS_CONFIG="${B}/vtpm/minios.cfg" CONFIG_FILE="${B}/vtpm-minios-config.mk" DESTDIR= -C ${MINIOS_SRCDIR} config + CPPFLAGS="`cat ${B}/vtpm-minios-config.mk` ${STUBDOM_CPPFLAGS} ${VTPM_CPPFLAGS}" CFLAGS="${STUBDOM_CFLAGS}" ${MAKE} -C ${B}/vtpm + DEF_CPPFLAGS="${STUBDOM_CPPFLAGS}" \ + DEF_CFLAGS="${STUBDOM_CFLAGS}" \ + DEF_LDFLAGS="${STUBDOM_LDFLAGS}" \ + MINIOS_CONFIG="${B}/vtpm/minios.cfg" \ + ${MAKE} -C ${MINIOS_SRCDIR} \ + OBJ_DIR=${B}/mini-os-${XEN_TARGET_ARCH}-vtpm \ + APP_OBJS="${B}/vtpm/vtpm.a" \ + APP_LDLIBS="-ltpm -ltpm_crypto -lgmp -lpolarssl" + + ${MAKE} MINIOS_CONFIG="${B}/vtpmmgr/minios.cfg" CONFIG_FILE="${B}/vtpmmgr-minios-config.mk" DESTDIR= -C ${MINIOS_SRCDIR} config + CPPFLAGS="`cat ${B}/vtpmmgr-minios-config.mk` ${STUBDOM_CPPFLAGS}" CFLAGS="${STUBDOM_CFLAGS}" ${MAKE} -C ${B}/vtpmmgr + DEF_CPPFLAGS="${STUBDOM_CPPFLAGS}" \ + DEF_CFLAGS="${STUBDOM_CFLAGS}" \ + DEF_LDFLAGS="${STUBDOM_LDFLAGS}" \ + MINIOS_CONFIG="${B}/vtpmmgr/minios.cfg" \ + ${MAKE} -C ${MINIOS_SRCDIR} \ + OBJ_DIR=${B}/mini-os-${XEN_TARGET_ARCH}-vtpmmgr \ + APP_OBJS="${B}/vtpmmgr/vtpmmgr.a" \ + APP_LDLIBS="-lm -lpolarssl" +} + +PACKAGES = "\ + ${PN}-vtpm-stubdom \ + ${PN}-vtpmmgr-stubdom \ +" +FILES_${PN}-vtpm-stubdom="\ + ${libdir}/xen/boot/vtpm-stubdom.gz \ +" + +FILES_${PN}-vtpmmgr-stubdom="\ + ${libdir}/xen/boot/vtpmmgr-stubdom.gz \ +" + +do_install() { + install -m 644 -D ${B}/mini-os-${XEN_TARGET_ARCH}-vtpm/mini-os.gz ${D}${libdir}/xen/boot/vtpm-stubdom.gz + install -m 644 -D ${B}/mini-os-${XEN_TARGET_ARCH}-vtpmmgr/mini-os.gz ${D}${libdir}/xen/boot/vtpmmgr-stubdom.gz +} diff --git a/external/meta-virtualization/recipes-extended/xen/xen-vtpm_4.11.0.bb b/external/meta-virtualization/recipes-extended/xen/xen-vtpm_4.11.0.bb new file mode 100644 index 00000000..088e985b --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/xen-vtpm_4.11.0.bb @@ -0,0 +1,21 @@ +# Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> +# Released under the MIT license (see COPYING.MIT for the terms) + +DESCRIPTION = "MiniOS-based vTPMs for Xen" +HOMEPAGE = "https://www.xenproject.org" +LICENSE = "GPLv2 & BSD-3-Clause" +LIC_FILES_CHKSUM = "file://COPYING;md5=b1ceb1b03a49b202ee6f41ffd1ed0155 \ + file://vtpm/COPYING;md5=75a98062ab0322ded060d9026a1bda61 \ +" + +# git commit hash for Xen's RELEASE-4.11.0 tag +SRCREV_xen = "1eb6544a567e3e5133fafe0c4ef3545c5138d0e4" +SRC_URI = "\ + git://xenbits.xen.org/xen.git;protocol=git;nobranch=1;name=xen;subpath=stubdom \ + git://xenbits.xen.org/xen.git;protocol=git;nobranch=1;name=xen;destsuffix=stubdom/include;subpath=tools/xenstore/include \ +" + +S="${WORKDIR}/stubdom" +B="${S}" + +require xen-vtpm.inc diff --git a/external/meta-virtualization/recipes-extended/xen/xen.inc b/external/meta-virtualization/recipes-extended/xen/xen.inc new file mode 100644 index 00000000..7eb2ac4b --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/xen.inc @@ -0,0 +1,1106 @@ +DESCRIPTION = "Xen hypervisor" +HOMEPAGE = "http://xen.org" +LICENSE = "GPLv2" +SECTION = "console/tools" + +LIC_FILES_CHKSUM = "file://COPYING;md5=bbb4b1bdc2c3b6743da3c39d03249095" + +COMPATIBLE_HOST = '(x86_64.*).*-linux|aarch64.*-linux|arm-.*-linux-gnueabi' + +inherit autotools-brokensep setuptools update-rc.d systemd deploy + +require xen-arch.inc + +PACKAGECONFIG ??= " \ + sdl \ + ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \ + ${@bb.utils.contains('XEN_TARGET_ARCH', 'x86_64', 'hvm', '', d)} \ + " + +FLASK_POLICY_FILE ?= "xenpolicy-${PV}" + +PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,virtual/libsdl," +PACKAGECONFIG[xsm] = "--enable-xsmpolicy,--disable-xsmpolicy,checkpolicy-native," +PACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd,systemd," +PACKAGECONFIG[hvm] = "--with-system-seabios="/usr/share/firmware/bios.bin",--disable-seabios,seabios ipxe vgabios," + +DEPENDS = " \ + bison-native \ + dev86-native \ + flex-native \ + file-native \ + gettext-native \ + acpica-native \ + ncurses-native \ + util-linux-native \ + xz-native \ + bridge-utils \ + curl \ + dtc \ + gettext \ + glib-2.0 \ + gnutls \ + iproute2 \ + libnl \ + ncurses \ + openssl \ + pciutils \ + pixman \ + procps \ + python \ + libaio \ + lzo \ + util-linux \ + xz \ + yajl \ + zlib \ + gnu-efi \ + " + +# inherit setuptools adds python to RDEPENDS, override it +RDEPENDS_${PN} = "" + +RDEPENDS_${PN}-base = "\ + bash perl xz \ + ${PN}-console \ + ${PN}-libxenguest \ + ${PN}-libxenlight \ + ${PN}-libxenvchan \ + ${PN}-libxenctrl \ + ${PN}-libxlutil \ + ${PN}-libxenstat \ + ${PN}-libxenstore \ + ${PN}-libfsimage \ + ${PN}-fsimage \ + ${PN}-scripts-block \ + ${PN}-scripts-network \ + ${PN}-xen-watchdog \ + ${PN}-xencommons \ + ${PN}-xendomains \ + ${PN}-xenstore \ + ${PN}-xenstored \ + ${PN}-xl \ + " + +RDEPENDS_${PN}-dev = "" + +RRECOMMENDS_${PN}-base = " \ + ${PN}-blktap \ + ${PN}-libblktap \ + ${PN}-libblktapctl \ + ${PN}-libvhd \ + ${PN}-flask \ + ${PN}-hvmloader \ + ${PN}-shim \ + ${PN}-xenpaging \ + " + +RDEPENDS_${PN}-devd = " \ + ${PN}-xl \ + " + +RDEPENDS_${PN}-fsimage = " \ + libext2fs \ + " + +RDEPENDS_${PN}-misc = " \ + perl \ + python \ + " + +RDEPENDS_${PN}-remus = " \ + bash \ + python \ + " + +RDEPENDS_${PN}-scripts-block = "\ + bash \ + ${PN}-scripts-common \ + ${PN}-volatiles \ + " + +RDEPENDS_${PN}-scripts-common = "bash" + +RDEPENDS_${PN}-scripts-network = "\ + bash \ + bridge-utils \ + ${PN}-scripts-common \ + ${PN}-volatiles \ + " + +RDEPENDS_${PN}-xencommons = "\ + bash \ + ${PN}-console \ + ${PN}-xenstore \ + ${PN}-xenstored \ + ${PN}-xl \ + ${PN}-scripts-common \ + " + +RDEPENDS_${PN}-xendomains = "\ + bash \ + ${PN}-console \ + ${PN}-scripts-block \ + ${PN}-scripts-common \ + ${PN}-xenstored \ + " + +RDEPENDS_${PN}-xl = "libgcc" + +RDEPENDS_${PN}-xentrace = "python" + +RDEPENDS_${PN}-xen-watchdog = "bash" + +PACKAGES = "\ + ${PN}-base \ + ${PN}-blktap \ + ${PN}-console \ + ${PN}-cpuid \ + ${PN}-dbg \ + ${PN}-dev \ + ${PN}-devd \ + ${PN}-doc \ + ${PN}-efi \ + ${PN}-flask \ + ${PN}-flask-tools \ + ${PN}-fsimage \ + ${PN}-gdbsx \ + ${PN}-hvmloader \ + ${PN}-hypervisor \ + ${PN}-init-xenstore-dom \ + ${PN}-kdd \ + ${PN}-libblktap \ + ${PN}-libblktapctl \ + ${PN}-libblktapctl-dev \ + ${PN}-libblktap-dev \ + ${PN}-libfsimage \ + ${PN}-libfsimage-dev \ + ${PN}-libvhd \ + ${PN}-libvhd-dev \ + ${PN}-libxencall \ + ${PN}-libxencall-dev \ + ${PN}-libxenctrl \ + ${PN}-libxenctrl-dev \ + ${PN}-libxendevicemodel \ + ${PN}-libxendevicemodel-dev \ + ${PN}-libxenevtchn \ + ${PN}-libxenevtchn-dev \ + ${PN}-libxenforeignmemory \ + ${PN}-libxenforeignmemory-dev \ + ${PN}-libxengnttab \ + ${PN}-libxengnttab-dev \ + ${PN}-libxenguest \ + ${PN}-libxenguest-dev \ + ${PN}-libxenlight \ + ${PN}-libxenlight-dev \ + ${PN}-libxenstat \ + ${PN}-libxenstat-dev \ + ${PN}-libxenstore \ + ${PN}-libxenstore-dev \ + ${PN}-libxentoolcore \ + ${PN}-libxentoolcore-dev \ + ${PN}-libxentoollog \ + ${PN}-libxentoollog-dev \ + ${PN}-libxenvchan \ + ${PN}-libxenvchan-dev \ + ${PN}-libxlutil \ + ${PN}-libxlutil-dev \ + ${PN}-livepatch \ + ${PN}-misc \ + ${PN}-pygrub \ + ${PN}-python \ + ${PN}-qemu \ + ${PN}-remus \ + ${PN}-scripts-block \ + ${PN}-scripts-common \ + ${PN}-scripts-network \ + ${PN}-shim \ + ${PN}-staticdev \ + ${PN}-volatiles \ + ${PN}-xcutils \ + ${PN}-xencommons \ + ${PN}-xend \ + ${PN}-xend-examples \ + ${PN}-xendomains \ + ${PN}-xenmon \ + ${PN}-xenpaging \ + ${PN}-xenpmd \ + ${PN}-xenstat \ + ${PN}-xenstore \ + ${PN}-xenstored \ + ${PN}-xentrace \ + ${PN}-xen-watchdog \ + ${PN}-xl \ + ${PN}-xl-examples \ + ${PN}-xm \ + ${PN}-xm-examples \ + " + +FILES_${PN}-dbg += "\ + ${libdir}/.debug \ + ${libdir}/debug/* \ + ${libdir}/xen/bin/.debug \ + ${libdir}/python2.7/site-packages/.debug \ + ${libdir}/python2.7/site-packages/xen/lowlevel/.debug \ + ${libdir}/fs/xfs/.debug \ + ${libdir}/fs/ufs/.debug \ + ${libdir}/fs/ext2fs-lib/.debug \ + ${libdir}/fs/fat/.debug \ + ${libdir}/fs/zfs/.debug \ + ${libdir}/fs/reiserfs/.debug \ + ${libdir}/fs/iso9660/.debug \ + ${libdir}/fs/*/.debug \ + ${sbindir}/.debug \ + ${libdir}exec/.debug \ + ${libdir}/xen/libexec/.debug \ + ${bindir}/.debug \ + ${libdir}/python2.7/dist-packages/.debug \ + ${libdir}/python2.7/dist-packages/xen/lowlevel/.debug \ + " + +FILES_${PN}-dev = "\ + ${includedir} \ + " + +FILES_${PN}-doc = "\ + ${sysconfdir}/xen/README \ + ${sysconfdir}/xen/README.incompatibilities \ + ${datadir}/doc \ + ${datadir}/man \ + " + +FILES_${PN}-staticdev += "\ + ${libdir}/libblktapctl.a \ + ${libdir}/libxenguest.a \ + ${libdir}/libxenlight.a \ + ${libdir}/libxenvchan.a \ + ${libdir}/libxenctrl.a \ + ${libdir}/libxlutil.a \ + ${libdir}/libvhd.a \ + ${libdir}/libxenstat.a \ + ${libdir}/libxenstore.a \ + ${libdir}/libblktap.a \ + " + +FILES_${PN}-libblktapctl = "${libdir}/libblktapctl.so.*" +FILES_${PN}-libblktapctl-dev = " \ + ${libdir}/libblktapctl.so \ + ${datadir}/pkgconfig/xenblktapctl.pc \ + " + +FILES_${PN}-libxencall = "${libdir}/libxencall.so.*" +FILES_${PN}-libxencall-dev = " \ + ${libdir}/libxencall.so \ + ${datadir}/pkgconfig/xencall.pc \ + " + +FILES_${PN}-libxenctrl = "${libdir}/libxenctrl.so.*" +FILES_${PN}-libxenctrl-dev = " \ + ${libdir}/libxenctrl.so \ + ${datadir}/pkgconfig/xencontrol.pc \ + " + +FILES_${PN}-libxendevicemodel = "${libdir}/libxendevicemodel.so.*" +FILES_${PN}-libxendevicemodel-dev = " \ + ${libdir}/libxendevicemodel.so \ + ${datadir}/pkgconfig/xendevicemodel.pc \ + " + +FILES_${PN}-libxenevtchn = "${libdir}/libxenevtchn.so.*" +FILES_${PN}-libxenevtchn-dev = " \ + ${libdir}/libxenevtchn.so \ + ${datadir}/pkgconfig/xenevtchn.pc \ + " + +FILES_${PN}-libxenforeignmemory = "${libdir}/libxenforeignmemory.so.*" +FILES_${PN}-libxenforeignmemory-dev = " \ + ${libdir}/libxenforeignmemory.so \ + ${datadir}/pkgconfig/xenforeignmemory.pc \ + " + +FILES_${PN}-libxengnttab = "${libdir}/libxengnttab.so.*" +FILES_${PN}-libxengnttab-dev = " \ + ${libdir}/libxengnttab.so \ + ${datadir}/pkgconfig/xengnttab.pc \ + " + +FILES_${PN}-libxenguest = "${libdir}/libxenguest.so.*" +FILES_${PN}-libxenguest-dev = " \ + ${libdir}/libxenguest.so \ + ${datadir}/pkgconfig/xenguest.pc \ + " + +FILES_${PN}-libxenlight = "${libdir}/libxenlight.so.*" +FILES_${PN}-libxenlight-dev = " \ + ${libdir}/libxenlight.so \ + ${datadir}/pkgconfig/xenlight.pc \ + " + +FILES_${PN}-libxenstat = "${libdir}/libxenstat.so.*" +FILES_${PN}-libxenstat-dev = " \ + ${libdir}/libxenstat.so \ + ${datadir}/pkgconfig/xenstat.pc \ + " + +FILES_${PN}-libxenstore = "${libdir}/libxenstore.so.*" +FILES_${PN}-libxenstore-dev = " \ + ${libdir}/libxenstore.so \ + ${datadir}/pkgconfig/xenstore.pc \ + " + +FILES_${PN}-libxentoolcore = "${libdir}/libxentoolcore.so.*" +FILES_${PN}-libxentoolcore-dev = " \ + ${libdir}/libxentoolcore.so \ + ${datadir}/pkgconfig/xentoolcore.pc \ + " + +FILES_${PN}-libxentoollog = "${libdir}/libxentoollog.so.*" +FILES_${PN}-libxentoollog-dev = " \ + ${libdir}/libxentoollog.so \ + ${datadir}/pkgconfig/xentoollog.pc \ + " + +FILES_${PN}-libxenvchan = "${libdir}/libxenvchan.so.*" +FILES_${PN}-libxenvchan-dev = " \ + ${libdir}/libxenvchan.so \ + ${datadir}/pkgconfig/xenvchan.pc \ + " + +FILES_${PN}-libxlutil = "${libdir}/libxlutil.so.*" +FILES_${PN}-libxlutil-dev = " \ + ${libdir}/libxlutil.so \ + ${datadir}/pkgconfig/xlutil.pc \ + " +FILES_${PN}-libvhd = "${libdir}/libvhd.so.*" +FILES_${PN}-libvhd-dev = " \ + ${libdir}/libvhd.so \ + ${datadir}/pkgconfig/vhd.pc \ + " + +FILES_${PN}-libblktap = "${libdir}/libblktap.so.*" +FILES_${PN}-libblktap-dev = " \ + ${libdir}/libblktap.so \ + ${datadir}/pkgconfig/blktap.pc \ + " + +FILES_${PN}-libfsimage = "${libdir}/libfsimage.so.*" +FILES_${PN}-libfsimage-dev = " \ + ${libdir}/libfsimage.so \ + ${datadir}/pkgconfig/fsimage.pc \ + " + +FILES_${PN}-fsimage = "${libdir}/fs/*/*fsimage.so" + +FILES_${PN}-hypervisor = "\ + /boot/xen-* \ + /boot/xen \ + /boot/xen-*.gz \ + /boot/xen.gz \ + /boot/xen-syms-* \ + " + +FILES_${PN}-init-xenstore-dom = "${libdir}/xen/bin/init-xenstore-domain" + +FILES_${PN}-efi = "\ + ${exec_prefix}/lib64/efi/xen* \ + " + +FILES_${PN}-base = "\ + ${sysconfdir}/xen/auto \ + ${sysconfdir}/xen/cpupool \ + ${localstatedir}/xen/dump \ + " + +FILES_${PN}-blktap = "\ + ${sbindir}/blktapctrl \ + ${sbindir}/img2qcow \ + ${sbindir}/lock-util \ + ${sbindir}/qcow2raw \ + ${sbindir}/qcow-create \ + ${sbindir}/tap-ctl \ + ${sbindir}/tapdisk \ + ${sbindir}/tapdisk2 \ + ${sbindir}/tapdisk-client \ + ${sbindir}/tapdisk-diff \ + ${sbindir}/tapdisk-stream \ + ${sbindir}/td-util \ + ${sbindir}/vhd-update \ + ${sbindir}/vhd-util \ + " + +FILES_${PN}-console = "\ + ${libdir}/xen/bin/xenconsole \ + ${sbindir}/xenconsoled \ + " + +FILES_${PN}-cpuid = "\ + ${bindir}/xen-cpuid \ + " + +FILES_${PN}-devd = "\ + ${sysconfdir}/init.d/xendriverdomain \ + ${systemd_unitdir}/system/xendriverdomain.service \ + " + +FILES_${PN}-flask = "\ + /boot/${FLASK_POLICY_FILE} \ + " + +FILES_${PN}-flask-tools = "\ + ${sbindir}/flask-get-bool \ + ${sbindir}/flask-getenforce \ + ${sbindir}/flask-label-pci \ + ${sbindir}/flask-loadpolicy \ + ${sbindir}/flask-set-bool \ + ${sbindir}/flask-setenforce \ + " + +FILES_${PN}-gdbsx = "\ + ${sbindir}/gdbsx \ + " + +INSANE_SKIP_${PN}-hvmloader = "arch" +FILES_${PN}-hvmloader = "\ + ${libdir}/xen/boot/hvmloader \ + " + +FILES_${PN}-kdd = "\ + ${sbindir}/kdd \ + " + +FILES_${PN}-livepatch += " \ + ${sbindir}/xen-livepatch \ + " + +FILES_${PN}-misc = "\ + ${bindir}/xencons \ + ${bindir}/xencov_split \ + ${bindir}/xen-detect \ + ${libdir}/xen/bin/xenpvnetboot \ + ${libdir}/xen/bin/depriv-fd-checker \ + ${sbindir}/gtracestat \ + ${sbindir}/gtraceview \ + ${sbindir}/xen-bugtool \ + ${sbindir}/xencov \ + ${sbindir}/xenperf \ + ${sbindir}/xenpm \ + ${sbindir}/xsview \ + ${sbindir}/xen-diag \ + ${sbindir}/xen-tmem-list-parse \ + ${sbindir}/xen-python-path \ + ${sbindir}/xen-ringwatch \ + ${sbindir}/xen-hptool \ + ${sbindir}/xen-hvmcrash \ + ${sbindir}/xen-hvmctx \ + ${sbindir}/xenlockprof \ + ${sbindir}/xen-lowmemd \ + ${sbindir}/xen-mfndump \ + ${libdir}/xen/bin/verify-stream-v2 \ + ${libdir}/xen/bin/convert-legacy-stream \ + " + +FILES_${PN}-pygrub = "\ + ${bindir}/pygrub \ + ${libdir}/xen/bin/pygrub \ + " + +FILES_${PN}-python = "\ + ${libdir}/python2.7 \ + " + +INSANE_SKIP_${PN} = "already-stripped" +INSANE_SKIP_${PN}-qemu = "arch" +FILES_${PN}-qemu = " \ + ${datadir}/xen/qemu \ + ${libdir}/xen/bin/qemu-system-i386 \ + ${libdir}/xen/bin/qemu-system-x86_64 \ + ${libdir}/xen/bin/qemu-img \ + ${libdir}/xen/bin/qemu-nbd \ + ${libdir}/xen/bin/qemu-ga \ + ${libdir}/xen/bin/qemu-io \ + ${libdir}/xen/bin/qemu-dm \ + ${libdir}/xen/bin/virtfs-proxy-helper \ + /usr/libexec/qemu-bridge-helper \ + ${libdir}/xen/libexec/qemu-bridge-helper \ + /usr/etc/qemu \ + /usr/etc/qemu/target-x86_64.conf \ + ${libdir}/xen/etc/qemu/target-x86_64.conf \ + ${datadir}/qemu-xen \ + ${datadir}/qemu-xen/qemu \ + ${datadir}/qemu-xen/qemu/bamboo.dtb \ + ${datadir}/qemu-xen/qemu/pxe-pcnet.rom \ + ${datadir}/qemu-xen/qemu/vgabios-vmware.bin \ + ${datadir}/qemu-xen/qemu/pxe-eepro100.rom \ + ${datadir}/qemu-xen/qemu/pxe-e1000.rom \ + ${datadir}/qemu-xen/qemu/openbios-ppc \ + ${datadir}/qemu-xen/qemu/multiboot.bin \ + ${datadir}/qemu-xen/qemu/vgabios-cirrus.bin \ + ${datadir}/qemu-xen/qemu/bios.bin \ + ${datadir}/qemu-xen/qemu/vgabios-stdvga.bin \ + ${datadir}/qemu-xen/qemu/palcode-clipper \ + ${datadir}/qemu-xen/qemu/pxe-ne2k_pci.rom \ + ${datadir}/qemu-xen/qemu/spapr-rtas.bin \ + ${datadir}/qemu-xen/qemu/slof.bin \ + ${datadir}/qemu-xen/qemu/vgabios-qxl.bin \ + ${datadir}/qemu-xen/qemu/pxe-rtl8139.rom \ + ${datadir}/qemu-xen/qemu/openbios-sparc64 \ + ${datadir}/qemu-xen/qemu/pxe-virtio.rom \ + ${datadir}/qemu-xen/qemu/kvmvapic.bin \ + ${datadir}/qemu-xen/qemu/openbios-sparc32 \ + ${datadir}/qemu-xen/qemu/petalogix-s3adsp1800.dtb \ + ${datadir}/qemu-xen/qemu/sgabios.bin \ + ${datadir}/qemu-xen/qemu/linuxboot.bin \ + ${datadir}/qemu-xen/qemu/qemu-icon.bmp \ + ${datadir}/qemu-xen/qemu/ppc_rom.bin \ + ${datadir}/qemu-xen/qemu/vgabios.bin \ + ${datadir}/qemu-xen/qemu/s390-zipl.rom \ + ${datadir}/qemu-xen/qemu/petalogix-ml605.dtb \ + ${datadir}/qemu-xen/qemu/keymaps \ + ${datadir}/qemu-xen/qemu/keymaps/common \ + ${datadir}/qemu-xen/qemu/keymaps/th \ + ${datadir}/qemu-xen/qemu/keymaps/is \ + ${datadir}/qemu-xen/qemu/keymaps/en-gb \ + ${datadir}/qemu-xen/qemu/keymaps/ar \ + ${datadir}/qemu-xen/qemu/keymaps/fr-be \ + ${datadir}/qemu-xen/qemu/keymaps/ru \ + ${datadir}/qemu-xen/qemu/keymaps/hu \ + ${datadir}/qemu-xen/qemu/keymaps/de-ch \ + ${datadir}/qemu-xen/qemu/keymaps/no \ + ${datadir}/qemu-xen/qemu/keymaps/fr \ + ${datadir}/qemu-xen/qemu/keymaps/pl \ + ${datadir}/qemu-xen/qemu/keymaps/fr-ca \ + ${datadir}/qemu-xen/qemu/keymaps/de \ + ${datadir}/qemu-xen/qemu/keymaps/fr-ch \ + ${datadir}/qemu-xen/qemu/keymaps/bepo \ + ${datadir}/qemu-xen/qemu/keymaps/lv \ + ${datadir}/qemu-xen/qemu/keymaps/ja \ + ${datadir}/qemu-xen/qemu/keymaps/da \ + ${datadir}/qemu-xen/qemu/keymaps/lt \ + ${datadir}/qemu-xen/qemu/keymaps/hr \ + ${datadir}/qemu-xen/qemu/keymaps/es \ + ${datadir}/qemu-xen/qemu/keymaps/modifiers \ + ${datadir}/qemu-xen/qemu/keymaps/sl \ + ${datadir}/qemu-xen/qemu/keymaps/it \ + ${datadir}/qemu-xen/qemu/keymaps/nl \ + ${datadir}/qemu-xen/qemu/keymaps/fo \ + ${datadir}/qemu-xen/qemu/keymaps/mk \ + ${datadir}/qemu-xen/qemu/keymaps/pt-br \ + ${datadir}/qemu-xen/qemu/keymaps/tr \ + ${datadir}/qemu-xen/qemu/keymaps/sv \ + ${datadir}/qemu-xen/qemu/keymaps/fi \ + ${datadir}/qemu-xen/qemu/keymaps/en-us \ + ${datadir}/qemu-xen/qemu/keymaps/et \ + ${datadir}/qemu-xen/qemu/keymaps/nl-be \ + ${datadir}/qemu-xen/qemu/keymaps/pt \ + ${bindir}/qemu-nbd-xen \ + ${bindir}/qemu-img-xen \ + " + +FILES_${PN}-remus = "\ + ${bindir}/remus \ + ${sysconfdir}/xen/scripts/remus-netbuf-setup \ + " + +FILES_${PN}-scripts-network = " \ + ${sysconfdir}/xen/scripts/colo-proxy-setup \ + ${sysconfdir}/xen/scripts/network-bridge \ + ${sysconfdir}/xen/scripts/network-nat \ + ${sysconfdir}/xen/scripts/network-route \ + ${sysconfdir}/xen/scripts/qemu-ifup \ + ${sysconfdir}/xen/scripts/vif2 \ + ${sysconfdir}/xen/scripts/vif-bridge \ + ${sysconfdir}/xen/scripts/vif-common.sh \ + ${sysconfdir}/xen/scripts/vif-nat \ + ${sysconfdir}/xen/scripts/vif-openvswitch \ + ${sysconfdir}/xen/scripts/vif-route \ + ${sysconfdir}/xen/scripts/vif-setup \ + " + +FILES_${PN}-scripts-block = " \ + ${sysconfdir}/xen/scripts/blktap \ + ${sysconfdir}/xen/scripts/block \ + ${sysconfdir}/xen/scripts/block-common.sh \ + ${sysconfdir}/xen/scripts/block-dummy \ + ${sysconfdir}/xen/scripts/block-enbd \ + ${sysconfdir}/xen/scripts/block-iscsi \ + ${sysconfdir}/xen/scripts/block-nbd \ + ${sysconfdir}/xen/scripts/block-drbd-probe \ + ${sysconfdir}/xen/scripts/block-tap \ + ${sysconfdir}/xen/scripts/vscsi \ + " + +FILES_${PN}-scripts-common = " \ + ${sysconfdir}/xen/scripts/external-device-migrate \ + ${sysconfdir}/xen/scripts/hotplugpath.sh \ + ${sysconfdir}/xen/scripts/locking.sh \ + ${sysconfdir}/xen/scripts/logging.sh \ + ${sysconfdir}/xen/scripts/xen-hotplug-cleanup \ + ${sysconfdir}/xen/scripts/xen-hotplug-common.sh \ + ${sysconfdir}/xen/scripts/xen-network-common.sh \ + ${sysconfdir}/xen/scripts/xen-script-common.sh \ + " + +INSANE_SKIP_${PN}-shim = "arch" +FILES_${PN}-shim = " \ + ${libdir}/xen/boot/xen-shim \ + " + +FILES_${PN}-volatiles = "\ + ${sysconfdir}/default/volatiles/99_xen \ + ${sysconfdir}/tmpfiles.d/xen.conf \ + " + +FILES_${PN}-xcutils = "\ + ${libdir}/xen/bin/lsevtchn \ + ${libdir}/xen/bin/readnotes \ + ${libdir}/xen/bin/xc_restore \ + ${libdir}/xen/bin/xc_save \ + " + +FILES_${PN}-xend-examples = "\ + ${sysconfdir}/xen/xend-config.sxp \ + ${sysconfdir}/xen/xend-pci-permissive.sxp \ + ${sysconfdir}/xen/xend-pci-quirks.sxp \ + " + +FILES_${PN}-xenpaging = "\ + ${libdir}/xen/bin/xenpaging \ + ${localstatedir}/lib/xen/xenpaging \ + " + +FILES_${PN}-xenpmd = "\ + ${sbindir}/xenpmd \ + " + +FILES_${PN}-xenstat = "\ + ${sbindir}/xentop \ + " + +FILES_${PN}-xenstore = "\ + ${bindir}/xenstore \ + ${bindir}/xenstore-chmod \ + ${bindir}/xenstore-control \ + ${bindir}/xenstore-exists \ + ${bindir}/xenstore-list \ + ${bindir}/xenstore-ls \ + ${bindir}/xenstore-read \ + ${bindir}/xenstore-rm \ + ${bindir}/xenstore-watch \ + ${bindir}/xenstore-write \ + " + +FILES_${PN}-xenstored = "\ + ${sbindir}/xenstored \ + ${localstatedir}/lib/xenstored \ + " + +FILES_${PN}-xentrace = "\ + ${bindir}/xentrace \ + ${bindir}/xentrace_format \ + ${bindir}/xentrace_setsize \ + ${libdir}/xen/bin/xenctx \ + ${bindir}/xenalyze \ + ${sbindir}/xentrace \ + ${sbindir}/xentrace_setsize \ + " + +FILES_${PN}-xen-watchdog = "\ + ${sbindir}/xenwatchdogd \ + ${sysconfdir}/init.d/xen-watchdog \ + ${systemd_unitdir}/system/xen-watchdog.service \ + " + +FILES_${PN}-xl = "\ + ${sysconfdir}/bash_completion.d/xl.sh \ + ${sysconfdir}/xen/xl.conf \ + ${libdir}/xen/bin/libxl-save-helper \ + ${sbindir}/xl \ + ${libdir}/xen/bin/xen-init-dom0 \ + " + +FILES_${PN}-xl-examples = "\ + ${sysconfdir}/xen/xlexample.hvm \ + ${sysconfdir}/xen/xlexample.pvlinux \ + " + +FILES_${PN}-xm-examples = "\ + ${sysconfdir}/xen/xmexample1 \ + ${sysconfdir}/xen/xmexample2 \ + ${sysconfdir}/xen/xmexample3 \ + ${sysconfdir}/xen/xmexample.hvm \ + ${sysconfdir}/xen/xmexample.hvm-stubdom \ + ${sysconfdir}/xen/xmexample.nbd \ + ${sysconfdir}/xen/xmexample.pv-grub \ + ${sysconfdir}/xen/xmexample.vti \ + " + +FILES_${PN}-xenmon = "\ + ${sbindir}/xenbaked \ + ${sbindir}/xentrace_setmask \ + ${sbindir}/xenmon.py \ + " + +FILES_${PN}-xm = "\ + ${sysconfdir}/xen/xm-config.xml \ + ${datadir}/xen/create.dtd \ + ${sbindir}/xm \ + " + +FILES_${PN}-xencommons += "\ + ${sysconfdir}/default/xencommons \ + ${sysconfdir}/init.d/xencommons \ + ${sysconfdir}/xen/scripts/launch-xenstore \ + ${systemd_unitdir}/modules-load.d/xen.conf \ + ${systemd_unitdir}/system/proc-xen.mount \ + ${systemd_unitdir}/system/xen-qemu-dom0-disk-backend.service \ + ${systemd_unitdir}/system/xenconsoled.service \ + ${systemd_unitdir}/system/xen-init-dom0.service \ + ${systemd_unitdir}/system/xenstored.service \ + ${systemd_unitdir}/system/var-lib-xenstored.mount \ + " + +FILES_${PN}-xend += " \ + ${sysconfdir}/init.d/xend \ + ${sbindir}/xend \ + " + +FILES_${PN}-xendomains += "\ + ${libdir}/xen/bin/xendomains \ + ${sysconfdir}/default/xendomains \ + ${sysconfdir}/init.d/xendomains \ + ${sysconfdir}/sysconfig/xendomains \ + ${systemd_unitdir}/system/xendomains.service \ + " + +# configure init.d scripts +INITSCRIPT_PACKAGES = "${PN}-xend ${PN}-xencommons ${PN}-xen-watchdog ${PN}-xendomains ${PN}-devd" +INITSCRIPT_NAME_${PN}-xencommons = "xencommons" +INITSCRIPT_PARAMS_${PN}-xencommons = "defaults 80" +INITSCRIPT_NAME_${PN}-xen-watchdog = "xen-watchdog" +INITSCRIPT_PARAMS_${PN}-xen-watchdog = "defaults 81" +INITSCRIPT_NAME_${PN}-xend = "xend" +INITSCRIPT_PARAMS_${PN}-xend = "defaults 82" +INITSCRIPT_NAME_${PN}-xendomains = "xendomains" +INITSCRIPT_PARAMS_${PN}-xendomains = "defaults 83" +INITSCRIPT_NAME_${PN}-devd = "xendriverdomain" +INITSCRIPT_PARAMS_${PN}-devd = "defaults 82" + +# systemd packages +SYSTEMD_PACKAGES = "${PN}-xen-watchdog ${PN}-xencommons ${PN}-xendomains ${PN}-devd" +SYSTEMD_SERVICE_${PN}-devd = "xendriverdomain.service" +SYSTEMD_SERVICE_${PN}-xen-watchdog = "xen-watchdog.service" +SYSTEMD_SERVICE_${PN}-xencommons = " \ + proc-xen.mount \ + var-lib-xenstored.mount \ + xen-qemu-dom0-disk-backend.service \ + xenconsoled.service \ + xen-init-dom0.service \ + xenstored.service \ + " +SYSTEMD_SERVICE_${PN}-xendomains = "xendomains.service" + +#### REQUIRED ENVIRONMENT VARIABLES #### +export BUILD_SYS +export HOST_SYS +export STAGING_INCDIR +export STAGING_LIBDIR + +# specify xen hypervisor to build/target +export XEN_TARGET_ARCH = "${@map_xen_arch(d.getVar('TARGET_ARCH'), d)}" +export XEN_COMPILE_ARCH = "${@map_xen_arch(d.getVar('BUILD_ARCH'), d)}" + +python () { + if d.getVar('XEN_TARGET_ARCH') == 'INVALID': + raise bb.parse.SkipPackage('Cannot map `%s` to a xen architecture' % d.getVar('TARGET_ARCH')) +} + +# Yocto appends ${PN} to libexecdir by default and Xen appends 'xen' as well +# the result is a nested xen/xen/ so let's avoid that by shunning Yocto's +# extra ${PN} appended. +libexecdir = "${libdir}" + +# hardcoded as Linux, as the only compatible hosts are Linux. +export XEN_OS = "Linux" + +# this is used for the header (#!${bindir}/python) of the install python scripts +export PYTHONPATH="${bindir}/python" +export ac_cv_path_PYTHONPATH="${bindir}/python" +export DISTUTILS_BUILD_ARGS +export DISTUTILS_INSTALL_ARGS + +# xen and seabios require HOSTCC and HOSTCXX set to cross-compile +export HOSTCC="${BUILD_CC}" +export HOSTCXX="${BUILD_CXX}" + +# make xen requires CROSS_COMPILE set by hand as it does not abide by ./configure +export CROSS_COMPILE="${TARGET_PREFIX}" + +# overide LDFLAGS to allow xen to build without: "x86_64-oe-linux-ld: unrecognized option '-Wl,-O1'" +export LDFLAGS="" + +# Yocto injects -mfpmath=sse for some machine types into the CFLAGS which +# conflicts with -mno-sse so instead we strip -mfpmath=sse instead of +# patching the build to be ok with this +TUNE_CCARGS := "${@oe.utils.str_filter_out('-mfpmath=sse', '${TUNE_CCARGS}', d)}" +TUNE_CCARGS := "${@oe.utils.str_filter_out('-msse4.2', '${TUNE_CCARGS}', d)}" + +# Supply the full set of compiler flags via the tool variables +# Yocto supplys _FORTIFY_SOURCE via CC/CPP/CXX but optimization -O via C*FLAGS +CC_append = " ${CFLAGS}" +CPP_append = " ${CPPFLAGS}" +CXX_append = " ${CXXFLAGS}" + +EXTRA_OECONF += " \ + --exec-prefix=${prefix} \ + --prefix=${prefix} \ + --host=${HOST_SYS} \ + --with-systemd=${systemd_unitdir}/system \ + --with-systemd-modules-load=${systemd_unitdir}/modules-load.d \ + --disable-stubdom \ + --disable-ioemu-stubdom \ + --disable-pv-grub \ + --disable-xenstore-stubdom \ + --disable-rombios \ + --disable-ocamltools \ + --with-initddir=${INIT_D_DIR} \ + --with-sysconfig-leaf-dir=default \ + --with-system-qemu=/usr/bin/qemu-system-i386 \ + --disable-qemu-traditional \ + " + +EXTRA_OEMAKE += "STDVGA_ROM=${STAGING_DIR_HOST}/usr/share/firmware/vgabios-0.7a.bin" +EXTRA_OEMAKE += "CIRRUSVGA_ROM=${STAGING_DIR_HOST}/usr/share/firmware/vgabios-0.7a.cirrus.bin" +EXTRA_OEMAKE += "SEABIOS_ROM=${STAGING_DIR_HOST}/usr/share/firmware/bios.bin" +EXTRA_OEMAKE += "ETHERBOOT_ROMS=${STAGING_DIR_HOST}/usr/share/firmware/rtl8139.rom" + +# prevent the Xen build scripts from fetching things during the build +# all dependencies should be reflected in the Yocto recipe +EXTRA_OEMAKE += "WGET=/bin/false" +EXTRA_OEMAKE += "GIT=/bin/false" + +# Improve build reproducibility: provide values for build variables. +def get_build_time_vars(d): + source_date_epoch = d.getVar('SOURCE_DATE_EPOCH') + if source_date_epoch is not None: + import datetime + utc_datetime = datetime.datetime.utcfromtimestamp(float(source_date_epoch)) + return " XEN_BUILD_DATE=" + utc_datetime.strftime("%Y-%m-%d") + \ + " XEN_BUILD_TIME=" + utc_datetime.strftime("%H:%M:%S") + return "" +EXTRA_OEMAKE += "${@['', 'XEN_WHOAMI=${PF} XEN_DOMAIN=${DISTRO} XEN_BUILD_HOST=${PN}-buildhost'] \ + [d.getVar('BUILD_REPRODUCIBLE_BINARIES') == '1']}${@get_build_time_vars(d)}" + +# Improve build reproducibility: compiler flags to remove filesystem differences. +# Suppress __FILE__ via an alternative builtin. +CC += "${@['', '-gno-record-gcc-switches -Wno-builtin-macro-redefined -D__FILE__=__VERSION__ ' + \ + '-fdebug-prefix-map=${WORKDIR}=${PN}'] \ + [d.getVar('BUILD_REPRODUCIBLE_BINARIES') == '1']}" + +# check for XSM in package config to allow XSM_ENABLE to be set +python () { + pkgconfig = d.getVar('PACKAGECONFIG') + if ('xsm') in pkgconfig.split(): + d.setVar('XSM_ENABLED', '1') + else: + d.setVar('XSM_ENABLED', '0') +} + +do_post_patch() { + # fixup AS/CC/CCP/etc variable within StdGNU.mk + for i in LD CC CPP CXX; do + sed -i "s/^\($i\s\s*\).*=/\1?=/" ${S}/config/StdGNU.mk + done + # fixup environment passing in some makefiles + sed -i 's#\(\w*\)=\(\$.\w*.\)#\1="\2"#' ${S}/tools/firmware/Makefile + + # libsystemd-daemon -> libsystemd for newer systemd versions + sed -i 's#libsystemd-daemon#libsystemd#' ${S}/tools/configure + + # Improve build reproducibility: disable insertion of the build timestamp + # into the x86 EFI hypervisor binary. + # binutils should allow a user-supplied timestamp or use SOURCE_DATE_EPOCH + # for PE but currently does not. + if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ] ; then + sed '/^EFI_LDFLAGS = /{a EFI_LDFLAGS += --no-insert-timestamp +}' -i "${S}/xen/arch/x86/Makefile" + fi +} + +do_post_patch_append_arm() { + # The hypervisor binary must not be built with the hard floating point ABI. + echo "CC := \$(filter-out ${TUNE_CCARGS},\$(CC))" >> ${B}/xen/arch/arm/Rules.mk +} + +addtask post_patch after do_patch before do_configure + +do_stubs() { + # no stubs-32.h in our 64-bit sysroot - hack it into tools/include/gnu + if ! test -f ${STAGING_DIR_TARGET}/usr/include/gnu/stubs-32.h ; then + if test -f ${STAGING_DIR_TARGET}/usr/include/gnu/stubs-64.h ; then + test -d ${S}/tools/include/gnu || mkdir ${S}/tools/include/gnu + cat ${STAGING_DIR_TARGET}/usr/include/gnu/stubs-64.h | grep -v stub_bdflush | grep -v stub_getmsg | grep -v stub_putmsg > ${S}/tools/include/gnu/stubs-32.h + echo \#define __stub___kernel_cosl >> ${S}/tools/include/gnu/stubs-32.h + echo \#define __stub___kernel_sinl >> ${S}/tools/include/gnu/stubs-32.h + echo \#define __stub___kernel_tanl >> ${S}/tools/include/gnu/stubs-32.h + fi + fi +} + +addtask stubs after do_configure before do_compile + +# Allow all hypervisor settings in a defconfig +EXTRA_OEMAKE += "XEN_CONFIG_EXPERT=y" +# Build release versions always. Technically since we track release +# tarballs this always happens but occasionally people pull in patches +# from staging that reverts this +EXTRA_OEMAKE += "debug=n" + +do_configure() { + + #./configure --enable-xsmpolicy does not set XSM_ENABLE must be done manually + if [ "${XSM_ENABLED}" = "1" ]; then + echo "XSM_ENABLE := y" > ${S}/.config + fi + + if [ -f "${WORKDIR}/defconfig" ]; then + cp "${WORKDIR}/defconfig" "${B}/xen/.config" || \ + bbfatal "Unable to copy defconfig to .config" + fi + + # do configure + oe_runconf + if [ ! -e ${STAGING_INCDIR}/bits/long-double-32.h ]; then + cp ${STAGING_INCDIR}/bits/long-double-64.h ${STAGING_INCDIR}/bits/long-double-32.h + fi +} + +do_compile() { + # workaround for build bug when CFLAGS is exported + # https://www.mail-archive.com/xen-devel@lists.xen.org/msg67822.html + unset CFLAGS + + # Workaround for parallel build bug: build xen first. + # https://lists.xenproject.org/archives/html/xen-devel/2018-07/msg02551.html + oe_runmake xen + oe_runmake +} + +do_install() { + # CFLAGS is used to set PY_CFLAGS which affects the pygrub install + # so also need to unset CFLAGS here: + unset CFLAGS + oe_runmake DESTDIR="${D}" install + + # remove installed volatiles + rm -rf ${D}${localstatedir}/run \ + ${D}${localstatedir}/lock \ + ${D}${localstatedir}/log \ + ${D}${localstatedir}/volatile \ + ${D}${localstatedir}/lib/xen + + VOLATILE_DIRS=" \ + ${localstatedir}/run/xenstored \ + ${localstatedir}/run/xend \ + ${localstatedir}/run/xend/boot \ + ${localstatedir}/run/xen \ + ${localstatedir}/log/xen \ + ${localstatedir}/lock/xen \ + ${localstatedir}/lock/subsys \ + ${localstatedir}/lib/xen \ + " + + # install volatiles using populate_volatiles mechanism + install -d ${D}${sysconfdir}/default/volatiles + for i in $VOLATILE_DIRS; do + echo "d root root 0755 $i none" >> ${D}${sysconfdir}/default/volatiles/99_xen + done + + # workaround for xendomains script which searchs sysconfig if directory exists + install -d ${D}${sysconfdir}/sysconfig + ln -sf ${sysconfdir}/default/xendomains ${D}${sysconfdir}/sysconfig/xendomains + + # systemd + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + # install volatiles using systemd tmpfiles.d + install -d ${D}${sysconfdir}/tmpfiles.d + for i in $VOLATILE_DIRS; do + echo "d $i 0755 root root - -" >> ${D}${sysconfdir}/tmpfiles.d/xen.conf + done + fi + + # fixup default path to qemu-system-i386 + sed -i 's#\(test -z "$QEMU_XEN" && QEMU_XEN=\).*$#\1"/usr/bin/qemu-system-i386"#' ${D}/etc/init.d/xencommons + + if [ -e ${D}${systemd_unitdir}/system/xen-qemu-dom0-disk-backend.service ]; then + sed -i 's#ExecStart=.*qemu-system-i386\(.*\)$#ExecStart=/usr/bin/qemu-system-i386\1#' \ + ${D}${systemd_unitdir}/system/xen-qemu-dom0-disk-backend.service + fi +} + +pkg_postinst_${PN}-volatiles() { + if [ -z "$D" ]; then + if command -v systemd-tmpfiles >/dev/null; then + systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/xen.conf + elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then + ${sysconfdir}/init.d/populate-volatile.sh update + fi + fi +} + +do_deploy() { + install -d ${DEPLOYDIR} + + if [ -f ${D}/boot/xen ]; then + install -m 0644 ${D}/boot/xen ${DEPLOYDIR}/xen-${MACHINE} + fi + + if [ -f ${D}/boot/xen.gz ]; then + install -m 0644 ${D}/boot/xen.gz ${DEPLOYDIR}/xen-${MACHINE}.gz + fi + + if [ -f ${D}/usr/lib64/efi/xen.efi ]; then + install -m 0644 ${D}/usr/lib64/efi/xen.efi ${DEPLOYDIR}/xen-${MACHINE}.efi + fi + + # Install the flask policy in the deploy directory if it exists + if [ -f ${D}/boot/${FLASK_POLICY_FILE} ]; then + install -m 0644 ${D}/boot/${FLASK_POLICY_FILE} ${DEPLOYDIR} + ln -sf ${FLASK_POLICY_FILE} ${DEPLOYDIR}/xenpolicy-${MACHINE} + fi +} + +addtask deploy after do_populate_sysroot + +# Enable use of menuconfig directly from bitbake and also within the devshell +OE_TERMINAL_EXPORTS += "HOST_EXTRACFLAGS HOSTLDFLAGS TERMINFO" +HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}" +HOSTLDFLAGS = "${BUILD_LDFLAGS}" +TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo" +do_devshell[depends] += "ncurses-native:do_populate_sysroot" + +KCONFIG_CONFIG_COMMAND ??= "menuconfig" +python do_menuconfig() { + import shutil + + try: + mtime = os.path.getmtime("xen/.config") + shutil.copy("xen/.config", "xen/.config.orig") + except OSError: + mtime = 0 + + oe_terminal("${SHELL} -c \"cd xen; XEN_CONFIG_EXPERT=y make %s; if [ \$? -ne 0 ]; then echo 'Command failed.'; printf 'Press any key to continue... '; read r; fi\"" % d.getVar('KCONFIG_CONFIG_COMMAND'), + d.getVar('PN') + ' Configuration', d) + + try: + newmtime = os.path.getmtime("xen/.config") + except OSError: + newmtime = 0 + + if newmtime > mtime: + bb.note("Configuration changed, recompile will be forced") + bb.build.write_taint('do_compile', d) +} +do_menuconfig[depends] += "ncurses-native:do_populate_sysroot" +do_menuconfig[nostamp] = "1" +do_menuconfig[dirs] = "${B}" +addtask menuconfig after do_configure diff --git a/external/meta-virtualization/recipes-extended/xen/xen_4.11.0.bb b/external/meta-virtualization/recipes-extended/xen/xen_4.11.0.bb new file mode 100644 index 00000000..870caa72 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/xen_4.11.0.bb @@ -0,0 +1,16 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" +require xen.inc + +SRC_URI = " \ + https://downloads.xenproject.org/release/xen/${PV}/xen-${PV}.tar.gz \ + file://tools-xentop-vwprintw.patch \ + file://xen-4.11-arm-acpi-fix-string-lengths.patch \ + file://xen-tools-xenpmd-snprintf.patch \ + file://xen-disable-sse-before-inlines.patch \ + file://0001-python-pygrub-pass-DISTUTILS-env-vars-as-setup.py-ar.patch \ + " + +SRC_URI[md5sum] = "cbec0600284921744bc14119f4ed3fff" +SRC_URI[sha256sum] = "826e3a9f6d0eac94a825d272cc2c1294e22640ae75af906eb13920f9ad667643" + +S = "${WORKDIR}/xen-${PV}" diff --git a/external/meta-virtualization/recipes-extended/xen/xen_git.bb b/external/meta-virtualization/recipes-extended/xen/xen_git.bb new file mode 100644 index 00000000..0ebd81ce --- /dev/null +++ b/external/meta-virtualization/recipes-extended/xen/xen_git.bb @@ -0,0 +1,19 @@ +require xen.inc + +SRCREV ?= "2b50cdbc444c637575580dcfa6c9525a84d5cc62" + +XEN_REL = "4.12" +XEN_BRANCH = "staging" +FLASK_POLICY_FILE = "xenpolicy-${XEN_REL}-unstable" + +PV = "${XEN_REL}+git${SRCPV}" + +S = "${WORKDIR}/git" + +SRC_URI = " \ + git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ + file://xen-disable-sse-before-inlines.patch \ + file://0001-python-pygrub-pass-DISTUTILS-env-vars-as-setup.py-ar.patch \ + " + +DEFAULT_PREFERENCE = "-1" |