README.txt 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. README
  2. ======
  3. This README file describes the contents of the build configurations available
  4. for the NuttX QEMU i486 port.
  5. Contents
  6. ========
  7. * QEMU
  8. - Building QEMU
  9. - Cygwin Build Problems
  10. - Running QEMU
  11. * Toolchains
  12. - Cygwin Buildroot Toolchain
  13. - Buildroot Instructions
  14. * FAQ
  15. * Configurations
  16. - ostest
  17. - nsh
  18. QEMU
  19. ====
  20. QEMU is a generic and open source machine emulator and virtualizer. Here are
  21. some links (which will probably be mostly outdated by the time your read this):
  22. Home Page: http://wiki.qemu.org/Main_Page
  23. Downloads: http://wiki.qemu.org/Download
  24. Documentation: http://wiki.qemu.org/Manual
  25. Usage: qemu -nographic -kernel nuttx.elf
  26. Building QEMU
  27. -------------
  28. tar zxf qemu-0.14.0.tar.gz
  29. cd qemu-0.14.0
  30. ./configure --target-list=i386-softmmu
  31. make
  32. make install
  33. Cygwin Build Problems
  34. ---------------------
  35. Error:
  36. "gcc: The -mno-cygwin flag has been removed; use a mingw-targeted cross-compiler."
  37. Workaround:
  38. None known. It does not seem possible to build QEMU using the Cygwin gcc.
  39. I tried editing configure. Removing the following line will allow QEMU to
  40. configure:
  41. QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
  42. However, it then fails later during the compilation phase.
  43. Recommendation:
  44. 1. Google for "qemu windows download" and download some pre-built QEMU
  45. binaries. I found 0.14.0 here: http://dietpc.org/windows/qemu/, or
  46. 2. Try building QEMU with MingGW (I understand that this is difficult).
  47. NOTE: As of this writing, I have not been successful getting ANY pre-built
  48. version of QEMU to work successfully with WinXP. The same binaries work
  49. fine on Vista, however.
  50. Running QEMU
  51. ------------
  52. In the top-level NuttX directory:
  53. qemu -cpu 486 -m 2 -kernel nuttx.elf -nographic
  54. The -nographic option redirects COM1 to your console. However, the -nographic
  55. option does not work under Cygwin. For simple testing under Cygwin, I use
  56. qemu -cpu 486 -m 2 -kernel nuttx.elf -serial file:test.txt
  57. which will send COM1 output to the file test.txt.
  58. Toolchains
  59. ==========
  60. Two target environments are supported: (1) Linux and (2) Cygwin under Windows.
  61. Any GCC toolchain that can produce i486 ELF binaries should work. On Linux,
  62. you can probably use the installed system gcc. But that will not work with
  63. Cygwin. Why? Because the Cygwin gcc (and probably the MinGW gcc as well) do
  64. not produce ELF final binaries but, rather, DOS MZ executables (i.e., .exe
  65. files). Those cannot be used with QEMU.
  66. NOTE: It has also been reported to me that with a certain Ubuntu virtual
  67. installation, the native x86 did not build correct i486 code. Other
  68. installations of the same vintage do not have such issues. However,
  69. there is always a possibility that any GCC release will be incompatible
  70. with i486. That fallback used by this person in this particular case
  71. was to use the Buildroot i486 cross-development tool described below. I
  72. suspect that this was not necessary, but it was a simple work-around
  73. that allowed that person to build a work-able system.
  74. In any event, the PATH environment variable should be modified to point to
  75. the correct path to the GCC toolchain.
  76. Cygwin Buildroot Toolchain
  77. --------------------------
  78. With Cygwin the solution is to build an i486 cross-development toolchain to
  79. generate the i486 ELF files needed by QEMU. The NuttX buildroot package will
  80. create such a toolchain.
  81. NOTE: As of this writing, none of the released buildroot packages support the
  82. i486 build. This is only available in GIT or in any any 1.10 or later buildroot
  83. release.
  84. Buildroot Instructions
  85. ----------------------
  86. 1. You must have already configured Nuttx in <some-dir>/nuttx.
  87. tools/configure.sh qemu-i486:<sub-dir>
  88. 2. Download the latest buildroot package into <some-dir>
  89. 3. unpack the buildroot tarball. The resulting directory may
  90. have versioning information on it like buildroot-x.y.z. If so,
  91. rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
  92. 4. cd <some-dir>/buildroot
  93. 5. cp boards/i486-defconfig-4.3.3 .config
  94. 6. make oldconfig
  95. 7. make
  96. 8. Make sure that the PATH variable includes the path to the newly built
  97. binaries.
  98. See the file boards/README.txt in the buildroot source tree. That has more
  99. detailed PLUS some special instructions that you will need to follow if you
  100. run into problems building the toolchain for Cygwin under Windows.
  101. FAQ
  102. ===
  103. Q: I get the following error message, "undefined reference to '__stack_chk_fail'"
  104. A: Add -fno-stack-protector to ARCHCPUFLAGS in you Make.defs file. Switch the
  105. commenting on the following two lines in the Make.defs file:
  106. ARCHCPUFLAGS = -march=i486 -mtune=i486 -fno-builtin
  107. #ARCHCPUFLAGS = -march=i486 -mtune=i486 -fno-builtin -fno-stack-protector
  108. Configurations
  109. ==============
  110. Common Configuration Notes
  111. --------------------------
  112. 1. Each Qemu-i486 Web Server configuration is maintained in a sub-directory
  113. and can be selected as follow:
  114. tools/configure.sh qemu-i486:<subdir>
  115. Where <subdir> is one of the configuration sub-directories described in
  116. the following paragraph.
  117. 2. These configurations use the mconf-based configuration tool. To
  118. change a configurations using that tool, you should:
  119. a. Build and install the kconfig-mconf tool. See nuttx/README.txt
  120. see additional README.txt files in the NuttX tools repository.
  121. b. Execute 'make menuconfig' in nuttx/ in order to start the
  122. reconfiguration process.
  123. 3. By default, all configurations assume the Linux. This is easily
  124. reconfigured:
  125. CONFIG_HOST_LINUX=y
  126. Configuration Sub-Directories
  127. -----------------------------
  128. ostest
  129. The "standard" NuttX examples/ostest configuration.
  130. nsh
  131. Configures the NuttShell (nsh) located at examples/nsh.