Page 1 of 1

Chrooting into a newly created toolchain.

Posted: Wed Feb 13, 2008 2:11 pm
by Robert.Keizer
I have been playing around with different approaches to creating an operating system. I have decided to start with creating a standalone toolchain to begin with. The problem I have run into is that I cannot for some reason chroot into it.

I have compiled gcc-4.2.3 with a livecd onto the hard drive, then compiled binutils using the new gcc. Using the new toolchain I compiled busybox. All this was compiled so it was in /larry. When I use the command: chroot /larry /bin/sh , I get a message saying that /bin/sh does not exist. It is dynamically linked to ../../usr/bin/busybox so its inside the chroot.

But at the same time, I can use /larry/usr/bin/busybox sh, and get a sh prompt. Any suggestions on a different way to create a toolchain would be great.

Robert Keizer

-----edit------
Just to be clear here is my directory listing

/larry - new hd root
/larry/toolchain - where everything about the toolchain is stored
/larry/toolchain/gcc-round1/ - gcc-4.2.3 compiled with the livecd stuff
/larry/toolchain/binutils-round1/ - binutils compiled with gcc-round1
/larry/toolchain/busybox-1.9.0/ - busybox compiled with binutils and gcc above

Posted: Thu Feb 14, 2008 1:27 am
by xyzzy
So basically you want to build your own Linux system, correct? Have you taken a look at LFS? http://www.linuxfromscratch.org

RE: LFS

Posted: Thu Feb 14, 2008 9:34 am
by Robert.Keizer
Yes I have, thats the livecd I am using. I've been working away at chroot's for a long time, but this has stumped me. For some reason when I chroot into it, it claims there is no file there. Im assuming a buggy chroot because if I copy all the deps and the livecd /bin/sh it still says that the file is not found. Although I havn't been able to find anything about this online..

Posted: Thu Feb 14, 2008 11:34 am
by xyzzy
Possibly could be a dynamic linking issue. Run these 2 commands and paste the output here:

Code: Select all

readelf -l /larry/bin/sh

Code: Select all

ldd /larry/bin/sh