From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7088977375648546816 X-Received: by 2002:a05:6402:84e:b0:422:b76c:bef8 with SMTP id b14-20020a056402084e00b00422b76cbef8mr28266287edz.238.1650531756145; Thu, 21 Apr 2022 02:02:36 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a17:906:6a19:b0:6f0:c0b:9786 with SMTP id qw25-20020a1709066a1900b006f00c0b9786ls2068676ejc.6.gmail; Thu, 21 Apr 2022 02:02:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVl7tYp9829s04ZSOP+qDfvm0TO0SqiiFem9Gn6cuSv/XqQz5o3l0hgWssYl/qU+QicTLY X-Received: by 2002:a17:907:d26:b0:6f0:2a0:d3d5 with SMTP id gn38-20020a1709070d2600b006f002a0d3d5mr5978446ejc.608.1650531755128; Thu, 21 Apr 2022 02:02:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1650531755; cv=pass; d=google.com; s=arc-20160816; b=qJfTOcsgYVEyZD7r1S7AoPeQLjZ6txSf0OOI3kCIfwy+FOIl21GIpJ0G41B+MtRpfZ c/zka7VjCfeNcJOkh6kPcBfSALJ3DuJ9blklx9stF+JIVjtOi8E3CCYJujhSJ0pa95KZ DZSEWN638/O/offLom+jOCMB33A5/+IjX9DwteqEkMtObFKaUZp+hY2Mkq5Q/HXqFM5/ J08I8VcpuCmJwZSdxgiRat+G+eW0euu7m79VQnDYg2Jw+ZuO/EHds9rCB0tcHZJuRenQ k6BNOiGGFV5Mmr/rlOHf7lql7pFWkVFJuXiiZeg5PSHBYV9LjVnYcTKDOOmERMy/ZRP9 Uaow== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:content-transfer-encoding:references:in-reply-to :message-id:subject:cc:to:from:date:dkim-signature; bh=3IvZrGmeBS7WizmS+M5GWaklPGXUuspsF6RvPDoT5Vc=; b=kwZfHVcM/hHHIwGCXnJESCwec+7khho5BcbWLV4rD6EvFHplz6DqH0Qi3BQZ3GSppx D7Bpsy9WZEVSwLtTzXPnnST5j8RFyYIGVmOKM23wxOu8uHZkI9hliwyV6lzQLS0LRd81 QN/3MHomN71VUDcqfoJfhZntJSifVoZJ3ue/KfUzTmBZVwIlOteuteVV7qTibMq2SWJI J6uy1cM/ftX1Ymvt/S2dPfbRufmCrwjAWDsTq7Gp/SWUoYCB1ckaDrIrBnsoT900lJBG IP6PwZ+dMxaqeUKbHo7SaZdF3/QzPUC7LBJab2hnDHdQmO/utu80GVR3YdmiDjOeXzY7 yHzA== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=U8523V79; 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 henning.schild@siemens.com designates 2a01:111:f400:7e1a::61a as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2061a.outbound.protection.outlook.com. [2a01:111:f400:7e1a::61a]) by gmr-mx.google.com with ESMTPS id s4-20020a170906354400b006e8421b806dsi209456eja.1.2022.04.21.02.02.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Apr 2022 02:02:35 -0700 (PDT) Received-SPF: pass (google.com: domain of henning.schild@siemens.com designates 2a01:111:f400:7e1a::61a as permitted sender) client-ip=2a01:111:f400:7e1a::61a; Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=U8523V79; 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 henning.schild@siemens.com designates 2a01:111:f400:7e1a::61a as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oEQns2v0q4yrZxXFsUGRIY8cXT2mkByBfTJ5vySf5yuVidZWX5aAdmhsSc7XGQEhnBb3p6UnkjabaO0+1PV8SAdGRai6/DGDGhTmJwejRsPyDv4VWvLfcO5RHqwneKXSHbmHhtCaam3YdJ9+o1ZL+HsPpUn93klpf8+DTK1GQidqwqTX6rGKoAHQnDFo/QoUM3m48/oV363GJyXQBzqyAUDuREwigxxE1O/UPekn1Bo5fIvgZFQZ8YPzLcgXC7+8RKOOWgjV6a3iYOZho1uzD8/eSHstZlYWNMD5kFU69m6ULYa4WlbpbQvoWTAjHFRwOLe9J4n3zXBWsdeH52KQAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=3IvZrGmeBS7WizmS+M5GWaklPGXUuspsF6RvPDoT5Vc=; b=N1QZLuQ1MKfkuGxD80JmJxK+3G+kkJE6C43Nkm8zdexI/NC3ByuPNnXK+6Tv4OCFteqw9HPJW4zsQYFIw2AkQsC6M7BXSh6QuHe+mFYw1qPoSuy3G7hPnWjGdcZfeUcC5gkFEPpMPZjZx1PEI2I5NRNV5b1va6jjy+Y5CeX6FH6j01RN5cb7AsVJkrqlzPRXg4HpMncTTTnWs7GmR7glPIF9NA5Hzsz8yLCuRFdk2EBDTFaCRdHCMKtSckuknSfHOjw7S2M3/02rvVKDn9OAPmrN4DFMkCQEcRsg+G5ci7QwPj8zLTgSLOp+lNd6t+FH/si2p3yK/ypJaAxLaYNxjA== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=siemens.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3IvZrGmeBS7WizmS+M5GWaklPGXUuspsF6RvPDoT5Vc=; b=U8523V79A00a1dquv6cpMVdzUOF7KXb8hnHFz5oNODQGOweil3ddY2fv8efoYV6Q8CIAmxGoHkmqiiXQb+EVAOqsbTBAYCkoCIoqCl1WxCMU6d7r4EeAFDCEZ+AoRrZaGL0q4F2+2mo2vPwFFQRlZZAiLkkAlpdZZ9fZjMEtDYRnpUFnHmhh+1GJxlz+JqAulxP37/D/woWKRnLEUXkirzM2neTOEC/NpMcsXi/MS/kaRdfutPh01jXpMZktCNa7ATKrDEaPYk8asruMUi1ge6lnPVLFTGqeCnAZVz1YO/lXOLNk8zOrFVpgI8tBzidrxYA0RhrmgOWqMgq1qO9I2g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=siemens.com; Received: from PA4PR10MB5780.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:269::8) by VI1PR10MB2432.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:7d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.14; Thu, 21 Apr 2022 09:02:33 +0000 Received: from PA4PR10MB5780.EURPRD10.PROD.OUTLOOK.COM ([fe80::f4be:8b5d:4314:c2d8]) by PA4PR10MB5780.EURPRD10.PROD.OUTLOOK.COM ([fe80::f4be:8b5d:4314:c2d8%4]) with mapi id 15.20.5186.014; Thu, 21 Apr 2022 09:02:33 +0000 Date: Thu, 21 Apr 2022 11:02:28 +0200 From: Henning Schild To: isar-users Cc: Florian Bezdeka , Felix Moessbauer Subject: Re: [PATCH v2 2/2] wic: Update to the latest revision Message-ID: <20220421110228.61a065db@md1za8fc.ad001.siemens.net> In-Reply-To: <20220421085232.1949-3-henning.schild@siemens.com> References: <20220421085232.1949-1-henning.schild@siemens.com> <20220421085232.1949-3-henning.schild@siemens.com> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-ClientProxiedBy: AS9PR04CA0031.eurprd04.prod.outlook.com (2603:10a6:20b:46a::10) To PA4PR10MB5780.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:269::8) Return-Path: henning.schild@siemens.com MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fd518696-3f7b-4a67-ba1a-08da2375abfc X-MS-TrafficTypeDiagnostic: VI1PR10MB2432:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Us2dpvVcQuFVEcAfQSVxK3coo+vmKieiTGFiG69B1IUn+6YpRse1jpVFqtsLHZ4AsLroqEof/Zd0jTDuqh3nDKVcaqFt3vrtuYZl8dlgUzuUHzE9qruO8WET1Hfkn0Ra64vjwqkyqcyO8Un30FAX2KblXBmaSdZA0n1yAt47SD6CSnXnyHQPnUZZ/DskFBEm4be4xHk7DUzHntU1rOtYC+f0iyFoyjjkQISFQ+emEwp4+rTWOLXXY5dcSD3xQQDATpr93w6Pa1I7kN2ahktU7wzakNYA5ea6P7TS+NTc2VC/m3Yw+kHxISChWEBZC/MwQ1zBic8ymji6tqfQ/A5+vo1KTKDiPSfpQEjLRQYGi+H+c7WBdpcwwA8ohGTB9rGj9eqeo0+ni4YHd7Y+wJX/5McblNHX6EvmFk1I2cOgfaKGkS0r08V53PB3cw4KiX7L4mVHmfy4bmUwIkLJAIkLV4PsjFO/JEb9O1Jk9Y0FjBRXDLwCcxfmJAq2CLybUZYtLQqobfg5l1t3ATQKD7h8f+cB/PWx86B/l3oyVjZbNeuLt+k96zprWt5m2fmetZ0qNwsVgMH2ygtZnVVhbspGOPUtBWUmbEdj9fGg0urWUlqfZT+HQYu2wwsubsjWmatpqlpw5RY9lJhAQrfo0tGBdvk2X8zDkcUJdvn3CZA1nDrEB+3fnSfoCmJYlICNuHN2OYK0fTugcasOh1Z64BrOL8h060E8hqWak8QfdNV9r+g= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PA4PR10MB5780.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(26005)(6512007)(508600001)(9686003)(966005)(86362001)(107886003)(6486002)(66476007)(1076003)(8936002)(2906002)(15650500001)(6666004)(5660300002)(83380400001)(6506007)(186003)(44832011)(30864003)(66556008)(38100700002)(66946007)(54906003)(6916009)(8676002)(4326008)(316002)(82960400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?0rpH2aO8GvcHTOBxJwR0dlAP/558/+SrFl/4gKfzQBVcTqxrkaiyDagnnmuV?= =?us-ascii?Q?dcUVNLUPf4pNvI5GMmFJlKP+k/ChMjtSFXI9eQ0oJNnj6eG0u8qxCFQbuNKZ?= =?us-ascii?Q?XqxpcL2vwkHSWNLom5cEpkISq+0FWx4dP59+2zxk9YLZcU25eL07KNSp9TRq?= =?us-ascii?Q?Hu0HqC3+mRsrQM9LlPqRN718WXBMH/IP/IxEdEfCXiwIbvz+zxxQJMW+ydL1?= =?us-ascii?Q?BRtY1BGUtpGwZyjkK+Fzt17KIOXhyWu+nTPY4Bk7KW2XM38v6c1NEE4PTUX7?= =?us-ascii?Q?TfuijEA/08+Kvii4FgjqbV9eXzsFDlO1RUnvkpssPCjB/0UyOmS6Gm1Ilyr1?= =?us-ascii?Q?L5kN24tPMuA1quWL1YLOX1yZWlDRj+rNYNPO5j1rFZ9/ev0HEy7XYN5RIOgn?= =?us-ascii?Q?/zcXVU678VtWIZzD4WrRHsCjfrl6mUpAsWDKcTVTmitXTlkjoHKZBs7bPOrl?= =?us-ascii?Q?bQTdi4l1bXT2yJuyRHec9tbm/1s5K6cal9LJ8Wgf4WU63zUGRVufRzj3uQYW?= =?us-ascii?Q?fJXpFM36h8GkZJEBxLthgw3kRA9bskqgoD3TwAKDDOOfuu1S74DN9CYRJHMt?= =?us-ascii?Q?V/ccWlvUGTbRxv8J8olvgBuSKLmV2y7b4f34PLPtmQcZAq8+/zCxXTjBCibs?= =?us-ascii?Q?v2DTMUif/qU4dh6ZIV6yqAb0Ez0lAvw5JjmZ7YyNbGjOlXbD+Rh14nfRPt5o?= =?us-ascii?Q?4yh9ftV4MUZSIR3G+IDPxQmALuY11n6QOcaoNhTD0obadCXaoePFotaU4iwa?= =?us-ascii?Q?/6g2o4ujY09+kdOrKtGhbmL9JFVihR+94wNrCqfeJNzhuX4JotpfX016p01g?= =?us-ascii?Q?2lvFpIxX22AP6AvqSbbAe5dpcwuhPECq0C8zbLAZB7uE9Tw4H0JfwTpL4Rkl?= =?us-ascii?Q?AFIdMUfLDIBWl1oA7n/zzrb0D40Nrk6+lIn/SvpMCP89IFSZH+ZSq3jV3/2d?= =?us-ascii?Q?Xn0nEe4MRJAKuX4HpNJw7hhDZS9uayFoe60n5DRFU+hhifZub9GdUDp0dmz9?= =?us-ascii?Q?QP9R+72lno3qZsw9qsRpVvesqJTD+JXA+SJtgUMiuBjz1yrxoEbBCiT+hFui?= =?us-ascii?Q?j6naN0TVXyB6H58gr8U36iUo4FaC9AxEMgNal3NdXal0bRK5vmcTy4JwdJEH?= =?us-ascii?Q?aQPZWSu6EblnqVAxyK+U82NqvCwBw1JTPJv6rr2LZ2xnfYwTh+bgk+ET1izv?= =?us-ascii?Q?SR62ffyCSyLwhBL9b4RHfKxGmXr2OCQ62p1VGInN+L1tAKVdbRMJI8AIlOS3?= =?us-ascii?Q?QsZDFT0tWEn2aL8nEFTZHvvmvpcf4Wh5dL2QtTP4ld4x6qgNJHkyydtTFvsD?= =?us-ascii?Q?/jaTVrzXEbTJ3Nu6qnPfR5SCMdQSV1mJcFGfjvsq+FlhiS8X5+pWh4S3wJv8?= =?us-ascii?Q?46YdajDZaguwK0Wpy9sB6XaqVcV1KsNk903CtUsAioo7WfvXgViHhcK0KDHq?= =?us-ascii?Q?CQ8xH0PNaezEu/BOogM/UdFz2D0Ha/3lEEXI1OWtRx946mL5oXFWCSvW3Yyd?= =?us-ascii?Q?A7vHIUl2nkKLDkDjD86UH80x4ILqz8FCTYtQjIdyyVgHBJgAL/Xw5g8zrlmZ?= =?us-ascii?Q?a/dzgf38bQ+YEBobrA24kRa1lZC6YML5hM087/HxWQRI0F3whGJ4hsJ/zHKk?= =?us-ascii?Q?7/cMDljvwazPoidtklUQGZ8p13KLzkHFB/ZiXqgZA0SF+wIwEC//nYlGHHtA?= =?us-ascii?Q?PCAsPM1mN73gnmdZneYZXsCSiipBQ+HwFiFTp/GviF/aKJkV7c+V1WD8JzdE?= =?us-ascii?Q?Ehjc+EGVRvmQ84fDoupxR3q5LyVeub8KXh/nZ16EfZqpJck325Wr?= X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd518696-3f7b-4a67-ba1a-08da2375abfc X-MS-Exchange-CrossTenant-AuthSource: PA4PR10MB5780.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2022 09:02:33.1208 (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: zR3j8w217geNx+H9H8g1/7ZMlNIy5455zLIVjv6VDwTmyKFSVuDBaPRdVlcC+jLbuEesLmvaaz+W9KOZV3Dcoj0BEQ85452eYskz5IyVpmo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB2432 X-TUID: gZYmK1VNa9ju Am Thu, 21 Apr 2022 10:52:32 +0200 schrieb Henning Schild : > Update to the latest wic from OE-core. > > OE-core Revision: 712552b5cc427d7be1258c45886de9b57f7272c9 > > Signed-off-by: Henning Schild > --- > .../wic/plugins/source/bootimg-efi-isar.py | 77 > ++++++++++++++++--- .../wic/plugins/source/bootimg-pcbios-isar.py | > 6 +- scripts/lib/wic/canned-wks/common.wks.inc | 2 +- > scripts/lib/wic/canned-wks/directdisk-gpt.wks | 2 +- > scripts/lib/wic/canned-wks/mkefidisk.wks | 2 +- > scripts/lib/wic/engine.py | 6 +- > scripts/lib/wic/help.py | 10 ++- > scripts/lib/wic/ksparser.py | 8 +- > scripts/lib/wic/misc.py | 4 +- > scripts/lib/wic/partition.py | 25 ++++-- > scripts/lib/wic/pluginbase.py | 8 +- > scripts/lib/wic/plugins/imager/direct.py | 11 ++- > scripts/lib/wic/plugins/source/bootimg-efi.py | 74 +++++++++++++++--- > .../lib/wic/plugins/source/bootimg-pcbios.py | 6 +- > scripts/lib/wic/plugins/source/rawcopy.py | 35 ++++++++- > scripts/lib/wic/plugins/source/rootfs.py | 2 +- > scripts/wic | 9 ++- > 17 files changed, 231 insertions(+), 56 deletions(-) > > 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 > 5ba0777ad244..a24e04f309da 100644 --- > a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py +++ > b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py @@ -12,6 > +12,7 @@ > import logging > import os > +import tempfile > import shutil > import re > > @@ -129,12 +130,13 @@ class BootimgEFIPlugin(SourcePlugin): > bootloader = creator.ks.bootloader > > loader_conf = "" > - loader_conf += "default boot\n" > + if source_params.get('create-unified-kernel-image') != > "true": > + loader_conf += "default boot\n" > loader_conf += "timeout %d\n" % bootloader.timeout > > initrd = source_params.get('initrd') > > - if initrd: > + if initrd and > source_params.get('create-unified-kernel-image') != "true": # > obviously we need to have a common common deploy var bootimg_dir = > get_bitbake_var("DEPLOY_DIR_IMAGE") if not bootimg_dir: > @@ -195,11 +197,12 @@ class BootimgEFIPlugin(SourcePlugin): > for rd in initrds: > boot_conf += "initrd /%s\n" % rd > > - logger.debug("Writing systemd-boot config " > - "%s/hdd/boot/loader/entries/boot.conf", > cr_workdir) > - cfg = open("%s/hdd/boot/loader/entries/boot.conf" % > cr_workdir, "w") > - cfg.write(boot_conf) > - cfg.close() > + if source_params.get('create-unified-kernel-image') != > "true": > + logger.debug("Writing systemd-boot config " > + "%s/hdd/boot/loader/entries/boot.conf", > cr_workdir) > + cfg = open("%s/hdd/boot/loader/entries/boot.conf" % > cr_workdir, "w") > + cfg.write(boot_conf) > + cfg.close() > > > @classmethod > @@ -300,11 +303,63 @@ class BootimgEFIPlugin(SourcePlugin): > kernel = "%s-%s.bin" % \ > (get_bitbake_var("KERNEL_IMAGETYPE"), > get_bitbake_var("INITRAMFS_LINK_NAME")) > - install_cmd = "install -m 0644 %s/%s %s/%s" % \ > - (staging_kernel_dir, kernel, hdddir, kernel) > + if source_params.get('create-unified-kernel-image') == > "true": > + initrd = source_params.get('initrd') > + if not initrd: > + raise WicError("initrd= must be specified when > create-unified-kernel-image=true, exiting") + > + deploy_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") > + efi_stub = glob("%s/%s" % (deploy_dir, > "linux*.efi.stub")) > + if len(efi_stub) == 0: > + raise WicError("Unified Kernel Image EFI stub not > found, exiting") > + efi_stub = efi_stub[0] > + > + with tempfile.TemporaryDirectory() as tmp_dir: > + label = source_params.get('label') > + label_conf = "root=%s" % creator.rootdev > + if label: > + label_conf = "LABEL=%s" % label > + > + bootloader = creator.ks.bootloader > + cmdline = open("%s/cmdline" % tmp_dir, "w") > + cmdline.write("%s %s" % (label_conf, > bootloader.append)) > + cmdline.close() > + > + initrds = initrd.split(';') > + initrd = open("%s/initrd" % tmp_dir, "wb") > + for f in initrds: > + with open("%s/%s" % (deploy_dir, f), 'rb') as > in_file: > + shutil.copyfileobj(in_file, initrd) > + initrd.close() > + > + # Searched by systemd-boot: > + # > https://systemd.io/BOOT_LOADER_SPECIFICATION/#type-2-efi-unified-kernel-images > + install_cmd = "install -d %s/EFI/Linux" % hdddir > + exec_cmd(install_cmd) > + > + staging_dir_host = > get_bitbake_var("STAGING_DIR_HOST") + > + # > https://www.freedesktop.org/software/systemd/man/systemd-stub.html > + objcopy_cmd = "objcopy \ > + --add-section .osrel=%s --change-section-vma > .osrel=0x20000 \ > + --add-section .cmdline=%s --change-section-vma > .cmdline=0x30000 \ > + --add-section .linux=%s --change-section-vma > .linux=0x2000000 \ > + --add-section .initrd=%s --change-section-vma > .initrd=0x3000000 \ > + %s %s" % \ > + ("%s/usr/lib/os-release" % staging_dir_host, > + cmdline.name, > + "%s/%s" % (staging_kernel_dir, kernel), > + initrd.name, > + efi_stub, > + "%s/EFI/Linux/linux.efi" % hdddir) > + exec_cmd(objcopy_cmd) > + else: > + install_cmd = "install -m 0644 %s/%s %s/%s" % \ > + (staging_kernel_dir, kernel, hdddir, kernel) > + > + install_cmd = > isar_populate_boot_cmd(rootfs_dir['ROOTFS_DIR'], hdddir) > + exec_cmd(install_cmd) > > - install_cmd = > isar_populate_boot_cmd(rootfs_dir['ROOTFS_DIR'], hdddir) > - exec_cmd(install_cmd) > > if get_bitbake_var("IMAGE_EFI_BOOT_FILES"): > for src_path, dst_path in cls.install_task: > 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 > 9136d4f215ca..7fb0f2a87394 100644 --- > a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py +++ > b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py @@ > -213,8 +213,10 @@ class BootimgPcbiosIsarPlugin(SourcePlugin): # > dosfs image, created by mkdosfs bootimg = "%s/boot%s.img" % > (cr_workdir, part.lineno) > - dosfs_cmd = "mkdosfs -n boot -i %s -S 512 -C %s %d" % \ > - (part.fsuuid, bootimg, blocks) > + label = part.label if part.label else "boot" > + > + dosfs_cmd = "mkdosfs -n %s -i %s -S 512 -C %s %d" % \ > + (label, part.fsuuid, bootimg, blocks) > exec_native_cmd(dosfs_cmd, native_sysroot) > > mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (bootimg, hdddir) > diff --git a/scripts/lib/wic/canned-wks/common.wks.inc > b/scripts/lib/wic/canned-wks/common.wks.inc index > 4fd29fa8c119..89880b417b6e 100644 --- > a/scripts/lib/wic/canned-wks/common.wks.inc +++ > b/scripts/lib/wic/canned-wks/common.wks.inc @@ -1,3 +1,3 @@ > # This file is included into 3 canned wks files from this directory > part /boot --source bootimg-pcbios --ondisk sda --label boot > --active --align 1024 -part / --source rootfs --use-uuid > --fstype=ext4 --mkfs-extraopts "-T default" --label platform --align > 1024 +part / --source rootfs --use-uuid --fstype=ext4 --label > platform --align 1024 diff --git This is https://github.com/openembedded/openembedded-core/commit/7e8017208bed98b6c90735cb641fc9d7aedf9140 and it was not taken for our forks in meta-isar/scripts/lib/wic/canned-wks/ Because we can not be sure to have a brandnew e2fsprogs always. With scripts/wic_fakeroot we have a way to centrally hook into wic plugins and play with arguments. But i think having our forked wks files is nicer and we might eventually be able to drop wic_fakeroot, at the moment it only deals with one remaining hack for old e2fsck Henning > a/scripts/lib/wic/canned-wks/directdisk-gpt.wks > b/scripts/lib/wic/canned-wks/directdisk-gpt.wks index > cf16c0c30bbd..8d7d8de6ea7e 100644 --- > a/scripts/lib/wic/canned-wks/directdisk-gpt.wks +++ > b/scripts/lib/wic/canned-wks/directdisk-gpt.wks @@ -4,7 +4,7 @@ > part /boot --source bootimg-pcbios --ondisk sda --label boot > --active --align 1024 -part / --source rootfs --ondisk sda > --fstype=ext4 --mkfs-extraopts "-T default" --label platform --align > 1024 --use-uuid +part / --source rootfs --ondisk sda --fstype=ext4 > --label platform --align 1024 --use-uuid bootloader --ptable gpt > --timeout=0 --append="rootwait rootfstype=ext4 video=vesafb > vga=0x318 console=tty0 console=ttyS0,115200n8" diff --git > a/scripts/lib/wic/canned-wks/mkefidisk.wks > b/scripts/lib/wic/canned-wks/mkefidisk.wks index > d1878e23e5a3..9f534fe18471 100644 --- > a/scripts/lib/wic/canned-wks/mkefidisk.wks +++ > b/scripts/lib/wic/canned-wks/mkefidisk.wks @@ -4,7 +4,7 @@ > part /boot --source bootimg-efi --sourceparams="loader=grub-efi" > --ondisk sda --label msdos --active --align 1024 > -part / --source rootfs --ondisk sda --fstype=ext4 --mkfs-extraopts > "-T default" --label platform --align 1024 --use-uuid +part / > --source rootfs --ondisk sda --fstype=ext4 --label platform --align > 1024 --use-uuid part swap --ondisk sda --size 44 --label swap1 > --fstype=swap > diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py > index 018815b96688..674ccfc24418 100644 > --- a/scripts/lib/wic/engine.py > +++ b/scripts/lib/wic/engine.py > @@ -19,10 +19,10 @@ import os > import tempfile > import json > import subprocess > +import shutil > import re > > from collections import namedtuple, OrderedDict > -from distutils.spawn import find_executable > > from wic import WicError > from wic.filemap import sparse_copy > @@ -245,7 +245,7 @@ class Disk: > for path in pathlist.split(':'): > self.paths = "%s%s:%s" % (native_sysroot, path, > self.paths) > - self.parted = find_executable("parted", self.paths) > + self.parted = shutil.which("parted", path=self.paths) > if not self.parted: > raise WicError("Can't find executable parted") > > @@ -283,7 +283,7 @@ class Disk: > "resize2fs", "mkswap", "mkdosfs", > "debugfs","blkid"): aname = "_%s" % name > if aname not in self.__dict__: > - setattr(self, aname, find_executable(name, > self.paths)) > + setattr(self, aname, shutil.which(name, > path=self.paths)) if aname not in self.__dict__ or > self.__dict__[aname] is None: raise WicError("Can't find executable > '{}'".format(name)) return self.__dict__[aname] > diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py > index bd3a2b97dfaf..4ff7470a6a79 100644 > --- a/scripts/lib/wic/help.py > +++ b/scripts/lib/wic/help.py > @@ -637,7 +637,7 @@ DESCRIPTION > oe-core: directdisk.bbclass and mkefidisk.sh. The difference > between wic and those examples is that with wic the functionality > of those scripts is implemented by a general-purpose partitioning > - 'language' based on Redhat kickstart syntax). > + 'language' based on Red Hat kickstart syntax). > > The initial motivation and design considerations that lead to the > current tool are described exhaustively in Yocto Bug #3847 > @@ -840,8 +840,8 @@ DESCRIPTION > meanings. The commands are based on the Fedora kickstart > documentation but with modifications to reflect wic capabilities. > > - > http://fedoraproject.org/wiki/Anaconda/Kickstart#part_or_partition > - http://fedoraproject.org/wiki/Anaconda/Kickstart#bootloader > + > https://pykickstart.readthedocs.io/en/latest/kickstart-docs.html#part-or-partition > + > https://pykickstart.readthedocs.io/en/latest/kickstart-docs.html#bootloader > Commands > > @@ -930,6 +930,7 @@ DESCRIPTION > ext4 > btrfs > squashfs > + erofs > swap > > --fsoptions: Specifies a free-form string of options to be > @@ -990,6 +991,9 @@ DESCRIPTION > multiple partitions and we want to keep > the right permissions and usernames in all the partitions. > > + --no-fstab-update: This option is specific to wic. It does > not update the > + '/etc/fstab' stock file for the given > partition. + > --extra-space: This option is specific to wic. It adds extra > space after the space filled by the content > of the partition. The final size can go > diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py > index 3eb669da39ca..0df9eb0d057d 100644 > --- a/scripts/lib/wic/ksparser.py > +++ b/scripts/lib/wic/ksparser.py > @@ -157,7 +157,8 @@ class KickStart(): > part.add_argument('--fsoptions', dest='fsopts') > part.add_argument('--fstype', default='vfat', > choices=('ext2', 'ext3', 'ext4', 'btrfs', > - 'squashfs', 'vfat', 'msdos', > 'swap')) > + 'squashfs', 'vfat', 'msdos', > 'erofs', > + 'swap')) > part.add_argument('--mkfs-extraopts', default='') > part.add_argument('--label') > part.add_argument('--use-label', action='store_true') > @@ -184,6 +185,7 @@ class KickStart(): > part.add_argument('--use-uuid', action='store_true') > part.add_argument('--uuid') > part.add_argument('--fsuuid') > + part.add_argument('--no-fstab-update', action='store_true') > > bootloader = subparsers.add_parser('bootloader') > bootloader.add_argument('--append') > @@ -229,6 +231,10 @@ class KickStart(): > err = "%s:%d: SquashFS does not > support LABEL" \ % (confpath, lineno) > raise KickStartError(err) > + # erofs does not support filesystem labels > + if parsed.fstype == 'erofs' and parsed.label: > + err = "%s:%d: erofs does not support > LABEL" % (confpath, lineno) > + raise KickStartError(err) > if parsed.fstype == 'msdos' or parsed.fstype > == 'vfat': if parsed.fsuuid: > if > parsed.fsuuid.upper().startswith('0X'): diff --git > a/scripts/lib/wic/misc.py b/scripts/lib/wic/misc.py index > 57c042c503e6..3e118229960b 100644 --- a/scripts/lib/wic/misc.py > +++ b/scripts/lib/wic/misc.py > @@ -16,9 +16,9 @@ import logging > import os > import re > import subprocess > +import shutil > > from collections import defaultdict > -from distutils import spawn > > from wic import WicError > > @@ -122,7 +122,7 @@ def find_executable(cmd, paths): > if provided and "%s-native" % recipe in provided: > return True > > - return spawn.find_executable(cmd, paths) > + return shutil.which(cmd, path=paths) > > def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""): > """ > diff --git a/scripts/lib/wic/partition.py > b/scripts/lib/wic/partition.py index 76d144d12d30..09e491dd494d 100644 > --- a/scripts/lib/wic/partition.py > +++ b/scripts/lib/wic/partition.py > @@ -54,6 +54,7 @@ class Partition(): > self.uuid = args.uuid > self.fsuuid = args.fsuuid > self.type = args.type > + self.no_fstab_update = args.no_fstab_update > self.updated_fstab_path = None > self.has_fstab = False > self.update_fstab_in_rootfs = False > @@ -104,7 +105,7 @@ class Partition(): > extra_blocks = self.extra_space > > rootfs_size = actual_rootfs_size + extra_blocks > - rootfs_size *= self.overhead_factor > + rootfs_size = int(rootfs_size * self.overhead_factor) > > logger.debug("Added %d extra blocks to %s to get to %d > total blocks", extra_blocks, self.mountpoint, rootfs_size) > @@ -141,9 +142,9 @@ class Partition(): > native_sysroot) > self.source_file = "%s/fs.%s" % (cr_workdir, > self.fstype) else: > - if self.fstype == 'squashfs': > - raise WicError("It's not possible to create > empty squashfs " > - "partition '%s'" % > (self.mountpoint)) > + if self.fstype in ('squashfs', 'erofs'): > + raise WicError("It's not possible to create > empty %s " > + "partition '%s'" % (self.fstype, > self.mountpoint)) > rootfs = "%s/fs_%s.%s.%s" % (cr_workdir, self.label, > self.lineno, > self.fstype) @@ -170,7 +171,7 @@ class Partition(): > # Split sourceparams string of the form > key1=val1[,key2=val2,...] # into a dict. Also accepts valueless keys > i.e. without = splitted = self.sourceparams.split(',') > - srcparams_dict = dict(par.split('=', 1) for par in > splitted if par) > + srcparams_dict = dict((par.split('=', 1) + [None])[:2] > for par in splitted if par) > plugin = PluginMgr.get_plugins('source')[self.source] > plugin.do_configure_partition(self, srcparams_dict, creator, > @@ -286,7 +287,7 @@ class Partition(): > (self.fstype, extraopts, rootfs, label_str, self.fsuuid, > rootfs_dir) exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) > > - if self.updated_fstab_path and self.has_fstab: > + if self.updated_fstab_path and self.has_fstab and not > self.no_fstab_update: debugfs_script_path = os.path.join(cr_workdir, > "debugfs_script") with open(debugfs_script_path, "w") as f: > f.write("cd etc\n") > @@ -350,7 +351,7 @@ class Partition(): > mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (rootfs, rootfs_dir) > exec_native_cmd(mcopy_cmd, native_sysroot) > > - if self.updated_fstab_path and self.has_fstab: > + if self.updated_fstab_path and self.has_fstab and not > self.no_fstab_update: mcopy_cmd = "mcopy -i %s %s ::/etc/fstab" % > (rootfs, self.updated_fstab_path) exec_native_cmd(mcopy_cmd, > native_sysroot) > @@ -369,6 +370,16 @@ class Partition(): > (rootfs_dir, rootfs, extraopts) > exec_native_cmd(squashfs_cmd, native_sysroot, pseudo=pseudo) > > + def prepare_rootfs_erofs(self, rootfs, cr_workdir, oe_builddir, > rootfs_dir, > + native_sysroot, pseudo): > + """ > + Prepare content for a erofs rootfs partition. > + """ > + extraopts = self.mkfs_extraopts or '' > + erofs_cmd = "mkfs.erofs %s -U %s %s %s" % \ > + (extraopts, self.fsuuid, rootfs, rootfs_dir) > + exec_native_cmd(erofs_cmd, native_sysroot, pseudo=pseudo) > + > def prepare_empty_partition_ext(self, rootfs, oe_builddir, > native_sysroot): > """ > diff --git a/scripts/lib/wic/pluginbase.py > b/scripts/lib/wic/pluginbase.py index d9b4e57747e7..b64568339b1b > 100644 --- a/scripts/lib/wic/pluginbase.py > +++ b/scripts/lib/wic/pluginbase.py > @@ -9,9 +9,11 @@ __all__ = ['ImagerPlugin', 'SourcePlugin'] > > import os > import logging > +import types > > from collections import defaultdict > -from importlib.machinery import SourceFileLoader > +import importlib > +import importlib.util > > from wic import WicError > from wic.misc import get_bitbake_var > @@ -54,7 +56,9 @@ class PluginMgr: > mname = fname[:-3] > mpath = os.path.join(ppath, fname) > logger.debug("loading plugin module %s", > mpath) > - SourceFileLoader(mname, > mpath).load_module() > + spec = > importlib.util.spec_from_file_location(mname, mpath) > + module = > importlib.util.module_from_spec(spec) > + spec.loader.exec_module(module) > > return PLUGINS.get(ptype) > > diff --git a/scripts/lib/wic/plugins/imager/direct.py > b/scripts/lib/wic/plugins/imager/direct.py index > ea709e8c545d..35fff7c10242 100644 --- > a/scripts/lib/wic/plugins/imager/direct.py +++ > b/scripts/lib/wic/plugins/imager/direct.py @@ -77,7 +77,8 @@ class > DirectPlugin(ImagerPlugin): > image_path = self._full_path(self.workdir, > self.parts[0].disk, "direct") self._image = > PartitionedImage(image_path, self.ptable_format, > - self.parts, > self.native_sysroot) > + self.parts, > self.native_sysroot, > + options.extra_space) > > def setup_workdir(self, workdir): > if workdir: > @@ -116,7 +117,7 @@ class DirectPlugin(ImagerPlugin): > updated = False > for part in self.parts: > if not part.realnum or not part.mountpoint \ > - or part.mountpoint == "/": > + or part.mountpoint == "/" or not > part.mountpoint.startswith('/'): continue > > if part.use_uuid: > @@ -258,6 +259,8 @@ class DirectPlugin(ImagerPlugin): > if part.mountpoint == "/": > if part.uuid: > return "PARTUUID=%s" % part.uuid > + elif part.label: > + return "PARTLABEL=%s" % part.label > else: > suffix = 'p' if part.disk.startswith('mmcblk') > else '' return "/dev/%s%s%-d" % (part.disk, suffix, part.realnum) > @@ -293,7 +296,7 @@ class PartitionedImage(): > Partitioned image in a file. > """ > > - def __init__(self, path, ptable_format, partitions, > native_sysroot=None): > + def __init__(self, path, ptable_format, partitions, > native_sysroot=None, extra_space=0): self.path = path # Path to the > image file self.numpart = 0 # Number of allocated partitions > self.realpart = 0 # Number of partitions in the partition > table @@ -314,6 +317,7 @@ class PartitionedImage(): > self.sector_size = SECTOR_SIZE > self.native_sysroot = native_sysroot > num_real_partitions = len([p for p in self.partitions if not > p.no_table]) > + self.extra_space = extra_space > > # calculate the real partition number, accounting for > partitions not # in the partition table and logical partitions > @@ -483,6 +487,7 @@ class PartitionedImage(): > self.min_size += GPT_OVERHEAD > > self.min_size *= self.sector_size > + self.min_size += self.extra_space > > def _create_partition(self, device, parttype, fstype, start, > size): """ Create a partition on an image described by the 'device' > object. """ diff --git > a/scripts/lib/wic/plugins/source/bootimg-efi.py > b/scripts/lib/wic/plugins/source/bootimg-efi.py index > cdc72543c200..0391aebdc840 100644 --- > a/scripts/lib/wic/plugins/source/bootimg-efi.py +++ > b/scripts/lib/wic/plugins/source/bootimg-efi.py @@ -12,6 +12,7 @@ > import logging > import os > +import tempfile > import shutil > import re > > @@ -119,12 +120,13 @@ class BootimgEFIPlugin(SourcePlugin): > bootloader = creator.ks.bootloader > > loader_conf = "" > - loader_conf += "default boot\n" > + if source_params.get('create-unified-kernel-image') != > "true": > + loader_conf += "default boot\n" > loader_conf += "timeout %d\n" % bootloader.timeout > > initrd = source_params.get('initrd') > > - if initrd: > + if initrd and > source_params.get('create-unified-kernel-image') != "true": # > obviously we need to have a common common deploy var bootimg_dir = > get_bitbake_var("DEPLOY_DIR_IMAGE") if not bootimg_dir: > @@ -183,11 +185,12 @@ class BootimgEFIPlugin(SourcePlugin): > for rd in initrds: > boot_conf += "initrd /%s\n" % rd > > - logger.debug("Writing systemd-boot config " > - "%s/hdd/boot/loader/entries/boot.conf", > cr_workdir) > - cfg = open("%s/hdd/boot/loader/entries/boot.conf" % > cr_workdir, "w") > - cfg.write(boot_conf) > - cfg.close() > + if source_params.get('create-unified-kernel-image') != > "true": > + logger.debug("Writing systemd-boot config " > + "%s/hdd/boot/loader/entries/boot.conf", > cr_workdir) > + cfg = open("%s/hdd/boot/loader/entries/boot.conf" % > cr_workdir, "w") > + cfg.write(boot_conf) > + cfg.close() > > > @classmethod > @@ -288,9 +291,60 @@ class BootimgEFIPlugin(SourcePlugin): > kernel = "%s-%s.bin" % \ > (get_bitbake_var("KERNEL_IMAGETYPE"), > get_bitbake_var("INITRAMFS_LINK_NAME")) > - install_cmd = "install -m 0644 %s/%s %s/%s" % \ > - (staging_kernel_dir, kernel, hdddir, kernel) > - exec_cmd(install_cmd) > + if source_params.get('create-unified-kernel-image') == > "true": > + initrd = source_params.get('initrd') > + if not initrd: > + raise WicError("initrd= must be specified when > create-unified-kernel-image=true, exiting") + > + deploy_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") > + efi_stub = glob("%s/%s" % (deploy_dir, > "linux*.efi.stub")) > + if len(efi_stub) == 0: > + raise WicError("Unified Kernel Image EFI stub not > found, exiting") > + efi_stub = efi_stub[0] > + > + with tempfile.TemporaryDirectory() as tmp_dir: > + label = source_params.get('label') > + label_conf = "root=%s" % creator.rootdev > + if label: > + label_conf = "LABEL=%s" % label > + > + bootloader = creator.ks.bootloader > + cmdline = open("%s/cmdline" % tmp_dir, "w") > + cmdline.write("%s %s" % (label_conf, > bootloader.append)) > + cmdline.close() > + > + initrds = initrd.split(';') > + initrd = open("%s/initrd" % tmp_dir, "wb") > + for f in initrds: > + with open("%s/%s" % (deploy_dir, f), 'rb') as > in_file: > + shutil.copyfileobj(in_file, initrd) > + initrd.close() > + > + # Searched by systemd-boot: > + # > https://systemd.io/BOOT_LOADER_SPECIFICATION/#type-2-efi-unified-kernel-images > + install_cmd = "install -d %s/EFI/Linux" % hdddir > + exec_cmd(install_cmd) > + > + staging_dir_host = > get_bitbake_var("STAGING_DIR_HOST") + > + # > https://www.freedesktop.org/software/systemd/man/systemd-stub.html > + objcopy_cmd = "objcopy \ > + --add-section .osrel=%s --change-section-vma > .osrel=0x20000 \ > + --add-section .cmdline=%s --change-section-vma > .cmdline=0x30000 \ > + --add-section .linux=%s --change-section-vma > .linux=0x2000000 \ > + --add-section .initrd=%s --change-section-vma > .initrd=0x3000000 \ > + %s %s" % \ > + ("%s/usr/lib/os-release" % staging_dir_host, > + cmdline.name, > + "%s/%s" % (staging_kernel_dir, kernel), > + initrd.name, > + efi_stub, > + "%s/EFI/Linux/linux.efi" % hdddir) > + exec_cmd(objcopy_cmd) > + else: > + install_cmd = "install -m 0644 %s/%s %s/%s" % \ > + (staging_kernel_dir, kernel, hdddir, kernel) > + exec_cmd(install_cmd) > > if get_bitbake_var("IMAGE_EFI_BOOT_FILES"): > for src_path, dst_path in cls.install_task: > diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py > b/scripts/lib/wic/plugins/source/bootimg-pcbios.py index > f2639e700493..32e47f183146 100644 --- > a/scripts/lib/wic/plugins/source/bootimg-pcbios.py +++ > b/scripts/lib/wic/plugins/source/bootimg-pcbios.py @@ -186,8 +186,10 > @@ class BootimgPcbiosPlugin(SourcePlugin): # dosfs image, created by > mkdosfs bootimg = "%s/boot%s.img" % (cr_workdir, part.lineno) > > - dosfs_cmd = "mkdosfs -n boot -i %s -S 512 -C %s %d" % \ > - (part.fsuuid, bootimg, blocks) > + label = part.label if part.label else "boot" > + > + dosfs_cmd = "mkdosfs -n %s -i %s -S 512 -C %s %d" % \ > + (label, part.fsuuid, bootimg, blocks) > exec_native_cmd(dosfs_cmd, native_sysroot) > > mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (bootimg, hdddir) > diff --git a/scripts/lib/wic/plugins/source/rawcopy.py > b/scripts/lib/wic/plugins/source/rawcopy.py index > 3c4997d8ba5e..7c90cd3cf82b 100644 --- > a/scripts/lib/wic/plugins/source/rawcopy.py +++ > b/scripts/lib/wic/plugins/source/rawcopy.py @@ -4,6 +4,8 @@ > > import logging > import os > +import signal > +import subprocess > > from wic import WicError > from wic.pluginbase import SourcePlugin > @@ -29,15 +31,34 @@ class RawCopyPlugin(SourcePlugin): > cmd = 'btrfs filesystem label %s %s' % (dst, label) > elif fstype == 'swap': > cmd = 'mkswap -L %s %s' % (label, dst) > - elif fstype == 'squashfs': > - raise WicError("It's not possible to update a squashfs " > - "filesystem label '%s'" % (label)) > + elif fstype in ('squashfs', 'erofs'): > + raise WicError("It's not possible to update a %s " > + "filesystem label '%s'" % (fstype, label)) > else: > raise WicError("Cannot update filesystem label: " > "Unknown fstype: '%s'" % (fstype)) > > exec_cmd(cmd) > > + @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", > + ".gz": "gzip", > + ".xz": "xz" > + }.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) + > @classmethod > def do_prepare_partition(cls, part, source_params, cr, > cr_workdir, oe_builddir, bootimg_dir, kernel_dir, > @@ -56,7 +77,13 @@ class RawCopyPlugin(SourcePlugin): > if 'file' not in source_params: > raise WicError("No file specified") > > - src = os.path.join(kernel_dir, source_params['file']) > + if 'unpack' in source_params: > + img = os.path.join(kernel_dir, source_params['file']) > + src = os.path.join(cr_workdir, > os.path.splitext(source_params['file'])[0]) > + RawCopyPlugin.do_image_uncompression(img, src, > cr_workdir) > + else: > + src = os.path.join(kernel_dir, source_params['file']) > + > dst = os.path.join(cr_workdir, "%s.%s" % > (os.path.basename(source_params['file']), part.lineno)) > if not os.path.exists(os.path.dirname(dst)): > diff --git a/scripts/lib/wic/plugins/source/rootfs.py > b/scripts/lib/wic/plugins/source/rootfs.py index > 96d940a91d61..2e34e715ca73 100644 --- > a/scripts/lib/wic/plugins/source/rootfs.py +++ > b/scripts/lib/wic/plugins/source/rootfs.py @@ -218,7 +218,7 @@ class > RootfsPlugin(SourcePlugin): # Update part.has_fstab here as fstab may > have been added or # removed by the above modifications. > part.has_fstab = os.path.exists(os.path.join(new_rootfs, > "etc/fstab")) > - if part.update_fstab_in_rootfs and part.has_fstab: > + if part.update_fstab_in_rootfs and part.has_fstab and > not part.no_fstab_update: fstab_path = os.path.join(new_rootfs, > "etc/fstab") # Assume that fstab should always be owned by root with > fixed permissions install_cmd = "install -m 0644 %s %s" % > (part.updated_fstab_path, fstab_path) diff --git a/scripts/wic > b/scripts/wic index a741aed364bf..aee63a45aacf 100755 > --- a/scripts/wic > +++ b/scripts/wic > @@ -22,9 +22,9 @@ import sys > import argparse > import logging > import subprocess > +import shutil > > from collections import namedtuple > -from distutils import spawn > > # External modules > scripts_path = os.path.dirname(os.path.realpath(__file__)) > @@ -47,7 +47,7 @@ if os.environ.get('SDKTARGETSYSROOT'): > break > sdkroot = os.path.dirname(sdkroot) > > -bitbake_exe = spawn.find_executable('bitbake') > +bitbake_exe = shutil.which('bitbake') > if bitbake_exe: > bitbake_path = scriptpath.add_bitbake_lib_path() > import bb > @@ -159,6 +159,9 @@ def wic_create_subcommand(options, usage_str): > "(Use -e/--image-name to specify it)") > native_sysroot = options.native_sysroot > > + if options.kernel_dir: > + kernel_dir = options.kernel_dir > + > if not options.vars_dir and (not native_sysroot or not > os.path.isdir(native_sysroot)): logger.info("Building wic-tools...\n") > subprocess.check_call(["bitbake", "wic-tools"]) > @@ -346,6 +349,8 @@ def wic_init_parser_create(subparser): > default=False, help="output debug information") > subparser.add_argument("-i", "--imager", dest="imager", > default="direct", help="the wic imager plugin") > + subparser.add_argument("--extra-space", type=int, > dest="extra_space", > + default=0, help="additional free disk space to > add to the image") return > >