STM32CubeF4 archive has been downloaded from : http://www.st.com/web/en/catalog/tools/PF259243#
sudo apt-get install autoconf pkg-config libusb-1.0 git
mkdir toolchain
cd toolchain
wget https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q1-update/+download/gcc-arm-none-eabi-4_9-2015q1-20150306-linux.tar.bz2
tar xvf gcc-arm-none-eabi-4_9-2015q1-20150306-linux.tar.bz2
cd ..
git clone https://github.com/texane/stlink.git
cd stlink
./autogen.sh
./configure
make
git clone https://github.com/studoret/STM32F401-Discovery_FW_F4_V1.5.0.git
Edit the STM32Cube_FW_F4_V1.5.0/GNU-ARM/envsetup.sh according to the toolchain and stlink paths
Then do :
cd STM32Cube_FW_F4_V1.5.0 source GNU-ARM/envsetup.sh
cd Projects/STM32F401-Discovery/Applications/Audio/Audio_playback_and_record
cd GNU_ARM
# clean STM32Cube_FW_F4_V1.5.0/Middlewares/build, STM32Cube_FW_F4_V1.5.0/Drivers/build <br > # and build directories
make reallyclean
# make binaries
make
# Flash the board
make program