From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6617812835611181056 X-Received: by 2002:a25:ba8a:: with SMTP id s10-v6mr966847ybg.81.1540966272801; Tue, 30 Oct 2018 23:11:12 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a25:f507:: with SMTP id a7-v6ls5760385ybe.7.gmail; Tue, 30 Oct 2018 23:11:12 -0700 (PDT) X-Google-Smtp-Source: AJdET5ebjqtfwkIcyW6UxD90WL98OGwvvjl5mplRs6C0OIJGjPeZoyhD/gX8PAr4UZEBuKHMheJ5 X-Received: by 2002:a25:b809:: with SMTP id v9-v6mr948185ybj.2.1540966272607; Tue, 30 Oct 2018 23:11:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540966272; cv=none; d=google.com; s=arc-20160816; b=UhA/Zxu0gK7CnlGEm2+KCJrGc4A4MXfxXgw9NlcGP+pwIw4qH/hbqADEZzOkMBq54a UgXKlKam9MVMAqAkG6ks9wnYTfkocd1tavPn7QzxadnsQxBwAQeC+XsT6MiSn2N2hIDS BubgYVp6N1an1SY49tVVryvfB815/gtI1HO3wFtG0X1VP4KBscY1bsZa+f3K4a/3nqPe nEBVCovP/bwPx7X5JgRPt7wYWKkJyKQvBjhX4EX77kuBQptFPKsJxxnHw38/WcAQLq2Z QdbePn/92k1DfIruQaAslB/43S76UfSUEpKyKc3FncJ+Q8PL2lZ2D85MpyNQKp3ZHCFL K2wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=91H71b/XvTacHwlwCX0ZuhU6l1kry2MWFMMa2ea/Ruc=; b=e82FNL8O/4Tc/HdrJHpPGcH38+W0P1NVF4PTtmogl9MOoDjpDufPfe62mZl9e6eHYf x8RwvZIwxx8xCwYNX18eukFq0BIAAbOr1OuHLZ8hJu4MEdDTxe69cMhQHFGc/x1lpPaa 921n8v/yAWIdWGbZwNfek3xDrSde3TgljXjWncBru7ZqUrTxtaw9nAmZGkTdkRZcnfy2 Ome+Ym68i+t8sZ/TMPdSkwzr2XZOYcF9E6EJ7BjyCC6R8W5uQByO0Hx2XbP72KfBFQ+s A/Lnl/ovio9jsHAXaOyOZzx2HgLg/mCPt7Zu5nEMYP3e6CX/IkC2uMx5UTULkxWaOmH/ ULmg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of cedric_hombourger@mentor.com designates 192.94.38.131 as permitted sender) smtp.mailfrom=Cedric_Hombourger@mentor.com Return-Path: Received: from relay1.mentorg.com (relay1.mentorg.com. [192.94.38.131]) by gmr-mx.google.com with ESMTPS id o8-v6si432245ywb.0.2018.10.30.23.11.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Oct 2018 23:11:12 -0700 (PDT) Received-SPF: pass (google.com: domain of cedric_hombourger@mentor.com designates 192.94.38.131 as permitted sender) client-ip=192.94.38.131; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of cedric_hombourger@mentor.com designates 192.94.38.131 as permitted sender) smtp.mailfrom=Cedric_Hombourger@mentor.com Received: from nat-ies.mentorg.com ([192.94.31.2] helo=svr-ies-mbx-02.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1gHjih-0001kQ-Cl from Cedric_Hombourger@mentor.com for isar-users@googlegroups.com; Tue, 30 Oct 2018 23:11:11 -0700 Received: from localhost.localdomain (137.202.0.90) by svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Wed, 31 Oct 2018 06:11:07 +0000 From: Cedric Hombourger To: CC: Cedric Hombourger Subject: [PATCH v2 2/2] isar-image: refactor do_rootfs() Date: Wed, 31 Oct 2018 07:10:25 +0100 Message-ID: <20181031061025.28840-3-Cedric_Hombourger@mentor.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181031061025.28840-1-Cedric_Hombourger@mentor.com> References: <20181030134154.7adc8bf9@md1pvb1c.ad001.siemens.net> <20181031061025.28840-1-Cedric_Hombourger@mentor.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-08.mgc.mentorg.com (139.181.222.8) To svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) X-TUID: q4Pady192L/G Split the do_rootfs() shell function into four (smaller) shell functions to generate the fstab file (isar_image_gen_fstab), populate the root file-system (isar_image_gen_rootfs), configure it (isar_image_conf_rootfs) and perform some house-keeping (isar_image_cleanup). do_rootfs is now a python function and sequentially calls the helper functions listed above. Signed-off-by: Cedric Hombourger --- meta-isar/classes/isar-image.bbclass | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/meta-isar/classes/isar-image.bbclass b/meta-isar/classes/isar-image.bbclass index ec2b9e3..e0508be 100644 --- a/meta-isar/classes/isar-image.bbclass +++ b/meta-isar/classes/isar-image.bbclass @@ -21,7 +21,7 @@ ISAR_RELEASE_CMD ?= "${ISAR_RELEASE_CMD_DEFAULT}" do_rootfs[root_cleandirs] = "${IMAGE_ROOTFS} \ ${IMAGE_ROOTFS}/isar-apt" -do_rootfs() { +isar_image_gen_fstab() { cat > ${WORKDIR}/fstab << EOF # Begin /etc/fstab /dev/root / auto defaults 0 0 @@ -33,11 +33,15 @@ devtmpfs /dev devtmpfs mode=0755,nosuid 0 0 # End /etc/fstab EOF +} +isar_image_gen_rootfs() { setup_root_file_system --clean --keep-apt-cache \ --fstab "${WORKDIR}/fstab" \ "${IMAGE_ROOTFS}" ${IMAGE_PREINSTALL} ${IMAGE_INSTALL} +} +isar_image_conf_rootfs() { # Configure root filesystem if [ -n "${DISTRO_CONFIG_SCRIPT}" ]; then sudo install -m 755 "${WORKDIR}/${DISTRO_CONFIG_SCRIPT}" "${IMAGE_ROOTFS}" @@ -45,7 +49,9 @@ EOF "${BAUDRATE_TTY}" sudo rm "${IMAGE_ROOTFS}/${DISTRO_CONFIG_SCRIPT}" fi +} +isar_image_cleanup() { # Cleanup sudo rm "${IMAGE_ROOTFS}/etc/apt/sources.list.d/isar-apt.list" test ! -e "${IMAGE_ROOTFS}/usr/share/doc/qemu-user-static" && \ @@ -57,3 +63,10 @@ EOF sudo umount -l ${IMAGE_ROOTFS}/proc sudo rm -f "${IMAGE_ROOTFS}/etc/apt/apt.conf.d/55isar-fallback.conf" } + +python do_rootfs() { + bb.build.exec_func("isar_image_gen_fstab", d) + bb.build.exec_func("isar_image_gen_rootfs", d) + bb.build.exec_func("isar_image_conf_rootfs", d) + bb.build.exec_func("isar_image_cleanup", d) +} -- 2.11.0