aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/utils/iproute2
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-12-17 15:59:29 +0000
committerFelix Fietkau <nbd@openwrt.org>2013-12-17 15:59:29 +0000
commit088eea282d0b6b33d089440e097422b7d4256145 (patch)
tree4fa77eaaa072b76bd81224209169e41c4f7a062e /package/network/utils/iproute2
parent80b2fbc687919621cc9eaeee8fb4afcef4e5459b (diff)
downloadupstream-088eea282d0b6b33d089440e097422b7d4256145.tar.gz
upstream-088eea282d0b6b33d089440e097422b7d4256145.tar.bz2
upstream-088eea282d0b6b33d089440e097422b7d4256145.zip
iproute2: reduce .ipk package size from ~100k down to ~60k
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 39119
Diffstat (limited to 'package/network/utils/iproute2')
-rw-r--r--package/network/utils/iproute2/Makefile7
-rw-r--r--package/network/utils/iproute2/patches/300-ip_tiny.patch115
2 files changed, 121 insertions, 1 deletions
diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile
index dbacd275c6..a44572db8e 100644
--- a/package/network/utils/iproute2/Makefile
+++ b/package/network/utils/iproute2/Makefile
@@ -69,10 +69,15 @@ ifdef CONFIG_USE_EGLIBC
endif
endif
+TARGET_CFLAGS += -ffunction-sections -fdata-sections
+
MAKE_FLAGS += \
EXTRA_CCOPTS="$(TARGET_CFLAGS) -I../include -I$(STAGING_DIR)/usr/include/libnl-tiny" \
KERNEL_INCLUDE="$(LINUX_DIR)/include" \
- FPIC="$(FPIC)"
+ SHARED_LIBS="" \
+ LDFLAGS="-Wl,--gc-sections" \
+ IP_CONFIG_TINY=y \
+ FPIC=""
define Build/Compile
+$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
diff --git a/package/network/utils/iproute2/patches/300-ip_tiny.patch b/package/network/utils/iproute2/patches/300-ip_tiny.patch
new file mode 100644
index 0000000000..43afb9c848
--- /dev/null
+++ b/package/network/utils/iproute2/patches/300-ip_tiny.patch
@@ -0,0 +1,115 @@
+--- a/ip/Makefile
++++ b/ip/Makefile
+@@ -15,6 +15,13 @@ ifeq ($(IP_CONFIG_SETNS),y)
+ CFLAGS += -DHAVE_SETNS
+ endif
+
++STATIC_SYM_FILTER:=
++ifeq ($(IP_CONFIG_TINY),y)
++ STATIC_SYM_FILTER:=iplink_can.c iplink_ipoib.c iplink_vxlan.c
++ CFLAGS += -DIPROUTE2_TINY
++endif
++STATIC_SYM_SOURCES:=$(filter-out $(STATIC_SYM_FILTER),$(wildcard *.c))
++
+ ALLOBJ=$(IPOBJ) $(RTMONOBJ)
+ SCRIPTS=ifcfg rtpr routel routef
+ TARGETS=ip rtmon
+@@ -43,7 +50,7 @@ else
+
+ ip: static-syms.o
+ static-syms.o: static-syms.h
+-static-syms.h: $(wildcard *.c)
++static-syms.h: $(STATIC_SYM_SOURCES)
+ files="$^" ; \
+ for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \
+ sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \
+--- a/ip/ip.c
++++ b/ip/ip.c
+@@ -66,29 +66,41 @@ static const struct cmd {
+ int (*func)(int argc, char **argv);
+ } cmds[] = {
+ { "address", do_ipaddr },
++#ifndef IPROUTE2_TINY
+ { "addrlabel", do_ipaddrlabel },
++#endif
+ { "maddress", do_multiaddr },
+ { "route", do_iproute },
+ { "rule", do_iprule },
+ { "neighbor", do_ipneigh },
+ { "neighbour", do_ipneigh },
++#ifndef IPROUTE2_TINY
+ { "ntable", do_ipntable },
+ { "ntbl", do_ipntable },
++#endif
+ { "link", do_iplink },
++#ifndef IPROUTE2_TINY
+ { "l2tp", do_ipl2tp },
++#endif
+ { "tunnel", do_iptunnel },
+ { "tunl", do_iptunnel },
++#ifndef IPROUTE2_TINY
+ { "tuntap", do_iptuntap },
+ { "tap", do_iptuntap },
+ { "token", do_iptoken },
+ { "tcpmetrics", do_tcp_metrics },
+ { "tcp_metrics",do_tcp_metrics },
++#endif
+ { "monitor", do_ipmonitor },
++#ifndef IPROUTE2_TINY
+ { "xfrm", do_xfrm },
++#endif
+ { "mroute", do_multiroute },
+ { "mrule", do_multirule },
+ { "netns", do_netns },
++#ifndef IPROUTE2_TINY
+ { "netconf", do_ipnetconf },
++#endif
+ { "help", do_help },
+ { 0 }
+ };
+--- a/lib/utils.c
++++ b/lib/utils.c
+@@ -627,6 +627,7 @@ const char *rt_addr_n2a(int af, int len,
+ case AF_INET:
+ case AF_INET6:
+ return inet_ntop(af, addr, buf, buflen);
++#ifndef IPROUTE2_TINY
+ case AF_IPX:
+ return ipx_ntop(af, addr, buf, buflen);
+ case AF_DECnet:
+@@ -635,6 +636,7 @@ const char *rt_addr_n2a(int af, int len,
+ memcpy(dna.a_addr, addr, 2);
+ return dnet_ntop(af, &dna, buf, buflen);
+ }
++#endif
+ default:
+ return "???";
+ }
+@@ -710,6 +712,7 @@ const char *format_host(int af, int len,
+ case AF_INET6:
+ len = 16;
+ break;
++#ifndef IPROUTE2_TINY
+ case AF_IPX:
+ len = 10;
+ break;
+@@ -720,6 +723,7 @@ const char *format_host(int af, int len,
+ len = 2;
+ break;
+ #endif
++#endif
+ default: ;
+ }
+ }
+--- a/lib/Makefile
++++ b/lib/Makefile
+@@ -1,5 +1,9 @@
+ include ../Config
+
++ifeq ($(IP_CONFIG_TINY),y)
++ CFLAGS += -DIPROUTE2_TINY
++endif
++
+ CFLAGS += $(FPIC)
+
+ UTILOBJ=utils.o rt_names.o ll_types.o ll_proto.o ll_addr.o inet_proto.o