diff options
author | Pushpal Sidhu <psidhu@gateworks.com> | 2015-04-24 17:32:22 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-07-08 00:01:23 +0100 |
commit | 9238984340ec80f51183bc1859ccd6c0467a7c6c (patch) | |
tree | 6fa6146498b6b73ac29a5b70cd3bf4ad9dfe5698 /meta | |
parent | d93171c060deb6b3d7ea6ccf07810fc523628219 (diff) | |
download | poky-9238984340ec80f51183bc1859ccd6c0467a7c6c.tar.gz |
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.
(From OE-Core rev: 1255476161f409a0999650c2c8bdaf36b1ba4b95)
Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/image_types.bbclass | 55 |
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" | |||
97 | 97 | ||
98 | UBI_VOLNAME ?= "${MACHINE}-rootfs" | 98 | UBI_VOLNAME ?= "${MACHINE}-rootfs" |
99 | 99 | ||
100 | IMAGE_CMD_ubi () { | 100 | multiubi_mkfs() { |
101 | echo \[ubifs\] > ubinize.cfg | 101 | local mkubifs_args="$1" |
102 | echo mode=ubi >> ubinize.cfg | 102 | local ubinize_args="$2" |
103 | echo image=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs >> ubinize.cfg | 103 | local vname="_$3" |
104 | echo vol_id=0 >> ubinize.cfg | 104 | |
105 | echo vol_type=dynamic >> ubinize.cfg | 105 | echo \[ubifs\] > ubinize${vname}.cfg |
106 | echo vol_name=${UBI_VOLNAME} >> ubinize.cfg | 106 | echo mode=ubi >> ubinize${vname}.cfg |
107 | echo vol_flags=autoresize >> ubinize.cfg | 107 | echo image=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${vname}.rootfs.ubifs >> ubinize${vname}.cfg |
108 | mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs ${MKUBIFS_ARGS} | 108 | echo vol_id=0 >> ubinize${vname}.cfg |
109 | ubinize -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubi ${UBINIZE_ARGS} ubinize.cfg | 109 | echo vol_type=dynamic >> ubinize${vname}.cfg |
110 | echo vol_name=${UBI_VOLNAME} >> ubinize${vname}.cfg | ||
111 | echo vol_flags=autoresize >> ubinize${vname}.cfg | ||
112 | mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${vname}.rootfs.ubifs ${mkubifs_args} | ||
113 | ubinize -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${vname}.rootfs.ubi ${ubinize_args} ubinize${vname}.cfg | ||
114 | |||
115 | # Cleanup cfg file | ||
116 | mv ubinize${vname}.cfg ${DEPLOY_DIR_IMAGE}/ | ||
117 | |||
118 | # Create own symlink | ||
119 | cd ${DEPLOY_DIR_IMAGE} | ||
120 | if [ -e ${IMAGE_NAME}${vname}.rootfs.ubifs ]; then | ||
121 | ln -sf ${IMAGE_NAME}${vname}.rootfs.ubifs \ | ||
122 | ${IMAGE_LINK_NAME}${vname}.ubifs | ||
123 | fi | ||
124 | if [ -e ${IMAGE_NAME}${vname}.rootfs.ubi ]; then | ||
125 | ln -sf ${IMAGE_NAME}${vname}.rootfs.ubi \ | ||
126 | ${IMAGE_LINK_NAME}${vname}.ubi | ||
127 | fi | ||
128 | cd - | ||
129 | } | ||
130 | |||
131 | IMAGE_CMD_multiubi () { | ||
132 | # Split MKUBIFS_ARGS_<name> and UBINIZE_ARGS_<name> | ||
133 | for name in ${MULTIUBI_BUILD}; do | ||
134 | eval local mkubifs_args=\"\$MKUBIFS_ARGS_${name}\" | ||
135 | eval local ubinize_args=\"\$UBINIZE_ARGS_${name}\" | ||
136 | |||
137 | multiubi_mkfs "${mkubifs_args}" "${ubinize_args}" "${name}" | ||
138 | done | ||
110 | } | 139 | } |
111 | IMAGE_TYPEDEP_ubi = "ubifs" | 140 | |
141 | IMAGE_CMD_ubi = "multiubi_mkfs "${MKUBIFS_ARGS}" "${UBINIZE_ARGS}" "${UBI_VOLNAME}"" | ||
112 | 142 | ||
113 | IMAGE_CMD_ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs ${MKUBIFS_ARGS}" | 143 | IMAGE_CMD_ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs ${MKUBIFS_ARGS}" |
114 | 144 | ||
@@ -139,6 +169,7 @@ IMAGE_DEPENDS_squashfs-lzo = "squashfs-tools-native" | |||
139 | IMAGE_DEPENDS_elf = "virtual/kernel mkelfimage-native" | 169 | IMAGE_DEPENDS_elf = "virtual/kernel mkelfimage-native" |
140 | IMAGE_DEPENDS_ubi = "mtd-utils-native" | 170 | IMAGE_DEPENDS_ubi = "mtd-utils-native" |
141 | IMAGE_DEPENDS_ubifs = "mtd-utils-native" | 171 | IMAGE_DEPENDS_ubifs = "mtd-utils-native" |
172 | IMAGE_DEPENDS_multiubi = "mtd-utils-native" | ||
142 | 173 | ||
143 | # This variable is available to request which values are suitable for IMAGE_FSTYPES | 174 | # This variable is available to request which values are suitable for IMAGE_FSTYPES |
144 | IMAGE_TYPES = " \ | 175 | IMAGE_TYPES = " \ |
@@ -151,7 +182,7 @@ IMAGE_TYPES = " \ | |||
151 | iso \ | 182 | iso \ |
152 | hddimg \ | 183 | hddimg \ |
153 | squashfs squashfs-xz squashfs-lzo \ | 184 | squashfs squashfs-xz squashfs-lzo \ |
154 | ubi ubifs \ | 185 | ubi ubifs multiubi \ |
155 | tar tar.gz tar.bz2 tar.xz tar.lz4 \ | 186 | tar tar.gz tar.bz2 tar.xz tar.lz4 \ |
156 | cpio cpio.gz cpio.xz cpio.lzma cpio.lz4 \ | 187 | cpio cpio.gz cpio.xz cpio.lzma cpio.lz4 \ |
157 | vmdk \ | 188 | vmdk \ |