summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorEnrico Scholz <enrico.scholz@sigma-chemnitz.de>2015-01-22 17:13:00 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-11 17:40:08 +0000
commit71164f126ba853f611d8f366ccb9c63df78480a2 (patch)
treeb2007877295feae285ca27c6ce4cdeb796d5d7a4 /meta
parent76ba20f9c0009cb2aedc4ce7050e119683df05c4 (diff)
downloadpoky-71164f126ba853f611d8f366ccb9c63df78480a2.tar.gz
image_types.bbclass: fixed 'init' creation for cpio images
When /init is a dangling symlink or a symlink to a file which can not be stated on the build system (e.g. due to SELinux restrictions), the '[ ! -e .../init ]' test will succeed which causes the manual creation of /init. E.g. here: | $ ls -la cpio_append/init | lrwxrwxrwx. 1 ensc ensc 10 22. Jan 16:26 cpio_append/init -> /sbin/init | | $ strace /bin/test -e cpio_append/init | stat("cpio_append/init", 0x7fff374a9db0) = -1 EACCES (Permission denied) | exit_group(1) = ? To test for the existence of a file, both '-L' and '-e' checks must be executed and to prevent SELinux noise, the '-L' should happen before '-e'. (From OE-Core rev: 2aa5d2880ee3578f4965f245addd365fb7b1c1ca) (From OE-Core rev: f8d3bee7140cade4c70a1c6583fb6d9ef4063b92) Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/image_types.bbclass4
1 files changed, 2 insertions, 2 deletions
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 8e33214955..650c2f8a5f 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -68,9 +68,9 @@ IMAGE_CMD_tar = "tar -cvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar -C ${IMAG
68 68
69IMAGE_CMD_cpio () { 69IMAGE_CMD_cpio () {
70 (cd ${IMAGE_ROOTFS} && find . | cpio -o -H newc >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio) 70 (cd ${IMAGE_ROOTFS} && find . | cpio -o -H newc >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio)
71 if [ ! -e ${IMAGE_ROOTFS}/init ]; then 71 if [ ! -L ${IMAGE_ROOTFS}/init -a ! -e ${IMAGE_ROOTFS}/init ]; then
72 mkdir -p ${WORKDIR}/cpio_append 72 mkdir -p ${WORKDIR}/cpio_append
73 if [ -e ${IMAGE_ROOTFS}/sbin/init -o -L ${IMAGE_ROOTFS}/sbin/init ]; then 73 if [ -L ${IMAGE_ROOTFS}/sbin/init -o -e ${IMAGE_ROOTFS}/sbin/init ]; then
74 ln -sf /sbin/init ${WORKDIR}/cpio_append/init 74 ln -sf /sbin/init ${WORKDIR}/cpio_append/init
75 else 75 else
76 touch ${WORKDIR}/cpio_append/init 76 touch ${WORKDIR}/cpio_append/init