preetam preetam - 17 days ago 6
Linux Question

Why does my initramfs not detect init

I am compiling an initramfs from minimalfs and it fails to detect init during boot.
I have 2 simlinks one at /init and another at sbin/init both pointing to /sbin/init.sysvinit

I just have tried passing the filesystem directory as well as the cpio in the kernel config. The following is the tail of bootlog:

=========================================================

[ 2.152221] vmmc: supplied by vbat
[ 2.157139] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
[ 2.165445] omap_i2c 4802a000.i2c: bus 1 rev0.11 at 100 kHz
[ 2.208472] remoteproc0: wkup_m3 is available
[ 2.213169] remoteproc0: Note: remoteproc is still under development and co.
[ 2.222618] remoteproc0: THE BINARY FORMAT IS NOT YET FINALIZED, and backwa.
[ 2.233660] remoteproc0: Direct firmware load failed with error -2
[ 2.240280] remoteproc0: Falling back to user helper
[ 2.245995] cpu cpu0: of_pm_voltdm_notifier_register: Fail calculating volta2
[ 2.259066] input: volume_keys.8 as /devices/volume_keys.8/input/input2
[ 2.266959] /home/preetam/Workspace/neato/ti-processor-sdk-linux-am335x-evm-)
[ 2.287394] Warning: unable to open an initial console.
[ 2.300184] Freeing unused kernel memory: 4212K (c0587000 - c09a4000)
[ 2.307330] Failed to execute /init (error -2)
[ 2.312502] Kernel panic - not syncing: No working init found. Try passing .
[ 8.180642] random: nonblocking pool is initialized


==========================================================================

The following is my bootargs:

"console=${console} earlyprintk=serial mem=128m"

The hardware I am using is am335x based custom board which is a full custom version of beagle bone that is product specific. Has 128MB DDR ram.

Answer

The init was an elf binary with dynamic libraries linked to it. I found it by using readelf -d on the init file. So I needed to add the libc library that I thought would be linked statically in init. Big thanks to "that toher guy".