diff options
author | Thomas Perrot <thomas.perrot@bootlin.com> | 2021-10-19 01:21:23 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-10-23 17:42:27 +0100 |
commit | cbfd377c7dc6c79749fc80508f5ac8c4bd1ce5d1 (patch) | |
tree | ee32dcad54273b7a6ef92b2bd0d932adba2bab5d | |
parent | 3622d27b84a42a76b064bfebd8fe22ef920a936b (diff) | |
download | poky-cbfd377c7dc6c79749fc80508f5ac8c4bd1ce5d1.tar.gz |
image_types: allow the creation of block devices on top of UBI volumes
Currently, the function multiubi_mkfs doesn't allow using anything else than
UBIFS over UBI.
Here, we propose to introduce two variables that allow to customize the ubinize
configuration and the image dependency, in order to be able to build UBI
images using the ubiblock abstraction layer and block filesystems.
For example, with this change it is possible to build a UBI volume using a
compressed squashfs, with the following configuration:
UBI_VOLTYPE ?= "static"
UBI_IMGTYPE ?= "squasfs-lz4"
(From OE-Core rev: 6f0c6a0cc9b4685716f0991ce350d046810eb8ec)
Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/image_types.bbclass | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass index 32d4cd4c76..f643ed3ce7 100644 --- a/meta/classes/image_types.bbclass +++ b/meta/classes/image_types.bbclass | |||
@@ -139,16 +139,18 @@ IMAGE_CMD:cpio () { | |||
139 | } | 139 | } |
140 | 140 | ||
141 | UBI_VOLNAME ?= "${MACHINE}-rootfs" | 141 | UBI_VOLNAME ?= "${MACHINE}-rootfs" |
142 | UBI_VOLTYPE ?= "dynamic" | ||
143 | UBI_IMGTYPE ?= "ubifs" | ||
142 | 144 | ||
143 | multiubi_mkfs() { | 145 | multiubi_mkfs() { |
144 | local mkubifs_args="$1" | 146 | local mkubifs_args="$1" |
145 | local ubinize_args="$2" | 147 | local ubinize_args="$2" |
146 | 148 | ||
147 | # Added prompt error message for ubi and ubifs image creation. | 149 | # Added prompt error message for ubi and ubifs image creation. |
148 | if [ -z "$mkubifs_args" ] || [ -z "$ubinize_args" ]; then | 150 | if [ -z "$mkubifs_args" ] || [ -z "$ubinize_args" ]; then |
149 | bbfatal "MKUBIFS_ARGS and UBINIZE_ARGS have to be set, see http://www.linux-mtd.infradead.org/faq/ubifs.html for details" | 151 | bbfatal "MKUBIFS_ARGS and UBINIZE_ARGS have to be set, see http://www.linux-mtd.infradead.org/faq/ubifs.html for details" |
150 | fi | 152 | fi |
151 | 153 | ||
152 | if [ -z "$3" ]; then | 154 | if [ -z "$3" ]; then |
153 | local vname="" | 155 | local vname="" |
154 | else | 156 | else |
@@ -157,9 +159,9 @@ multiubi_mkfs() { | |||
157 | 159 | ||
158 | echo \[ubifs\] > ubinize${vname}-${IMAGE_NAME}.cfg | 160 | echo \[ubifs\] > ubinize${vname}-${IMAGE_NAME}.cfg |
159 | echo mode=ubi >> ubinize${vname}-${IMAGE_NAME}.cfg | 161 | echo mode=ubi >> ubinize${vname}-${IMAGE_NAME}.cfg |
160 | echo image=${IMGDEPLOYDIR}/${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.ubifs >> ubinize${vname}-${IMAGE_NAME}.cfg | 162 | echo image=${IMGDEPLOYDIR}/${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.${UBI_IMGTYPE} >> ubinize${vname}-${IMAGE_NAME}.cfg |
161 | echo vol_id=0 >> ubinize${vname}-${IMAGE_NAME}.cfg | 163 | echo vol_id=0 >> ubinize${vname}-${IMAGE_NAME}.cfg |
162 | echo vol_type=dynamic >> ubinize${vname}-${IMAGE_NAME}.cfg | 164 | echo vol_type=${UBI_VOLTYPE} >> ubinize${vname}-${IMAGE_NAME}.cfg |
163 | echo vol_name=${UBI_VOLNAME} >> ubinize${vname}-${IMAGE_NAME}.cfg | 165 | echo vol_name=${UBI_VOLNAME} >> ubinize${vname}-${IMAGE_NAME}.cfg |
164 | echo vol_flags=autoresize >> ubinize${vname}-${IMAGE_NAME}.cfg | 166 | echo vol_flags=autoresize >> ubinize${vname}-${IMAGE_NAME}.cfg |
165 | if [ -n "$vname" ]; then | 167 | if [ -n "$vname" ]; then |
@@ -198,7 +200,7 @@ IMAGE_CMD:multiubi () { | |||
198 | IMAGE_CMD:ubi () { | 200 | IMAGE_CMD:ubi () { |
199 | multiubi_mkfs "${MKUBIFS_ARGS}" "${UBINIZE_ARGS}" | 201 | multiubi_mkfs "${MKUBIFS_ARGS}" "${UBINIZE_ARGS}" |
200 | } | 202 | } |
201 | IMAGE_TYPEDEP:ubi = "ubifs" | 203 | IMAGE_TYPEDEP:ubi = "${UBI_IMGTYPE}" |
202 | 204 | ||
203 | IMAGE_CMD:ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.ubifs ${MKUBIFS_ARGS}" | 205 | IMAGE_CMD:ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.ubifs ${MKUBIFS_ARGS}" |
204 | 206 | ||
@@ -329,7 +331,7 @@ CONVERSION_DEPENDS_gzsync = "zsync-curl-native" | |||
329 | RUNNABLE_IMAGE_TYPES ?= "ext2 ext3 ext4" | 331 | RUNNABLE_IMAGE_TYPES ?= "ext2 ext3 ext4" |
330 | RUNNABLE_MACHINE_PATTERNS ?= "qemu" | 332 | RUNNABLE_MACHINE_PATTERNS ?= "qemu" |
331 | 333 | ||
332 | DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso" | 334 | DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso" |
333 | 335 | ||
334 | # The IMAGE_TYPES_MASKED variable will be used to mask out from the IMAGE_FSTYPES, | 336 | # The IMAGE_TYPES_MASKED variable will be used to mask out from the IMAGE_FSTYPES, |
335 | # images that will not be built at do_rootfs time: vmdk, vhd, vhdx, vdi, qcow2, hddimg, iso, etc. | 337 | # images that will not be built at do_rootfs time: vmdk, vhd, vhdx, vdi, qcow2, hddimg, iso, etc. |