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.
**********************************************************************
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to