From patchwork Mon Nov 23 14:02:19 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clara Kowalsky X-Patchwork-Id: 5638 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Mon, 23 Nov 2026 15:03:08 +0100 X-Sieve: CMU Sieve 2.4 Received: from mail-qt1-f189.google.com (mail-qt1-f189.google.com [209.85.160.189]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 6ANE36BV007190 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 23 Nov 2026 15:03:06 +0100 Received: by mail-qt1-f189.google.com with SMTP id d75a77b69052e-5363763b556sf67346831cf.3 for ; Mon, 23 Nov 2026 06:03:06 -0800 (PST) ARC-Seal: i=3; a=rsa-sha256; t=1795442581; cv=pass; d=google.com; s=arc-20260327; b=kdY+1NFzOFiqFd2rPkZMc+CAELjBQy7PVDb3EUSuHai+MqWSunzu5sOMlI0txttLty Dq/Uiw0oSr8SooWO0eBGUF0gp6nXfjbHvEmt4Dz5KNSLURPBN8wrkmeF8VvVnzNgW8pR Q1sSTNgC5jWUNY/421XoYFNdr3ZWG4ND4UiYhrM5S8I1gNjuE6XhzWDU5eVdzV7ppehX 0V5G/AflD0vvXib5tAG6SwyFovQZVvxSdyznVJsgC9RxFplFeMrLgiEh7X9jx+NUpvr8 XJ7GBJC3/PaLEQlt9mUMVnlmft8zDPUwNVCPwd3woJbznAWZyv78N6i3AHpSGLXqWAhM Jedw== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=QeVBqp+Dyb8OA1cXF8dF8sKm86zOn00BdmiZYYYBBO4=; fh=r6PxNEK229HNOrDSB02m7Rqdl67srSCvKdyznAwU/50=; b=ITO+iQncbJ4tCcw13JudOxCVDqTEEM5LWgyQv1AHdpBNsHqALLmYbN83CuSImMRkTT 6wgFtD+wIFqEoOzLxdC6TigoS6PnKYEvlM7Uk1ry/O3IU9ErWeDCCx0zdlUkGNoTktvL xLuW05FjC18ffrF6SVSJmkz3+RuSVfdsawmnB4tERg64iRnFmEiv7gi55hFOxsjgxc+v byXUV9sZNeVYrOh99eUNLJYB7MFev7zOEno5ZR0IXbdpNeMx8XplvaKT3KsJkFGwsxK4 wBE8DzIHCeUbzewfCsLKyWqN54iGfq9qFnAzT7NElRqmQDBJqEfZlbZUv/B0Yg7dZjBz EZvg==; darn=isar-build.org ARC-Authentication-Results: i=3; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=OScfTJ5P; arc=pass (i=1 spf=pass spfdomain=siemens.com dkim=pass dkdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of clara.kowalsky@siemens.com designates 2a01:111:f403:c20a::7 as permitted sender) smtp.mailfrom=clara.kowalsky@siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20260707; t=1795442580; x=1796047380; darn=isar-build.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:mime-version :content-type:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=QeVBqp+Dyb8OA1cXF8dF8sKm86zOn00BdmiZYYYBBO4=; b=FMftUa2IjWl1vks/bY11LDqgt0hVVmkWrf2/BzZHxZ2ZYZxe00et8CWD5tx3EAUCuf ybmIOq5bltnl1Glq8CqTfCLnx7eYFB9qmdRhENzHBPcvEIiFG/PkBdFDl57x0XV6Xf9w BiEAXCEsMnDvvcmBdzPTmLQgm1mBZ9DzV1aD0oAnn/dSQCLXAazeb0UGE0r+NOoPt7gx QnI8eD0fr58RT/c0A17G3EfH3kkWvtt3Wa/+3jiud5qSJXHJoCtlknvH9Wqz+V2vp+6u jjpt4wcOH36x6/XjIf55qGVhb3ZwiQwJ28PuLuyLrmutMUEXC2ILMnW1nJ+63NjOKJJ2 mIJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795442580; x=1796047380; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:mime-version :content-type:references:in-reply-to:message-id:date:subject:cc:to :from:x-beenthere:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=QeVBqp+Dyb8OA1cXF8dF8sKm86zOn00BdmiZYYYBBO4=; b=n8EY6WEIZqTjWeeRJIE10sRRjuAwq8psN/yj+rfsu+jYCJw3FWie2imHw5yzIpSWQH 5r/lzBIKcjxpbYGvhkMSQW48cHpqzlI4brZe2jCz3SpIKklkLsa1q2kNiN/QoG1Pk15D L6fWZPSgMH+AGglUO4dNAD5AhZpjtDQkFU7ZefACe5gzVtEdGPNL5wzWNCp2IimrtCEV 0o+TCFRgrrFvo5KtiU/NRdTalRzC2fMiUDYqkAxhYS4/oYzKSSRpyrA0aMOiIUf/ygRT y0mgYbIfjN8iAuEOTPYlbSA4q0c/Moo4M1I3J3gTKFSW9jncJuugwOjT0HSqivEViKT1 tZFQ== X-Forwarded-Encrypted: i=3; AL+hErHmfZfk5Ogn6YFnpTFSbP5BCtozt9OI8gwZukr/PzwxnU/RbRUavwIswRg+dbNIW+c7vdOGbJ4=@isar-build.org X-Gm-Message-State: APuU4Z+DAQJ59HJH8UvdPjoL0zX0p9eDNRfCH8/CjSlTZoRaP9K1grPC 7qgUE9+M1ZjBjxIocGYzCkY5yo8r4zr6ZYBMsuaE7fr0l/xU74ZsAtmI X-Received: by 2002:a05:622a:487:b0:536:64ee:73cc with SMTP id d75a77b69052e-55d76a62980mr219858731cf.39.1795442580556; Mon, 23 Nov 2026 06:03:00 -0800 (PST) X-BeenThere: isar-users@googlegroups.com; h="ATskLdemRZj+46SmmnOoczZx19/gOP1DJJLtdTRMIwUvITfr8g==" Received: by 2002:a05:622a:1032:b0:55d:39dc:2b89 with SMTP id d75a77b69052e-55d78cef633ls74418401cf.2.-pod-prod-07-us; Mon, 23 Nov 2026 06:02:58 -0800 (PST) X-Received: by 2002:ac8:5fc6:0:b0:54f:b317:f6fd with SMTP id d75a77b69052e-55d76a25effmr199883331cf.13.1795442578067; Mon, 23 Nov 2026 06:02:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1795442578; cv=pass; d=google.com; s=arc-20260327; b=l0QDYg0jAuigkLK4xcQzmtvrHGvs/CMD79OgycWPsm+paSK8N9T14NocxLyhdBUFNP 2Yb+ld4HBBkBy2pJCOukYs6fc2KPKElAYvapQbrvTVyb+DseFTcmFo5GHL8NcC9t4IqY b77luqI9Lu2EXIJmmZhg/+9BnBilvYl/0Ti4kzjZmUMltqGPVoCSWYQv8xFGldAXxgCr YvLPXsuxyO9KDRFYCZXnYR1NA3z2jb9Ktw46R4jE8KZBZzrO14xr5soNbjILs9iQ1FGd ulDKthGu/WOtMwNiqlNBgDTtQu9m1ZBePz9UVguXKmcsLlJXIHpdgBPJY6NFQljADxU5 i9Uw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=mime-version:content-transfer-encoding:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=EmTaVWCczAxu8piZoTetVpY4zT5ndzgbLIKpaynhhfs=; fh=gPnyYwFwya925hIKsufnyacyuqnFsKXzQMHP3i58878=; b=BxigJmuvGiGAp2qcuobyKBENNqXXb4Kjs3dMWnzlm+X7WhAwMKPRapMik97Mmg/wMM MNMCo/MWzfUJpZuUGugIu6RPShRQQ68Mann3edIgJLofvdfrq0C+WgcWdO016ki9Mxnn S/DjE/ONkZQySsKygOb9vUlTckXG7OTeZzYXKgPzuG+VtMDkImOsNETjB6e2Ynvfbv6K 5MJUdUwlBPeIKdN4Bz1rz9gQA7nXw1xHRUEdlLt3Pf7FK7ABhBxpqAw0dvqKKtnrcRu+ Kr1ccnYrxAIpvW3aJX4tA4W6YZI4jkBAaBMOKmqMwA/SeMA2MsPeiLMP4CvBFNNl0CTl 2MPA==; dara=google.com ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=OScfTJ5P; arc=pass (i=1 spf=pass spfdomain=siemens.com dkim=pass dkdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of clara.kowalsky@siemens.com designates 2a01:111:f403:c20a::7 as permitted sender) smtp.mailfrom=clara.kowalsky@siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from PA4PR04CU001.outbound.protection.outlook.com (mail-francecentralazlp170130007.outbound.protection.outlook.com. [2a01:111:f403:c20a::7]) by gmr-mx.google.com with ESMTPS id d75a77b69052e-55d7885e4e0si2001311cf.13.2026.11.23.06.02.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Nov 2026 06:02:58 -0800 (PST) Received-SPF: pass (google.com: domain of clara.kowalsky@siemens.com designates 2a01:111:f403:c20a::7 as permitted sender) client-ip=2a01:111:f403:c20a::7; ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eyQdovNl7+8RPui/Ao9nz/6ES3/uu2XpVGEEY3OB0JtqUemfDnvlHpH9nDRTTnwd4ud/jQBZGUcV4OHgYRYZ+S++XGf7GwwifRumpgbnJ5nXb/3U+1vOykiWHPdDGqX4hRYQntKkSs3A9Wr7nhqLS3BTaF8aUe+FJbUr/gXGwOfjjRqyZWhBOy4wIFxtt8Be3k8f3Sib9mpd97e54fCUR1FFizIXsYxQsmOOKQE2gSlf6XI13OJROyPO+ptDm0QiL7fiQx2y/APZOl/S6rI+jSWoBnfOMMFucyAcqGIbHJpn8dJTvKipHClNavfEvKRJCQPdaeiObJH28+16usmQbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EmTaVWCczAxu8piZoTetVpY4zT5ndzgbLIKpaynhhfs=; b=hQiAJ+BPI2Wb6X5urKOfDIQK0AyDSgHaUYvVuuSV9J5zrEoWyUUiZvWhbV35aZHdD1Yy2LW+XthHRoC5cLyoQlCjw1Zpq67ehjty5uAGBlK/OykY+p8TU0OSLZ0k9VGX4fpaSdJCPO/tDSH3GbS0dD6mmUXSxEDGZmynCuqyOiWQ0+upi3DGNiy330jQ+FllE6C3DA+/O0STsUA+2xC+SDDleN2IjEBiRd0O4Su1RT37E/E8LzXb93KVsDnNk659y9ezdyFsoPmS8nk2pStQM2b39mRNFW3R/bcH3htYAdlndZmNHk5EsyMkU3HEt9lrHwUzuCDESI06S5qhQph7zg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=siemens.com; dmarc=pass action=none header.from=siemens.com; dkim=pass header.d=siemens.com; arc=none Received: from AM0PR10MB9645.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:740::12) by GV1PR10MB5940.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:150:5c::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.3; Mon, 23 Nov 2026 14:02:53 +0000 Received: from AM0PR10MB9645.EURPRD10.PROD.OUTLOOK.COM ([fe80::527e:14a7:bd3e:86be]) by AM0PR10MB9645.EURPRD10.PROD.OUTLOOK.COM ([fe80::527e:14a7:bd3e:86be%6]) with mapi id 15.21.0662.001; Mon, 23 Nov 2026 14:02:53 +0000 X-Patchwork-Original-From: "'Clara Kowalsky' via isar-users" From: Clara Kowalsky To: isar-users@googlegroups.com Cc: Clara Kowalsky , Felix Moessbauer Subject: [PATCH v3 3/7] wic: run the Python driver outside the imaging chroot Date: Mon, 23 Nov 2026 15:02:19 +0100 Message-ID: <20261123140223.1707025-4-clara.kowalsky@siemens.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261123140223.1707025-1-clara.kowalsky@siemens.com> References: <20261123140223.1707025-1-clara.kowalsky@siemens.com> X-ClientProxiedBy: FR0P281CA0119.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a8::17) To AM0PR10MB9645.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:740::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR10MB9645:EE_|GV1PR10MB5940:EE_ X-MS-Office365-Filtering-Correlation-Id: 91d6e0b1-6d64-4e1b-f7e5-08df496a76d4 X-MS-Exchange-AtpMessageProperties: SA X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016|23010399003|6133799003|55112099003|261009223027099003|18002099003|22082099003|3023799007|261022115727099003|261022105027099003|261022075727099003|261022113327099003|261026140227099003|261026130827099003|261026121527099003|261028144727099003|261021123027099003|261021121427099003|261021135927099003|261021130227099003|261102123227099003|261102130727099003|56012099006|10067099003|11063799006|5023799004; X-Microsoft-Antispam-Message-Info: 23MelOk9GxKWnpLzQECUqK+3i+NSsiHDFrbkRisZ9lytzDQfT8WfhV+00N8qYZH5D0jrHHHQyQ/MUcbSutQbJt0jxfTsnPReq1k9WlIyE6oV8a7VMaw98o25emd0CoLlT8NCEiyLMjKW+0i1DOWWv7JYtuFsZhM5Cnmeabh8vJQa5udQlyTB/cJ1n7kbQKqxxGR6o4ShGbvW7CzHKAAIQZZ6gkhDsK3NXWQ6Ze1i+dc0EvX6RgnNQDqiE75r4xdWHYkyTpaEuJKmMcaYcwbnDR1Mq9ejR8fRP8DsG3zqc9fxyCLM8GG3NXcjVrP3VFjIk0xwC4/nBzqeohRAi7uf5xPf1kKEKdObncVIkKpiIuv6+C19BRiw63BM5/0s2Xvix7TGCixOtHiAoeJ+25LAL3CVbWWqcM1/mprkyDiDi9ofDxHI2XGU5AA8StM1XBh+oYPaQYaQKRv9+G9WnLeixHrV4UnSIsvP0Cz+m7kBBV/tLLIQd/jOfE4TSwFIo5FS3vZ/31PEvfcX5TZ5wBOxQA29R2z2TrOu1laSKRfAkyG2L10kxkt+rGCAeufj2ytiPKEltoFxIfAYRW88rjGQsrXtzhuMvj2V0GjP/iDl8gr/2H/oaiFbxFQ5neAKwxY1oRa/N8z6rESQy84iYS97Nm75EMoqpL3/xcIWQh/O62w= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR10MB9645.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016)(23010399003)(6133799003)(55112099003)(261009223027099003)(18002099003)(22082099003)(3023799007)(261022115727099003)(261022105027099003)(261022075727099003)(261022113327099003)(261026140227099003)(261026130827099003)(261026121527099003)(261028144727099003)(261021123027099003)(261021121427099003)(261021135927099003)(261021130227099003)(261102123227099003)(261102130727099003)(56012099006)(10067099003)(11063799006)(5023799004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yDBmD+Ygy3DcLvvvvKAR8+llMRMBF3pUeTY1HQd2/VpT+hqdcgv34ZGjTbff6nFFstRESOlKr8EeemgMzeOtK+ZlwbjdHPLfNxkDusuSKst8uOfvF19I+PTBj215xsKtnVXhLIyRG5RnPwu7xovDieDFVVxn6cw357UruDhOi0445y9Q4vt2sn7xYCz5XQeo0p/f9zBST2AMHFOZwPw8HCWV6X+x8G9S4LD+q1laqBhXC3q39d0bz0H3QkLUTyyq6P3nfELj+OhHenzu0Gi8mPwCu9UXE6+qpVSgkaV6MfVlehx6dHWRaKy+DW7aRMwMdANjNixbRTBa+x/VD8TcRExUIyGRNwsRIPIZvK4FyRxcjLav7HYK+lbt9FeczZ4f+/8BCXOpYrRYesa7D5+NRpy3f14mpIU1EH072a2W1alB6uNgaclLdKasq4BJKUQ9v+BBoIwaFjdfOK3HwAK5Mt6LL0gUjt7LtI1ztDnuPngeHl3Qz6ERdbcJrvx+/O4Y9Kf069yp3kc6ygR/+GAEupeA8N+/QHQiXuKRepVCm6fE3ud5uDefWhS7Ps2Ms89iSRnrhJ2BylRrKchkSyLT6MI1g2ZiErsiimPaH8/mn2Jzjo2U4FIKtzqJw0uNXSGpMBf7utHxbhchToPIx2PicpqwBhuW6L93wc3Xh3yiAB8psLu62Zh25GgcC5zmPC7KTMtZsKBf/XdsYd2ESOJSZqQWHfNwXsfle8/NpNFpoag0ZCt+CLbfU1AxD9nQuVCMCNwIt+WffFLrXnMJB6koIZCn5KqAyQffX/AvRmwEpW+pwrDmFQrZ0ZSOO8WDYwd8Lcree9BaoMkbZi/VOUR3hi8CZtso4ENbZd69lVjw7CPR7qfoXbyz+WIY+cjWq0vOi/TrAendH6Fcdu5ARYmJTS9ARy/uezN+nin+BLl4isI0B+DgvQ8WaIO5m2+D0lrG/qXMpMhAsUcimLjlzaJ62A5PyU6r682Ll0r8QR6SAxvtomAcqEbJWYdx9RcMHWWskveAfLi3NoV2SVDmELtoyzsCcSbPmQa0XeB9ymwcxheQU5Jg1qFX/OEB+bxZuBIPCQG0o2w+w/RJuvmNR/YDoo9JgX8reO++/4Nr7rRQePIuDWShuwXe3GyzG/anR2/51c/Ze3qMM90ioWeK25/IlfI+iVHggMisvA8mBT8mp0w+63S1r9/A/JV0NwsZyBIROYPfVMNhvKvtrxg9b63UtUoyxYa1uGjoomfgbLqJpZDil325nVkEObS4QIMouRcm8H/zv2peRO/KoHvNAhu8PFQ8O9QLpCtvrTuOP40rdF75Urdd2mMP8Dh4udUWZq2EWfctyp2HXlOPIPTwqAjdTlEI+qVaKh5jScZV3Ch+i54ic/0q13Wip/sBUw1jtxnyTTVDOjVy+QWS8UFdLcvmYdbI3uRTQIfbz6GBxIRIOdiId9HfkWvcYp35hNSsgqI//eJPharWT20mvc0Hwv5MGiBoiuIYf6GfKMPZtEJJyd7arkzh4Wp5lv965CkDYdHc/cX9AmFQMAhWwMDeT1MOx4dx8uZVP3PMOh1zsRq5cmOauyr9mMeSWOeEqmOo+VRyuRtU/amziwlecLtFWsOifnwxpR9whuArHJ/uZPm9g0uI1wneZEC1pZ3b9lhlRSR5/Aurj+H6TlGOqRuBTgX9vRpuYLCdamk55B6/oJm8LMnCiAz+7RUAXjZlri3rHGORS6MgN4BH4My3JYjE/Vj7Pr/lpY61VDEaZdDql7mERpo= X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-Network-Message-Id: 91d6e0b1-6d64-4e1b-f7e5-08df496a76d4 X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB9645.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Nov 2026 14:02:51.9997 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: II+4qsDulXmZuuYgkmrH8jNlkfaXSmLjpR2nVONLD7A/Mv1eggIyS6X0mO3FmgBbTzWViWllm0fZMVQHJc6ZO9gzgH8fhov+/wh6JEYcV3c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR10MB5940 X-Original-Sender: clara.kowalsky@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=OScfTJ5P; arc=pass (i=1 spf=pass spfdomain=siemens.com dkim=pass dkdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of clara.kowalsky@siemens.com designates 2a01:111:f403:c20a::7 as permitted sender) smtp.mailfrom=clara.kowalsky@siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com X-Original-From: Clara Kowalsky Reply-To: Clara Kowalsky Precedence: list Mailing-list: list isar-users@googlegroups.com; contact isar-users+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: isar-users@googlegroups.com X-Google-Group-Id: 914930254986 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-Spam-Status: No, score=-4.9 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, RCVD_IN_RP_CERTIFIED,RCVD_IN_RP_RNBL,RCVD_IN_RP_SAFE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= WIC is a Python tool that imports BitBake (scripts/wic: "import bb"), so it needs a Python interpreter that BitBake supports. Isar runs WIC inside the imaging chroot, which has the userland of the target distribution, so WIC is executed by the chroot's python3. This blocks updating BitBake to 2.18, the version used in Yocto 6.0 LTS: Current BitBake 2.8 requires Python 3.8, BitBake 2.18 requires 3.9, but Debian buster ships Python 3.7. Isar worked around this by lowering BitBake's version check (commit da17d920 "bitbake: Downgrade python requirements"). Carrying it on would run BitBake 2.18 on an interpreter it does not support. Fix this by running WIC with the build host's Python, which BitBake itself already uses. Image utilities such as mkfs, mtools and bmaptool run in the imaging chroot. The rootfs plugin keeps using copyhardlinktree, which runs its copy commands on the host. imager_run_host runs a script outside the chroot with the same privilege handling and mounts as imager_run and provides IMAGER_CHROOT. WIC uses WIC_TOOL_RUNNER (scripts/wic-chroot) to execute utilities in the chroot and WIC_TOOL_SYSROOT to translate native sysroot paths with get_native_path(). WIC is invoked as an external script, so its source files are not included in do_image_wic's task signature automatically. Fix this by listing the driver, runner and modified plugin files in the file-checksums, so changes to them rerun the task instead of reusing a stale image. The WIC work directory is now ${WORKDIR}/wic instead of /tmp in the chroot. Downstream WIC plugins should use exec_cmd() for commands available in the imaging chroot's standard PATH and exec_native_cmd() for tools provided by the native sysroot. Both helpers use WIC_TOOL_RUNNER when configured, so existing calls do not need a conversion between the APIs. Direct subprocess or os.system calls intended to run tools in the imaging chroot must be migrated. Use: - get_native_path() for host-side native-sysroot paths passed to chrooted commands - get_chroot_path() for host paths under the workdir or image-rootfs bind mounts - get_host_path() when host-side Python needs to inspect a path in the imaging chroot - tool_path_exists() when Python only needs to check whether a path exists in the tool environment These helpers translate paths, not command strings or arguments. Signed-off-by: Clara Kowalsky Tested-by: Felix Moessbauer --- RECIPE-API-CHANGELOG.md | 85 ++++++++++++++++++ doc/technical_overview.md | 31 +++++++ .../image-tools-extension.bbclass | 17 +++- meta/classes-recipe/imagetypes_wic.bbclass | 49 +++++++++-- .../source/bootimg-biosplusefi-isar.py | 1 + .../wic/plugins/source/bootimg-efi-isar.py | 17 ++-- .../wic/plugins/source/bootimg-pcbios-isar.py | 6 +- .../plugins/source/isoimage-isohybrid-isar.py | 6 +- .../lib/wic/plugins/source/rootfs-u-boot.py | 17 ++-- scripts/lib/wic/misc.py | 86 ++++++++++++++++++- scripts/lib/wic/partition.py | 5 +- scripts/lib/wic/plugins/imager/direct.py | 9 +- .../lib/wic/plugins/source/bootimg-pcbios.py | 6 +- .../wic/plugins/source/isoimage-isohybrid.py | 4 +- scripts/lib/wic/plugins/source/rawcopy.py | 20 ++--- scripts/lib/wic/plugins/source/rootfs.py | 3 +- scripts/wic-chroot | 43 ++++++++++ 17 files changed, 354 insertions(+), 51 deletions(-) create mode 100755 scripts/wic-chroot diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md index 3798a9d1..1c74aa8e 100644 --- a/RECIPE-API-CHANGELOG.md +++ b/RECIPE-API-CHANGELOG.md @@ -1225,3 +1225,88 @@ the rootfs. This has been replaced by the `exclude-docs` rootfs feature. The When enabled, the package changelogs are now removed as well (copyright is still kept for legal reasons). + +### WIC runs on the build host, add imager_run_host + +WIC's Python driver now runs on the build host instead of inside the imaging +chroot. Image utilities such as mkfs tools, mtools and bmaptool still run in +the chroot. The rootfs copy uses the host's cp, find and tar through +`copyhardlinktree()`. The chroot distribution no longer needs a Python +interpreter that is compatible with BitBake, which is required to update +BitBake beyond Debian buster's Python version. + +`imager_run_host` is for imager scripts, such as WIC's Python driver, that must +run on the host. It provides the same privilege handling and mounts as +`imager_run` and sets `IMAGER_CHROOT` to the prepared imaging chroot. This is +not a blanket replacement for `imager_run`; other imager scripts should keep +running in the chroot when they depend on that environment. + +#### Migrating custom WIC plugins + +WIC plugins are Python code and now run on the host. Existing plugin calls to +`exec_cmd()` and `exec_native_cmd()` do not need to be changed solely because +of this migration: both are routed through `WIC_TOOL_RUNNER` when WIC +configures it. Direct `subprocess` or `os.system` calls that were intended to +run commands in the imaging chroot must be migrated, since they now run on the +host and bypass the runner. Calls intentionally meant to run on the host may +remain direct. + +Choose the command helper based on where the executable comes from: + +- Use `exec_cmd(command)` for commands available in the imaging chroot's + standard `PATH`. Pass `as_shell=True` for shell syntax such as pipes, + redirections, or environment assignments. It returns stdout as a string and + raises `WicError` if the command fails. +- Use `exec_native_cmd(command, native_sysroot)` for tools supplied by the WIC + native sysroot. It sets up the native tool `PATH`, returns + `(return_code, output)` on success, and raises `WicError` on command failure. + The `native_sysroot` argument is translated automatically. + +Translate paths according to which process accesses them: + +- Use `get_native_path(path)` for a host path under `WIC_TOOL_SYSROOT` that is + passed as a command argument. It translates the native-sysroot prefix to the + chroot-visible prefix; it does not translate command text or other arguments. +- Use `get_chroot_path(path)` when host-side Python has a path under the + workdir or image-rootfs bind mounts and needs to pass it to a chroot command. + Paths outside those mounts are returned unchanged and must exist at the same + absolute path inside the imaging chroot. +- Use `get_host_path(path)` when host-side Python must inspect an absolute path + inside the imaging chroot, for example with `os.listdir()`. It maps the path + into the host-visible imaging sysroot; relative paths are left unchanged. +- Use `tool_path_exists(path)` when Python only needs to check whether a path + exists in the tool environment; it returns a boolean, not a path to open. + +The WIC work directory is now `${WORKDIR}/wic`. + +For example, replace a direct subprocess call for a tool in the imaging +chroot's `PATH` with: + +``` +import os +import shlex + +from wic.misc import (exec_cmd, exec_native_cmd, get_chroot_path, + get_native_path) + +exec_cmd("tool --input %s" % shlex.quote(input_path), as_shell=True) +``` + +For a nested chroot into a target rootfs mounted inside the imaging chroot, +translate the host rootfs path before constructing the command: + +``` +rootfs_path = get_chroot_path(rootfs_dir) +exec_cmd("chroot %s command" % shlex.quote(rootfs_path), as_shell=True) +``` + +For a tool supplied by the native sysroot, translate host-visible paths in +its arguments with `get_native_path()`: + +``` +input_path = os.path.join(native_sysroot, "usr/lib/example/input") +ret, output = exec_native_cmd( + "tool --input %s" % shlex.quote(get_native_path(input_path)), + native_sysroot, +) +``` diff --git a/doc/technical_overview.md b/doc/technical_overview.md index 5d2e1b8a..99e48e4d 100644 --- a/doc/technical_overview.md +++ b/doc/technical_overview.md @@ -243,6 +243,37 @@ This process contains the following steps: 1.1. `IMAGE_CMD:ext4`: target filesystem is packed to extfs image. 1.2. `IMAGE_CMD:wic`: a bootable disk image gets created for the platform +WIC runs with the build host's Python interpreter. Image utilities and their +data remain in the imaging chroot, except for rootfs copying, which uses the +host's cp, find and tar. Older target distributions therefore do not need to +provide a Python interpreter compatible with BitBake. + +`imager_run_host` prepares the same tool environment as `imager_run`, but +executes the supplied shell script outside the chroot. It still uses Isar's +privilege handling and, in rootless mode, the mapped user and mount namespaces. +`IMAGER_CHROOT` identifies the prepared chroot for the script. + +WIC uses `WIC_TOOL_RUNNER` to execute utility commands in that environment and +`WIC_TOOL_SYSROOT` to locate native tool data from the host. Plugins should use +`exec_cmd()` for commands available in the imaging chroot's `PATH` and +`exec_native_cmd()` for tools supplied by the native sysroot; both use the +runner when WIC configures it. Direct `subprocess` and `os.system` calls +bypass the runner. + +Path translation depends on which side accesses the file: +- `get_native_path()` maps a host path under `WIC_TOOL_SYSROOT` to its + chroot-visible native-sysroot path. +- `get_chroot_path()` maps a host path under the workdir or image-rootfs bind + mounts to its corresponding path inside the imaging chroot. Unmapped paths + are returned unchanged and must exist at the same absolute path there. +- `get_host_path()` maps an absolute imaging-chroot path into the host-visible + imaging sysroot for Python file operations; relative paths are unchanged. +- `tool_path_exists()` checks whether a path exists inside the tool environment + when Python only needs a boolean result. + +These helpers translate paths, not command text or arbitrary arguments. See +the Recipe API Changelog's WIC migration section for usage guidance. + ## 3.8 Cross-compilation Isar provides the possibility to cross-compile all or individual packages. If diff --git a/meta/classes-recipe/image-tools-extension.bbclass b/meta/classes-recipe/image-tools-extension.bbclass index 8f666444..9532fa47 100644 --- a/meta/classes-recipe/image-tools-extension.bbclass +++ b/meta/classes-recipe/image-tools-extension.bbclass @@ -33,6 +33,10 @@ imager_run() { imager_run_${ISAR_CHROOT_MODE} "$@" } +imager_run_host() { + IMAGER_HOST_RUN=1 imager_run "$@" +} + imager_run_schroot() { local_install="${@(d.getVar("INSTALL_%s" % d.getVar("BB_CURRENTTASK")) or '').strip()}" local_bom="${@(d.getVar("BOM_%s" % d.getVar("BB_CURRENTTASK")) or '').strip()}" @@ -85,7 +89,11 @@ EOAPT ${local_install}" fi - schroot -r -c ${session_id} "$@" + if [ "${IMAGER_HOST_RUN:-0}" = "1" ]; then + IMAGER_CHROOT="${schroot_dir}" run_privileged_heredoc "$@" + else + schroot -r -c ${session_id} "$@" + fi if [ -n "${local_bom}" ]; then schroot -r -c ${session_id} -d / -- \ @@ -198,7 +206,12 @@ EOF set -e mkdir -p ${ROOTFS_IMAGETOOLS}/${SCRIPTSDIR} ${@insert_isar_mounts(d, d.getVar('ROOTFS_IMAGETOOLS'), d.getVar('IMAGER_UNSHARE_MOUNTS'))} - chroot ${ROOTFS_IMAGETOOLS} "$@" <&3 + if [ "${IMAGER_HOST_RUN:-0}" = "1" ]; then + export IMAGER_CHROOT="${ROOTFS_IMAGETOOLS}" + "$@" <&3 + else + chroot ${ROOTFS_IMAGETOOLS} "$@" <&3 + fi EOF if [ -n "${local_bom}" ]; then diff --git a/meta/classes-recipe/imagetypes_wic.bbclass b/meta/classes-recipe/imagetypes_wic.bbclass index 6cf7bd8e..2f1f23b5 100644 --- a/meta/classes-recipe/imagetypes_wic.bbclass +++ b/meta/classes-recipe/imagetypes_wic.bbclass @@ -144,7 +144,25 @@ check_for_wic_warnings() { } do_image_wic[depends] += "${@bb.utils.contains('ROOTFS_FEATURES', 'generate-sbom', 'sbom-chroot:do_build', '', d)}" -do_image_wic[file-checksums] += "${WKS_FILE_CHECKSUM}" +do_image_wic[file-checksums] += " \ + ${WKS_FILE_CHECKSUM} \ + ${SCRIPTSDIR}/wic:True \ + ${SCRIPTSDIR}/wic-chroot:True \ + ${SCRIPTSDIR}/wic_fakeroot:True \ + ${SCRIPTSDIR}/lib/wic/misc.py:True \ + ${SCRIPTSDIR}/lib/wic/partition.py:True \ + ${SCRIPTSDIR}/lib/wic/plugins/imager/direct.py:True \ + ${SCRIPTSDIR}/lib/wic/plugins/source/bootimg-pcbios.py:True \ + ${SCRIPTSDIR}/lib/wic/plugins/source/isoimage-isohybrid.py:True \ + ${SCRIPTSDIR}/lib/wic/plugins/source/rawcopy.py:True \ + ${SCRIPTSDIR}/lib/wic/plugins/source/rootfs.py:True \ + ${LAYERDIR_core}/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py:True \ + ${LAYERDIR_core}/scripts/lib/wic/plugins/source/bootimg-efi-isar.py:True \ + ${LAYERDIR_core}/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py:True \ + ${LAYERDIR_core}/scripts/lib/wic/plugins/source/isoimage-isohybrid-isar.py:True \ + ${LAYERDIR_core}/scripts/lib/wic/plugins/source/rootfs-u-boot.py:True \ +" +do_image_wic[cleandirs] += "${WORKDIR}/wic" IMAGE_CMD:wic() { generate_wic_image check_for_wic_warnings @@ -162,9 +180,21 @@ generate_wic_image() { mkdir -p ${IMAGE_ROOTFS}/../pseudo touch ${IMAGE_ROOTFS}/../pseudo/files.db - imager_run -p -d ${PP_WORK} -u root <<'EOIMAGER' + imager_run_host <<'EOIMAGER' set -e + export WIC_TOOL_RUNNER="${SCRIPTSDIR}/wic-chroot" + export WIC_TOOL_SYSROOT="$IMAGER_CHROOT" + export WIC_TOOL_CWD="${PP_WORK}" + export WIC_TOOL_HOST_WORKDIR="${WORKDIR}" + export WIC_TOOL_HOST_ROOTFS="${IMAGE_ROOTFS}" + export WIC_TOOL_ROOTFS="${PP_ROOTFS}" + export TMPDIR="${WORKDIR}/wic/tmp" + mkdir -p "$TMPDIR" + cd "${WORKDIR}" + + "$WIC_TOOL_RUNNER" /bin/sh -s <<'EOTOOLS' + set -e # The python path is hard-coded as /usr/bin/python3-native/python3 in wic. Handle that. mkdir -p /usr/bin/python3-native/ if [ $(head -1 $(which bmaptool) | grep python3) ];then @@ -172,24 +202,27 @@ generate_wic_image() { else ln -fs /usr/bin/python2 /usr/bin/python3-native/python3 fi +EOTOOLS export PATH="${BITBAKEDIR}/bin:$PATH" "${SCRIPTSDIR}"/wic create "${WKS_FULL_PATH}" \ --vars "${STAGING_DIR}/${MACHINE}/imgdata/" \ - -o "/tmp/${IMAGE_FULLNAME}.wic/" \ + --native-sysroot "$IMAGER_CHROOT" \ + -o "${WORKDIR}/wic/" \ --bmap \ -e "${IMAGE_BASENAME}" ${WIC_CREATE_EXTRA_ARGS} - WIC_DIRECT=$(ls -t -1 /tmp/${IMAGE_FULLNAME}.wic/*.direct | head -1) - mv -f ${WIC_DIRECT} ${PP_DEPLOY}/${IMAGE_FULLNAME}.wic - mv -f ${WIC_DIRECT}.bmap ${PP_DEPLOY}/${IMAGE_FULLNAME}.wic.bmap + WIC_DIRECT=$(ls -t -1 ${WORKDIR}/wic/*.direct | head -1) + mv -f ${WIC_DIRECT} ${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.wic + mv -f ${WIC_DIRECT}.bmap ${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.wic.bmap # deploy partition files if requested (ending with .p) if [ "${WIC_DEPLOY_PARTITIONS}" -eq "1" ]; then # locate *.direct.p partition files - find "/tmp/${IMAGE_FULLNAME}.wic/" -type f -regextype sed -regex ".*\.direct.*\.p[0-9]\{1,\}" | while read f; do + find "${WORKDIR}/wic/" -type f -regextype sed \ + -regex ".*\.direct.*\.p[0-9]\{1,\}" | while read f; do suffix=$(basename $f | sed 's/.*\.direct\(.*\)/\1/') - mv -f ${f} ${PP_DEPLOY}/${IMAGE_FULLNAME}.wic${suffix} + mv -f ${f} ${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.wic${suffix} done fi EOIMAGER diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py index fb6b7fcc..df37f97b 100644 --- a/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py +++ b/meta/scripts/lib/wic/plugins/source/bootimg-biosplusefi-isar.py @@ -18,6 +18,7 @@ # AUTHORS # William Bourque +import os import types from wic.pluginbase import SourcePlugin diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py index a2592986..b4ca3e19 100644 --- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py +++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py @@ -22,7 +22,8 @@ from wic import WicError from wic.engine import get_custom_config from wic.pluginbase import SourcePlugin from wic.misc import (exec_cmd, exec_native_cmd, - get_bitbake_var, BOOTDD_EXTRA_SPACE) + get_bitbake_var, get_host_path, tool_path_exists, + BOOTDD_EXTRA_SPACE) # allow plugins to import from isarpluginbase if '__file__' in globals(): @@ -313,7 +314,10 @@ class BootimgEFIPlugin(SourcePlugin): @classmethod def _sign_file(cls, signee, source_params): sign_script = source_params.get("signwith") - if sign_script and os.path.exists(sign_script): + if sign_script and not tool_path_exists(sign_script): + logger.error("Could not find script %s", sign_script) + exit(1) + if sign_script: logger.info("sign with script %s", sign_script) orig_signee = signee + ".unsigned" os.rename(signee, orig_signee) @@ -321,9 +325,6 @@ class BootimgEFIPlugin(SourcePlugin): .format(sign_script=sign_script, orig_signee=orig_signee, signee=signee) exec_cmd(sign_cmd) - elif sign_script and not os.path.exists(sign_script): - logger.error("Could not find script %s", sign_script) - exit(1) @classmethod def do_prepare_partition(cls, part, source_params, creator, cr_workdir, @@ -468,7 +469,7 @@ class BootimgEFIPlugin(SourcePlugin): if any(name in distro for name in efi_uga_list): grub_modules += "efi_uga " if distro.startswith("ubuntu") and \ - os.path.exists('/usr/lib/grub/x86_64-efi/linuxefi.mod'): + tool_path_exists('/usr/lib/grub/x86_64-efi/linuxefi.mod'): grub_modules += "linuxefi " elif distro_arch == "i386": grub_target = 'i386-efi' @@ -520,8 +521,8 @@ class BootimgEFIPlugin(SourcePlugin): # backup kernel dir before overwriting kernel_dir_orig = kernel_dir kernel_dir = "/usr/lib/systemd/boot/efi/" - - for mod in [x for x in os.listdir(kernel_dir) if x.startswith("systemd-")]: + efi_dir = get_host_path(kernel_dir) + for mod in [x for x in os.listdir(efi_dir) if x.startswith("systemd-")]: target = mod[8:] if target.endswith('.signed'): target = target[:-7] diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py index d5040b72..7569c7b1 100644 --- a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py +++ b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py @@ -18,7 +18,7 @@ from wic import WicError from wic.engine import get_custom_config from wic.pluginbase import SourcePlugin from wic.misc import (exec_cmd, exec_native_cmd, - get_bitbake_var, BOOTDD_EXTRA_SPACE) + get_bitbake_var, get_native_path, BOOTDD_EXTRA_SPACE) # allow plugins to import from isarpluginbase if '__file__' in globals(): @@ -83,7 +83,8 @@ class BootimgPcbiosIsarPlugin(SourcePlugin): logger.debug("Installing MBR on disk %s as %s with size %s bytes", disk_name, full_path, disk.min_size) - dd_cmd = "dd if=%s of=%s conv=notrunc" % (mbrfile, full_path) + dd_cmd = "dd if=%s of=%s conv=notrunc" % (get_native_path(mbrfile), + full_path) exec_cmd(dd_cmd, native_sysroot) @classmethod @@ -167,6 +168,7 @@ class BootimgPcbiosIsarPlugin(SourcePlugin): bootimg_dir = cls._get_bootimg_dir(bootimg_dir, 'syslinux') staging_kernel_dir = kernel_dir + bootimg_dir = get_native_path(bootimg_dir) hdddir = "%s/hdd/boot" % cr_workdir diff --git a/meta/scripts/lib/wic/plugins/source/isoimage-isohybrid-isar.py b/meta/scripts/lib/wic/plugins/source/isoimage-isohybrid-isar.py index 6aa58870..7a4bbf87 100644 --- a/meta/scripts/lib/wic/plugins/source/isoimage-isohybrid-isar.py +++ b/meta/scripts/lib/wic/plugins/source/isoimage-isohybrid-isar.py @@ -16,7 +16,8 @@ import shutil from wic import WicError from wic.engine import get_custom_config from wic.pluginbase import SourcePlugin -from wic.misc import exec_cmd, exec_native_cmd, get_bitbake_var +from wic.misc import (exec_cmd, exec_native_cmd, + get_bitbake_var, get_native_path, tool_path_exists) # allow plugins to import from isarpluginbase if '__file__' in globals(): @@ -393,7 +394,7 @@ class IsoImagePlugin(SourcePlugin): if any(name in distro for name in efi_uga_list): grub_modules += "efi_uga " if get_bitbake_var("DISTRO").startswith("ubuntu") and \ - os.path.exists('/usr/lib/grub/x86_64-efi/linuxefi.mod'): + tool_path_exists('/usr/lib/grub/x86_64-efi/linuxefi.mod'): grub_modules += "linuxefi " elif re.match('i.86', target_arch): grub_target = "i386-efi" @@ -477,6 +478,7 @@ class IsoImagePlugin(SourcePlugin): syslinux_dir = get_bitbake_var("STAGING_DATADIR") if not syslinux_dir: raise WicError("Couldn't find STAGING_DATADIR, exiting.") + syslinux_dir = get_native_path(syslinux_dir) if os.path.exists("%s/isolinux" % isodir): shutil.rmtree("%s/isolinux" % isodir) diff --git a/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py b/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py index 5611f93a..6c33efcc 100644 --- a/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py +++ b/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py @@ -17,10 +17,12 @@ import glob import logging import re import os +import shlex +import shutil from wic import WicError from wic.plugins.source.rootfs import RootfsPlugin -from wic.misc import get_bitbake_var, exec_cmd +from wic.misc import get_bitbake_var, get_chroot_path, exec_cmd logger = logging.getLogger('wic') @@ -98,13 +100,14 @@ class RootfsUBootPlugin(RootfsPlugin): results = glob.glob(os.path.join("/usr/bin/qemu-*-static")) qemu_static = results[0] if len(results) > 0 else None if qemu_static: - cp_cmd = "cp -L %s %s/usr/bin" % (qemu_static, real_rootfs_dir) - exec_cmd(cp_cmd) - update_cmd = "chroot %s sh -c update-u-boot-script" % real_rootfs_dir - exec_cmd(update_cmd) + qemu_target = os.path.join(real_rootfs_dir, "usr/bin", + os.path.basename(qemu_static)) + shutil.copy(qemu_static, qemu_target) + update_cmd = "TMPDIR=/tmp chroot %s sh -c update-u-boot-script" % \ + shlex.quote(get_chroot_path(real_rootfs_dir)) + exec_cmd(update_cmd, as_shell=True) if qemu_static: - rm_cmd = "rm -f %s/usr/bin/%s" % (real_rootfs_dir, qemu_static) - exec_cmd(rm_cmd) + os.remove(qemu_target) # For reproducibility set the time stamp of newly updated files if os.getenv('SOURCE_DATE_EPOCH'): diff --git a/scripts/lib/wic/misc.py b/scripts/lib/wic/misc.py index 1a7c140f..ff301ce8 100644 --- a/scripts/lib/wic/misc.py +++ b/scripts/lib/wic/misc.py @@ -15,6 +15,7 @@ import logging import os import re +import shlex import subprocess import shutil @@ -51,6 +52,56 @@ NATIVE_RECIPES = {"bmaptool": "bmaptool", "tar": "tar" } +def get_native_path(path): + """Translate a host sysroot path to its matching path in the chroot.""" + tool_sysroot = os.environ.get('WIC_TOOL_SYSROOT') + if tool_sysroot and os.environ.get('WIC_TOOL_RUNNER'): + tool_sysroot = os.path.normpath(tool_sysroot) + if path == tool_sysroot: + return '/' + if path.startswith(tool_sysroot + '/'): + return path[len(tool_sysroot):] + return path + +def get_host_path(path): + """Translate a chroot path to its matching path on the WIC host.""" + tool_sysroot = os.environ.get('WIC_TOOL_SYSROOT') + if not path or not tool_sysroot or not os.environ.get('WIC_TOOL_RUNNER'): + return path + if not os.path.isabs(path): + return path + + tool_sysroot = os.path.normpath(tool_sysroot) + path = os.path.normpath(path) + if path == tool_sysroot or path.startswith(tool_sysroot + os.sep): + return path + return os.path.join(tool_sysroot, path.lstrip(os.sep)) + +def get_chroot_path(path): + """Translate a host path to its matching path in the imaging chroot.""" + path = os.path.realpath(path) + if not os.environ.get('WIC_TOOL_RUNNER'): + return path + + path_mappings = ( + (os.environ.get('WIC_TOOL_HOST_ROOTFS'), + os.environ.get('WIC_TOOL_ROOTFS')), + (os.environ.get('WIC_TOOL_HOST_WORKDIR'), + os.environ.get('WIC_TOOL_CWD')), + ) + for host_path, chroot_path in path_mappings: + if not host_path or not chroot_path: + continue + + host_path = os.path.realpath(host_path) + relative_path = os.path.relpath(path, host_path) + if relative_path == os.pardir or relative_path.startswith( + os.pardir + os.sep): + continue + return os.path.normpath(os.path.join(chroot_path, relative_path)) + + return path + def runtool(cmdln_or_args): """ wrapper for most of the subprocess calls input: @@ -62,10 +113,18 @@ def runtool(cmdln_or_args): cmd = cmdln_or_args[0] shell = False else: - import shlex cmd = shlex.split(cmdln_or_args)[0] shell = True + tool_runner = os.environ.get('WIC_TOOL_RUNNER') + if tool_runner and os.path.basename(cmd) != 'bitbake': + runner_args = shlex.split(tool_runner) + if shell: + cmdln_or_args = runner_args + ['/bin/sh', '-c', cmdln_or_args] + else: + cmdln_or_args = runner_args + cmdln_or_args + shell = False + sout = subprocess.PIPE serr = subprocess.STDOUT @@ -84,6 +143,17 @@ def runtool(cmdln_or_args): return process.returncode, out +def tool_path_exists(path): + if not os.environ.get('WIC_TOOL_RUNNER'): + return os.path.exists(path) + + ret, out = runtool(['/bin/sh', '-c', + 'if [ -e "$1" ]; then printf 1; else printf 0; fi', + 'sh', path]) + if ret != 0 or out not in ('0', '1'): + raise WicError('Cannot check tool path %s (rc = %d): %s' % (path, ret, out)) + return out == '1' + def _exec_cmd(cmd_and_args, as_shell=False): """ Execute command, catching stderr, stdout @@ -123,6 +193,14 @@ def find_executable(cmd, paths): if provided and "%s-native" % recipe in provided: return True + if os.environ.get('WIC_TOOL_RUNNER'): + paths = os.pathsep.join(get_native_path(path) + for path in paths.split(os.pathsep)) + ret, _ = runtool(['/bin/sh', '-c', + 'PATH=%s command -v %s' % + (shlex.quote(paths), shlex.quote(cmd))]) + return ret == 0 + return shutil.which(cmd, path=paths) def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""): @@ -133,6 +211,7 @@ def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""): Always need to execute native commands as_shell """ + native_sysroot = get_native_path(native_sysroot) # The reason -1 is used is because there may be "export" commands. args = cmd_and_args.split(';')[-1].split() logger.debug(args) @@ -263,4 +342,7 @@ def get_bitbake_var(var, image=None, cache=True): Provide old get_bitbake_var API by wrapping get_var method of BB_VARS singleton. """ - return BB_VARS.get_var(var, image, cache) + value = BB_VARS.get_var(var, image, cache) + if value and var in ('RECIPE_SYSROOT_NATIVE', 'STAGING_DATADIR', 'STAGING_LIBDIR'): + return get_host_path(value) + return value diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index bf2c34d5..7c6b83f3 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py @@ -15,7 +15,8 @@ import os import uuid from wic import WicError -from wic.misc import exec_cmd, exec_native_cmd, get_bitbake_var +from wic.misc import (exec_cmd, exec_native_cmd, + get_bitbake_var, get_native_path) from wic.pluginbase import PluginMgr logger = logging.getLogger('wic') @@ -219,6 +220,7 @@ class Partition(): os.remove(rootfs) p_prefix = os.environ.get("PSEUDO_PREFIX", "%s/usr" % native_sysroot) + p_prefix = get_native_path(p_prefix) if (pseudo_dir): # Canonicalize the ignore paths. This corresponds to # calling oe.path.canonicalize(), which is used in bitbake.conf. @@ -548,4 +550,3 @@ class Partition(): logger.warn("%s Inodes (of size %d) are too small." % (get_err_str(self), size)) break - diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py index a65ae36a..60f2dbf7 100644 --- a/scripts/lib/wic/plugins/imager/direct.py +++ b/scripts/lib/wic/plugins/imager/direct.py @@ -25,7 +25,8 @@ from wic import WicError from wic.filemap import sparse_copy from wic.ksparser import KickStart, KickStartError from wic.pluginbase import PluginMgr, ImagerPlugin -from wic.misc import get_bitbake_var, exec_cmd, exec_native_cmd +from wic.misc import (get_bitbake_var, get_native_path, + exec_cmd, exec_native_cmd) logger = logging.getLogger('wic') @@ -212,8 +213,10 @@ class DirectPlugin(ImagerPlugin): # Generate .bmap if self.bmap: logger.debug("Generating bmap file for %s", disk_name) - python = os.path.join(self.native_sysroot, 'usr/bin/python3-native/python3') - bmaptool = os.path.join(self.native_sysroot, 'usr/bin/bmaptool') + tool_sysroot = get_native_path(self.native_sysroot) + python = os.path.join(tool_sysroot, + 'usr/bin/python3-native/python3') + bmaptool = os.path.join(tool_sysroot, 'usr/bin/bmaptool') exec_native_cmd("%s %s create %s -o %s.bmap" % \ (python, bmaptool, full_path, full_path), self.native_sysroot) # Compress the image diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py index a207a835..77e2e52b 100644 --- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py +++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py @@ -18,7 +18,7 @@ from wic import WicError from wic.engine import get_custom_config from wic.pluginbase import SourcePlugin from wic.misc import (exec_cmd, exec_native_cmd, - get_bitbake_var, BOOTDD_EXTRA_SPACE) + get_bitbake_var, get_native_path, BOOTDD_EXTRA_SPACE) logger = logging.getLogger('wic') @@ -73,7 +73,8 @@ class BootimgPcbiosPlugin(SourcePlugin): logger.debug("Installing MBR on disk %s as %s with size %s bytes", disk_name, full_path, disk.min_size) - dd_cmd = "dd if=%s of=%s conv=notrunc" % (mbrfile, full_path) + dd_cmd = "dd if=%s of=%s conv=notrunc" % (get_native_path(mbrfile), + full_path) exec_cmd(dd_cmd, native_sysroot) @classmethod @@ -146,6 +147,7 @@ class BootimgPcbiosPlugin(SourcePlugin): bootimg_dir = cls._get_bootimg_dir(bootimg_dir, 'syslinux') staging_kernel_dir = kernel_dir + bootimg_dir = get_native_path(bootimg_dir) hdddir = "%s/hdd/boot" % cr_workdir diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py index 607356ad..4b8815b6 100644 --- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py +++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py @@ -18,7 +18,8 @@ import shutil from wic import WicError from wic.engine import get_custom_config from wic.pluginbase import SourcePlugin -from wic.misc import exec_cmd, exec_native_cmd, get_bitbake_var +from wic.misc import (exec_cmd, exec_native_cmd, + get_bitbake_var, get_native_path) logger = logging.getLogger('wic') @@ -385,6 +386,7 @@ class IsoImagePlugin(SourcePlugin): syslinux_dir = get_bitbake_var("STAGING_DATADIR") if not syslinux_dir: raise WicError("Couldn't find STAGING_DATADIR, exiting.") + syslinux_dir = get_native_path(syslinux_dir) if os.path.exists("%s/isolinux" % isodir): shutil.rmtree("%s/isolinux" % isodir) diff --git a/scripts/lib/wic/plugins/source/rawcopy.py b/scripts/lib/wic/plugins/source/rawcopy.py index 21903c2f..05543e3f 100644 --- a/scripts/lib/wic/plugins/source/rawcopy.py +++ b/scripts/lib/wic/plugins/source/rawcopy.py @@ -6,12 +6,11 @@ import logging import os -import signal -import subprocess +import shlex from wic import WicError from wic.pluginbase import SourcePlugin -from wic.misc import exec_cmd, get_bitbake_var +from wic.misc import exec_cmd, get_bitbake_var, get_host_path from wic.filemap import sparse_copy logger = logging.getLogger('wic') @@ -48,12 +47,6 @@ class RawCopyPlugin(SourcePlugin): @staticmethod def do_image_uncompression(src, dst, workdir): - def subprocess_setup(): - # Python installs a SIGPIPE handler by default. This is usually not what - # non-Python subprocesses expect. - # SIGPIPE errors are known issues with gzip/bash - signal.signal(signal.SIGPIPE, signal.SIG_DFL) - extension = os.path.splitext(src)[1] decompressor = { ".bz2": "bzip2", @@ -63,8 +56,9 @@ class RawCopyPlugin(SourcePlugin): }.get(extension) if not decompressor: raise WicError("Not supported compressor filename extension: %s" % extension) - cmd = "%s -dc %s > %s" % (decompressor, src, dst) - subprocess.call(cmd, preexec_fn=subprocess_setup, shell=True, cwd=workdir) + cmd = "cd %s && %s -dc %s > %s" % (shlex.quote(workdir), decompressor, + shlex.quote(src), shlex.quote(dst)) + exec_cmd(cmd, as_shell=True) @classmethod def do_prepare_partition(cls, part, source_params, cr, cr_workdir, @@ -90,6 +84,10 @@ class RawCopyPlugin(SourcePlugin): RawCopyPlugin.do_image_uncompression(img, src, cr_workdir) else: src = os.path.join(kernel_dir, source_params['file']) + if os.environ.get('WIC_TOOL_RUNNER'): + host_src = get_host_path(src) + if host_src != src and os.path.lexists(host_src): + src = host_src dst = os.path.join(cr_workdir, "%s.%s" % (os.path.basename(source_params['file']), part.lineno)) diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py index e29f3a4c..792f8fa5 100644 --- a/scripts/lib/wic/plugins/source/rootfs.py +++ b/scripts/lib/wic/plugins/source/rootfs.py @@ -21,7 +21,7 @@ from pathlib import Path from wic import WicError from wic.pluginbase import SourcePlugin -from wic.misc import get_bitbake_var, exec_native_cmd +from wic.misc import exec_native_cmd, get_bitbake_var, get_native_path logger = logging.getLogger('wic') @@ -63,6 +63,7 @@ class RootfsPlugin(SourcePlugin): @staticmethod def __get_pseudo(native_sysroot, rootfs, pseudo_dir): + native_sysroot = get_native_path(native_sysroot) pseudo = "export PSEUDO_PREFIX=%s/usr;" % native_sysroot pseudo += "export PSEUDO_LOCALSTATEDIR=%s;" % pseudo_dir pseudo += "export PSEUDO_PASSWD=%s;" % rootfs diff --git a/scripts/wic-chroot b/scripts/wic-chroot new file mode 100755 index 00000000..d263e0a8 --- /dev/null +++ b/scripts/wic-chroot @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 +# This software is a part of Isar. +# Copyright (C) Siemens AG, 2026 +# +# SPDX-License-Identifier: MIT + +import os +import sys + +sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), 'lib')) +from wic.misc import get_chroot_path + + +def main(): + imager_chroot = os.environ.get('IMAGER_CHROOT') + if not imager_chroot: + sys.exit('wic-chroot: No imaging chroot configured') + if len(sys.argv) < 2: + sys.exit('Usage: wic-chroot COMMAND [ARG ...]') + + workdir = os.environ.get('WIC_TOOL_CWD') + if not workdir: + sys.exit('wic-chroot: No in-chroot working directory configured') + + cwd = get_chroot_path(os.getcwd()) + + shell_script = ''' + cd "$1" || exit + shift + export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + exec "$@" + ''' + os.execvp('chroot', [ + 'chroot', imager_chroot, '/bin/sh', '-c', shell_script, + 'sh', cwd, *sys.argv[1:], + ]) + + +if __name__ == '__main__': + try: + main() + except OSError as err: + sys.exit(f'wic-chroot: {err}')