iw: add iw-full package without size reduction hacks

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau 2018-10-03 08:57:00 +02:00
parent 502bcd93fe
commit 8c647e873f
2 changed files with 43 additions and 20 deletions

View File

@ -15,6 +15,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/software/network/iw PKG_SOURCE_URL:=@KERNEL/software/network/iw
PKG_HASH:=f01671c0074bfdec082a884057edba1b9efd35c89eda554638496f03b769ad89 PKG_HASH:=f01671c0074bfdec082a884057edba1b9efd35c89eda554638496f03b769ad89
PKG_BUILD_DIR:=$(BUILD_DIR)/iw-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name> PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=GPL-2.0 PKG_LICENSE:=GPL-2.0
@ -26,6 +27,14 @@ define Package/iw
TITLE:=cfg80211 interface configuration utility TITLE:=cfg80211 interface configuration utility
URL:=http://wireless.kernel.org/en/users/Documentation/iw URL:=http://wireless.kernel.org/en/users/Documentation/iw
DEPENDS:= +libnl-tiny DEPENDS:= +libnl-tiny
VARIANT:=tiny
endef
define Package/iw-full
$(Package/iw)
TITLE += (full version)
VARIANT:=full
PROVIDES:=iw
endef endef
define Build/Configure define Build/Configure
@ -41,6 +50,11 @@ TARGET_CPPFLAGS:= \
-D_GNU_SOURCE \ -D_GNU_SOURCE \
-flto -flto
ifeq ($(BUILD_VARIANT),full)
TARGET_CPPFLAGS += -DIW_FULL
MAKE_FLAGS += IW_FULL=1
endif
MAKE_FLAGS += \ MAKE_FLAGS += \
CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -ffunction-sections -fdata-sections" \ CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -ffunction-sections -fdata-sections" \
LDFLAGS="$(TARGET_LDFLAGS) -Wl,--gc-sections -flto" \ LDFLAGS="$(TARGET_LDFLAGS) -Wl,--gc-sections -flto" \
@ -54,4 +68,7 @@ define Package/iw/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/iw $(1)/usr/sbin/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/iw $(1)/usr/sbin/
endef endef
Package/iw-full/install=$(Package/iw/install)
$(eval $(call BuildPackage,iw)) $(eval $(call BuildPackage,iw))
$(eval $(call BuildPackage,iw-full))

View File

@ -4,7 +4,7 @@
} }
switch (gnlh->cmd) { switch (gnlh->cmd) {
+#if 0 +#ifdef IW_FULL
case NL80211_CMD_NEW_WIPHY: case NL80211_CMD_NEW_WIPHY:
printf("renamed to %s\n", nla_get_string(tb[NL80211_ATTR_WIPHY_NAME])); printf("renamed to %s\n", nla_get_string(tb[NL80211_ATTR_WIPHY_NAME]));
break; break;
@ -20,7 +20,7 @@
mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC])); mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
printf("del station %s\n", macbuf); printf("del station %s\n", macbuf);
break; break;
+#if 0 +#ifdef IW_FULL
case NL80211_CMD_JOIN_IBSS: case NL80211_CMD_JOIN_IBSS:
mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC])); mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
printf("IBSS %s joined\n", macbuf); printf("IBSS %s joined\n", macbuf);
@ -42,7 +42,7 @@
} }
} }
+#if 0 +#ifdef IW_FULL
if (tb_band[NL80211_BAND_ATTR_RATES]) { if (tb_band[NL80211_BAND_ATTR_RATES]) {
printf("\t\tBitrates (non-HT):\n"); printf("\t\tBitrates (non-HT):\n");
nla_for_each_nested(nl_rate, tb_band[NL80211_BAND_ATTR_RATES], rem_rate) { nla_for_each_nested(nl_rate, tb_band[NL80211_BAND_ATTR_RATES], rem_rate) {
@ -58,7 +58,7 @@
printf("\tCoverage class: %d (up to %dm)\n", coverage, 450 * coverage); printf("\tCoverage class: %d (up to %dm)\n", coverage, 450 * coverage);
} }
+#if 0 +#ifdef IW_FULL
if (tb_msg[NL80211_ATTR_CIPHER_SUITES]) { if (tb_msg[NL80211_ATTR_CIPHER_SUITES]) {
int num = nla_len(tb_msg[NL80211_ATTR_CIPHER_SUITES]) / sizeof(__u32); int num = nla_len(tb_msg[NL80211_ATTR_CIPHER_SUITES]) / sizeof(__u32);
int i; int i;
@ -74,7 +74,7 @@
printf("\t\t * %s\n", iftype_name(nla_type(nl_mode))); printf("\t\t * %s\n", iftype_name(nla_type(nl_mode)));
} }
+#if 0 +#ifdef IW_FULL
if (tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES]) { if (tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES]) {
printf("\tsoftware interface modes (can always be added):\n"); printf("\tsoftware interface modes (can always be added):\n");
nla_for_each_nested(nl_mode, tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES], rem_mode) nla_for_each_nested(nl_mode, tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES], rem_mode)
@ -88,7 +88,7 @@
printf("\tinterface combinations are not supported\n"); printf("\tinterface combinations are not supported\n");
} }
+#if 0 +#ifdef IW_FULL
if (tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS]) { if (tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS]) {
printf("\tSupported commands:\n"); printf("\tSupported commands:\n");
nla_for_each_nested(nl_cmd, tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS], rem_cmd) nla_for_each_nested(nl_cmd, tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS], rem_cmd)
@ -104,7 +104,7 @@
} }
} }
+#if 0 +#ifdef IW_FULL
if (tb_msg[NL80211_ATTR_FEATURE_FLAGS]) { if (tb_msg[NL80211_ATTR_FEATURE_FLAGS]) {
unsigned int features = nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]); unsigned int features = nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]);
@ -120,7 +120,7 @@
"List all wireless devices and their capabilities."); "List all wireless devices and their capabilities.");
TOPLEVEL(phy, NULL, NL80211_CMD_GET_WIPHY, NLM_F_DUMP, CIB_NONE, handle_info, NULL); TOPLEVEL(phy, NULL, NL80211_CMD_GET_WIPHY, NLM_F_DUMP, CIB_NONE, handle_info, NULL);
+#if 0 +#ifdef IW_FULL
static int handle_commands(struct nl80211_state *state, struct nl_msg *msg, static int handle_commands(struct nl80211_state *state, struct nl_msg *msg,
int argc, char **argv, enum id_input id) int argc, char **argv, enum id_input id)
{ {
@ -153,7 +153,7 @@
+ [114] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), }, + [114] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
+ [191] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), }, + [191] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), },
+ [192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), }, + [192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), },
+#if 0 +#ifdef IW_FULL
[1] = { "Supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), }, [1] = { "Supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
[3] = { "DS Parameter set", print_ds, 1, 1, BIT(PRINT_SCAN), }, [3] = { "DS Parameter set", print_ds, 1, 1, BIT(PRINT_SCAN), },
[5] = { "TIM", print_tim, 4, 255, BIT(PRINT_SCAN), }, [5] = { "TIM", print_tim, 4, 255, BIT(PRINT_SCAN), },
@ -184,7 +184,7 @@
ieprinters[ie[0]].flags & BIT(ptype)) { ieprinters[ie[0]].flags & BIT(ptype)) {
print_ie(&ieprinters[ie[0]], print_ie(&ieprinters[ie[0]],
ie[0], ie[1], ie + 2, &ie_buffer); ie[0], ie[1], ie + 2, &ie_buffer);
+#if 0 +#ifdef IW_FULL
} else if (ie[0] == 221 /* vendor */) { } else if (ie[0] == 221 /* vendor */) {
print_vendor(ie[1], ie + 2, unknown, ptype); print_vendor(ie[1], ie + 2, unknown, ptype);
} else if (unknown) { } else if (unknown) {
@ -200,7 +200,7 @@
printf(" ESS"); printf(" ESS");
if (capa & WLAN_CAPABILITY_IBSS) if (capa & WLAN_CAPABILITY_IBSS)
printf(" IBSS"); printf(" IBSS");
+#if 0 +#ifdef IW_FULL
if (capa & WLAN_CAPABILITY_CF_POLLABLE) if (capa & WLAN_CAPABILITY_CF_POLLABLE)
printf(" CfPollable"); printf(" CfPollable");
if (capa & WLAN_CAPABILITY_CF_POLL_REQUEST) if (capa & WLAN_CAPABILITY_CF_POLL_REQUEST)
@ -216,7 +216,7 @@
if (bss[NL80211_BSS_FREQUENCY]) { if (bss[NL80211_BSS_FREQUENCY]) {
int freq = nla_get_u32(bss[NL80211_BSS_FREQUENCY]); int freq = nla_get_u32(bss[NL80211_BSS_FREQUENCY]);
printf("\tfreq: %d\n", freq); printf("\tfreq: %d\n", freq);
+#if 0 +#ifdef IW_FULL
if (freq > 45000) if (freq > 45000)
is_dmg = true; is_dmg = true;
+#endif +#endif
@ -227,7 +227,7 @@
return 0; return 0;
} }
+#if 0 +#ifdef IW_FULL
COMMAND(scan, sched_start, COMMAND(scan, sched_start,
SCHED_SCAN_OPTIONS, SCHED_SCAN_OPTIONS,
NL80211_CMD_START_SCHED_SCAN, 0, CIB_NETDEV, handle_start_sched_scan, NL80211_CMD_START_SCHED_SCAN, 0, CIB_NETDEV, handle_start_sched_scan,
@ -242,7 +242,7 @@
static char cmdbuf[100]; static char cmdbuf[100];
+#if 0 +#ifdef IW_FULL
const char *command_name(enum nl80211_commands cmd) const char *command_name(enum nl80211_commands cmd)
{ {
if (cmd <= NL80211_CMD_MAX && commands[cmd]) if (cmd <= NL80211_CMD_MAX && commands[cmd])
@ -254,22 +254,28 @@
int ieee80211_channel_to_frequency(int chan, enum nl80211_band band) int ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
{ {
@@ -426,6 +428,7 @@ int parse_keys(struct nl_msg *msg, char @@ -426,6 +428,9 @@ int parse_keys(struct nl_msg *msg, char
char keybuf[13]; char keybuf[13];
int pos = 0; int pos = 0;
+#ifndef IW_FULL
+ return 1; + return 1;
+#endif
if (!argc) if (!argc)
return 1; return 1;
--- a/Makefile --- a/Makefile
+++ b/Makefile +++ b/Makefile
@@ -25,6 +25,8 @@ OBJS-$(HWSIM) += hwsim.o @@ -25,6 +25,12 @@ OBJS-$(HWSIM) += hwsim.o
OBJS += $(OBJS-y) $(OBJS-Y) OBJS += $(OBJS-y) $(OBJS-Y)
+OBJS_DISABLED = ocb offch cqm wowlan coalesce roc p2p ap +OBJS_FULL = ocb offch cqm wowlan coalesce roc p2p ap
+OBJS:=$(filter-out $(patsubst %,%.o,$(OBJS_DISABLED)),$(OBJS)) +ifdef IW_FULL
+ CFLAGS += -DIW_FULL
+else
+ OBJS:=$(filter-out $(patsubst %,%.o,$(OBJS_DISABLED)),$(OBJS))
+endif
ALL = iw ALL = iw
ifeq ($(NO_PKG_CONFIG),) ifeq ($(NO_PKG_CONFIG),)
@ -279,7 +285,7 @@
nla_put_failure: nla_put_failure:
return -ENOBUFS; return -ENOBUFS;
} }
+#if 0 +#ifdef IW_FULL
COMMAND_ALIAS(station, set, "<MAC address> plink_action <open|block>", COMMAND_ALIAS(station, set, "<MAC address> plink_action <open|block>",
NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_plink, NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_plink,
"Set mesh peer link action for this station (peer).", "Set mesh peer link action for this station (peer).",
@ -292,7 +298,7 @@
nla_put_failure: nla_put_failure:
return -ENOBUFS; return -ENOBUFS;
} }
+#if 0 +#ifdef IW_FULL
COMMAND_ALIAS(station, set, "<MAC address> mesh_power_mode " COMMAND_ALIAS(station, set, "<MAC address> mesh_power_mode "
"<active|light|deep>", NL80211_CMD_SET_STATION, 0, CIB_NETDEV, "<active|light|deep>", NL80211_CMD_SET_STATION, 0, CIB_NETDEV,
handle_station_set_mesh_power_mode, handle_station_set_mesh_power_mode,