Porting wpa_supplicant

Tags: Network, Programming, Wireless

If you've ever tried porting wpa_supplicant to a different operating system, you probably have come across this link on the wpa_supplicant documentation page: Porting to different target boards and operating systems. While it gives a good heads up, the end section describes the C files needed to build an initial compiling version from where to start building the operating support.

cc -o wpa_supplicant config.c eloop.c common.c md5.c rc4.c sha1.c \
	config_none.c l2_packet_none.c tls_none.c wpa.c preauth.c \
	aes_wrap.c wpa_supplicant.c events.c main_none.c drivers.c

This seems to be a bit outdated. The actual list should be:

cc -o wpa_supplicant config.c common.c md5.c sha1.c crypto_openssl.c \
        config_none.c l2_packet_none.c tls_none.c wpa.c preauth.c \
        wpa_supplicant.c events.c main_none.c drivers.c wpa_debug.c \
        os_none.c sha1-pbkdf2.c wpabuf.c eloop_none.c wpa_common.c \
        wpa_ie.c aes-unwrap.c blacklist.c scan.c notify.c bss.c sme.c \
        wpas_glue.c eap_register.c ieee802_11_common.c

This also should have a couple of defines set in your build system:

    -DOS_NO_C_LIB_DEFINES -DCONFIG_SME

There is one more issue; the file "eloop_none.c" has a couple of function prototypes which do not match the ones defined in the header. Change all occurrences of:

    void (*handler)(int sock, void *eloop_ctx, void *sock_ctx)

in the function arguments to:

    eloop_sock_handler handler

I just uncommented the actual use of that handler in the functions for now. We'll need to port it anyway...

At this point, the initial bits of wpa_supplicant compile and the actual work can start.

Happy porting!

Comments

Hi I am trying to port

Hi

I am trying to port wpa_supplicant to arm cortex m0, with minimal size. I have seen that 50kB binary for wpa/wpa2 is possible. But i really don't have any idea how to start. The above compilation does not work . How to proceed?

Porting to Cortex M series

Hi,

It seems you were porting wpa_supplicant to arm cortex few years ago. I am currently doing a similar task. May please share your experience of how you were able to do a simple build of wpa_supplicant and what were the dependencies that couldn't support on the embedded platform?

Thanks in advance.

It is possible

It is possible the code size be around 15-20kb

Re: It is possible

Hi,

I don't think you can get it that small. Around 50KB is the minimum if I remember correctly.

Johan.

Hi.Assuming you can get the

Hi.

Assuming you can get the size down (Cortex M0  cpu's tend to be resource constraint), you should definitely be able to do the port. It won't be just a simple 'make' and be done with it though. The majority of the applications running wpa_supplicant run Linux or at least some other operating system that provides all the abstraction layers and resources.

You will have to start much lower level than that, and really go through every step of the build and requirements, writing drivers where needed. I assume you already have a working interface between your WiFi module and your M0? You have looked at the dependencies of wpa_supplicant and know how to work around/provide them on your platform?

You can use my post as a starting point, but remember that that post was made in 2012, and that it might not reflect the current wpa_supplicant version (if I remember correctly, I used 0.7.2 at the time. You could start there). Sadly, I don't have the time to guide you through the entire process (and it won't fit in this comment). However, if you run into some specific issues, let me know and I'll try to help you out.

 

Johan.