Navigation
Downloads
Home
Look! - Over 40 Tutorials
RMPrepUSB - Site News
 

How to compile grub4dos under Windows using MinGW

As I had some problems doing this and could not find a simple How To on it, here are some notes on how to do it. It is really quite easy once you know how!

  1. First download MinGW from here. Click on the 'Download and run the latest mingw-get-inst version' text.
  2. Run the latest download (e.g. mingw-get-inst-20110316)  --> mingw-get-inst-20110316.exe
  3. Choose 'Use prepacked repository catalogues' default option, Accept the EULA, use C:\MinGW as the install folder (do not use a path with spaces in it!) 
  4. Click Next - Next until you get to the 'Select Components' menu - now you need to tick the bottom two options - MSYS Basic System and MinGW Developer Toolkit
  5. Wait for the files to be downloaded and installed.
  6. In the Start Menu - run All Programs - MinGW - MinGW Shell
  7. You should now be at a MINGW32 command shell. Type ls to see the files and folders that are present. The actual root folder is located at C:\MinGW\msys\1.0\home\USERNAME (where USERNAME is your Windows user name).
  8. Now we need to download the latest chenall build. At the MinGW command prompt type:

    svn checkout http://grub4dos-chenall.googlecode.com/svn/trunk/ grubnew

    where grubnew will be the name of your new folder containing the latest source files. Note that if you connect via an internet proxy this won't work!
  9. We now need to configure the files for the new build (create make files, etc.), type

    cd ./grubnew
    ./configure


    If all goes well there will not be any error messages.
  10. Now to compile grub4dos, simply type 

    make

    Again no error messages should be displayed and there should now be a file called grldr in the C:\MinGW\msys\1.0\home\USERNAME\grubnew\stage2 folder.
  11. Copy the grldr file to test on your new drive (e.g. USB drive using RMPrepUSB and the F11 QEMU emulation feature)



Now you can edit the source files as you wish and just type 'make' to remake a new build.

If you want to see what you have changed compared to the original source files, type svn diff. To create a nice diff file type svn diff > mychanges.diff and then load the file mychanges.diff using NotePad2 or a similar programmers text editor.



Compiling grub4dos utilities


3. Use cd to change to the grubutils/src folder and type ./build to build all utilities.
4. In the Windows Virtual PC Settings menu, enable the Integration features and then in BT5, run Setup from the CD that should now be detected by linux. This will install integration features via WINE.
5. In Dolphin, click on Network and Add Network Folder, enter the name of your host computer - e.g. MyDell\c$, enter the username and password and tick Remember password - if the password does not seem to work - just keep hitting OK until it is accepted - it seems to take several attempts!
6. You should now be able to browse to the host computer C: drive and drop any compiled utilities from the virtual machine onto the host machine.

Now just edit a source file - e.g. wenv.c and type ./build to recompile it. Then copy it to your host C: drive and then copy it to a USB drive to test it (e.g. under QEMU).


Compiling qemu-img.exe

2. cd to new folder  and run
configure --disable-guest-agent  (otherwise asks for python)
                (if error about glib-2.0 required to compile QEMU then edit configure file around line 1840 to comment out exit 1 line)
                (if error about error: zlib check failed  then install zlib and maybe xy too - see here for instructions)
make
strip qemu-img.exe (to get rid of debug code)

Note: qemu may not be usable as usually needs tweaks .


Updated on Aug 27, 2011 by Steve Si (Version 12)