2009年8月28日 星期五

* ubuntu mplayer using fbdev

reference http://forum.ubuntu.org.cn/viewtopic.php?f=74&t=118666

#mplayer -vo help
#mplayer -vo fbdev /media/sda7/else/lian.flv

#mplayer -vo fbdev -vf scale=1024:768 video_file.avi
-vo fbdev 是告诉mplayer用framebuffer作视频驱动.
-vf scale=1024:768 是全屏的方法,可按屏幕的具体情况作调整
用fbxine的话需要下载:
# apt-get install xine-console

picture
# apt-get install fbi
用这个软件包里的fbi可以浏览图片,fbgs可以观看pdf文件:
# fbi -a *jpg
# fbgs -c *pdf

2009年8月27日 星期四

* ubuntu command "mksquashfs"

#cd /scratchbox
#mksquashfs . /scratchbox.squashfs -b 65536
#mkdir scratchbox.base

//only for test,this is base layer and squashfs only support read mode

#mount -t squashfs -oloop scratchbox.squashfs scratchbox.base/
#mkdir scratchbox.changes
#mkdir scratchbox
#mount -t aufs -o dirs=scratchbox.changes/=rw:scratchbox.base/=rr aufs /scratchbox

//if you want to automount while bootup linux,then you need to edit /etc/fstab


------------------------------------------------------------------------------
mount squashfs
And, make sure you are root

#mount -t squashfs -o loop /scratchbox.squashfs /scratchbox.base/

#mount -t aufs -o dirs=/scratchbox.changes/=rw:/scratchbox.base/=rr aufs /scratchbox

*ubuntu command "7zip"

make sure you are a root
Tar file:
#sudo su
#tar -cvf - Adobe | 7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=64m -ms=on -si Adobe.tar.7z

Untar file:
#7za x -so /opt/Adobe.tar.7z | tar -xf -

* ubuntu bash.bashrc setting

edit #/etc/bash.bashrc
Added

----------------------------------------

----------------------------------------
bind 'C-b':backward-word
bind 'C-f':forward-word
bind 'C-w':backward-kill-word

bind '"\x1b\x5b\x41":history-search-backward'
bind '"\x1b\x5b\x42":history-search-forward'

export HISTFILESIZE=10000
export HISTSIZE=10000
---------------------------------------------

2009年8月26日 星期三

*audio driver on linux

Reference Essential Linux device drives

1. Audio connection


cpu ===> audio codec ===> MIC or speaker

ex: audio codec : AC97. TI TPS65950
audio codec converts digitial audio to analog sound for playing through speakers
Then, audio codec has "mixer" functionality

2.Linuc sound subsystem
ALSA is the sound subsystem of choice in the 2.6 kernel

Device node : /dev/snd/*

/dev/snd/controlC0 is control node for volume gain
/dev/snd/pcmC0D0p is a playback device, p is playback
/dev/snd/pcmC0D0c is a recording device, c is capture

3. Accessing information via /proc/asound and /sys/class/sound

4. ALSA library : user space alsa library alsa-lib which provides the libasound.so
ALSA utility : alsa-utils, alsamixer, amixer, alsactl , aplay and areocrd

5. Audio driver is build out of three main function
* Playback
* Capture
* Mixer control functions

2009年8月24日 星期一

* ubuntu scp command

Ubuntu scp command

scp 來源 目的

將檔案從遠端傳到本機
遠端-->本機
scp username@tohostname:/remotefile /newlocalfile



將檔案從本機傳到遠端
本機 -->遠端

scp localfile username@tohostname:/newfilename

* [ D ] Ubuntu can't use console

Ubuntu can't use console
Solution:
#cd /etc/event.d/
#cp tty1 ttyS0
Please make sure your console setting by bootargs=console=ttyS0,115200......

Then, edit /etc/event.d/ttyS0
----------------------------------------------------------------------------
#vi /etc/event.d/ttyS0

tart on stopped rc2
start on stopped rc3
start on stopped rc4
start on stopped rc5

stop on runlevel 0
stop on runlevel 1
stop on runlevel 6

console owner
respawn
exec /sbin/getty 115200 ttyS0
----------------------------------------------------------------------------

* ubuntu upstart

http://upstart.ubuntu.com/

http://linux.com/archive/feature/125977



Upstart is an event-based replacement for the /sbin/init daemon which handles starting of tasks and services during boot, stopping them during shutdown and supervising them while the system is running.

*Linux ash prompt can't work about PS1='[\u\@\h \W]# '

In the busybox, you must turn on CONFIG_FEATURE_SH_FANCY_PROMPT

Symbol: FEATURE_EDITING_FANCY_PROMPT
x Prompt: Fancy shell prompts
x Defined at libbb/Config.in:97
x Depends on: FEATURE_EDITING
x Location:
x -> Busybox Settings
x -> Busybox Library Tuning
x -> Command line editing (FEATURE_EDITING [=y])
 Location:                                                                                                              x
-> Busybox Settings x
-> Busybox Library Tuning x
-> Command line editing (FEATURE_EDITING [=y])

*build busybox and create rootfs for nfs

step1: build busybox
#make menuconfig CROSS_COMPILE=arm-none-linux-
#make CROSS_COMPILE=arm-none-linux
#make install CROSS_COMPILE=arm-none-linux
Then, get _intall directory
#cp -rdf _install/* /nfs

Step2: Create nfs rootfs
#mkdir bin dev etc lib proc sbin tmp usr var
#chmod 1777 tmp
#mkdir usr/bin usr/lib usr/sbin
#mkdir var/lib var/lock var/log var/run var/tmp
#chmod 1777 var/tmp

Step3: Create device node
#mknod -m 600 console c 5 1
or you can copy device nodes from your linux system

Step4: Create /etc/init.d/rcS

-------------------------------------------------------------------

Note: When you makemenuconfig,you must take care below:

Busybox Settings >

General Configuration >

[*] Support for devfs

Build Options >

[*] Build BusyBox as a static binary (no shared libs)

[*] Do you want to build BusyBox with a Cross Compiler?

(/usr/local/arm/3.3.2/bin/armlinux)

Cross Compiler prefix

Init Utilities >

[*] init

[*] Support reading an inittab file

Shells >

Choose your default shell (ash) >


http://blog.sina.com.cn/s/blog_4570e33b0100dbp5.html~type=v5_one&label=rela_prevarticle





2009年8月21日 星期五

* beagle board format mmc card

step1: see mmc disk
#dmesg | tail
get mmcblk0

step2: umount mmc card
#umount /medisk/disk

step3: list mmc
#sudo su -
#fdisk -l /dev/mmcblk0

step4: format mmc card
#sudo ./mmc.sh
--------------------------------------------------------------------------------

#! /bin/sh
MMCDEV="/dev/mmcblk0"
DISKSIZE=`fdisk -l ${MMCDEV} | awk '/[^=] [0-9]+ bytes/{print $5}'`
CYLINDERS=`echo "${DISKSIZE} 255 63 512
**/f" | dc`
/bin/echo -e "p\nn\np\n1\n\n+64M\nn\np\n2\n\n\n\na\n1\nt\n1\nc\np\nw\nq\n" | fdisk -H 255 -S 63 -C ${CYLINDERS} ${MMCDEV}
------------------------------------------------------------------------------
#mkdosfs -F 32 /dev/mmcblk0p1
#mke2fs -j /dev/mmcblk0p2

----------------------------------------------------------------------------------
step5: insert mmc card
#mount


beagleboard format mmc card

step1: umount disk
#umount /media/disk
step2: list disk and delete disk format
#fdisk -l /dev/mmcblk0
#fdisk /dev/mmcblk0
step3: partition disk
step4: format disk

2009年8月20日 星期四

[ d ] booting from nfs

booting from nfs on u-boot environment settiing
#setenv netmask 255.255.0.0
#setenv serverip 192.168.1.101
#setenv ipaddr 192.168.1.102
#setenv rootpath /work/nfs
#setenv bootcmd 'tftpboot 0x2000000 $(image_name);setenv bootargs console=ttyS0,115200 root=/dev/nfs nfsroot=$(serverip):$(rootpath) ip=$(ipaddr):$(serverip):::orion:eth0:none usb0Mode=host usb1Mode=host; bootm 0x2000000'

ubuntu 架設 nfs server

$sudo apt-get install nfs-common nfs-kernel-server
$ sudo vi /etc/exports
/work/MVP 192.168.*.*(rw,no_root_squash,nohide,insecure,no_subtree_check,async)

啟動nfs
$/etc/init.d/nfs-kernel-server restart

檢查
$showmount -e

掛載
$mount -t nfs 192.168.xxx.xxx:/work /mnt/nfs

2009年8月19日 星期三

ubuntu 架設 tftp server

#sudo apt-get install xinetd tftp-hpa tftpd-hp

安裝TFTP server
修改設定檔/etc/default/tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -c -s /tftpboot"
也修改/etc/inetd.conf
tftp dgram udp wait root /usr/sbin/in.tftpd /usr/sbin/in.tftpd -c -s /tftpboot
參數:
-c 讓client可以修改server內的檔案
-s 指定server的資料夾

重新啟動ttftp server
#sudo /etc/init.d/tftpd-hpa restart

安裝client
#sudo apt-get install tftp

連線到主機去 xxx.xxx.xxx.xxx is ip

tftp xxx.xxx.xxx.xxx

>get xxx

>quit

2009年8月18日 星期二

[w] 測試Webcam

連續好幾天,uvc driver build 和 v4l1/v4l2都build 好了
卻無法動作
後來才發現是權限的問題

# ls /dev/video0 -al
crw-rw---- 1 root video 81, 0 Jan 1 00:00 /dev/video0
#sudo su -
# chmod o+rw /dev/video0

或是到 /etc/group 下面加入 yourname on video中

測試方式:

#mplayer -cache 128 -tv driver=v4l2:width=320:height=240:outfmt=i420 -vc rawyuy2 -vo x11 tv://

2009年8月17日 星期一

[w]linux audio 權限問題

由於ubuntu 無法看到Projetc音效卡的資訊
根據之前/dev/video0的權限經驗
今天也把audio 權限修改之後就可以看到了
Solution:
vi /etc/group

audio:x:29:pulse,myname

myname是我登入的名稱


How to add user to audio group
#gpasswd -a username audio