Port wpa supplicant to RTEMS.

Add wpa_supplicant lib support and shell command support in RTEMS.
This commit is contained in:
Sichen Zhao
2017-10-12 20:16:07 +08:00
committed by Sebastian Huber
parent 9c9d11b481
commit 8f2267bbb9
12 changed files with 562 additions and 5 deletions

View File

@@ -25,6 +25,11 @@
#include <mach/mach_time.h>
#endif /* __MACH__ */
#ifdef __rtems__
#include <unistd.h>
#endif /* __rtems__ */
#include "os.h"
#include "common.h"
@@ -225,7 +230,7 @@ static int os_daemon(int nochdir, int noclose)
int os_daemonize(const char *pid_file)
{
#if defined(__uClinux__) || defined(__sun__)
#if defined(__uClinux__) || defined(__sun__) || defined(__rtems__)
return -1;
#else /* defined(__uClinux__) || defined(__sun__) */
#ifdef __FreeBSD__
@@ -282,6 +287,9 @@ int os_get_random(unsigned char *buf, size_t len)
if (TEST_FAIL())
return -1;
#ifdef __rtems__
return getentropy(buf, len);
#else /* __rtems__ */
f = fopen("/dev/urandom", "rb");
if (f == NULL) {
printf("Could not open /dev/urandom.\n");
@@ -292,6 +300,7 @@ int os_get_random(unsigned char *buf, size_t len)
fclose(f);
return rc != len ? -1 : 0;
#endif /* __rtems__ */
}

View File

@@ -45,6 +45,9 @@
#include "common/ieee802_11_defs.h"
#include "common/ieee802_11_common.h"
#ifdef __rtems__
#include <machine/rtems-bsd-commands.h>
#endif /* __rtems__ */
struct wpa_cred {
/**

View File

@@ -19,6 +19,11 @@
#include "driver_i.h"
#include "p2p_supplicant.h"
#ifdef __rtems__
#include <assert.h>
#include <sys/mutex.h>
#include <machine/rtems-bsd-program.h>
#endif /* __rtems__ */
static void usage(void)
{
@@ -154,6 +159,22 @@ static void wpa_supplicant_fd_workaround(int start)
#endif /* __linux__ */
}
#ifdef __rtems__
#include <rtems/libio.h>
static int
main(int argc, char **argv);
int rtems_bsd_command_wpa_supplicant(int argc, char **argv)
{
int exit_code;
rtems_status_code sc;
exit_code = rtems_bsd_program_call_main("wpa_supplicant", main, argc, argv);
return exit_code;
}
#endif /* __rtems__ */
int main(int argc, char *argv[])
{