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"
15 http://www.busybox.net/downloads/busybox-${PV}.tar.gz \
17 file://busybox-httpd \
18 file://busybox-udhcpd \
19 file://default.script \
20 file://dhcp-hostname.patch;patch=1 \
22 file://ifupdown-spurious-environ.patch;patch=1 \
23 file://mount.busybox \
26 file://udhcpscript.patch;patch=1 \
27 file://umount.busybox \
30 SRC_URI_append_nylon = " file://xargs-double-size.patch;patch=1"
32 export EXTRA_CFLAGS = "${CFLAGS}"
33 EXTRA_OEMAKE_append = " CROSS=${HOST_PREFIX}"
34 PACKAGES =+ "${PN}-httpd ${PN}-udhcpd"
35 # We need this RRECOMMENDS because libc dlopens libgcc
36 # and shlib mechanism can not detect it because its not
37 # listed in the NEEDED field.
38 RRECOMMENDS += "libgcc"
39 FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
40 FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
42 FILES_${PN} += "${datadir}/udhcpc"
44 INITSCRIPT_PACKAGES = "${PN} ${PN}-httpd ${PN}-udhcpd"
45 INITSCRIPT_NAME_${PN}-httpd = "busybox-httpd"
46 INITSCRIPT_NAME_${PN}-udhcpd = "busybox-udhcpd"
47 INITSCRIPT_NAME_${PN} = "syslog"
48 CONFFILES_${PN} = "${sysconfdir}/syslog.conf"
50 # This disables the syslog startup links in slugos (see slugos-init)
51 INITSCRIPT_PARAMS_${PN}_slugos = "start 20 ."
53 inherit cml1 update-rc.d
56 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
61 oe_runmake busybox.links
62 if [ "x${layout_prefix}" = "x" ]; then
63 sed 's:^/usr/:/:' < busybox.links >busybox.links.new
64 mv busybox.links.new busybox.links
65 elif [ "${layout_prefix}" != "/usr" ]; then
66 echo "warning, busybox.links will lose with this prefix"
68 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
69 install -d ${D}${sysconfdir}/init.d
70 oe_runmake "PREFIX=${D}" install
71 cp -pPR ${S}/_install/* ${D}/
73 # Move everything to /busybox (not supposed to end up in any package)
74 install -d ${D}/busybox
77 for i in ${D}${base_bindir} ${D}${base_sbindir} ${D}${prefix} ; do
79 cp -dPr $i ${D}/busybox/
82 # Move the busybox binary back to /bin
83 install -d ${D}${base_bindir}
84 mv ${D}/busybox${base_bindir}/busybox ${D}${base_bindir}/
85 # Move back the sh symlink
86 test -h ${D}/busybox${base_bindir}/sh && mv ${D}/busybox${base_bindir}/sh ${D}${base_bindir}/
88 install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/
89 install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/
90 if grep "CONFIG_CROND=y" ${WORKDIR}/defconfig; then
91 # Move crond back to /usr/sbin/crond
92 install -d ${D}${sbindir}
93 mv ${D}/busybox${sbindir}/crond ${D}${sbindir}/
95 install -m 0755 ${WORKDIR}/busybox-cron ${D}${sysconfdir}/init.d/
97 if grep "CONFIG_HTTPD=y" ${WORKDIR}/defconfig; then
98 # Move httpd back to /usr/sbin/httpd
99 install -d ${D}${sbindir}
100 mv ${D}/busybox${sbindir}/httpd ${D}${sbindir}/
102 install -m 0755 ${WORKDIR}/busybox-httpd ${D}${sysconfdir}/init.d/
103 install -d ${D}/srv/www
105 if grep "CONFIG_APP_UDHCPD=y" ${WORKDIR}/defconfig; then
106 # Move udhcpd back to /usr/sbin/udhcpd
107 install -d ${D}${sbindir}
108 mv ${D}/busybox${sbindir}/udhcpd ${D}${sbindir}/
110 install -m 0755 ${WORKDIR}/busybox-udhcpd ${D}${sysconfdir}/init.d/
112 if grep "CONFIG_HWCLOCK=y" ${WORKDIR}/defconfig; then
113 # Move hwclock back to /sbin/hwclock
114 install -d ${D}${base_sbindir}
115 mv ${D}/busybox${base_sbindir}/hwclock ${D}${base_sbindir}/
117 install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
119 if grep "CONFIG_APP_UDHCPC=y" ${WORKDIR}/defconfig; then
120 # Move dhcpc back to /usr/sbin/udhcpc
121 install -d ${D}${base_sbindir}
122 mv ${D}/busybox${base_sbindir}/udhcpc ${D}${base_sbindir}/
124 install -d ${D}${sysconfdir}/udhcpc.d
125 install -d ${D}${datadir}/udhcpc
126 install -m 0755 ${S}/examples/udhcp/simple.script ${D}${sysconfdir}/udhcpc.d/50default
127 install -m 0755 ${WORKDIR}/default.script ${D}${datadir}/udhcpc/default.script
130 install -m 0644 ${S}/busybox.links ${D}${sysconfdir}
133 pkg_postinst_${PN} () {
134 # If we are not making an image we create links for the utilities that doesn't exist
135 # so the update-alternatives script will get the utilities it needs
136 # (update-alternatives have no problem replacing links later anyway)
137 test -n 2> /dev/null || alias test='busybox test'
138 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";; esac; busybox ln -s $to $link; fi; done </etc/busybox.links; fi
140 # This adds the links, remember that this has to work when building an image too, hence the $D
141 while read link; do case "$link" in /*/*/*) to="../../bin/busybox";; /bin/*) to="busybox";; /*/*) to="../bin/busybox";; esac; bn=`basename $link`; update-alternatives --install $link $bn $to 50; done <$D/etc/busybox.links
145 # This is so you can make busybox commit suicide - removing busybox with no other packages
146 # providing its files, this will make update-alternatives work, but the update-rc.d part
147 # for syslog, httpd and/or udhcpd will fail if there is no other package providing sh
148 tmpdir=`mktemp -d /tmp/busyboxrm-XXXXXX`
149 ln -s /bin/busybox $tmpdir/[
150 ln -s /bin/busybox $tmpdir/test
151 ln -s /bin/busybox $tmpdir/head
152 ln -s /bin/busybox $tmpdir/sh
153 ln -s /bin/busybox $tmpdir/basename
154 ln -s /bin/busybox $tmpdir/echo
155 ln -s /bin/busybox $tmpdir/mv
156 ln -s /bin/busybox $tmpdir/ln
157 ln -s /bin/busybox $tmpdir/dirname
158 ln -s /bin/busybox $tmpdir/rm
159 ln -s /bin/busybox $tmpdir/sed
160 ln -s /bin/busybox $tmpdir/sort
161 export PATH=$PATH:$tmpdir
166 /*/*/*) to="../../bin/busybox";;
167 /bin/*) to="busybox";;
168 /*/*) to="../bin/busybox";;
171 sh /usr/bin/update-alternatives --remove $bn $to
172 done </etc/busybox.links