From 08220028e52992dcba667fc97bf3afe8be1949fb Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Wed, 8 Jan 2020 13:48:07 -0600 Subject: runqemu: Add network bridge support Qemu supports attaching the virtual machine to an existing network bridge interface via the qemu-bridge-helper program (as long as the system is correctly configured to give the user permissions). Add support for runqemu to do this also via the "bridge=" argument. Note that for this to work correctly, the host qemu-bridge-helper must be used, not the one that might have been built by qemu-native. In order for qemu to correctly find this program, a qemu-oe-bridge-helper program has been added to qemu-helper-native, and runqemu will use this helper as the bridge helper. The helper will look for the host qemu-bridge-helper first by looking in the QEMU_BRIDGE_HELPER environment variable, then by search common paths where the helper is installed. (From OE-Core rev: 9e7b38c61c6b84b7f137c733ac5da9414025693d) Signed-off-by: Joshua Watt Signed-off-by: Richard Purdie --- .../qemu/qemu-helper-native_1.0.bb | 7 +++++- .../qemu/qemu-helper/qemu-oe-bridge-helper | 25 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100755 meta/recipes-devtools/qemu/qemu-helper/qemu-oe-bridge-helper (limited to 'meta/recipes-devtools/qemu') diff --git a/meta/recipes-devtools/qemu/qemu-helper-native_1.0.bb b/meta/recipes-devtools/qemu/qemu-helper-native_1.0.bb index 372eebd886..2fc07669dd 100644 --- a/meta/recipes-devtools/qemu/qemu-helper-native_1.0.bb +++ b/meta/recipes-devtools/qemu/qemu-helper-native_1.0.bb @@ -5,7 +5,10 @@ PR = "r1" LIC_FILES_CHKSUM = "file://${WORKDIR}/tunctl.c;endline=4;md5=ff3a09996bc5fff6bc5d4e0b4c28f999" -SRC_URI = "file://tunctl.c" +SRC_URI = "\ + file://tunctl.c \ + file://qemu-oe-bridge-helper \ + " S = "${WORKDIR}" @@ -18,6 +21,8 @@ do_compile() { do_install() { install -d ${D}${bindir} install tunctl ${D}${bindir}/ + + install -m 755 ${WORKDIR}/qemu-oe-bridge-helper ${D}${bindir}/ } DEPENDS += "qemu-system-native" diff --git a/meta/recipes-devtools/qemu/qemu-helper/qemu-oe-bridge-helper b/meta/recipes-devtools/qemu/qemu-helper/qemu-oe-bridge-helper new file mode 100755 index 0000000000..f057d4eef0 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu-helper/qemu-oe-bridge-helper @@ -0,0 +1,25 @@ +#! /bin/sh +# Copyright 2020 Garmin Ltd. or its subsidiaries +# +# SPDX-License-Identifier: GPL-2.0 +# +# Attempts to find and exec the host qemu-bridge-helper program + +# If the QEMU_BRIDGE_HELPER variable is set by the user, exec it. +if [ -n "$QEMU_BRIDGE_HELPER" ]; then + exec "$QEMU_BRIDGE_HELPER" "$@" +fi + +# Search common paths for the helper program +BN="qemu-bridge-helper" +PATHS="/usr/libexec/ /usr/lib/qemu/" + +for p in $PATHS; do + if [ -e "$p/$BN" ]; then + exec "$p/$BN" "$@" + fi +done + +echo "$BN not found!" > /dev/stderr +exit 1 + -- cgit v1.2.3-54-g00ecf