From: Jan Kiszka <[email protected]>

Pull the ivshmem-demo code from current Jailhouse, build it for the
targets and install it in the initramfs images. This allows to test
ivshmem in non-root Linux cells.

This recipe change is avoiding a direct dependency on the Jailhouse
package for obtaining the source file so that changes to the latter do
not start to trigger the lengthy non-root-initramfs build. There aren't
many changes to the demo application in Jailhouse expected, so this
should be fine.

Signed-off-by: Jan Kiszka <[email protected]>
---
 recipes-core/non-root-initramfs/files/amd64-config              | 2 +-
 recipes-core/non-root-initramfs/files/arm64-config              | 2 +-
 recipes-core/non-root-initramfs/files/armhf-config              | 2 +-
 recipes-core/non-root-initramfs/files/build-ivshmem-demo.sh     | 8 ++++++++
 recipes-core/non-root-initramfs/non-root-initramfs_2019.02.2.bb | 5 +++++
 5 files changed, 16 insertions(+), 3 deletions(-)
 create mode 100755 recipes-core/non-root-initramfs/files/build-ivshmem-demo.sh

diff --git a/recipes-core/non-root-initramfs/files/amd64-config 
b/recipes-core/non-root-initramfs/files/amd64-config
index ccf4537..4a96858 100644
--- a/recipes-core/non-root-initramfs/files/amd64-config
+++ b/recipes-core/non-root-initramfs/files/amd64-config
@@ -360,7 +360,7 @@ BR2_SYSTEM_DEFAULT_PATH="/bin:/sbin:/usr/bin:/usr/sbin"
 # BR2_TARGET_TZ_INFO is not set
 BR2_ROOTFS_USERS_TABLES=""
 BR2_ROOTFS_OVERLAY="$(TOPDIR)/../overlay"
-BR2_ROOTFS_POST_BUILD_SCRIPT=""
+BR2_ROOTFS_POST_BUILD_SCRIPT="$(TOPDIR)/../build-ivshmem-demo.sh"
 BR2_ROOTFS_POST_FAKEROOT_SCRIPT=""
 BR2_ROOTFS_POST_IMAGE_SCRIPT=""
 
diff --git a/recipes-core/non-root-initramfs/files/arm64-config 
b/recipes-core/non-root-initramfs/files/arm64-config
index 087d10d..fe9e1a2 100644
--- a/recipes-core/non-root-initramfs/files/arm64-config
+++ b/recipes-core/non-root-initramfs/files/arm64-config
@@ -390,7 +390,7 @@ BR2_SYSTEM_DEFAULT_PATH="/bin:/sbin:/usr/bin:/usr/sbin"
 # BR2_TARGET_TZ_INFO is not set
 BR2_ROOTFS_USERS_TABLES=""
 BR2_ROOTFS_OVERLAY="$(TOPDIR)/../overlay"
-BR2_ROOTFS_POST_BUILD_SCRIPT=""
+BR2_ROOTFS_POST_BUILD_SCRIPT="$(TOPDIR)/../build-ivshmem-demo.sh"
 BR2_ROOTFS_POST_FAKEROOT_SCRIPT=""
 BR2_ROOTFS_POST_IMAGE_SCRIPT=""
 
diff --git a/recipes-core/non-root-initramfs/files/armhf-config 
b/recipes-core/non-root-initramfs/files/armhf-config
index 9a422c8..d5cd5bf 100644
--- a/recipes-core/non-root-initramfs/files/armhf-config
+++ b/recipes-core/non-root-initramfs/files/armhf-config
@@ -422,7 +422,7 @@ BR2_SYSTEM_DEFAULT_PATH="/bin:/sbin:/usr/bin:/usr/sbin"
 # BR2_TARGET_TZ_INFO is not set
 BR2_ROOTFS_USERS_TABLES=""
 BR2_ROOTFS_OVERLAY="$(TOPDIR)/../overlay"
-BR2_ROOTFS_POST_BUILD_SCRIPT=""
+BR2_ROOTFS_POST_BUILD_SCRIPT="$(TOPDIR)/../build-ivshmem-demo.sh"
 BR2_ROOTFS_POST_FAKEROOT_SCRIPT=""
 BR2_ROOTFS_POST_IMAGE_SCRIPT=""
 
diff --git a/recipes-core/non-root-initramfs/files/build-ivshmem-demo.sh 
b/recipes-core/non-root-initramfs/files/build-ivshmem-demo.sh
new file mode 100755
index 0000000..7a248dc
--- /dev/null
+++ b/recipes-core/non-root-initramfs/files/build-ivshmem-demo.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+eval $(grep ^BR2_ARCH= ${BR2_CONFIG})
+if [ ${BR2_ARCH} = arm ]; then
+    ABI="gnueabihf"
+fi
+
+${BR2_ARCH}-buildroot-linux-uclibc${ABI}-gcc -o $1/usr/bin/ivshmem-demo 
../ivshmem-demo.c
diff --git a/recipes-core/non-root-initramfs/non-root-initramfs_2019.02.2.bb 
b/recipes-core/non-root-initramfs/non-root-initramfs_2019.02.2.bb
index 1e642ee..17d866f 100644
--- a/recipes-core/non-root-initramfs/non-root-initramfs_2019.02.2.bb
+++ b/recipes-core/non-root-initramfs/non-root-initramfs_2019.02.2.bb
@@ -15,11 +15,16 @@ DESCRIPTION = "Linux initramfs for Jailhouse non-root cells"
 
 SRC_URI = " \
     https://buildroot.org/downloads/buildroot-${PV}.tar.bz2 \
+    
https://raw.githubusercontent.com/siemens/jailhouse/${SRC_REV_IVSHMEM_DEMO}/tools/ivshmem-demo.c;name=ivshmem-demo
 \
     file://debian/ \
     file://${DISTRO_ARCH}-config \
+    file://build-ivshmem-demo.sh \
     file://overlay/"
 SRC_URI[sha256sum] = 
"0250b4e11d4aeba7cb5ac956b56e3069d3136c1e7fd741a658b0ea96c6b35181"
 
+SRC_REV_IVSHMEM_DEMO = "87cc49f944ed756e930b70991726ca5595a30717"
+SRC_URI[ivshmem-demo.sha256sum] = 
"e7cc426bb009c3c7d99c042ae45760494d8454647fbb042359655ea37ad1dcfc"
+
 S = "${WORKDIR}/buildroot-${PV}"
 
 do_prepare_build() {
-- 
2.16.4

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/48f89d618757250dce33fade9d37237b93648272.1579170887.git.jan.kiszka%40siemens.com.

Reply via email to