Building MinGW Tools
This topic describes the building of the RTEMS tools for MinGW. The detail of building a tool set for MinGW is complex and not documented here, rather the interfaces to the scripts used are. If you want the detail you will need to dig into the scripts.
A brief version of what is here is in a README installed to the top of the installation directory tree.
- A fast computer running Fedora Core 7, lots of disk space and plently of memory.
- The NSIS installer source code.
- The RTEMS source tree.
The build system currently uses the crossrpms build. This is located in the contrib section of the RTEMS source tree. The crossrpms project handles the building of the various tools, the patches and the source code. This is not a simple matter of building a specific version of GCC or newlib. Each RTEMS supported target can have a mix of versions and a mix of patches. This is all handled by crossrpms. It uses rpmbuild to perform the actual task of building.
You need to build the NSIS installer. This is a GPL Windows installer so the binary installer executables is GPL code, the installer scripts are part of the RTEMS source tree and the tools are all GPL. The NSIS source package provided details on a POSIX build. Follow those and you will have the ability to create Windows installer on Linux. This is rather nice. Place the NSIS installer executable into your PATH.
You need to set up some files in your home directory for RPM to use. The first create a $HOME/.rpmrc file with:
os_canon: mingw32: mingw32 23 arch_canon: mingw32: i686 1 arch_compat: mingw32: i686 noarch buildarch_compat: mingw32: i686 noarch optflags: mingw32 -O2 -g optflags: i686 -O2 -pipe
I am currently unsure what is needed here, but it works so I am not changing it. Next you need to create a $HOME/.rpmmacros file. You need to change the %_topdir and _tmppath to suit your build machine:
%_topdir /home2/work/chris/rtems/4.8/packages %_tmppath /home2/work/chris/tmp/rtems %_rpmdir %_topdir/%_target_os/RPMS %_srcrpmdir %_topdir/%_target_os/SRPMS %_signature gpg %_gpg_name rtems %vendor: RTEMS Project %packager firstname.lastname@example.org %distribution RTEMS Project http://www.rtems.org/
The directories need to be set up. The rpmbuild does not create the directories, you need to create them. You also need to get the various source code packages and patches. The patches are in the patch directory in crossrpms in the RTEMS source code. There is not easy way to get a complete list of the packages you need before you start to build. you have to wait until rpmbuild falis and then obtain the package and start again. The shell commands to create the paths to match my $HOME/.rpmmacros are:
$ mkdir -p /home2/work/chris/rtems/4.8/packages $ mkdir /home2/work/chris/rtems/4.8/packages/SOURCES $ mkdir /home2/work/chris/rtems/4.8/packages/BUILD $ mkdir -p /home2/work/chris/rtems/4.8/packages/linux/SRPMS $ mkdir -p /home2/work/chris/rtems/4.8/packages/linux/RPMS $ mkdir -p /home2/work/chris/rtems/4.8/packages/mingw32/SRPMS $ mkdir -p /home2/work/chris/rtems/4.8/packages/mingw32/RPMS $ cp /home2/work/chris/rtems/4.8/head/contrib/crossrpms/patches/* \ /home2/work/chris/rtems/4.8/packages/SOURCES/.
The RTEMS source code is in /home2/work/chris/rtems/4.8/head.
A single script controls the whole build process.
$ export PATH=/opt/rtems-4.8/bin:$PATH $ cd /home2/work/chris/rtems/4.8/head/contrib/crossrpms $ ./bootstrap $ cd /home2/work/chris/rtems/4.8/head/contrib/mingw $ ./build.sh -d -h mingw32 \ -p /home2/work/chris/rtems/4.8/build/rpms \ -s /home2/work/chris/rtems/4.8/head/contrib/crossrpms \ -r /home2/work/chris/rtems/4.8/build/mingw