From patchwork Wed Sep 7 19:51:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vyacheslav Yurkov X-Patchwork-Id: 12451 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0C30C38145 for ; Wed, 7 Sep 2022 19:52:54 +0000 (UTC) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by mx.groups.io with SMTP id smtpd.web12.240.1662580368808579957 for ; Wed, 07 Sep 2022 12:52:49 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CHsR0MqU; spf=pass (domain: gmail.com, ip: 209.85.128.43, mailfrom: uvv.mail@gmail.com) Received: by mail-wm1-f43.google.com with SMTP id j26so9427873wms.0 for ; Wed, 07 Sep 2022 12:52:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=di3DVO49biHoHHeQaC8NWXE5+gazosHIPcwCmbdm7zE=; b=CHsR0MqU12l1xuWUBqXT3jBkrQ/DVZbA7u5MllKDpL0Q9B4LmzS6vpUHc+wHnOVvW6 aopJdMPdXE8BQdGF3UrcPNJJsMjQ0EN/QupqIXsNIA/r8OOeg7qOdgNNziYMkdlmnDYS tLi2pycUFjP879JzLoPKCgsUKl+pXZ09Pi2Z7LpboyAWCzTL3lMNC5bJhjUZ65U15BNv lHGiLMLAzTEovgpZMuYZ333v+iG1lJmflWgtkjRdh8/HNOwtn6UFBWefGqMIebQIw413 Ohc+Rxd6vUyuSKB4WwYTEKIacD/PdrrEXuGTxYZlM5Jh6JJOKIaWwZJpTXKHdZMhjYIZ yzUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=di3DVO49biHoHHeQaC8NWXE5+gazosHIPcwCmbdm7zE=; b=TNzrkkOs/M6sTsY7+NpZz7ieu+bHVdmxgEI2zTK05Q2iT91yzxKXlPtbRttwmqzegl PqSDs0+TG8utIWuJvhuoioGBsom5zQ1hBXa7qfEBJ5fH+rO9rZsWqVPVTZ0AAWcAHMa0 cBvo/bpNGkUKvJAs2DVCt5kbMpMm2B3P7U8gEQhFV84ugLTxU8mmvredisEQuWNu9u27 sF6QPH5gw6g4wE9qjjR/HFCcYT74YeB3p+8CtwYW86n9ihqWChkSkjzViXtUPrExLOvy fVXdx+GyhiMpjhYDzxOzl5FnlA+Qa9UcEJjKnVTsRFDll98Aw/SJdoPvv18zipsoxr6y fBWA== X-Gm-Message-State: ACgBeo2c94CbYM3uwsGokZi4RdDxzHD8vt4eeRNSU6B6U6Rg+hIl214M fZCe4+z218aKQ0juMjlwk6oTaAIzxnT9OQ== X-Google-Smtp-Source: AA6agR7nL+pY7oBdmplCCHPJBZb71dG96JN1i8dpWHJ3tN/UNnXsgsK5KLDsV3pWtL+vKC+sBHcf4w== X-Received: by 2002:a05:600c:4f43:b0:3a6:2335:f5de with SMTP id m3-20020a05600c4f4300b003a62335f5demr44104wmq.109.1662580366833; Wed, 07 Sep 2022 12:52:46 -0700 (PDT) Received: from developer.localdomain (dslb-002-205-007-019.002.205.pools.vodafone-ip.de. [2.205.7.19]) by smtp.gmail.com with ESMTPSA id r9-20020adff709000000b0022862fd933asm15030361wrp.96.2022.09.07.12.52.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Sep 2022 12:52:46 -0700 (PDT) From: Vyacheslav Yurkov To: openembedded-core@lists.openembedded.org Cc: Vyacheslav Yurkov Subject: [PATCH 1/5] oeqa/selftest: drop image_feature test from overlayfs Date: Wed, 7 Sep 2022 21:51:35 +0200 Message-Id: <20220907195139.814465-1-uvv.mail@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 07 Sep 2022 19:52:54 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/170426 From: Vyacheslav Yurkov The test checked the incorrect class use with INHERIT. This functionality is now covered by bitbake Signed-off-by: Vyacheslav Yurkov --- meta/lib/oeqa/selftest/cases/overlayfs.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/overlayfs.py b/meta/lib/oeqa/selftest/cases/overlayfs.py index bff22f21b6..f550015b4b 100644 --- a/meta/lib/oeqa/selftest/cases/overlayfs.py +++ b/meta/lib/oeqa/selftest/cases/overlayfs.py @@ -333,24 +333,14 @@ EXTRA_IMAGE_FEATURES += "package-management" self.assertTrue("overlayfs-etc" in res.output, msg=res.output) self.assertTrue("package-management" in res.output, msg=res.output) - def test_image_feature_is_missing_class_included(self): - configAppend = """ -INHERIT += "overlayfs-etc" -""" - self.run_check_image_feature(configAppend) - def test_image_feature_is_missing(self): - self.run_check_image_feature() - - def run_check_image_feature(self, appendToConfig=""): """ Summary: Overlayfs-etc class is not applied when image feature is not set - even if we inherit it directly, Expected: Image is created successfully but /etc is not an overlay Author: Vyacheslav Yurkov """ - config = f""" + config = """ DISTRO_FEATURES:append = " systemd" # Use systemd as init manager @@ -366,7 +356,6 @@ EXTRA_IMAGE_FEATURES += "read-only-rootfs" # Image configuration for overlayfs-etc OVERLAYFS_ETC_MOUNT_POINT = "/data" OVERLAYFS_ETC_DEVICE = "/dev/sda3" -{appendToConfig} """ self.write_config(config) From patchwork Wed Sep 7 19:51:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vyacheslav Yurkov X-Patchwork-Id: 12452 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6EAEC6FA8B for ; Wed, 7 Sep 2022 19:52:54 +0000 (UTC) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by mx.groups.io with SMTP id smtpd.web09.235.1662580369164309533 for ; Wed, 07 Sep 2022 12:52:49 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BvZNwzK+; spf=pass (domain: gmail.com, ip: 209.85.221.44, mailfrom: uvv.mail@gmail.com) Received: by mail-wr1-f44.google.com with SMTP id by5so837950wrb.6 for ; Wed, 07 Sep 2022 12:52:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=wx83NSkDe2C4n2+WTwQGt8fmdHI0wo5RHrhemJsi1Bo=; b=BvZNwzK+8I6pVhwBGjkhQwfu7H4+TKCcPg4KLwuDjyWjg3cX8oH0j+/BuRMUd0j7Wz jAdDhOZLbO1VYZ8VJ3j/NpnZ6zSVSz6WQ0Gkz++8EN8dpMyWQpBcfGf7DuG/ULjFxyiB xtO6RPTXL01xY/uNY1DceXJjmI7b+NCiq0Vj77CBdLBJ3CAfiR7ZHbIgaC8yxvgB3qRT 2XVVk78LK/RSEuRuqK9LfMznmslporYZRyMUy4FZhZVgplRwkZ1fj8Io0GUsOAV1GTHi rEcRDCurb1zrEqoFVXD+cIuyK4Jgss5yARvqLOXZ2iqJZuowTEk7aHm6LL1WhqHh0E+g d+9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=wx83NSkDe2C4n2+WTwQGt8fmdHI0wo5RHrhemJsi1Bo=; b=SZ5yfMeuZBKCdOpMRO//2IjDJZw41aFlFlPLmwBMRoG0HsWa+mrKWSuDmowcillz0h 7S9ctDzjwdP1jh2/yGqHKZNllhkbt/E/h6waHhACxDLtiLCwyntYJmXzxE4hyecXrIlQ d3Is7/nZITD46zYwD2NJmeqYEQpRPqVBh8dYjVjMrWQCv16YA3HOwn1yuwwyIj21q+SH SBUNhNJXq0L0cJwOzjwFrHXZ+v9DvftaSFHdUIfqM0wBMGwFzeISh8uitFHLqLpzZXoH noXlh3fPg1PI4yEJ27otHO7441IJD+A1bLYW4MUpHtXOQnETbduikcjkoq8B8dR3pi9X PCaA== X-Gm-Message-State: ACgBeo2C0NK+FdQ8me2PMaAsIhtzpoIJORO0ZFltvrZzEGzLOCWUgDox V1OpfxPvljtrzChMYGWqtbfhXXmpjTD2ag== X-Google-Smtp-Source: AA6agR5lBUJmK4Un3/AjTtNVbHgxNaZRNpkFchfzebEYR8OGxnIW7aYhbOye++J74+gOPg1MEqrH/Q== X-Received: by 2002:a5d:5955:0:b0:226:dac4:a713 with SMTP id e21-20020a5d5955000000b00226dac4a713mr2914891wri.245.1662580367369; Wed, 07 Sep 2022 12:52:47 -0700 (PDT) Received: from developer.localdomain (dslb-002-205-007-019.002.205.pools.vodafone-ip.de. [2.205.7.19]) by smtp.gmail.com with ESMTPSA id r9-20020adff709000000b0022862fd933asm15030361wrp.96.2022.09.07.12.52.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Sep 2022 12:52:47 -0700 (PDT) From: Vyacheslav Yurkov To: openembedded-core@lists.openembedded.org Cc: Vyacheslav Yurkov Subject: [PATCH 2/5] classes: Update overlayfs classes to use new bitbake functionality Date: Wed, 7 Sep 2022 21:51:36 +0200 Message-Id: <20220907195139.814465-2-uvv.mail@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220907195139.814465-1-uvv.mail@gmail.com> References: <20220907195139.814465-1-uvv.mail@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 07 Sep 2022 19:52:54 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/170427 From: Vyacheslav Yurkov OverlayFS classes belong to a recipe scope Signed-off-by: Vyacheslav Yurkov --- meta/{classes => classes-recipe}/overlayfs-etc.bbclass | 0 meta/{classes => classes-recipe}/overlayfs.bbclass | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename meta/{classes => classes-recipe}/overlayfs-etc.bbclass (100%) rename meta/{classes => classes-recipe}/overlayfs.bbclass (100%) diff --git a/meta/classes/overlayfs-etc.bbclass b/meta/classes-recipe/overlayfs-etc.bbclass similarity index 100% rename from meta/classes/overlayfs-etc.bbclass rename to meta/classes-recipe/overlayfs-etc.bbclass diff --git a/meta/classes/overlayfs.bbclass b/meta/classes-recipe/overlayfs.bbclass similarity index 100% rename from meta/classes/overlayfs.bbclass rename to meta/classes-recipe/overlayfs.bbclass From patchwork Wed Sep 7 19:51:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vyacheslav Yurkov X-Patchwork-Id: 12453 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6E67C6FA89 for ; Wed, 7 Sep 2022 19:52:54 +0000 (UTC) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by mx.groups.io with SMTP id smtpd.web12.241.1662580369844669842 for ; Wed, 07 Sep 2022 12:52:50 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Y5w4kqna; spf=pass (domain: gmail.com, ip: 209.85.128.52, mailfrom: uvv.mail@gmail.com) Received: by mail-wm1-f52.google.com with SMTP id 186-20020a1c02c3000000b003b26feb5c6bso1472360wmc.5 for ; Wed, 07 Sep 2022 12:52:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=RqwzNSDW696refARX11w0FAtjJ4jpVTd5IfDtjQcH9E=; b=Y5w4kqnalZY3L3ThDE2O4SgkLKqfG3XAoYTeAFC0CTVNcOXyOvJhvE7qkkLcrcDKMw Ju18JJGA2Kq/2KLldNJ6W9K7XkZtJ4XR0m7c2xwgCcorEzgTmvHjeretVhPyU89zEwj8 20LByrOP2fl0xDGctjgGz7G/DlbchU5wVGmuMtFLeDiE5kTV18E0hN+Cng0S3tt4/JVo 4/P6kayGZsy2OFeb50ArnPYWXUU3z4ZFenYDGd399/o3G0RyfJ/jJlWdRzhPSvN+nhQX LnBI4sVFhSCqT+QyTiIS0QcW+hDDtSII5ETYnQ5XJhSUTlp45Eo/oQAkP9HaFXpUHrGN FcXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=RqwzNSDW696refARX11w0FAtjJ4jpVTd5IfDtjQcH9E=; b=ISaLcfVRxH24YgcvOmTN9WFNz0m3kQO9jss/6LlUJF2DlD/39rMNaHDNJDrWP9sZog TWOKH6+OaQ+WFRZG/7FhHXV5qB71+bGyBvg0Iz489Jdt5zrmz99yX0LdM4WP3gw3u7EE 92WGZf54lyFh9PeyqKLIgcscdWWk8sjzUIuA9yUm83kWQ16Y/mkmcXNBHWWIqYjrwDlp mBtdTn/y/JiCy4pyEfMpWFDN2mkIYBPWZ6vASGIojCy1uU4zfZ93VyXkfnOb+Ldn3JJN M/X7MrDlu6sQKkZFSntYybTUFWrTHXj0lrF58n5AcwCnt0L8JDvhdf4BRYXUik3Dd94M cBQw== X-Gm-Message-State: ACgBeo3fcqU4XPZFSTuo/BJUeBbJxNqaVrinNyDPuH5LtjlL50BaQ+BH GsTjgy4xdL5eE/pcVMxQf5IuhYNCJ6fGuQ== X-Google-Smtp-Source: AA6agR5QpvIu8bY6jlIl6cfkOE10xW+KP9DiovQZS6Vn/V1PHozp/zbcx9KlfwWqce11bavleAYaZQ== X-Received: by 2002:a05:600c:1906:b0:3a5:fe9c:4dcf with SMTP id j6-20020a05600c190600b003a5fe9c4dcfmr55258wmq.118.1662580368096; Wed, 07 Sep 2022 12:52:48 -0700 (PDT) Received: from developer.localdomain (dslb-002-205-007-019.002.205.pools.vodafone-ip.de. [2.205.7.19]) by smtp.gmail.com with ESMTPSA id r9-20020adff709000000b0022862fd933asm15030361wrp.96.2022.09.07.12.52.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Sep 2022 12:52:47 -0700 (PDT) From: Vyacheslav Yurkov To: openembedded-core@lists.openembedded.org Cc: Vyacheslav Yurkov Subject: [PATCH 3/5] files: overlayfs-etc: refactor preinit template Date: Wed, 7 Sep 2022 21:51:37 +0200 Message-Id: <20220907195139.814465-3-uvv.mail@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220907195139.814465-1-uvv.mail@gmail.com> References: <20220907195139.814465-1-uvv.mail@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 07 Sep 2022 19:52:54 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/170428 From: Vyacheslav Yurkov Signed-off-by: Vyacheslav Yurkov --- meta/files/overlayfs-etc-preinit.sh.in | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/meta/files/overlayfs-etc-preinit.sh.in b/meta/files/overlayfs-etc-preinit.sh.in index 43c9b04eb9..0e80849f12 100644 --- a/meta/files/overlayfs-etc-preinit.sh.in +++ b/meta/files/overlayfs-etc-preinit.sh.in @@ -15,19 +15,23 @@ mount -t sysfs sysfs /sys [ -z "$CONSOLE" ] && CONSOLE="/dev/console" +BASE_OVERLAY_ETC_DIR={OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc +UPPER_DIR=$BASE_OVERLAY_ETC_DIR/upper +WORK_DIR=$BASE_OVERLAY_ETC_DIR/work + mkdir -p {OVERLAYFS_ETC_MOUNT_POINT} if mount -n -t {OVERLAYFS_ETC_FSTYPE} \ -o {OVERLAYFS_ETC_MOUNT_OPTIONS} \ {OVERLAYFS_ETC_DEVICE} {OVERLAYFS_ETC_MOUNT_POINT} then - mkdir -p {OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc/upper - mkdir -p {OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc/work + mkdir -p $UPPER_DIR + mkdir -p $WORK_DIR mount -n -t overlay \ - -o upperdir={OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc/upper \ + -o upperdir=$UPPER_DIR \ -o lowerdir=/etc \ - -o workdir={OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc/work \ + -o workdir=$WORK_DIR \ -o index=off,xino=off,redirect_dir=off,metacopy=off \ - {OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc/upper /etc || \ + $UPPER_DIR /etc || \ echo "PREINIT: Mounting etc-overlay failed!" else echo "PREINIT: Mounting failed!" From patchwork Wed Sep 7 19:51:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vyacheslav Yurkov X-Patchwork-Id: 12450 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2A4FC54EE9 for ; Wed, 7 Sep 2022 19:52:54 +0000 (UTC) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by mx.groups.io with SMTP id smtpd.web10.234.1662580370649843326 for ; Wed, 07 Sep 2022 12:52:51 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ADpA5hTK; spf=pass (domain: gmail.com, ip: 209.85.221.45, mailfrom: uvv.mail@gmail.com) Received: by mail-wr1-f45.google.com with SMTP id d2so5113534wrn.1 for ; Wed, 07 Sep 2022 12:52:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=8EuW5VSpRkDP8oRyYA47uTq4o48B28DyjvxWLnfa4g4=; b=ADpA5hTKpIb84aY1VqsfT3DYTYSmufqEQktIz9f3bHwB3KLbpIbDBuNwzxKve0orNO izGt7eActCPX3TRBzH6OvhsSUKYxEKUni9N8p/TYjo5+v4jZcKHOvYqHiiiXpotIAxvM qHXZXHXW1lTtIa3aGo50EVgk45YLkVdkE3JtKXYQ6JbBzHqmbjoL1XUaLORrKxybQF1y 7tNoIooF2eECsUGqYcWjHR1CWhS2aarb7kF5H09JW5jNtIItHVvnSFBXR0iZRIStYyrk TyPUP53p2SVedIQ4nB/+a/f2GoCsEjJLj9PEGGt94nSTNVfjc0p182i7fl+B8ag69yDh l9xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=8EuW5VSpRkDP8oRyYA47uTq4o48B28DyjvxWLnfa4g4=; b=vKrUKbq9gWRtgoS+xJ6cDQjSxot60SWZpGTJz2SBaOs4vH5wJ92nndLrYPyG+mvbEe pdG7l+SPrgTdSO0T8jrhU7MjZ70SRi2wr3aAmyWSMqwpvD9mkOiu7TjN0UjY6Zn9B82M +ApegA1v+1DBsmN7QCbM+ncu8ZVWDvLB0osC9liXqGmL2KjqEH6mRQh9cCHPMKc6KCXz qIzvXiluXi770Xdi73rXhCSmHFntBHiahwS/wdbhLvU+IruDN9YRmLZrs04HZUcSYRK6 EQ3al/Csc5REQIjbkOO6GX4TNjCOIUF0fYC17VRToXaCgJXHvT6GayDG1Tg0d4VQhHv9 Zs0g== X-Gm-Message-State: ACgBeo0Fwtc2BjnljWOcE844cl1l5Fpkl4rGR0ivOFGqJopp5OpSiuWA 0SrdttSxJToht/3Wpk4YmeVtd42fEptKhA== X-Google-Smtp-Source: AA6agR7hcNIeexQ/NZVVKBmLiTFBFsDDMR0/aPDnkRdF94dWJNSBX1IClE5jaDVaGGk14j6XUXUGfA== X-Received: by 2002:adf:ee86:0:b0:228:6fe1:371 with SMTP id b6-20020adfee86000000b002286fe10371mr3027384wro.684.1662580368897; Wed, 07 Sep 2022 12:52:48 -0700 (PDT) Received: from developer.localdomain (dslb-002-205-007-019.002.205.pools.vodafone-ip.de. [2.205.7.19]) by smtp.gmail.com with ESMTPSA id r9-20020adff709000000b0022862fd933asm15030361wrp.96.2022.09.07.12.52.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Sep 2022 12:52:48 -0700 (PDT) From: Vyacheslav Yurkov To: openembedded-core@lists.openembedded.org Cc: Vyacheslav Yurkov Subject: [PATCH 4/5] classes: files: Extend overlayfs-etc class Date: Wed, 7 Sep 2022 21:51:38 +0200 Message-Id: <20220907195139.814465-4-uvv.mail@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220907195139.814465-1-uvv.mail@gmail.com> References: <20220907195139.814465-1-uvv.mail@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 07 Sep 2022 19:52:54 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/170429 From: Vyacheslav Yurkov Add the ability to expose the lower layer of /etc when mounting overlay. This is the similar to what overlayroot script from initramfs-framework does. By default, this option is turned off to keep an old behavior intact. Signed-off-by: Vyacheslav Yurkov --- meta/classes-recipe/overlayfs-etc.bbclass | 5 ++++- meta/files/overlayfs-etc-preinit.sh.in | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/meta/classes-recipe/overlayfs-etc.bbclass b/meta/classes-recipe/overlayfs-etc.bbclass index d0bc3ecfac..f8343106f3 100644 --- a/meta/classes-recipe/overlayfs-etc.bbclass +++ b/meta/classes-recipe/overlayfs-etc.bbclass @@ -40,6 +40,7 @@ OVERLAYFS_ETC_DEVICE ??= "" OVERLAYFS_ETC_USE_ORIG_INIT_NAME ??= "1" OVERLAYFS_ETC_MOUNT_OPTIONS ??= "defaults" OVERLAYFS_ETC_INIT_TEMPLATE ??= "${COREBASE}/meta/files/overlayfs-etc-preinit.sh.in" +OVERLAYFS_ETC_EXPOSE_LOWER ??= "0" python create_overlayfs_etc_preinit() { overlayEtcMountPoint = d.getVar("OVERLAYFS_ETC_MOUNT_POINT") @@ -60,13 +61,15 @@ python create_overlayfs_etc_preinit() { preinitPath = oe.path.join(d.getVar("IMAGE_ROOTFS"), d.getVar("base_sbindir"), "preinit") initBaseName = oe.path.join(d.getVar("base_sbindir"), "init") origInitNameSuffix = ".orig" + exposeLower = oe.types.boolean(d.getVar('OVERLAYFS_ETC_EXPOSE_LOWER')) args = { 'OVERLAYFS_ETC_MOUNT_POINT': overlayEtcMountPoint, 'OVERLAYFS_ETC_MOUNT_OPTIONS': d.getVar('OVERLAYFS_ETC_MOUNT_OPTIONS'), 'OVERLAYFS_ETC_FSTYPE': overlayEtcFsType, 'OVERLAYFS_ETC_DEVICE': overlayEtcDevice, - 'SBIN_INIT_NAME': initBaseName + origInitNameSuffix if useOrigInit else initBaseName + 'SBIN_INIT_NAME': initBaseName + origInitNameSuffix if useOrigInit else initBaseName, + 'OVERLAYFS_ETC_EXPOSE_LOWER': "true" if exposeLower else "false" } if useOrigInit: diff --git a/meta/files/overlayfs-etc-preinit.sh.in b/meta/files/overlayfs-etc-preinit.sh.in index 0e80849f12..8db076f4ba 100644 --- a/meta/files/overlayfs-etc-preinit.sh.in +++ b/meta/files/overlayfs-etc-preinit.sh.in @@ -18,6 +18,7 @@ mount -t sysfs sysfs /sys BASE_OVERLAY_ETC_DIR={OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc UPPER_DIR=$BASE_OVERLAY_ETC_DIR/upper WORK_DIR=$BASE_OVERLAY_ETC_DIR/work +LOWER_DIR=$BASE_OVERLAY_ETC_DIR/lower mkdir -p {OVERLAYFS_ETC_MOUNT_POINT} if mount -n -t {OVERLAYFS_ETC_FSTYPE} \ @@ -26,6 +27,14 @@ if mount -n -t {OVERLAYFS_ETC_FSTYPE} \ then mkdir -p $UPPER_DIR mkdir -p $WORK_DIR + + if {OVERLAYFS_ETC_EXPOSE_LOWER}; then + mkdir -p $LOWER_DIR + + # provide read-only access to original /etc content + mount -o bind,ro /etc $LOWER_DIR + fi + mount -n -t overlay \ -o upperdir=$UPPER_DIR \ -o lowerdir=/etc \ From patchwork Wed Sep 7 19:51:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vyacheslav Yurkov X-Patchwork-Id: 12454 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id C12ADC6FA82 for ; Wed, 7 Sep 2022 19:52:54 +0000 (UTC) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by mx.groups.io with SMTP id smtpd.web12.242.1662580371277252684 for ; Wed, 07 Sep 2022 12:52:51 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PCOw+ML3; spf=pass (domain: gmail.com, ip: 209.85.221.44, mailfrom: uvv.mail@gmail.com) Received: by mail-wr1-f44.google.com with SMTP id bp20so21722510wrb.9 for ; Wed, 07 Sep 2022 12:52:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=hX3spU7bUoIUrLIi87WiArTBiWPQppwZk7xIoaa1mNk=; b=PCOw+ML3xai2y0s9gKfXotTBZXpglN2O0EGIHsQOlPyDrMqSNln0bHBiOFAHh9jQZC 9p9t+VY2vRjATBWylL7N+oS5glbHKIpV9wUtKLmgyuiOtOijuDifAdAniGIIMeoIia2Q D+uvPcQEqe9IFfUm2FwoENP+PxdnaDXQxRmeAGYTocpIWh422DAa31AVY65TIsBP8Hpg j3fyZWc18LEjuO9xrCWXgF54VSSul9UE1XNEl+RSHtI6cGkYPssOA6q99iPVIPU9y8C2 II78GDs8cojjv9ALOTBMoISp/Q0QFwKmdxA3HqqCjjLdbnSc+4ExupbG268kk7LEclUM I2CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=hX3spU7bUoIUrLIi87WiArTBiWPQppwZk7xIoaa1mNk=; b=kiS7cJGHTU6eZ7l0qjnoKtm4FnFfvf9Phng39/+cTodBBaBS+frv9TQboLNLapAy8M y2+gSmOojgmkjfcfDAszoTVqHtbikkf+gd7GhJzEsz2z9UUvHKBQyvOks7QZjCDDyLTD eoK6qyfRE4pk8NF3Lav0ATDMVpIGLFu3Iv0WCjlOSeNSkHZ40D3INFKfJpjSK+bC2//5 CuCiUDJKOiGROO/B0hxD6EAlo3/kJfUB2Elw3x+yrUrNPBwwWjgkAriuKVcQOtr0+jiP TY00BEPJqR4V+HEtEbF2nKziU1A8Q3+e3IeAODQhXsgC7eBFWhHVh4D8aSj7W0xGK0p6 LeWg== X-Gm-Message-State: ACgBeo3a4SF0RxTye2GIME/HxEaVufv3zxFOYOyGlukB5D5lMJBkZ3Ku WikjY7jbXfmcKeWk/h3lkeDXwtDuU2QZ3w== X-Google-Smtp-Source: AA6agR6iaz/uN8xgSvCmje7oxxtMEzOf93mgujDMqgFdK4cq34amJs6hI9eG/5jmzKg81oV6Kg1V4g== X-Received: by 2002:adf:d1c7:0:b0:226:eb3b:29b0 with SMTP id b7-20020adfd1c7000000b00226eb3b29b0mr3057399wrd.365.1662580369581; Wed, 07 Sep 2022 12:52:49 -0700 (PDT) Received: from developer.localdomain (dslb-002-205-007-019.002.205.pools.vodafone-ip.de. [2.205.7.19]) by smtp.gmail.com with ESMTPSA id r9-20020adff709000000b0022862fd933asm15030361wrp.96.2022.09.07.12.52.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Sep 2022 12:52:49 -0700 (PDT) From: Vyacheslav Yurkov To: openembedded-core@lists.openembedded.org Cc: Vyacheslav Yurkov Subject: [PATCH 5/5] oeqa/selftest: Add lower layer test for overlayfs-etc Date: Wed, 7 Sep 2022 21:51:39 +0200 Message-Id: <20220907195139.814465-5-uvv.mail@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220907195139.814465-1-uvv.mail@gmail.com> References: <20220907195139.814465-1-uvv.mail@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 07 Sep 2022 19:52:54 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/170430 From: Vyacheslav Yurkov Place a test file on the /etc by means of overlayfs-user recipe. Perform QA checks to make sure that: - When lower layer is exposed, that it's read-only to avoid undefined behavior - By default lower layer is not exposed Signed-off-by: Vyacheslav Yurkov --- .../overlayfs-user/overlayfs-user.bb | 7 +- meta/lib/oeqa/selftest/cases/overlayfs.py | 90 ++++++++++++++----- 2 files changed, 74 insertions(+), 23 deletions(-) diff --git a/meta-selftest/recipes-test/overlayfs-user/overlayfs-user.bb b/meta-selftest/recipes-test/overlayfs-user/overlayfs-user.bb index 913a4d1fdb..50cba9514b 100644 --- a/meta-selftest/recipes-test/overlayfs-user/overlayfs-user.bb +++ b/meta-selftest/recipes-test/overlayfs-user/overlayfs-user.bb @@ -12,6 +12,11 @@ OVERLAYFS_WRITABLE_PATHS[mnt-overlay] += "/usr/share/my-application" do_install() { install -d ${D}/usr/share/my-application + install -d ${D}${sysconfdir} + echo "Original file in /etc" >> ${D}${sysconfdir}/lower-layer-test.txt } -FILES:${PN} += "/usr" +FILES:${PN} += "\ + ${exec_prefix} \ + ${sysconfdir \ +" diff --git a/meta/lib/oeqa/selftest/cases/overlayfs.py b/meta/lib/oeqa/selftest/cases/overlayfs.py index f550015b4b..57a8c8bdb6 100644 --- a/meta/lib/oeqa/selftest/cases/overlayfs.py +++ b/meta/lib/oeqa/selftest/cases/overlayfs.py @@ -381,28 +381,7 @@ OVERLAYFS_ETC_DEVICE = "/dev/sda3" Author: Vyacheslav Yurkov """ - config = """ -DISTRO_FEATURES:append = " systemd" - -# Use systemd as init manager -VIRTUAL-RUNTIME_init_manager = "systemd" - -# enable overlayfs in the kernel -KERNEL_EXTRA_FEATURES:append = " features/overlayfs/overlayfs.scc" - -IMAGE_FSTYPES += "wic" -OVERLAYFS_INIT_OPTION = "{OVERLAYFS_INIT_OPTION}" -WKS_FILE = "overlayfs_etc.wks.in" - -EXTRA_IMAGE_FEATURES += "read-only-rootfs" -# Image configuration for overlayfs-etc -EXTRA_IMAGE_FEATURES += "overlayfs-etc" -IMAGE_FEATURES:remove = "package-management" -OVERLAYFS_ETC_MOUNT_POINT = "/data" -OVERLAYFS_ETC_FSTYPE = "ext4" -OVERLAYFS_ETC_DEVICE = "/dev/sda3" -OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "{OVERLAYFS_ETC_USE_ORIG_INIT_NAME}" -""" + config = self.get_working_config() args = { 'OVERLAYFS_INIT_OPTION': "" if origInit else "init=/sbin/preinit", @@ -423,6 +402,11 @@ OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "{OVERLAYFS_ETC_USE_ORIG_INIT_NAME}" line = getline_qemu(output, "upperdir=/data/overlay-etc/upper") self.assertTrue(line and line.startswith("/data/overlay-etc/upper on /etc type overlay"), msg=output) + # check that lower layer is not available + status, output = qemu.run_serial("ls -1 /data/overlay-etc/lower") + line = getline_qemu(output, "No such file or directory") + self.assertTrue(line, msg=output) + status, output = qemu.run_serial("touch " + testFile) status, output = qemu.run_serial("sync") status, output = qemu.run_serial("ls -1 " + testFile) @@ -434,3 +418,65 @@ OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "{OVERLAYFS_ETC_USE_ORIG_INIT_NAME}" status, output = qemu.run_serial("ls -1 " + testFile) line = getline_qemu(output, testFile) self.assertTrue(line and line.startswith(testFile), msg=output) + + def test_lower_layer_access(self): + """ + Summary: Test that lower layer of /etc is available read-only when configured + Expected: Can't write to lower layer. The files on lower and upper different after + modification + Author: Vyacheslav Yurkov + """ + + config = self.get_working_config() + + configLower = """ +OVERLAYFS_ETC_EXPOSE_LOWER = "1" +IMAGE_INSTALL:append = " overlayfs-user" +""" + testFile = "lower-layer-test.txt" + + args = { + 'OVERLAYFS_INIT_OPTION': "", + 'OVERLAYFS_ETC_USE_ORIG_INIT_NAME': 1 + } + + self.write_config(config.format(**args)) + + self.append_config(configLower) + bitbake('core-image-minimal') + + with runqemu('core-image-minimal', image_fstype='wic') as qemu: + status, output = qemu.run_serial("echo \"Modified in upper\" > /etc/" + testFile) + status, output = qemu.run_serial("diff /etc/" + testFile + " /data/overlay-etc/lower/" + testFile) + line = getline_qemu(output, "Modified in upper") + self.assertTrue(line, msg=output) + line = getline_qemu(output, "Original file") + self.assertTrue(line, msg=output) + + status, output = qemu.run_serial("touch /data/overlay-etc/lower/ro-test.txt") + line = getline_qemu(output, "Read-only file system") + self.assertTrue(line, msg=output) + + def get_working_config(self): + return """ +DISTRO_FEATURES:append = " systemd" + +# Use systemd as init manager +VIRTUAL-RUNTIME_init_manager = "systemd" + +# enable overlayfs in the kernel +KERNEL_EXTRA_FEATURES:append = " features/overlayfs/overlayfs.scc" + +IMAGE_FSTYPES += "wic" +OVERLAYFS_INIT_OPTION = "{OVERLAYFS_INIT_OPTION}" +WKS_FILE = "overlayfs_etc.wks.in" + +EXTRA_IMAGE_FEATURES += "read-only-rootfs" +# Image configuration for overlayfs-etc +EXTRA_IMAGE_FEATURES += "overlayfs-etc" +IMAGE_FEATURES:remove = "package-management" +OVERLAYFS_ETC_MOUNT_POINT = "/data" +OVERLAYFS_ETC_FSTYPE = "ext4" +OVERLAYFS_ETC_DEVICE = "/dev/sda3" +OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "{OVERLAYFS_ETC_USE_ORIG_INIT_NAME}" +"""