summaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
authorPushpal Sidhu <psidhu@gateworks.com>2015-04-24 17:32:22 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-07 23:57:13 +0100
commit1255476161f409a0999650c2c8bdaf36b1ba4b95 (patch)
tree6ae91f27b3e65b86a6f0efc8b9edd9f184d10f01 /meta
parent04554b128c358e3c10f6581fd4506764a65240b8 (diff)
downloadopenembedded-core-1255476161f409a0999650c2c8bdaf36b1ba4b95.tar.gz
openembedded-core-1255476161f409a0999650c2c8bdaf36b1ba4b95.tar.bz2
openembedded-core-1255476161f409a0999650c2c8bdaf36b1ba4b95.zip
image_types.bbclass: add support for multiple ubi sizes
Add new FSTYPE called 'multiubi'. This new type has the ability to create multple ubi's, something that's extremely useful on boards that can include varying flash sizes (e.g. 256MB vs 2GB). Because we don't want to reuse code, I extracted the mkfs and ubinize commands out to a new function that will handle the creation of both multiple ubi's, as well as the 'ubi' FSTYPE (so as not to break current boards). Due to the single processes nature of the OE when doing it's 'create_image', this new multiubi_mkfs function also creates it's own symlinks as well as cleans up it's own cfg file. Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/image_types.bbclass55
1 files changed, 43 insertions, 12 deletions
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 9668bad7e3..588a474620 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -97,18 +97,48 @@ IMAGE_TYPEDEP_elf = "cpio.gz"
UBI_VOLNAME ?= "${MACHINE}-rootfs"
-IMAGE_CMD_ubi () {
- echo \[ubifs\] > ubinize.cfg
- echo mode=ubi >> ubinize.cfg
- echo image=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs >> ubinize.cfg
- echo vol_id=0 >> ubinize.cfg
- echo vol_type=dynamic >> ubinize.cfg
- echo vol_name=${UBI_VOLNAME} >> ubinize.cfg
- echo vol_flags=autoresize >> ubinize.cfg
- mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs ${MKUBIFS_ARGS}
- ubinize -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubi ${UBINIZE_ARGS} ubinize.cfg
+multiubi_mkfs() {
+ local mkubifs_args="$1"
+ local ubinize_args="$2"
+ local vname="_$3"
+
+ echo \[ubifs\] > ubinize${vname}.cfg
+ echo mode=ubi >> ubinize${vname}.cfg
+ echo image=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${vname}.rootfs.ubifs >> ubinize${vname}.cfg
+ echo vol_id=0 >> ubinize${vname}.cfg
+ echo vol_type=dynamic >> ubinize${vname}.cfg
+ echo vol_name=${UBI_VOLNAME} >> ubinize${vname}.cfg
+ echo vol_flags=autoresize >> ubinize${vname}.cfg
+ mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${vname}.rootfs.ubifs ${mkubifs_args}
+ ubinize -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${vname}.rootfs.ubi ${ubinize_args} ubinize${vname}.cfg
+
+ # Cleanup cfg file
+ mv ubinize${vname}.cfg ${DEPLOY_DIR_IMAGE}/
+
+ # Create own symlink
+ cd ${DEPLOY_DIR_IMAGE}
+ if [ -e ${IMAGE_NAME}${vname}.rootfs.ubifs ]; then
+ ln -sf ${IMAGE_NAME}${vname}.rootfs.ubifs \
+ ${IMAGE_LINK_NAME}${vname}.ubifs
+ fi
+ if [ -e ${IMAGE_NAME}${vname}.rootfs.ubi ]; then
+ ln -sf ${IMAGE_NAME}${vname}.rootfs.ubi \
+ ${IMAGE_LINK_NAME}${vname}.ubi
+ fi
+ cd -
+}
+
+IMAGE_CMD_multiubi () {
+ # Split MKUBIFS_ARGS_<name> and UBINIZE_ARGS_<name>
+ for name in ${MULTIUBI_BUILD}; do
+ eval local mkubifs_args=\"\$MKUBIFS_ARGS_${name}\"
+ eval local ubinize_args=\"\$UBINIZE_ARGS_${name}\"
+
+ multiubi_mkfs "${mkubifs_args}" "${ubinize_args}" "${name}"
+ done
}
-IMAGE_TYPEDEP_ubi = "ubifs"
+
+IMAGE_CMD_ubi = "multiubi_mkfs "${MKUBIFS_ARGS}" "${UBINIZE_ARGS}" "${UBI_VOLNAME}""
IMAGE_CMD_ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs ${MKUBIFS_ARGS}"
@@ -139,6 +169,7 @@ IMAGE_DEPENDS_squashfs-lzo = "squashfs-tools-native"
IMAGE_DEPENDS_elf = "virtual/kernel mkelfimage-native"
IMAGE_DEPENDS_ubi = "mtd-utils-native"
IMAGE_DEPENDS_ubifs = "mtd-utils-native"
+IMAGE_DEPENDS_multiubi = "mtd-utils-native"
# This variable is available to request which values are suitable for IMAGE_FSTYPES
IMAGE_TYPES = " \
@@ -151,7 +182,7 @@ IMAGE_TYPES = " \
iso \
hddimg \
squashfs squashfs-xz squashfs-lzo \
- ubi ubifs \
+ ubi ubifs multiubi \
tar tar.gz tar.bz2 tar.xz tar.lz4 \
cpio cpio.gz cpio.xz cpio.lzma cpio.lz4 \
vmdk \