summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorPierre-Loup GOSSE <pierre-loup.gosse@smile.fr>2025-09-30 11:43:44 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-10-03 17:51:38 +0100
commit7a3925c6e50d90b70e687c3c75ca3ab4c10cb245 (patch)
treefa8ef8dfd8b722a02539eba6d56c655a6aab9ae8 /meta
parent3d87b9ca0d829c384680718970811aa31de3008c (diff)
downloadpoky-7a3925c6e50d90b70e687c3c75ca3ab4c10cb245.tar.gz
wic: extra partition plugin
The extra_partition plugin allows populating an extra partition with files listed in the new IMAGE_EXTRA_FILES variable. The implementation is similar to the bootimg_partition plugin. This plugin provides an easy way to install files that are not part of the rootfs. (From OE-Core rev: a6a3d9662947e7f6087a539efd8370b03ae64449) Signed-off-by: Pierre-Loup GOSSE <pierre-loup.gosse@smile.fr> Reviewed-by: Yoann CONGAL <yoann.congal@smile.fr> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes-recipe/image_types_wic.bbclass1
-rw-r--r--meta/lib/oeqa/selftest/cases/wic.py43
2 files changed, 43 insertions, 1 deletions
diff --git a/meta/classes-recipe/image_types_wic.bbclass b/meta/classes-recipe/image_types_wic.bbclass
index 6180874a4c..549a69db60 100644
--- a/meta/classes-recipe/image_types_wic.bbclass
+++ b/meta/classes-recipe/image_types_wic.bbclass
@@ -17,6 +17,7 @@ WICVARS ?= "\
17 IMAGE_BOOT_FILES \ 17 IMAGE_BOOT_FILES \
18 IMAGE_CLASSES \ 18 IMAGE_CLASSES \
19 IMAGE_EFI_BOOT_FILES \ 19 IMAGE_EFI_BOOT_FILES \
20 IMAGE_EXTRA_FILES \
20 IMAGE_LINK_NAME \ 21 IMAGE_LINK_NAME \
21 IMAGE_ROOTFS \ 22 IMAGE_ROOTFS \
22 IMGDEPLOYDIR \ 23 IMGDEPLOYDIR \
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index b1c318bd4e..1b59980f1c 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -18,6 +18,7 @@ from glob import glob
18from shutil import rmtree, copy 18from shutil import rmtree, copy
19from tempfile import NamedTemporaryFile 19from tempfile import NamedTemporaryFile
20from tempfile import TemporaryDirectory 20from tempfile import TemporaryDirectory
21from textwrap import dedent
21 22
22from oeqa.selftest.case import OESelftestTestCase 23from oeqa.selftest.case import OESelftestTestCase
23from oeqa.core.decorator import OETestTag 24from oeqa.core.decorator import OETestTag
@@ -1021,7 +1022,7 @@ class Wic2(WicTestCase):
1021 wicvars = wicvars.difference(('DEPLOY_DIR_IMAGE', 'IMAGE_BOOT_FILES', 1022 wicvars = wicvars.difference(('DEPLOY_DIR_IMAGE', 'IMAGE_BOOT_FILES',
1022 'INITRD', 'INITRD_LIVE', 'ISODIR','INITRAMFS_IMAGE', 1023 'INITRD', 'INITRD_LIVE', 'ISODIR','INITRAMFS_IMAGE',
1023 'INITRAMFS_IMAGE_BUNDLE', 'INITRAMFS_LINK_NAME', 1024 'INITRAMFS_IMAGE_BUNDLE', 'INITRAMFS_LINK_NAME',
1024 'APPEND', 'IMAGE_EFI_BOOT_FILES')) 1025 'APPEND', 'IMAGE_EFI_BOOT_FILES', 'IMAGE_EXTRA_FILES'))
1025 with open(path) as envfile: 1026 with open(path) as envfile:
1026 content = dict(line.split("=", 1) for line in envfile) 1027 content = dict(line.split("=", 1) for line in envfile)
1027 # test if variables used by wic present in the .env file 1028 # test if variables used by wic present in the .env file
@@ -1647,6 +1648,46 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
1647 status, output = qemu.run_serial(cmd) 1648 status, output = qemu.run_serial(cmd)
1648 self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) 1649 self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
1649 1650
1651 def test_extra_partition_plugin(self):
1652 """Test extra partition plugin"""
1653 config = dedent("""\
1654 IMAGE_EXTRA_FILES_label-foo = "bar.conf;foo.conf"
1655 IMAGE_EXTRA_FILES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d = "bar.conf;foobar.conf"
1656 IMAGE_EXTRA_FILES = "foo/*"
1657 WICVARS:append = "\
1658 IMAGE_EXTRA_FILES_label-foo \
1659 IMAGE_EXTRA_FILES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d \
1660 "
1661 """)
1662 self.append_config(config)
1663
1664 deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE')
1665
1666 testfile = open(os.path.join(deploy_dir, "bar.conf"), "w")
1667 testfile.write("test")
1668 testfile.close()
1669
1670 os.mkdir(os.path.join(deploy_dir, "foo"))
1671 testfile = open(os.path.join(deploy_dir, "foo", "bar.conf"), "w")
1672 testfile.write("test")
1673 testfile.close()
1674
1675 with NamedTemporaryFile("w", suffix=".wks") as wks:
1676 wks.writelines(['part / --source extra_partition --ondisk sda --fstype=ext4 --label foo --align 4 --size 5M\n',
1677 'part / --source extra_partition --ondisk sda --fstype=ext4 --uuid e7d0824e-cda3-4bed-9f54-9ef5312d105d --align 4 --size 5M\n',
1678 'part / --source extra_partition --ondisk sda --fstype=ext4 --label bar --align 4 --size 5M\n'])
1679 wks.flush()
1680 _, wicimg = self._get_wic(wks.name)
1681
1682 result = runCmd("wic ls %s | wc -l" % wicimg)
1683 self.assertEqual('4', result.output, msg="Expect 3 partitions, not %s" % result.output)
1684
1685 for part, file in enumerate(["foo.conf", "foobar.conf", "bar.conf"]):
1686 result = runCmd("wic ls %s:%d | grep -q \"%s\"" % (wicimg, part + 1, file))
1687 self.assertEqual(0, result.status, msg="File '%s' not found in the partition #%d" % (file, part))
1688
1689 self.remove_config(config)
1690
1650 def test_fs_types(self): 1691 def test_fs_types(self):
1651 """Test filesystem types for empty and not empty partitions""" 1692 """Test filesystem types for empty and not empty partitions"""
1652 img = 'core-image-minimal' 1693 img = 'core-image-minimal'