Build and Verify - Linux Embedded systems

You’re ready to run configure to add your applet to the build. Before doing that, you build as the system is configured and create a baseline for sizing purposes. Recall that a goal of Busy Box is to be efficient with resources; creating a baseline enables you to later check out much code your utility added to the size of the Busy Box binary. Follow these steps to create the baseline:

Now, test that everything builds by running the configuration tool and selecting your application:

Select Miscellaneous Utilities from the first menu, and then scroll to the bottom. If you followed the directions verbatim, the following appears:

[ ] Hello World (NEW)

Press the spacebar to select and exit the configuration program. You’re asked to save the current configuration; make sure you affirm. After changing the configuration, build by doing the following:

Notice that this code isn’t cross-compiled. At this point, you need to build some code that runs on your local machine so you can test that you performed all the steps necessary for the applet to compile and run. This is much easier to validate on your development host. When you’re satisfied that the applet compiles, it can be cross-compiled for the target.

In the installation directory, the default is ./_install. The scripts should have created a

/usr/bin/hello symlink to BusyBox: $./_install/usr/bin hello hello

Running this file produces the “Hello, World” text you put in the printf:

You can also check that the help works as expected:

This is what you placed in the include/usage.h file. If your help was different from the text, your output will be similarly different here.

That’s it! You’ve added an applet and gotten it installed and running. Writing a more complex applet means writing more code. The mechanics of having Busy Box include it in the build and installation have been handled.Earlier in the process, you created a baseline to see how much more memory your applet added to Busy Box. After verifying that the applet is installed properly and works, check how much code it added by doing the following:

As you can see, your new code is responsible for adding 48 bytes to the size of the executable. Most of that (22 bytes) is in the help function, called packed_usage; your increase in code size is a mere 14 bytes.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

Linux Embedded systems Topics