From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6948728032777469952 X-Received: by 2002:a05:6402:4405:: with SMTP id y5mr11056681eda.32.1617883057981; Thu, 08 Apr 2021 04:57:37 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a17:906:c1ca:: with SMTP id bw10ls3073811ejb.5.gmail; Thu, 08 Apr 2021 04:57:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqZkWAy5xeguDz/T5l8tNm4c6IDrYzK6ak+BE9IMPVSB7qv9YkxvyfcV0LRU25FT3TM+AB X-Received: by 2002:a17:906:14d1:: with SMTP id y17mr9800838ejc.139.1617883057012; Thu, 08 Apr 2021 04:57:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617883057; cv=none; d=google.com; s=arc-20160816; b=stnEdsuOtt8W1i710wMMmRrjEwR0NUlgXeLqMtgEqX5BlC9eYTg77JprfxrZKAgtrw O9EgRbfw2MfI5OAbmKQRJiAduSTxW6CC0d66ifsumeND362Nvq9/MF0wf1PdK3HLGqn3 djm7+fiN8g5T0L946J1+kNalWy3TuTThtNLPvY8smMCi3/JWf/xVs9XWNwScQZiDsKCX 9lF8ZvrNhKVnZmVtNVtvRPB0NtROinZo9p111FCJCfsBABdHgCel0erbTHG+8sVRaSG2 jgKWKCN83HOzUKZ6dr5fGQ7rxTnQskUJSwc7AzsV7YsB9MxtBbNodtHwVPrY5Eu3rdYQ 3EZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:to:subject; bh=FRIC2/PZYCGjZ2rmuDe9OYoXuCzqxhAIzoLm0EeG4Yw=; b=MbmGhbm/KkNKnsOzfe/74crCiRMAY8+BvSnImPZ0aTjM9KB0nxwASCTYaG0jTBBwPk 1RIj4j2SqfvbDgrd/FfuexZLahaQKBqblubJPkuak8hTwgqOSKFzvx+gP4JfLY5Ptgyr 3th0COTJewygJjeKgPQJEZ/mtxK+pTSfPAfT4h28vVnBaAul8ywqggPnRtCet/Xr05mx jFVruT3JKT09nbjJEMNWYg1p03KS17YWxEbMSUJyosB+zJBfv9WuSxakklpE4ZcEnDRw AYwqf3eAHkY44nMiRjwIJLHvgqo1I3xm0q995t2jtos6FeMIXKFMJKAImwaHqnFCqFIo xR8Q== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 194.138.37.40 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from gecko.sbs.de (gecko.sbs.de. [194.138.37.40]) by gmr-mx.google.com with ESMTPS id y16si615819edq.2.2021.04.08.04.57.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Apr 2021 04:57:36 -0700 (PDT) Received-SPF: pass (google.com: domain of jan.kiszka@siemens.com designates 194.138.37.40 as permitted sender) client-ip=194.138.37.40; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 194.138.37.40 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by gecko.sbs.de (8.15.2/8.15.2) with ESMTPS id 138BvapU012256 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 8 Apr 2021 13:57:36 +0200 Received: from [167.87.250.28] ([167.87.250.28]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id 138BrsOg014879; Thu, 8 Apr 2021 13:53:54 +0200 Subject: Re: [PATCH] wic/rootfs-u-boot: Allow to set root with source_params To: "[ext] Q. Gylstorff" , isar-users@googlegroups.com References: <20210408100241.18186-1-Quirin.Gylstorff@siemens.com> From: Jan Kiszka Message-ID: Date: Thu, 8 Apr 2021 13:53:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <20210408100241.18186-1-Quirin.Gylstorff@siemens.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: KfmRtChUXXFv On 08.04.21 12:02, [ext] Q. Gylstorff wrote: > From: Quirin Gylstorff > > If the root device needs to be modified during boot it needs > to be set as source parameter in the wic file similar to efi > boot. > > Signed-off-by: Quirin Gylstorff > --- > .../lib/wic/plugins/source/rootfs-u-boot.py | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > 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 3ac0aa0..1e10648 100644 > --- a/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py > +++ b/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py > @@ -37,7 +37,7 @@ class RootfsUBootPlugin(RootfsPlugin): > # Prologue from RootfsPlugin.do_prepare_partition, retrieves the > # rootfs directory > if part.rootfs_dir is None: > - if not 'ROOTFS_DIR' in krootfs_dir: > + if 'ROOTFS_DIR' not in krootfs_dir: > raise WicError("Couldn't find --rootfs-dir, exiting") > > rootfs_dir = krootfs_dir['ROOTFS_DIR'] > @@ -48,7 +48,8 @@ class RootfsUBootPlugin(RootfsPlugin): > rootfs_dir = part.rootfs_dir > else: > raise WicError("Couldn't find --rootfs-dir=%s connection or " > - "it is not a valid path, exiting" % part.rootfs_dir) > + "it is not a valid path, exiting" % > + part.rootfs_dir) > if os.path.isdir(rootfs_dir): > real_rootfs_dir = rootfs_dir > else: > @@ -59,6 +60,13 @@ class RootfsUBootPlugin(RootfsPlugin): > (rootfs_dir, image_rootfs_dir)) > real_rootfs_dir = image_rootfs_dir > > + root_dev = cr.rootdev > + if not root_dev: > + root_dev = source_params.get("root", None) > + if not root_dev: > + raise WicError("root not defined, exiting.") > + root_dev = root_dev.replace(":", "=") > + > u_boot_script = os.path.join(real_rootfs_dir, > "etc/default/u-boot-script") > if not os.path.exists(u_boot_script): > @@ -68,8 +76,8 @@ class RootfsUBootPlugin(RootfsPlugin): > with open(u_boot_script, 'w') as cfg: > cfg.write('# Generated by wic, rootfs-u-boot plugin\n') > cfg.write('ROOT_PARTITION="%d"\n' % part.realnum) > - cfg.write('KERNEL_ARGS="root=%s %s"\n' % \ > - (cr.rootdev, cr.ks.bootloader.append or "")) > + cfg.write('KERNEL_ARGS="root=%s %s"\n' % > + (root_dev, cr.ks.bootloader.append or "")) > no_initrd = source_params.get('no_initrd') or '' > cfg.write('NO_INITRD="%s"\n' % no_initrd) > overlays = source_params.get('overlays') or '' > Quite a bit of unrelated style changes in this patch - better split up. Jan -- Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux