[Clfs-support] libraries for booting temporary system

Joe Ciccone jciccone at gmail.com
Sun Jul 19 06:10:16 PDT 2009

Alexander Roalter wrote:
> Joe Ciccone wrote:
> > Alexander Roalter wrote:
> >> after compiling the temporary system (SVN, for pure64 x86_64) and
> >> booting it I got the error
> >>
> >> Kernel panic: no init found. Try passing init= option to kernel...
> >>
> >> looking into it (and comparing with my host system), /sbin/init is
> >> linked shared, while my original init (opensuse 11.0) is linked static.
> >> So contrary to ch. 7.5 I changed the src/Makefile in sysvinit-2.86 the
> >> line LDFLAGS=-s to LDFLAGS=-s -static
> >>
> >> then I got a static init, and the system booted up until the shell
> >> should have been started with the error: /bin/sh: No such file or
> >> directory
> >>
> >> The problem is: all the files in /bin don't know where to look for the
> >> libraries, which are located in /tools/lib, and not in /lib.
> >>
> >> So if I copy all files from /tools/lib to lib, everything works and I
> >> get the login prompt and I also can log in...
> >>
> >> Now, since this is not described in the book, what has to be done that
> >> the executable from the temporary system know how to find their
> >> libraries? I would assume one could use ld.so.cache and set up the
> >> search path to /tools/lib, but nothing of this kind is done...
> >>
> >> Any suggestions?
> > It shoulds like you're linking against host libraries, init does not
> > have to be static. My first guess would be that you did not compile gcc
> > final cross (2nd gcc build) with the specs patch. This would leave your
> > system attached to /lib/ld.so instead of /tools/lib/ld.so which is gone
> > once you chroot/boot. You can verify this by running readelf -l
> > /tools/bin/sh | grep interpreter
> as expected, it returns
> clfs:~$ readelf -l /tools/bin/bash | grep interpreter
> [Requesting program interpreter: /lib/ld-linux-x86-64.so.2]
> which is bad.
> On building GCC in chapter 6.9, even gcc-build/gcc/g++ shows the same
> behavior:
> clfs:~/sources/gcc-build$ readelf -l ./g++ | grep interpreter
> [Requesting program interpreter: /lib/ld-linux-x86-64.so.2]
> so the modified startfile SPEC, that should look first in /tools/lib
> seems not to have influenced the build... Is there something where one
> can see which spec file is used?
http://cross-lfs.org/view/svn/x86_64-64/cross-tools/gcc-final.html .
During the building of gcc-final in cross-tools you did not apply the
pure64_specs patch. I'm not sure if you used the same source directory
but you shouldn't have done that if you did. basically you have to start
over. Rebuild gcc-final and then rebuild all of /tools.

More information about the Clfs-support mailing list