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 # Use gcc for linking so LDFLAGS actually makes sense
54 LD = "${CC} -nostdlib"
56 inherit cml1 update-rc.d
59 unset CFLAGS CPPFLAGS CXXFLAGS
64 oe_runmake busybox.links
65 if [ "x${layout_prefix}" = "x" ]; then
66 sed 's:^/usr/:/:' < busybox.links >busybox.links.new
67 mv busybox.links.new busybox.links
68 elif [ "${layout_prefix}" != "/usr" ]; then
69 echo "warning, busybox.links will lose with this prefix"
71 unset CFLAGS CPPFLAGS CXXFLAGS
72 install -d ${D}${sysconfdir}/init.d
73 oe_runmake "PREFIX=${D}" install
74 cp -pPR ${S}/_install/* ${D}/
76 # Move everything to /busybox (not supposed to end up in any package)
77 install -d ${D}/busybox
80 for i in ${D}${base_bindir} ${D}${base_sbindir} ${D}${prefix} ; do
82 cp -dPr $i ${D}/busybox/
85 # Move the busybox binary back to /bin
86 install -d ${D}${base_bindir}
87 mv ${D}/busybox${base_bindir}/busybox ${D}${base_bindir}/
88 # Move back the sh symlink
89 test -h ${D}/busybox${base_bindir}/sh && mv ${D}/busybox${base_bindir}/sh ${D}${base_bindir}/
91 install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/
92 install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/
93 if grep "CONFIG_CROND=y" ${WORKDIR}/defconfig; then
94 # Move crond back to /usr/sbin/crond
95 install -d ${D}${sbindir}
96 mv ${D}/busybox${sbindir}/crond ${D}${sbindir}/
98 install -m 0755 ${WORKDIR}/busybox-cron ${D}${sysconfdir}/init.d/
100 if grep "CONFIG_HTTPD=y" ${WORKDIR}/defconfig; then
101 # Move httpd back to /usr/sbin/httpd
102 install -d ${D}${sbindir}
103 mv ${D}/busybox${sbindir}/httpd ${D}${sbindir}/
105 install -m 0755 ${WORKDIR}/busybox-httpd ${D}${sysconfdir}/init.d/
106 install -d ${D}/srv/www
108 if grep "CONFIG_APP_UDHCPD=y" ${WORKDIR}/defconfig; then
109 # Move udhcpd back to /usr/sbin/udhcpd
110 install -d ${D}${sbindir}
111 mv ${D}/busybox${sbindir}/udhcpd ${D}${sbindir}/
113 install -m 0755 ${WORKDIR}/busybox-udhcpd ${D}${sysconfdir}/init.d/
115 if grep "CONFIG_HWCLOCK=y" ${WORKDIR}/defconfig; then
116 # Move hwclock back to /sbin/hwclock
117 install -d ${D}${base_sbindir}
118 mv ${D}/busybox${base_sbindir}/hwclock ${D}${base_sbindir}/
120 install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
122 if grep "CONFIG_APP_UDHCPC=y" ${WORKDIR}/defconfig; then
123 # Move dhcpc back to /usr/sbin/udhcpc
124 install -d ${D}${base_sbindir}
125 mv ${D}/busybox${base_sbindir}/udhcpc ${D}${base_sbindir}/
127 install -d ${D}${sysconfdir}/udhcpc.d
128 install -d ${D}${datadir}/udhcpc
129 install -m 0755 ${S}/examples/udhcp/simple.script ${D}${sysconfdir}/udhcpc.d/50default
130 install -m 0755 ${WORKDIR}/default.script ${D}${datadir}/udhcpc/default.script
132 if grep "CONFIG_FEATURE_MOUNT_FSTAB=y" ${WORKDIR}/defconfig; then
133 install -d ${D}${sysconfdir}/default
134 install -m 644 ${WORKDIR}/mountall ${D}${sysconfdir}/default/
137 install -m 0644 ${S}/busybox.links ${D}${sysconfdir}
140 pkg_postinst_${PN} () {
141 # If we are not making an image we create links for the utilities that doesn't exist
142 # so the update-alternatives script will get the utilities it needs
143 # (update-alternatives have no problem replacing links later anyway)
144 test -n 2> /dev/null || alias test='busybox test'
145 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
147 # This adds the links, remember that this has to work when building an image too, hence the $D
148 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
152 # This is so you can make busybox commit suicide - removing busybox with no other packages
153 # providing its files, this will make update-alternatives work, but the update-rc.d part
154 # for syslog, httpd and/or udhcpd will fail if there is no other package providing sh
155 tmpdir=`mktemp -d /tmp/busyboxrm-XXXXXX`
156 ln -s /bin/busybox $tmpdir/[
157 ln -s /bin/busybox $tmpdir/test
158 ln -s /bin/busybox $tmpdir/head
159 ln -s /bin/busybox $tmpdir/sh
160 ln -s /bin/busybox $tmpdir/basename
161 ln -s /bin/busybox $tmpdir/echo
162 ln -s /bin/busybox $tmpdir/mv
163 ln -s /bin/busybox $tmpdir/ln
164 ln -s /bin/busybox $tmpdir/dirname
165 ln -s /bin/busybox $tmpdir/rm
166 ln -s /bin/busybox $tmpdir/sed
167 ln -s /bin/busybox $tmpdir/sort
168 export PATH=$PATH:$tmpdir
173 /*/*/*) to="../../bin/busybox";;
174 /bin/*) to="busybox";;
175 /*/*) to="../bin/busybox";;
178 sh /usr/bin/update-alternatives --remove $bn $to
179 done </etc/busybox.links
182 PACKAGES =+ "${PN}-mdev"
183 FILES_${PN}-mdev = "${sysconfdir}/mdev ${sysconfdir}/mdev.conf ${sysconfdir}/init.d/mdev"
184 RDEPENDS_${PN}-mdev += "${PN}"
186 pkg_postinst_${PN}-mdev() {
187 if test "x$D" != "x"; then
192 update-rc.d $OPT mdev start 06 S .