From 088eea282d0b6b33d089440e097422b7d4256145 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 17 Dec 2013 15:59:29 +0000 Subject: iproute2: reduce .ipk package size from ~100k down to ~60k Signed-off-by: Felix Fietkau SVN-Revision: 39119 --- package/network/utils/iproute2/Makefile | 7 +- .../utils/iproute2/patches/300-ip_tiny.patch | 115 +++++++++++++++++++++ 2 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 package/network/utils/iproute2/patches/300-ip_tiny.patch diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile index dbacd27..a44572d 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 0000000..43afb9c --- /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 '\