From patchwork Tue Nov 17 14:41:06 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clara Kowalsky X-Patchwork-Id: 5621 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Tue, 17 Nov 2026 15:42:39 +0100 X-Sieve: CMU Sieve 2.4 Received: from mail-ed1-f57.google.com (mail-ed1-f57.google.com [209.85.208.57]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 6AHEgb1V006512 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 17 Nov 2026 15:42:37 +0100 Received: by mail-ed1-f57.google.com with SMTP id 4fb4d7f45d1cf-6b776f5a7c0sf4701695a12.3 for ; Tue, 17 Nov 2026 06:42:37 -0800 (PST) ARC-Seal: i=3; a=rsa-sha256; t=1794926552; cv=pass; d=google.com; s=arc-20260327; b=iYxmamO0WUiUwdDtJQMtMRT3M6MACzMSujilceZ+uMFdZhFjWu7fxdkUyf3FxDEvwc KJB+gRlNIHkafVoB3qsO8ZWxB+0aBdn153fbnvls4Cqc+stb7s6xJieYj5UB/ocBpkJJ Ci1Dl8uAuvZVsFd78dqEIzUfxFKF1cYxuhVz71lmeURdRZSJsD3b8yO47fTe5qSewF5s 1kwWD4qEciuwJYmdQ/T6f6joFef6nbKDSRJ1z60xd+JqMt6mnikJ0cxApsT6Xr2AkSVG zCSqAYwRDSCRc7+UtPEakszNfzFM1FSZ7oU2qqCiL/2YCPrjMWkjjpcLj/S+a+UQVx6q bidg== 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=CzAXWgKzMeiSiL+Io+medggYhNYiaREc7bZrs8ibHLk=; fh=wh+uWtcifakUOsJCwVAJ8CKclafXHehsvH1v7yx8RPM=; b=eoAEvGGgTEC7STkeB+cWduFfj1rMyhh+yZJ5188I7KqVqo8MnJNyjl56U1riByay93 AzGMHXGFEiiOyzfnH3VzKutDFz9FIPq44aAfbWeF0wID0ZlwEmBVDS4kJ1lcmk0GX7Ra IWLp+/3ETurmX/VYzlgBIHR00ZCxMoUar28fPfZk4Jtk83duDXBUXnlOT90N4NEu5HsD iED6fRdwe6wvhPOaMPCP3GLZfas2vcGbCI4o7WpPJMb+5OXXoPFicHa9rcdXYEX1e398 xqnjUC8Pq86psStJN2RdQKB4M7KQrLGg68++11hFC5vskqK5AIcQ+65gc6KEonUt3AAK uvXQ==; darn=isar-build.org ARC-Authentication-Results: i=3; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=Y5fCeMhX; 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:c200::5 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=1794926552; x=1795531352; 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=CzAXWgKzMeiSiL+Io+medggYhNYiaREc7bZrs8ibHLk=; b=wBF+KGnya1KhDlD23qHq+5uR/MzbRCeZNmYCceE5e29siSy1o+e/XmJ9O5wvby/gBU sdIQaELP590TcJWRVtcYNbrbdUT9ZA4WwLQ4Y7pk5sURSETcccwjplgmaFk0d13jz68I nlE5FAO3aGBibzEmiCmfEgtG+ChcHgNvUgIysqtBsOo6Ppxi9jjHIISeuQutyjpSTPk8 iOCesso+BTjYBo8QiERzSzhxkeKaR4wa/x7ox+BGmZuHeJ4mPo6v+T3FnEtWOUkzaKCC um7Yi0pC9qZc2A93vaAX/St0sbI08UPiuI9kpr6grYGC2WAYINT530mvpO9OjuOO+Hxl 1+Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794926552; x=1795531352; 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=CzAXWgKzMeiSiL+Io+medggYhNYiaREc7bZrs8ibHLk=; b=qRZ8ds6Kf3hvCpwodrzCYvSiRymL0vMUQvsa7IAecCzj13+Yh4CjNeslv2I5i4rWwg BgwK81FEtb6U0uTGz3IkfUxjywGv3NiPsRv1PhHS9NXTV4Z1PPUFS529FEhf1Guf38OL R42Wu2twF/SsW6hPFz+qRuGa5Z5NhgVVCYCDoUJNv01dZKvGt3BfyPRlfdHR8r/emjGo kVdLIU0VcZdm1Eq/F0JNhZlwGn2S/0ESQSFSyEkOwsSF0LHAmhn7IqEQfUQS1xRFNSGh GyJoawuPc/P5jhoqadDyLZJG4LEjwcmSl9mgpeqJtZmX9cBfaEZAX0tJ3Efvu4LGmuLs n0ug== X-Forwarded-Encrypted: i=3; AL+hErHqRqCO5zTy2i5Ou1RthxAJOJJYTO5w2j0LMOH/7ns/+AESOgbVhRZ7Qq5r4gK8aEiLaihqfoI=@isar-build.org X-Gm-Message-State: APuU4Z/mmRXBRk6LDS24HGS3Y28fy2Gf4cehG2Q+Igf7LYj1W1GHLUhE fwL+wOxi7CxJxeK/YRRRYQXw1+Ua4H840Vmv5Y3kJhK5jDmEH2W0zBiV X-Received: by 2002:a05:6402:2348:b0:6b7:cad8:e3fd with SMTP id 4fb4d7f45d1cf-6b7cad8ec70mr9316974a12.26.1794926551527; Tue, 17 Nov 2026 06:42:31 -0800 (PST) X-BeenThere: isar-users@googlegroups.com; h="ATskLdeZeJIJfWNVv13SYcQdAJK2OpqsCEyHNiJ6ajywBAeADg==" Received: by 2002:a05:6402:51cf:b0:6aa:c8a7:f5ea with SMTP id 4fb4d7f45d1cf-6b7c03497f0ls5929230a12.0.-pod-prod-05-eu; Tue, 17 Nov 2026 06:42:29 -0800 (PST) X-Received: by 2002:a17:907:e915:b0:c2e:378c:8ceb with SMTP id a640c23a62f3a-c50965452a4mr1167396966b.36.1794926549187; Tue, 17 Nov 2026 06:42:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1794926549; cv=pass; d=google.com; s=arc-20260327; b=gh4GI8rRnqs/+aKxtRkdxbCmCJOooTxrjc5kOiDcVdsq8195008hrlRgY/x6JWvkhI x3X8fRsSIKvu1RD+IjRiEZXp6jdk4Hu4J1atlZl2akk8ilvhNyjEyVVIDUYYNCWRulmT mfkBufONuTwOwYE+wfdaxl3zTyN6AF9inQnNQmUMRN4poSfJDm3WEGI7H8Oq/S/nvElk sh5levfMaea+i/Kfsh6DstDGJE8er6n97Vfd+QNvsP6533NIZ0DiGy9exyXirpt3yNZJ EPBauMpkKuTPzoFSFdnsiUjTK7Qzri2Gl2rXcSlpfD9iU5ZClHSAEHW8wt3ieA4a1Hvm 1u3Q== 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=Y/3KxAppYgtYtjc+LM8IrjVW/hM0H6s7wmJOXJivOkw=; fh=gPnyYwFwya925hIKsufnyacyuqnFsKXzQMHP3i58878=; b=nqWdmwLjeeOWcTvRGh37gyvvanu3mcORHGUNYfzQy7KSOy+6DalIqmCVGWlkgOduUe nZXkqpJOP0GFkMX+qzQ3fnx8JkyHj3+HAuWUkLMSlKQ7QL3EZMsMKIfrYXbms/Q/ROQA DtrEe3wt/G9m6/01NuGQBbUvkEqTaaafNVLN/k3FpLG6rQbtWdxiENXcxAaXEEdcnJcN 82z7PatgahhEIbDndH5AxDoEkPcGerHYWwoY3mWzRzEOh7d+oYGmWFPA3S4eHJvYbGO8 0zzQanOSv/0lwNR9AKnKePpzBRTbNP/V5N496Tyec+JMqG/KLHNttv5+eUlnTRXi/AuF MxNg==; dara=google.com ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=Y5fCeMhX; 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:c200::5 as permitted sender) smtp.mailfrom=clara.kowalsky@siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazlp170120005.outbound.protection.outlook.com. [2a01:111:f403:c200::5]) by gmr-mx.google.com with ESMTPS id a640c23a62f3a-c50d8dadd27si9160566b.1.2026.11.17.06.42.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2026 06:42:29 -0800 (PST) Received-SPF: pass (google.com: domain of clara.kowalsky@siemens.com designates 2a01:111:f403:c200::5 as permitted sender) client-ip=2a01:111:f403:c200::5; ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nM7G1IzVuuM/Mp4l6mvSfABeZwq+mvozSQS00TPSnfU7CsKWh7qRp0JAQDAHZ1eSop9fhqCIy+A6aSkkMOHA0pPO+kqUEte/vIDuatAbGSfFSFP7cewJHeJK4RFaN6gX07HLSl06ETHIP0PElh33lGjQtZRjMXs9KXRbfEuIm/ygZREt/C+FzbNfuoSu/SFVmPEv/+xd/tBqJ+jjRUGV3gNK2jcyVsA5wVMnoxB/f869T2+SKl/bYRKCkM7yRfGE1WP2kq69yiVUyIq36b6iDS5ZfKddYeGcQVxUgHOD+dvroZa3DG34R9ta+ZRWXaz5sx6hnFcjcvUGUUwmg4pwWw== 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=Y/3KxAppYgtYtjc+LM8IrjVW/hM0H6s7wmJOXJivOkw=; b=p9NUw/o3ICsACaiLdQlwuGKnBvrO+BIprx+yKiUe+tCv3X/cdEICT0G86jt3q0xCxQOe7vS8hTfzljsbC1Tryz+wc9g4eYsK1za4o6Y79xNyOjv2RDpCNr4UH9VTlfTi77s+tKOf+SqfnjRSBThiMHdSU56l/k9QmpAIL/SXpADgb4jqxPpiYUr6RHkPmWAkTKe8z4fhp/gSDtXoRN0gLd5gTQ/U7EksBEg3Ni6qot5hkuTF6cPmyl3H970okXJkSmDkGP8oKg1KqJ9R1lldig1I+6ZKOksoZTUkOBocjulS9JgJVmvfMQTS1p/MgusIA40mwL78VkzSRYYBvxPiqQ== 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 AMDPR10MB992270.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:70d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.639.8; Tue, 17 Nov 2026 14:42:27 +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.0639.006; Tue, 17 Nov 2026 14:42:27 +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 v2 3/6] wic: run the Python driver outside the imaging chroot Date: Tue, 17 Nov 2026 15:41:06 +0100 Message-ID: <20261117144109.2417395-4-clara.kowalsky@siemens.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261117144109.2417395-1-clara.kowalsky@siemens.com> References: <20261117144109.2417395-1-clara.kowalsky@siemens.com> X-ClientProxiedBy: FR4P281CA0371.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:f8::7) To AM0PR10MB9645.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:740::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR10MB9645:EE_|AMDPR10MB992270:EE_ X-MS-Office365-Filtering-Correlation-Id: bbc4763b-8c8f-4a81-7abb-08df44b9001b X-MS-Exchange-AtpMessageProperties: SA X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|1800799024|366016|376014|261102123227099003|261102130727099003|261028144727099003|261022075727099003|261022115727099003|261021121427099003|261021123027099003|261022105027099003|261021135927099003|261026140227099003|261026121527099003|5023799004|11063799006|56012099006|10067099003|18002099003|22082099003|55112099003|6133799003|261009223027099003|3023799007; X-Microsoft-Antispam-Message-Info: Nw9xxRbQF9Qd+mn1xhjuVSnoXkPIAOKE2m+yNGEArBbK0Kl8UyXiyHc8hmSCE4yHE5a98pnYd1JOPjcGSo4dFbU7SNunQOzyFk+lA34xbmB69uePh+Pm3v+HTVulT+Bm1VPc7mt/apoKeNcOaOzrVbgNdLTvPaLJ3mRfkQmtMYuO/Mxl9bwhGFhqq70cutFcNPFd8ZAeobs5CrRfsDD9TGNGefOu5xc6xgeRi8t4/dAfRiABwMzhoUy3YCHFB7wYWPSGgh1KDxt7DArDAh+UT7vkCw1uSWiCWsyUKzbiOGEzT8hPyqU6aaqdyy98YW0TeozqYoLAhwIiJ+EJZZvQOefXGgpn4X7XvWFsaZj2ZJaBgS9jR/X0EMTKhns7UjBQD5kA/SRHVivHNmbja38l0suJRkAgvPP2BmVBXatfb+GY3zdLMsyeJVQpxV2suIIb79j/61swpfmce4jErjMLeENzqFPNAhOG4UR63+g7fSYkCBkwBcvJzGWLxZDayL6jSIneCKCZ87GmspnhUxzGAuhSC3SWpUFCeT2pWHhTDyJlbZHetXocl7VD/uMZKAuoODJr+sC7YgQVG6rcsNkfSvZJ25vae04/c8rraxcl6+ovZ7nnaVfV2SM2yi0WeROPJWiV6V6nMyfDNyaEYSaVCJ08vR1NLyxNwLEYQWf9iy8= 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)(23010399003)(1800799024)(366016)(376014)(261102123227099003)(261102130727099003)(261028144727099003)(261022075727099003)(261022115727099003)(261021121427099003)(261021123027099003)(261022105027099003)(261021135927099003)(261026140227099003)(261026121527099003)(5023799004)(11063799006)(56012099006)(10067099003)(18002099003)(22082099003)(55112099003)(6133799003)(261009223027099003)(3023799007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dRKZarPrng4yOQczkCVCK4hbDrJOtup912IvgFPnkIlQGXlRHLQkuTmNk3TJ66aCJJkURWB5FMAtXwiedvz+sbzg8hs786Qc7BKvLTYbXFsOSFC7yY989RG0d2N0CbiN0oqhl6JjzI8gd5uzGKdUbTswnCXK+T8MMEd5/G6kPxOaO8Tdcw7dNDhejI0F8/9KC2oXjz1SQSSrR97GwDLEkC3JplreR8krNDM0dnrz7oyahxUKRBCk+wbHKNS4uz3SRAhKcT+I9tixBJuJQZceyJmQzudBPclfXr7i8tuuGf7fLHXQw6jeTx885G783a2oAQ7tggu/Aasi2+UHnlsIMq0WtPCadQ+S2dcR/Ta3XnXopIdaGUh1oJBvaLYGUi9cnZf3Tw913VxlmKAgCzgqSPi6k0hTIZwrdsLEc02vvoM5b0bds7ca+xx5H/vOHj/jESLnMWDZSvcr57nkZ7Jx6f8XiWEBOqfUqGEWnDs/avLfHope2TEgu1skY+E0fRH7ekW39hpb6TUZYLX6NHpwuodEl+b9f0zJyxqW2rq5kcGhhDWTpisYyuUCa8GbmoFvMifkRoKEcpRzVK2Ayu0UEEoSViSrT47pAZ4xzuvkfFpMcARedhyPtqtfYHHj3uTQFgynFX4VtXuwL2p/Im5rrXQ8s6ANMHZhzZgjSBisZ909Pbl/l6p+rHONvPqT46m0rA+scKwbRxYVQL2zy4M2ZWLD/ClEmNmRigYLFh/oVw9RRREbVYmFOzJoaiMOS4odRe6ZBU+p/q+yN3hXXp7VOmwGT7omZDSJGd2O2GipcycexAvXYKFlDypntvY0iT2VdNlm4LqwRRJVcj9TW/1blUAnx/ilg2/8JuaDS9/H5dxHWZ0pjuPmzdj1e4JqiGmkXLqR7xd5BfQxqE5dYRHruykoxI5lBqk7AlNqCcBt4xuBlQOA01ysnGIDJUdUGRxljnG1R/sVq8GANlSmYKuFkQkS8vhigyOzlEOK/vzU2eKub3F2b/26E24UuTgDabGQownWch0MzzMJ29J0MxT5PeXdNXRE2HPPiPMSZDJeBuV4bEZG6cMWxPQgJzSIYx40tFVRnmX0qGURI5NsTBnv/v6+om34BkuKqqpbhkLJ6I0DX2vHrBskNIJj+yv3mbFqchB/9Jw0zlf5lRat2/oJ6ah587jDKh9ao4+Y5Vx5kD9Ac6ICpk2jbH9uejPYoBK7B4ojrnIb1TsawsTp93QbryTENvXum6oqw2H+tdt1YLnJaaLx48e57XTi4LIy3ZXprEXHapWBg6SeU1mrq7FEpZrLHSPstejuKiZMQkNREHF8bTtB2a99exiiWX0phyQV9OfDydEhJSz30nbnA300NkVrnlMTX3rL9R7z7b/1PQT3kp0DCWxdNPHM9Jmb1nC3tgcWLBtpKN8ZcR6Cgpwf/8QMbmjfSpC5niiphVlrxn8rOdbJ3nhlJoGBcT2JFGU7lS8Zik1O95D7Kz6tqu+HLFd47Eemow3jTqTkUCSlV71LddMrCuG5mZkFC7C8lijqVjB5FgaKoKTrfPovW+HGCg8SmqzwGA2CIkQn8kEtxxN/i+Dx7l2nToBX8RKWJjj9tH51vssjj96CH5ZBjrDgjmaJgFB3o3f3hRon/hetUoOXncEXMDEhQxjxxW3xC7AKHvJUo1h0MNQHBtutHqhsKUIMuunWtZzw+4hAuAxiY28gSuFg2aHfr3UM65GWbpd8Ni57Wuac3WhLTo675felQehPrCUc5+4VUsv1PjRT158= X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-Network-Message-Id: bbc4763b-8c8f-4a81-7abb-08df44b9001b X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB9645.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2026 14:42:27.2790 (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: XU8eLqCArxM4+rAbuUN5neripwso0uBcX4ZFGWSuhoJ3O737Vai1NxlqxhCctl0H1SITEsJsvVrwuqLslQUp+NOpO9MDpuxsTO567WZJotg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AMDPR10MB992270 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=Y5fCeMhX; 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:c200::5 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_H2,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 the latest version: BitBake 2.8 to 2.18 require Python 3.8, BitBake 2.20 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.20 on an interpreter it does not support. Fix this by running WIC with the build host's Python, which BitBake itself already uses, and executing only the image utilities (e.g., mkfs, mtools, bmaptool) in the chroot. 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(). The WIC rootfs plugin routes its copy commands through WIC_TOOL_RUNNER when configured. 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. Signed-off-by: Clara Kowalsky Tested-by: Felix Moessbauer --- RECIPE-API-CHANGELOG.md | 17 +++++++ doc/technical_overview.md | 17 +++++++ .../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 | 8 ++- .../wic/plugins/source/bootimg-pcbios-isar.py | 6 ++- .../plugins/source/isoimage-isohybrid-isar.py | 4 +- .../lib/wic/plugins/source/rootfs-u-boot.py | 15 +++--- scripts/lib/wic/misc.py | 38 +++++++++++++- 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 | 45 +++++++++++++++-- scripts/wic-chroot | 38 ++++++++++++++ 17 files changed, 256 insertions(+), 43 deletions(-) create mode 100755 scripts/wic-chroot diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md index 3798a9d1..42641d9a 100644 --- a/RECIPE-API-CHANGELOG.md +++ b/RECIPE-API-CHANGELOG.md @@ -1225,3 +1225,20 @@ 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. Only the image utilities (e.g. mkfs tools, mtools, bmaptool) still run +in the chroot. By that, 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. + +Recipes can use the new `imager_run_host` instead of `imager_run` to run a +script on the host. It provides the same privilege handling and mounts and +sets `IMAGER_CHROOT` to the path of the prepared imaging chroot. + +Custom WIC plugins that start subprocesses directly must use `exec_cmd()` or +`exec_native_cmd()` from `wic.misc` to still run their tools in the chroot. +Native sysroot paths passed to such tools must be converted with +`get_native_path()`. The WIC work directory is now `${WORKDIR}/wic`. diff --git a/doc/technical_overview.md b/doc/technical_overview.md index 5d2e1b8a..d3d4e827 100644 --- a/doc/technical_overview.md +++ b/doc/technical_overview.md @@ -243,6 +243,23 @@ 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, so older target distributions 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. Native paths are +converted explicitly with `get_native_path` when constructing utility commands; +command text and non-path arguments are not rewritten. Rootfs copy helpers use +an optional command executor to route their utilities through the same runner, +without changing the default behavior for other callers. Plugins that launch +subprocesses directly must integrate with this runner to retain tool isolation. + ## 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..7fb5f448 100644 --- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py +++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py @@ -521,7 +521,13 @@ class BootimgEFIPlugin(SourcePlugin): 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 = kernel_dir + if os.environ.get('WIC_TOOL_RUNNER'): + tool_sysroot = os.environ.get('WIC_TOOL_SYSROOT') + if tool_sysroot: + efi_dir = os.path.join(tool_sysroot, kernel_dir.lstrip('/')) + + 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..9a7817e7 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) # allow plugins to import from isarpluginbase if '__file__' in globals(): @@ -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..ab10e391 100644 --- a/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py +++ b/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py @@ -17,6 +17,8 @@ import glob import logging import re import os +import shlex +import shutil from wic import WicError from wic.plugins.source.rootfs import RootfsPlugin @@ -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(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..dc6114a2 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,17 @@ 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 runtool(cmdln_or_args): """ wrapper for most of the subprocess calls input: @@ -62,10 +74,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 @@ -123,6 +143,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 +161,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 +292,9 @@ 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) + tool_sysroot = os.environ.get('WIC_TOOL_SYSROOT') + if tool_sysroot and value and var in ('RECIPE_SYSROOT_NATIVE', + 'STAGING_DATADIR', 'STAGING_LIBDIR'): + return os.path.join(tool_sysroot, value.lstrip('/')) + 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..a5e9b1d6 100644 --- a/scripts/lib/wic/plugins/source/rawcopy.py +++ b/scripts/lib/wic/plugins/source/rawcopy.py @@ -6,8 +6,7 @@ import logging import os -import signal -import subprocess +import shlex from wic import WicError from wic.pluginbase import SourcePlugin @@ -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,12 @@ 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'): + tool_sysroot = os.environ.get('WIC_TOOL_SYSROOT') + if tool_sysroot and os.path.isabs(src): + host_src = os.path.join(tool_sysroot, src.lstrip('/')) + if 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..aa0ccaec 100644 --- a/scripts/lib/wic/plugins/source/rootfs.py +++ b/scripts/lib/wic/plugins/source/rootfs.py @@ -13,15 +13,16 @@ import logging import os +import shlex import shutil import sys -from oe.path import copyhardlinktree 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_cmd, exec_native_cmd, + get_bitbake_var, get_native_path) logger = logging.getLogger('wic') @@ -63,6 +64,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 @@ -70,6 +72,43 @@ class RootfsPlugin(SourcePlugin): pseudo += "%s " % get_bitbake_var("FAKEROOTCMD") return pseudo + @staticmethod + def __chroot_path(path): + path = os.path.realpath(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 + + @classmethod + def __copy_rootfs_command(cls, command, cwd=None): + if cwd: + command = "cd %s && %s" % (shlex.quote(cls.__chroot_path(cwd)), command) + return exec_cmd(command, as_shell=True) + + @classmethod + def __copy_rootfs_tree(cls, src, dst): + os.makedirs(dst, exist_ok=True) + src_path = shlex.quote(cls.__chroot_path(src)) + dst_path = shlex.quote(cls.__chroot_path(dst)) + command = "tar --xattrs --xattrs-include='*' -cf - -S -C %s -p . | " \ + "tar --xattrs --xattrs-include='*' -xf - -C %s" % (src_path, dst_path) + cls.__copy_rootfs_command(command) + @classmethod def do_prepare_partition(cls, part, source_params, cr, cr_workdir, oe_builddir, bootimg_dir, kernel_dir, @@ -122,7 +161,7 @@ class RootfsPlugin(SourcePlugin): orig_dir = cls.__validate_path("--change-directory", part.rootfs_dir, cd) else: orig_dir = part.rootfs_dir - copyhardlinktree(orig_dir, new_rootfs) + cls.__copy_rootfs_tree(orig_dir, new_rootfs) # Convert the pseudo directory to its new location if (pseudo_dir): diff --git a/scripts/wic-chroot b/scripts/wic-chroot new file mode 100755 index 00000000..e1a8d858 --- /dev/null +++ b/scripts/wic-chroot @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 +# This software is a part of Isar. +# Copyright (C) Siemens AG, 2026 +# +# SPDX-License-Identifier: MIT + +import os +import sys + + +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') + + 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', workdir, *sys.argv[1:], + ]) + + +if __name__ == '__main__': + try: + main() + except OSError as err: + sys.exit(f'wic-chroot: {err}')