1 DESCRIPTION = "BusyBox combines tiny versions of many common UNIX utilities into a single \
2 small executable. It provides minimalist replacements for most of the \
3 utilities you usually find in GNU fileutils, shellutils, etc. The utilities \
4 in BusyBox generally have fewer options than their full-featured GNU \
5 cousins; however, the options that are included provide the expected \
6 functionality and behave very much like their GNU counterparts. BusyBox \
7 provides a fairly complete POSIX environment for any small or embedded \
9 HOMEPAGE = "http://www.busybox.net"
18 file://busybox-httpd \
19 file://busybox-udhcpd \
20 file://default.script file://simple.script \
21 file://dhcp-hostname.patch;patch=1 \
23 file://ifupdown-spurious-environ.patch;patch=1 \
24 file://mount.busybox \
27 file://udhcpscript.patch;patch=1 \
28 file://umount.busybox \
31 SRC_URI_append_nylon = " file://xargs-double-size.patch;patch=1"
33 export EXTRA_CFLAGS = "${CFLAGS}"
34 EXTRA_OEMAKE_append = " CROSS=${HOST_PREFIX}"
35 PACKAGES =+ "${PN}-mountall ${PN}-httpd ${PN}-syslog ${PN}-udhcpd"
37 # We need this RRECOMMENDS because libc dlopens libgcc
38 # and shlib mechanism can not detect it because its not
39 # listed in the NEEDED field.
40 RRECOMMENDS += "libgcc"
42 FILES_${PN}-mountall = "${sysconfdir}/default/mountall.${PN}"
43 RDEPENDS_${PN} += "${PN}-mountall"
45 # Make busybox recommend busybox-syslog for those images that expect it
46 RRECOMMENDS_${PN} += "libgcc ${PN}-syslog"
48 FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
49 FILES_${PN}-syslog = "${sysconfdir}/init.d/syslog ${sysconfdir}/syslog.conf"
50 FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
52 FILES_${PN} += "${datadir}/udhcpc"
54 INITSCRIPT_PACKAGES = "${PN}-httpd ${PN}-syslog ${PN}-udhcpd"
55 INITSCRIPT_NAME_${PN}-httpd = "busybox-httpd"
56 INITSCRIPT_NAME_${PN}-syslog = "syslog"
57 INITSCRIPT_NAME_${PN}-udhcpd = "busybox-udhcpd"
58 CONFFILES_${PN}-syslog = "${sysconfdir}/syslog.conf"
60 # This disables the syslog startup links in slugos (see slugos-init)
61 INITSCRIPT_PARAMS_${PN}-syslog_slugos = "start 20 ."
63 RDEPENDS_${PN}-httpd += "${PN}"
64 RDEPENDS_${PN}-syslog += "${PN}"
65 RDEPENDS_${PN}-udhcpd += "${PN}"
67 # Use gcc for linking so LDFLAGS actually makes sense
68 LD = "${CC} -nostdlib"
70 inherit cml1 update-rc.d
73 sed -e 's#@DATADIR@#${datadir}#g' \
74 < ${WORKDIR}/defconfig > ${S}/.config
79 unset CFLAGS CPPFLAGS CXXFLAGS
84 oe_runmake busybox.links
85 if [ "${prefix}" != "/usr" ]; then
86 sed "s:^/usr/:${prefix}/:" busybox.links > busybox.links.new
87 mv busybox.links.new busybox.links
89 if [ "${base_sbindir}" != "/sbin" ]; then
90 sed "s:^/sbin/:${base_sbindir}/:" busybox.links > busybox.links.new
91 mv busybox.links.new busybox.links
94 install -d ${D}${sysconfdir}/init.d
96 # Install /bin/busybox, and the /bin/sh link so the postinst script
97 # can run. Let update-alternatives handle the rest.
98 install -d ${D}${base_bindir}
99 if grep -q "CONFIG_FEATURE_SUID=y" ${WORKDIR}/defconfig; then
100 install -m 4755 ${S}/busybox ${D}${base_bindir}
102 install -m 0755 ${S}/busybox ${D}${base_bindir}
104 ln -sf busybox ${D}${base_bindir}/sh
106 if grep -q "CONFIG_SYSLOGD=y" ${WORKDIR}/defconfig; then
107 install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/
108 install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/
110 if grep "CONFIG_CROND=y" ${WORKDIR}/defconfig; then
111 install -m 0755 ${WORKDIR}/busybox-cron ${D}${sysconfdir}/init.d/
113 if grep "CONFIG_HTTPD=y" ${WORKDIR}/defconfig; then
114 install -m 0755 ${WORKDIR}/busybox-httpd ${D}${sysconfdir}/init.d/
115 install -d ${D}/srv/www
117 if grep "CONFIG_APP_UDHCPD=y" ${WORKDIR}/defconfig; then
118 install -m 0755 ${WORKDIR}/busybox-udhcpd ${D}${sysconfdir}/init.d/
120 if grep "CONFIG_HWCLOCK=y" ${WORKDIR}/defconfig; then
121 install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
123 if grep "CONFIG_APP_UDHCPC=y" ${WORKDIR}/defconfig; then
124 install -d ${D}${sysconfdir}/udhcpc.d
125 install -d ${D}${datadir}/udhcpc
126 install -m 0755 ${WORKDIR}/simple.script ${D}${sysconfdir}/udhcpc.d/50default
127 install -m 0755 ${WORKDIR}/default.script ${D}${datadir}/udhcpc/default.script
129 if grep "CONFIG_FEATURE_MOUNT_FSTAB=y" ${WORKDIR}/defconfig; then
130 install -d ${D}${sysconfdir}/default
131 install -m 644 ${WORKDIR}/mountall ${D}${sysconfdir}/default/mountall.${PN}
134 install -m 0644 ${S}/busybox.links ${D}${sysconfdir}
137 pkg_postinst_${PN} () {
138 # If we are not making an image we create links for the utilities that doesn't exist
139 # so the update-alternatives script will get the utilities it needs
140 # (update-alternatives have no problem replacing links later anyway)
141 test -n 2> /dev/null || alias test='busybox test'
142 if test "x$D" = "x"; then while read link; do if test ! -h "$link"; then case "$link" in /*/*/*) to="../../bin/busybox";; /bin/*) to="busybox";; /*/*) to="../bin/busybox";; /*) to="/bin/busybox";; esac; busybox ln -s $to $link; fi; done </etc/busybox.links; fi
144 # This adds the links, remember that this has to work when building an image too, hence the $D
146 while read link; do case "$link" in /*/*/*) to="../../bin/busybox";; /bin/*) to="busybox";; /*/*) to="../bin/busybox";; /*) to="/bin/busybox";; esac; bn=`basename $link`; update-alternatives --install $link $bn $to 50; done <$D/etc/busybox.links
150 pkg_postinst_${PN}-mountall () {
151 update-alternatives --install ${sysconfdir}/default/mountall default_mountall mountall.${PN} 50
153 pkg_prerm_${PN}-mountall () {
154 update-alternatives --remove default_mountall mountall.${PN}
158 # This is so you can make busybox commit suicide - removing busybox with no other packages
159 # providing its files, this will make update-alternatives work, but the update-rc.d part
160 # for syslog, httpd and/or udhcpd will fail if there is no other package providing sh
161 tmpdir=`mktemp -d /tmp/busyboxrm-XXXXXX`
162 ln -s /bin/busybox $tmpdir/[
163 ln -s /bin/busybox $tmpdir/test
164 ln -s /bin/busybox $tmpdir/head
165 ln -s /bin/busybox $tmpdir/sh
166 ln -s /bin/busybox $tmpdir/basename
167 ln -s /bin/busybox $tmpdir/echo
168 ln -s /bin/busybox $tmpdir/mv
169 ln -s /bin/busybox $tmpdir/ln
170 ln -s /bin/busybox $tmpdir/dirname
171 ln -s /bin/busybox $tmpdir/rm
172 ln -s /bin/busybox $tmpdir/sed
173 ln -s /bin/busybox $tmpdir/sort
174 export PATH=$PATH:$tmpdir
179 /*/*/*) to="../../bin/busybox";;
180 /bin/*) to="busybox";;
181 /*/*) to="../bin/busybox";;
182 /*) to="/bin/busybox";;
185 sh /usr/bin/update-alternatives --remove $bn $to
186 done </etc/busybox.links
189 PACKAGES =+ "${PN}-mdev"
190 FILES_${PN}-mdev = "${sysconfdir}/mdev ${sysconfdir}/mdev.conf ${sysconfdir}/init.d/mdev"
191 RDEPENDS_${PN}-mdev += "${PN}"
193 PACKAGES =+ "${PN}-linuxrc"
194 FILES_${PN}-linuxrc = "linuxrc"
195 RDEPENDS_${PN}-linuxrc += "${PN}"
197 pkg_postinst_${PN}-mdev() {
198 if test "x$D" != "x"; then
203 update-rc.d $OPT mdev start 06 S .