Ubuntu-10.04.1下DirectFB與範例的編譯安裝、運行體驗

來源:互聯網
上載者:User

下載DirectFB與範例的源碼包:

http://directfb.org/index.php?path=Main%2FDownloads&page=0 DirectFB-1.3.0

http://directfb.org/index.php?path=Main%2FDownloads&page=1 DirectFB-examples-1.2.0

一、安裝DirectFB-1.3.0

1.下載到/huang目錄,解壓到本目錄

$sudo tar zxvf DirectFB-1.3.0.tar.gz
2.安裝

$cd DirectFB-1.3.0

$./configure

 

註:如果在./configure這步出現下面的提示:
      PNG support is missing - many applications won't work correctly!
      JPEG support is missing - many applications won't work correctly!
      FreeType2 support is missing - many applications won't work correctly!

參考解決方案:

尋找關於png方面的包:  $apt-cache search libpng

安裝尋找的相關包:      $apt-get install libpng12-dev

$apt-cache search libjpeg

$apt-get install libjpeg62-dev

$apt-cache search libfreetype

$apt-get install libfreetype6-dev

$sudo make 

$sudo make install

二、安裝DirectFB-examples-1.2.0

1.下載到/huang目錄,解壓到本目錄

$sudo tar zxvf DirectFB-examples-1.2.0.tar.gz

2.安裝

a).找到directfb.pc的路徑,讓其能找到對應的directfb。

$updatedb        -----更新資料庫
$locate directfb.pc

例如得到資訊:

/huang/DirectFB-1.3.0/directfb.pc

/huang/DirectFB-1.3.0/directfb.pc.in

/usr/local/lib/pkgconfig/directfb.pc

b)接著設定環境,將上一步得到的pkgconfig庫目錄加入環境之中:
$export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
(這樣只能在當前終端可以運行,關機後還得自已運行些命令,才能運行dfb程式,如 要永久性加入可這樣:
如你用的是root使用者,可以$vi /root/.profile中加入:
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig )

c)$cd DirectFB-examples-1.2.0

d)$./configure

e)$.sudo make

f)$sudo make install

g)指定directfb的庫目錄:
    $sudo vi /etc/ld.so.conf在最後一行加入:/usr/local/lib,儲存退出。
    $ldconfig
h)到目錄/usr/local/bin或/huang/DirectFB-examples-1.2.0/src下測試範例

$cd /huang/DirectFB-examples-1.2.0/src

$sudo df_andi        

這時,如果通過的話會得到不美觀的全螢幕顯示畫面(因為圖形system預設用fbdev引擎), 若要得到美觀的自訂的畫面在下一步給出。

注意:如果沒有通過且出現錯誤提示:

(*) DirectFB/Core: Single Application Core. 

(!) Direct/Util: opening '/dev/fb0' failed
    --> No such device
(!) DirectFB/FBDev: Error opening framebuffer device!
(!) DirectFB/FBDev: Use 'fbdev' option or set FRAMEBUFFER environment variable.
(!) DirectFB/Core: Could not initialize 'system_core' core!
    --> Initialization error!
df_andi.c <462>:
        (#) DirectFBError [DirectFBCreate( &dfb )]: Initialization error!

上面過程中可能出現framebuffer沒有啟動的問題,需要在ubuntu中配置以讓其啟動f ramebuffer支援。

參考以下方法:先重啟電腦,不行的話進行下面操作。

首先,編輯你的 /etc/initramfs-tools/modules 檔案
加入如下三行內容
fbcon
vesafb
vga16fb
最重要的一步,要把檔案/etc/modprobe.d/blacklist-framebuffer裡面的vesafb和vga16fb 這兩行給注釋掉。
這樣就可以在核心後面加入vga=xxx這樣的啟動參數了。

最好用$hwinfo --framebuffer先看一下顯卡支援的vga數值
$sudo hwinfo --framebuffer
參考:在核心後面加入了vga=0x0317,是1024x768的16位色。
最後重新整理一下代碼:
$sudo update-initramfs -u
重啟

安裝完成。

 

三、運行範例

1.建立設定檔

$sudo vi /usr/local/etc/directfbrc

寫進參考參數:

system = x11

設定使用的圖形系統為x11。預設使用Linux frame buffer (fbdev)。

wm = default   

設定視窗管理層,預設default(0)。

mode = 640x480  

設定預設的螢幕顯示。如果不設定,DirectFB將使用/etc/fb.modes 的 第一個設定 值。一些frame buffer裝置(如 vesafb)不支援模式切換,而只能使用啟動時 設 定的值。

scaled = 640x480

設定主視窗。

depth = 32

使用二進位位元設定每像素預設的像素深度。如果沒有指定,DirectFB將 使用 /etc/fb.modes 裡面的第一個指定的深度值。DirectFB支援8, 15, 16, 24和32位的顏 色深度(color depths),這些值依賴於你使用的frame buffer裝置是否支援。一些 frame  buffer裝置(如: vesafb)根本就不支援模式切換,只能使用在啟動時設定 的像素深度值。

pixelformat = RGB32

設定預設的像素格式。和上面描述的深度參數類似但允許更精細的控制。Pixelformat的值可以為LUT8, RGB332, RGB16, RGB24和RGB32。一些裝置可能還支援更奇怪的A8, ALUT44, ARGB, ARGB1555, I420, UYVY, YUY2和YV12像素格式。 

mouse-protocol = IMPS/2

為一個串口滑鼠指定使用的協議。以下的協議被支援:

MS 使用微軟滑鼠協議的兩個按鈕的滑鼠;

MS3使用擴充的微軟滑鼠協議的三按鈕滑鼠;

MouseMan使用一種Logitech開發的另一種擴充的微軟滑鼠協議的三按鈕的滑鼠;

MouseSystems 廣泛使用的三按鈕滑鼠。

串口滑鼠所使用的協議的詳細資料可參考相關資料。

bg-color = 00FFFF

控制背景的顏色。顏色的值為十六進位值。預設的alpha值為完全不透明並可能被 忽略。例如,設定背景色為紅紫色(magenta),可以使用bg-color=FF00FF。

 

具體參數可以參考http://www.directfb.org/docs/directfbrc.5.html

或http://blog.chinaunix.net/u3/104335/showart_2061486.html

或者在終端上查看

$man directfbrc

 

2.運行

$sudo df_andi

看到:

 

 (圖略)

如果這時還是得到不美觀的全螢幕顯示畫面的話,檢查x11是否已經安裝。

3.檢查x11包

$./configure  --enable-x11=yes 如果看到沒支援x11,需要安裝。

4.安裝x11

$apt-cache search x11

$apt-get install xorg-dev

5.重新運行

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.