I tried compiling grub from bzr on cygwin.
grub-mkimage failed with the following error:
~/grub/build/grub-core $ ../grub-mkimage -v -O i386-pc -d . -o core.img biosdisk part_msdos fat ntfs
../grub-mkimage: info: getting the size of ./biosdisk.mod.
../grub-mkimage: info: getting the size of ./part_msdos.mod.
../grub-mkimage: info: getting the size of ./fat.mod.
../grub-mkimage: info: getting the size of ./fshelp.mod.
../grub-mkimage: info: getting the size of ./ntfs.mod.
../grub-mkimage: info: the total module size is 0x6280.
../grub-mkimage: info: getting the size of ./kernel.img.
../grub-mkimage: info: reading ./kernel.img.
../grub-mkimage: info: getting the size of ./kernel.img.
../grub-mkimage: error: invalid ELF header.
I found that the problem can be solved by replacing the following line in the Makefile
strip -v -R .rel.dyn -R .reginfo -R .note -R .comment -o kernel.img kernel.exec.exe
by
strip -Felf32-i386 -v -R .rel.dyn -R .reginfo -R .note -R .comment -o kernel.img kernel.exec.exe
-- lode