arch/sim: set CMDLINE env to the argument user pass to nuttx

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-08-19 20:49:15 +08:00 committed by Petro Karashchenko
parent 697e2a333b
commit b60704614e

View File

@ -31,12 +31,30 @@
#include <nuttx/spi/spi_flash.h> #include <nuttx/spi/spi_flash.h>
#include <nuttx/spi/qspi_flash.h> #include <nuttx/spi/qspi_flash.h>
#include <stdlib.h>
#include "up_internal.h" #include "up_internal.h"
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_DISABLE_ENVIRON
static void up_init_cmdline(void)
{
char cmdline[ARG_MAX] = "";
int i;
for (i = 1; i < g_argc; i++)
{
strlcat(cmdline, g_argv[i], sizeof(cmdline));
strlcat(cmdline, " ", sizeof(cmdline));
}
setenv("CMDLINE", cmdline, true);
}
#endif
/**************************************************************************** /****************************************************************************
* Name: up_init_smartfs * Name: up_init_smartfs
* *
@ -226,6 +244,10 @@ void up_initialize(void)
pm_initialize(); pm_initialize();
#endif #endif
#ifndef CONFIG_DISABLE_ENVIRON
up_init_cmdline();
#endif
/* Register some tty-port to access tty-port on sim platform */ /* Register some tty-port to access tty-port on sim platform */
up_uartinit(); up_uartinit();