2010年5月31日 星期一

Broadcom Crystal HD for Linux

1.Compile procdure

unzip crystalhd_linux_20091229.zip


cd crystalhd

cd driver/linux

fromdos ./*
autoconf

$ ./configure
checking for ld... ld
configure: creating ./config.status
config.status: creating ./Makefile

$ make
make -C /lib/modules/2.6.32-22-generic/build SUBDIRS=/home/steve/crystalhd/driver/linux modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-22-generic'
  CC [M]  /home/steve/crystalhd/driver/linux/crystalhd_lnx.o
  CC [M]  /home/steve/crystalhd/driver/linux/crystalhd_misc.o
  CC [M]  /home/steve/crystalhd/driver/linux/crystalhd_cmds.o
  CC [M]  /home/steve/crystalhd/driver/linux/crystalhd_hw.o
  LD [M]  /home/steve/crystalhd/driver/linux/crystalhd.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/steve/crystalhd/driver/linux/crystalhd.mod.o
  LD [M]  /home/steve/crystalhd/driver/linux/crystalhd.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-22-generic'

$chmod 755 bcm_70012_dev.sh bcm_70012_run.sh

$ sudo make install
[sudo] password for steve:
install -d /lib/modules/2.6.32-22-generic/kernel/drivers/video/broadcom
install -m 0644 crystalhd.ko /lib/modules/2.6.32-22-generic/kernel/drivers/video/broadcom
/sbin/depmod -a

cd ../../linux_lib/libcrystalhd

fromdos ./*

$ make
OBJFILES = libcrystalhd_if.o libcrystalhd_int_if.o libcrystalhd_fwcmds.o libcrystalhd_priv.o libcrystalhd_fwdiag_if.o
SRCFILES = libcrystalhd_if.cpp libcrystalhd_int_if.cpp libcrystalhd_fwcmds.cpp libcrystalhd_priv.cpp libcrystalhd_fwdiag_if.cpp
LNM = libcrystalhd.so.1.0 libcrystalhd.so.1
g++  -D__LINUX_USER__ -I./ -I/usr/include -I../../include -I../../include/link -g -Wall -fPIC -shared  -c -o libcrystalhd_if.o libcrystalhd_if.cpp
libcrystalhd_if.cpp: In function ‘BC_STATUS DtsProcInput(void*, uint8_t*, uint32_t, uint64_t, BOOL)’:
libcrystalhd_if.cpp:1340: warning: format not a string literal and no format arguments
libcrystalhd_if.cpp:1346: warning: format not a string literal and no format arguments
libcrystalhd_if.cpp:1366: warning: format not a string literal and no format arguments
g++  -D__LINUX_USER__ -I./ -I/usr/include -I../../include -I../../include/link -g -Wall -fPIC -shared  -c -o libcrystalhd_int_if.o libcrystalhd_int_if.cpp
g++  -D__LINUX_USER__ -I./ -I/usr/include -I../../include -I../../include/link -g -Wall -fPIC -shared  -c -o libcrystalhd_fwcmds.o libcrystalhd_fwcmds.cpp
g++  -D__LINUX_USER__ -I./ -I/usr/include -I../../include -I../../include/link -g -Wall -fPIC -shared  -c -o libcrystalhd_priv.o libcrystalhd_priv.cpp
libcrystalhd_priv.cpp: In function ‘BC_STATUS DtsDeleteMdataPool(DTS_LIB_CONTEXT*)’:
libcrystalhd_priv.cpp:579: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 2 has type ‘uintptr_t’
g++  -D__LINUX_USER__ -I./ -I/usr/include -I../../include -I../../include/link -g -Wall -fPIC -shared  -c -o libcrystalhd_fwdiag_if.o libcrystalhd_fwdiag_if.cpp
g++ -D__LINUX_USER__ -I./ -I/usr/include -I../../include -I../../include/link -g -Wall -fPIC -shared -Wl,-soname,libcrystalhd.so.1 -o libcrystalhd.so.1.0 libcrystalhd_if.o libcrystalhd_int_if.o libcrystalhd_fwcmds.o libcrystalhd_priv.o libcrystalhd_fwdiag_if.o
ln -sf libcrystalhd.so.1.0 libcrystalhd.so
ln -sf libcrystalhd.so.1.0 libcrystalhd.so.1

$ chmod 755 ln-libcrystalhd.sh

$ sudo make install
install -m 755 libcrystalhd.so.1.0 /usr/lib
(cd /usr/lib; ln -sf libcrystalhd.so.1.0 libcrystalhd.so)
(cd /usr/lib; ln -sf libcrystalhd.so.1.0 libcrystalhd.so.1)

cd ../../filters/gst/gst-plugin

fromdos ./*

chmod 755 autogen.sh autoregen.sh gst-autogen.sh

Fix src/Makefile.am
Change this line
INCLUDES += -I$(ROOTDIR)/linux_lib/ldil
to
INCLUDES += -I$(ROOTDIR)/linux_lib/libcrystalhd

Change this line
BCMDEC_LDFLAGS = -L$(ROOTDIR)/linux_lib/ldil -lcrystalhd
to
BCMDEC_LDFLAGS = -L$(ROOTDIR)/linux_lib/libcrystalhd -lcrystalhd

Modify src/decif.h
Change this line
#include "bc_ldil_if.h"
to
#include "libcrystalhd_if.h"

$ ./autogen.sh
+ check for build tools
  checking for autoconf >= 2.52 ... found 2.65, ok.
  checking for automake >= 1.7 ... found 1.11.1, ok.
  checking for libtoolize >= 1.5.0 ... found 2.2.6b, ok.
  checking for pkg-config >= 0.8.0 ... found 0.22, ok.
+ checking for autogen.sh options
  This autogen script will automatically run ./configure as:
  ./configure --enable-maintainer-mode --enable-debug
  To pass any additional options, please specify them on the ./autogen.sh
  command line.
+ running aclocal -I m4/ ...
+ running libtoolize --copy --force...
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
+ running autoheader ...
+ running autoconf ...
+ running automake -a -c...
+ running configure ...
  ./configure default flags: --enable-maintainer-mode --enable-debug
...
...

$make

$sudo make install

2.Run test program

$ cd crystalhd/driver/linux
$ sudo ./bcm_70012_run.sh
[sudo] password for steve:
Stopping Broadcom Crystal HD (BCM70012) Module
Broadcom Crystal HD (BCM70012) Module loaded

$ cd ../../examples
$ ./hellobcm
starting up
Running DIL (0.9.25) Version
Mdata Pool Created...
DtsSetupHardware: DtsPushAuthFwToLink
DtsGetFirmwareFiles:Ctx->FwBinFile is /lib/firmware/bcmFilePlayFw.bin
DtsSetupHardware: Success
ADD buffs
ADD buffs
ADD buffs
ADD buffs
ADD buffs
ADD buffs
ADD buffs
ADD buffs
DbgOptions=b0000025
try calls done
file opened successfully
Input Buffer: 0x9339b20
Aligned Input Buffer: 0x9339b20, Offset = 0
Y Buffer: 0xb532f008
FormatCh: Width: 1920 Height: 1080 Res:e
Dtsprocout:update stats
Format Change Detected. Flags: 0x00030004
New Format
----------------------------------
    TimeStamp: 0
    Picture Number: 0
    Width: 1920
    Height: 1080
    Chroma: 0x420
    Pulldown: 9
    Flags: 0x00000000
    Frame Rate/Res: 14
    Aspect Ratio: 1
    Color Primaries: 2
    MetaData: 0
    Session Number: 0
    TimeStamp: 0
    Custom Aspect: 0
    Frames to Drop: 0
    H264 Valid Fields: 0x00000000
DtsProcOutput: Failed to copy out buffs.. f
I/O Transfer Error.
Invalid PIB received. Skipping picture. Flags: 0x00000004
Received Output. Bytes In: 262144, Y: 1038720, UV: 0, Number: 3, H: 1080, W: 1920, Flags: 0x00020004
Received Output. Bytes In: 327680, Y: 1038720, UV: 0, Number: 4, H: 1080, W: 1920, Flags: 0x00020004
Received Output. Bytes In: 393216, Y: 1038720, UV: 0, Number: 5, H: 1080, W: 1920, Flags: 0x00020004
...
...
...

3.XBMC support

Download XBMC source code and enable CrystalHD support then build.
It works great ...

PS : Do not get xbmc form apt...

4.Gstreamer plug-in
The Crystal HD gstreamer plug-in is bcmdec
In fact, it's not work ...

$ gst-launch playbin2 uri=file:///home/steve/video.mp4
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Running DIL (0.9.25) Version
Mdata Pool Created...
DtsSetupHardware: DtsPushAuthFwToLink
DtsGetFirmwareFiles:Ctx->FwBinFile is /lib/firmware/bcmFilePlayFw.bin
DtsSetupHardware: Success
OPEN success

Then nothing happen ...

依據以下的link做修改, Crystal HD gstreamer plug-in works
http://git.wilsonet.com/crystalhd.git/?a=blobdiff;f=filters/gst/gst-plugin/src/gstbcmdec.c;h=c321e27bba831bf99197f75454e7dde8ec36d78a;hp=1fd2eccc23d753d047b20bc076377ebcb57c4838;hb=1f293c968e5ab8dad3ad0c3ceefa91cbb1bcce63;hpb=a8e27b2203eb2c1f0266176f5c70d8c5b6102c76

totem 播放mp4 h.264 with Crystal HD works






2010年5月21日 星期五

GIT 雜七雜八的問題及解決

1.其他人push過後就不能push了

gigijoe@gigijoe-desktop:~/DSPG8181$ git push
To git@localhost:DSPG8181.git
 ! [rejected]        HEAD -> master (non-fast forward)
error: failed to push some refs to 'git@localhost:DSPG8181.git'

也不能pull了

gigijoe@gigijoe-desktop:~/DSPG8181$ git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.master.merge' in
your configuration file does not tell me either.    Please
specify which branch you want to merge on the command line and
try again (e.g. 'git pull ').
See git-pull(1) for details.

If you often merge with the same branch, you may want to
configure the following variables in your configuration
file:

    branch.master.remote =
    branch.master.merge =
    remote. .url =
    remote. .fetch =

See git-config(1) for details.

git config branch.master.remote origin
git config branch
.master.merge refs/heads/master
git checkout master
git reflog
git pull
git push

另一個解法(沒試過)

git pull origin master

2.沒事整理一下
git fsck --full

3.維護資料庫 (會跑一陣子,用很多記憶體)
git gc


2010年5月5日 星期三

GIT Server 架設 (使用gitosis)

參考資料
http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way

http://ao2.it/wiki/How_to_setup_a_GIT_server_with_gitosis_and_gitweb

http://blog.agdunn.net/?p=277

以參考資料其實很容易就能把git server搞定.
這邊就只紀錄一下流程

< Server Side >

git clone git://eagain.net/gitosis.git

cd gitosis/

sudo apt-get install python-setuptools
sudo python setup.py install

sudo adduser --system --shell /bin/sh --gecos 'git version control' --group --disabled-password --home /home/git git

請由 Local Side 產生KEY id_rsa.pub 並存放到 Server Side

ssh-keygen -t rsa

會在$HOME/.ssh/ 產生 id_rsa  id_rsa.pub

複製到Server Side /tmp

sudo -H -u git gitosis-init < /tmp/id_rsa.pub
sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update

< Local Side >

gitosis運用相當巧妙的方式管理git server.
gitosis 本身就是git server中的project.所以必須先從local side取出gitosis的副本.
透過編輯這個副本並上傳來管理所有的user & project.

git clone git@192.168.168.70:gitosis-admin.git

cd gitosis-admin

編輯gitosis.conf

增加一個新的Repository,格式如下

[group $REPOSITORY]
writable = $PROJECT
members = $USER

Commit new repository

git commit -a -m "New Repository"

git push

結果有Warning如下

warning: You did not specify any refspecs to push, and the current remote
warning: has not configured any push refspecs. The default action in this
warning: case is to push all matching refspecs, that is, all branches
warning: that exist both locally and remotely will be updated.  This may
warning: not necessarily be what you want to happen.
warning:
warning: You can specify what action you want to take in this case, and
warning: avoid seeing this message again, by configuring 'push.default' to:
warning:   'nothing'  : Do not push anything
warning:   'matching' : Push all matching branches (default)
warning:   'tracking' : Push the current branch to whatever it is tracking
warning:   'current'  : Push the current branch
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 386 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@192.168.168.70:gitosis-admin.git
   1cfd916..4f2becf  master -> master

我找到的解決方式是

git config --add push.default current

到這邊基礎的設定已經完成,接著要實際將project同步到git server

首先到project source code目錄下

cd S3C6410

git init
git remote add origin git@192.168.168.70:s3c6410.git

將希望的目錄加入

git add android_kernel_smdk6410

git commit

實際將資料上傳

git push origin master:refs/heads/master

會看到以下的message

gigijoe@gigijoe-laptop:~/S3C6410$ git push origin master:refs/heads/master
Counting objects: 22134, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (21762/21762), done.
Writing objects: 100% (22134/22134), 233.26 MiB | 2374 KiB/s, done.
Total 22134 (delta 2456), reused 0 (delta 0)
To git@192.168.168.70:s3c6410.git
 * [new branch]      master -> master
gigijoe@gigijoe-laptop:~/S3C6410$

< Local Side >

新增user 的方式
進入gitosis-admin目錄中編輯
gitosis.conf.加入$USER1

[group $REPOSITORY]
writable = $PROJECT
members = $USER $OTHER_USER

接著由user產生key並將id_rsa.pub並重新命名擺放到
keydir/$USER1.pub

把檔案加入gitosis
git add keydir/$USER1.pub

更新並上傳
git commit
git push

之後就可以用 git clone 的方式取得 project

< Log >

gigijoe@gigijoe-laptop:~/gitosis-admin$ ls keydir/
gigijoe@gigijoe-desktop.pub  gigijoe@gigijoe-laptop.pub
gigijoe@gigijoe-laptop:~/gitosis-admin$ git add keydir/gigijoe@gigijoe-desktop.pub
gigijoe@gigijoe-laptop:~/gitosis-admin$ git commit
[master 82a65c0] Add gigijoe@gigijoe-desktop
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 keydir/gigijoe@gigijoe-desktop.pub
gigijoe@gigijoe-laptop:~/gitosis-admin$ git push
Counting objects: 6, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 711 bytes, done.
Total 4 (delta 0), reused 0 (delta 0)
To git@192.168.168.70:gitosis-admin.git
   d45919f..82a65c0  HEAD -> master