From patchwork Thu Apr 6 08:44:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dit Kozmaj X-Patchwork-Id: 22306 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 08A0DC7618D for ; Thu, 6 Apr 2023 08:46:14 +0000 (UTC) Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) by mx.groups.io with SMTP id smtpd.web11.153783.1680770772882879506 for ; Thu, 06 Apr 2023 01:46:13 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kynetics-com.20210112.gappssmtp.com header.s=20210112 header.b=yJ5dO0f1; spf=neutral (domain: kynetics.com, ip: 209.85.208.52, mailfrom: dit.kozmaj@kynetics.com) Received: by mail-ed1-f52.google.com with SMTP id i5so147712927eda.0 for ; Thu, 06 Apr 2023 01:46:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kynetics-com.20210112.gappssmtp.com; s=20210112; t=1680770771; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=vJzj40/c+dDZV+4AQqNRSvObAh6AJJUhqjOTCDY2xNw=; b=yJ5dO0f1HmS85lEOZaw6td/yzNlmJgQ8CZg6+msWtcQ3Rvq5xbEVpeQ58N3N4xs+pO dkxsVFtry10mqGP5sX1AjOp5nNTqWYdTvS3erwp0L2TcB+tTWfIjNJP/NNtFL1ZYSl6c o/WIWMmN3Bjw3s1BEw+Nk8fjskCuLjAlJINs1pDjnOfs4L5RvP6qW2eGeQJucr/jp3DQ t/485M31LyKDZv9+/Jnk36iP83lrwKpZ8kYsWJm0g+MRpwtkzG/eBejXbjjlDlYfjD3p /Y0N/m/lkjo7csel7knZuWzVvQTdScwJH0tVxvpFhvwvLTNa/mCaUsYQnZ4rGl21PnlO rGcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680770771; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vJzj40/c+dDZV+4AQqNRSvObAh6AJJUhqjOTCDY2xNw=; b=FN+OpaEDu3HFfuUmbp+2+J4Sp0TKQovtDBhQ2mPqrrUC3feezHyMIwHaHxEp2nG/UL j5m0R9OobjrUCUHv/U8m9AMBky7acviX7GjZtTZk0Pmek14biyA3hoHwSdIfQPPX3QOq gsgEWgKcR2VEpk6MKAEHvN2HcyaQkqYtpMRE9lMdwPdks9cK2F5BHSmuF+EcJUc07nKF 6XyEIEz1v68J3o//Yhjy8jF5MEKK5FxGLiMYPk+e9zpDPn8Xd7HFTQKKBraSMHw3CbJh LvhNP0FLUWMZJW8hyoAV0N0eFuGDo1/ySw7F0SPthTXOaiky+jvDCbK0Uh4yjBLymV3G sBaw== X-Gm-Message-State: AAQBX9eAG57vHIRxAXzNKEGKir/32DTiaZgN9CxLSvQzCSOOPLNkV21T IXRD6O7fXwFKhPdmZ0KFfoHE4PrmUT13+cqCelo= X-Google-Smtp-Source: AKy350b6oax99ZOkPvDiKJNXZXtRQbiOC3bxix3a6oRe5cBhQ00ZHPyh8dQi/a1rvTLsWrq3+ckO2g== X-Received: by 2002:a17:906:4e56:b0:948:b988:8cc3 with SMTP id g22-20020a1709064e5600b00948b9888cc3mr5257143ejw.75.1680770770974; Thu, 06 Apr 2023 01:46:10 -0700 (PDT) Received: from localhost.localdomain (217-133-17-98.static.clienti.tiscali.it. [217.133.17.98]) by smtp.gmail.com with ESMTPSA id v13-20020a50954d000000b004fc649481basm440544eda.58.2023.04.06.01.46.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Apr 2023 01:46:10 -0700 (PDT) From: dit.kozmaj@kynetics.com To: openembedded-core@lists.openembedded.org Cc: Dit Kozmaj , Diego Rondini Subject: [PATCH 1/3] wic: use part_name when defined Date: Thu, 6 Apr 2023 10:44:15 +0200 Message-Id: <20230406084417.34931-1-dit.kozmaj@kynetics.com> X-Mailer: git-send-email 2.34.1 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 ; Thu, 06 Apr 2023 08:46:14 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/179760 From: Dit Kozmaj So far part.label has been used to define GPT partition label even if part.part_name was defined. Fix the code to use part.part_name whenever available, as it makes sense to have a GPT partition label which is different from the contained filesystem label. Signed-off-by: Dit Kozmaj Signed-off-by: Diego Rondini --- scripts/lib/wic/plugins/imager/direct.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py index dfaa901567..7315d8f073 100644 --- a/scripts/lib/wic/plugins/imager/direct.py +++ b/scripts/lib/wic/plugins/imager/direct.py @@ -571,11 +571,12 @@ class PartitionedImage(): self._create_partition(self.path, part.type, parted_fs_type, part.start, part.size_sec) - if part.part_name: + if self.ptable_format == "gpt" and (part.part_name or part.label): + partition_label = part.part_name if part.part_name else part.label logger.debug("partition %d: set name to %s", - part.num, part.part_name) + part.num, partition_label) exec_native_cmd("sgdisk --change-name=%d:%s %s" % \ - (part.num, part.part_name, + (part.num, partition_label, self.path), self.native_sysroot) if part.part_type: @@ -592,13 +593,6 @@ class PartitionedImage(): (part.num, part.uuid, self.path), self.native_sysroot) - if part.label and self.ptable_format == "gpt": - logger.debug("partition %d: set name to %s", - part.num, part.label) - exec_native_cmd("parted -s %s name %d %s" % \ - (self.path, part.num, part.label), - self.native_sysroot) - if part.active: flag_name = "legacy_boot" if self.ptable_format == 'gpt' else "boot" logger.debug("Set '%s' flag for partition '%s' on disk '%s'", From patchwork Thu Apr 6 08:44:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dit Kozmaj X-Patchwork-Id: 22307 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 07CA9C76196 for ; Thu, 6 Apr 2023 08:46:24 +0000 (UTC) Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) by mx.groups.io with SMTP id smtpd.web11.153784.1680770780056000035 for ; Thu, 06 Apr 2023 01:46:20 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kynetics-com.20210112.gappssmtp.com header.s=20210112 header.b=tzOxg+IO; spf=neutral (domain: kynetics.com, ip: 209.85.218.50, mailfrom: dit.kozmaj@kynetics.com) Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-9338d479a21so110865866b.1 for ; Thu, 06 Apr 2023 01:46:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kynetics-com.20210112.gappssmtp.com; s=20210112; t=1680770778; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sy0C8HbubT6uDaJfUuttgwV8TZiw6TRar/MU2z2ld10=; b=tzOxg+IOck2rQYtJbYqmFXnL0SiP01wWOoURgPBRNygXBw2nK16NF8rrJblpc+dPz3 5+s2118yEttjvsO0DNRYTv4xvVSE9J+yrR/4GnIRx8SPeuO+lh6sTKsLxLEl5SWWzbSt h8287Eap7lb+csGP3xwfVoGrIZmLdADAnCrM86DuNaNrMnOVUo9++wQMCsdPXpsIrwY5 rJTNRqOhNp9T6aBJVIH4Dy67hFf6oCVIYEoZH0L3mCYwKWsHo/HJrtcYCEoLBqmqBZpa INTmx0iTVT26pHRCcYbGZhz73qbZq/qP1yJRpXP3163zfOEpBcttDw2uKIcuubT9KuoD K5Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680770778; 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:message-id:reply-to; bh=sy0C8HbubT6uDaJfUuttgwV8TZiw6TRar/MU2z2ld10=; b=PN0mAqqla8tIA5qYEpGtW/ubn6b1JYOpFaqF96wlqc2GsYZtpdCYtk6yu7+jtrwGZD e37Btx3BDA2LmCNsxUJzA0JYQBcc3sq/+83Qv11/xEalHRyNPmrQvJzmu9g6FWPAMNlG J6YZk5pyT7ItoWtKMyjNodbgF3p1U5BIUDR53DhABAMssBmvXz6wWX4iP72pNxqkKQSB ITTOrHx5S0zQH2RNynJjjal5Eh855i3bYf6xT4cvvzCvA9bhqhYgaisZnA/Q5xQ8z9HY Al9LyT73aXT1IQzttUL2KvKe2JhZ45gEyDivuwaIQ1Ypq5o6+wBYd1JTevCxQ5iRnKZX cz4w== X-Gm-Message-State: AAQBX9e0UOLY0IPP3MOOXh6bZbIQXhYGb4g+AeVeDL38/qMAjDsVG6tC FL0PjUuF+1zCxyg+C5RnXW7/z8rAbhF6WvBTe5A= X-Google-Smtp-Source: AKy350ZFC3420OWTemtNud355rxa9oA2jqEqUXa1ZRbkqG3RJEsQaB8bKidDuQR+4bMbhv4lkyuBtQ== X-Received: by 2002:a05:6402:1842:b0:4fd:21a6:a649 with SMTP id v2-20020a056402184200b004fd21a6a649mr3710839edy.40.1680770778349; Thu, 06 Apr 2023 01:46:18 -0700 (PDT) Received: from localhost.localdomain (217-133-17-98.static.clienti.tiscali.it. [217.133.17.98]) by smtp.gmail.com with ESMTPSA id v13-20020a50954d000000b004fc649481basm440544eda.58.2023.04.06.01.46.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Apr 2023 01:46:17 -0700 (PDT) From: dit.kozmaj@kynetics.com To: openembedded-core@lists.openembedded.org Cc: Dit Kozmaj Subject: [PATCH 2/3] selftest: wic: Add test for --part-name argument Date: Thu, 6 Apr 2023 10:44:16 +0200 Message-Id: <20230406084417.34931-2-dit.kozmaj@kynetics.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230406084417.34931-1-dit.kozmaj@kynetics.com> References: <20230406084417.34931-1-dit.kozmaj@kynetics.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 ; Thu, 06 Apr 2023 08:46:24 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/179761 From: Dit Kozmaj Add test for wic --part-name argument in .wks file. Test three different cases: - Set only the --part-name argument. - Set only the --label argument. In this case the GPT partition label is set to the value of --label for compatibility reasons. - Set both. In this case the code has been changed to set the GPT partition label to the --part-name value. The test uses a test_gpt_partition_name.wks file created for this purpose. Signed-off-by: Dit Kozmaj --- meta-selftest/wic/test_gpt_partition_name.wks | 7 ++++++ meta/lib/oeqa/selftest/cases/wic.py | 23 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 meta-selftest/wic/test_gpt_partition_name.wks diff --git a/meta-selftest/wic/test_gpt_partition_name.wks b/meta-selftest/wic/test_gpt_partition_name.wks new file mode 100644 index 0000000000..7db6da9aee --- /dev/null +++ b/meta-selftest/wic/test_gpt_partition_name.wks @@ -0,0 +1,7 @@ +# short-description: image to test part-name in GPT partitions + +part --fstype=ext4 --part-name boot-A --label boot --size 1M --align 1024 +part / --source rootfs --fstype=ext4 --part-name root-A --align 1024 +part --fstype=ext4 --label ext-space --size 1M --align 1024 + +bootloader --ptable gpt diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py index b26b649c3a..0b0ca90c1e 100644 --- a/meta/lib/oeqa/selftest/cases/wic.py +++ b/meta/lib/oeqa/selftest/cases/wic.py @@ -1348,6 +1348,29 @@ class Wic2(WicTestCase): if os.path.exists(image_path + '.bak'): os.rename(image_path + '.bak', image_path) + def test_gpt_partition_name(self): + """Test --part-name argument to set partition name in GPT table""" + config = 'IMAGE_FSTYPES += "wic"\nWKS_FILE = "test_gpt_partition_name.wks"\n' + self.append_config(config) + bitbake('core-image-minimal') + self.remove_config(config) + deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE') + machine = self.td['MACHINE'] + + image_path = os.path.join(deploy_dir, 'core-image-minimal-%s.wic' % machine) + # Image is created + self.assertTrue(os.path.exists(image_path)) + + # Check the names of the three partitions + # as listed in test_gpt_partition_name.wks + result = runCmd("sfdisk --part-label %s 1" % image_path) + self.assertEqual('boot-A', result.output) + result = runCmd("sfdisk --part-label %s 2" % image_path) + self.assertEqual('root-A', result.output) + # When the --part-name is not defined, the partition name is equal to the --label + result = runCmd("sfdisk --part-label %s 3" % image_path) + self.assertEqual('ext-space', result.output) + class ModifyTests(WicTestCase): def test_wic_ls(self): """Test listing image content using 'wic ls'""" From patchwork Thu Apr 6 08:44:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dit Kozmaj X-Patchwork-Id: 22308 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 0BAD5C7618D for ; Thu, 6 Apr 2023 08:46:24 +0000 (UTC) Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) by mx.groups.io with SMTP id smtpd.web11.153785.1680770782503969865 for ; Thu, 06 Apr 2023 01:46:22 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kynetics-com.20210112.gappssmtp.com header.s=20210112 header.b=McxW0J4L; spf=neutral (domain: kynetics.com, ip: 209.85.218.49, mailfrom: dit.kozmaj@kynetics.com) Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-932072d4c00so127607266b.1 for ; Thu, 06 Apr 2023 01:46:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kynetics-com.20210112.gappssmtp.com; s=20210112; t=1680770780; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bCNACmwq8ederuirruA9cg9i1bNiQGXN0hsfOcRU/fY=; b=McxW0J4LXDK0c5hB+wFVczBkxif1ZUvthEzwZDz5SQopN+633QBxpn9xO+tU0BxJhO gxEAW3FjnEWnOlKZ4LC46bRg8OB6oVjJJkNmuse9bo3RK1TUQvpnfCgbzhyO0YxP6N4l GN05LbJRw+rtKhu9CkQwmI2U5vre3OJkkaHSJNVf4y2LQsXjlcjk1hwXhGDdsvlKzJJT F6wCPdhD7YrIPOLDfsEhW9iUnDQjoJ50ouBEgUHmaUxOdIGP7+UqiY3w6g++eHLSG2D8 TvlWpLins2o+z9PucbZQhq+qBbXSWbYr0fJgv74GR7usXAPq21RYdgRpb5igGywI8Bpn C3DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680770780; 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:message-id:reply-to; bh=bCNACmwq8ederuirruA9cg9i1bNiQGXN0hsfOcRU/fY=; b=w9amUXyY7mFFIL/aq0NkX92szQqcxjTQGptgoTOyJezb8phUyoyNmt86GmrfckWvo6 eODBcE1BNsyt3gDZ+rZg8Qx6oL+s79dSIeBBJFQ/P/fYCWjaqhmsQ0UcRTAeMFAw/cT+ rBlOSEzxqwA4mh1IbsPjg0JwaP82aRUoQhyXpX9j3eWn+qReSXfiWCuOk2KlMIq28h55 zXDenj/kLLJmGh3abUG/Ukmm59g5mjNn4sB4ZSYhdzRAmJxdLRZ/o0y8nCK4t/KjqziH oWsIXwB66eZiJvp15d9xTC3gGrc/ZtyuLoK1+vgME4ld70jRNT42UVwrh1T+3FGM4uhw ix1g== X-Gm-Message-State: AAQBX9ccedlVWUbbV+cCV4DRFnNAN8ih+/ynrQstisyKapJ2xIJbu56f SNEHsY9LZJ6eo2z1/MUDNsvpHMjEIozD7sEzfSQ= X-Google-Smtp-Source: AKy350bz4nD5bFzX/Can7zXb6EkftpCzxw793xFqJj5d+0xlhAVDvKhm9wM/kz5kaun9I3YdADherA== X-Received: by 2002:a05:6402:31ee:b0:502:70e9:2c14 with SMTP id dy14-20020a05640231ee00b0050270e92c14mr4521758edb.29.1680770780630; Thu, 06 Apr 2023 01:46:20 -0700 (PDT) Received: from localhost.localdomain (217-133-17-98.static.clienti.tiscali.it. [217.133.17.98]) by smtp.gmail.com with ESMTPSA id v13-20020a50954d000000b004fc649481basm440544eda.58.2023.04.06.01.46.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Apr 2023 01:46:20 -0700 (PDT) From: dit.kozmaj@kynetics.com To: openembedded-core@lists.openembedded.org Cc: Dit Kozmaj Subject: [PATCH 3/3] kickstart: Expand label and part-name doc Date: Thu, 6 Apr 2023 10:44:17 +0200 Message-Id: <20230406084417.34931-3-dit.kozmaj@kynetics.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230406084417.34931-1-dit.kozmaj@kynetics.com> References: <20230406084417.34931-1-dit.kozmaj@kynetics.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 ; Thu, 06 Apr 2023 08:46:24 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/179762 From: Dit Kozmaj Update --label and --part-name documentation to reflect the behaviour with GPT partition format. Signed-off-by: Dit Kozmaj --- documentation/ref-manual/kickstart.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/documentation/ref-manual/kickstart.rst b/documentation/ref-manual/kickstart.rst index 297887805c..a01f035cd2 100644 --- a/documentation/ref-manual/kickstart.rst +++ b/documentation/ref-manual/kickstart.rst @@ -135,6 +135,8 @@ the ``part`` and ``partition`` commands: - ``--label label``: Specifies the label to give to the filesystem to be made on the partition. If the given label is already in use by another filesystem, a new label is created for the partition. + If the partition table format is GPT and the ``--part-name`` is not + defined the partition name is set as the value of ``--label``. - ``--active``: Marks the partition as active. @@ -172,7 +174,9 @@ the ``part`` and ``partition`` commands: "1.3". - ``--part-name``: This option is a Wic-specific option that - specifies a name for GPT partitions. + specifies a name for GPT partitions. If both ``--part-name`` and + ``--label`` are defined, the partition name is set to the value of + ``--part-name``. - ``--part-type``: This option is a Wic-specific option that specifies the partition type globally unique identifier (GUID) for