iw: reduce size and make the phy dump output more readable
authorFelix Fietkau <nbd@openwrt.org>
Fri, 13 Dec 2013 11:02:05 +0000 (11:02 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 13 Dec 2013 11:02:05 +0000 (11:02 +0000)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 39041

package/network/utils/iw/Makefile
package/network/utils/iw/patches/200-reduce_size.patch [new file with mode: 0644]

index 1ee8861648a328e5e03d872a4e32f108d4330423..75a8c4fc1f34ca2cde6334d3711113f4371c951d 100644 (file)
@@ -41,8 +41,8 @@ TARGET_CPPFLAGS:= \
        -D_GNU_SOURCE
 
 MAKE_FLAGS += \
-       CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
-       LDFLAGS="$(TARGET_LDFLAGS)" \
+       CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -ffunction-sections -fdata-sections" \
+       LDFLAGS="$(TARGET_LDFLAGS) -Wl,--gc-sections" \
        NL1FOUND="" NL2FOUND=Y \
        NLLIBNAME="libnl-tiny" \
        LIBS="-lm -lnl-tiny" \
diff --git a/package/network/utils/iw/patches/200-reduce_size.patch b/package/network/utils/iw/patches/200-reduce_size.patch
new file mode 100644 (file)
index 0000000..46f58bc
--- /dev/null
@@ -0,0 +1,109 @@
+--- a/Makefile
++++ b/Makefile
+@@ -15,8 +15,8 @@ CFLAGS += -Wall -Wundef -Wstrict-prototy
+ OBJS = iw.o genl.o event.o info.o phy.o \
+       interface.o ibss.o station.o survey.o util.o \
+       mesh.o mpath.o scan.o reg.o version.o \
+-      reason.o status.o connect.o link.o offch.o ps.o cqm.o \
+-      bitrate.o wowlan.o roc.o p2p.o
++      reason.o status.o connect.o link.o ps.o \
++      bitrate.o
+ OBJS += sections.o
+ OBJS-$(HWSIM) += hwsim.o
+--- a/info.c
++++ b/info.c
+@@ -198,6 +198,7 @@ next:
+                               }
+                       }
++#if 0
+                       if (tb_band[NL80211_BAND_ATTR_RATES]) {
+                       printf("\t\tBitrates (non-HT):\n");
+                       nla_for_each_nested(nl_rate, tb_band[NL80211_BAND_ATTR_RATES], rem_rate) {
+@@ -214,6 +215,7 @@ next:
+                               printf("\n");
+                       }
+                       }
++#endif
+               }
+       }
+@@ -248,6 +250,7 @@ next:
+               printf("\tCoverage class: %d (up to %dm)\n", coverage, 450 * coverage);
+       }
++#if 0
+       if (tb_msg[NL80211_ATTR_CIPHER_SUITES]) {
+               int num = nla_len(tb_msg[NL80211_ATTR_CIPHER_SUITES]) / sizeof(__u32);
+               int i;
+@@ -259,6 +262,7 @@ next:
+                                       cipher_name(ciphers[i]));
+               }
+       }
++#endif
+       if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX] &&
+           tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX])
+@@ -278,11 +282,13 @@ next:
+                       printf("\t\t * %s\n", iftype_name(nla_type(nl_mode)));
+       }
++#if 0
+       if (tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES]) {
+               printf("\tsoftware interface modes (can always be added):\n");
+               nla_for_each_nested(nl_mode, tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES], rem_mode)
+                       printf("\t\t * %s\n", iftype_name(nla_type(nl_mode)));
+       }
++#endif
+       if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS]) {
+               struct nlattr *nl_combi;
+@@ -379,6 +385,7 @@ broken_combination:
+                       printf("\tinterface combinations are not supported\n");
+       }
++#if 0
+       if (tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS]) {
+               printf("\tSupported commands:\n");
+               nla_for_each_nested(nl_cmd, tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS], rem_cmd)
+@@ -471,6 +478,7 @@ broken_combination:
+                               printf("\t\t * wake up on TCP connection\n");
+               }
+       }
++#endif
+       if (tb_msg[NL80211_ATTR_ROAM_SUPPORT])
+               printf("\tDevice supports roaming.\n");
+@@ -507,6 +515,7 @@ broken_combination:
+               }
+       }
++#if 0
+       if (tb_msg[NL80211_ATTR_FEATURE_FLAGS]) {
+               unsigned int features = nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]);
+@@ -527,6 +536,7 @@ broken_combination:
+               if (features & NL80211_FEATURE_AP_SCAN)
+                       printf("\tDevice supports AP scan.\n");
+       }
++#endif
+       return NL_SKIP;
+ }
+@@ -558,6 +568,7 @@ TOPLEVEL(list, NULL, NL80211_CMD_GET_WIP
+        "List all wireless devices and their capabilities.");
+ TOPLEVEL(phy, NULL, NL80211_CMD_GET_WIPHY, NLM_F_DUMP, CIB_NONE, handle_info, NULL);
++#if 0
+ static int handle_commands(struct nl80211_state *state,
+                          struct nl_cb *cb, struct nl_msg *msg,
+                          int argc, char **argv, enum id_input id)
+@@ -570,6 +581,7 @@ static int handle_commands(struct nl8021
+ }
+ TOPLEVEL(commands, NULL, NL80211_CMD_GET_WIPHY, 0, CIB_NONE, handle_commands,
+        "list all known commands and their decimal & hex value");
++#endif
+ static int print_feature_handler(struct nl_msg *msg, void *arg)
+ {