summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-core/toybox
diff options
context:
space:
mode:
authorPaul Barker <paul@paulbarker.me.uk>2014-09-08 09:11:44 +0000
committerMartin Jansa <Martin.Jansa@gmail.com>2014-09-26 05:42:53 +0200
commit11a7fb62b8e2f1d91793460de33229874c433648 (patch)
tree70510b84e4f4a02b17d4dc09a10908be97d3ffcb /meta-oe/recipes-core/toybox
parent8c2e27e68642224df084eed14c2ad1de4f1bb0a5 (diff)
downloadmeta-openembedded-11a7fb62b8e2f1d91793460de33229874c433648.tar.gz
toybox: New recipe for toybox-0.4.9
Toybox is a BSD-licensed alternative to Busybox which may be of interest to a few people. It's still a work in progress but it already covers a large number of the basic commands a system needs. Removing toybox after it has been installed currently bricks the system though as the postrm script runs after '/bin/toybox' has been removed (so things like '/bin/ln' become broken links and the update-alternatives script can't run). Toybox is patched to change the install paths of several utilities to match the paths used by Busybox. This is needed as update-alternatives from opkg-utils cannot handle two providers of a given utility which place their links in different locations. Link locations have so far only been matched with Busybox, other packages such as coreutils still cause clashes. Therefore, toybox currently installs cleanly on core-image-minimal but fails to install cleanly on core-image-full-cmdline. Hopefully Toybox is still usable for testing in the current state. With further development of the recipe it should be possible to install and uninstall toybox cleanly on all core images. With further upstream development it should become a viable replacement for Busybox. Signed-off-by: Paul Barker <paul@paulbarker.me.uk> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-core/toybox')
-rw-r--r--meta-oe/recipes-core/toybox/toybox/0001-Match-paths-with-busybox.patch365
-rw-r--r--meta-oe/recipes-core/toybox/toybox_0.4.9.bb64
2 files changed, 429 insertions, 0 deletions
diff --git a/meta-oe/recipes-core/toybox/toybox/0001-Match-paths-with-busybox.patch b/meta-oe/recipes-core/toybox/toybox/0001-Match-paths-with-busybox.patch
new file mode 100644
index 000000000..221355943
--- /dev/null
+++ b/meta-oe/recipes-core/toybox/toybox/0001-Match-paths-with-busybox.patch
@@ -0,0 +1,365 @@
1From cbd9ac1d0769338411297d2cb97f1608c17c8ae9 Mon Sep 17 00:00:00 2001
2From: Paul Barker <paul@paulbarker.me.uk>
3Date: Mon, 18 Aug 2014 12:18:16 +0000
4Subject: [PATCH] Match paths with busybox
5
6To ensure that toybox can be installed alongside busybox without confusing
7update-alternatives, the paths of the links installed by toybox should match
8those installed by busybox. This is accomplished by changing the flags of a few
9tools within toybox.
10
11Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
12
13Upstream-status: Inappropriate
14 (specific to update-alternatives use in OpenEmbedded)
15---
16 toys/lsb/pidof.c | 2 +-
17 toys/other/chvt.c | 2 +-
18 toys/other/ifconfig.c | 2 +-
19 toys/other/insmod.c | 2 +-
20 toys/other/lsmod.c | 2 +-
21 toys/other/netcat.c | 2 +-
22 toys/other/pivot_root.c | 2 +-
23 toys/other/readlink.c | 2 +-
24 toys/other/reboot.c | 6 +++---
25 toys/other/rfkill.c | 2 +-
26 toys/other/rmmod.c | 2 +-
27 toys/other/swapoff.c | 2 +-
28 toys/other/swapon.c | 2 +-
29 toys/other/sysctl.c | 2 +-
30 toys/posix/cut.c | 2 +-
31 toys/posix/df.c | 2 +-
32 toys/posix/head.c | 2 +-
33 toys/posix/id.c | 6 +++---
34 toys/posix/mkfifo.c | 2 +-
35 toys/posix/renice.c | 2 +-
36 toys/posix/tail.c | 2 +-
37 toys/posix/tee.c | 2 +-
38 toys/posix/uniq.c | 2 +-
39 toys/posix/who.c | 2 +-
40 24 files changed, 28 insertions(+), 28 deletions(-)
41
42diff --git a/toys/lsb/pidof.c b/toys/lsb/pidof.c
43index 51b742f..a8fc8ef 100644
44--- a/toys/lsb/pidof.c
45+++ b/toys/lsb/pidof.c
46@@ -5,7 +5,7 @@
47 *
48 * http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/pidof.html
49
50-USE_PIDOF(NEWTOY(pidof, "<1so:", TOYFLAG_USR|TOYFLAG_BIN))
51+USE_PIDOF(NEWTOY(pidof, "<1so:", TOYFLAG_BIN))
52
53 config PIDOF
54 bool "pidof"
55diff --git a/toys/other/chvt.c b/toys/other/chvt.c
56index 6544265..a93327f 100644
57--- a/toys/other/chvt.c
58+++ b/toys/other/chvt.c
59@@ -2,7 +2,7 @@
60 *
61 * Copyright (C) 2008 David Anders <danders@amltd.com>
62
63-USE_CHVT(NEWTOY(chvt, "<1", TOYFLAG_USR|TOYFLAG_SBIN))
64+USE_CHVT(NEWTOY(chvt, "<1", TOYFLAG_USR|TOYFLAG_BIN))
65
66 config CHVT
67 bool "chvt"
68diff --git a/toys/other/ifconfig.c b/toys/other/ifconfig.c
69index a84e26a..66c7179 100644
70--- a/toys/other/ifconfig.c
71+++ b/toys/other/ifconfig.c
72@@ -6,7 +6,7 @@
73 *
74 * Not in SUSv4.
75
76-USE_IFCONFIG(NEWTOY(ifconfig, "?a", TOYFLAG_BIN))
77+USE_IFCONFIG(NEWTOY(ifconfig, "?a", TOYFLAG_SBIN))
78
79 config IFCONFIG
80 bool "ifconfig"
81diff --git a/toys/other/insmod.c b/toys/other/insmod.c
82index 8aa959a..75fd7cd 100644
83--- a/toys/other/insmod.c
84+++ b/toys/other/insmod.c
85@@ -2,7 +2,7 @@
86 *
87 * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
88
89-USE_INSMOD(NEWTOY(insmod, "<1", TOYFLAG_BIN|TOYFLAG_NEEDROOT))
90+USE_INSMOD(NEWTOY(insmod, "<1", TOYFLAG_SBIN|TOYFLAG_NEEDROOT))
91
92 config INSMOD
93 bool "insmod"
94diff --git a/toys/other/lsmod.c b/toys/other/lsmod.c
95index b8f5d82..4d16048 100644
96--- a/toys/other/lsmod.c
97+++ b/toys/other/lsmod.c
98@@ -2,7 +2,7 @@
99 *
100 * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
101
102-USE_LSMOD(NEWTOY(lsmod, NULL, TOYFLAG_BIN))
103+USE_LSMOD(NEWTOY(lsmod, NULL, TOYFLAG_SBIN))
104
105 config LSMOD
106 bool "lsmod"
107diff --git a/toys/other/netcat.c b/toys/other/netcat.c
108index 3c6f630..188c3d1 100644
109--- a/toys/other/netcat.c
110+++ b/toys/other/netcat.c
111@@ -4,7 +4,7 @@
112 *
113 * TODO: udp, ipv6, genericize for telnet/microcom/tail-f
114
115-USE_NETCAT(OLDTOY(nc, netcat, USE_NETCAT_LISTEN("tl^L^")"w#p#s:q#f:", TOYFLAG_BIN))
116+USE_NETCAT(OLDTOY(nc, netcat, USE_NETCAT_LISTEN("tl^L^")"w#p#s:q#f:", TOYFLAG_USR|TOYFLAG_BIN))
117 USE_NETCAT(NEWTOY(netcat, USE_NETCAT_LISTEN("tl^L^")"w#p#s:q#f:", TOYFLAG_BIN))
118
119 config NETCAT
120diff --git a/toys/other/pivot_root.c b/toys/other/pivot_root.c
121index 3e4beac..ce3d3a8 100644
122--- a/toys/other/pivot_root.c
123+++ b/toys/other/pivot_root.c
124@@ -2,7 +2,7 @@
125 *
126 * Copyright 2012 Rob Landley <rob@landley.net>
127
128-USE_PIVOT_ROOT(NEWTOY(pivot_root, "<2>2", TOYFLAG_USR|TOYFLAG_BIN))
129+USE_PIVOT_ROOT(NEWTOY(pivot_root, "<2>2", TOYFLAG_SBIN))
130
131 config PIVOT_ROOT
132 bool "pivot_root"
133diff --git a/toys/other/readlink.c b/toys/other/readlink.c
134index 1c33362..fecd1ef 100644
135--- a/toys/other/readlink.c
136+++ b/toys/other/readlink.c
137@@ -2,7 +2,7 @@
138 *
139 * Copyright 2007 Rob Landley <rob@landley.net>
140
141-USE_READLINK(NEWTOY(readlink, "<1>1fenq[-fe]", TOYFLAG_BIN))
142+USE_READLINK(NEWTOY(readlink, "<1>1fenq[-fe]", TOYFLAG_USR|TOYFLAG_BIN))
143
144 config READLINK
145 bool "readlink"
146diff --git a/toys/other/reboot.c b/toys/other/reboot.c
147index 5cbc4f8..f8baafc 100644
148--- a/toys/other/reboot.c
149+++ b/toys/other/reboot.c
150@@ -2,9 +2,9 @@
151 *
152 * Copyright 2013 Elie De Brauwer <eliedebrauwer@gmail.com>
153
154-USE_REBOOT(NEWTOY(reboot, "n", TOYFLAG_BIN|TOYFLAG_NEEDROOT))
155-USE_REBOOT(OLDTOY(halt, reboot, "n", TOYFLAG_BIN|TOYFLAG_NEEDROOT))
156-USE_REBOOT(OLDTOY(poweroff, reboot, "n", TOYFLAG_BIN|TOYFLAG_NEEDROOT))
157+USE_REBOOT(NEWTOY(reboot, "n", TOYFLAG_SBIN|TOYFLAG_NEEDROOT))
158+USE_REBOOT(OLDTOY(halt, reboot, "n", TOYFLAG_SBIN|TOYFLAG_NEEDROOT))
159+USE_REBOOT(OLDTOY(poweroff, reboot, "n", TOYFLAG_SBIN|TOYFLAG_NEEDROOT))
160
161 config REBOOT
162 bool "reboot"
163diff --git a/toys/other/rfkill.c b/toys/other/rfkill.c
164index af3efe1..7527ec7 100644
165--- a/toys/other/rfkill.c
166+++ b/toys/other/rfkill.c
167@@ -5,7 +5,7 @@
168 *
169 * No Standard
170
171-USE_RFKILL(NEWTOY(rfkill, "<1>2", TOYFLAG_SBIN))
172+USE_RFKILL(NEWTOY(rfkill, "<1>2", TOYFLAG_USR|TOYFLAG_SBIN))
173
174 config RFKILL
175 bool "rfkill"
176diff --git a/toys/other/rmmod.c b/toys/other/rmmod.c
177index b789acc..10c134c 100644
178--- a/toys/other/rmmod.c
179+++ b/toys/other/rmmod.c
180@@ -2,7 +2,7 @@
181 *
182 * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
183
184-USE_RMMOD(NEWTOY(rmmod, "<1wf", TOYFLAG_BIN|TOYFLAG_NEEDROOT))
185+USE_RMMOD(NEWTOY(rmmod, "<1wf", TOYFLAG_SBIN|TOYFLAG_NEEDROOT))
186
187 config RMMOD
188 bool "rmmod"
189diff --git a/toys/other/swapoff.c b/toys/other/swapoff.c
190index b89e915..fb17130 100644
191--- a/toys/other/swapoff.c
192+++ b/toys/other/swapoff.c
193@@ -2,7 +2,7 @@
194 *
195 * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
196
197-USE_SWAPOFF(NEWTOY(swapoff, "<1>1", TOYFLAG_BIN|TOYFLAG_NEEDROOT))
198+USE_SWAPOFF(NEWTOY(swapoff, "<1>1", TOYFLAG_SBIN|TOYFLAG_NEEDROOT))
199
200 config SWAPOFF
201 bool "swapoff"
202diff --git a/toys/other/swapon.c b/toys/other/swapon.c
203index 49f1249..838d382 100644
204--- a/toys/other/swapon.c
205+++ b/toys/other/swapon.c
206@@ -2,7 +2,7 @@
207 *
208 * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
209
210-USE_SWAPON(NEWTOY(swapon, "<1>1p#<0>32767", TOYFLAG_BIN|TOYFLAG_NEEDROOT))
211+USE_SWAPON(NEWTOY(swapon, "<1>1p#<0>32767", TOYFLAG_SBIN|TOYFLAG_NEEDROOT))
212
213 config SWAPON
214 bool "swapon"
215diff --git a/toys/other/sysctl.c b/toys/other/sysctl.c
216index 8e57ca1..0c6c640 100644
217--- a/toys/other/sysctl.c
218+++ b/toys/other/sysctl.c
219@@ -5,7 +5,7 @@
220 *
221 * No Standard
222
223-USE_SYSCTL(NEWTOY(sysctl, "^neNqwpaA[!ap][!aq][!aw][+aA]", TOYFLAG_USR|TOYFLAG_BIN))
224+USE_SYSCTL(NEWTOY(sysctl, "^neNqwpaA[!ap][!aq][!aw][+aA]", TOYFLAG_SBIN))
225
226 config SYSCTL
227 bool "sysctl"
228diff --git a/toys/posix/cut.c b/toys/posix/cut.c
229index 38f136e..87a1f0d 100644
230--- a/toys/posix/cut.c
231+++ b/toys/posix/cut.c
232@@ -4,7 +4,7 @@
233 *
234 * http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cut.html
235
236-USE_CUT(NEWTOY(cut, "b:|c:|f:|d:sn[!cbf]", TOYFLAG_BIN))
237+USE_CUT(NEWTOY(cut, "b:|c:|f:|d:sn[!cbf]", TOYFLAG_USR|TOYFLAG_BIN))
238
239 config CUT
240 bool "cut"
241diff --git a/toys/posix/df.c b/toys/posix/df.c
242index afb296b..6296dc9 100644
243--- a/toys/posix/df.c
244+++ b/toys/posix/df.c
245@@ -4,7 +4,7 @@
246 *
247 * See http://opengroup.org/onlinepubs/9699919799/utilities/df.html
248
249-USE_DF(NEWTOY(df, "Pkt*a", TOYFLAG_USR|TOYFLAG_SBIN))
250+USE_DF(NEWTOY(df, "Pkt*a", TOYFLAG_BIN))
251
252 config DF
253 bool "df"
254diff --git a/toys/posix/head.c b/toys/posix/head.c
255index e8517d4..3ac4373 100644
256--- a/toys/posix/head.c
257+++ b/toys/posix/head.c
258@@ -4,7 +4,7 @@
259 *
260 * See http://opengroup.org/onlinepubs/9699919799/utilities/head.html
261
262-USE_HEAD(NEWTOY(head, "n#<0=10", TOYFLAG_BIN))
263+USE_HEAD(NEWTOY(head, "n#<0=10", TOYFLAG_USR|TOYFLAG_BIN))
264
265 config HEAD
266 bool "head"
267diff --git a/toys/posix/id.c b/toys/posix/id.c
268index a03a097..cfe0b59 100644
269--- a/toys/posix/id.c
270+++ b/toys/posix/id.c
271@@ -6,10 +6,10 @@
272 *
273 * See http://opengroup.org/onlinepubs/9699919799/utilities/id.html
274
275-USE_ID(NEWTOY(id, ">1nGgru[!Ggu]", TOYFLAG_BIN))
276+USE_ID(NEWTOY(id, ">1nGgru[!Ggu]", TOYFLAG_USR|TOYFLAG_BIN))
277 USE_ID_GROUPS(OLDTOY(groups, id, NULL, TOYFLAG_USR|TOYFLAG_BIN))
278-USE_ID_LOGNAME(OLDTOY(logname, id, ">0", TOYFLAG_BIN))
279-USE_ID_LOGNAME(OLDTOY(whoami, id, ">0", TOYFLAG_BIN))
280+USE_ID_LOGNAME(OLDTOY(logname, id, ">0", TOYFLAG_USR|TOYFLAG_BIN))
281+USE_ID_LOGNAME(OLDTOY(whoami, id, ">0", TOYFLAG_USR|TOYFLAG_BIN))
282
283 config ID
284 bool "id"
285diff --git a/toys/posix/mkfifo.c b/toys/posix/mkfifo.c
286index 15fab70..4e0fca3 100644
287--- a/toys/posix/mkfifo.c
288+++ b/toys/posix/mkfifo.c
289@@ -4,7 +4,7 @@
290 *
291 * See http://opengroup.org/onlinepubs/9699919799/utilities/mkfifo.html
292
293-USE_MKFIFO(NEWTOY(mkfifo, "<1m:", TOYFLAG_BIN))
294+USE_MKFIFO(NEWTOY(mkfifo, "<1m:", TOYFLAG_USR|TOYFLAG_BIN))
295
296 config MKFIFO
297 bool "mkfifo"
298diff --git a/toys/posix/renice.c b/toys/posix/renice.c
299index 8c20644..489eb13 100644
300--- a/toys/posix/renice.c
301+++ b/toys/posix/renice.c
302@@ -4,7 +4,7 @@
303 *
304 * See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/renice.html
305
306-USE_RENICE(NEWTOY(renice, "<1gpun#|", TOYFLAG_BIN))
307+USE_RENICE(NEWTOY(renice, "<1gpun#|", TOYFLAG_USR|TOYFLAG_BIN))
308
309 config RENICE
310 bool "renice"
311diff --git a/toys/posix/tail.c b/toys/posix/tail.c
312index e1048be..ba0a55a 100644
313--- a/toys/posix/tail.c
314+++ b/toys/posix/tail.c
315@@ -4,7 +4,7 @@
316 *
317 * See http://opengroup.org/onlinepubs/9699919799/utilities/tail.html
318
319-USE_TAIL(NEWTOY(tail, "fc-n-[-cn]", TOYFLAG_BIN))
320+USE_TAIL(NEWTOY(tail, "fc-n-[-cn]", TOYFLAG_USR|TOYFLAG_BIN))
321
322 config TAIL
323 bool "tail"
324diff --git a/toys/posix/tee.c b/toys/posix/tee.c
325index 0388510..5574088 100644
326--- a/toys/posix/tee.c
327+++ b/toys/posix/tee.c
328@@ -4,7 +4,7 @@
329 *
330 * See http://opengroup.org/onlinepubs/9699919799/utilities/tee.html
331
332-USE_TEE(NEWTOY(tee, "ia", TOYFLAG_BIN))
333+USE_TEE(NEWTOY(tee, "ia", TOYFLAG_USR|TOYFLAG_BIN))
334
335 config TEE
336 bool "tee"
337diff --git a/toys/posix/uniq.c b/toys/posix/uniq.c
338index bd41d4a..374ceab 100644
339--- a/toys/posix/uniq.c
340+++ b/toys/posix/uniq.c
341@@ -4,7 +4,7 @@
342 *
343 * See http://opengroup.org/onlinepubs/9699919799/utilities/uniq.html
344
345-USE_UNIQ(NEWTOY(uniq, "f#s#w#zicdu", TOYFLAG_BIN))
346+USE_UNIQ(NEWTOY(uniq, "f#s#w#zicdu", TOYFLAG_USR|TOYFLAG_BIN))
347
348 config UNIQ
349 bool "uniq"
350diff --git a/toys/posix/who.c b/toys/posix/who.c
351index 2c8a2e6..d5cd001 100644
352--- a/toys/posix/who.c
353+++ b/toys/posix/who.c
354@@ -9,7 +9,7 @@
355 * Posix says to support many options (-abdHlmpqrstTu) but this
356 * isn't aimed at minicomputers with modem pools.
357
358-USE_WHO(NEWTOY(who, "a", TOYFLAG_BIN))
359+USE_WHO(NEWTOY(who, "a", TOYFLAG_USR|TOYFLAG_BIN))
360
361 config WHO
362 bool "who"
363--
3642.0.4
365
diff --git a/meta-oe/recipes-core/toybox/toybox_0.4.9.bb b/meta-oe/recipes-core/toybox/toybox_0.4.9.bb
new file mode 100644
index 000000000..ec76bd61a
--- /dev/null
+++ b/meta-oe/recipes-core/toybox/toybox_0.4.9.bb
@@ -0,0 +1,64 @@
1SUMMARY = "Toybox combines common utilities together into a single executable."
2HOMEPAGE = "http://www.landley.net/toybox/"
3
4SRC_URI = "http://www.landley.net/toybox/downloads/${BPN}-${PV}.tar.bz2 \
5 file://0001-Match-paths-with-busybox.patch"
6SRC_URI[md5sum] = "a8f1022175689defec51cf5a71c41326"
7SRC_URI[sha256sum] = "e6dc9052826a3bdae1923e3301c9e3542e890af5ed66534052943f8412255bff"
8
9LICENSE = "BSD-0-Clause"
10LIC_FILES_CHKSUM = "file://LICENSE;md5=57cc240a6204b2ea8c68450d42f9d33f"
11
12SECTION = "base"
13
14do_configure() {
15 oe_runmake defconfig
16
17 # Disable killall5 as it isn't managed by update-alternatives
18 sed -e 's/CONFIG_KILLALL5=y/# CONFIG_KILLALL5 is not set/' -i .config
19}
20
21do_compile() {
22 oe_runmake toybox_unstripped
23
24 # Create a list of links needed
25 oe_runmake generated/instlist
26 ./generated/instlist long | sed -e 's#^#/#' > toybox.links
27}
28
29do_install() {
30 # Install manually instead of using 'make install'
31 install -d ${D}${base_bindir}
32 if grep -q "CONFIG_TOYBOX_SUID=y" ${B}/.config; then
33 install -m 4755 ${B}/toybox_unstripped ${D}${base_bindir}/toybox
34 else
35 install -m 0755 ${B}/toybox_unstripped ${D}${base_bindir}/toybox
36 fi
37
38 install -d ${D}${sysconfdir}
39 install -m 0644 ${B}/toybox.links ${D}${sysconfdir}
40}
41
42inherit update-alternatives
43
44# If you've chosen to install toybox you probably want it to take precedence
45# over busybox where possible but not over other packages
46ALTERNATIVE_PRIORITY = "60"
47
48python do_package_prepend () {
49 # Read links from /etc/toybox.links and create appropriate
50 # update-alternatives variables
51
52 dvar = d.getVar('D', True)
53 pn = d.getVar('PN', True)
54 target = "/bin/toybox"
55
56 f = open('%s/etc/toybox.links' % (dvar), 'r')
57 for alt_link_name in f:
58 alt_link_name = alt_link_name.strip()
59 alt_name = os.path.basename(alt_link_name)
60 d.appendVar('ALTERNATIVE_%s' % (pn), ' ' + alt_name)
61 d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, alt_link_name)
62 d.setVarFlag('ALTERNATIVE_TARGET', alt_name, target)
63 f.close()
64}