LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 01-08-2012, 12:48 PM   #1
qwerty4061
Member
 
Registered: Nov 2011
Posts: 31

Rep: Reputation: Disabled
Busybox


Hi,
I am using busybox in my embedded project. I was interested in knowing how busybox is linking multiple utilities to a single executable.

http://en.wikipedia.org/wiki/BusyBox#Examples

According to the above link. If I call "/bin/ls" then in turn it is being translated to "/bin/busybox ls" (I am not sure whether my understanding is correct.).

Can someone please tell me how busybox is converting "/bin/ls" to "/bin/busybox"

Thanks
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 01-08-2012, 02:29 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
There are two components to the answer.
1. For each utility that will be implemented by busybox, a filesystem link from some standard directory such as /bin, /usr/bin, /sbin, etc, will point to the busybox binary.
2. Any application in Linux can look at its argv[0], and from that see what the parent process used to invoke the application. By doing this, busybox is able to know what the parent process was expecting, and is able to provide the accordant behavior.
There are other applications, such as bash which use the same procedure to provide an alter ego, of sorts.

--- rod.
 
2 members found this post helpful.
Old 01-09-2012, 02:40 AM   #3
qwerty4061
Member
 
Registered: Nov 2011
Posts: 31

Original Poster
Rep: Reputation: Disabled
Thanks theNbomr...I had forgotten about argv[0]... :P
 
Old 01-11-2012, 11:56 AM   #4
JonathanWilson
Member
 
Registered: Aug 2009
Location: Ilkeston, England
Distribution: ubuntu, xp, embeded
Posts: 79

Rep: Reputation: 1
I'm curious, is the busybox code re-entrant in that many command calls only loads one instance of busybox or if say 2 processes call busybox ls then its loaded twice?

The reason I'm curious is that if loaded twice then isn't that actually quite inefficient as it means that two copies of a "large" program are loaded as apposed to two smaller specialised programs as busy box has to include code for every command as apposed to say ls as a standalone that could be quite small in comparison.

Also wouldn't loading one "large" program take a lot more resources and time than two smaller programs.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ftpd on busybox amitk.gupta09 Linux - Server 1 10-23-2011 08:36 AM
BusyBox v1.1.3 Rameses Linux - Server 1 08-01-2010 01:27 AM
Busybox Meh Linux - Newbie 4 03-01-2010 01:31 AM
CrunchBox vs. BusyBox .. (which better and why ?) alMubarmij Linux - General 2 04-14-2006 06:00 AM
Busybox and vi krizzz Linux - Software 3 03-24-2005 05:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 10:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration