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"
17 http://www.busybox.net/downloads/busybox-${PV}.tar.gz \
19 file://busybox-httpd \
20 file://busybox-udhcpd \
21 file://default.script file://simple.script \
22 file://dhcp-hostname.patch;patch=1 \
24 file://ifupdown-spurious-environ.patch;patch=1 \
25 file://mount.busybox \
28 file://udhcpscript.patch;patch=1 \
29 file://umount.busybox \
32 SRC_URI_append_nylon = " file://xargs-double-size.patch;patch=1"
34 export EXTRA_CFLAGS = "${CFLAGS}"
35 EXTRA_OEMAKE_append = " CROSS=${HOST_PREFIX}"
36 PACKAGES =+ "${PN}-mountall ${PN}-httpd ${PN}-syslog ${PN}-udhcpd"
38 # We need this RRECOMMENDS because libc dlopens libgcc
39 # and shlib mechanism can not detect it because its not
40 # listed in the NEEDED field.
41 RRECOMMENDS += "libgcc"
43 FILES_${PN}-mountall = "${sysconfdir}/default/mountall"
44 RDEPENDS_${PN} += "${PN}-mountall"
46 # Make busybox recommend busybox-syslog for those images that expect it
47 RRECOMMENDS_${PN} += "libgcc ${PN}-syslog"
49 FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
50 FILES_${PN}-syslog = "${sysconfdir}/init.d/syslog ${sysconfdir}/syslog.conf"
51 FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
53 FILES_${PN} += "${datadir}/udhcpc"
55 INITSCRIPT_PACKAGES = "${PN}-httpd ${PN}-syslog ${PN}-udhcpd"
56 INITSCRIPT_NAME_${PN}-httpd = "busybox-httpd"
57 INITSCRIPT_NAME_${PN}-syslog = "syslog"
58 INITSCRIPT_NAME_${PN}-udhcpd = "busybox-udhcpd"
59 CONFFILES_${PN}-syslog = "${sysconfdir}/syslog.conf"
61 # This disables the syslog startup links in slugos (see slugos-init)
62 INITSCRIPT_PARAMS_${PN}-syslog_slugos = "start 20 ."
64 RDEPENDS_${PN}-httpd += "${PN}"
65 RDEPENDS_${PN}-syslog += "${PN}"
66 RDEPENDS_${PN}-udhcpd += "${PN}"
68 # Use gcc for linking so LDFLAGS actually makes sense
69 LD = "${CC} -nostdlib"
71 inherit cml1 update-rc.d
74 sed -e 's#@DATADIR@#${datadir}#g' \
75 < ${WORKDIR}/defconfig > ${S}/.config
80 unset CFLAGS CPPFLAGS CXXFLAGS
85 oe_runmake busybox.links
86 if [ "${prefix}" != "/usr" ]; then
87 sed "s:^/usr/:${prefix}/:" busybox.links > busybox.links.new
88 mv busybox.links.new busybox.links
90 if [ "${base_sbindir}" != "/sbin" ]; then
91 sed "s:^/sbin/:${base_sbindir}/:" busybox.links > busybox.links.new
92 mv busybox.links.new busybox.links
95 install -d ${D}${sysconfdir}/init.d
97 # Install /bin/busybox, and the /bin/sh link so the postinst script
98 # can run. Let update-alternatives handle the rest.
99 install -d ${D}${base_bindir}
100 install -m 0755 ${S}/busybox ${D}${base_bindir}
101 ln -sf busybox ${D}${base_bindir}/sh
103 if grep -q "CONFIG_SYSLOGD=y" ${WORKDIR}/defconfig; then
104 install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/
105 install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/
107 if grep "CONFIG_CROND=y" ${WORKDIR}/defconfig; then
108 install -m 0755 ${WORKDIR}/busybox-cron ${D}${sysconfdir}/init.d/
110 if grep "CONFIG_HTTPD=y" ${WORKDIR}/defconfig; then
111 install -m 0755 ${WORKDIR}/busybox-httpd ${D}${sysconfdir}/init.d/
112 install -d ${D}/srv/www
114 if grep "CONFIG_APP_UDHCPD=y" ${WORKDIR}/defconfig; then
115 install -m 0755 ${WORKDIR}/busybox-udhcpd ${D}${sysconfdir}/init.d/
117 if grep "CONFIG_HWCLOCK=y" ${WORKDIR}/defconfig; then
118 install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
120 if grep "CONFIG_APP_UDHCPC=y" ${WORKDIR}/defconfig; then
121 install -d ${D}${sysconfdir}/udhcpc.d
122 install -d ${D}${datadir}/udhcpc
123 install -m 0755 ${WORKDIR}/simple.script ${D}${sysconfdir}/udhcpc.d/50default
124 install -m 0755 ${WORKDIR}/default.script ${D}${datadir}/udhcpc/default.script
126 if grep "CONFIG_FEATURE_MOUNT_FSTAB=y" ${WORKDIR}/defconfig; then
127 install -d ${D}${sysconfdir}/default
128 install -m 644 ${WORKDIR}/mountall ${D}${sysconfdir}/default/
131 install -m 0644 ${S}/busybox.links ${D}${sysconfdir}
134 pkg_postinst_${PN} () {
135 # If we are not making an image we create links for the utilities that doesn't exist
136 # so the update-alternatives script will get the utilities it needs
137 # (update-alternatives have no problem replacing links later anyway)
138 test -n 2> /dev/null || alias test='busybox test'
139 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
141 # This adds the links, remember that this has to work when building an image too, hence the $D
142 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
146 # This is so you can make busybox commit suicide - removing busybox with no other packages
147 # providing its files, this will make update-alternatives work, but the update-rc.d part
148 # for syslog, httpd and/or udhcpd will fail if there is no other package providing sh
149 tmpdir=`mktemp -d /tmp/busyboxrm-XXXXXX`
150 ln -s /bin/busybox $tmpdir/[
151 ln -s /bin/busybox $tmpdir/test
152 ln -s /bin/busybox $tmpdir/head
153 ln -s /bin/busybox $tmpdir/sh
154 ln -s /bin/busybox $tmpdir/basename
155 ln -s /bin/busybox $tmpdir/echo
156 ln -s /bin/busybox $tmpdir/mv
157 ln -s /bin/busybox $tmpdir/ln
158 ln -s /bin/busybox $tmpdir/dirname
159 ln -s /bin/busybox $tmpdir/rm
160 ln -s /bin/busybox $tmpdir/sed
161 ln -s /bin/busybox $tmpdir/sort
162 export PATH=$PATH:$tmpdir
167 /*/*/*) to="../../bin/busybox";;
168 /bin/*) to="busybox";;
169 /*/*) to="../bin/busybox";;
170 /*) to="/bin/busybox";;
173 sh /usr/bin/update-alternatives --remove $bn $to
174 done </etc/busybox.links
177 PACKAGES =+ "${PN}-mdev"
178 FILES_${PN}-mdev = "${sysconfdir}/mdev ${sysconfdir}/mdev.conf ${sysconfdir}/init.d/mdev"
179 RDEPENDS_${PN}-mdev += "${PN}"
181 PACKAGES =+ "${PN}-linuxrc"
182 FILES_${PN}-linuxrc = "linuxrc"
183 RDEPENDS_${PN}-linuxrc += "${PN}"
185 pkg_postinst_${PN}-mdev() {
186 if test "x$D" != "x"; then
191 update-rc.d $OPT mdev start 06 S .