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://ifupdown-phase.patch;patch=1 \
33 file://start-stop-daemon-oknodo-support.patch;patch=1 \
36 file://busybox-httpd \
37 file://busybox-udhcpd \
40 file://default.script \
42 file://mount.busybox \
43 file://umount.busybox"
45 S = "${WORKDIR}/busybox-${PV}"
47 export EXTRA_CFLAGS = "${CFLAGS}"
48 EXTRA_OEMAKE_append = " CROSS=${HOST_PREFIX}"
49 PACKAGES =+ "${PN}-httpd ${PN}-udhcpd"
51 FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
52 FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
54 FILES_${PN} += " ${datadir}/udhcpc"
56 INITSCRIPT_PACKAGES = "${PN} ${PN}-httpd ${PN}-udhcpd"
57 INITSCRIPT_NAME_${PN}-httpd = "busybox-httpd"
58 INITSCRIPT_NAME_${PN}-udhcpd = "busybox-udhcpd"
59 INITSCRIPT_NAME_${PN} = "syslog"
60 CONFFILES_${PN} = "${sysconfdir}/syslog.conf"
62 # This disables the syslog startup links in openslug (see openslug-init)
63 INITSCRIPT_PARAMS_${PN}_openslug = "start 20 ."
65 inherit cml1 update-rc.d
68 install -m 0644 ${WORKDIR}/defconfig ${S}/.config
78 install -d ${D}${sysconfdir}/init.d
79 oe_runmake 'PREFIX=${D}' install
81 # Move everything to /busybox (not supposed to end up in any package)
82 install -d ${D}/busybox
83 mv ${D}${base_bindir} ${D}${base_sbindir} ${D}${prefix} ${D}/busybox/
84 # Move the busybox binary back to /bin
85 install -d ${D}${base_bindir}
86 mv ${D}/busybox${base_bindir}/busybox ${D}${base_bindir}/
87 # Move back the sh symlink
88 mv ${D}/busybox${base_bindir}/sh ${D}${base_bindir}/
90 install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/
91 install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/
92 if grep "CONFIG_CROND=y" ${WORKDIR}/defconfig; then
93 # Move crond back to /usr/sbin/crond
94 install -d ${D}${sbindir}
95 mv ${D}/busybox${sbindir}/crond ${D}${sbindir}/
97 install -m 0755 ${WORKDIR}/busybox-cron ${D}${sysconfdir}/init.d/
99 if grep "CONFIG_HTTPD=y" ${WORKDIR}/defconfig; then
100 # Move httpd back to /usr/sbin/httpd
101 install -d ${D}${sbindir}
102 mv ${D}/busybox${sbindir}/httpd ${D}${sbindir}/
104 install -m 0755 ${WORKDIR}/busybox-httpd ${D}${sysconfdir}/init.d/
105 install -d ${D}/srv/www
107 if grep "CONFIG_UDHCPD=y" ${WORKDIR}/defconfig; then
108 # Move udhcpd back to /usr/sbin/udhcpd
109 install -d ${D}${sbindir}
110 mv ${D}/busybox${sbindir}/udhcpd ${D}${sbindir}/
112 install -m 0755 ${WORKDIR}/busybox-udhcpd ${D}${sysconfdir}/init.d/
114 if grep "CONFIG_HWCLOCK=y" ${WORKDIR}/defconfig; then
115 # Move hwclock back to /sbin/hwclock
116 install -d ${D}${base_sbindir}
117 mv ${D}/busybox${base_sbindir}/hwclock ${D}${base_sbindir}/
119 install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
121 if grep "CONFIG_UDHCPC=y" ${WORKDIR}/defconfig; then
122 # Move dhcpc back to /usr/sbin/udhcpc
123 install -d ${D}${base_sbindir}
124 mv ${D}/busybox${base_sbindir}/udhcpc ${D}${base_sbindir}/
126 install -d ${D}${sysconfdir}/udhcpc.d
127 install -d ${D}${datadir}/udhcpc
128 install -m 0755 ${S}/examples/udhcp/simple.script ${D}${sysconfdir}/udhcpc.d/50default
129 install -m 0755 ${WORKDIR}/default.script ${D}${datadir}/udhcpc/default.script
132 install -m 0644 ${S}/busybox.links ${D}${sysconfdir}
135 pkg_postinst_${PN} () {
136 # If we are not making an image we create links for the utilities that doesn't exist
137 # so the update-alternatives script will get the utilities it needs
138 # (update-alternatives have no problem replacing links later anyway)
139 test -n 2> /dev/null || alias test='busybox test'
140 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
142 # This adds the links, remember that this has to work when building an image too, hence the $D
143 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
147 # This is so you can make busybox commit suicide - removing busybox with no other packages
148 # providing its files, this will make update-alternatives work, but the update-rc.d part
149 # for syslog, httpd and/or udhcpd will fail if there is no other package providing sh
150 tmpdir=`mktemp -d /tmp/busyboxrm-XXXXXX`
151 cp -a /bin/busybox $tmpdir/
152 ln -s $tmpdir/busybox $tmpdir/[
153 ln -s $tmpdir/busybox $tmpdir/test
154 ln -s $tmpdir/busybox $tmpdir/head
155 ln -s $tmpdir/busybox $tmpdir/sh
156 ln -s $tmpdir/busybox $tmpdir/basename
157 ln -s $tmpdir/busybox $tmpdir/echo
158 ln -s $tmpdir/busybox $tmpdir/mv
159 ln -s $tmpdir/busybox $tmpdir/ln
160 ln -s $tmpdir/busybox $tmpdir/dirname
161 ln -s $tmpdir/busybox $tmpdir/rm
162 ln -s $tmpdir/busybox $tmpdir/sed
163 ln -s $tmpdir/busybox $tmpdir/sort
164 export PATH=$PATH:$tmpdir
165 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