[oe-commits] Patrick Ohly : initramfs-framework: create /dev/console

git at git.openembedded.org git at git.openembedded.org
Fri Sep 4 16:43:39 UTC 2015


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

Author: Patrick Ohly <patrick.ohly at intel.com>
Date:   Thu Sep  3 20:42:27 2015 +0200

initramfs-framework: create /dev/console

Some kernels, for example linux-yocto 3.19 for qemux86, fail to
execute /init in an initramfs unless there is already a /dev/console
char device in the initramfs. Booting then fails with:
    Kernel panic - not syncing: /dev/console is missing or not a character device!
    Please ensure your rootfs is properly configured

The panic itself comes from a linux-yocto specific patch to
kernel_init_freeable in init/main.c, but even without it, that
function will print an error when /dev/console is missing. The
kernel's Documentation/initrd.txt also mentions creating that device.

It remained unclear why this is not a problem on other machines. On
intel-corei7-64 from meta-intel, something (the kernel?) creates
/dev/console and /dev/[012] before transfering control to the init
script. In that case, creating /dev/console in advance is not
necessary, but does not cause any problem either.

Signed-off-by: Patrick Ohly <patrick.ohly at intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
index 89b900d..6c37b9a 100644
--- a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
@@ -34,6 +34,11 @@ do_install() {
 
     # debug
     install -m 0755 ${WORKDIR}/debug ${D}/init.d/00-debug
+
+    # Create device nodes expected by some kernels in initramfs
+    # before even executing /init.
+    install -d ${D}/dev
+    mknod -m 622 ${D}/dev/console c 5 1
 }
 
 PACKAGES = "${PN}-base \
@@ -42,7 +47,7 @@ PACKAGES = "${PN}-base \
             initramfs-module-e2fs \
             initramfs-module-debug"
 
-FILES_${PN}-base = "/init /init.d/99-finish"
+FILES_${PN}-base = "/init /init.d/99-finish /dev"
 
 SUMMARY_initramfs-module-mdev = "initramfs support for mdev"
 RDEPENDS_initramfs-module-mdev = "${PN}-base"



More information about the Openembedded-commits mailing list