Re: question about "Failed to execute /init"

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

 



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

Dear Nick:
thanks for your suggestions.
Actually I find where my problem is.
Since I use uclinux, it only supports FLAT format and there are 2 ways to do so.

a. use -Wl,-elf2flt,-s32684 as compile option to let the
cross-compile-ld to transform the elf to the flt as I need.
b. use cross-compile-elf2flt to transfer the elf to flt.

I have tried 2 kinds of cross-toolchain.
1. arm-linux toolchain, download from
http://ftp.snapgear.org/pub/snapgear/tools/arm-linux/
2. buildroot,
3. arm-uclinux, download from Codesourcery.

1,2 both cannot get flt by a or b.
The uclinux kernel image compiled by 3 will let my platform get
unknown instruction exception.

I still working on them and if someone knows how to solve it, please
let me know.

Sincerely Yours,
miloody

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