aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2015-10-05 11:15:43 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2015-10-05 11:15:43 +0200
commit5fa6d1a632505789409a2ba6cf8e112529f9db18 (patch)
tree9666bad5a3b4ebd4c9dfabbe5b0f67617e075c00
parent12efcf3285a75d197704d2eef23824b3e4f11e66 (diff)
downloadbusybox-w32-5fa6d1a632505789409a2ba6cf8e112529f9db18.tar.gz
busybox-w32-5fa6d1a632505789409a2ba6cf8e112529f9db18.tar.bz2
busybox-w32-5fa6d1a632505789409a2ba6cf8e112529f9db18.zip
Aboriginal linux/musl build fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--Config.in8
-rw-r--r--Makefile.flags2
-rwxr-xr-xapplets/usage_compressed9
-rw-r--r--networking/brctl.c52
-rw-r--r--networking/ifplugd.c12
5 files changed, 81 insertions, 2 deletions
diff --git a/Config.in b/Config.in
index 07b4bf36b..11371c783 100644
--- a/Config.in
+++ b/Config.in
@@ -514,6 +514,14 @@ config PIE
514 514
515 Most people will leave this set to 'N'. 515 Most people will leave this set to 'N'.
516 516
517config LINK_WITH_PTHREAD
518 bool "Link with pthread library"
519 default n
520 help
521 On some systems, some libraries (such as crypt) also require pthread.
522
523 Select this only if your build otherwise fails.
524
517config NOMMU 525config NOMMU
518 bool "Force NOMMU build" 526 bool "Force NOMMU build"
519 default n 527 default n
diff --git a/Makefile.flags b/Makefile.flags
index b29b06839..2bc83d1d9 100644
--- a/Makefile.flags
+++ b/Makefile.flags
@@ -126,10 +126,12 @@ else
126LDLIBS += m 126LDLIBS += m
127endif 127endif
128 128
129ifeq ($(CONFIG_LINK_WITH_PTHREAD),y)
129PTHREAD_AVAILABLE := $(shell echo 'int main(void){return 0;}' >pthreadtest.c; $(CC) $(CFLAGS) -lpthread -o /dev/null pthreadtest.c >/dev/null 2>&1 && echo "y"; rm pthreadtest.c) 130PTHREAD_AVAILABLE := $(shell echo 'int main(void){return 0;}' >pthreadtest.c; $(CC) $(CFLAGS) -lpthread -o /dev/null pthreadtest.c >/dev/null 2>&1 && echo "y"; rm pthreadtest.c)
130ifeq ($(PTHREAD_AVAILABLE),y) 131ifeq ($(PTHREAD_AVAILABLE),y)
131LDLIBS += pthread 132LDLIBS += pthread
132endif 133endif
134endif
133 135
134ifeq ($(CONFIG_PAM),y) 136ifeq ($(CONFIG_PAM),y)
135# libpam uses libpthread, libdl and libaudit, so for static builds busybox 137# libpam uses libpthread, libdl and libaudit, so for static builds busybox
diff --git a/applets/usage_compressed b/applets/usage_compressed
index fb6e1c286..186fcde77 100755
--- a/applets/usage_compressed
+++ b/applets/usage_compressed
@@ -20,6 +20,7 @@ exec >"$target.$$"
20 20
21echo '#define UNPACKED_USAGE "" \' 21echo '#define UNPACKED_USAGE "" \'
22"$loc/usage" | od -v -b \ 22"$loc/usage" | od -v -b \
23| grep -v '^ ' \
23| $SED -e 's/^[^ ]*//' \ 24| $SED -e 's/^[^ ]*//' \
24 -e 's/ //g' \ 25 -e 's/ //g' \
25 -e '/^$/d' \ 26 -e '/^$/d' \
@@ -27,6 +28,13 @@ echo '#define UNPACKED_USAGE "" \'
27 -e 's/^/"/' \ 28 -e 's/^/"/' \
28 -e 's/$/" \\/' 29 -e 's/$/" \\/'
29echo '' 30echo ''
31# "grep -v '^ '" is for toybox's od bug: od -b prints some extra lines:
32#0000000 010 000 010 000 133 055 144 146 135 040 133 055 143 040 103 117
33# 000010 000010 026533 063144 020135 026533 020143 047503
34#0000020 116 106 104 111 122 135 040 133 055 154 040 114 117 107 106 111
35# 043116 044504 056522 055440 066055 046040 043517 044506
36#0000040 114 105 135 040 133 055 141 040 101 103 124 111 117 116 106 111
37# 042514 020135 026533 020141 041501 044524 047117 044506
30 38
31echo '#define PACKED_USAGE \' 39echo '#define PACKED_USAGE \'
32## Breaks on big-endian systems! 40## Breaks on big-endian systems!
@@ -40,6 +48,7 @@ echo '#define PACKED_USAGE \'
40## -e 's/\(..\)\(..\)/0x\2,0x\1,/g' 48## -e 's/\(..\)\(..\)/0x\2,0x\1,/g'
41## -e 's/$/ \\/' 49## -e 's/$/ \\/'
42"$loc/usage" | bzip2 -1 | $DD bs=2 skip=1 2>/dev/null | od -v -b \ 50"$loc/usage" | bzip2 -1 | $DD bs=2 skip=1 2>/dev/null | od -v -b \
51| grep -v '^ ' \
43| $SED -e 's/^[^ ]*//' \ 52| $SED -e 's/^[^ ]*//' \
44 -e 's/ //g' \ 53 -e 's/ //g' \
45 -e '/^$/d' \ 54 -e '/^$/d' \
diff --git a/networking/brctl.c b/networking/brctl.c
index 207b069aa..8043d600b 100644
--- a/networking/brctl.c
+++ b/networking/brctl.c
@@ -64,7 +64,57 @@
64#define BRCTL_USE_INTERNAL 1 64#define BRCTL_USE_INTERNAL 1
65 65
66#if ENABLE_FEATURE_BRCTL_FANCY 66#if ENABLE_FEATURE_BRCTL_FANCY
67# include <linux/if_bridge.h> 67/* #include <linux/if_bridge.h>
68 * breaks on musl: we already included netinet/in.h in libbb.h,
69 * if we include <linux/if_bridge.h> here, we get this:
70 * In file included from /usr/include/linux/if_bridge.h:18,
71 * from networking/brctl.c:67:
72 * /usr/include/linux/in6.h:32: error: redefinition of 'struct in6_addr'
73 * /usr/include/linux/in6.h:49: error: redefinition of 'struct sockaddr_in6'
74 * /usr/include/linux/in6.h:59: error: redefinition of 'struct ipv6_mreq'
75 */
76/* From <linux/if_bridge.h> */
77#define BRCTL_GET_VERSION 0
78#define BRCTL_GET_BRIDGES 1
79#define BRCTL_ADD_BRIDGE 2
80#define BRCTL_DEL_BRIDGE 3
81#define BRCTL_ADD_IF 4
82#define BRCTL_DEL_IF 5
83#define BRCTL_GET_BRIDGE_INFO 6
84#define BRCTL_GET_PORT_LIST 7
85#define BRCTL_SET_BRIDGE_FORWARD_DELAY 8
86#define BRCTL_SET_BRIDGE_HELLO_TIME 9
87#define BRCTL_SET_BRIDGE_MAX_AGE 10
88#define BRCTL_SET_AGEING_TIME 11
89#define BRCTL_SET_GC_INTERVAL 12
90#define BRCTL_GET_PORT_INFO 13
91#define BRCTL_SET_BRIDGE_STP_STATE 14
92#define BRCTL_SET_BRIDGE_PRIORITY 15
93#define BRCTL_SET_PORT_PRIORITY 16
94#define BRCTL_SET_PATH_COST 17
95#define BRCTL_GET_FDB_ENTRIES 18
96struct __bridge_info {
97 uint64_t designated_root;
98 uint64_t bridge_id;
99 uint32_t root_path_cost;
100 uint32_t max_age;
101 uint32_t hello_time;
102 uint32_t forward_delay;
103 uint32_t bridge_max_age;
104 uint32_t bridge_hello_time;
105 uint32_t bridge_forward_delay;
106 uint8_t topology_change;
107 uint8_t topology_change_detected;
108 uint8_t root_port;
109 uint8_t stp_enabled;
110 uint32_t ageing_time;
111 uint32_t gc_interval;
112 uint32_t hello_timer_value;
113 uint32_t tcn_timer_value;
114 uint32_t topology_change_timer_value;
115 uint32_t gc_timer_value;
116};
117/* end <linux/if_bridge.h> */
68 118
69/* FIXME: These 4 funcs are not really clean and could be improved */ 119/* FIXME: These 4 funcs are not really clean and could be improved */
70static ALWAYS_INLINE void bb_strtotimeval(struct timeval *tv, 120static ALWAYS_INLINE void bb_strtotimeval(struct timeval *tv,
diff --git a/networking/ifplugd.c b/networking/ifplugd.c
index fef7a5ac9..1e6c562e0 100644
--- a/networking/ifplugd.c
+++ b/networking/ifplugd.c
@@ -38,7 +38,17 @@
38#include <linux/mii.h> 38#include <linux/mii.h>
39#include <linux/ethtool.h> 39#include <linux/ethtool.h>
40#ifdef HAVE_NET_ETHERNET_H 40#ifdef HAVE_NET_ETHERNET_H
41# include <net/ethernet.h> 41/* musl breakage:
42 * In file included from /usr/include/net/ethernet.h:10,
43 * from networking/ifplugd.c:41:
44 * /usr/include/netinet/if_ether.h:96: error: redefinition of 'struct ethhdr'
45 *
46 * Build succeeds without it on musl. Commented it out.
47 * If on your system you need it, consider removing <linux/ethtool.h>
48 * and copy-pasting its definitions here (<linux/ethtool.h> is what pulls in
49 * conflicting definition of struct ethhdr on musl).
50 */
51/* # include <net/ethernet.h> */
42#endif 52#endif
43#include <linux/netlink.h> 53#include <linux/netlink.h>
44#include <linux/rtnetlink.h> 54#include <linux/rtnetlink.h>