media streaming with upnp and mpeg-7 in embedded linux system hsu shih-chang dcnlab @ csie, ncku

24
Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

Post on 21-Dec-2015

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

Media Streaming with UPnP and MPEG-7 in Embedded Linux System

Hsu Shih-ChangDCNLAB @ CSIE, NCKU

Page 2: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

Outline

Target board Building Embedded OS Problems

Page 3: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

Target board StrongARM

Page 4: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

Target board(contd.)

DMA-ARM9 2410

Page 5: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

Target board(contd.)

Intel Strong-ARM DMA-ARM9 2410

CPU INTEL StrongARM SA-1110/206MHz、 32bit processors( RISC)

32-bit ARM920T 核心

Memory 32MB on board( one 144pins SODIMM for Expansion)

64Mbyte( 32Mbyte×2)

Flash Memory

32MB ( Two PLCC Sockets for Expansion)

NAND FLASH ( K9S1208, 64M)NOR FLASH( SST39VF160, 2M)

Display 3.9”彩色反射觸控式 TFT LCD( 240*320)

SAMSUNG 3.5 吋 256K色 TFT (320*240)

Page 6: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

Target board(contd.)

Intel Strong-ARM DMA-ARM9 2410

USB 1個 2個PC MCIA/CF card 應用介面

YES (16bit Flash Slot)

NO

Audio 16bit立體音頻、錄放及外接電話;IN/OUT*1 Line

IIS 數位音效輸入 / 輸出介面

Radio CDMA/GSM/Bluetooth Module

其他 6 個 Expansion Slots / 1rDA / FIR ( up to 4 Mbps);4 個 LED ;Real Time Clock: 32.768KHz ;9 個板上按鍵 ;Support for PC/ATX Power Supply

BOOT ROM : SST39VF160 ;2 通道 UART ;SD 卡 /MMC 卡 HOST ;Embedded-ICE Debug 介面 ;16 個板上按鍵 ;10M 乙太網介面 ;RTC 即時時鐘

Page 7: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

Building Embedded OS Building Flow

Cross-Development

Environment

Kernel

File System

Network

The Basic Operations

on Strong ARM

Application

Page 8: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

Cross-Development Environment

一般來說,開發嵌入式系統的環境都會分為 Host 端以及 Target 端,而所謂的 Host 端就是我們所使用的 PC,而 Target 端就是我們所要開發版。為了能夠在 Host端編譯出能在 Target 端執行的指令,因此我們就會用所謂的 Cross-Compiler 來編譯我們的程式。

version : cross-2.95.3.tar.bz2

Page 9: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

Kernel 一個 Kernel 就是一個最簡單的 OS,主要是用來控制

硬體系統的,換句話說,如果你的 kernel 並沒有支援某項硬體設備,那麼該硬體也就無法在這樣的核心底下工作了。

version : linux-2.4.0-test11.tar.gz patch-2.4.0-test11-rmk1.tar.gz

diff-2.4.0-test11-rmk1-np3.gz patch-2.4.0-test11-rmk1-np3 (Provide by MasterIA)

Page 10: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

File System 當 Kernel 建構完畢後,我們還需要一些常用的工具程

式,例如 ls、 mount…等等的工具。然而,我們現在所發展的是嵌入式系統,所以需要兼具便利與低容量的使用,其中 BusyBox 便是個不錯的選擇。

而, Busybox 為何能夠佔有如此小的容量,卻能提供為數不少的常用工具呢?這訣竅在於 busybox 在編譯後,雖然整體只是一個執行檔,卻可以透過 symbolic link 的方式,將常用指令 (Busybox 的術語是 “ applet”) 「連」到 busybox 這個執行檔上。

version: busybox-1.00.tar.gz

Page 11: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

File System(contd.)

/bin

Page 12: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

File System(contd.)

Page 13: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

File System(contd.)

Page 14: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

File System(contd.)

有了 busybox 的常用工具後,要完成一個基本的 File System 還需要下列步驟 :

※先建立一個空的 filesystem 映像檔。 dd if=/dev/zero of=initrd.img bs=1k count=8192 ※在該檔案上作一的 ext2 的 filesystem 。 /sbin/mkfs.ext2 –F –v –m0 initrd.img ※建立相關的目錄結構。

mkdir etc/ proc/ dev/ var/ mnt/ tmp/ lib/ ※進入 dev 目錄,建立驅動程式的主要機碼與次要機碼

cd dev mknod

Page 15: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

Network CF 有線網路之驅動 version : pcmcia-cs-3.2.7.tar.gz Step : cd pcmcia-cs-3.2.7 make config make 修改檔案 (config.opts 、 config 、 network.opts ) 複製 route 檔到我們剛剛開啟的 ../FileSystem/sbin/ 複製相關的 lib 檔到 ram_image/lib 下 ( 可用 arm-linux-strip 降低 li

b 大小 ) /etc/rc.d/rc.pcmcia start

Page 16: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

Network(contd.)

CF 無線網路之驅動 version : pcmcia-cs-3.2.7.tar.gz linux-wlan-ng-0.2.0.tar.gz Step : 必須先對 pcmcia-cs-3.2.7.tar.gz configure 再對 linux-wlan-ng-0.2.0.tar.gz 做 configure make all install 擷取所需的檔案至 filesystem 修改 module 定義 及 啟動驅動程式的 script 檔 在版子上即可載入無線網卡的 module (ex: insmod [/prefix]/p80211.o) /etc/rc.d/init.d/pcmcia stop /etc/rc.d/init.d/pcmcia start

Page 17: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

Application UPnP SDK version : Apache Xerces-c++-2.5.0 CyberLink C++ UPnP SDK-1.5 step : 設定環境變數 (export ) configure ( 設定 for x86 或是 for arm)

Page 18: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

Application(contd.)

QT 在 make QTE for arm 之前,必須先 make QTE for x86 因為我們需

要 make 完後檔案夾裡面的 uic 檔案,才能將 QTE 成功的 make for arm

version : qt-embedded-3.3.4 Make qte for x86 進入資料夾並設定環境變數 編譯 Make qte for arm 進入資料夾並設定環境變數 ( 與 for x86 指令不同 ) 將 qte for x86 裡的 bin/uic 覆蓋掉這個資料夾的 bin/uic 編譯 編譯成功後便可將資料夾底下的 lib 放置在目標板上

Page 19: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

The Basic Operations on Strong ARM

Tools: puppy.tar.gz ( 包含 bin2rom,ethload) Step: 設定 minicom (minicom -s) 將檔案轉換為可以 download 到 StrongARM 版子的格式 (./bin2ro

m) 執行 TFTP Server(./ethload) 即可將我們的檔案燒至 Flash or Ram

Page 20: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

Problems-MTD

使用 ext2 格式的 file system 時,會有 8MB 大小的限制。 解決方式 : 使用 cramfs 這種格式來建立 file system ,並使用 MTD

來將此格式的 file system 燒到版子上。 Step: 1. 進入版子的環境後,利用 nfs 將 xxx.cramfs 燒到版子上 cat /mnt/nfs/xxx.cramfs > /dev/mtdblock/2 2. 燒完 kernel 後,在 minicom 內直接選 6執行,此時便會將先前燒

到 flash 的 root.cramfs 當作版子上的 file system 。

Page 21: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

Problems- Write and Read FS

當我們執行我們的 client 時,會發現無法看圖片及視訊影像。

問題來源: 要看圖片時會將圖片先下載至我們的 File System 中,而看視訊

時亦是先將 capture.sdp 這個檔案先下載下來再進行播放。因此,我們的問題在於無法將檔案下載至執行檔所在目錄。這是因為我們執行 dcnplayer 的目錄是 mount mtdblock 的目錄,而我們放在mtdblock 內的檔案是 cramfs 的格式,故無法將檔案寫入,因此無法下載檔案。

Ex : mount /dev/mtdblock/2 /mnt 將 MTD mount 到 /mnt 下,因為 MTD 為唯讀,因此 /mnt 這個

目錄 也是唯讀。

Page 22: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

Problems- Write and Read FS (contd.)

解決方法:我們將 dcnplayer 在我們的 ext2 格式的 File System 內建一個連

結,如下: ln –s /mnt/dcnplayer /home/dcnplayer cd /home ./dcnplayer -qws

如此一來,我們就可以將我們所需的檔案下載至 home 的目錄下,這樣就不會出現錯誤了。

Page 23: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

Problem- Voice

播放影片時沒有聲音。 解決方法: 要播放有關音效的檔案,必須建構相關的設備檔,如

audio0 等,而其相關的 major number 及 minor number 經由參閱廠商所附的 File System 內的 dev

目 錄而得。

Page 24: Media Streaming with UPnP and MPEG-7 in Embedded Linux System Hsu Shih-Chang DCNLAB @ CSIE, NCKU

Problem- Touch Panel

無法使用觸控板。 解決方法: 要使用 Strong Arm 的 touch panel ,需要新增 h3600_ts 與 h3600_key 這兩個設備檔: mknod h3600_ts c 11 0 mknod h3600_key c 11 0