Difference between revisions of "EBC Exercise 27 BusyBox"

From eLinux.org
Jump to: navigation, search
m (Compiling BusyBox)
(configuring)
(2 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
{{YoderHead}}
 
{{YoderHead}}
  
== Downloading and Compiling BusyBox ==
+
== Getting BusyBox ==
 +
=== downloading ===
  
 
Get the busybox sources from the busybox site
 
Get the busybox sources from the busybox site
Line 9: Line 10:
 
  host$ '''git clone git://busybox.net/busybox.git'''
 
  host$ '''git clone git://busybox.net/busybox.git'''
 
  host$ '''cd busybox'''
 
  host$ '''cd busybox'''
 +
 +
=== compiling ===
 
  host$ '''source ~/.oe/crossCompileEnv.sh'''
 
  host$ '''source ~/.oe/crossCompileEnv.sh'''
 
  host$ '''make help'''
 
  host$ '''make help'''
Line 14: Line 17:
 
  host$ '''make -j9'''      # use -j''X'' for ''X-1'' cores
 
  host$ '''make -j9'''      # use -j''X'' for ''X-1'' cores
  
== Configuring BusyBox ==
+
=== configuring ===
  
You can now configure BusyBox.
+
You can now configure BusyBox (In the event that none of the graphical tools work you can use "make config" to use the text based tool as a method of last resort).
  
 
  host$ '''make gconfig'''
 
  host$ '''make gconfig'''
  
After saving the configuration changes to update the .config file, it is a simple matter of running make.
+
After saving the configuration changes to update the .config file, it is a simple matter of running make.  
  
 
  host$ '''make -j9'''
 
  host$ '''make -j9'''
Line 26: Line 29:
 
My make took about 1.5 minutes to compile (25 seconds with make -j8!).
 
My make took about 1.5 minutes to compile (25 seconds with make -j8!).
  
 +
=== installing ===
 
Copy it to your Beagle and test it out.  Just typing '''busybox''' will tell you what commands it knows.  Try some of them.
 
Copy it to your Beagle and test it out.  Just typing '''busybox''' will tell you what commands it knows.  Try some of them.
 
  host$ '''scp busybox root@beagle:.'''
 
  host$ '''scp busybox root@beagle:.'''
Line 33: Line 37:
 
Try some other commands...
 
Try some other commands...
  
== Shrinking BusyBox ==
+
== Playing with BusyBox ==
  
How big is the '''busybox''' file?  Try making it smaller by removing commands you don't use.  How big is it if you just have ''ls''? How much bigger is it when you add httpd?  Try your own combinations.  Report your findings to the class.
+
=== shrinking ===
  
== Static Linking ==
+
How big is the '''busybox''' file?  The default configuration for busybox has it many things (some 400).  Reconfigure it to do just the commands you use.  How big is it now? How big is it if you just have ''ls''? How much bigger is it when you add httpd?  Try your own combinations.  Report your findings in your status report.
 +
 
 +
=== Static Linking ===
  
 
Some embedded systems are so small they don't have shared libraries.  Recompile busybox to be statically linked. (Hint: look in configuration) How big it is?  Does it still work?
 
Some embedded systems are so small they don't have shared libraries.  Recompile busybox to be statically linked. (Hint: look in configuration) How big it is?  Does it still work?
  
== Running a Web Server ==
+
=== Running a Web Server ===
  
Configure busybox to be a web server. Look under '''Networking Untilites''', select '''httpd'''.  How much more space does it take?
+
Configure busybox to be a web server. Look under '''Networking Utilites''', select '''httpd'''.  How much more space does it take?
  
 
  beagle$ '''busybox httpd'''
 
  beagle$ '''busybox httpd'''
  
Yup, you are now running a web server.  Your task is to figure out where to put the web pages it is serving.  If you get something interesting going post your Beagle's address here. Hint: find httpd.c.
+
Yup, you are now running a web server.  Your task is to figure out where to put the web pages it is serving.  If you get something interesting going, post your Beagle's address here. Hint: find httpd.c.
 
 
{|style="color:green; background-color:#ccccff;" cellpadding="10" cellspacing="0" border="1"
 
! URL !! Name !! Notes
 
|-
 
| [http://137.112.41.87/test.html 137.112.41.87/test.html]
 
| Mark A. Yoder
 
| My first Beagle web page.
 
|}
 
  
 
{{YoderFoot}}
 
{{YoderFoot}}

Revision as of 22:26, 7 November 2012

thumb‎ Embedded Linux Class by Mark A. Yoder


Getting BusyBox

downloading

Get the busybox sources from the busybox site

host$ git clone git://busybox.net/busybox.git
host$ cd busybox

compiling

host$ source ~/.oe/crossCompileEnv.sh
host$ make help
host$ make defconfig
host$ make -j9       # use -jX for X-1 cores

configuring

You can now configure BusyBox (In the event that none of the graphical tools work you can use "make config" to use the text based tool as a method of last resort).

host$ make gconfig

After saving the configuration changes to update the .config file, it is a simple matter of running make.

host$ make -j9

My make took about 1.5 minutes to compile (25 seconds with make -j8!).

installing

Copy it to your Beagle and test it out. Just typing busybox will tell you what commands it knows. Try some of them.

host$ scp busybox root@beagle:.
beagle$ busybox
beagle$ busybox ls

Try some other commands...

Playing with BusyBox

shrinking

How big is the busybox file? The default configuration for busybox has it many things (some 400). Reconfigure it to do just the commands you use. How big is it now? How big is it if you just have ls? How much bigger is it when you add httpd? Try your own combinations. Report your findings in your status report.

Static Linking

Some embedded systems are so small they don't have shared libraries. Recompile busybox to be statically linked. (Hint: look in configuration) How big it is? Does it still work?

Running a Web Server

Configure busybox to be a web server. Look under Networking Utilites, select httpd. How much more space does it take?

beagle$ busybox httpd

Yup, you are now running a web server. Your task is to figure out where to put the web pages it is serving. If you get something interesting going, post your Beagle's address here. Hint: find httpd.c.




thumb‎ Embedded Linux Class by Mark A. Yoder