summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorJonas Eriksson <jonas.eriksson@enea.com>2014-03-24 16:56:05 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-27 09:42:05 +0000
commitcdf0d9715eca62f9bd86e0a1ae6e435b43cf8d87 (patch)
tree4e9da51ce243dbf34f723c5ab9816a1d7e4a8348 /meta/classes
parent0ba78399f462618156c5853822eb8d73a297289b (diff)
downloadpoky-cdf0d9715eca62f9bd86e0a1ae6e435b43cf8d87.tar.gz
cpio rootfs build: Avoid modifying rootfs dir
The Linux kernel requires that initrd images contain a /init file for the image to be used as an initrd, even if it is empty. Adding it into the rootfs directory creates a race, that can upset tar when building both a .tar and .cpio image file ("tar: .: file changed as we read it"). Additionally, whether or not the tar file will contain the /init file is also up to the race condition. To avoid this problem, move the /init addition out from the rootfs directory, and thus only include it in the .cpio image. (From OE-Core rev: 706055503f493a5af73240c0983c46dbe31d8fe9) Signed-off-by: Jonas Eriksson <jonas.eriksson@enea.com> Signed-off-by: Josep Puigdemont <josep.puigdemont@enea.com> Cc: Laurentiu Palcu <laurentiu.palcu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/image_types.bbclass8
1 files changed, 5 insertions, 3 deletions
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index b693317a9f..f38e3b6a11 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -66,10 +66,12 @@ IMAGE_CMD_squashfs-xz = "mksquashfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_
66IMAGE_CMD_tar = "tar -cvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar -C ${IMAGE_ROOTFS} ." 66IMAGE_CMD_tar = "tar -cvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar -C ${IMAGE_ROOTFS} ."
67 67
68IMAGE_CMD_cpio () { 68IMAGE_CMD_cpio () {
69 if [ ! -L ${IMAGE_ROOTFS}/init ]; then
70 touch ${IMAGE_ROOTFS}/init
71 fi
72 (cd ${IMAGE_ROOTFS} && find . | cpio -o -H newc >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio) 69 (cd ${IMAGE_ROOTFS} && find . | cpio -o -H newc >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio)
70 if [ ! -e ${IMAGE_ROOTFS}/init ]; then
71 mkdir -p ${WORKDIR}/cpio_append
72 touch ${WORKDIR}/cpio_append/init
73 (cd ${WORKDIR}/cpio_append && echo ./init | cpio -oA -H newc -F ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio)
74 fi
73} 75}
74 76
75ELF_KERNEL ?= "${STAGING_DIR_HOST}/usr/src/kernel/${KERNEL_IMAGETYPE}" 77ELF_KERNEL ?= "${STAGING_DIR_HOST}/usr/src/kernel/${KERNEL_IMAGETYPE}"