diff options
author | Hongxu Jia <hongxu.jia@windriver.com> | 2019-04-12 05:10:38 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-04-12 13:32:48 +0100 |
commit | 03cc7d03efa08a31776f19e4f93f5517c1f5147c (patch) | |
tree | 952223dbb3fb3c6524711bc6288dc066073159f5 | |
parent | 4fe07763c7078c67e45be9952cbedcf8c94b86ea (diff) | |
download | poky-03cc7d03efa08a31776f19e4f93f5517c1f5147c.tar.gz |
image_types.bbclass: fix a race between the ubi and ubifs FSTYPES
The ubi, ubifs and multiubi FSTYPES calls `mkfs.ubifs' to create UBIFS
images.
In do_image_ubi, $vname is empty, the name of UBIFS image conflicts with
the one in do_image_ubifs, and it's a race risk.
[do_image_ubi]
mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${IMGDEPLOYDIR}/${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.ubifs ${mkubifs_args}
[do_image_ubi]
[do_image_ubifs]
mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.ubifs ${MKUBIFS_ARGS}
[do_image_ubifs]
In do_image_multiubi, $vname is not empty, the UBIFS image name does
not conflict with others.
So do not call mkfs.ubifs in do_image_ubi and depend on do_image_ubifs
to create UBIFS images.
The fix does not affect do_image_multiubi which still call mkfs.ubifs to
create multiple UBIFS images and symlinks.
[YOCTO #13272]
(From OE-Core rev: 3e5f075184d91dd99cf25cfe84bba1c946ed0c7c)
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/image_types.bbclass | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass index f363c42ee5..95aa1674cf 100644 --- a/meta/classes/image_types.bbclass +++ b/meta/classes/image_types.bbclass | |||
@@ -170,7 +170,9 @@ multiubi_mkfs() { | |||
170 | echo vol_type=dynamic >> ubinize${vname}-${IMAGE_NAME}.cfg | 170 | echo vol_type=dynamic >> ubinize${vname}-${IMAGE_NAME}.cfg |
171 | echo vol_name=${UBI_VOLNAME} >> ubinize${vname}-${IMAGE_NAME}.cfg | 171 | echo vol_name=${UBI_VOLNAME} >> ubinize${vname}-${IMAGE_NAME}.cfg |
172 | echo vol_flags=autoresize >> ubinize${vname}-${IMAGE_NAME}.cfg | 172 | echo vol_flags=autoresize >> ubinize${vname}-${IMAGE_NAME}.cfg |
173 | mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${IMGDEPLOYDIR}/${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.ubifs ${mkubifs_args} | 173 | if [ -n "$vname" ]; then |
174 | mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${IMGDEPLOYDIR}/${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.ubifs ${mkubifs_args} | ||
175 | fi | ||
174 | ubinize -o ${IMGDEPLOYDIR}/${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.ubi ${ubinize_args} ubinize${vname}-${IMAGE_NAME}.cfg | 176 | ubinize -o ${IMGDEPLOYDIR}/${IMAGE_NAME}${vname}${IMAGE_NAME_SUFFIX}.ubi ${ubinize_args} ubinize${vname}-${IMAGE_NAME}.cfg |
175 | 177 | ||
176 | # Cleanup cfg file | 178 | # Cleanup cfg file |
@@ -204,6 +206,7 @@ IMAGE_CMD_multiubi () { | |||
204 | IMAGE_CMD_ubi () { | 206 | IMAGE_CMD_ubi () { |
205 | multiubi_mkfs "${MKUBIFS_ARGS}" "${UBINIZE_ARGS}" | 207 | multiubi_mkfs "${MKUBIFS_ARGS}" "${UBINIZE_ARGS}" |
206 | } | 208 | } |
209 | IMAGE_TYPEDEP_ubi = "ubifs" | ||
207 | 210 | ||
208 | IMAGE_CMD_ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.ubifs ${MKUBIFS_ARGS}" | 211 | IMAGE_CMD_ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.ubifs ${MKUBIFS_ARGS}" |
209 | 212 | ||