Add tools/kconfig.bat

git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5450 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2012-12-22 16:47:02 +00:00
parent 247ad37c4b
commit e975043dd3
6 changed files with 265 additions and 53 deletions

View File

@ -3811,3 +3811,5 @@
tool.
* include/pthread.h: In sys/prctl.h because it is needed by
pthread_[set|get]name_np()
* tools/kconfig.bat: Kludge to run kconfig-frontends from a DOS shell.

View File

@ -7,7 +7,7 @@ mainmenu "Nuttx/$ARCH Configuration"
config APPSDIR
string
option env="APPSDIR"
default "../apps"
# This is a temporary kludge to let the build system know that we are using the new
# configuration system

View File

@ -252,7 +252,7 @@ LINKLIBS = $(patsubst lib\\%,%,$(NUTTXLIBS))
BIN = nuttx$(EXEEXT)
all: $(BIN)
.PHONY: context clean_context check_context export subdir_clean clean subdir_distclean distclean apps_clean apps_distclean
.PHONY: context clean_context check_context configenv config oldconfig menuconfig export subdir_clean clean subdir_distclean distclean apps_clean apps_distclean
# Target used to copy include\nuttx\math.h. If CONFIG_ARCH_MATH_H is
# defined, then there is an architecture specific math.h header file
@ -647,14 +647,17 @@ pass2dep: context tools\mkdeps$(HOSTEXEEXT)
# location: http://ymorin.is-a-geek.org/projects/kconfig-frontends. See
# misc\tools\README.txt for additional information.
config:
$(Q) APPSDIR=${CONFIG_APPS_DIR} conf Kconfig
configenv:
$(Q) set APPSDIR=${CONFIG_APPS_DIR}
oldconfig:
$(Q) APPSDIR=${CONFIG_APPS_DIR} conf --oldconfig Kconfig
config: configenv
$(Q) conf Kconfig
menuconfig:
$(Q) APPSDIR=${CONFIG_APPS_DIR} mconf Kconfig
oldconfig: configenv
$(Q) conf --oldconfig Kconfig
menuconfig: configenv
$(Q) mconf Kconfig
# export
#

View File

@ -10,6 +10,7 @@ README
o Configuring NuttX
- Instantiating "Canned" Configurations
- NuttX Configuration Tool
- NuttX Configuration Tool from DOS
o Toolchains
- Cross-Development Toolchains
- NuttX Buildroot Toolchain
@ -249,7 +250,6 @@ easier. It is used as follows:
cd ${TOPDIR}/tools
./configure.sh <board-name>/<config-dir>
NuttX Configuration Tool
------------------------
@ -292,6 +292,52 @@ NuttX Configuration Tool
install 'mconf', make certain that your PATH variable includes
a path to that installation directory.
NuttX Configuration Tool from DOS
---------------------------------
Recent versions of NuttX support building NuttX from a native Windows
CMD.exe shell (see "Native Windows Build" below). But kconfig-frontends
is a Linux tool. There have been some successes building a Windows
native version of the kconfig-frontends tool, but that is not ready
for prime time.
At this point, there are only a few options for the Windows user:
1. You can run the configuration tool using Cygwin. However, the
Cygwin Makefile.win will complain so to do this will, you have
to manually edit the .config file:
a. Delete the line: CONFIG_WINDOWS_NATIVE=y
b. Change the apps/ directory path, CONFIG_APPS_DIR to use Unix
style delimiters. For example, change "..\apps" to "../apps"
And of course, after you use the configuration tool you need to
restore CONFIG_WINDOWS_NATIVE=y and the correct CONFIG_APPS_DIR.
2) You can, with some effort, run the the Cygwin mconf tool directly
in the CMD.exe shell. In this case, you do not have to modify the
.config file, but there are other complexities:
a. You need to temporarily set the Cgywin directories in the PATH
variable then run mconf manually like:
mconf Kconfig
There is a Windows bacht file at tools/kconfig.bat that automates
these steps:
tools/kconfig menuconfig
b. There is an issue with accessing DOS environment variables from
the Cygwin mconf running in the CMD.exe shell. The following
change to the top-level Kconfig file seems to work around these
problems:
config APPSDIR
string
- option env="APPSDIR"
+ default "../apps"
TOOLCHAINS
^^^^^^^^^^
@ -523,68 +569,68 @@ Native Windows Build
Installing GNUWin32
-------------------
The Windows native build will depend upon a few Unix-like tools that can be
provided either by MSYS or GNUWin32. The GNUWin32 are available from
http://gnuwin32.sourceforge.net/. GNUWin32 provides ports of tools with a
GPL or similar open source license to modern MS-Windows (Microsoft Windows
2000 / XP / 2003 / Vista / 2008 / 7). See
http://gnuwin32.sourceforge.net/packages.html for a list of all of the tools
available in the GNUWin32 package.
The Windows native build will depend upon a few Unix-like tools that can be
provided either by MSYS or GNUWin32. The GNUWin32 are available from
http://gnuwin32.sourceforge.net/. GNUWin32 provides ports of tools with a
GPL or similar open source license to modern MS-Windows (Microsoft Windows
2000 / XP / 2003 / Vista / 2008 / 7). See
http://gnuwin32.sourceforge.net/packages.html for a list of all of the tools
available in the GNUWin32 package.
The SourceForge project is located here:
http://sourceforge.net/projects/gnuwin32/. The project is still being
actively supported (although some of the Windows ports have gotten very old).
The SourceForge project is located here:
http://sourceforge.net/projects/gnuwin32/. The project is still being
actively supported (although some of the Windows ports have gotten very old).
Some commercial toolchains include a subset of the GNUWin32 tools in the
installation. My recommendation is that you download the GNUWin32 tools
directly from the sourceforge.net website so that you will know what you are
using and can reproduce your build environment.
Some commercial toolchains include a subset of the GNUWin32 tools in the
installation. My recommendation is that you download the GNUWin32 tools
directly from the sourceforge.net website so that you will know what you are
using and can reproduce your build environment.
GNUWin32 Installation Steps:
GNUWin32 Installation Steps:
The following steps will download and execute the GNUWin32 installer.
The following steps will download and execute the GNUWin32 installer.
1. Download GetGNUWin32-x.x.x.exe from
http://sourceforge.net/projects/getgnuwin32/files/. This is the
installer. The current version as of this writing is 0.6.3.
1. Download GetGNUWin32-x.x.x.exe from
http://sourceforge.net/projects/getgnuwin32/files/. This is the
installer. The current version as of this writing is 0.6.3.
2. Run the installer.
2. Run the installer.
3. Accept the license.
3. Accept the license.
4. Select the installation directory. My recommendation is the
directory that contains this README file (<this-directory>).
4. Select the installation directory. My recommendation is the
directory that contains this README file (<this-directory>).
5. After running GetGNUWin32-0.x.x.exe, you will have a new directory
<this-directory>/GetGNUWin32
5. After running GetGNUWin32-0.x.x.exe, you will have a new directory
<this-directory>/GetGNUWin32
Note the the GNUWin32 installer didn't install GNUWin32. Instead, it
installed another, smarter downloader. That downloader is the GNUWin32
package management tool developed by the Open SSL project.
Note the the GNUWin32 installer didn't install GNUWin32. Instead, it
installed another, smarter downloader. That downloader is the GNUWin32
package management tool developed by the Open SSL project.
The following steps probably should be performed from inside a DOS shell.
The following steps probably should be performed from inside a DOS shell.
6. Change to the directory created by GetGNUWin32-x.x.x.exe
6. Change to the directory created by GetGNUWin32-x.x.x.exe
cd GetGNUWin32
cd GetGNUWin32
7. Execute the download.bat script. The download.bat script will download
about 446 packages! Enough to have a very complete Linux-like environment
under the DOS shell. This will take awhile. This step only downloads
the packages and the next step will install the packages.
7. Execute the download.bat script. The download.bat script will download
about 446 packages! Enough to have a very complete Linux-like environment
under the DOS shell. This will take awhile. This step only downloads
the packages and the next step will install the packages.
download
download
8. This step will install the downloaded packages. The argument of the
install.bat script is the installation location. C:\gnuwin32 is the
standard install location:
8. This step will install the downloaded packages. The argument of the
install.bat script is the installation location. C:\gnuwin32 is the
standard install location:
install C:\gnuwin32
install C:\gnuwin32
NOTE: This installation step will install *all* GNUWin32 packages... far
more than you will ever need. If disc space is a problem for you, you might
need to perform a manual installation of the individual ZIP files that you
will find in the <this directory>/GetGNUWin32/packages directory.
NOTE: This installation step will install *all* GNUWin32 packages... far
more than you will ever need. If disc space is a problem for you, you might
need to perform a manual installation of the individual ZIP files that you
will find in the <this directory>/GetGNUWin32/packages directory.
CYGWIN BUILD PROBLEMS
^^^^^^^^^^^^^^^^^^^^^

View File

@ -413,6 +413,36 @@ unlink.bat
NTFS mklink.exe command instead of copying files. That logic, however,
has not been verified as of this writing.
kconfig.bat
-----------
Recent versions of NuttX support building NuttX from a native Windows
CMD.exe shell. But kconfig-frontends is a Linux tool and is not yet
available in the pure CMD.exe environment. At this point, there are
only a few options for the Windows user (see the top-level README.txt
file).
You can, with some effort, run the the Cygwin mconf tool directly
in the CMD.exe shell. In this case, you do not have to modify the
.config file, but there are other complexities: You need to
temporarily set the Cgywin directories in the PATH variable and
then run mconf outside of the Make system.
kconfig.bat is a Windows batch file at tools/kconfig.bat that automates
these steps. It is used from the top-level NuttX directory like:
tools/kconfig menuconfig
NOTE: There is an currently an issue with accessing DOS environment
variables from the Cygwin mconf running in the CMD.exe shell. The
following change to the top-level Kconfig file seems to work around
these problems:
config APPSDIR
string
- option env="APPSDIR"
+ default "../apps"
mkimage.sh
----------

131
nuttx/tools/kconfig.bat Executable file
View File

@ -0,0 +1,131 @@
@echo off
rem tools/kconfig.bat
rem
rem Copyright (C) 2012 Gregory Nutt. All rights reserved.
rem Author: Gregory Nutt <gnutt@nuttx.org>
rem
rem Redistribution and use in source and binary forms, with or without
rem modification, are permitted provided that the following conditions
rem are met:
rem
rem 1. Redistributions of source code must retain the above copyright
rem notice, this list of conditions and the following disclaimer.
rem 2. Redistributions in binary form must reproduce the above copyright
rem notice, this list of conditions and the following disclaimer in
rem the documentation and/or other materials provided with the
rem distribution.
rem 3. Neither the name NuttX nor the names of its contributors may be
rem used to endorse or promote products derived from this software
rem without specific prior written permission.
rem
rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
rem COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
rem OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
rem AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
rem POSSIBILITY OF SUCH DAMAGE.
rem
rem Remember the state of the PATH variable on entry
set oldpath=%PATH%
rem Handle command line options
set action=%1
shift
if "%action%"=="" goto :MissingArgument
set appsdir=..\apps
set cygwindir=C:\Cygwin
:ArgLoop
if "%1"=="" goto :CheckArguments
if "%1"=="-a" (
shift
set appsdir=%1
goto :NextArg
)
if "%1"=="-c" (
shift
set cygwindir=%1
goto :NextArg
)
echo ERROR: Unrecognized option: %1
goto :ShowUsage
:NextArg
shift
goto :ArgLoop
rem Verify that all of the paths are valid
:CheckArguments
if exist "%appsdir%" goto :CheckCygwinDir
echo ERROR: %appsdir% does not exist
goto :ShowUsage
:CheckCygwinDir
if exist "%cygwindir%" goto :SetPath
echo ERROR: %cygwindir% does not exist
goto :ShowUsage
rem Setup some required environment variables and PATH settings
:SetPath
set PATH=%cygwindir%\usr\local\bin;%cygwindir%\usr\bin;%cygwindir%\bin;%PATH%
set APPSDIR=%appsdir%
rem Execute the requested action
if "%action%"=="config" goto :DoConfig
if "%action%"=="oldconfig" goto :DoOldConfig
if "%action%"=="menuconfig" goto :DoMenuConfig
echo ERROR: Unrecognized action: %action%
goto :ShowUsage
:DoConfig
conf Kconfig
goto End
:DoOldConfig
conf --oldconfig Kconfig
goto End
:DoMenuConfig
mconf Kconfig
goto End
:MissingArgument
echo ERROR: Missing required argument
:ShowUsage
echo USAGE: %0 ^<action^> [-a ^<appsdir^>] [-c ^<cygwindir^>]
echo Where:
echo ^<action^> is one of config, oldconf, or menuconfig
echo ^<appsdir^> is the relative path to the apps\ directory.
echo This defaults to ..\apps
echo ^<cygwindir^> is the relative path to the Cygwin installation
echo directory. This defaults to C:\Cygwin
rem Restore the original PATH settings
:End
set PATH=%oldpath%