mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
Update configure.sh, configure.bat, configure.c: With compressed format, part of the installation requires that we run 'make olddefconfig' to restore the uncompressed defconfig format. Also, while I was at it, I also added options to select host platform on configure command line.
This commit is contained in:
+38
-27
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
rem tools/configure.bat
|
rem tools/configure.bat
|
||||||
rem
|
rem
|
||||||
rem Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
rem Copyright (C) 2012, 2017 Gregory Nutt. All rights reserved.
|
||||||
rem Author: Gregory Nutt <gnutt@nuttx.org>
|
rem Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
rem
|
rem
|
||||||
rem Redistribution and use in source and binary forms, with or without
|
rem Redistribution and use in source and binary forms, with or without
|
||||||
@@ -36,33 +36,38 @@ rem
|
|||||||
rem Parse command line arguments
|
rem Parse command line arguments
|
||||||
|
|
||||||
set debug=
|
set debug=
|
||||||
set fmt=-w
|
set fmt=-b
|
||||||
set posix=
|
set posix=
|
||||||
set help=
|
set help=
|
||||||
set appdir=
|
set appdir=
|
||||||
set config=
|
set config=
|
||||||
|
set hostopt=
|
||||||
|
|
||||||
:ArgLoop
|
:ArgLoop
|
||||||
if "%1"=="" goto :NoConfig
|
if "%1"=="" goto :NoConfig
|
||||||
if "%1"=="-h" goto :ShowUsage
|
if "%1"=="-h" goto :ShowUsage
|
||||||
if "%1"=="-d" goto :SetDebug
|
if "%1"=="-d" goto :SetDebug
|
||||||
if "%1"=="-w" goto :SetWindows
|
if "%1"=="-f" goto :SetFormat
|
||||||
if "%1"=="-l" goto :SetPosix
|
if "%1"=="-b" goto :SetFormat
|
||||||
|
if "%1"=="-l" goto :SetHostOption
|
||||||
|
if "%1"=="-c" goto :SetHostOption
|
||||||
|
if "%1"=="-u" goto :SetHostOption
|
||||||
|
if "%1"=="-n" goto :SetHostOption
|
||||||
if "%1"=="-a" goto :SetAppDir
|
if "%1"=="-a" goto :SetAppDir
|
||||||
|
|
||||||
set config=%1
|
set config=%1
|
||||||
goto EndOfLoop
|
goto EndOfLoop
|
||||||
|
|
||||||
:SetDebug
|
:SetDebug
|
||||||
set debug=-d
|
set debug=%1
|
||||||
goto :NextArg
|
goto :NextArg
|
||||||
|
|
||||||
:SetWindows
|
:SetFormat
|
||||||
set fmt=-w
|
set fmt=%1
|
||||||
goto :NextArg
|
goto :NextArg
|
||||||
|
|
||||||
:SetWindows
|
:SetHostOption
|
||||||
set fmt=-l
|
set hostopt=%1
|
||||||
goto :NextArg
|
goto :NextArg
|
||||||
|
|
||||||
:SetAppDir
|
:SetAppDir
|
||||||
@@ -89,7 +94,7 @@ if errorlevel 1 (
|
|||||||
)
|
)
|
||||||
|
|
||||||
:HaveConfigureExe
|
:HaveConfigureExe
|
||||||
configure.exe %debug% %fmt% %appdir% %config%
|
configure.exe %debug% %fmt% %hostopt% %appdir% %config%
|
||||||
if errorlevel 1 echo configure.exe failed
|
if errorlevel 1 echo configure.exe failed
|
||||||
goto End
|
goto End
|
||||||
|
|
||||||
@@ -97,8 +102,29 @@ goto End
|
|||||||
echo Missing ^<board-name^>/^<config-name^> argument
|
echo Missing ^<board-name^>/^<config-name^> argument
|
||||||
|
|
||||||
:ShowUsage
|
:ShowUsage
|
||||||
echo USAGE: %0 [-d] [-w] [-l] [-h] [-a ^<app-dir^>] ^<board-name^>\^<config-name^>
|
echo USAGE: %0 [-d] [-b|f] [-a ^<app-dir^>] ^<board-name^>\^<config-name^>
|
||||||
|
echo %0 [-h]
|
||||||
echo\nWhere:
|
echo\nWhere:
|
||||||
|
echo -d:
|
||||||
|
echo Enables debug output
|
||||||
|
echo -b:
|
||||||
|
echo Informs the tool that it should use Windows style paths like C:\\Program Files
|
||||||
|
echo instead of POSIX style paths are used like /usr/local/bin. Windows
|
||||||
|
echo style paths are used by default.
|
||||||
|
echo -f:
|
||||||
|
echo Informs the tool that it should use POSIX style paths like /usr/local/bin.
|
||||||
|
echo By default, Windows style paths like C:\\Program Files are used.
|
||||||
|
echo -l selects the Linux (l) host environment. The [-c^|u^|n] options
|
||||||
|
echo select one of the Windows environments. Default: Use host setup
|
||||||
|
echo in the defconfig file
|
||||||
|
echo [-c^|u^|n] selects the Windows host and a Windows environment: Cygwin (c),
|
||||||
|
echo Ubuntu under Windows 10 (u), or Windows native (n). Default Cygwin
|
||||||
|
echo -a ^<app-dir^>:
|
||||||
|
echo Informs the configuration tool where the application build
|
||||||
|
echo directory. This is a relative path from the top-level NuttX
|
||||||
|
echo build directory. But default, this tool will look in the usual
|
||||||
|
echo places to try to locate the application directory: ../apps or
|
||||||
|
echo ../apps-xx.yy where xx.yy is the NuttX version number.
|
||||||
echo ^<board-name^>:
|
echo ^<board-name^>:
|
||||||
echo Identifies the board. This must correspond to a board directory
|
echo Identifies the board. This must correspond to a board directory
|
||||||
echo under nuttx/configs/.
|
echo under nuttx/configs/.
|
||||||
@@ -106,22 +132,7 @@ echo ^<config-name^>:
|
|||||||
echo Identifies the specific configuratin for the selected ^<board-name^>.
|
echo Identifies the specific configuratin for the selected ^<board-name^>.
|
||||||
echo This must correspond to a sub-directory under the board directory at
|
echo This must correspond to a sub-directory under the board directory at
|
||||||
echo under nuttx/configs/^<board-name^>/.
|
echo under nuttx/configs/^<board-name^>/.
|
||||||
echo ^<-d^>:
|
echo -h:
|
||||||
echo Enables debug output
|
|
||||||
echo ^<-w^>:
|
|
||||||
echo Informs the tool that it should use Windows style paths like C:\\Program Files
|
|
||||||
echo instead of POSIX style paths are used like /usr/local/bin. Windows
|
|
||||||
echo style paths are used by default.
|
|
||||||
echo ^<-l^>:
|
|
||||||
echo Informs the tool that it should use POSIX style paths like /usr/local/bin.
|
|
||||||
echo By default, Windows style paths like C:\\Program Files are used.
|
|
||||||
echo -a ^<app-dir^>:
|
|
||||||
echo Informs the configuration tool where the application build
|
|
||||||
echo directory. This is a relative path from the top-level NuttX
|
|
||||||
echo build directory. But default, this tool will look in the usual
|
|
||||||
echo places to try to locate the application directory: ../apps or
|
|
||||||
echo ../apps-xx.yy where xx.yy is the NuttX version number.
|
|
||||||
echo ^<-h^>:
|
|
||||||
echo Prints this message and exits.
|
echo Prints this message and exits.
|
||||||
|
|
||||||
:End
|
:End
|
||||||
|
|||||||
+205
-19
@@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -62,6 +63,14 @@
|
|||||||
# define strndup(x, y) strdup(x)
|
# define strndup(x, y) strdup(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define HOST_NOCHANGE 0
|
||||||
|
#define HOST_LINUX 1
|
||||||
|
#define HOST_WINDOWS 2
|
||||||
|
|
||||||
|
#define WINDOWS_NATIVE 1
|
||||||
|
#define WINDOWS_CYGWIN 2
|
||||||
|
#define WINDOWS_UBUNTU 3
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -91,6 +100,9 @@ static char *g_srcmakedefs = NULL; /* Source Make.defs file */
|
|||||||
static bool g_winnative = false; /* True: Windows native configuration */
|
static bool g_winnative = false; /* True: Windows native configuration */
|
||||||
static bool g_needapppath = true; /* Need to add app path to the .config file */
|
static bool g_needapppath = true; /* Need to add app path to the .config file */
|
||||||
|
|
||||||
|
static uint8_t g_host = HOST_NOCHANGE;
|
||||||
|
static uint8_t g_windows = WINDOWS_CYGWIN;
|
||||||
|
|
||||||
static char g_buffer[BUFFER_SIZE]; /* Scratch buffer for forming full paths */
|
static char g_buffer[BUFFER_SIZE]; /* Scratch buffer for forming full paths */
|
||||||
|
|
||||||
static struct variable_s *g_configvars = NULL;
|
static struct variable_s *g_configvars = NULL;
|
||||||
@@ -113,18 +125,12 @@ static const char *g_optfiles[] =
|
|||||||
|
|
||||||
static void show_usage(const char *progname, int exitcode)
|
static void show_usage(const char *progname, int exitcode)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "\nUSAGE: %s [-d] [-w] [-l] [-h] [-a <app-dir>] <board-name>[%c<config-name>]\n", progname, g_delim);
|
fprintf(stderr, "\nUSAGE: %s [-d] [-b] [-f] [-l|c|u|n] [-a <app-dir>] <board-name>[%c<config-name>]\n", progname, g_delim);
|
||||||
|
fprintf(stderr, "\nUSAGE: %s [-h]\n\n", progname);
|
||||||
fprintf(stderr, "\nWhere:\n");
|
fprintf(stderr, "\nWhere:\n");
|
||||||
fprintf(stderr, " <board-name>:\n");
|
fprintf(stderr, " -d:\n");
|
||||||
fprintf(stderr, " Identifies the board. This must correspond to a board directory\n");
|
|
||||||
fprintf(stderr, " under nuttx%cconfigs%c.\n", g_delim, g_delim);
|
|
||||||
fprintf(stderr, " <config-name>:\n");
|
|
||||||
fprintf(stderr, " Identifies the specific configuration for the selected <board-name>.\n");
|
|
||||||
fprintf(stderr, " This must correspond to a sub-directory under the board directory at\n");
|
|
||||||
fprintf(stderr, " under nuttx%cconfigs%c<board-name>%c.\n", g_delim, g_delim, g_delim);
|
|
||||||
fprintf(stderr, " <-d>:\n");
|
|
||||||
fprintf(stderr, " Enables debug output\n");
|
fprintf(stderr, " Enables debug output\n");
|
||||||
fprintf(stderr, " <-w>:\n");
|
fprintf(stderr, " -b:\n");
|
||||||
#ifdef CONFIG_WINDOWS_NATIVE
|
#ifdef CONFIG_WINDOWS_NATIVE
|
||||||
fprintf(stderr, " Informs the tool that it should use Windows style paths like C:\\Program Files\n");
|
fprintf(stderr, " Informs the tool that it should use Windows style paths like C:\\Program Files\n");
|
||||||
fprintf(stderr, " instead of POSIX style paths are used like /usr/local/bin. Windows\n");
|
fprintf(stderr, " instead of POSIX style paths are used like /usr/local/bin. Windows\n");
|
||||||
@@ -133,7 +139,7 @@ static void show_usage(const char *progname, int exitcode)
|
|||||||
fprintf(stderr, " Informs the tool that it should use Windows style paths like C:\\Program Files.\n");
|
fprintf(stderr, " Informs the tool that it should use Windows style paths like C:\\Program Files.\n");
|
||||||
fprintf(stderr, " By default, POSIX style paths like /usr/local/bin are used.\n");
|
fprintf(stderr, " By default, POSIX style paths like /usr/local/bin are used.\n");
|
||||||
#endif
|
#endif
|
||||||
fprintf(stderr, " <-l>:\n");
|
fprintf(stderr, " -f:\n");
|
||||||
#ifdef CONFIG_WINDOWS_NATIVE
|
#ifdef CONFIG_WINDOWS_NATIVE
|
||||||
fprintf(stderr, " Informs the tool that it should use POSIX style paths like /usr/local/bin.\n");
|
fprintf(stderr, " Informs the tool that it should use POSIX style paths like /usr/local/bin.\n");
|
||||||
fprintf(stderr, " By default, Windows style paths like C:\\Program Files are used.\n");
|
fprintf(stderr, " By default, Windows style paths like C:\\Program Files are used.\n");
|
||||||
@@ -142,13 +148,27 @@ static void show_usage(const char *progname, int exitcode)
|
|||||||
fprintf(stderr, " instead of Windows style paths like C:\\Program Files are used. POSIX\n");
|
fprintf(stderr, " instead of Windows style paths like C:\\Program Files are used. POSIX\n");
|
||||||
fprintf(stderr, " style paths are used by default.\n");
|
fprintf(stderr, " style paths are used by default.\n");
|
||||||
#endif
|
#endif
|
||||||
|
fprintf(stderr, " -l:\n");
|
||||||
|
fprintf(stderr, " Selects the Linux (l) host environment. The [-c|u|n] options\n");
|
||||||
|
fprintf(stderr, " select one of the Windows environments. Default: Use host setup\n");
|
||||||
|
fprintf(stderr, " in the defconfig file\n");
|
||||||
|
fprintf(stderr, " [-c|u|n]\n");
|
||||||
|
fprintf(stderr, " Selects the Windows host and a Windows host environment: Cygwin (c),\n");
|
||||||
|
fprintf(stderr, " Ubuntu under Windows 10 (u), or Windows native (n). Default Cygwin\n");
|
||||||
fprintf(stderr, " -a <app-dir>:\n");
|
fprintf(stderr, " -a <app-dir>:\n");
|
||||||
fprintf(stderr, " Informs the configuration tool where the application build\n");
|
fprintf(stderr, " Informs the configuration tool where the application build\n");
|
||||||
fprintf(stderr, " directory. This is a relative path from the top-level NuttX\n");
|
fprintf(stderr, " directory. This is a relative path from the top-level NuttX\n");
|
||||||
fprintf(stderr, " build directory. But default, this tool will look in the usual\n");
|
fprintf(stderr, " build directory. But default, this tool will look in the usual\n");
|
||||||
fprintf(stderr, " places to try to locate the application directory: ..%capps or\n", g_delim);
|
fprintf(stderr, " places to try to locate the application directory: ..%capps or\n", g_delim);
|
||||||
fprintf(stderr, " ..%capps-xx.yy where xx.yy is the NuttX version number.\n", g_delim);
|
fprintf(stderr, " ..%capps-xx.yy where xx.yy is the NuttX version number.\n", g_delim);
|
||||||
fprintf(stderr, " <-h>:\n");
|
fprintf(stderr, " <board-name>:\n");
|
||||||
|
fprintf(stderr, " Identifies the board. This must correspond to a board directory\n");
|
||||||
|
fprintf(stderr, " under nuttx%cconfigs%c.\n", g_delim, g_delim);
|
||||||
|
fprintf(stderr, " <config-name>:\n");
|
||||||
|
fprintf(stderr, " Identifies the specific configuration for the selected <board-name>.\n");
|
||||||
|
fprintf(stderr, " This must correspond to a sub-directory under the board directory at\n");
|
||||||
|
fprintf(stderr, " under nuttx%cconfigs%c<board-name>%c.\n", g_delim, g_delim, g_delim);
|
||||||
|
fprintf(stderr, " -h:\n");
|
||||||
fprintf(stderr, " Prints this message and exits.\n");
|
fprintf(stderr, " Prints this message and exits.\n");
|
||||||
exit(exitcode);
|
exit(exitcode);
|
||||||
}
|
}
|
||||||
@@ -174,7 +194,7 @@ static void parse_args(int argc, char **argv)
|
|||||||
|
|
||||||
g_debug = false;
|
g_debug = false;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, ":a:dwlh")) > 0)
|
while ((ch = getopt(argc, argv, ":a:bcdfhlnu")) > 0)
|
||||||
{
|
{
|
||||||
switch (ch)
|
switch (ch)
|
||||||
{
|
{
|
||||||
@@ -182,16 +202,21 @@ static void parse_args(int argc, char **argv)
|
|||||||
g_appdir = optarg;
|
g_appdir = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd' :
|
case 'b' :
|
||||||
g_debug = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'w' :
|
|
||||||
g_delim = '\\';
|
g_delim = '\\';
|
||||||
g_winpaths = false;
|
g_winpaths = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'l' :
|
case 'c' :
|
||||||
|
g_host = HOST_WINDOWS;
|
||||||
|
g_windows = WINDOWS_CYGWIN;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'd' :
|
||||||
|
g_debug = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'f' :
|
||||||
g_delim = '/';
|
g_delim = '/';
|
||||||
g_winpaths = true;
|
g_winpaths = true;
|
||||||
break;
|
break;
|
||||||
@@ -199,6 +224,20 @@ static void parse_args(int argc, char **argv)
|
|||||||
case 'h' :
|
case 'h' :
|
||||||
show_usage(argv[0], EXIT_SUCCESS);
|
show_usage(argv[0], EXIT_SUCCESS);
|
||||||
|
|
||||||
|
case 'l' :
|
||||||
|
g_host = HOST_LINUX;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'n' :
|
||||||
|
g_host = HOST_WINDOWS;
|
||||||
|
g_windows = WINDOWS_NATIVE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'u' :
|
||||||
|
g_host = HOST_WINDOWS;
|
||||||
|
g_windows = WINDOWS_UBUNTU;
|
||||||
|
break;
|
||||||
|
|
||||||
case '?' :
|
case '?' :
|
||||||
fprintf(stderr, "ERROR: Unrecognized option: %c\n", optopt);
|
fprintf(stderr, "ERROR: Unrecognized option: %c\n", optopt);
|
||||||
show_usage(argv[0], EXIT_FAILURE);
|
show_usage(argv[0], EXIT_FAILURE);
|
||||||
@@ -801,6 +840,123 @@ static void copy_optional(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void enable_feature(const char *destconfig, const char *varname)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
snprintf(g_buffer, BUFFER_SIZE,
|
||||||
|
"kconfig-tweak --file %s --disable %s",
|
||||||
|
destconfig, varname);
|
||||||
|
|
||||||
|
ret = system(g_buffer);
|
||||||
|
|
||||||
|
#ifdef WEXITSTATUS
|
||||||
|
if (ret < 0 || WEXITSTATUS(ret) != 0)
|
||||||
|
#else
|
||||||
|
if (ret < 0)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR: Failed to enable %s\n", varname);
|
||||||
|
fprintf(stderr, " command: %s\n", g_buffer);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void disable_feature(const char *destconfig, const char *varname)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
snprintf(g_buffer, BUFFER_SIZE,
|
||||||
|
"kconfig-tweak --file %s --disable %s",
|
||||||
|
destconfig, varname);
|
||||||
|
|
||||||
|
ret = system(g_buffer);
|
||||||
|
|
||||||
|
#ifdef WEXITSTATUS
|
||||||
|
if (ret < 0 || WEXITSTATUS(ret) != 0)
|
||||||
|
#else
|
||||||
|
if (ret < 0)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR: Failed to disable %s\n", varname);
|
||||||
|
fprintf(stderr, " command: %s\n", g_buffer);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Select the host build development environment */
|
||||||
|
|
||||||
|
static void set_host(const char *destconfig)
|
||||||
|
{
|
||||||
|
if (g_host != HOST_NOCHANGE)
|
||||||
|
{
|
||||||
|
if (g_host == HOST_LINUX)
|
||||||
|
{
|
||||||
|
printf(" Select the Linux host\n");
|
||||||
|
|
||||||
|
enable_feature(destconfig, "CONFIG_HOST_LINUX");
|
||||||
|
disable_feature(destconfig, "CONFIG_HOST_WINDOWS");
|
||||||
|
|
||||||
|
disable_feature(destconfig, "CONFIG_WINDOWS_NATIVE");
|
||||||
|
disable_feature(destconfig, "CONFIG_WINDOWS_CYGWIN");
|
||||||
|
disable_feature(destconfig, "CONFIG_WINDOWS_UBUNTU");
|
||||||
|
disable_feature(destconfig, "CONFIG_WINDOWS_MSYS");
|
||||||
|
disable_feature(destconfig, "CONFIG_WINDOWS_OTHER");
|
||||||
|
|
||||||
|
enable_feature(destconfig, "CONFIG_SIM_X8664_SYSTEMV");
|
||||||
|
disable_feature(destconfig, "CONFIG_SIM_X8664_MICROSOFT");
|
||||||
|
disable_feature(destconfig, "CONFIG_SIM_M32");
|
||||||
|
}
|
||||||
|
else if (g_host == HOST_WINDOWS)
|
||||||
|
{
|
||||||
|
enable_feature(destconfig, "CONFIG_HOST_WINDOWS");
|
||||||
|
disable_feature(destconfig, "CONFIG_HOST_LINUX");
|
||||||
|
|
||||||
|
disable_feature(destconfig, "CONFIG_WINDOWS_MSYS");
|
||||||
|
disable_feature(destconfig, "CONFIG_WINDOWS_OTHER");
|
||||||
|
|
||||||
|
enable_feature(destconfig, "CONFIG_SIM_X8664_MICROSOFT");
|
||||||
|
disable_feature(destconfig, "CONFIG_SIM_X8664_SYSTEMV");
|
||||||
|
|
||||||
|
disable_feature(destconfig, "CONFIG_SIM_M32");
|
||||||
|
|
||||||
|
switch (g_windows)
|
||||||
|
{
|
||||||
|
case WINDOWS_CYGWIN:
|
||||||
|
printf(" Select Windows/Cygwin host\n");
|
||||||
|
enable_feature(destconfig, "CONFIG_WINDOWS_CYGWIN");
|
||||||
|
disable_feature(destconfig, "CONFIG_WINDOWS_UBUNTU");
|
||||||
|
disable_feature(destconfig, "CONFIG_WINDOWS_NATIVE");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINDOWS_UBUNTU:
|
||||||
|
printf(" Select Ubuntu for Windows 10 host\n");
|
||||||
|
disable_feature(destconfig, "CONFIG_WINDOWS_CYGWIN");
|
||||||
|
enable_feature(destconfig, "CONFIG_WINDOWS_UBUNTU");
|
||||||
|
disable_feature(destconfig, "CONFIG_WINDOWS_NATIVE");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINDOWS_NATIVE:
|
||||||
|
printf(" Select Windows native host\n");
|
||||||
|
disable_feature(destconfig, "CONFIG_WINDOWS_CYGWIN");
|
||||||
|
disable_feature(destconfig, "CONFIG_WINDOWS_UBUNTU");
|
||||||
|
enable_feature(destconfig, "CONFIG_WINDOWS_NATIVE");
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "ERROR: Unrecognized windows configuration: %d\n",
|
||||||
|
g_windows);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR: Unrecognized host configuration: %d\n", g_host);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void configure(void)
|
static void configure(void)
|
||||||
{
|
{
|
||||||
char *destconfig;
|
char *destconfig;
|
||||||
@@ -822,6 +978,10 @@ static void configure(void)
|
|||||||
|
|
||||||
copy_optional();
|
copy_optional();
|
||||||
|
|
||||||
|
/* Select the host build development environment */
|
||||||
|
|
||||||
|
set_host(destconfig);
|
||||||
|
|
||||||
/* If we did not use the CONFIG_APPS_DIR that was in the defconfig config file,
|
/* If we did not use the CONFIG_APPS_DIR that was in the defconfig config file,
|
||||||
* then append the correct application information to the tail of the .config
|
* then append the correct application information to the tail of the .config
|
||||||
* file
|
* file
|
||||||
@@ -873,6 +1033,29 @@ static void configure(void)
|
|||||||
free(destconfig);
|
free(destconfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void refresh(void)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = chdir(g_topdir);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR: Failed to ch to %s\n", g_topdir);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = system("make olddefconfig");
|
||||||
|
#ifdef WEXITSTATUS
|
||||||
|
if (ret < 0 || WEXITSTATUS(ret) != 0)
|
||||||
|
#else
|
||||||
|
if (ret < 0)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR: Failed to refresh configuations\n");
|
||||||
|
fprintf(stderr, " kconfig-conf --olddefconfig Kconfig\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -900,5 +1083,8 @@ int main(int argc, char **argv, char **envp)
|
|||||||
|
|
||||||
debug("main: Configuring\n");
|
debug("main: Configuring\n");
|
||||||
configure();
|
configure();
|
||||||
|
|
||||||
|
debug("main: Refresh configuration\n");
|
||||||
|
refresh();
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
+87
-8
@@ -36,12 +36,18 @@ WD=`test -d ${0%/*} && cd ${0%/*}; pwd`
|
|||||||
TOPDIR="${WD}/.."
|
TOPDIR="${WD}/.."
|
||||||
USAGE="
|
USAGE="
|
||||||
|
|
||||||
USAGE: ${0} [-d] [-a <app-dir>] <board-name>/<config-name>
|
USAGE: ${0} [-d] [-l|c|u|n] [-a <app-dir>] <board-name>/<config-name>
|
||||||
|
|
||||||
Where:
|
Where:
|
||||||
|
-l selects the Linux (l) host environment. The [-c|u|n] options
|
||||||
|
select one of the Windows environments. Default: Use host setup
|
||||||
|
in the defconfig file
|
||||||
|
[-c|u|n] selects the Windows host and a Windows environment: Cygwin (c),
|
||||||
|
Ubuntu under Windows 10 (u), or Windows native (n). Default Cygwin
|
||||||
<board-name> is the name of the board in the configs directory
|
<board-name> is the name of the board in the configs directory
|
||||||
<config-name> is the name of the board configuration sub-directory
|
<config-name> is the name of the board configuration sub-directory
|
||||||
<app-dir> is the path to the apps/ directory, relative to the nuttx directory
|
<app-dir> is the path to the apps/ directory, relative to the nuttx
|
||||||
|
directory
|
||||||
|
|
||||||
"
|
"
|
||||||
|
|
||||||
@@ -57,9 +63,19 @@ OPTFILES="\
|
|||||||
|
|
||||||
unset boardconfig
|
unset boardconfig
|
||||||
unset appdir
|
unset appdir
|
||||||
|
unset host
|
||||||
|
unset wenv
|
||||||
|
|
||||||
while [ ! -z "$1" ]; do
|
while [ ! -z "$1" ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
-a )
|
||||||
|
shift
|
||||||
|
appdir=$1
|
||||||
|
;;
|
||||||
|
-c )
|
||||||
|
host=windows
|
||||||
|
wenv=cygwin
|
||||||
|
;;
|
||||||
-d )
|
-d )
|
||||||
set -x
|
set -x
|
||||||
;;
|
;;
|
||||||
@@ -67,9 +83,16 @@ while [ ! -z "$1" ]; do
|
|||||||
echo "$USAGE"
|
echo "$USAGE"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
-a )
|
-l )
|
||||||
shift
|
host=linux
|
||||||
appdir=$1
|
;;
|
||||||
|
-n )
|
||||||
|
host=windows
|
||||||
|
wenv=native
|
||||||
|
;;
|
||||||
|
-u )
|
||||||
|
host=windows
|
||||||
|
wenv=ubuntu
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ ! -z "${boardconfig}" ]; then
|
if [ ! -z "${boardconfig}" ]; then
|
||||||
@@ -129,6 +152,12 @@ if [ ! -r "${src_config}" ]; then
|
|||||||
exit 6
|
exit 6
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -r ${dest_config} ]; then
|
||||||
|
echo "Already configured!"
|
||||||
|
echo "Do 'make distclean' and try again."
|
||||||
|
exit 7
|
||||||
|
fi
|
||||||
|
|
||||||
# Extract values needed from the defconfig file. We need:
|
# Extract values needed from the defconfig file. We need:
|
||||||
# (1) The CONFIG_WINDOWS_NATIVE setting to know it this is target for a
|
# (1) The CONFIG_WINDOWS_NATIVE setting to know it this is target for a
|
||||||
# native Windows
|
# native Windows
|
||||||
@@ -185,6 +214,7 @@ fi
|
|||||||
|
|
||||||
# Okay... Everything looks good. Setup the configuration
|
# Okay... Everything looks good. Setup the configuration
|
||||||
|
|
||||||
|
echo " Copy files"
|
||||||
install -m 644 "${src_makedefs}" "${dest_makedefs}" || \
|
install -m 644 "${src_makedefs}" "${dest_makedefs}" || \
|
||||||
{ echo "Failed to copy \"${src_makedefs}\"" ; exit 7 ; }
|
{ echo "Failed to copy \"${src_makedefs}\"" ; exit 7 ; }
|
||||||
install -m 644 "${src_config}" "${dest_config}" || \
|
install -m 644 "${src_config}" "${dest_config}" || \
|
||||||
@@ -206,12 +236,61 @@ if [ "X${defappdir}" = "Xy" ]; then
|
|||||||
sed -e "/^CONFIG_APPS_DIR/d" "${dest_config}" > "${dest_config}-temp"
|
sed -e "/^CONFIG_APPS_DIR/d" "${dest_config}" > "${dest_config}-temp"
|
||||||
mv "${dest_config}-temp" "${dest_config}"
|
mv "${dest_config}-temp" "${dest_config}"
|
||||||
|
|
||||||
echo "" >> "${dest_config}"
|
|
||||||
echo "# Application configuration" >> "${dest_config}"
|
|
||||||
echo "" >> "${dest_config}"
|
|
||||||
if [ "X${winnative}" = "Xy" ]; then
|
if [ "X${winnative}" = "Xy" ]; then
|
||||||
echo "CONFIG_APPS_DIR=\"$winappdir\"" >> "${dest_config}"
|
echo "CONFIG_APPS_DIR=\"$winappdir\"" >> "${dest_config}"
|
||||||
else
|
else
|
||||||
echo "CONFIG_APPS_DIR=\"$posappdir\"" >> "${dest_config}"
|
echo "CONFIG_APPS_DIR=\"$posappdir\"" >> "${dest_config}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$host" ]; then
|
||||||
|
sed -i -e "/CONFIG_HOST_OSX/d" ${dest_config}
|
||||||
|
sed -i -e "/CONFIG_HOST_OTHER/d" ${dest_config}
|
||||||
|
|
||||||
|
if [ "$host" == "linux" ]; then
|
||||||
|
echo " Select CONFIG_HOST_LINUX=y"
|
||||||
|
|
||||||
|
sed -i -e "/CONFIG_HOST_WINDOWS/d" ${dest_config}
|
||||||
|
sed -i -e "/CONFIG_SIM_X8664_MICROSOFT/d" ${dest_config}
|
||||||
|
sed -i -e "/CONFIG_SIM_M32/d" ${dest_config}
|
||||||
|
echo "CONFIG_HOST_LINUX=y" >> "${dest_config}"
|
||||||
|
echo "CONFIG_SIM_X8664_SYSTEMV=y" >> "${dest_config}"
|
||||||
|
|
||||||
|
else
|
||||||
|
echo " Select CONFIG_HOST_WINDOWS=y"
|
||||||
|
|
||||||
|
sed -i -e "/CONFIG_HOST_LINUX/d" ${dest_config}
|
||||||
|
sed -i -e "/CONFIG_WINDOWS_MSYS/d" ${dest_config}
|
||||||
|
sed -i -e "/CONFIG_WINDOWS_OTHER/d" ${dest_config}
|
||||||
|
sed -i -e "/CONFIG_SIM_X8664_SYSTEMV/d" ${dest_config}
|
||||||
|
echo "CONFIG_HOST_WINDOWS=y" >> "${dest_config}"
|
||||||
|
echo "CONFIG_SIM_X8664_MICROSOFT=y" >> "${dest_config}"
|
||||||
|
|
||||||
|
if [ "X$wenv" == "Xcygwin" ]; then
|
||||||
|
echo " Select CONFIG_WINDOWS_CYGWIN=y"
|
||||||
|
|
||||||
|
sed -i -e "/CONFIG_WINDOWS_UBUNTU/d" ${dest_config}
|
||||||
|
sed -i -e "/CONFIG_WINDOWS_NATIVE/d" ${dest_config}
|
||||||
|
echo "CONFIG_WINDOWS_CYGWIN=y" >> "${dest_config}"
|
||||||
|
else
|
||||||
|
sed -i -e "/CONFIG_WINDOWS_CYGWIN/d" ${dest_config}
|
||||||
|
if [ "X$wenv" == "Xubuntu" ]; then
|
||||||
|
echo " Select CONFIG_WINDOWS_UBUNTU=y"
|
||||||
|
|
||||||
|
sed -i -e "/CONFIG_WINDOWS_UBUNTU/d" ${dest_config}
|
||||||
|
echo "CONFIG_WINDOWS_UBUNTU=y" >> "${dest_config}"
|
||||||
|
else
|
||||||
|
echo " Select CONFIG_WINDOWS_NATIVE=y"
|
||||||
|
|
||||||
|
sed -i -e "/CONFIG_WINDOWS_NATIVE/d" ${dest_config}
|
||||||
|
echo "CONFIG_WINDOWS_NATIVE=y" >> "${dest_config}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# The saved defconfig files are all in compressed format and must be
|
||||||
|
# reconstitued before they can be used.
|
||||||
|
|
||||||
|
echo " Refreshing..."
|
||||||
|
make olddefconfig 1>/dev/null 2>&1
|
||||||
|
|||||||
Reference in New Issue
Block a user