2009年2月8日 星期日

convert fb's raw data to png

if you want to check your last display from fbdev,
you can "cat /dev/fb0 > fb0.raw" and review it by converting png file.

#!/usr/bin/perl -w

$w = shift || 240;
$h = shift || 320;
$pixels = $w * $h;

open OUT, "|pnmtopng" or die "Can't pipe pnmtopng: $!\n";

printf OUT "P6%d %d\n255\n", $w, $h;

while ((read STDIN, $raw, 2) and $pixels--) {
$short = unpack('S', $raw);
print OUT pack("C3",
($short & 0xf800) >> 8,
($short & 0x7e0) >> 3,
($short & 0x1f) << 3);
}

close OUT;

2009年2月4日 星期三

mkh264 with ES only

REF:Levi
mkh264.sh

#!/bin/bash
: ${1?"Usage: $0 <filename>"}
mkfifo stream.y4m
mplayer ${1} -nosound -benchmark -vf scale=720:-10,rotate=1 -vo yuv4mpeg:file=stream.y4m > LOG &
x264 -q 3 --bframes 0 --no-cabac -o `basename ${1}`.264 stream.y4m `awk '/VO/{print $3}' LOG`
rm -f stream.yuv stream.y4m LOG

2008年11月13日 星期四

List ASM code and C code together

"arm-linux-objdump -lSDx rylcd.ko > dump.txt" ,

2008年7月8日 星期二

kernel/module debugging

REF:Inside the Linux kernel debugger

Kernel Module .ko 的Makefile

REF:http://wshlab2.ee.kuas.edu.tw/personal/simon/archives/000735.html

目前小弟常用的兩種寫法,敬供參考。
KERNEL_VERSION  := `uname -r`
KERNEL_DIR := /lib/modules/$(KERNEL_VERSION)/build
#KERNEL_DIR :=
$(KERNEL_SRC)
CROSS_COMPILE := arm-linux-


PWD := $(shell pwd)

obj-m := snd-dummy.o
snd-dummy-objs := dummy.o

all: snd-dummy

snd-dummy:
@echo "Building a dummy driver..."
@(make -C $(KERNEL_DIR) M=$(PWD) CROSS_COMPILE=$(CROSS_COMPILE) modules)

clean:
-rm -f *.o *.ko .*.cmd .*.flags *.mod.c Module.symvers modules.order tags
-rm -rf .tmp_versions


ifneq   ($(KERNELRELEASE),)
obj-m :=
dummy.o

else
KERNEL_VERSION := `uname -r`
KERNEL_DIR := /lib/modules/$(KERNEL_VERSION)/build
#KERNEL_DIR :=
$(KERNEL_SRC)
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

clean:
rm -r .tmp_versions *.mod.c .*.cmd *.o *.ko

endif

2008年7月2日 星期三

抓當代已patched kernel source

apt-get source linux-source-2.6.22
註:apt-get source [按TAB可以查詢且補齊]

2008年6月30日 星期一

轉檔:Covnert wma to mp3

#先轉至pcm
mplayer Samba.wma -ao pcm:file=test.pcm
#再編成MP3
lame -ms test.pcm -o Samba.mp3

#!/bin/sh
for i in *.wma ;
do
mplayer "$i" -ao pcm:file=audiodump.wav
lame -ms audiodump.wav -o "`basename "$i" .wma`.mp3";
rm -f audiodump.wav
done
rm -f audiodump.wav