Flickernoise build instructions
From Milkymist Wiki
Contents |
[edit] Build products
The Automatic or Manual build procedures create the Flickernoise VJ application for the Milkymist One. The final Flickernoise executable is an ELF binary. From that, you can either:
- try the ELF binary in the QEMU emulator with
qemu-system-lm32 -M milkymist -kernel flickernoise
- generate a raw binary file with
make flickernoise.ralf
, suitable for TFTP netbooting (recommended), booting from the memory card or downloading over the serial line with flterm. Using flterm is not recommended as this method is slow because of the large size of the binary. - generate a FBI image with
make flickernoise.fbi
that you can use with the auto-upgrade feature of Flickernoise (0.2+).
[edit] Automatic build
xiangfu wrote some Makefiles to compile the lm32 toolchain and flickernoise. Please read the README.html for detailed directions and host specific requirements. Build steps are below:
- Download the script files:
$ git clone git://github.com/milkymist/scripts.git
- Read and follow the directions in the README.html file:
$ cd scripts $ vi README
[edit] Manual build steps
Note: The automatic build procedure is the preferred way of building the Flickernoise application.
[edit] RTEMS and toolchain
First you need to follow the RTEMS build instructions. We will assume you have installed both RTEMS and the toolchain in /opt/rtems
(or /opt/rtems-VERSION). Not installing RTEMS and the toolchain in the same directory tends to cause problems w.r.t. finding include files.
We recommend using the GCC 4.5.1 based toolchain, which works reasonably well. You will however need to patch GCC a bit so the base C libraries can use all the features of our LM32 implementation:
diff -Naur gcc-4.5.1.orig/gcc/config/lm32/t-lm32 gcc-4.5.1/gcc/config/lm32/t-lm32 --- gcc-4.5.1.orig/gcc/config/lm32/t-lm32 2010-03-30 12:26:24.000000000 +0200 +++ gcc-4.5.1/gcc/config/lm32/t-lm32 2010-11-28 12:42:30.047795004 +0100 @@ -1,2 +1,2 @@ # for multilib -MULTILIB_OPTIONS = mmultiply-enabled mbarrel-shift-enabled +MULTILIB_OPTIONS = mbarrel-shift-enabled mmultiply-enabled mdivide-enabled msign-extend-enabled
Once you have the toolchain and RTEMS installed:
- make sure the toolchain binary directory (e.g.
/opt/rtems/bin
) is in yourPATH
, so that thelm32-rtems4.11-*
family of commands is found.
export PATH=/opt/rtems-4.11/bin:$PATH
- set the
RTEMS_MAKEFILE_PATH
environment variable, e.g. to/opt/rtems-4.11/lm32-rtems4.11/milkymist
export RTEMS_MAKEFILE_PATH=/opt/rtems-4.11/lm32-rtems4.11/milkymist
[edit] libpng
We use libpng 1.5.6. Sometimes, GNU/Autocrap-infected software packages happen to work almost correctly, and libpng is one of those rare cases.
CC=lm32-rtems4.11-gcc CFLAGS="-O9 -Wall -mbarrel-shift-enabled -mmultiply-enabled -mdivide-enabled -msign-extend-enabled -I $RTEMS_MAKEFILE_PATH/lib/include -B $RTEMS_MAKEFILE_PATH/lib -specs bsp_specs -qrtems" CPPFLAGS="-DPNG_NO_FLOATING_ARITHMETIC -DPNG_NO_FLOATING_POINT" ./configure --disable-shared --prefix=$RTEMS_MAKEFILE_PATH --host=lm32-rtems4.11 make make install
Again, move the include files:
mv /opt/rtems-4.11/lm32-rtems4.11/milkymist/include/* /opt/rtems-4.11/lm32-rtems4.11/milkymist/lib/include
[edit] libjpeg
This is known to work with jpegsrc v8c from IJG.
wget http://www.ijg.org/files/jpegsrc.v8c.tar.gz
CFLAGS="-O9 -Wall -mbarrel-shift-enabled -mmultiply-enabled -mdivide-enabled -msign-extend-enabled -I $RTEMS_MAKEFILE_PATH/lib/include -B $RTEMS_MAKEFILE_PATH/lib -specs bsp_specs -qrtems" ./configure --host=lm32-rtems4.11 --disable-shared --prefix=$RTEMS_MAKEFILE_PATH make make install mv /opt/rtems-4.11/lm32-rtems4.11/milkymist/include/* /opt/rtems-4.11/lm32-rtems4.11/milkymist/lib/include
[edit] libcurl
Tested with curl 7.22.0. Configure with the usual Autocrap command line (as above). Special parameters are: --host=lm32-rtems4.11 --disable-shared --without-librtmp --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smtp --disable-gopher --disable-manual --prefix=$RTEMS_MAKEFILE_PATH
Then you need to hack the generated files:
- at the end of lib/setup.h add
#define HAVE_SOCKET 1
[edit] expat
Works with expat 2.0.1. Edit conftools/config.sub
and replace ppc
with lm32
, then proceed like with Freetype.
[edit] Softusb firmware
You will need gcc-avr.
Make sure the RTEMS_MAKEFILE_PATH
environment variable is set (see above).
Run these commands from the top directory of the SoC distribution:
$ cd softusb-input $ make # make install
[edit] libFPVM
Flickernoise uses the FPVM compilation library to generate microcode for the PFPU. It is part of the SoC distribution.
You will need Lemon and RE2C to compile libFPVM.
Make sure the RTEMS_MAKEFILE_PATH
environment variable is set (see above).
dont forget PATH too, ie PATH=/opt/rtems-4.11/bin:$PATH
Run these commands from the top directory of the SoC distribution:
$ cd software/libfpvm $ make # make install
[edit] MTK
MTK (Milkymist Toolkit) is a lightweight and portable GUI toolkit, based on Genode FX.
After you have cloned the git repository, compilation and installation are very simple:
make milkymist make install-milkymist
(Again, these commands requires the RTEMS_MAKEFILE_PATH environment variable)
[edit] liboscparse (lop)
Liboscparse is used to implement Opensoundcontrol (OSC). It is based on liblo, but it does not use the GNU/Autocrap "build system" and does not contain any network-dependent code (the original liblo networking code does not play nice with RTEMS).
Run the following commands (making sure the environment variables listed above are set):
make make install
[edit] Yaffs
rtems-yaffs2 YAFFS (Yet Another Flash File System) is now in its second generation and provides a fast robust file system for NAND and NOR Flash.
After you have cloned the git repository, compilation is very simple:
make -f Makefile.rtems make -f Makefile.rtems install
(Again, this command requires the RTEMS_MAKEFILE_PATH environment variable)
[edit] Flickernoise
Compile it with:
cd src make
Do not forget to set the RTEMS_MAKEFILE_PATH
environment variable to the right directory where your RTEMS is installed.
This produces an ELF binary. From that, you can either:
- try the ELF binary in the QEMU emulator with
qemu-system-lm32 -M milkymist -kernel flickernoise
- generate a raw binary file with
make flickernoise.ralf
, suitable for TFTP netbooting (recommended), booting from the memory card or downloading over the serial line with flterm. Using flterm is not recommended as this method is slow because of the large size of the binary. - generate a FBI image with
make flickernoise.fbi
that you can use with the auto-upgrade feature of Flickernoise (0.2+). - generate a MCS flash image with
make flickernoise.mcs
that you can download into the board's flash memory so that Flickernoise automatically starts at every boot.
[edit] Extra libraries (normally not needed)
[edit] freetype2
This is known to work with freetype 2.4.4.
wget http://ufpr.dl.sourceforge.net/project/freetype/freetype2/2.4.4/freetype-2.4.4.tar.gz
CFLAGS="-O9 -Wall -mbarrel-shift-enabled -mmultiply-enabled -mdivide-enabled -msign-extend-enabled -I $RTEMS_MAKEFILE_PATH/lib/include -B $RTEMS_MAKEFILE_PATH/lib -specs bsp_specs -qrtems" ./configure --host=lm32-rtems4.11 --disable-shared --prefix=$RTEMS_MAKEFILE_PATH make make install mv /opt/rtems-4.11/lm32-rtems4.11/milkymist/include/* /opt/rtems-4.11/lm32-rtems4.11/milkymist/lib/include
[edit] libgd
This works with GD 2.0.33.
RTEMS lacks the required include file bits/wordsize.h so we create one:
mkdir /opt/rtems-4.11/lm32-rtems4.11/include/bits cat << EOF > /opt/rtems-4.11/lm32-rtems4.11/include/bits/wordsize.h #define __WORDSIZE 32 EOF
Edit the beginning of the Makefile to set:
COMPILER=lm32-rtems4.11-gcc AR=lm32-rtems4.11-ar CFLAGS=-O9 -Wall -mbarrel-shift-enabled -mmultiply-enabled -mdivide-enabled -msign-extend-enabled -fsingle-precision-constant -I$(RTEMS_MAKEFILE_PATH)/lib/include -I/opt/rtems-4.11/lm32-rtems4.11/milkymist/lib/include/freetype2 -g -DHAVE_LIBPNG -DHAVE_LIBJPEG -DHAVE_LIBFREETYPE -DHAVE_FT2BUILD_H LIBS=-lgd -lpng -lz -ljpeg -lfreetype -lm INCLUDEDIRS=-I. LIBDIRS=
Also, they seem to have forgotten gd_security.c to the list of objects, so add it to LIBOBJS.
Compile with:
make libgd.a
Then copy libgd.a to /opt/rtems-4.11/lm32-rtems4.11/milkymist/lib and gd.h, gdcache.h, gd_io.h, gdfontg.h, gdfontl.h, gdfontmb.h, gdfonts.h and gdfontt.h to /opt/rtems-4.11/lm32-rtems4.11/milkymist/lib/include.
[edit] openjpeg
We use openjpeg version 1.2.
wget http://www.openjpeg.org/openjpeg_v1_2.tar.gz
Uncompress the archive, and edit the Makefile:
- set CC = lm32-rtems4.11-gcc -mbarrel-shift-enabled -mmultiply-enabled -mdivide-enabled -msign-extend-enabled
- set AR = lm32-rtems4.11-ar
- for the target OpenJPEG, comment out $(SHAREDLIB)
RTEMS lacks memory.h so we create a fake one:
echo "#include <string.h>" > libopenjpeg/memory.h
Type make to compile. Then ranlib and copy the library and its include file to the RTEMS directory:
lm32-rtems4.11-ranlib libopenjpeg.a cp libopenjpeg.a /opt/rtems-4.11/lm32-rtems4.11/milkymist/lib cp libopenjpeg/openjpeg.h /opt/rtems-4.11/lm32-rtems4.11/milkymist/lib/include
[edit] jbig2dec
We use jbig2dec 0.11.
wget http://ghostscript.com/~giles/jbig2/jbig2dec/jbig2dec-0.11.tar.gz
You will first need to re-generate config.sub using a recent version of automake. Indeed, the steaming pile of shit that constitutes GNU/Autocrap has a hardcoded list of CPUs it would support, and lm32 isn't included with many software packages.
rm config.sub automake --add-missing
Ignore any warning about version mismatches that automake may puke out - trying to fix it actually makes the problem worse.
Run the configure script, compile and install:
CFLAGS="-O9 -Wall -mbarrel-shift-enabled \ -mmultiply-enabled -mdivide-enabled -msign-extend-enabled \ -I $RTEMS_MAKEFILE_PATH/lib/include \ -B $RTEMS_MAKEFILE_PATH/lib -specs bsp_specs -qrtems" \ ./configure --host=lm32-rtems4.11 --disable-shared --prefix=$RTEMS_MAKEFILE_PATH make make install
Again, move the include file:
mv /opt/rtems-4.11/lm32-rtems4.11/milkymist/include/* /opt/rtems-4.11/lm32-rtems4.11/milkymist/lib/include
[edit] mupdf
These instructions are known to work with mupdf 0.7.
wget http://mupdf.com/download/mupdf-0.7.tar.gz
First, compile the code generation tools natively:
gcc -o build/release/cmapdump ./mupdf/cmapdump.c -lfreetype -ljpeg -lz -lm -Ifitz gcc -o build/release/fontdump ./mupdf/fontdump.c -lfreetype -ljpeg -lz -lm -Ifitz
Then, edit Makerules and:
- comment out the two lines at the beginning setting the OS variable
- set
CC := lm32-rtems4.11-gcc
- set
CFLAGS := -Ifitz -Imupdf -Wall -O9 -Wall -mbarrel-shift-enabled -mmultiply-enabled -mdivide-enabled -msign-extend-enabled -I $(RTEMS_MAKEFILE_PATH)/lib/include -I $(RTEMS_MAKEFILE_PATH)/lib/include/freetype2 -B $(RTEMS_MAKEFILE_PATH)/lib -specs bsp_specs -qrtems
Compile the MuPDF library with:
make build=release build/release/libmupdf.a
Finally, copy the includes and binaries to the RTEMS folder:
cp fitz/fitz.h /opt/rtems-4.11/lm32-rtems4.11/milkymist/lib/include cp mupdf/mupdf.h /opt/rtems-4.11/lm32-rtems4.11/milkymist/lib/include cp build/release/libmupdf.a /opt/rtems-4.11/lm32-rtems4.11/milkymist/lib
[edit] FFMPEG
#undef __STRICT_ANSI__ #include <stdlib.h>
CFLAGS="-O9 -Wall -mbarrel-shift-enabled -mmultiply-enabled -mdivide-enabled -msign-extend-enabled -I $RTEMS_MAKEFILE_PATH/lib/include -B $RTEMS_MAKEFILE_PATH/lib -specs bsp_specs -qrtems" ./configure --cross-prefix=lm32-rtems4.11- --enable-cross-compile --target-os=none --arch=lm32 --disable-shared --disable-network --prefix=$RTEMS_MAKEFILE_PATH