EBC Exercise 27 BusyBox

From eLinux.org
Revision as of 11:20, 19 October 2012 by Yoder (talk | contribs) (Compiling BusyBox: Updated for Fall 2012)
Jump to: navigation, search

thumb‎ Embedded Linux Class by Mark A. Yoder


Compiling BusyBox

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

# INHERIT += " rm_work "

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$ source  ~/.oe/environment-oecore
host$ time bitbake busybox
host$ cd ~/BeagleBoard/oe/build/tmp-angstrom_v2012_05-eglibc/work/beagleboard-angstrom-linux-gnueabi
host$ ls

My bitbake took about 4.5 minutes to download and compile.

When you did ls did you see BusyBox? I didn't. Do this to find it:

host$ cd cd ~/BeagleBoard/oe/build/tmp-angstrom_v2012_05-eglibc/work
host$ find . -name "*busybox*"

The find command will find all files and directories that contain the name busybox. 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.

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!).

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...

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.

URL Name Notes
137.112.41.87/test.html Mark A. Yoder My first Beagle web page.




thumb‎ Embedded Linux Class by Mark A. Yoder