From 86bfe1339969606d1101d1d3d1d3d7bb07705bbe Mon Sep 17 00:00:00 2001 From: "chao.an" Date: Wed, 19 Feb 2020 20:34:52 +0800 Subject: [PATCH] net/bringup: late net init after nsh script done --- nshlib/nsh_altconsole.c | 8 ++++++++ nshlib/nsh_consolemain.c | 8 ++++++++ nshlib/nsh_init.c | 7 ------- nshlib/nsh_usbconsole.c | 8 ++++++++ 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/nshlib/nsh_altconsole.c b/nshlib/nsh_altconsole.c index 0d5d6286b..dd574becb 100644 --- a/nshlib/nsh_altconsole.c +++ b/nshlib/nsh_altconsole.c @@ -50,6 +50,8 @@ #include "nsh.h" #include "nsh_console.h" +#include "netutils/netinit.h" + #if defined(CONFIG_NSH_ALTCONDEV) && !defined(HAVE_USB_CONSOLE) /**************************************************************************** @@ -284,6 +286,12 @@ int nsh_consolemain(int argc, char *argv[]) nsh_initscript(&pstate->cn_vtbl); #endif +#ifdef CONFIG_NSH_NETINIT + /* Bring up the network */ + + netinit_bringup(); +#endif + #if defined(CONFIG_NSH_ARCHINIT) && defined(CONFIG_BOARDCTL_FINALINIT) /* Perform architecture-specific final-initialization (if configured) */ diff --git a/nshlib/nsh_consolemain.c b/nshlib/nsh_consolemain.c index 9ed118f5f..60e1f6e18 100644 --- a/nshlib/nsh_consolemain.c +++ b/nshlib/nsh_consolemain.c @@ -47,6 +47,8 @@ #include "nsh.h" #include "nsh_console.h" +#include "netutils/netinit.h" + #if !defined(CONFIG_NSH_ALTCONDEV) && !defined(HAVE_USB_CONSOLE) && \ !defined(HAVE_USB_KEYBOARD) @@ -96,6 +98,12 @@ int nsh_consolemain(int argc, char *argv[]) #endif #endif +#ifdef CONFIG_NSH_NETINIT + /* Bring up the network */ + + netinit_bringup(); +#endif + #ifdef CONFIG_NSH_USBDEV_TRACE /* Initialize any USB tracing options that were requested */ diff --git a/nshlib/nsh_init.c b/nshlib/nsh_init.c index ce6d4097a..7ac91a0d9 100644 --- a/nshlib/nsh_init.c +++ b/nshlib/nsh_init.c @@ -42,7 +42,6 @@ #include #include "system/readline.h" -#include "netutils/netinit.h" #include "nshlib/nshlib.h" #include "nsh.h" @@ -103,10 +102,4 @@ void nsh_initialize(void) boardctl(BOARDIOC_INIT, 0); #endif - -#ifdef CONFIG_NSH_NETINIT - /* Bring up the network */ - - netinit_bringup(); -#endif } diff --git a/nshlib/nsh_usbconsole.c b/nshlib/nsh_usbconsole.c index c21fc2f38..11c160219 100644 --- a/nshlib/nsh_usbconsole.c +++ b/nshlib/nsh_usbconsole.c @@ -59,6 +59,8 @@ #include "nsh.h" #include "nsh_console.h" +#include "netutils/netinit.h" + #ifdef HAVE_USB_CONSOLE /**************************************************************************** @@ -317,6 +319,12 @@ int nsh_consolemain(int argc, char *argv[]) nsh_initscript(&pstate->cn_vtbl); #endif +#ifdef CONFIG_NSH_NETINIT + /* Bring up the network */ + + netinit_bringup(); +#endif + #if defined(CONFIG_NSH_ARCHINIT) && defined(CONFIG_BOARDCTL_FINALINIT) /* Perform architecture-specific final-initialization (if configured) */