MinGW:Grub2:VMWare Development Environment Setup

From RTEMSWiki
Jump to: navigation, search

This page describes how to setup a host environment with MinGW, Grub2 and VMWare to build, boot and simulate RTEMS on Windows. Hopefully these tried-out steps could be helpful to you.


Build RTEMS Using MinGW

Brief BSP Build Steps

Please refer to MinGW Tools for Windows for details of how to setup MinGW to build RTEMS on Windows. The following are brief steps to build a pc686 BSP:

> export PATH=/c/opt/rtems-4.9/bin:${PATH}
> cd /usr/local/src/rtems
> tar -xvjf ../rtems-4.9.0.tar.bz2
> mkdir i386_install
> mkdir i386_build
> cd i386_build
> ../rtems-4.9.0/configure --target=i386-rtems4.9 --enable-rtemsbsp=pc686 --enable-cxx --enable-rdbg --prefix=/usr/local/src/rtems/i386_install
> make all install

Workaround -lstdc++_s Issue

To temporarily workaround the build issue of "...ld.exe: cannot find -lstdc++_s", use vi to change "-lstdc++_s" to "-lstdc++" Makefile in the following 2 directory:

> /usr/local/src/rtems/i386_build/i386-rtems4.9/c/pc686/testsuites/samples/iostream
> /usr/local/src/rtems/i386_build/i386-rtems4.9/c/pc686/testsuites/samples/cdtest

Create CD Image Using Grub2

Check out and Build the Latest Grub2 Source From SVN

As of this writing, as shown below there is a configure issue with the latest Grub2 release grub-1.96:

> configure: error: GRUB requires a working absolute objcopy; upgrade your binutils

Fortunately someone already fixed it in SVN.

> mkdir -p /usr/local/src/grub/build
> cd /usr/local/src/grub
> svn co svn://svn.sv.gnu.org/grub/trunk/grub2
> cd /usr/local/src/grub/build
> ../grub2/configure  --prefix=/usr/local
> make all intall

Workaround a Linking Issue

During the above configure step, to workaround the linking issue resulted from the lack of soft link in Windows, vi grub2/configure to change

   cp -p "$srcdir/$ac_source" "$ac_file"


   cp -pr "$srcdir/$ac_source" "$ac_file"

Install mktemp

If you don't have mktemp installed yet, download it from http://downloads.sourceforge.net/mingw/mktemp-1.5-MSYS.tar.bz2. Extract mktemp.exe and put it into your /usr/bin (e.g., C:\msys\1.0\bin).

Install mkisofs and genisoimage

1) Download all executables from http://fy.chalmers.se/~appro/linux/DVD+RW/tools/win32/

2) Install all downloaded executables into /mingw/bin

3) cp /mingw/bin/mkisofs.exe /mingw/bin/genisoimage.exe

Create CD Image

The following is a sample grub.cfg (Note that cd0 will be used by default):

# RTEMS Grubs Configuration for the Sample Tests

set default=12

menuentry "RTEMS - Hello" {
 multiboot /tests/hello.exe

menuentry "RTEMS - Ticker" {
 multiboot /tests/ticker.exe

menuentry "RTEMS - Minimum" {
 multiboot /tests/minimum.exe

menuentry "RTEMS - Paranoia" {
 multiboot /tests/paranoia.exe

menuentry "RTEMS - File IO" {
 multiboot /tests/fileio.exe

menuentry "RTEMS - Unlimited" {
 multiboot /tests/unlimited.exe

menuentry "RTEMS - Loopback" {
 multiboot /tests/loopback.exe

menuentry "RTEMS - PPPD" {
 multiboot /tests/pppd.exe
menuentry "RTEMS - Base Mulitprocessor" {
 multiboot /tests/base_mp.exe

menuentry "RTEMS - Base Single Processor" {
 multiboot /tests/base_sp.exe

menuentry "RTEMS - C++ Static Constructors" {
 multiboot /tests/cdtest.exe

menuentry "RTEMS - C++ IO Streams" {
 multiboot /tests/cxx_iostream.exe

menuentry "RTEMS - Capture" {
 multiboot /tests/capture.exe
> mkdir -p /usr/local/src/rtems/i386_install/grub_cfg/boot/grub
> copy your grub.cfg to /usr/local/src/rtems/i386_install/grub_cfg/boot/grub
> grub-mkrescue --overlay=/usr/local/src/rtems/i386_install/i386-rtems4.9/pc686/lib/rtems-4.9 \
>               --overlay=/usr/local/src/rtems/i386_install/grub_cfg  /vm/pc686_rtems4.9.0.iso

You can output the iso file in your chosen directory. I have a /vm mapping in my fstab. 
The 1st overlay specifies executables to be included, and the 2nd one allows you to add your custom grub.cfg. 
More overlay can be specified.

Simulate in VMWare Using ISO Image

Download and Install Free VMware Server

Download free VMware Server 2 (mine is VMware-server-2.0.0-116503.exe) from http://www.vmware.com/freedownload/login.php?product=server20.

One nice feature is that there is no need to actually burn ISO image into CD. When configuring CD/DVD drive in Create Virtual Machine wizard, select ISO image option to use the ISO image created in the above steps. This makes updating and testing RTEMS ISO image very convenient.


1) Use your Windows credential to logon to VMWare.

2) Make sure Net Logon service is up and running.

3) Make sure all VMWare services except VMware VSS Writer Service are up and running.

4) Make sure you have wired or wirelss network connection before powering up a virtual machine via VMware Infrastructure Web Access, otherwise VMWare might not work correctly.

Create, Boot and Test RTEMS Virtual Machine

I tried out the hello, cdtest, cxx_iostream and capture examples in VMWare, and they worked. The following illustrates a minimum setup of a RTEMS virtual machine using Create Virtual Machine wizard, and you can adjust it to fit your needs.

To start, click on Create Virtual Machine under Commands panel, and select name and location for the new VM.

MiniVM Name.jpg

On Guest Operating System page, specify Other operating systems with version of Other (32-bit).

MiniVM GuestOS.jpg

On Memory and Processors page, accept the default.

MiniVM MemCPU.jpg

On the next 2 pages, select Don't Add a Hard Disk and Don't Add a Network Adaptor for the minimum setup.

MiniVM NoHD.jpg

MiniVM NoNIC.jpg

For CD/DVD Drive, select Use an ISO Image and iso file generated above as the image file. Later when testing your code or configuration change, there is no need to create another VM, just update the iso file, and then power the vm up. So the ISO image option is very convenient in iterative development cycles.

MiniVM isoCD.jpg

MiniVM isoImg.jpg

Select Don't Add a Floppy Drive and Don't Add a USB Controller for the minimum setup.

MiniVM NoFloppy.jpg

MiniVM No USB.jpg

It's ready for the minimum setup.

MiniVM Ready.jpg

Finally you can boot it up and test it in VMWare.

MiniVM Boot.jpg

MiniVM Test.jpg

More Simulation Examples

An example of device simulation is presented in Simulate Serial Communication Application.

Personal tools

Gedare's Special Help