LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Busybox and uClibc (https://www.linuxquestions.org/questions/linux-newbie-8/busybox-and-uclibc-282226/)

spencerbray 01-25-2005 06:08 PM

Busybox and uClibc
 
New to linux and the embedded world, I have tried to create a valid root filesystem using BusyBox and uClibC. I am not cross compling to another platform, its all i386.

If I make busybox with a static linked library all works fine as expected and I can boot from my new filesystem. Changing the busybox config to a dynamic linked library configuration, I start to get problems. This is where my knowledge takes a nose dive. From what I can google, I need to compile busybox against uclibc libs as right now it's being compiled against the glibc lib. Now I think that uclibc should create a gcc wrapper for me to cross compile against somewhere under /usr/i386-linux-uclibc. No such luck.

Can anyone tell me how to get it do this? Am I missing something fundermental?

I'm going mad with this. Your help would be much appreciated.

:Pengy:

DaHammer 01-25-2005 09:16 PM

Well technically unless you'll be adding several programs to the disk, ie not busybox emulated programs, you won't save much space using dynamically linked binaries. Especially if you include any C++ programs, as those libraries are huge. Instead I'd trim down bsybox to what I need and compile it static. Also uclibc isn't required. You can use the standard glibc libraries as well. However, you can downsize things quiet a bit using uclibc. Either way, run "ldd" on the busybox binary to determine what libraries it requires. Install those libraries on the disk and it should run fine. You can also use strace to get even more info on what's needed.

As far as uclibc goes. There are couple of ways to set it up under linux. They offer a toolchain installer that will download everything for you, compile it and install it. All you have to do then is set busybox to use it instead of the host gcc & glibc. That option is set in the configuration menu when you configure busybox, ie "make menuconfig", under "Build Options -> Do you want to build BusyBox with a Cross Compiler?". Mine is set to:

/usr/local/compiler/cross/uclibc-3.3/bin/i386-linux-uclibc-

which is where my uclibc gcc toolchain is installed. Busybox will append the gcc and etc onto the end of the i386-linux-uclibc- so don't add it. They also offer a complete uclibc development environment that you can install and chroot into to build things against the uclibc libraries, although I haven't tired it. BTW, you'll need to build an ldd for your host that uses uclibc if you want to use it on uclibc binaries. Check the FAQ for info on doing that.

spencerbray 01-26-2005 02:50 AM

Ham ;-),

Many thanks for your reply. I've read many articles on the web about building a boot floppy with uclibc/ busybox and none of them mention using a toolchain. Are they using another method to complile busybox against uclibc? Its a mystery to me.

I'm currently trying the toolchain option you described. However it seems to download and do loads of stuff for me. Feel a bit cheated. Do you know of a "from scratch" type approach that i could use to understand the full process?

Also, what would happen if I pointed /lib at the i386-linux-uclibc/lib dir for the duration of the busybox build. Would this work?

Spencer

:scratch:

DaHammer 01-26-2005 01:41 PM

Quote:

Originally posted by spencerbray
Ham ;-),

Many thanks for your reply. I've read many articles on the web about building a boot floppy with uclibc/ busybox and none of them mention using a toolchain. Are they using another method to complile busybox against uclibc? Its a mystery to me.

There use to be a wrapper of sorts that would allow you to use your existing glibc toolchain, but they dropped support for it in favor a complete uclibc toolchain instead. More info can be found at http://uclibc.org/FAQ.html#wrapper.

Quote:

Originally posted by spencerbray
I'm currently trying the toolchain option you described. However it seems to download and do loads of stuff for me. Feel a bit cheated. Do you know of a "from scratch" type approach that i could use to understand the full process?

Yeah, I hate that as well. Guess the author figured it was less trouble to just do it all for you. Anyway, I'm not aware of a detailed howto of sorts. I customized the makefile a little, removed ccache and went with it as I remember.

Quote:

Originally posted by spencerbray
Also, what would happen if I pointed /lib at the i386-linux-uclibc/lib dir for the duration of the busybox build. Would this work?

Compiler failure most likely. :) But try it and see.

spencerbray 01-27-2005 02:01 AM

Many thanks for you insight.

Spencer


All times are GMT -5. The time now is 08:39 PM.