No init found --> executable format problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all,
I have a question concerning the end of the init() function, where the kernel should start the shell. In my case, the kernel outputs the well_known errors with initial console and No init found.(see the kernel output below). After investigations, it seems that the format of the 'init' and 'sh' executable is not correct. Indeed, the load_binary_handler() which is responsible for checking the format magic string of
the executable returns -8 (-ENOEXEC).
I have checked the content of bprm->buf field and it has been correctly filled with the 128 first bytes of the executable:

bprm = (struct linux_binfmt * ) 0x70ec00
    |__ buf  = (char [128]) [128]
           |_  0 = (char) 127 '\177'
           |_  1 = (char) 69 'E'
           |_  2 = (char) 76 'L'
           |_  3 = (char) 70 'F'
           |_  4 = (char) 1 '\001'
           ...
           ...

It has the magic string ELF but it doesn't begin with the 2 #! characters .
It seems to be the problem..

if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!') || (bprm->sh_bang))
                           return -ENOEXEC;

How can I change the format of these executables in order to generate the #! characters?
Any suggestions?

Thanks in advance.
Regards.

*******************************************************************
Linux version 2.6.19-uc1(gcc version 4.1.2 20080812 (Cortus release)) #10 Tue Feb 3 10:19:08 CET 2009
romfs start : 12000
Built 1 zonelists.  Total pages: 1975
Kernel command line:
PID hash table entries: 32 (order: 5, 128 bytes)
Dentry cache hash table entries: 1024 (order: 0, 4096 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mem_init: start=42000, end=7c67f0
Memory available: 1924k/7608k RAM, (582k kernel code, 70k data)
Mount-cache hash table entries: 512
io scheduler noop registered
io scheduler cfq registered (default)
uclinux[mtd]: RAM probe address=0x12000 size=0x19000
Creating 1 MTD partitions on "RAM":
0x00000000-0x00019000 : "ROMfs"
uclinux[mtd]: set ROMfs to be root filesystem
VFS: Mounted root (romfs filesystem) readonly.
Freeing unused kernel memory: 1k freed
Warning: unable to open an initial console.
Kernel panic - not syncing: No init found. Try passing init= option to kernel.
**********************************************************************

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux