Re: question about "Failed to execute /init"

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

 



> 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.
Dear all:
I find there is some problem about kernel setting to support loading
static/dynamic elf format.
I study the kernel source and find my error comes from
search_binary_handler and it return -8, -ENOEXEC, while executing,
fmt->load_binary.

In kernel source, the core_initcall will register different
init_elf_xxxfmt, and it seems this option will determine whether
kernel support dynamic or static elf execute files.
And kernel seems support these binfmts:
binfmt_aout.c:static struct linux_binfmt aout_format = {
binfmt_elf.c:static struct linux_binfmt elf_format = {
binfmt_elf_fdpic.c:static struct linux_binfmt elf_fdpic_format = {
binfmt_em86.c:static struct linux_binfmt em86_format = {
binfmt_flat.c:static struct linux_binfmt flat_format = {
binfmt_misc.c:static struct linux_binfmt misc_format = {
binfmt_script.c:static struct linux_binfmt script_format = {
binfmt_som.c:static struct linux_binfmt som_format = {

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.

My questions are:
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?
2. if my assumption correct, which one in the list is my choice and
what config I should add in my uclinxu kernel config?
3. if my assumption above is wrong and kernel will default support
static elf file, why I get -8, -ENOEXEC, while calling
fmt->load_binary.
4. There is only binfmt_script.o build in my kernel, but why in try=2
loop in search_binary_handler, I still get 2 fmt->load_binarys. There
should only be 1 fmt->load_binary, load_script in Binfmt_script.c.

appreciate your help,
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