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 SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.gz \
16 file://add-getkey-applet.patch;patch=1 \
17 file://udhcpscript.patch;patch=1 \
18 file://dhcpretrytime.patch;patch=1 \
19 file://hdparm_M.patch;patch=1 \
20 file://udhcppidfile.patch;patch=1 \
21 file://udhcppidfile-breakage.patch;patch=1 \
22 file://readlink.patch;patch=1 \
23 file://iproute-flush-cache.patch;patch=1;pnum=0 \
24 file://rmmod.patch;patch=1 \
25 file://below.patch;patch=1 \
26 file://fbset.patch;patch=1 \
27 file://mount-all-type.patch;patch=1 \
28 file://dhcp-hostname.patch;patch=1 \
29 file://gzip-spurious-const.patch;patch=1 \
30 file://ifupdown-spurious-environ.patch;patch=1 \
33 file://busybox-httpd \
34 file://busybox-udhcpd \
37 file://default.script \
39 file://mount.busybox \
40 file://umount.busybox"
42 S = "${WORKDIR}/busybox-${PV}"
44 export EXTRA_CFLAGS = "${CFLAGS}"
45 EXTRA_OEMAKE_append = " CROSS=${HOST_PREFIX}"
46 PACKAGES =+ "${PN}-httpd ${PN}-udhcpd"
48 FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
49 FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
51 FILES_${PN} += " ${datadir}/udhcpc"
53 INITSCRIPT_PACKAGES = "${PN} ${PN}-httpd ${PN}-udhcpd"
54 INITSCRIPT_NAME_${PN}-httpd = "busybox-httpd"
55 INITSCRIPT_NAME_${PN}-udhcpd = "busybox-udhcpd"
56 INITSCRIPT_NAME_${PN} = "syslog"
57 CONFFILES_${PN} = "${sysconfdir}/syslog.conf"
59 # This disables the syslog startup links in openslug (see openslug-init)
60 INITSCRIPT_PARAMS_${PN}_openslug = "start 20 ."
62 inherit cml1 update-rc.d
65 install -m 0644 ${WORKDIR}/defconfig ${S}/.config
75 install -d ${D}${sysconfdir}/init.d
76 oe_runmake 'PREFIX=${D}' install
78 # Move everything to /busybox (not supposed to end up in any package)
79 install -d ${D}/busybox
80 mv ${D}${base_bindir} ${D}${base_sbindir} ${D}${prefix} ${D}/busybox/
81 # Move the busybox binary back to /bin
82 install -d ${D}${base_bindir}
83 mv ${D}/busybox${base_bindir}/busybox ${D}${base_bindir}/
84 # Move back the sh symlink
85 mv ${D}/busybox${base_bindir}/sh ${D}${base_bindir}/
87 install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/
88 install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/
89 if grep "CONFIG_CROND=y" ${WORKDIR}/defconfig; then
90 # Move crond back to /usr/sbin/crond
91 install -d ${D}${sbindir}
92 mv ${D}/busybox${sbindir}/crond ${D}${sbindir}/
94 install -m 0755 ${WORKDIR}/busybox-cron ${D}${sysconfdir}/init.d/
96 if grep "CONFIG_HTTPD=y" ${WORKDIR}/defconfig; then
97 # Move httpd back to /usr/sbin/httpd
98 install -d ${D}${sbindir}
99 mv ${D}/busybox${sbindir}/httpd ${D}${sbindir}/
101 install -m 0755 ${WORKDIR}/busybox-httpd ${D}${sysconfdir}/init.d/
102 install -d ${D}/srv/www
104 if grep "CONFIG_UDHCPD=y" ${WORKDIR}/defconfig; then
105 # Move udhcpd back to /usr/sbin/udhcpd
106 install -d ${D}${sbindir}
107 mv ${D}/busybox${sbindir}/udhcpd ${D}${sbindir}/
109 install -m 0755 ${WORKDIR}/busybox-udhcpd ${D}${sysconfdir}/init.d/
111 if grep "CONFIG_HWCLOCK=y" ${WORKDIR}/defconfig; then
112 # Move hwclock back to /sbin/hwclock
113 install -d ${D}${base_sbindir}
114 mv ${D}/busybox${base_sbindir}/hwclock ${D}${base_sbindir}/
116 install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
118 if grep "CONFIG_UDHCPC=y" ${WORKDIR}/defconfig; then
119 # Move dhcpc back to /usr/sbin/udhcpc
120 install -d ${D}${base_sbindir}
121 mv ${D}/busybox${base_sbindir}/udhcpc ${D}${base_sbindir}/
123 install -d ${D}${sysconfdir}/udhcpc.d
124 install -d ${D}${datadir}/udhcpc
125 install -m 0755 ${S}/examples/udhcp/simple.script ${D}${sysconfdir}/udhcpc.d/50default
126 install -m 0755 ${WORKDIR}/default.script ${D}${datadir}/udhcpc/default.script
129 install -m 0644 ${S}/busybox.links ${D}${sysconfdir}
132 pkg_postinst_${PN} () {
133 # If we are not making an image we create links for the utilities that doesn't exist
134 # so the update-alternatives script will get the utilities it needs
135 # (update-alternatives have no problem replacing links later anyway)
136 test -n 2> /dev/null || alias test='busybox test'
137 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
139 # This adds the links, remember that this has to work when building an image too, hence the $D
140 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
144 # This is so you can make busybox commit suicide - removing busybox with no other packages
145 # providing its files, this will make update-alternatives work, but the update-rc.d part
146 # for syslog, httpd and/or udhcpd will fail if there is no other package providing sh
147 tmpdir=`mktemp -d /tmp/busyboxrm-XXXXXX`
148 cp -a /bin/busybox $tmpdir/
149 ln -s $tmpdir/busybox $tmpdir/[
150 ln -s $tmpdir/busybox $tmpdir/test
151 ln -s $tmpdir/busybox $tmpdir/head
152 ln -s $tmpdir/busybox $tmpdir/sh
153 ln -s $tmpdir/busybox $tmpdir/basename
154 ln -s $tmpdir/busybox $tmpdir/echo
155 ln -s $tmpdir/busybox $tmpdir/mv
156 ln -s $tmpdir/busybox $tmpdir/ln
157 ln -s $tmpdir/busybox $tmpdir/dirname
158 ln -s $tmpdir/busybox $tmpdir/rm
159 ln -s $tmpdir/busybox $tmpdir/sed
160 ln -s $tmpdir/busybox $tmpdir/sort
161 export PATH=$PATH:$tmpdir
162 while read link; do case "$link" in /*/*/*) to="../../bin/busybox";; /bin/*) to="busybox";; /*/*) to="../bin/busybox";; esac; bn=`basename $link`; sh /usr/bin/update-alternatives --remove $bn $to; done </etc/busybox.links