Skip to contentSkip to conversation

poky: image_partition: add class file

PATCH Daniel Chaves 1 participant 1 message Sep 16, 2025 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

When generating an image recipe, including image or core-image BBClasses
adds unnecessary steps like check_image_features and do_rootfs, which assume a populated rootfs and prevent creating an empty one. This class avoids those dependencies, providing a minimal way to build a valid, empty base file system.

Attached below is the patch with corrected indentation, and also appended as a file.

From 9b76df54cff406174baab45d6df73a8d34460b53 Mon Sep 17 00:00:00 2001
From: Daniel Chaves <[email protected]>
Date: Sat, 13 Sep 2025 14:56:32 -0600
Subject: [PATCH] poky: image_partition: add class file

Use this class to create partitions in your desired format. The partition can be found in DEPLOY_DIR_IMAGE.

---
 meta/classes-recipe/image_partition.bbclass | 47 +++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 meta/classes-recipe/image_partition.bbclass
(quoted diff) +0 -0

b/meta/classes-recipe/image_partition.bbclass
new file mode 100644
index 0000000000..86558df82c

meta/classes-recipe/image_partition.bbclass new file +14 -0
@@ -0,0 +1,47 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+# Use this class to create partitions in your desired format. To get started:
+# 1. Create a recipe for the target partition.
+# 2. Inherit this class file.
+# 3. Define the partition metadata as follows:
+#      IMAGE_FSTYPES = "<ext4>"
+#      IMAGE_ROOTFS_SIZE = "<image_rootfs_size>"
+#    IMAGE_ROOTFS_SIZE must be specified in kilobytes.
+# 4. By default this produces an empty filesystem. If you want to

include packages,
+# add them to PACKAGE_INSTALL to fill it with what you need.
+# The partition can be found in DEPLOY_DIR_IMAGE. +
+IMAGE_FEATURES = ""
+IMAGE_LINGUAS = ""
+COPY_LIC_MANIFEST = "0"
+COPY_LIC_DIRS = "0"
+
+FORCE_RO_REMOVE = "1"
+
+PACKAGE_INSTALL = ""
+
+inherit image nopackages
+
+def check_image_features(d):
+ pass
+
+fakeroot python do_rootfs () {
+ pass
+}
+ +SSTATE_SKIP_CREATION:task-image-complete = "0" +SSTATE_SKIP_CREATION:task-image-qa = "0" +
+python sstate_report_unihash() {
+ report_unihash = getattr(bb.parse.siggen, 'report_unihash', None)
+
+ if report_unihash:
+ ss = sstate_state_fromvars(d)
+ if ss['task'] == 'image_complete':
+ os.environ['PSEUDO_DISABLED'] = '1'
+ report_unihash(os.getcwd(), ss['task'], d)
+}

Regards
Daniel

Quoted 83 lines · Ross Burton

Hi,

This should go the [email protected] <mailto:
[email protected]> list, but what does this give over just using an image recipe, considering the output of that can be called a ‘partition’ if you set IMAGE_FSTYPES=ext4.

Ross

Quoted 1 line

On 14 Sep 2025, at 01:10, Daniel via lists.yoctoproject.org <dchvs11=

Quoted 9 lines · [email protected]> wrote:

From 9b76df54cff406174baab45d6df73a8d34460b53 Mon Sep 17 00:00:00 2001
From: Daniel Chaves <[email protected]>
Date: Sat, 13 Sep 2025 14:56:32 -0600
Subject: [PATCH] poky: image_partition: add class file

Use this class to create partitions in your desired format. The partition can be found in DEPLOY_DIR_IMAGE.

Review

Quoted 7 lines

---
meta/classes-recipe/image_partition.bbclass | 47 +++++++++++++++++++++

1 file changed, 47 insertions(+)

create mode 100644 meta/classes-recipe/image_partition.bbclass

(quoted diff) +0 -0

b/meta/classes-recipe/image_partition.bbclass

meta/classes-recipe/image_partition.bbclass line 7

Quoted 12 lines

new file mode 100644
index 0000000000..86558df82c

meta/classes-recipe/image_partition.bbclass new file +7 -0
@@ -0,0 +1,47 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+# Use this class to create partitions in your desired format. To get

started:

meta/classes-recipe/image_partition.bbclass line 14

Quoted 7 lines
meta/classes-recipe/image_partition.bbclass new file +7 -0
+# 1. Create a recipe for the target partition.
+# 2. Inherit this class file.
+# 3. Define the partition metadata as follows:
+# IMAGE_FSTYPES = "<ext4>"
+# IMAGE_ROOTFS_SIZE = "<image_rootfs_size>"
+# IMAGE_ROOTFS_SIZE must be specified in kilobytes.
+# 4. By default this produces an empty filesystem. If you want to

include packages,

Quoted 34 lines
meta/classes-recipe/image_partition.bbclass new file +33 -0
+# add them to PACKAGE_INSTALL to fill it with what you need.
+# The partition can be found in DEPLOY_DIR_IMAGE.
+
+IMAGE_FEATURES = ""
+IMAGE_LINGUAS = ""
+COPY_LIC_MANIFEST = "0"
+COPY_LIC_DIRS = "0"
+
+FORCE_RO_REMOVE = "1"
+
+PACKAGE_INSTALL = ""
+
+inherit image nopackages
+
+def check_image_features(d):
+ pass
+
+fakeroot python do_rootfs () {
+ pass
+}
+
+SSTATE_SKIP_CREATION:task-image-complete = "0"
+SSTATE_SKIP_CREATION:task-image-qa = "0"
+
+python sstate_report_unihash() {
+ report_unihash = getattr(bb.parse.siggen, 'report_unihash', None)
+
+ if report_unihash:
+ ss = sstate_state_fromvars(d)
+ if ss['task'] == 'image_complete':
+ os.environ['PSEUDO_DISABLED'] = '1'
+ report_unihash(os.getcwd(), ss['task'], d)
+}
Quoted 12 lines
Quoted 3 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#15646):

https://lists.yoctoproject.org/g/linux-yocto/message/15646

Quoted 3 lines

Mute This Topic: https://lists.yoctoproject.org/mt/115231333/6875888
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [

[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

From 9b76df54cff406174baab45d6df73a8d34460b53 Mon Sep 17 00:00:00 2001
From: Daniel Chaves <[email protected]>
Date: Sat, 13 Sep 2025 14:56:32 -0600
Subject: [PATCH] poky: image_partition: add class file

Use this class to create partitions in your desired format. The partition can be found in DEPLOY_DIR_IMAGE.

---
 meta/classes-recipe/image_partition.bbclass | 47 +++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 meta/classes-recipe/image_partition.bbclass
meta/classes-recipe/image_partition.bbclass new file +47 -0

47 lines not on this page · raw message