Difference between revisions of "EBC Exercise 27 BusyBox"

From eLinux.org
Jump to: navigation, search
m (installing)
 
(14 intermediate revisions by 3 users not shown)
Line 3: Line 3:
 
{{YoderHead}}
 
{{YoderHead}}
  
== Compiling BusyBox ==
+
== Getting BusyBox ==
 +
=== downloading ===
  
We'll attack getting BusyBox like we did getting the kernel ([[EBC Exercise 01 Using bitbake for Kernel and U-boot]]) though the paths will be slightly different.  Make sure you have commented out
+
Get the busybox sources from the busybox site
<pre>
 
# INHERIT += " rm_work "
 
</pre>
 
in the '''local.conf''' file.  See [[EBC Exercise 01 Using bitbake for Kernel and U-boot]] for details.
 
  
Check and see what you already have for previous installations:
+
host$ '''git clone git://busybox.net/busybox.git'''
 +
host$ '''cd busybox'''
  
  host$ '''source ~/.oe/environment-oecore'''
+
=== compiling ===
  host$ '''time bitbake busybox'''
+
  host$ '''source ~/crossCompileEnv.sh'''
  host$ '''cd ~/BeagleBoard/oe/build/tmp-angstrom_2010_x-eglibc/work/beagleboard-angstrom-linux-gnueabi'''
+
  host$ '''make help'''
  host$ '''ls'''
+
  host$ '''make defconfig'''
 +
  host$ '''make -j9'''      # use -j''X'' for ''X-1'' cores
  
My bitbake took about 1.5 minutes to download and compile.
+
=== configuring ===
  
When you did ''ls'' did you see '''BusyBox'''?  I didn't. Do this to find it:
+
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). First be sure you have the graphics libraries loaded.
  
  host$ '''cd cd ~/BeagleBoard/oe/build/tmp-angstrom_2010_x-eglibc/work'''
+
  host$ '''sudo apt-get install libglade2-dev'''
  host$ '''find . -name "*busybox*"'''
+
  host$ '''make gconfig'''
  
The ''find'' command will find all files and directories that contain the name <code>busybox</code>.
+
After saving the configuration changes to update the .config file, it is a simple matter of running make.  
BusyBox is not a Beagle specific compile, so it appears in a different location.  Change to the BusyBox directory and look around.  Can you find the source? Hint: they aren't in a git directory.
+
  host$ '''make -j4'''
 
 
== Configuring BusyBox ==
 
 
 
You can now configure BusyBox.
 
 
 
host$ '''~/.oe/crossCompileEnv.sh'''
 
host$ '''make xconfig'''
 
 
 
After saving the configuration changes to update the .config file, it is a simple matter of running make.
 
 
 
  host$ '''make'''
 
  
 
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:.'''
 
  beagle$ '''busybox'''
 
  beagle$ '''busybox'''
  beagle$ '''busybox ls'''
+
  beagle$ '''./busybox'''
 +
beagle$ '''./busybox ls'''
  
 +
What's the difference between running '''busybox''' and '''./busybox'''?
 
Try some other commands...
 
Try some other commands...
  
== Shrinking 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.
 
 
== Static Linking ==
 
 
Some embedded systems are so small they don't have shared libraries.  Recompile busybox to be statically linked.  How big it is?  Does it still work?
 
 
== Running a Web Server ==
 
 
Configure busybox to be a web server. Look under '''Networking Untilites''', 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.
 
 
{|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}}

Latest revision as of 11:02, 1 November 2013

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 ~/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). First be sure you have the graphics libraries loaded.

host$ sudo apt-get install libglade2-dev
host$ make gconfig

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

host$ make -j4

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
beagle$ ./busybox ls

What's the difference between running busybox and ./busybox? Try some other commands...




thumb‎ Embedded Linux Class by Mark A. Yoder