Deploying Inputs into the MinGW VM

1. Moving intermediary build results

  • Boot into your Cygwin VM, open Cygwin console, and run the following commands:
    $ cd /opt/crosstool/
    $ tar -h -zcf gcc-4.9.2-glibc-2.19.tar.gz \
         gcc-4.9.2-glibc-2.19
    
    Because target MinGW VM does not support symlinks, it's important to create tar archive with symlink dereferencing (-h option).
     
  • Copy gcc-4.9.2-glibc-2.19.tar.gz to a shared folder with a host and shutdown the Cygwin VM.
     
  • Boot into your MinGW VM, create new folder C:\MinGW\msys\1.0\opt\crosstool and copy gcc-4.9.2-glibc-2.19.tar.gz from shared folder with a host into recently created folder C:\MinGW\msys\1.0\opt\crosstool.
     
  • Open MinGW shell, and run the following commands:
    $ cd /opt/crosstool
    $ tar -zxf gcc-4.9.2-glibc-2.19.tar.gz
    $ cd gcc-4.9.2-glibc-2.19
    $ ls -l
    $ find . -name '*.exe' -delete
    $ find . -name '*.dll' -delete
    Last command will remove all .exe and .dll files in the intermediary build results, because these .exe and .dll files depend on cygwin1.dll and won't run in MinGW environment. They also may be 64-bit executables if you have chosen to use 64-bit Cygwin, so they won't run in 32-bit Windows XP / MinGW environment anyway.

2. Unpacking source code

Open MinGW shell, create directory /opt/crosstool/src (mkdir -p), and unpack binutils, gcc and gdb into it. Use "tar zxf" command to unpack .tar.gz files, "tar jxf" to unpack .tar.bz2 files and "tar Jxf" to unpack .tar.xz files (grab those files from host system via shared folder).

You should get the following folders:

C:\MinGW\msys\1.0\opt\crosstool\src\binutils-2.25
C:\MinGW\msys\1.0\opt\crosstool\src\gcc-4.9.2
C:\MinGW\msys\1.0\opt\crosstool\src\gdb-7.7.1

Source code for glibc is not required, because we have already built it.

3. Creating temporary folders for build

gcc and probably other software will not build in its source folder. So, please create build-binutils, build-gcc and build-gdb subfolders in C:\MinGW\msys\1.0\opt\crosstool\src. These subfolders will contain intermediary build results when corresponding software will be built.

4. Merging $PREFIX/usr and $PREFIX/$TARGET folders

Please merge C:\MinGW\msys\1.0\opt\crosstool\gcc-4.9.2-glibc-2.19\arm-linux-gnueabihf\usr folder with C:\MinGW\msys\1.0\opt\crosstool\gcc-4.9.2-glibc-2.19\arm-linux-gnueabihf\arm-linux-gnueabihf, i.e. copy second folder to first one overwriting all files, then vice versa.

Then repeat the same process with C:\MinGW\msys\1.0\opt\crosstool\gcc-4.9.2-glibc-2.19\arm-linux-gnueabi\usr and C:\MinGW\msys\1.0\opt\crosstool\gcc-4.9.2-glibc-2.19\arm-linux-gnueabi\arm-linux-gnueabi folders.

5. Creating script files

Also please prepare stub batch file C:\MinGW\msys\1.0\opt\crosstool\src\build_cross_toolchain.cmd with the following contents:

@echo off
C:\MinGW\msys\1.0\bin\dos2unix.exe ^
    C:\MinGW\msys\1.0\opt\crosstool\src\build_cross_toolchain.sh
C:\MinGW\msys\1.0\bin\bash.exe ^
    -l -c /opt/crosstool/src/build_cross_toolchain.sh

Also please prepare main build script file C:\MinGW\msys\1.0\opt\crosstool\src\build_cross_toolchain.sh with the following contents:

#!/bin/bash

echo "=== build script: OK ==="

Then run build_cross_toolchain.cmd to make sure scripts work as expected.


It's recommended to shutdown MinGW virtual machine and make snapshot "SNAP-B" when initial deployment is done.


>> Read next section or buy already prepared cross-compiler (€10) to save your time.