STLinux/DirectFB 2008. 12. 9. 19:27

DirectFB Compile for sh4


1. DirectFB란?
- DirectFB란 H/W graphics 가속기능, 입력장치 handling, linux의 frame buffer 위에서 반 투명한 windows와 다중 display layer를 지원하기 위한 추상적이고 통합된 windowing system을 지원하는 가벼운 library이다.
- DirectFB는 모든 graphics 동작에 대하여 software fallbacks으로 동작하는 완전한 H/W 추상화 layer로서 H/W에 국한되지 않고 지원이 가능하다.
- DirectFB는 embedded system용으로 설계되었다.
DirectFB는 최소한의 resource와 overhead로 최대한의 H/W 가속화된 속도를 제공한다.
- DirectFB는 linux의 frame buffer를 기반으로 동작을 하기 때문에 frame buffer device는 반드시 구현이 되어 있어야 한다.

2. DirectFB를 위해 필요한 library
- Image loading
Libpng : PNG image format support
Libgif : GIF image format support
- Font rendering
FreeType2 : TrueType font 지원

3. 소스
- Libpng 1.2.5
http://www.libpng.org/pub/png/libpng.html

- Libjpeg 6b(jpeg-6b)
http://freshmeat.net/projects/libjpeg/

- FreeType2 2.1.7
http://sourceforge.net/project/showfiles.php?group_id=3157

- DirectFB 0.9.20 (현재는 1.0 이상을 쓰는것을 강추)
http://www.directfb.org/download/DirectFB/DFB++-0.9.20.tar.gz

4. porting 환경.
- Host : Fedora4
- Cross compiler : sh4 cross compiler(stlinux 2.2)
- Target CPU : sti710x-SH4 core
- Target kernel : 2.6.17.14_stm22_0039

5. compile 과정
- 반투명 windows와 graphics, True Type font를 지원하는 directFB 완성
- Libpng

참고 site
$ tar –zxvf libpng-1.2.5.tar.gz 
- 압축화일을 푼다
$ cp scripts/makefile.linux Makefile 
- 우선 linux용 makefile을 rename 한다. 
- Makefile에 다음을 추가한다.
# added by shkim for arm-linux compiler

LD=sh4-linux-ld
CC=sh4-linux-gcc
CXX=sh4-linux-g++
RANLIB=sh4-linux-ranlib
AR=sh4-linux-ar
OBJDUMP=sh4-linux-objdump
OBJCOPY=sh4-linux-objcopy
CROSSCOMPILE=/opt/STM/STLinux-2.2/devkit/target_full/bin
CROSS_EXTRADIR=/opt/STM/STLinux-2.2/devkit/target_full/usr
LIBRARY_PATH/opt/STM/STLinux-2.2/devkit/target_full/lib
C_INCLUDE_PATH/opt/STM/STLinux-2.2/devkit/target_full/usr/include
CPLUS_INCLUDE_PATH=/opt/STM/STLinux-2.2/devkit/target_full/usr/include
ZLIBLIB/opt/STM/STLinux-2.2/devkit/target_full/usr/lib
ZLIBINC/opt/STM/STLinux-2.2/devkit/target_full/usr/include

$ make clean
$make all prefix=/usr/imglib 
- png library compile

$ make install prefix=/usr/imglib 
- library를 install 한다.

- Libjpeg
$ ./ltconfig --with-gcc --with-gnu-ld ltmain.sh
$ ./configure --prefix=/opt/STM/STLinux-2.2/devkit/target_full/usr/imglib --enable-shared --target=sh4-linux
- compiler & linker를 설정한다. 
- compile 환경을 설정한다. 
- Makefile에 다음을 추가 한다.
CC=sh4-linux-gcc
LD=sh4-linux-ld
AR=sh4-linux-ar
$ make clean
$ make 

- jpeg library compile
$ make install

- FreeType2
$ DESTDIR=/usr/imglib ./configure --prefix=/usr/imglib --build=i386-linux --host=sh4-linux
$ make clean
$ make
$ make install

- DirectFB
$ LDFLAGS=-L/usr/imglib/lib ./configure --prefix=/usr/imglib --with-gfxdrivers=st --enable-sdl=no --disable-debug --disable-joystick --disable-cdrom --enable-shared --build=i386-linux --host=sh4-linux 
$ make clean
$ make
$ make install
$ PKG_CONFIG_PATH=/usr/imglib/lib/pkgconfig
$ export PKG_CONFIG_PATH

- DirectFB Example
LDFLAGS=-L/usr/imglib/lib ./configure --prefix=/usr/imglib --with-gfxdrivers=st --enable-sdl=no --disable-debug --disable-joystick --disable-cdrom --enable-shared --build=i386-linux --host=sh4-linux
$ make clean
$ make
$ make install 
STLinux/DirectFB 2008. 12. 1. 13:35

DirectFB 1.0.1 For SH4

1. stlinux 사이트에서 DirectFB 1.0.1을 다운
2. 압축을 해제하면 소스와 함께 *.patch 파일들이 나온다
3. patch 폴더를 생성후 *.patch 파일들을 옮겨놓는다
4. DirectFb1.0.1 폴더로 이동후 다음의 패치 커맨드를 실행
5. for i in ./../patch/*.patch; do patch -p0 -v < "$i"; done