summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Rossi <nathan.rossi@xilinx.com>2014-12-09 15:50:05 +1000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-12-19 17:54:13 +0000
commit3505558e067fdde4ab7aaaf3c50886f292d7c166 (patch)
tree8d1797965791ee0c98610b8e0c7e592651ea09af
parent3678e504cf81f45bd0b0ab315f9cc4da87a633b5 (diff)
downloadopenembedded-core-3505558e067fdde4ab7aaaf3c50886f292d7c166.tar.gz
openembedded-core-3505558e067fdde4ab7aaaf3c50886f292d7c166.tar.bz2
openembedded-core-3505558e067fdde4ab7aaaf3c50886f292d7c166.zip
image_types.bbclass: Populate cpio /init as symlink
For cpio/ramfs the kernel will first attempt to execute /init and will emit the following error as the file is empty: Failed to execute /init (error -13) If /sbin/init exists symlink to it so the kernel can immediately start the correct init executable instead of an empty file. Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
-rw-r--r--meta/classes/image_types.bbclass6
1 files changed, 5 insertions, 1 deletions
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 9aee7458bc..1b8ceeebed 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -70,7 +70,11 @@ IMAGE_CMD_cpio () {
(cd ${IMAGE_ROOTFS} && find . | cpio -o -H newc >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio)
if [ ! -e ${IMAGE_ROOTFS}/init ]; then
mkdir -p ${WORKDIR}/cpio_append
- touch ${WORKDIR}/cpio_append/init
+ if [ -e ${IMAGE_ROOTFS}/sbin/init -o -L ${IMAGE_ROOTFS}/sbin/init ]; then
+ ln -sf /sbin/init ${WORKDIR}/cpio_append/init
+ else
+ touch ${WORKDIR}/cpio_append/init
+ fi
(cd ${WORKDIR}/cpio_append && echo ./init | cpio -oA -H newc -F ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio)
fi
}