This is code from here. But with Makefiles to help build the project.
Follow the instructions here on setting up your Linux enironment for development on STM32F4xx boards.
Modify your Makefile to change STLINK and STM_COMMON to point them to the places you have installed and compiled these tools and libraries.
Run
$ make
to make the generator.bin file.
$ make burn
to burn the file to your STM32 Discovery board.