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://df.patch;patch=1 \
26 file://below.patch;patch=1 \
27 file://fbset.patch;patch=1 \
28 file://mount-all-type.patch;patch=1 \
29 file://dhcp-hostname.patch;patch=1 \
30 file://gzip-spurious-const.patch;patch=1 \
31 file://ifupdown-spurious-environ.patch;patch=1 \
32 file://start-stop-daemon-oknodo-support.patch;patch=1 \
35 file://busybox-httpd \
36 file://busybox-udhcpd \
39 file://default.script \
41 file://mount.busybox \
42 file://umount.busybox"
44 S = "${WORKDIR}/busybox-${PV}"
46 export EXTRA_CFLAGS = "${CFLAGS}"
47 EXTRA_OEMAKE_append = " CROSS=${HOST_PREFIX}"
48 PACKAGES =+ "${PN}-httpd ${PN}-udhcpd"
50 FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
51 FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
53 FILES_${PN} += " ${datadir}/udhcpc"
55 INITSCRIPT_PACKAGES = "${PN} ${PN}-httpd ${PN}-udhcpd"
56 INITSCRIPT_NAME_${PN}-httpd = "busybox-httpd"
57 INITSCRIPT_NAME_${PN}-udhcpd = "busybox-udhcpd"
58 INITSCRIPT_NAME_${PN} = "syslog"
59 CONFFILES_${PN} = "${sysconfdir}/syslog.conf"
61 # This disables the syslog startup links in openslug (see openslug-init)
62 INITSCRIPT_PARAMS_${PN}_openslug = "start 20 ."
64 inherit cml1 update-rc.d
67 install -m 0644 ${WORKDIR}/defconfig ${S}/.config
77 install -d ${D}${sysconfdir}/init.d
78 oe_runmake 'PREFIX=${D}' install
80 # Move everything to /busybox (not supposed to end up in any package)
81 install -d ${D}/busybox
82 mv ${D}${base_bindir} ${D}${base_sbindir} ${D}${prefix} ${D}/busybox/
83 # Move the busybox binary back to /bin
84 install -d ${D}${base_bindir}
85 mv ${D}/busybox${base_bindir}/busybox ${D}${base_bindir}/
86 # Move back the sh symlink
87 mv ${D}/busybox${base_bindir}/sh ${D}${base_bindir}/
89 install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/
90 install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/
91 if grep "CONFIG_CROND=y" ${WORKDIR}/defconfig; then
92 # Move crond back to /usr/sbin/crond
93 install -d ${D}${sbindir}
94 mv ${D}/busybox${sbindir}/crond ${D}${sbindir}/
96 install -m 0755 ${WORKDIR}/busybox-cron ${D}${sysconfdir}/init.d/
98 if grep "CONFIG_HTTPD=y" ${WORKDIR}/defconfig; then
99 # Move httpd back to /usr/sbin/httpd
100 install -d ${D}${sbindir}
101 mv ${D}/busybox${sbindir}/httpd ${D}${sbindir}/
103 install -m 0755 ${WORKDIR}/busybox-httpd ${D}${sysconfdir}/init.d/
104 install -d ${D}/srv/www
106 if grep "CONFIG_UDHCPD=y" ${WORKDIR}/defconfig; then
107 # Move udhcpd back to /usr/sbin/udhcpd
108 install -d ${D}${sbindir}
109 mv ${D}/busybox${sbindir}/udhcpd ${D}${sbindir}/
111 install -m 0755 ${WORKDIR}/busybox-udhcpd ${D}${sysconfdir}/init.d/
113 if grep "CONFIG_HWCLOCK=y" ${WORKDIR}/defconfig; then
114 # Move hwclock back to /sbin/hwclock
115 install -d ${D}${base_sbindir}
116 mv ${D}/busybox${base_sbindir}/hwclock ${D}${base_sbindir}/
118 install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
120 if grep "CONFIG_UDHCPC=y" ${WORKDIR}/defconfig; then
121 # Move dhcpc back to /usr/sbin/udhcpc
122 install -d ${D}${base_sbindir}
123 mv ${D}/busybox${base_sbindir}/udhcpc ${D}${base_sbindir}/
125 install -d ${D}${sysconfdir}/udhcpc.d
126 install -d ${D}${datadir}/udhcpc
127 install -m 0755 ${S}/examples/udhcp/simple.script ${D}${sysconfdir}/udhcpc.d/50default
128 install -m 0755 ${WORKDIR}/default.script ${D}${datadir}/udhcpc/default.script
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";; 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";; 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 cp -a /bin/busybox $tmpdir/
151 ln -s $tmpdir/busybox $tmpdir/[
152 ln -s $tmpdir/busybox $tmpdir/test
153 ln -s $tmpdir/busybox $tmpdir/head
154 ln -s $tmpdir/busybox $tmpdir/sh
155 ln -s $tmpdir/busybox $tmpdir/basename
156 ln -s $tmpdir/busybox $tmpdir/echo
157 ln -s $tmpdir/busybox $tmpdir/mv
158 ln -s $tmpdir/busybox $tmpdir/ln
159 ln -s $tmpdir/busybox $tmpdir/dirname
160 ln -s $tmpdir/busybox $tmpdir/rm
161 ln -s $tmpdir/busybox $tmpdir/sed
162 ln -s $tmpdir/busybox $tmpdir/sort
163 export PATH=$PATH:$tmpdir
164 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