Initramfs built into custom Linux kernel is not running

前端 未结 1 1820
死守一世寂寞
死守一世寂寞 2021-02-18 15:28

I am building a custom initramfs image that I am building as a CPIO archive into the Linux kernel (3.2).

The issue I am having is that no matter what I try, the kernel d

相关标签:
1条回答
  • 2021-02-18 15:53

    I figured it out. I will post the answer in case anyone else has this issue.

    I was missing a console device, this line was the clue:

    Warning: unable to open an initial console.
    

    After adding printk's so that I better understood the startup sequence, I realized that console device is opened prior to running the init script. Therefore, the console device must be in the initramfs filesystem directly, and we cannot rely on the devtmpfs mount to create that.

    I think when the init script ran the shell was trying to open the console and failed, that's why the kernel was outputting:

    Kernel panic - not syncing: Attempted to kill init!
    

    Executing the folowing commands from within the /dev directory of initramfs on the kernel build machine will generate the required device nodes:

    mknod -m 622 console c 5 1
    mknod -m 622 tty0 c 4 0
    

    After re-CPIO archiving the filesystem and rebuilding the kernel, I finally have a working filesystem in initramfs that the kernel will boot.

    0 讨论(0)
提交回复
热议问题