[oe-commits] Nathan Rossi : image_types.bbclass: Populate cpio /init as symlink

git at git.openembedded.org git at git.openembedded.org
Fri Dec 19 18:08:41 UTC 2014


Module: openembedded-core.git
Branch: master
Commit: 3505558e067fdde4ab7aaaf3c50886f292d7c166
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=3505558e067fdde4ab7aaaf3c50886f292d7c166

Author: Nathan Rossi <nathan.rossi at xilinx.com>
Date:   Tue Dec  9 15:50:05 2014 +1000

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 at xilinx.com>
Signed-off-by: Ross Burton <ross.burton at intel.com>

---

 meta/classes/image_types.bbclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 9aee745..1b8ceee 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
 }



More information about the Openembedded-commits mailing list