Re: question about "Failed to execute /init"

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

 



Hi Sandeep, Hi Loody,

> Sandeep K Sinha wrote:
You should have asked this at the bunutils list.

Actually I do not think that this is a binutils question. It is a question for the kernel folks. But I'll try to answer it anyway.

loody wrote:
my init is a very simple program like below

#include <stdio.h>
int main()
{
       printf("hello world\n");
       sleep(999999);
       return 0;
}
And my init is static build with "-static" option  and I use
cross-objdump to read it and it doesn't tell me there are any library
it depends on.

Are you using a cross-compiler to build your executable ? If so are you sure that you are using the correct cross-compiler for your target environment ?

I study the kernel source and find my error comes from
search_binary_handler and it return -8, -ENOEXEC, while executing,
fmt->load_binary.

Which definitely indicates that the kernel does not recognise the file format of your executable. As a matter of interest if you run "file <your-executable>" what does this report ?


And I check my fs folder and I only see this *.o files:
-rw-r--r-- 1 root root 2748 2009-01-23 11:42 binfmt_script.o
which is the default binfmt that will support.

Which looks rather suspicious. Given that I am not a kernel hacker, so the following may well be wrong, but to me that appears to indicate that your kernel has been built to only support the execution of shell scripts and not any other type of executable file.


1. are my assumptions above correct? take my static build init for
example, should I check whether static binary elf support code has
build in my kernel?

Yes I think that you should.


2. if my assumption correct, which one in the list is my choice and
what config I should add in my uclinxu kernel config?

I would suggest the "elf_format" is the one that you want.

Cheers
  Nick



--
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