2011-03-04 23:25:03 +01:00
|
|
|
README
|
2011-03-08 03:37:41 +01:00
|
|
|
======
|
2011-03-04 23:25:03 +01:00
|
|
|
|
|
|
|
This README file describes the contents of the build configurations available
|
|
|
|
for the NuttX QEMU i486 port.
|
|
|
|
|
2011-03-06 14:55:20 +01:00
|
|
|
Contents
|
2011-03-08 03:37:41 +01:00
|
|
|
========
|
2011-03-06 14:55:20 +01:00
|
|
|
|
|
|
|
* QEMU
|
2011-03-08 03:37:41 +01:00
|
|
|
- Building QEMU
|
2011-03-10 15:00:04 +01:00
|
|
|
- Cygwin Build Problems
|
|
|
|
- Running QEMU
|
2011-03-07 03:53:37 +01:00
|
|
|
* Toolchains
|
2011-03-08 03:37:41 +01:00
|
|
|
- Cygwin Buildroot Toolchain
|
2011-03-10 15:00:04 +01:00
|
|
|
- Buildroot Instructions
|
2011-03-18 15:41:22 +01:00
|
|
|
* FAQ
|
2011-03-06 14:55:20 +01:00
|
|
|
* Configurations
|
2011-03-08 03:37:41 +01:00
|
|
|
- ostest
|
2011-03-10 15:00:04 +01:00
|
|
|
- nsh
|
2011-03-06 14:55:20 +01:00
|
|
|
|
|
|
|
QEMU
|
2011-03-08 03:37:41 +01:00
|
|
|
====
|
2011-03-06 14:55:20 +01:00
|
|
|
|
|
|
|
QEMU is a generic and open source machine emulator and virtualizer. Here are
|
2011-03-18 15:41:22 +01:00
|
|
|
some links (which will probably be mostly outdated by the time your read this):
|
2011-03-06 14:55:20 +01:00
|
|
|
|
|
|
|
Home Page: http://wiki.qemu.org/Main_Page
|
|
|
|
Downloads: http://wiki.qemu.org/Download
|
|
|
|
Documentation: http://wiki.qemu.org/Manual
|
|
|
|
Usage: qemu -nographic -kernel nuttx.elf
|
|
|
|
|
2011-03-08 03:37:41 +01:00
|
|
|
Building QEMU
|
|
|
|
-------------
|
2011-03-06 14:55:20 +01:00
|
|
|
|
|
|
|
tar zxf qemu-0.14.0.tar.gz
|
|
|
|
cd qemu-0.14.0
|
2011-03-18 15:41:22 +01:00
|
|
|
./configure --target-list=i386-softmmu
|
2011-03-06 14:55:20 +01:00
|
|
|
make
|
|
|
|
make install
|
|
|
|
|
2011-03-08 03:37:41 +01:00
|
|
|
Cygwin Build Problems
|
|
|
|
---------------------
|
2011-03-06 14:55:20 +01:00
|
|
|
|
|
|
|
Error:
|
|
|
|
|
|
|
|
"gcc: The -mno-cygwin flag has been removed; use a mingw-targeted cross-compiler."
|
|
|
|
|
|
|
|
Workaround:
|
|
|
|
|
|
|
|
None known. It does not seem possible to build QEMU using the Cygwin gcc.
|
2011-03-10 15:00:04 +01:00
|
|
|
I tried editing configure. Removing the following line will allow QEMU to
|
|
|
|
configure:
|
2011-03-06 14:55:20 +01:00
|
|
|
|
|
|
|
QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
|
|
|
|
|
2011-03-10 15:00:04 +01:00
|
|
|
However, it then fails later during the compilation phase.
|
2011-03-06 14:55:20 +01:00
|
|
|
|
|
|
|
Recommendation:
|
|
|
|
|
|
|
|
1. Google for "qemu windows download" and download some pre-built QEMU
|
2011-03-10 15:00:04 +01:00
|
|
|
binaries. I found 0.14.0 here: http://dietpc.org/windows/qemu/, or
|
|
|
|
2. Try building QEMU with MingGW (I understand that this is difficult).
|
2011-03-09 04:41:34 +01:00
|
|
|
|
|
|
|
NOTE: As of this writing, I have not been successful getting ANY pre-built
|
2011-03-18 15:41:22 +01:00
|
|
|
version of QEMU to work successfully with WinXP. The same binaries work
|
|
|
|
fine on Vista, however.
|
2011-03-06 14:55:20 +01:00
|
|
|
|
2011-03-08 03:37:41 +01:00
|
|
|
Running QEMU
|
|
|
|
------------
|
|
|
|
|
|
|
|
In the top-level NuttX directory:
|
|
|
|
|
|
|
|
qemu -cpu 486 -m 2 -kernel nuttx.elf -nographic
|
|
|
|
|
2011-03-18 15:41:22 +01:00
|
|
|
The -nographic option redirects COM1 to your console. However, the -nographic
|
|
|
|
option does not work under Cygwin. For simple testing under Cygwin, I use
|
|
|
|
|
|
|
|
qemu -cpu 486 -m 2 -kernel nuttx.elf -serial file:test.txt
|
|
|
|
|
|
|
|
which will send COM1 output to the file test.txt.
|
|
|
|
|
2011-03-07 03:53:37 +01:00
|
|
|
Toolchains
|
2011-03-08 03:37:41 +01:00
|
|
|
==========
|
2011-03-07 03:53:37 +01:00
|
|
|
|
|
|
|
Two target environments are supported: (1) Linux and (2) Cygwin under Windows.
|
|
|
|
Any GCC toolchain that can produce i486 ELF binaries should work. On Linux,
|
|
|
|
you can probably use the installed system gcc. But that will not work with
|
|
|
|
Cygwin. Why? Because the Cygwin gcc (and probably the MinGW gcc as well) do
|
|
|
|
not produce ELF final binaries but, rather, DOS MZ executables (i.e., .exe
|
|
|
|
files). Those cannot be used with QEMU.
|
|
|
|
|
2013-04-11 14:53:26 +02:00
|
|
|
NOTE: It has also been reported to me that with a certain Ubuntu virtual
|
|
|
|
installation, the native x86 did not build correct i486 code. Other
|
|
|
|
installations of the same vintage do not have such issues. However,
|
|
|
|
there is always a possibility that any GCC release will be incompatible
|
|
|
|
with i486. That fallback used by this person in this particular case
|
|
|
|
was to use the Buildroot i486 cross-development tool described below. I
|
|
|
|
suspect that this was not necessary, but it was a simple work-around
|
|
|
|
that allowed that person to build a work-able system.
|
|
|
|
|
|
|
|
In any event, the file */setenv.sh should be modified to point to the correct
|
|
|
|
path to the GCC toolchain (if different from the default in your PATH
|
|
|
|
variable).
|
2011-03-07 03:53:37 +01:00
|
|
|
|
2011-03-08 03:37:41 +01:00
|
|
|
Cygwin Buildroot Toolchain
|
|
|
|
--------------------------
|
2011-03-07 03:53:37 +01:00
|
|
|
|
|
|
|
With Cygwin the solution is to build an i486 cross-development toolchain to
|
|
|
|
generate the i486 ELF files needed by QEMU. The NuttX buildroot package will
|
|
|
|
create such a toolchain.
|
|
|
|
|
|
|
|
NOTE: As of this writing, none of the released buildroot packages support the
|
2013-04-20 02:35:06 +02:00
|
|
|
i486 build. This is only available in GIT or in any any 1.10 or later buildroot
|
2011-03-07 03:53:37 +01:00
|
|
|
release.
|
|
|
|
|
2011-03-08 03:37:41 +01:00
|
|
|
Buildroot Instructions
|
|
|
|
----------------------
|
2011-03-07 03:53:37 +01:00
|
|
|
|
|
|
|
1. You must have already configured Nuttx in <some-dir>/nuttx.
|
|
|
|
|
|
|
|
cd tools
|
|
|
|
./configure.sh qemu-i486/<sub-dir>
|
|
|
|
|
|
|
|
2. Download the latest buildroot package into <some-dir>
|
|
|
|
|
|
|
|
3. unpack the buildroot tarball. The resulting directory may
|
|
|
|
have versioning information on it like buildroot-x.y.z. If so,
|
|
|
|
rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
|
|
|
|
|
|
|
|
4. cd <some-dir>/buildroot
|
|
|
|
|
|
|
|
5. cp configs/i486-defconfig-4.3.3 .config
|
|
|
|
|
|
|
|
6. make oldconfig
|
|
|
|
|
|
|
|
7. make
|
|
|
|
|
|
|
|
8. Edit setenv.h, if necessary, so that the PATH variable includes
|
|
|
|
the path to the newly built binaries.
|
|
|
|
|
|
|
|
See the file configs/README.txt in the buildroot source tree. That has more
|
|
|
|
detailed PLUS some special instructions that you will need to follow if you
|
|
|
|
run into problems building the toolchain for Cygwin under Windows.
|
|
|
|
|
2011-03-18 15:41:22 +01:00
|
|
|
FAQ
|
|
|
|
===
|
|
|
|
|
|
|
|
Q: I get the following error message, "undefined reference to '__stack_chk_fail'"
|
2011-04-07 02:42:46 +02:00
|
|
|
A: Add -fno-stack-protector to ARCHCPUFLAGS in you Make.defs file. Switch the
|
|
|
|
commenting on the following two lines in the Make.defs file:
|
|
|
|
|
|
|
|
ARCHCPUFLAGS = -march=i486 -mtune=i486 -fno-builtin
|
|
|
|
#ARCHCPUFLAGS = -march=i486 -mtune=i486 -fno-builtin -fno-stack-protector
|
2011-03-18 15:41:22 +01:00
|
|
|
|
2011-03-04 23:25:03 +01:00
|
|
|
Configurations
|
2011-03-08 03:37:41 +01:00
|
|
|
==============
|
2011-03-04 23:25:03 +01:00
|
|
|
|
2014-03-05 21:36:35 +01:00
|
|
|
Common Configuration Notes
|
|
|
|
--------------------------
|
|
|
|
|
|
|
|
1. Each Qemu-i486 Web Server configuration is maintained in a sub-directory
|
|
|
|
and can be selected as follow:
|
|
|
|
|
|
|
|
cd tools
|
|
|
|
./configure.sh qemu-i486/<subdir>
|
|
|
|
cd -
|
|
|
|
. ./setenv.sh
|
|
|
|
|
|
|
|
Where <subdir> is one of the configuration sub-directories described in
|
|
|
|
the following paragraph.
|
|
|
|
|
|
|
|
2. These configurations use the mconf-based configuration tool. To
|
|
|
|
change a configurations using that tool, you should:
|
|
|
|
|
|
|
|
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
|
|
|
|
and misc/tools/
|
|
|
|
|
|
|
|
b. Execute 'make menuconfig' in nuttx/ in order to start the
|
|
|
|
reconfiguration process.
|
|
|
|
|
|
|
|
3. By default, all configurations assume the Linux. This is easily
|
|
|
|
reconfigured:
|
2011-03-04 23:25:03 +01:00
|
|
|
|
2014-03-05 21:36:35 +01:00
|
|
|
CONFIG_HOST_LINUX=y
|
2011-03-04 23:25:03 +01:00
|
|
|
|
2014-03-05 21:36:35 +01:00
|
|
|
Configuration Sub-Directories
|
|
|
|
-----------------------------
|
2011-03-10 15:00:04 +01:00
|
|
|
|
2014-03-05 21:36:35 +01:00
|
|
|
ostest
|
2011-03-10 15:00:04 +01:00
|
|
|
|
2014-03-05 21:36:35 +01:00
|
|
|
The "standard" NuttX examples/ostest configuration.
|
2011-03-10 15:00:04 +01:00
|
|
|
|
2014-03-05 21:36:35 +01:00
|
|
|
nsh
|
2011-03-10 15:00:04 +01:00
|
|
|
|
2014-03-05 21:36:35 +01:00
|
|
|
Configures the NuttShell (nsh) located at examples/nsh.
|