All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/3] hostapd: fix static linking
@ 2014-03-04 13:35 Gustavo Zacarias
  2014-03-04 13:35 ` [Buildroot] [PATCH 2/3] wpa_supplicant: " Gustavo Zacarias
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gustavo Zacarias @ 2014-03-04 13:35 UTC (permalink / raw)
  To: buildroot

A rebase of Samuel Martin's http://patchwork.ozlabs.org/patch/312320/
hostapd doesn't use pkg-config and upstream likely wouldn't take a patch
to do so (hostapd/wpa_supplicant are used in android builds, and it
doesn't use any auto* stuff either) so pass it in LIBS since we
always build openssl with libz support.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
 package/hostapd/hostapd.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/hostapd/hostapd.mk b/package/hostapd/hostapd.mk
index 37de60d..5b7dd77 100644
--- a/package/hostapd/hostapd.mk
+++ b/package/hostapd/hostapd.mk
@@ -43,6 +43,7 @@ endif
 # Try to use openssl if it's already available
 ifeq ($(BR2_PACKAGE_OPENSSL),y)
 	HOSTAPD_DEPENDENCIES += openssl
+	HOSTAPD_LIBS += $(if $(BR2_PREFER_STATIC_LIB),-lcrypto -lz)
 	HOSTAPD_CONFIG_EDITS += 's/\#\(CONFIG_TLS=openssl\)/\1/'
 else
 	HOSTAPD_CONFIG_DISABLE += CONFIG_EAP_PWD
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH 2/3] wpa_supplicant: fix static linking
  2014-03-04 13:35 [Buildroot] [PATCH 1/3] hostapd: fix static linking Gustavo Zacarias
@ 2014-03-04 13:35 ` Gustavo Zacarias
  2014-03-04 13:35 ` [Buildroot] [PATCH 3/3] wpa_supplicant: add fix for WPS NFC support Gustavo Zacarias
  2014-03-04 18:35 ` [Buildroot] [PATCH 1/3] hostapd: fix static linking Thomas Petazzoni
  2 siblings, 0 replies; 4+ messages in thread
From: Gustavo Zacarias @ 2014-03-04 13:35 UTC (permalink / raw)
  To: buildroot

wpa_supplicant doesn't use pkg-config and upstream likely wouldn't take
a patch to do so (hostapd/wpa_supplicant are used in android builds, and
it doesn't use any auto* stuff either) so pass it in LIBS* since we
always build openssl with libz support.

Made ugly by the fact that wpa_supplicant uses LIBS for the
wpa_supplicant binary, LIBS_c for the wpa_cli binary and LIBS_p for the
wpa_passphrase binary.

Also do f62a1d887aee642593b3f9507d6f3ebcd82219d0 here too since it
applies when libnl is used.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
 package/wpa_supplicant/wpa_supplicant.mk | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/package/wpa_supplicant/wpa_supplicant.mk b/package/wpa_supplicant/wpa_supplicant.mk
index 17788cc..3802033 100644
--- a/package/wpa_supplicant/wpa_supplicant.mk
+++ b/package/wpa_supplicant/wpa_supplicant.mk
@@ -29,7 +29,13 @@ WPA_SUPPLICANT_CONFIG_ENABLE = \
 WPA_SUPPLICANT_CONFIG_DISABLE = \
 	CONFIG_SMARTCARD
 
+# libnl-3 needs -lm (for rint) and -lpthread if linking statically
+# And library order matters hence stick -lnl-3 first since it's appended
+# in the wpa_supplicant Makefiles as in LIBS+=-lnl-3 ... thus failing
 ifeq ($(BR2_PACKAGE_LIBNL),y)
+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+	WPA_SUPPLICANT_LIBS += -lnl-3 -lm -lpthread
+endif
 	WPA_SUPPLICANT_DEPENDENCIES += libnl
 	WPA_SUPPLICANT_CONFIG_ENABLE += CONFIG_LIBNL32
 else
@@ -57,6 +63,7 @@ endif
 # Try to use openssl if it's already available
 ifeq ($(BR2_PACKAGE_OPENSSL),y)
 	WPA_SUPPLICANT_DEPENDENCIES += openssl
+	WPA_SUPPLICANT_LIBS += $(if $(BR2_PREFER_STATIC_LIB),-lcrypto -lz)
 	WPA_SUPPLICANT_CONFIG_EDITS += 's/\#\(CONFIG_TLS=openssl\)/\1/'
 else
 	WPA_SUPPLICANT_CONFIG_DISABLE += CONFIG_EAP_PWD
@@ -108,9 +115,12 @@ define WPA_SUPPLICANT_CONFIGURE_CMDS
 	       $(WPA_SUPPLICANT_CONFIG)
 endef
 
+# LIBS for wpa_supplicant, LIBS_c for wpa_cli, LIBS_p for wpa_passphrase
 define WPA_SUPPLICANT_BUILD_CMDS
 	$(TARGET_MAKE_ENV) CFLAGS="$(WPA_SUPPLICANT_CFLAGS)" \
 		LDFLAGS="$(TARGET_LDFLAGS)" BINDIR=/usr/sbin \
+		LIBS="$(WPA_SUPPLICANT_LIBS)" LIBS_c="$(WPA_SUPPLICANT_LIBS)" \
+		LIBS_p="$(WPA_SUPPLICANT_LIBS)" \
 		$(MAKE) CC="$(TARGET_CC)" -C $(@D)/$(WPA_SUPPLICANT_SUBDIR)
 endef
 
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH 3/3] wpa_supplicant: add fix for WPS NFC support
  2014-03-04 13:35 [Buildroot] [PATCH 1/3] hostapd: fix static linking Gustavo Zacarias
  2014-03-04 13:35 ` [Buildroot] [PATCH 2/3] wpa_supplicant: " Gustavo Zacarias
@ 2014-03-04 13:35 ` Gustavo Zacarias
  2014-03-04 18:35 ` [Buildroot] [PATCH 1/3] hostapd: fix static linking Thomas Petazzoni
  2 siblings, 0 replies; 4+ messages in thread
From: Gustavo Zacarias @ 2014-03-04 13:35 UTC (permalink / raw)
  To: buildroot

WPS NFC support wouldn't build properly unless AP mode was enabled.
Add upstream fix to correct this and enable NFC support.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
 ...NFIG_WPS_NFC-y-build-without-CONFIG_P2P-y.patch | 121 +++++++++++++++++++++
 package/wpa_supplicant/wpa_supplicant.mk           |   1 -
 2 files changed, 121 insertions(+), 1 deletion(-)
 create mode 100644 package/wpa_supplicant/wpa_supplicant-0001-Fix-CONFIG_WPS_NFC-y-build-without-CONFIG_P2P-y.patch

diff --git a/package/wpa_supplicant/wpa_supplicant-0001-Fix-CONFIG_WPS_NFC-y-build-without-CONFIG_P2P-y.patch b/package/wpa_supplicant/wpa_supplicant-0001-Fix-CONFIG_WPS_NFC-y-build-without-CONFIG_P2P-y.patch
new file mode 100644
index 0000000..946011c
--- /dev/null
+++ b/package/wpa_supplicant/wpa_supplicant-0001-Fix-CONFIG_WPS_NFC-y-build-without-CONFIG_P2P-y.patch
@@ -0,0 +1,121 @@
+From 88853aedf6cc4a152442b5bb2c4946683df6ff66 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Thu, 13 Feb 2014 15:29:09 +0200
+Subject: [PATCH] Fix CONFIG_WPS_NFC=y build without CONFIG_P2P=y
+
+Some of the control interface operations for P2P were not properly
+protected with #ifdef CONFIG_P2P.
+
+Signed-off-by: Jouni Malinen <j@w1.fi>
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+---
+ wpa_supplicant/ctrl_iface.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
+index ddddad3..ed332da 100644
+--- a/wpa_supplicant/ctrl_iface.c
++++ b/wpa_supplicant/ctrl_iface.c
+@@ -951,6 +951,7 @@ static int wpas_ctrl_nfc_get_handover_req_wps(struct wpa_supplicant *wpa_s,
+ }
+ 
+ 
++#ifdef CONFIG_P2P
+ static int wpas_ctrl_nfc_get_handover_req_p2p(struct wpa_supplicant *wpa_s,
+ 					      char *reply, size_t max_len,
+ 					      int ndef)
+@@ -973,6 +974,7 @@ static int wpas_ctrl_nfc_get_handover_req_p2p(struct wpa_supplicant *wpa_s,
+ 
+ 	return res;
+ }
++#endif /* CONFIG_P2P */
+ 
+ 
+ static int wpas_ctrl_nfc_get_handover_req(struct wpa_supplicant *wpa_s,
+@@ -1001,10 +1003,12 @@ static int wpas_ctrl_nfc_get_handover_req(struct wpa_supplicant *wpa_s,
+ 			wpa_s, reply, max_len, ndef);
+ 	}
+ 
++#ifdef CONFIG_P2P
+ 	if (os_strcmp(pos, "P2P-CR") == 0) {
+ 		return wpas_ctrl_nfc_get_handover_req_p2p(
+ 			wpa_s, reply, max_len, ndef);
+ 	}
++#endif /* CONFIG_P2P */
+ 
+ 	return -1;
+ }
+@@ -1032,6 +1036,7 @@ static int wpas_ctrl_nfc_get_handover_sel_wps(struct wpa_supplicant *wpa_s,
+ }
+ 
+ 
++#ifdef CONFIG_P2P
+ static int wpas_ctrl_nfc_get_handover_sel_p2p(struct wpa_supplicant *wpa_s,
+ 					      char *reply, size_t max_len,
+ 					      int ndef, int tag)
+@@ -1052,6 +1057,7 @@ static int wpas_ctrl_nfc_get_handover_sel_p2p(struct wpa_supplicant *wpa_s,
+ 
+ 	return res;
+ }
++#endif /* CONFIG_P2P */
+ 
+ 
+ static int wpas_ctrl_nfc_get_handover_sel(struct wpa_supplicant *wpa_s,
+@@ -1084,6 +1090,7 @@ static int wpas_ctrl_nfc_get_handover_sel(struct wpa_supplicant *wpa_s,
+ 			os_strcmp(pos, "WPS-CR") == 0, pos2);
+ 	}
+ 
++#ifdef CONFIG_P2P
+ 	if (os_strcmp(pos, "P2P-CR") == 0) {
+ 		return wpas_ctrl_nfc_get_handover_sel_p2p(
+ 			wpa_s, reply, max_len, ndef, 0);
+@@ -1093,6 +1100,7 @@ static int wpas_ctrl_nfc_get_handover_sel(struct wpa_supplicant *wpa_s,
+ 		return wpas_ctrl_nfc_get_handover_sel_p2p(
+ 			wpa_s, reply, max_len, ndef, 1);
+ 	}
++#endif /* CONFIG_P2P */
+ 
+ 	return -1;
+ }
+@@ -1160,6 +1168,7 @@ static int wpas_ctrl_nfc_report_handover(struct wpa_supplicant *wpa_s,
+ 	struct wpabuf *req, *sel;
+ 	int ret;
+ 	char *pos, *role, *type, *pos2;
++#ifdef CONFIG_P2P
+ 	char *freq;
+ 	int forced_freq = 0;
+ 
+@@ -1169,6 +1178,7 @@ static int wpas_ctrl_nfc_report_handover(struct wpa_supplicant *wpa_s,
+ 		freq += 6;
+ 		forced_freq = atoi(freq);
+ 	}
++#endif /* CONFIG_P2P */
+ 
+ 	role = cmd;
+ 	pos = os_strchr(role, ' ');
+@@ -1237,11 +1247,14 @@ static int wpas_ctrl_nfc_report_handover(struct wpa_supplicant *wpa_s,
+ 
+ 	if (os_strcmp(role, "INIT") == 0 && os_strcmp(type, "WPS") == 0) {
+ 		ret = wpas_wps_nfc_report_handover(wpa_s, req, sel);
++#ifdef CONFIG_AP
+ 	} else if (os_strcmp(role, "RESP") == 0 && os_strcmp(type, "WPS") == 0)
+ 	{
+ 		ret = wpas_ap_wps_nfc_report_handover(wpa_s, req, sel);
+ 		if (ret < 0)
+ 			ret = wpas_er_wps_nfc_report_handover(wpa_s, req, sel);
++#endif /* CONFIG_AP */
++#ifdef CONFIG_P2P
+ 	} else if (os_strcmp(role, "INIT") == 0 && os_strcmp(type, "P2P") == 0)
+ 	{
+ 		ret = wpas_p2p_nfc_report_handover(wpa_s, 1, req, sel, 0);
+@@ -1249,6 +1262,7 @@ static int wpas_ctrl_nfc_report_handover(struct wpa_supplicant *wpa_s,
+ 	{
+ 		ret = wpas_p2p_nfc_report_handover(wpa_s, 0, req, sel,
+ 						   forced_freq);
++#endif /* CONFIG_P2P */
+ 	} else {
+ 		wpa_printf(MSG_DEBUG, "NFC: Unsupported connection handover "
+ 			   "reported: role=%s type=%s", role, type);
+-- 
+1.8.3.2
+
diff --git a/package/wpa_supplicant/wpa_supplicant.mk b/package/wpa_supplicant/wpa_supplicant.mk
index 3802033..9fcda2e 100644
--- a/package/wpa_supplicant/wpa_supplicant.mk
+++ b/package/wpa_supplicant/wpa_supplicant.mk
@@ -57,7 +57,6 @@ endif
 
 ifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_WPS),y)
 	WPA_SUPPLICANT_CONFIG_ENABLE += CONFIG_WPS
-	WPA_SUPPLICANT_CONFIG_DISABLE += CONFIG_WPS_NFC
 endif
 
 # Try to use openssl if it's already available
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH 1/3] hostapd: fix static linking
  2014-03-04 13:35 [Buildroot] [PATCH 1/3] hostapd: fix static linking Gustavo Zacarias
  2014-03-04 13:35 ` [Buildroot] [PATCH 2/3] wpa_supplicant: " Gustavo Zacarias
  2014-03-04 13:35 ` [Buildroot] [PATCH 3/3] wpa_supplicant: add fix for WPS NFC support Gustavo Zacarias
@ 2014-03-04 18:35 ` Thomas Petazzoni
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2014-03-04 18:35 UTC (permalink / raw)
  To: buildroot

Dear Gustavo Zacarias,

On Tue,  4 Mar 2014 10:35:11 -0300, Gustavo Zacarias wrote:
> A rebase of Samuel Martin's http://patchwork.ozlabs.org/patch/312320/
> hostapd doesn't use pkg-config and upstream likely wouldn't take a patch
> to do so (hostapd/wpa_supplicant are used in android builds, and it
> doesn't use any auto* stuff either) so pass it in LIBS since we
> always build openssl with libz support.
> 
> Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
> ---
>  package/hostapd/hostapd.mk | 1 +
>  1 file changed, 1 insertion(+)

All three patches applied, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-04 18:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-04 13:35 [Buildroot] [PATCH 1/3] hostapd: fix static linking Gustavo Zacarias
2014-03-04 13:35 ` [Buildroot] [PATCH 2/3] wpa_supplicant: " Gustavo Zacarias
2014-03-04 13:35 ` [Buildroot] [PATCH 3/3] wpa_supplicant: add fix for WPS NFC support Gustavo Zacarias
2014-03-04 18:35 ` [Buildroot] [PATCH 1/3] hostapd: fix static linking Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.