summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-core
diff options
context:
space:
mode:
authorPaul Barker <paul@paulbarker.me.uk>2016-06-05 12:58:04 +0100
committerMartin Jansa <Martin.Jansa@gmail.com>2016-06-08 14:55:29 +0200
commitf90b8d367d9bc8ffb02a70fbc23451a020653511 (patch)
treeba8528efa0ed72956fbec8fce38165a2abc3b009 /meta-oe/recipes-core
parent3ff2e225b7125f5c65d482e7c65f43bdfd37c850 (diff)
downloadmeta-openembedded-f90b8d367d9bc8ffb02a70fbc23451a020653511.tar.gz
toybox: Upgrade to 0.7.1
The previous patches are now included in the upstream 0.7.1 release. Two new patches are needed, both of which have been submitted upstream: * The version should report as 0.7.1 not 0.7.0. * grep didn't print any output due to printf choking on a field width of INT_MAX/2. When trim is not set we can drop the field width instead of using a huge default width. The unstripped toybox binary has moved from "toybox_unstripped" to "generated/unstripped/toybox". Additionally, the swapon command is now disabled as it does not support the '-a' option used by initscripts. 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')
-rw-r--r--meta-oe/recipes-core/toybox/toybox/0001-Fix-TOYBOX_VERSION.patch29
-rw-r--r--meta-oe/recipes-core/toybox/toybox/0001-Fix-segfault-in-login.patch33
-rw-r--r--meta-oe/recipes-core/toybox/toybox/0002-Add-b-and-F-arguments-to-hostname.patch84
-rw-r--r--meta-oe/recipes-core/toybox/toybox/0002-Fix-trimmed-printf-in-grep.patch34
-rw-r--r--meta-oe/recipes-core/toybox/toybox_0.7.1.bb (renamed from meta-oe/recipes-core/toybox/toybox_0.7.0.bb)21
5 files changed, 76 insertions, 125 deletions
diff --git a/meta-oe/recipes-core/toybox/toybox/0001-Fix-TOYBOX_VERSION.patch b/meta-oe/recipes-core/toybox/toybox/0001-Fix-TOYBOX_VERSION.patch
new file mode 100644
index 000000000..8af430511
--- /dev/null
+++ b/meta-oe/recipes-core/toybox/toybox/0001-Fix-TOYBOX_VERSION.patch
@@ -0,0 +1,29 @@
1From 209fad8ebd17bf46d0431dafbb547f429a3cffdf Mon Sep 17 00:00:00 2001
2From: Paul Barker <paul@paulbarker.me.uk>
3Date: Sat, 4 Jun 2016 15:05:49 +0100
4Subject: [PATCH 1/2] Fix TOYBOX_VERSION
5
6The latest tagged version is 0.7.1.
7
8Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
9Upstream-status: Submitted
10---
11 main.c | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-)
13
14diff --git a/main.c b/main.c
15index eeae2f3..bedb333 100644
16--- a/main.c
17+++ b/main.c
18@@ -6,7 +6,7 @@
19 #include "toys.h"
20
21 #ifndef TOYBOX_VERSION
22-#define TOYBOX_VERSION "0.7.0"
23+#define TOYBOX_VERSION "0.7.1"
24 #endif
25
26 // Populate toy_list[].
27--
282.1.4
29
diff --git a/meta-oe/recipes-core/toybox/toybox/0001-Fix-segfault-in-login.patch b/meta-oe/recipes-core/toybox/toybox/0001-Fix-segfault-in-login.patch
deleted file mode 100644
index 939885b96..000000000
--- a/meta-oe/recipes-core/toybox/toybox/0001-Fix-segfault-in-login.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1From 863b129441c12eb75d63e4f4fe9a8f7df81607fd Mon Sep 17 00:00:00 2001
2From: Paul Barker <paul@paulbarker.me.uk>
3Date: Sun, 1 May 2016 14:50:59 +0100
4Subject: [PATCH] Fix segfault in login
5
6Fix a bug in readfileat where *plen would be corrupted if you didn't supply
7your own buffer (because ibuf is 0 in that case, not a pointer to the start
8of the allocated space). This caused a segfault in the 'login' program.
9
10Partial backport of upstream commit 81f31e463bd982a8344ea8681938eb43c9114652
11
12Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
13Upstream-status: Backport
14---
15 lib/lib.c | 2 +-
16 1 file changed, 1 insertion(+), 1 deletion(-)
17
18diff --git a/lib/lib.c b/lib/lib.c
19index 6559030..e5bb605 100644
20--- a/lib/lib.c
21+++ b/lib/lib.c
22@@ -475,7 +475,7 @@ char *readfileat(int dirfd, char *name, char *ibuf, off_t *plen)
23 rbuf = buf+rlen;
24 len -= rlen;
25 }
26- *plen = len = rlen+(buf-ibuf);
27+ *plen = len = rlen+(rbuf-buf);
28 close(fd);
29
30 if (rlen<0) {
31--
322.1.4
33
diff --git a/meta-oe/recipes-core/toybox/toybox/0002-Add-b-and-F-arguments-to-hostname.patch b/meta-oe/recipes-core/toybox/toybox/0002-Add-b-and-F-arguments-to-hostname.patch
deleted file mode 100644
index e30049411..000000000
--- a/meta-oe/recipes-core/toybox/toybox/0002-Add-b-and-F-arguments-to-hostname.patch
+++ /dev/null
@@ -1,84 +0,0 @@
1From 151f576ab1fba44137beaeb95620b7942662b4d3 Mon Sep 17 00:00:00 2001
2From: Paul Barker <paul@paulbarker.me.uk>
3Date: Sun, 1 May 2016 15:42:57 +0100
4Subject: [PATCH] Add -b and -F arguments to hostname
5
6These arguments are required to correctly set the hostname at boot time.
7
8Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
9Upstream-status: Submitted
10---
11 toys/lsb/hostname.c | 42 ++++++++++++++++++++++++++++++++++++++++--
12 1 file changed, 40 insertions(+), 2 deletions(-)
13
14diff --git a/toys/lsb/hostname.c b/toys/lsb/hostname.c
15index 23467fb..ebfc803 100644
16--- a/toys/lsb/hostname.c
17+++ b/toys/lsb/hostname.c
18@@ -4,23 +4,61 @@
19 *
20 * http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/hostname.html
21
22-USE_HOSTNAME(NEWTOY(hostname, NULL, TOYFLAG_BIN))
23+USE_HOSTNAME(NEWTOY(hostname, "bF:", TOYFLAG_BIN))
24
25 config HOSTNAME
26 bool "hostname"
27 default y
28 help
29- usage: hostname [newname]
30+ usage: hostname [-b] [-F FILENAME] [newname]
31
32 Get/Set the current hostname
33+
34+ -b Set hostname to 'localhost' if otherwise unset
35+ -F Set hostname to contents of FILENAME
36 */
37
38 #define FOR_hostname
39 #include "toys.h"
40
41+GLOBALS(
42+ char *fname;
43+)
44+
45 void hostname_main(void)
46 {
47 const char *hostname = toys.optargs[0];
48+
49+ if (toys.optflags & FLAG_F) {
50+ char *buf;
51+ if ((hostname = buf = readfile(TT.fname, 0, 0))) {
52+ size_t len = strlen(hostname);
53+ char *end = buf + len - 1;
54+
55+ /* Trim trailing whitespace. */
56+ while (len && isspace(*end)) {
57+ *end-- = '\0';
58+ len--;
59+ }
60+ if (!len) {
61+ free(buf);
62+ hostname = NULL;
63+ if (!(toys.optflags & FLAG_b))
64+ error_exit("empty file '%s'", TT.fname);
65+ }
66+ } else if (!(toys.optflags & FLAG_b))
67+ error_exit("failed to read '%s'", TT.fname);
68+ }
69+
70+ if (!hostname && toys.optflags & FLAG_b) {
71+ /* Do nothing if hostname already set. */
72+ if (gethostname(toybuf, sizeof(toybuf))) perror_exit("get failed");
73+ if (strnlen(toybuf, sizeof(toybuf))) exit(0);
74+
75+ /* Else set hostname to localhost. */
76+ hostname = "localhost";
77+ }
78+
79 if (hostname) {
80 if (sethostname(hostname, strlen(hostname)))
81 perror_exit("set failed '%s'", hostname);
82--
832.1.4
84
diff --git a/meta-oe/recipes-core/toybox/toybox/0002-Fix-trimmed-printf-in-grep.patch b/meta-oe/recipes-core/toybox/toybox/0002-Fix-trimmed-printf-in-grep.patch
new file mode 100644
index 000000000..37808d03b
--- /dev/null
+++ b/meta-oe/recipes-core/toybox/toybox/0002-Fix-trimmed-printf-in-grep.patch
@@ -0,0 +1,34 @@
1From 9c51a0d7690fb3b08871dae2486af4032d8442fb Mon Sep 17 00:00:00 2001
2From: Paul Barker <paul@paulbarker.me.uk>
3Date: Sat, 4 Jun 2016 15:42:48 +0100
4Subject: [PATCH 2/2] Fix trimmed printf in grep
5
6Using a default trim value of INT_MAX/2 when printing a line causes nothing to
7be printed on a system built using OpenEmbedded for the qemux86 target. This may
8also affect other systems.
9
10Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
11Upstream-status: Submitted
12---
13 toys/posix/grep.c | 5 ++++-
14 1 file changed, 4 insertions(+), 1 deletion(-)
15
16diff --git a/toys/posix/grep.c b/toys/posix/grep.c
17index 2ca02d2..f38c538 100644
18--- a/toys/posix/grep.c
19+++ b/toys/posix/grep.c
20@@ -74,7 +74,10 @@ static void outline(char *line, char dash, char *name, long lcount, long bcount,
21 if (!line || (lcount && (toys.optflags&FLAG_n)))
22 printf("%ld%c", lcount, line ? dash : TT.outdelim);
23 if (bcount && (toys.optflags&FLAG_b)) printf("%ld%c", bcount-1, dash);
24- if (line) xprintf("%.*s%c", trim ? trim : INT_MAX/2, line, TT.outdelim);
25+ if (line) {
26+ if (trim) xprintf("%.*s%c", trim, line, TT.outdelim);
27+ else xprintf("%s%c", line, TT.outdelim);
28+ }
29 }
30
31 // Show matches in one file
32--
332.1.4
34
diff --git a/meta-oe/recipes-core/toybox/toybox_0.7.0.bb b/meta-oe/recipes-core/toybox/toybox_0.7.1.bb
index d7b469a89..defca7016 100644
--- a/meta-oe/recipes-core/toybox/toybox_0.7.0.bb
+++ b/meta-oe/recipes-core/toybox/toybox_0.7.1.bb
@@ -4,30 +4,35 @@ DEPENDS = "attr"
4 4
5SRC_URI = " \ 5SRC_URI = " \
6 http://www.landley.net/toybox/downloads/${BPN}-${PV}.tar.gz \ 6 http://www.landley.net/toybox/downloads/${BPN}-${PV}.tar.gz \
7 file://0001-Fix-segfault-in-login.patch \ 7 file://0001-Fix-TOYBOX_VERSION.patch \
8 file://0002-Add-b-and-F-arguments-to-hostname.patch \ 8 file://0002-Fix-trimmed-printf-in-grep.patch \
9" 9"
10 10
11SRC_URI[md5sum] = "d86c78624b47625c2f0fc64eda599443" 11SRC_URI[md5sum] = "e959e5ff8c6806781eb06e56f302a393"
12SRC_URI[sha256sum] = "65428816f88ad3fe92b67df86dc05427c8078fe03843b8b9715fdfa6d29c0f97" 12SRC_URI[sha256sum] = "5bb3069f58faf12940d5cfde3209ac7f63210bebdd9023979b0c20cede126ea7"
13 13
14LICENSE = "BSD-0-Clause" 14LICENSE = "BSD-0-Clause"
15LIC_FILES_CHKSUM = "file://LICENSE;md5=f0b8b3dd6431bcaa245da0a08bd0d511" 15LIC_FILES_CHKSUM = "file://LICENSE;md5=f0b8b3dd6431bcaa245da0a08bd0d511"
16 16
17SECTION = "base" 17SECTION = "base"
18 18
19TOYBOX_BIN = "generated/unstripped/toybox"
20
19do_configure() { 21do_configure() {
20 oe_runmake defconfig 22 oe_runmake defconfig
21 23
22 # Disable killall5 as it isn't managed by update-alternatives 24 # Disable killall5 as it isn't managed by update-alternatives
23 sed -e 's/CONFIG_KILLALL5=y/# CONFIG_KILLALL5 is not set/' -i .config 25 sed -e 's/CONFIG_KILLALL5=y/# CONFIG_KILLALL5 is not set/' -i .config
26
27 # Disable swapon as it doesn't handle the '-a' argument used during boot
28 sed -e 's/CONFIG_SWAPON=y/# CONFIG_SWAPON is not set/' -i .config
24} 29}
25 30
26do_compile() { 31do_compile() {
27 oe_runmake toybox_unstripped 32 oe_runmake ${TOYBOX_BIN}
28 33
29 # Create a list of links needed 34 # Create a list of links needed
30 oe_runmake generated/instlist 35 ${BUILD_CC} -I . scripts/install.c -o generated/instlist
31 ./generated/instlist long | sed -e 's#^#/#' > toybox.links 36 ./generated/instlist long | sed -e 's#^#/#' > toybox.links
32} 37}
33 38
@@ -35,9 +40,9 @@ do_install() {
35 # Install manually instead of using 'make install' 40 # Install manually instead of using 'make install'
36 install -d ${D}${base_bindir} 41 install -d ${D}${base_bindir}
37 if grep -q "CONFIG_TOYBOX_SUID=y" ${B}/.config; then 42 if grep -q "CONFIG_TOYBOX_SUID=y" ${B}/.config; then
38 install -m 4755 ${B}/toybox_unstripped ${D}${base_bindir}/toybox 43 install -m 4755 ${B}/${TOYBOX_BIN} ${D}${base_bindir}/toybox
39 else 44 else
40 install -m 0755 ${B}/toybox_unstripped ${D}${base_bindir}/toybox 45 install -m 0755 ${B}/${TOYBOX_BIN} ${D}${base_bindir}/toybox
41 fi 46 fi
42 47
43 install -d ${D}${sysconfdir} 48 install -d ${D}${sysconfdir}