Skip to contentSkip to conversation

Executing Programs from initrd

DISCUSSION Patrick Fisher 3 participants 3 messages May 5, 2001 MIPS

lore
Share & tools
lore
#0 lore raw

I'm plodding along working with Linux/MIPS (and Linux-VR) on a Philips Nino. I can boot linux, and fool around with the stand alone shell. I can also execute a program included on Steven Hill's Nino ramdisk - a simple Hello World program, in assembly, which I compiled with my mipsel-linux toolchain (well, also from Steven Hill, but it was compiled locally on my own machine). That program runs fine.

However, I can't run any binaries other than this one and the shell. I
wrote an additional Hello World program in C, compiled it for mipsel, and put it in the ramdisk. The executable is definitely there when I boot on the nino - I can send it all to the serial console and see that it exists. However, any attempt to execute it returns "No such file or directory". It's got all the right permissions, and this occurs when I'm positive I'm giving it the whole path. It simply can't see the file. I also copied "ls" from a root image for a mipsel decstation, and got the same problem. I downloaded the GNU fileutils source, set it for a mipsel target, compiled, put a few binaries on the ramdisk, and again, it can't find the file (but it's there, and I can see the contents).
This occurs on a ~650k ramdisk with ~30k free, and a 2MB ramdisk with ~1.5MB free, using either the SGI Linux/MIPS sources or the Linux-VR project's sources.

Any ideas?

Thanks,
Patrick

#1 lore raw
Quoted 1 line · Patrick Fisher

However, any attempt to execute it returns "No such file or directory".

That particular error message is highly misleading. Most people read it as "the file I'm trying to execute does not exist" but it is also issued when the loader cannot be found or one of the run time libraries cannot be found. At a guess you have a mismatch between the mipsel loader and the Nino loader. Run strings on a working and a failing binary and look at the required loader and libraries, usually the first few strings.

#2 lore raw
In reply to Patrick Fisher
Quoted 5 lines · Patrick Fisher

However, I can't run any binaries other than this one and the shell. I
wrote an additional Hello World program in C, compiled it for mipsel, and put it in the ramdisk. The executable is definitely there when I boot on the nino - I can send it all to the serial console and see that it exists. However, any attempt to execute it returns "No such file or directory".

Did you compile with -static? If not, the system will attempt to load it with /lib/ld.so.1. Do you have that file? Is it executable? What about libc?

If you have a file starting with

#! /bin/fux0r

and /bin/fux0r does not exist, the execution will fail with that exact error. In fact from the system's point of view it's the same thing with /lib/ld.so.1 instead of /bin/fux0r.

Signature · 4 lines
Keith M Wesolowski <[email protected]> http://foobazco.org/~wesolows
------(( Project Foobazco Coordinator and Network Administrator ))------
	"Nothing motivates a man more than to see his boss put
	 in an honest day's work." -- The fortune file