[Toybox] Fwd: Re: Fwd: build help please with toybox

Rob Landley rob at landley.net
Sat Nov 23 09:09:36 PST 2019


On 11/22/19 11:43 PM, scsijon wrote:
> Maybe one for Rob I fear? Sorry. Bottom posted.

Yes, but only because I wrote the initramfs docs, not because toybox. :)

> Run /init as init process
> Failed to execute /init (error -2)

It couldn't exec the binary.

#define ENOENT           2      /* No such file or directory */

If the binary was there, generally that means tried to load a shared library
that wasn't there.

Did you check to see if this is a static or dynamic binary? (And that there's an
/init in your filesystem, and if it's a symlink that it points to something?)

> ?Is there a problem with toybox's init please Rob?, the script builds ok and
> init works ok in busybox's version or is toybox's init not quite the same or
> ready yet?

toybox init is in pending, so I wouldn't use it, but it _should_ work. (I should
just break down and clean that up, it's a reasonable sysvinit...)

However, what it's complaining about here (assuming you configured init in) is
"file not found". Either there's on /init in your image or the execuable it
points to is dynamically linked and you didn't install the shared libraries.

> I've attached the alpha build script I used to create the iso in case it is of
> interest or help. It has the source site in its # ref's.

LDFLAGS="--static" make defconfig toybox
mkdir ./_install
make toybox install PREFIX=./_install

Why are you rebuilding toybox dynamically after you built it statically above?
(I _think_ it won't rebuild because it's up to date, but you're explicitly
_asking_ it to rebuild without the LDFLAGS=--static...)

And no, init isn't in defconfig. It's in pending. You'd have to explicitly
switch it on in the config.

Personally, I use oneit, which is in defconfig. See mkroot.sh for an example of
that.

> Mine was built on a EasyOS 2.1.8 (Debian Buster x86_64 base) of BarryK's as the
> EasyOS 1.2.8 (O.E. Pyro) and Quirky Ubuntu had apparently too old a gcc version
> to build.

Again, I've _recently_ built it with gcc 4.2.1 from 2007, which is 12 years old
now. Trust me, whatever your distro gcc was it wasn't too old. I have no idea
where your error message came from, you didn't copy it here and provide context.

>  Not bad for 3 packages to get a simple shell system up.

The external version of mkroot (https://github.com/landley/mkroot and used
busybox's shell (and its route command) did this back in 2017. I merged it into
toybox earlier this year as the "make root" target, but you need to switch on
toysh with menuconfig and then rdinit=/bin/sh on startup to bypass the init
script (which toysh isn't good enough to run yet).

Working on it...

Rob



More information about the Toybox mailing list