From patchwork Fri Feb 27 02:24:20 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chen, Qi" X-Patchwork-Id: 82043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02E5BFD9E2D for ; Fri, 27 Feb 2026 02:24:28 +0000 (UTC) Received: from mx0b-0064b401.pphosted.com (mx0b-0064b401.pphosted.com [205.220.178.238]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.86670.1772159064368415447 for ; Thu, 26 Feb 2026 18:24:27 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@windriver.com header.s=PPS06212021 header.b=bUeRuGUo; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.178.238, mailfrom: prvs=6518253275=qi.chen@windriver.com) Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61R2NJCb3669190 for ; Fri, 27 Feb 2026 02:24:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=PPS06212021; bh=da+y2ZKmcF4DiqT6IN9w O2F4ZZqArx3K7ypjiYqG3zQ=; b=bUeRuGUoyTdx5qniCrhw++r42415hAo1l4TM LXKUG1JlN8NGMOzWT06PehtEz2i/8GelwWNIq2yAb3Q6LWiIm0NgL0n/PUE2oGBm diDOXQLJ8t1ngV5BIdlcA+6U04UO34ILUYJjeJPHcnz1PIDLnFctYskWWZosWIQC uZFqI+eV0+9ZLL5eFQohIzKmkVm9ACUu933PmaDGVgSn3jb2MzFmQWRUeWUM0lCM RVxf2FyTm8B+Y7lhsDNvULcb0kUaNax8FovA61YwcdrfJx/OUjOKF1uVzERrIIgx f9l+0UXCHPtgU+te9a/30EfkhvErsLdinanG52BcwOM/IIb29Q== Received: from ala-exchng02.corp.ad.wrs.com (ala-exchng02.wrs.com [128.224.246.37]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 4cjdvdsceu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 27 Feb 2026 02:24:23 +0000 (GMT) Received: from ala-exchng01.corp.ad.wrs.com (10.11.224.121) by ALA-EXCHNG02.corp.ad.wrs.com (10.11.224.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.61; Thu, 26 Feb 2026 18:24:21 -0800 Received: from oak-lpgbuild14.wrs.com (10.66.9.59) by ala-exchng01.corp.ad.wrs.com (10.11.232.121) with Microsoft SMTP Server id 15.1.2507.61 via Frontend Transport; Thu, 26 Feb 2026 18:24:21 -0800 From: To: Subject: [OE-core][PATCH V3 1/2] runqemu: restore support to run inside SDK Date: Fri, 27 Feb 2026 02:24:20 +0000 Message-ID: <20260227022421.4072802-1-Qi.Chen@windriver.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjI3MDAxOCBTYWx0ZWRfX3l/9RCHBLanB Qa2FBxjOwHHRRm0+FcxUyRRCS/HJhWULsIM3oTRYatBMLPVqLd4tV18lSHC7nkIQF0E7rcZPpeX NGODgZNqYKd/L1KgSSxkkvTMB2JbhTDBVOf90hgjvl8e3kiSwP5mwDREnG3v4raCUmfIprrW5wg yVOLNtUl6vo3PavVgnnjB/ye2i56KWCHaI519suIYM5LQeHGbXO5KaTYmDbtauJJos4cxGb8bMT BvtVTfy9S5jROkKNORrzh7l/zbTmvCuzPcf4jdaz6hW6/mFmf6geT4GnnMof+nohQ6L/WMmR1Rq iOmYaH8TMzbaa9BIX53dCr1edOOOMeSUl8zW7je80iGv8fMNTMb7b0PZ8vO+axZe2gOU0/Sz8ji Z+MspfbfHn8ggUWH3xsARBreiw2EbUCXd2KPWLye0Z+58W7Pfa5kirRPBGiQR/w00VN4eAe80g+ wRgL3W7+9erogZxn/KA== X-Proofpoint-GUID: Ys1PkbYRa4NsMIuFLgFLqwJovhLdMYM8 X-Authority-Analysis: v=2.4 cv=UKzQ3Sfy c=1 sm=1 tr=0 ts=69a10057 cx=c_pps a=Lg6ja3A245NiLSnFpY5YKQ==:117 a=Lg6ja3A245NiLSnFpY5YKQ==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=bi6dqmuHe4P4UrxVR6um:22 a=fTW__CHxibyLmBMfj2wP:22 a=Q4-j1AaZAAAA:8 a=t7CeM3EgAAAA:8 a=2V6DY6BgAAAA:8 a=0mkdOpYzm_CPxjOHJy0A:9 a=9H3Qd4_ONW2Ztcrla5EB:22 a=FdTzh2GWekK77mhwV6Dw:22 a=ldqKKs2zR4t-S6fqr-1n:22 X-Proofpoint-ORIG-GUID: Ys1PkbYRa4NsMIuFLgFLqwJovhLdMYM8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-26_04,2026-02-26_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 priorityscore=1501 suspectscore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 clxscore=1015 bulkscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602270018 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 27 Feb 2026 02:24:28 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/232073 From: Chen Qi Using runqemu from SDK has been supported for a long time[1]. Below are example steps for using runqemu inside SDK. 1. mkdir destdir 2. cp -r /path/to/build/tmp/deploy/image/qemux86-64 destdir 3. Install SDK to destdir 4. Source SDK 5. runqemu qemux86-64 nographic slirp Recently the related code path was deleted by accident during an effort to make codes cleaner and more consistent. We need to restore support for it. What actually matters is the STAGING_BINDIR_NATIVE, which we use to locate the qemu binary. So in case of SDK, we set it from OECORE_NATIVE_SYSROOT. The STAGING_DIR_NATIVE checking and setting are meaningless, thus deleting it. [1] https://git.openembedded.org/openembedded-core/commit/?id=93649edc034f2540ff55dc9b41638797209cfb9c Signed-off-by: Chen Qi --- scripts/runqemu | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/runqemu b/scripts/runqemu index 32a3d6296a..5587d47865 100755 --- a/scripts/runqemu +++ b/scripts/runqemu @@ -997,17 +997,21 @@ to your build configuration. logger.info('Setting DEPLOY_DIR_IMAGE to folder containing %s (%s)' % (self.qemuboot, imgdir)) self.set('DEPLOY_DIR_IMAGE', imgdir) - # If the STAGING_*_NATIVE directories from the config file don't exist + oecore_native_sysroot = self.get('OECORE_NATIVE_SYSROOT') + if oecore_native_sysroot: + logger.info('In SDK environment, setting STAGING_BINDIR_NATIVE from OECORE_NATIVE_SYSROOT (%s)' % oecore_native_sysroot) + self.set('STAGING_BINDIR_NATIVE', '%s/usr/bin' % oecore_native_sysroot) + + # If the STAGING_BINDIR_NATIVE directories from the config file don't exist # and we're in a sourced OE build directory try to extract the paths # from `bitbake -e` - havenative = os.path.exists(self.get('STAGING_DIR_NATIVE')) and \ - os.path.exists(self.get('STAGING_BINDIR_NATIVE')) + havenative = os.path.exists(os.path.exists(self.get('STAGING_BINDIR_NATIVE'))) if not havenative: if not self.bitbake_e: self.load_bitbake_env() - native_vars = ['STAGING_DIR_NATIVE'] + native_vars = ['STAGING_BINDIR_NATIVE'] for nv in native_vars: s = re.search('^%s="(.*)"' % nv, self.bitbake_e, re.M) if s and s.group(1) != self.get(nv): From patchwork Fri Feb 27 02:24:21 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chen, Qi" X-Patchwork-Id: 82044 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 042ACFD9E31 for ; Fri, 27 Feb 2026 02:24:28 +0000 (UTC) Received: from mx0b-0064b401.pphosted.com (mx0b-0064b401.pphosted.com [205.220.178.238]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.86671.1772159064887101980 for ; Thu, 26 Feb 2026 18:24:27 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@windriver.com header.s=PPS06212021 header.b=ZJcVowqg; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.178.238, mailfrom: prvs=6518253275=qi.chen@windriver.com) Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61R2NJCc3669190 for ; Fri, 27 Feb 2026 02:24:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=PPS06212021; bh=xKsEy3QyW2p/2vJKk0WSRLT26E4JG7KY+DxS2n2A9LI=; b=ZJcVowqgtLaE xKCrVMBfoasxu6J7YEobzLjdn2aQrHIUKzuVikM885p6j0K8jWKJb81cTRSvozAw 5xc3DOUP5/Wn8MLdI038jSssGZ0EEe7Onbtt4jR47rzDSkOloWfS5gSsHdXnAf7K GEzXvSYArUPVYNeVtcmbF66GsntnTar5vuDdlsP4Wuwh4djIxx1z8O08LptEByDx /WJhdHN53IMAXGqjQKRP4fZJm8BeTy2FsItjxZkG1Sj9LH/jxelu47U+zisjWT74 74frJEjjn91DjOtvTMclzEHGSD8W6jT2UO2QGA6dCFeNMGgusYdgUuFqt7L+JVkd yymMv9tusA== Received: from ala-exchng02.corp.ad.wrs.com (ala-exchng02.wrs.com [128.224.246.37]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 4cjdvdsceu-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 27 Feb 2026 02:24:23 +0000 (GMT) Received: from ala-exchng01.corp.ad.wrs.com (10.11.224.121) by ALA-EXCHNG02.corp.ad.wrs.com (10.11.224.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.61; Thu, 26 Feb 2026 18:24:21 -0800 Received: from oak-lpgbuild14.wrs.com (10.66.9.59) by ala-exchng01.corp.ad.wrs.com (10.11.232.121) with Microsoft SMTP Server id 15.1.2507.61 via Frontend Transport; Thu, 26 Feb 2026 18:24:21 -0800 From: To: Subject: [OE-core][PATCH V3 2/2] oeqa/selftest/sdk: add test_sdk_runqemu Date: Fri, 27 Feb 2026 02:24:21 +0000 Message-ID: <20260227022421.4072802-2-Qi.Chen@windriver.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260227022421.4072802-1-Qi.Chen@windriver.com> References: <20260227022421.4072802-1-Qi.Chen@windriver.com> MIME-Version: 1.0 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjI3MDAxOCBTYWx0ZWRfXxDvyskaSgeAs uD/AXcKS8OYyLM3XA8YJwymeUl1xSdAGgsh/zBV77xG9REDYRmG1eZL8VJjOWioia34vZ/5Ju4R HQ7WtLyZnJwqEzBTtL+PnxIVxDYJCDaapW21eVhn9751AkmyiX8w3v46Tce6i5e08C3RlxkBXjI AHJcJxPkSe7i+1ulgVVjcX3Y8qNnlAE9bmOvMKevVGL7yfKllkVmt1WnLi342ZAzoy/A67NfwSs dlPFI+ePjpTEw/ct1lZc0cqX2bpy1H018CwkHAqhBQhNXdPmVYoeFta24CQiMigcIFwIqcD5NhA TB2YeT+oXEiEC5YmfHxhkU/MdZSxRsxvtfQYJOKLDgQ5phBXEJ89PgUEiDPDU9cdmQrmm78zrNq dt+Lfbx35yO0IPi+FJ2HxPAI3I4egiVffxzj5c96PbG/MdhPyU+fAZKC8OScwvVuU4wGHm4EgnR 4QIw19CpVc9IlFgZnxQ== X-Proofpoint-GUID: 5D94nMTnNw4BKcNJEkHGwDj_IeAYtRmv X-Authority-Analysis: v=2.4 cv=UKzQ3Sfy c=1 sm=1 tr=0 ts=69a10057 cx=c_pps a=Lg6ja3A245NiLSnFpY5YKQ==:117 a=Lg6ja3A245NiLSnFpY5YKQ==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=bi6dqmuHe4P4UrxVR6um:22 a=fTW__CHxibyLmBMfj2wP:22 a=t7CeM3EgAAAA:8 a=2V6DY6BgAAAA:8 a=QklhIAnghPIZTLOfvdoA:9 a=FdTzh2GWekK77mhwV6Dw:22 a=ldqKKs2zR4t-S6fqr-1n:22 X-Proofpoint-ORIG-GUID: 5D94nMTnNw4BKcNJEkHGwDj_IeAYtRmv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-26_04,2026-02-26_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 priorityscore=1501 suspectscore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 clxscore=1015 bulkscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602270018 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 27 Feb 2026 02:24:28 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/232074 From: Chen Qi Add test case to ensure runqemu works in SDK. Using runqemu from SDK has been supported for many years. Add a test case to ensure we have no regression. Signed-off-by: Chen Qi --- meta/lib/oeqa/selftest/cases/sdk.py | 88 ++++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 1 deletion(-) diff --git a/meta/lib/oeqa/selftest/cases/sdk.py b/meta/lib/oeqa/selftest/cases/sdk.py index 3971365029..ee1e4ca420 100644 --- a/meta/lib/oeqa/selftest/cases/sdk.py +++ b/meta/lib/oeqa/selftest/cases/sdk.py @@ -4,7 +4,13 @@ # SPDX-License-Identifier: MIT # -import os.path +import os +import shutil +import subprocess +import glob +import time +import select +from tempfile import TemporaryDirectory from oeqa.selftest.case import OESelftestTestCase from oeqa.utils.commands import bitbake, get_bb_vars @@ -37,3 +43,83 @@ IMAGE_INSTALL:append = " selftest-hello" path = os.path.join(vars["SDK_DEPLOY"], vars["TOOLCHAIN_OUTPUTNAME"] + ".target.manifest") self.assertNotEqual(os.path.getsize(path), 0, msg="Target manifest is empty") self.assertIn("selftest-hello", self.load_manifest(path)) + + def test_sdk_runqemu(self): + """Test using runqemu from SDK which has no bitbake available""" + + def path_with_no_bitbake(): + orig_paths = os.environ["PATH"].split(":") + new_paths = [] + for orig_path in orig_paths: + if not os.access(os.path.join(orig_path, "bitbake"), os.X_OK): + new_paths.append(orig_path) + return ":".join(new_paths) + + def runqemu_works_from_sdk(sdk_dir, sdk_env, machine, path, timeout=360): + env = os.environ.copy() + env["PATH"] = path + + cmd = f'cd {sdk_dir}; . {sdk_env}; runqemu {machine} snapshot slirp nographic' + self.logger.info(f"Running {cmd}") + proc = subprocess.Popen( + ['bash', '-c', cmd], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + text=True, + bufsize=1, + env=env + ) + buffer = "" + start = time.time() + while time.time() - start < timeout: + if proc.poll() is not None: + chunk = proc.stdout.read() + if chunk: + buffer += chunk + return ('Linux version' in buffer, "\n".join(buffer.split('\n')[-10:])) + ready, _, _ = select.select([proc.stdout], [], [], 0.1) + if ready: + chunk = proc.stdout.read(4096) + if chunk: + buffer += chunk + if "Linux version" in buffer: + proc.terminate() + return (True, "\n".join(buffer.split('\n')[-10:])) + time.sleep(0.1) + proc.terminate() + time.sleep(5) + if proc.poll() is None: + proc.kill() + return (False, "\n".join(buffer.split('\n')[-10:])) + + image = "core-image-minimal" + + self.write_config('QEMU_USE_KVM = "1"') + + # generate image and SDK + bitbake(f"{image}") + bitbake(f"{image} -c populate_sdk") + + # create a temporary destdir to test runqemu from SDK + with TemporaryDirectory() as tmpdir: + self.logger.debug(f"Created tempdir: {tmpdir}") + vars = get_bb_vars(["DEPLOY_DIR_IMAGE", "SDK_DEPLOY", "TOOLCHAIN_OUTPUTNAME", "MACHINE"], image) + machine = vars["MACHINE"] + image_dir = vars["DEPLOY_DIR_IMAGE"] + sdk_path = os.path.join(vars["SDK_DEPLOY"], vars["TOOLCHAIN_OUTPUTNAME"] + ".sh") + self.logger.debug(f"machine: {machine}") + self.logger.debug(f"image_dir: {image_dir}") + self.logger.debug(f"sdk_path: {sdk_path}") + dst_image_dir = os.path.join(tmpdir, os.path.basename(image_dir)) + shutil.copytree(image_dir, dst_image_dir) + subprocess.check_call(f"{sdk_path} -d {tmpdir} -y", shell=True) + sdk_env = glob.glob(tmpdir + '/environment-setup-*')[0] + self.logger.debug(f"sdk_env: {sdk_env}") + + path = path_with_no_bitbake() + self.logger.debug(f"path: {path}") + + runqemu_works, output = runqemu_works_from_sdk(tmpdir, sdk_env, machine, path) + self.logger.debug(f"runqemu works in SDK: {runqemu_works}\n{output}") + + self.assertTrue(runqemu_works, f"runqemu does not work in SDK\n{output}")