Chrooting into a newly created toolchain.

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Robert.Keizer
Posts: 2
Joined: Tue Feb 12, 2008 4:42 pm
Location: Winnipeg MB, Canada

Chrooting into a newly created toolchain.

Post 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
xyzzy
Member
Member
Posts: 391
Joined: Wed Jul 25, 2007 8:45 am
Libera.chat IRC: aejsmith
Location: London, UK
Contact:

Post by xyzzy »

So basically you want to build your own Linux system, correct? Have you taken a look at LFS? http://www.linuxfromscratch.org
User avatar
Robert.Keizer
Posts: 2
Joined: Tue Feb 12, 2008 4:42 pm
Location: Winnipeg MB, Canada

RE: LFS

Post 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..
xyzzy
Member
Member
Posts: 391
Joined: Wed Jul 25, 2007 8:45 am
Libera.chat IRC: aejsmith
Location: London, UK
Contact:

Post 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
Post Reply