[uClinux-dev] the Kernel does not start a script
Michael Schnell
mschnell at lumino.de
Mon Jun 2 08:51:05 EDT 2008
Hi Experts,
I'm trying to run a script on our little CPU.
By this I mean an text file that starts with
#!path_to_executable
and contains the script language text and has the executable bit set in
the access rights.
This is very useful to do simple cgi applications (here the web server -
boa - starts the script-file it finds in "cgi-bin") or very simple
"socket handlers" (here inetd starts the script file as denoted in
inetd.conf).
I tested both in a PC Linux environment and it works fine (using
bash-scripts and haserl-scrips <which in turn call bash scripts>).
Now I found that in the Kernel configuration there is a setting called
"Kernel support for MISC binaries" (CONFIG_BINFMT_MISC). This seems to
be necessary for executing script files. (the help on this is included
below).
Unfortunately setting this does compile, but the scripts are not
executed anyway.
if I e.g. start msh and the script also is supposed to use msh I get
this (I did enable msh, ls, and cat in busybox) :
/etc/dhcpc> ls -l
-rwxrwxrwx 1 root root 26 Nov 29 16:47 xmsh
/etc/dhcpc> cat xmsh
#!/bin/msh
/bin/ls -l /
/etc/dhcpc> /bin/msh
BusyBox v1.10.1 (2008-06-02 11:54:28 CEST) built-in shell (msh)
Enter 'help' for a list of built-in commands.
# ./xmsh
./xmsh: not found
#
I suppose msh issues the "not found" it an error is returned be execv().
What might prevent the Kernel from starting a script ?
Looking into tzhe Kernel source I am unable to find out what
"CONFIG_BINFMT_MISC" really does...
Any help on this ?
Thanks a lot !
-Michael
CONFIG_BINFMT_MISC:
If you say Y here, it will be possible to plug wrapper-driven binary
formats into the kernel. You will like this especially when you use
programs that need an interpreter to run like Java, Python, .NET or
Emacs-Lisp. It's also useful if you often run DOS executables under
the Linux DOS emulator DOSEMU (read the DOSEMU-HOWTO, available from
<http://www.tldp.org/docs.html#howto>). Once you have
registered such a binary class with the kernel, you can start one of
those programs simply by typing in its name at a shell prompt; Linux
will automatically feed it to the correct interpreter.
You can do other nice things, too. Read the file
<file:Documentation/binfmt_misc.txt> to learn how to use this
feature, <file:Documentation/java.txt> for information about how
to include Java support. and <file:Documentation/mono.txt> for
information about how to include Mono-based .NET support.
To use binfmt_misc, you will need to mount it:
mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
You may say M here for module support and later load the module when
you have use for it; the module is called binfmt_misc. If you
don't know what to answer at this point, say Y.
Symbol: BINFMT_MISC [=y]
Prompt: Kernel support for MISC binaries
Defined at fs/Kconfig.binfmt:115
Location:
-> Executable file formats
More information about the uClinux-dev
mailing list