blob: d5e9ae343b311f0b6d3ebec149549f00f69fca6a [file] [log] [blame]
Bernhard Reutner-Fischer5c071bc2005-10-05 07:40:46 +00001Building:
2=========
3
Rob Landleyff9f2f62005-10-09 20:18:32 +00004The BusyBox build process is similar to the Linux kernel build:
Bernhard Reutner-Fischer5c071bc2005-10-05 07:40:46 +00005
Rob Landleyff9f2f62005-10-09 20:18:32 +00006 make menuconfig # This creates a file called ".config"
7 make # This creates the "busybox" executable
8 make install # or make PREFIX=/path/from/root install
Bernhard Reutner-Fischer5c071bc2005-10-05 07:40:46 +00009
Rob Landleyff9f2f62005-10-09 20:18:32 +000010The full list of configuration and install options is available by typing:
Bernhard Reutner-Fischer5c071bc2005-10-05 07:40:46 +000011
Rob Landleyff9f2f62005-10-09 20:18:32 +000012 make help
Matt Kraai6e91f692001-05-10 14:12:20 +000013
Rob Landleyff9f2f62005-10-09 20:18:32 +000014Quick Start:
15============
Matt Kraai6e91f692001-05-10 14:12:20 +000016
Rob Landleyff9f2f62005-10-09 20:18:32 +000017The easy way to try out BusyBox for the first time, without having to install
18it, is to enable all features and then use "standalone shell" mode with a
19blank command $PATH:
Bernhard Reutner-Fischer5c071bc2005-10-05 07:40:46 +000020
Rob Landleyff9f2f62005-10-09 20:18:32 +000021 make allyesconfig
22 make
23 PATH= ./busybox ash
Bernhard Reutner-Fischer5c071bc2005-10-05 07:40:46 +000024
Rob Landleyff9f2f62005-10-09 20:18:32 +000025Standalone shell mode causes busybox's built-in command shell to run
26any built-in busybox applets directly, without looking for external
27programs by that name. Supplying an empty command path (as above) means
28the only commands busybox can find are the built-in ones.
Bernhard Reutner-Fischerb8faa7e2005-10-07 17:44:14 +000029
Rob Landleyff9f2f62005-10-09 20:18:32 +000030(Note that the standalone shell requires the /proc directory to function.)
Bernhard Reutner-Fischer5c071bc2005-10-05 07:40:46 +000031
Rob Landleyff9f2f62005-10-09 20:18:32 +000032Configuring Busybox:
33====================
Bernhard Reutner-Fischer5c071bc2005-10-05 07:40:46 +000034
Rob Landleyff9f2f62005-10-09 20:18:32 +000035Busybox is optimized for size, but enabling the full set of functionality
36still results in a fairly large executable (more than 1 megabyte when
37statically linked). To save space, busybox can be configured with only the
38set of applets needed for each environment. The minimal configuration, with
39all applets disabled, produces a 4k executable. (It's useless, but very small.)
Bernhard Reutner-Fischer5c071bc2005-10-05 07:40:46 +000040
Rob Landleyff9f2f62005-10-09 20:18:32 +000041The manual configurators "make config" and "make menuconfig" modify the
42existing configuration. Quick ways to get starting configurations include
43"make allyesconfig" (enables almost all options), "make allnoconfig" (disables
44all options), "make allbaseconfig" (enables all applets but disables all
45optional features), and "make defconfig" (reset to defaults).
Bernhard Reutner-Fischer5c071bc2005-10-05 07:40:46 +000046
Rob Landleyff9f2f62005-10-09 20:18:32 +000047Configuring BusyBox produces a file ".config", which can be saved for future
48use.
Bernhard Reutner-Fischer5c071bc2005-10-05 07:40:46 +000049
Rob Landleyff9f2f62005-10-09 20:18:32 +000050Installing Busybox:
51===================
Bernhard Reutner-Fischer5c071bc2005-10-05 07:40:46 +000052
Rob Landleyff9f2f62005-10-09 20:18:32 +000053Busybox is a single executable that can behave like many different commands,
54and BusyBox uses the name it was invoked under to determine the desired
55behavior. (Try "mv busybox ls" and then "./ls -l".)
Bernhard Reutner-Fischer5c071bc2005-10-05 07:40:46 +000056
Rob Landleyff9f2f62005-10-09 20:18:32 +000057Installing busybox consists of creating symlinks (or hardlinks) to the busybox
58binary for each applet enabled in busybox, and making sure these symlinks are
59in the shell's command $PATH. Running "make install" creates these symlinks,
60or "make install-hardlinks" creates hardlinks instead (useful on systems with
Rob Landleyd4f15e92005-12-02 18:27:39 +000061a limited number of inodes). This install process uses the file
Rob Landleyff9f2f62005-10-09 20:18:32 +000062"busybox.links" (created by make), which contains the list of enabled applets
63and the path at which to install them.
64
Rob Landleyd4f15e92005-12-02 18:27:39 +000065Installing links to busybox is not always necessary. The special applet name
66"busybox" (or with any optional suffix, such as "busybox-static") uses the
67first argument to determine which applet to behave as, for example
68"./busybox cat LICENSE". (Running the busybox applet with no arguments gives
69a list of all enabled applets.) The standalone shell can also call busybox
70applets without links to busybox under other names in the filesystem. You can
71also configure a standaone install capability into the busybox base applet,
72and then install such links at runtime with one of "busybox --install" (for
73hardlinks) or "busybox --install -s" (for symlinks).
Rob Landleyff9f2f62005-10-09 20:18:32 +000074
Bernhard Reutner-Fischer5d261262006-03-01 22:54:48 +000075If you built busybox as shared object which uses libbusybox.so and have not
76yet installed the binary but want to run tests, then set your LD_LIBRARY_PATH
77accordingly before running the executable:
78
79 export LD_LIBRARY_PATH=`pwd`
80 ./busybox
81
Rob Landleyff9f2f62005-10-09 20:18:32 +000082Building out-of-tree:
83=====================
84
85By default, the BusyBox build puts its temporary files in the source tree.
86Building from a read-only source tree, or to building multiple
87configurations from the same source directory, requires the ability to
88put the temporary files somewhere else.
89
Bernhard Reutner-Fischer5d261262006-03-01 22:54:48 +000090To build out of tree, cd to the empty directory and do this instead:
91
92 make -f /path/to/source/Makefile allyesconfig
93 make
94 make install
95
96Alternately, use the O=$BUILDPATH option during the configuration step, as in:
Rob Landleyff9f2f62005-10-09 20:18:32 +000097
98 make O=/some/empty/directory allyesconfig
99 cd /some/empty/directory
100 make
101 make PREFIX=. install
102
103(Note, O= requires an absolute path.)
104
Rob Landleyff9f2f62005-10-09 20:18:32 +0000105
106More Information:
107=================
108
109Se also the busybox FAQ, under the questions "How can I get started using
110BusyBox" and "How do I build a BusyBox-based system?" The BusyBox FAQ is
111available from http://www.busybox.net/FAQ.html or as the file
112docs/busybox.net/FAQ.html in this tarball.