Chinaunix首页 | 论坛 | 博客
  • 博客访问: 173172
  • 博文数量: 44
  • 博客积分: 2762
  • 博客等级: 少校
  • 技术积分: 520
  • 用 户 组: 普通用户
  • 注册时间: 2010-10-04 19:19
文章分类
文章存档

2011年(28)

2010年(16)

我的朋友

分类: LINUX

2011-11-08 08:54:41

 

 

ArmadilloでDirectFBを動かしてみましょう。
DirectFBとは、Linux Frame Buffer上で動作するGraphics APIです。
DirectFB上で動作することができるアプリケーションも色々とあるようです。

  • DFBTerm(ターミナルソフト)
  • DirectVNC(VNCクライアント)

などがあります。

今回のDirectFBの動作確認には、Input Deviceの確認やベンチマークテストまで含まれているDirectFB-examplesを使用してみます。

1. ソースコードの取得

ソースコードは、から取得します。
以下のようにコマンドを入力して取得してください。

  1. [PC ~]$ mkdir directfb
  2. [PC ~]$ cd directfb
  3. [PC ~/directfb]$ wget
  4. [PC ~/directfb]$ wget
続いてアーカイブを展開していきます。
  1. [PC ~/directfb]$ tar zxvf DirectFB-1.0.1.tar.gz
  2. [PC ~/directfb]$ tar zxvf DirectFB-examples-1.0.0.tar.gz
  3. [PC ~/directfb]$ ls
  4. DirectFB-1.0.1 DirectFB-examples-1.0.0
  5. DirectFB-1.0.1.tar.gz DirectFB-examples-1.0.0.tar.gz
2. 準備

DirectFBのクロスビルドには、様々なクロス開発パッケージが必要となってきます。
弊社で提供しているパッケージの他に、次のパッケージをインストールしておきます。

 

 

  1. libfreetype6-arm-cross
  2. libfreetype6-dev-arm-cross
  3. libjpeg62-arm-cross
  4. libjpeg62-dev-arm-cross
  5. libpng12-0-arm-cross
  6. libpng12-dev-arm-cross

 

パッケージの作成についての詳細は、「」を参照してください。

また、通常(ホスト用)のlibfreetype6-devパッケージがインストールされているとDirectFBのビルドがよりスムースに行きます。以下のようにインストールしてください。

  1. [PC ~/directfb]$ sudo apt-get install libfreetype6-dev

次にビルドスクリプトを取得してください。

 

  1. [PC ~/directfb]$ wget
  2. [PC ~/directfb]$ wget
  3. [PC ~/directfb]$ wget

 

スクリプトを実行可能にします。

 

  1. [PC ~/directfb]$ chmod 755 build-directfb-for-arm.sh
  2. [PC ~/directfb]$ chmod 755 prepare-directfb-example-for-arm.sh
  3. [PC ~/directfb]$ chmod 755 install-directfb-for-arm.sh

 

DirectFBとDirectFB-examplesのディレクトリ名を変更します。

 

  1. [PC ~/directfb]$ mv DirectFB-1.0.1 DirectFB
  2. [PC ~/directfb]$ mv DirectFB-examples-1.0.0 DirectFB-examples

 

  1. [PC ~/directfb]$ ls
  2. DirectFB build-directfb-for-arm.sh
  3. DirectFB-1.0.1.tar.gz install-directfb-for-arm.sh
  4. DirectFB-examples prepare-directfb-example-for-arm.sh
  5. DirectFB-examples-1.0.0.tar.gz
 

これで準備は完了です。

3. DirectFBのビルド

DirectFBのビルドを行っていきましょう。build-directfb-for-arm.shスクリプトを使って行います。

 

 

  1. [PC ~/directfb]$ ./build-directfb-for-arm.sh
  2. :
  3. :
  4. ----
  5. Configuring directfb ...
  6. ----
  7. :
  8. :
  9. ----
  10. Making directfb ... (will take some time)
  11. ----
  12. :
  13. :
  14. ----
  15. Installing directfb to temp directory ...
  16. ----
  17. :
  18. :
  19. /usr/bin/install -c -m 644 'directfb.pc' '/home/hoge/directfb/DirectFB/install/usr/local/lib/pkgconfig/directfb.pc'
  20. /usr/bin/install -c -m 644 'directfb-internal.pc' '/home/hoge/directfb/DirectFB/install/usr/local/lib/pkgconfig/directfb-internal.pc'
  21. make[2]: ディレクトリ `/home/hoge/directfb/DirectFB' から出ます
  22. make[1]: ディレクトリ `/home/hoge/directfb/DirectFB' から出ます
  23. make: ディレクトリ `/home/hoge/directfb/DirectFB' から出ます
  24. [PC ~/directfb]$

 

4.DirectFB-examplesの準備

次はDirectFB-examplesの準備です。
prepare-directfb-example-for-arm.shスクリプトを使います。

 

  1. [PC ~/directfb]$ ./prepare-directfb-example-for-arm.sh
  2. ----
  3. Configuring directfb examples ...
  4. ----
  5. :
  6. :
  7. config.status: creating src/Makefile
  8. config.status: creating src/df_knuckles/Makefile
  9. config.status: creating src/df_neo/Makefile
  10. config.status: creating src/spacedream/Makefile
  11. config.status: executing depfiles command
  12. [PC ~/directfb]$

 

5. インストールアーカイブの作成

install-directfb-for-arm.shスクリプトを使用してアーカイブを作成します。

 

  1. [PC ~/directfb]$ ./install-directfb-for-arm.sh
  2. ----
  3. install: directfb --> add-to-rootfs
  4. ----
  5. ----
  6. install: directfb examples --> add-to-rootfs
  7. ----
  8. :
  9. :
  10. ----
  11. install: setup script --> add-to-rootfs
  12. ----
  13. ----
  14. archive: add-to-rootfs --> add-to-rootfs.tar.gz
  15. ----
  16. [PC ~/directfb]$ ls
  17. DirectFB DirectFB-examples-1.0.0.tar.gz build-directfb-for-arm.sh
  18. DirectFB-1.0.1.tar.gz add-to-rootfs install-directfb-for-arm.sh
  19. DirectFB-examples add-to-rootfs.tar.gz prepare-directfb-example-for-arm.s

 

ここで作成された「add-to-rootfs.tar.gz」がインストールアーカイブとなります。

6. カーネルの変更

Armadillo-240の場合、カーネルのコンフィグレーションでフレームバッファのコンソールサポートを有効にします。

※今回はlinux-2.6.12.3-a9-11を使用することとします。

 

  1. Device Drivers --->
  2. Character devices --->
  3. [*] Virtual terminal
  4. Graphics support --->
  5. Console display driver support --->
  6. [ ] VGA text console
  7. < > MDA text console (dual-headed) (EXPERIMENTAL)
  8. <*> Framebuffer Console support
  9. [*] Select compiled-in fonts
  10. [*] VGA 8x8 font
  11. [*] VGA 8x16 font

 

コンソールサポートを有効にすることによって、Armadillo-240のカーネルイメージのサイズが大きくなり過ぎて、フラッシュメモリに保存できなくなる可能性があります。フラッシュメモリのカーネルリージョンを拡張するには、「」を参考にしてください。

Armadillo-9でマウスを使う場合は、以下のように設定する必要があります。

 

  1. Device Drivers -->
  2. Input device support -->
  3. --- Userland interface
  4. <*> Event interface

 

7. イメージの作成

カーネルの設定を変更したら、イメージの作成を行います。
※イメージの作成方法は等を参照してください。

 

  1. [PC ~]$ ls
  2. atmark-dist-20071018 directfb linux-2.6.12.3-a9-11
  3. [PC ~]$ cd atmark-dist-20071018
  4. [PC ~/atmark-dist-20071018]$ make

 

次にデフォルトのromfsディレクトリに先ほど作成したadd-to-rootfs.tar.gzを展開します。

そして再度イメージを作成しなおします。

 

  1. [PC ~/atmark-dist-20071018]$ cd romfs
  2. [PC ~/atmark-dist-20071018/romfs]$ tar zxvf ../../directfb/add-to-rootfs.tar.gz
  3. [PC ~/atmark-dist-20071018/romfs]$ cd ..
  4. [PC ~/atmark-dist-20071018]$ make romfs image
  5. [PC ~/atmark-dist-20071018]$ ls images
  6. linux.bin linux.bin.gz romfs.img romfs.img.gz

 

作成したlinux.bin.gzとromfs.img.gzをArmadilloに書き込みます。

8. 動作確認

イメージの書き込みが終わったら、Armadilloを起動させログインしましょう。
ログイン後、次のコマンドを入力し、setupさせます。

 

  1. [armadillo ~]# ./directfb_setup.sh

 

これでDirectFBが動作する環境は整いました。

df_windowを実行したときの画面です。

df_window画面

df_dokでベンチマークを実行した結果です。

 

  1. [armadillo ~]# df_dok
  2. =======================| DirectFB 1.0.1 |=======================
  3. (c) 2001-2007 The DirectFB Organization (directfb.org)
  4. (c) 2000-2004 Convergence (integrated media) GmbH
  5. ------------------------------------------------------------
  6. :
  7. :
  8. Benchmarking with 256x256 in 16bit mode... (16bit)
  9. Anti-aliased Text 3.135 secs ( 26.411 KChars/sec)
  10. Anti-aliased Text (blend) 3.145 secs ( 4.578 KChars/sec)
  11. Fill Rectangle 3.054 secs ( 32.188 MPixel/sec)
  12. Fill Rectangle (blend) 7.168 secs ( 0.914 MPixel/sec)
  13. Fill Rectangles [10] 4.028 secs ( 32.540 MPixel/sec)
  14. Fill Rectangles [10] (blend) 71.168 secs ( 0.920 MPixel/sec)
  15. Fill Triangles 3.127 secs ( 25.149 MPixel/sec)
  16. Fill Triangles (blend) 3.611 secs ( 0.907 MPixel/sec)
  17. Draw Rectangle 3.015 secs ( 2.918 KRects/sec)
  18. Draw Rectangle (blend) 3.208 secs ( 0.436 KRects/sec)
  19. Draw Lines [10] 3.017 secs ( 10.938 KLines/sec)
  20. Draw Lines [10] (blend) 3.473 secs ( 2.015 KLines/sec)
  21. Fill Spans 3.172 secs ( 28.925 MPixel/sec)
  22. Fill Spans (blend) 7.204 secs ( 0.909 MPixel/sec)
  23. Blit 3.277 secs ( 15.999 MPixel/sec)
  24. Blit colorkeyed 3.737 secs ( 7.014 MPixel/sec)
  25. Blit destination colorkeyed 5.151 secs ( 2.544 MPixel/sec)
  26. Blit with format conversion 5.700 secs ( 2.299 MPixel/sec)
  27. Blit with colorizing 4.378 secs ( 1.496 MPixel/sec)
  28. Blit from 32bit (blend) 5.747 secs ( 1.140 MPixel/sec)
  29. Blit from 32bit (blend) with colorizing 13.146 secs ( 0.498 MPixel/sec)
  30. Stretch Blit 4.658 secs ( 13.926 MPixel/sec)
  31. Stretch Blit colorkeyed 11.735 secs ( 5.527 MPixel/sec)

 

 
阅读(1951) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~