2010年12月5日 星期日

BeagleBoard wifi Abocom WA-160CUN (Ralink RT3072 chip)

1.Download driver from ralink

2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO.bz2

2.Apply patch

diff -Naur 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO.org/Makefile 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO/Makefile
--- 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO.org/Makefile    2010-08-31 17:12:20.000000000 +0800
+++ 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO/Makefile    2010-12-06 13:42:45.517707164 +0800
@@ -15,7 +15,7 @@
 RTMP_SRC_DIR = $(RT28xx_DIR)/RT$(CHIPSET)
 
 #PLATFORM: Target platform
-PLATFORM = PC
+#PLATFORM = PC
 #PLATFORM = 5VT
 #PLATFORM = IKANOS_V160
 #PLATFORM = IKANOS_V180
@@ -46,6 +46,7 @@
 #PLATFORM = MT85XX
 #PLATFORM = NXP_TV550
 #PLATFORM = MVL5
+PLATFORM = OMAP3
 
 #RELEASE Package
 RELEASE = DPO
@@ -240,6 +241,11 @@
 CROSS_COMPILE = /opt/montavista/pro/devkit/arm/v5t_le_mvl5/bin/arm_v5t_le-
 endif
 
+ifeq ($(PLATFORM),OMAP3)
+LINUX_SRC = ${HOME}/BeagleBoard/kernel
+CROSS_COMPILE = arm-none-linux-gnueabi-
+endif
+
 export OSABL RT28xx_DIR RT28xx_MODE LINUX_SRC CROSS_COMPILE CROSS_COMPILE_INCLUDE PLATFORM RELEASE CHIPSET RTMP_SRC_DIR LINUX_SRC_MODULE TARGET
 
 # The targets that may be used.
diff -Naur 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO.org/os/linux/config.mk 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO/os/linux/config.mk
--- 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO.org/os/linux/config.mk    2010-08-31 17:12:20.000000000 +0800
+++ 2010_0831_RT3070_Linux_STA_v2.4.0.1_DPO/os/linux/config.mk    2010-12-06 14:58:50.981706317 +0800
@@ -148,7 +148,8 @@
 # config for STA mode
 
 ifeq ($(RT28xx_MODE),STA)
-WFLAGS += -DCONFIG_STA_SUPPORT -DDBG
+#WFLAGS += -DCONFIG_STA_SUPPORT -DDBG
+WFLAGS += -DCONFIG_STA_SUPPORT
 
 ifeq ($(HAS_XLINK),y)
 WFLAGS += -DXLINK_SUPPORT
@@ -577,6 +578,11 @@
 export CFLAGS
 endif
 
+ifeq ($(PLATFORM),OMAP3)
+EXTRA_CFLAGS := -D__KERNEL__ -DMODULE -I$(LINUX_SRC)/include -I$(RT28xx_DIR)/include -I$(LINUX_SRC)/arch/arm/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Os -marm -fno-omit-frame-pointer -mapcs -mno-sched-prolog -mabi=aapcs-linux -mno-thumb-interwork -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm -fno-stack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -Wdeclaration-after-statement -Wno-pointer-sign -fwrapv $(WFLAGS)
+export EXTRA_CFLAGS
+endif
+
 ifeq ($(PLATFORM),BL2348)
 CFLAGS := -D__KERNEL__ -I$(RT28xx_DIR)/include -I$(LINUX_SRC)/include -I$(LINUX_SRC)/include/asm/gcc -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -DEM86XX_CHIP=EM86XX_CHIPID_TANGO2 -DEM86XX_REVISION=6 -I$(LINUX_SRC)/include/asm-mips/mach-generic -I$(RT2860_DIR)/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2     -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -pipe  -mabi=32 -march=mips32r2 -Wa,-32 -Wa,-march=mips32r2 -Wa,-mips32r2 -Wa,--trap -DMODULE $(WFLAGS) -DSIGMA863X_PLATFORM -DEXPORT_SYMTAB -DPLATFORM_BL2348
 export CFLAGS

3.Put driver to BeagleBoard

os/linux/rt3370sta.ko -> /etc/Wireless/RT2870STA/rt3370sta.ko

4.Put .dat to BeagleBoard

RT2870STA.dat -> /etc/Wireless/RT2870STA/RT2870STA.dat

5.Load driver

# insmod /etc/Wireless/RT2870STA/rt3370sta.ko
rtusb init --->
ra0 (): not using net_device_ops yet
usbcore: registered new interface driver rt2870

6.Config

ifconfig ra0 up
iwlist ra0 scan
iwconfig ra0 essid 3F_SW_AP
iwconfig ra0 mode managed
iwconfig ra0 key 0123456789
iwpriv ra0 set AuthMode=WEPAUTO
iwpriv ra0 set EncrypType=WEP

7.Run dhcp client

udhcpc -i ra0 -s /etc/udhcpc.script







2010年11月17日 星期三

Real-Time Object Detection by Stefan Hintersser running on linux Intel X86

Computer Version is an interesting topic, I found an implementation of real-time object detection which is really work on my linux X86.

Stefan Hintersser home page
http://campar.in.tum.de/Main/StefanHinterstoisser

Document
http://campar.in.tum.de/personal/hinterst/index/project/CVPR10.pdf

Although the author says it can work on linux but not really tested.
Now, let's do some fix to get it work.

1.Download and install source code and all necessary libraries

Source code
http://campar.in.tum.de/personal/hinterst/index/downloads.html

OpenCV

ESM
ftp://ftp-sop.inria.fr/evolution/malis/software/ESM/ESMkitLin_0_4.tar.gz
Install in
$DOT_vs_1.0/resources/ESM/ESMkitLin

Intel IPP
I'm running with Intel IPP 6.0.1.071. it installed in /opt

1.Create Makefile

CC=gcc
AR=ar

CFLAGS=-Wall -O3 -funroll-loops -msse2 -I./include -I/usr/include/opencv -I/opt/intel/ipp/6.0.1.071/ia32/include -I./resources/ESM/ESMkitLin/inc
LDFLAGS=-L/opt/intel/ipp/6.0.1.071/ia32/lib -lcv -lcvaux -lhighgui -lcxcore -lippcvmerged -lippmemerged -lippmmerged -lippccmerged -lipprmerged -lippiemerged -lippimerged -lippsemerged -lippsmerged -lippsrmerged -lippcore -lm

LIBS=src/cv_camera.o src/cv_utilities.o src/cv_esm.o

%.o : %.cc
        $(CC) -c $(CFLAGS) $< -o $@

all : main_dot2D main_dot3D

main_dot2D : ${LIBS} src/main_dot2D.o
        ${CC} -o $@ ${LIBS} src/main_dot2D.o ${LDFLAGS} resources/ESM/ESMkitLin/lib/ESMlib.a

main_dot3D : ${LIBS} src/main_dot3D.o
        ${CC} -o $@ ${LIBS} src/main_dot3D.o ${LDFLAGS} resources/ESM/ESMkitLin/lib/ESMlib.a

clean :
        rm -rf src/*.o

2.Then make.
After successful compile and link
run ./main_dot2D

The program almost eating all CPU resource and window shows nothing.
I found the camera frame rate seems too high (90 fps !!!)
So I try to reduce the frame rate by change

        int l_key = cvWaitKey(1);

to

        int l_key = cvWaitKey(60);

Now it's worked ...








 

2010年9月24日 星期五

Rowboat Android Overlay Setup

There are some trick to setup omap overlay

1. omap_vout omap_vout: probed for an unknown device

To fix this problem set u-boot environment variable

setenv optargs 'init=/init omapdss.def_disp=dvi omapfb.mode=dvi:1280x1024MR-16@60 vram=4M omapfb.vram=0:4M'

http://groups.google.com/group/beagleboard/browse_thread/thread/ff11355c5834a187

2.TIDmaiVideoSink params

Make sure what video output you are using ...

gst-launch-0.10 -v videotestsrc ! TIDmaiVideoSink videoStd=VGA videoOutput=DVI sync=false

gst-launch-0.10 filesrc location=/sdcard/video.mp4 ! typefind ! qtdemux name=demux demux.video_00 ! queue ! TIViddec2 ! TIDmaiVideoSink videoStd=VGA videoOutput=DVI sync=false

3.Resolution issue

Refer this mail

Re: [rowboat] Display resolution
...
寄件者:
Vladimir Barinov
...
加到通訊錄
收件者:rowboat@googlegroups.com

Juan,

Juan Garibay wrote:
> Hi,
>
> I was facing the same issue described by Abdi and I followed the instructions described in the following link:
> http://code.google.com/p/rowboat/wiki/ConfigureAndBuild#External_Display
> Here it is specified to use "omap-dss.def_disp" and "omapfb.video_mode" without mentioning the kernel version constrains, it would be nice to update it.
ok
>
> Using the parameters mentioned by Vladimir, I am able to set different resolutions however the highest resolution for which it works is 1280x720MR-16@60. According to the "Video modes for external display" section from this link:
> http://code.google.com/p/rowboat/wiki/SimpleTests
> The BeagleBoard should also support 1280x1024MR-16@60 , 1440x900MR-16@60, 1440x1050MR-16@60,1600x1024MR-16@60 but I am getting the following error:
try to add these option in your kernel command line: vram=XXX
for example for 1280x1024MR-16@60 you should add vram=4M
1440x1050MR-16@60, vram=6M
1600x1024MR-16@60, vram=7M
etc, the equation to calculate the vram value is x_res*y_rex*4

Regards,
Vladimir
>
> omaplfb: OMAPLFB_Init: OMAPLFBInit failed
>
> Can anyone help me on this?
>
> I am using a Beagle C2, rowboat-eclair-dsp.xml and as display a TV that supports fullHD (1920x1080) so it should not be an issue.
>
> Regards,
> Juan Garibay
>
>
>
>
>
> > Date: Wed, 15 Sep 2010 18:20:49 +0400
> > From: batareich@gmail.com
> > To: rowboat@googlegroups.com
> > Subject: Re: [rowboat] Display resolution
> >
> > abdi farah wrote:
> > > Hi,
> > >
> > >
> > > I would like to know how to change the display resolution using
> > > rowboat-android.
> > > I manage to port rowboat-android 2.1 to beagleboard revc4.
> > >
> > > i used the console commands:
> > >
> > > #Beagleboard# setenv bootcmd 'mmc init; fatload mmc 0 84000000 uImage; bootm 84000000'
> > > #Beagleboard# setenv bootargs 'mem=128M androidboot.console=ttyS2 console=tty0 console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw
> > >
> > > init=/init rootwait omapfb.video_mode=640x480MR-16@60'
> > these params are redundant since they are siutable for 2.6.29.
> > The 2.6.32 DSS takes these parameters from kernel command line -
> > omapdss.def_disp and omapfb.mode, f.e:
> > omapdss.def_disp=dvi omapfb.mode=dvi:720x576MR-16@60
> >
> > >
> > > #Beagleboard# saveenv
> > > Beagleboard# reset
> > > i try to change the second line to my desired resolution. but it does
> > > not change anything.
> > >
> > > Best regards
> > > Abdi



2010年9月15日 星期三

Extract Ubuntu initrd.img

mkdir initrd
cd initrd
cp /boot/initrd.img-2.6.32-21-generic-pae .
sudo mv initrd.img-2.6.32-21-generic-pae initrd.img-2.6.32-21-generic-pae.gz
sudo gzip -dc initrd.img-2.6.32-21-generic-pae.gz | sudo cpio -id

2010年9月3日 星期五

Get default gateway in C language

紀錄一下這件看起來很簡單的事

呼叫 SxNetDefaultGateway() 傳回 default gateway

Source code below



/* numeric: & 0x8000: default instead of *,
 *          & 0x4000: host instead of net,
 *          & 0x0fff: don't resolve
 */
char *INET_rresolve(struct sockaddr_in *s_in, int numeric, uint32_t netmask)
{
  /* addr-to-name cache */
  struct addr {
    struct addr *next;
    struct sockaddr_in addr;
    int host;
    char name[1];
  };
/* 
  static struct addr *cache = NULL;

  struct addr *pn;
  char *name;
  uint32_t ad, host_ad;
  int host = 0;
*/
  uint32_t ad;
 
  /* Grmpf. -FvK */
  if (s_in->sin_family != AF_INET) {
#ifdef DEBUG
    printf("rresolve: unsupported address family %d!",
          s_in->sin_family);
#endif
    errno = EAFNOSUPPORT;
    return NULL;
  }
  ad = s_in->sin_addr.s_addr;
#ifdef DEBUG
  printf("rresolve: %08x, mask %08x, num %08x", (unsigned)ad, netmask, numeric);
#endif
  if (ad == INADDR_ANY) {
    if ((numeric & 0x0FFF) == 0) {
      if (numeric & 0x8000)
        return strdup("default");
      return strdup("*");
    }
  }
  if (numeric & 0x0FFF)
    return strdup(inet_ntoa(s_in->sin_addr));
 
  return 0;
}

#ifndef RTF_UP
/* Keep this in sync with /usr/src/linux/include/linux/route.h */
#define RTF_UP          0x0001  /* route usable                 */
#define RTF_GATEWAY     0x0002  /* destination is a gateway     */
#define RTF_HOST        0x0004  /* host entry (net otherwise)   */
#define RTF_REINSTATE   0x0008  /* reinstate route after tmout  */
#define RTF_DYNAMIC     0x0010  /* created dyn. (by redirect)   */
#define RTF_MODIFIED    0x0020  /* modified dyn. (by redirect)  */
#define RTF_MTU         0x0040  /* specific MTU for this route  */
#ifndef RTF_MSS
#define RTF_MSS         RTF_MTU /* Compatibility :-(            */
#endif
#define RTF_WINDOW      0x0080  /* per route window clamping    */
#define RTF_IRTT        0x0100  /* Initial round trip time      */
#define RTF_REJECT      0x0200  /* Reject route                 */
#endif

static const unsigned flagvals[] = { /* Must agree with flagchars[]. */
  RTF_GATEWAY,
  RTF_HOST,
  RTF_REINSTATE,
  RTF_DYNAMIC,
  RTF_MODIFIED,
#if ENABLE_FEATURE_IPV6
  RTF_DEFAULT,
  RTF_ADDRCONF,
  RTF_CACHE
#endif
};

#define IPV4_MASK (RTF_GATEWAY|RTF_HOST|RTF_REINSTATE|RTF_DYNAMIC|RTF_MODIFIED)
#define IPV6_MASK (RTF_GATEWAY|RTF_HOST|RTF_DEFAULT|RTF_ADDRCONF|RTF_CACHE)

/* Must agree with flagvals[]. */
static const char flagchars[] =
  "GHRDM"
#if ENABLE_FEATURE_IPV6
  "DAC"
#endif
;

static void set_flags(char *flagstr, int flags)
{
  int i;

  *flagstr++ = 'U';

  for (i = 0; (*flagstr = flagchars[i]) != 0; i++) {
    if (flags & flagvals[i]) {
      ++flagstr;
    }
  }
}

const char *SxNetDefaultGateway()
{
  char devname[64], flags[16];
  static char *sdest = 0, *sgw = 0;
  unsigned long d, g, m;
  int flgs, ref, use, metric, mtu, win, ir;
  struct sockaddr_in s_addr;
  struct in_addr mask;

  FILE *fp = fopen("/proc/net/route", "r");
  if(!fp)
    return 0;
 
  if (fscanf(fp, "%*[^\n]\n") < 0) { /* Skip the first line. */
    goto ERROR;      /* Empty or missing line, or read error. */
  }
  while (1) {
    int r;
    r = fscanf(fp, "%63s%lx%lx%X%d%d%d%lx%d%d%d\n",
           devname, &d, &g, &flgs, &ref, &use, &metric, &m,
           &mtu, &win, &ir);
    if (r != 11) {
      if ((r < 0) && feof(fp)) { /* EOF with no (nonspace) chars read. */
        break;
      }
 ERROR:
      fclose(fp);
      perror("fscanf");
      return 0;
    }

    if (!(flgs & RTF_UP)) { /* Skip interfaces that are down. */
      continue;
    }

    set_flags(flags, (flgs & IPV4_MASK));
#ifdef RTF_REJECT
    if (flgs & RTF_REJECT) {
      flags[0] = '!';
    }
#endif
    if(sdest) free(sdest);
    if(sgw)  free(sgw);

    memset(&s_addr, 0, sizeof(struct sockaddr_in));
    s_addr.sin_family = AF_INET;
    s_addr.sin_addr.s_addr = d;
    sdest = INET_rresolve(&s_addr, (0x0fff | 0x8000), m); /* 'default' instead of '*' */
    s_addr.sin_addr.s_addr = g;
    sgw = INET_rresolve(&s_addr, (0x0fff | 0x4000), m); /* Host instead of net */
    mask.s_addr = m;  
    /* "%15.15s" truncates hostnames, do we really want that? */
    /*
    printf("%-15.15s %-15.15s %-16s%-6s", sdest, sgw, inet_ntoa(mask), flags);   
    if (netstatfmt) {
      printf("%5d %-5d %6d %s\n", mtu, win, ir, devname);
    } else {
      printf("%-6d %-2d %7d %s\n", metric, ref, use, devname);
    }
    */
    if(flgs & RTF_GATEWAY)  {
      fclose(fp);
      return sgw;
    }
  }
 
  fclose(fp);
  return 0;
}


2010年8月27日 星期五

Android 心得感想

還記的一年前Android大張旗鼓出現,偶當時也具有高度的興趣,因為base on linux而且open source.
而且google也在Android上導入open source所缺乏的重要軟體,例如Web Browser, 穩定的Java VM等.
這一年來偶接觸過兩個Android platform分別是TI OMAP 3530 & Samsung S3C6410, 軟體的部份有修改一些driver以符合Android的要求,簡單的JNI及Android application.偶嘗試以技術的角度將這些與Android的經歷紀錄下來.

1.Linux kernel

Linux kernel必須加上一些Android fix & driver才能跑Android.
例如,比較奇特的像是pmem driver,用來保留memory給Android使用.
坦白說為了特定application保留memory這件事偶個人覺得非常不妥,
一般都是保留給其他hardware使用像是DSP而且也不需要額外的driver來處理,
只要在kernel param設定mem=XXX就能保留剩下的memory,甚至是保留特定memory region也可透過類似方式達到.是效率或著是security issue非得用如此的作法不可嗎 ?

這只是冰山一角,還有其他特異的程式碼在系統中運作著.
事實上Linux Kernel的維護者已經在年初宣佈移除所有Android相關的程式碼.

2.Where is linux ?

第一次順利booting kernel啟動Android進入console之後偶發現一切都很陌生.
是的,的確有個shell,很難用的shell... OK,Android自己搞的shell.

每個指令的功能都陽春到不行,backspace & tab key都不能用.進入/etc目錄之後更是大吃一驚,在UNIX系統沿用多年的許多系統檔案都不見了,全部被Android一手包辦.

在Android 中init.rc這個檔案負責系統初始化的設定,如mount file system, init network 及週邊初始化.其中的script語法並非shell script而是Android自訂的key word所組成.

嗯,這真的不是Linux更不是UNIX like system.
Android是以linux kernel為核心基礎也僅只於此了.

3.Porting Android

Android 具有跨平台在不同CPU上工作的能力,但porting的工作則是各憑本事.
目前Embedded ARM CPU往往有許多特殊硬體的功能,例如2D, 3D graphic engine, video coder及camera interface等.

這些功能在linux kernel driver端常常就有許多新增的ioctl及操作流程,porting的困難是需要對driver及Android都有相當程度的了解才能進行的下去.

在開發環境上以往熟悉的Makefile已經被Android.mk取代,完全不同於傳統Embedded System.

Android對自身系統設計的文件並不多,但光從source code的量來看要能有詳細的文件確實是很難.
所以想要porting Android到產品等級絕對不是幾個有經驗的工程師就能作到其中的know how真的非常多.

4.Java VM

Android提供一個Java VM Engine - dalvik,我相當喜歡這樣的設計.dalvik提供一個可以達到同一個application java binary在不同平台執行,而且其效能不見得比native binary來的差.不過這不是絕對的,例如Android允許使用JNI的方式撰寫直接控制硬體或是連結close source binary.許多商業軟體就會透過這種方式達到保護自身利益.java binary跨平台的特性也因此弱化了.但不可否認的是使用Java 單一語言來開發application的確是很大的好處,尤其是Graphic Interface.如果是c/c++因為語言開放特性的關係就算有完整library也不是一件容易的事(例如QT, gtk).


2010年8月18日 星期三

Maemo 5 DBus 初探

DBus 在Maemo 5系統中是很重要的 IPC 功能,透過DBus可以控制許多硬體如LED, Keypad,甚至是撥電話及發簡訊.現在我想要在程式執行時LCD panel不要進入power saving而關閉也需要透過DBus.

1.Reference

http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/DBus/DBus_Basics

http://maemo.org/api_refs/5.0/5.0-final/mce-dev/dbus-names_8h.html#c9f233f336f9be78f223a31866455b80

http://www.mail-archive.com/maemo-developers@maemo.org/msg01889.html


2.以下的程式碼片段就是我想要的囉

    DBusConnection *conn;
DBusMessage *msg = NULL;
DBusError dbus_error;
dbus_bool_t dresult;

#define MCE_SERVICE "com.nokia.mce"
#define MCE_REQUEST_PATH "/com/nokia/mce/request"
#define MCE_REQUEST_IF "com.nokia.mce.request"
#define MCE_PREVENT_BLANK_REQ "req_display_blanking_pause"

dbus_error_init(&dbus_error);

conn = dbus_bus_get (DBUS_BUS_SYSTEM, &dbus_error);

msg = dbus_message_new_method_call(MCE_SERVICE,
MCE_REQUEST_PATH,
MCE_REQUEST_IF,
MCE_PREVENT_BLANK_REQ);
if (msg == NULL)
return;

dresult = dbus_connection_send (conn, msg, NULL);

if (!dresult)
{
dbus_message_unref(msg);
return;
}

dbus_connection_flush(conn);
dbus_message_unref(msg);


2010年8月9日 星期一

Maemo 5 debian packaging

初次嘗試Maemo 5 hello world programing之後,將binary複製到target上就可以執行.
但這樣並不是正規的散布方式,Maemo 5支援Debian dpkg的方式包裝binary,包含icon, desktop設定等...
網路上搜尋Maemo 5 dpkg相關的資料並不多,流程也有些複雜,因此作個紀錄供往後參考用.

以下將延續之前的example_hildonprogram

1.要使用dpkg packaging需要配合autotools (據說也可以不要)
2.建立目錄及環境,之後複製example_hildonprogram.c

[sbox-FREMANTLE_ARMEL: ~/] > mkdir example_hildonprogram
[sbox-FREMANTLE_ARMEL: ~/] > cd example_hildonprogram
[sbox-FREMANTLE_ARMEL: ~/example_hildonprogram] > mkdir src
[sbox-FREMANTLE_ARMEL: ~/example_hildonprogram] > mkdir data
[sbox-FREMANTLE_ARMEL: ~/example_hildonprogram] > mkdir data/maemo

複製example_hildonprogram.c 到 example_hildonprogram/src

3.建立autotools所需檔案

File configure.ac

AC_INIT([example_hildonprogram], [0.1])
AM_INIT_AUTOMAKE([foreign])
AC_PROG_CC
PKG_CHECK_MODULES(GTK2,
          [gtk+-2.0]
          [AC_SUBST(GTK2_CFLAGS)
          AC_SUBST(GTK2_LIBS)])

PKG_CHECK_MODULES([HILDON], [hildon-1 >= 2.2])
AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT

File Makefile.am

SUBDIRS = src
EXTRA_DIST = data/icons/example_hildonprogram.png \
        data/maemo/example_hildonprogram.desktop \
        data/maemo/com.nokia.example_hildonprogram.service

File src/Makefile.am

bin_PROGRAMS = example_hildonprogram

example_hildonprogram_SOURCES = example_hildonprogram.c

example_hildonprogram_CFLAGS = $(GTK2_CFLAGS) \
                  $(HILDON_CFLAGS)

example_hildonprogram_LDADD = $(GTK2_LIBS) \
                 $(HILDON_LIBS)

4.建立Maemo 5所需檔案

File data/maemo/example_hildonprogram.desktop

[Desktop Entry]
Encoding=UTF-8
Version=0.1
Name=example_hildonprogram
Type=Application
Exec=/usr/bin/example_hildonprogram
Icon=example_hildonprogram

File data/maemo/com.nokia.example_hildonprogram.service

[D-BUS Service]
Name=nokia.com.example_hildonprogram
Exec=/usr/bin/example_hildonprogram

5.Run autoreconf to create configure

[sbox-FREMANTLE_ARMEL: ~/example_hildonprogram] > autoreconf --force --install -v
autoreconf2.50: Entering directory `.'
autoreconf2.50: configure.ac: not using Gettext
autoreconf2.50: running: aclocal --force
autoreconf2.50: configure.ac: tracing
autoreconf2.50: configure.ac: not using Libtool
autoreconf2.50: running: /scratchbox/tools/autotools/autoconf2.61/bin/autoconf --force
autoreconf2.50: configure.ac: not using Autoheader
autoreconf2.50: running: automake --add-missing --copy --force-missing
src/Makefile.am: installing `./compile'
autoreconf2.50: Leaving directory `.'

6.configure

[sbox-FREMANTLE_ARMEL: ~/example_hildonprogram] > ./configure
checking for a BSD-compatible install... /scratchbox/tools/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for pkg-config... /scratchbox/tools/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for GTK2... yes
checking for HILDON... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: executing depfiles commands

7.make

[sbox-FREMANTLE_ARMEL: ~/example_hildonprogram] > make
Making all in src
make[1]: Entering directory `/home/gigijoe/example_hildonprogram/src'
if gcc -DPACKAGE_NAME=\"example_hildonprogram\" -DPACKAGE_TARNAME=\"example_hildonprogram\" -DPACKAGE_VERSION=\"0.1\" -DPACKAGE_STRING=\"example_hildonprogram\ 0.1\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"example_hildonprogram\" -DVERSION=\"0.1\" -I. -I.    -DMAEMO_CHANGES -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12   -DMAEMO_CHANGES -DMAEMO_GTK -I/usr/include/hildon-1 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12   -g -O2 -MT example_hildonprogram-example_hildonprogram.o -MD -MP -MF ".deps/example_hildonprogram-example_hildonprogram.Tpo" -c -o example_hildonprogram-example_hildonprogram.o `test -f 'example_hildonprogram.c' || echo './'`example_hildonprogram.c; \
    then mv -f ".deps/example_hildonprogram-example_hildonprogram.Tpo" ".deps/example_hildonprogram-example_hildonprogram.Po"; else rm -f ".deps/example_hildonprogram-example_hildonprogram.Tpo"; exit 1; fi
gcc  -g -O2   -o example_hildonprogram  example_hildonprogram-example_hildonprogram.o -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0   -lhildon-1 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0  
make[1]: Leaving directory `/home/gigijoe/example_hildonprogram/src'
make[1]: Entering directory `/home/gigijoe/example_hildonprogram'
make[1]: Nothing to be done for `all-am'.
make[1]: Leaving directory `/home/gigijoe/example_hildonprogram'

8.make dist, 此時會產生example_hildonprogram-0.1.tar.gz

[sbox-FREMANTLE_ARMEL: ~/example_hildonprogram] > make dist
{ test ! -d example_hildonprogram-0.1 || { find example_hildonprogram-0.1 -type d ! -perm -200 -exec chmod u+w {} ';' && rm -fr example_hildonprogram-0.1; }; }
mkdir example_hildonprogram-0.1
mkdir -p -- . example_hildonprogram-0.1/data/icons example_hildonprogram-0.1/data/maemo
list='src'; for subdir in $list; do \
      if test "$subdir" = .; then :; else \
        test -d "example_hildonprogram-0.1/$subdir" \
        || mkdir "example_hildonprogram-0.1/$subdir" \
        || exit 1; \
        (cd $subdir && \
          make  \
            top_distdir="../example_hildonprogram-0.1" \
            distdir="../example_hildonprogram-0.1/$subdir" \
            distdir) \
          || exit 1; \
      fi; \
    done
make[1]: Entering directory `/home/gigijoe/example_hildonprogram/src'
make[1]: Leaving directory `/home/gigijoe/example_hildonprogram/src'
find example_hildonprogram-0.1 -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
      ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
      ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
      ! -type d ! -perm -444 -exec /bin/sh /home/gigijoe/example_hildonprogram/install-sh -c -m a+r {} {} \; \
    || chmod -R a+r example_hildonprogram-0.1
/bin/sh /home/gigijoe/example_hildonprogram/missing --run tar chof - example_hildonprogram-0.1 | GZIP=--best gzip -c >example_hildonprogram-0.1.tar.gz
{ test ! -d example_hildonprogram-0.1 || { find example_hildonprogram-0.1 -type d ! -perm -200 -exec chmod u+w {} ';' && rm -fr example_hildonprogram-0.1; }; }

9.解開壓縮檔準備以此作為packaging source,這樣的作法不會影響到原來的source.

[sbox-FREMANTLE_ARMEL: ~/example_hildonprogram] > tar -zxvf example_hildonprogram-0.1.tar.gz
example_hildonprogram-0.1/
example_hildonprogram-0.1/compile
example_hildonprogram-0.1/configure
example_hildonprogram-0.1/missing
example_hildonprogram-0.1/install-sh
example_hildonprogram-0.1/depcomp
example_hildonprogram-0.1/configure.ac
example_hildonprogram-0.1/aclocal.m4
example_hildonprogram-0.1/Makefile.am
example_hildonprogram-0.1/Makefile.in
example_hildonprogram-0.1/src/
example_hildonprogram-0.1/src/example_hildonprogram.c
example_hildonprogram-0.1/src/Makefile.am
example_hildonprogram-0.1/src/Makefile.in
example_hildonprogram-0.1/data/
example_hildonprogram-0.1/data/icons/
example_hildonprogram-0.1/data/icons/example_hildonprogram.png
example_hildonprogram-0.1/data/maemo/
example_hildonprogram-0.1/data/maemo/com.nokia.example_hildonprogram.service
example_hildonprogram-0.1/data/maemo/example_hildonprogram.desktop



[sbox-FREMANTLE_ARMEL: ~/example_hildonprogram] > cd example_hildonprogram-0.1
[sbox-FREMANTLE_ARMEL: ~/example_hildonprogram/example_hildonprogram-0.1] > dh_make -e stevegigijoe@yahoo.com.tw --createorig -c GPL

Type of package: single binary, multiple binary, library, kernel module or cdbs?
 [s/m/l/k/b] s

Maintainer name : unknown
Email-Address   : stevegigijoe@yahoo.com.tw
Date            : Mon,  9 Aug 2010 15:47:56 +0800
Package Name    : example.hildonprogram
Version         : 0.1
License         : gpl
Type of Package : Single
Hit to confirm:
Done. Please edit the files in the debian/ subdirectory now. example.hildonprogram
uses a configure script, so you probably don't have to edit the Makefiles.


11.packaging

首先更動一下 debian/control, 這個檔案很重要.

[sbox-FREMANTLE_ARMEL: ~/example_hildonprogram/example.hildonprogram-0.1] > vi debian/control

-Build-Depends: debhelper (>= 5), autotools-dev
+Build-Depends: debhelper (>= 5), autotools-dev, libhildon1 (>= 2.2)
 
OK,go packaging

以下兩者都可以
dpkg-buildpackage -i -rfakeroot -D
dpkg-buildpackage -sa -rfakeroot -kstevegigijoe@yahoo.com.tw


[sbox-FREMANTLE_ARMEL: ~/example_hildonprogram/example.hildonprogram-0.1] > dpkg-buildpackage -sa -rfakeroot -kstevegigijoe@yahoo.com.tw
dpkg-buildpackage: source package is example.hildonprogram
dpkg-buildpackage: source version is 0.1-1
dpkg-buildpackage: source changed by unknown
dpkg-buildpackage: host architecture armel
dpkg-buildpackage: source version without epoch 0.1-1
: Using Scratchbox tools to satisfy builddeps
: Dependency provided by Scratchbox: autotools-dev
 fakeroot debian/rules clean
dh_testdir
dh_testroot
rm -f build-stamp
# Add here commands to clean up after the build process.
/scratchbox/tools/bin/make distclean
make[1]: Entering directory `/home/gigijoe/example_hildonprogram/example.hildonprogram-0.1'
make[1]: *** No rule to make target `distclean'.  Stop.
make[1]: Leaving directory `/home/gigijoe/example_hildonprogram/example.hildonprogram-0.1'
make: [clean] Error 2 (ignored)
cp -f /usr/share/misc/config.sub config.sub
cp -f /usr/share/misc/config.guess config.guess
dh_clean
 dpkg-source -b example.hildonprogram-0.1
dpkg-source: building example.hildonprogram using existing example.hildonprogram_0.1.orig.tar.gz
dpkg-source: building example.hildonprogram in example.hildonprogram_0.1-1.diff.gz
dpkg-source: building example.hildonprogram in example.hildonprogram_0.1-1.dsc
 debian/rules build
dh_testdir
# Add here commands to configure the package.
./configure --host=arm-linux-gnueabi --build=arm-linux-gnueabi --prefix=/usr --mandir=\${prefix}/share/man --infodir=\${prefix}/share/info CFLAGS="-Wall -g -O2" LDFLAGS="-Wl,-z,defs"
checking for a BSD-compatible install... /scratchbox/tools/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for arm-linux-gnueabi-gcc... arm-linux-gnueabi-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether arm-linux-gnueabi-gcc accepts -g... yes
checking for arm-linux-gnueabi-gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of arm-linux-gnueabi-gcc... gcc3
checking for arm-linux-gnueabi-pkg-config... no
checking for pkg-config... /scratchbox/tools/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for GTK2... yes
checking for HILDON... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: executing depfiles commands
dh_testdir
# Add here commands to compile the package.
/scratchbox/tools/bin/make
make[1]: Entering directory `/home/gigijoe/example_hildonprogram/example.hildonprogram-0.1'
Making all in src
make[2]: Entering directory `/home/gigijoe/example_hildonprogram/example.hildonprogram-0.1/src'
if arm-linux-gnueabi-gcc -DPACKAGE_NAME=\"example_hildonprogram\" -DPACKAGE_TARNAME=\"example_hildonprogram\" -DPACKAGE_VERSION=\"0.1\" -DPACKAGE_STRING=\"example_hildonprogram\ 0.1\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"example_hildonprogram\" -DVERSION=\"0.1\" -I. -I.    -DMAEMO_CHANGES -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12   -DMAEMO_CHANGES -DMAEMO_GTK -I/usr/include/hildon-1 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12   -Wall -g -O2 -MT example_hildonprogram-example_hildonprogram.o -MD -MP -MF ".deps/example_hildonprogram-example_hildonprogram.Tpo" -c -o example_hildonprogram-example_hildonprogram.o `test -f 'example_hildonprogram.c' || echo './'`example_hildonprogram.c; \
    then mv -f ".deps/example_hildonprogram-example_hildonprogram.Tpo" ".deps/example_hildonprogram-example_hildonprogram.Po"; else rm -f ".deps/example_hildonprogram-example_hildonprogram.Tpo"; exit 1; fi
arm-linux-gnueabi-gcc  -Wall -g -O2  -Wl,-z,defs -o example_hildonprogram  example_hildonprogram-example_hildonprogram.o -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0   -lhildon-1 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0  
make[2]: Leaving directory `/home/gigijoe/example_hildonprogram/example.hildonprogram-0.1/src'
make[2]: Entering directory `/home/gigijoe/example_hildonprogram/example.hildonprogram-0.1'
make[2]: Nothing to be done for `all-am'.
make[2]: Leaving directory `/home/gigijoe/example_hildonprogram/example.hildonprogram-0.1'
make[1]: Leaving directory `/home/gigijoe/example_hildonprogram/example.hildonprogram-0.1'
#docbook-to-man debian/example.hildonprogram.sgml > example.hildonprogram.1
touch build-stamp
 fakeroot debian/rules binary
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
# Add here commands to install the package into debian/example.hildonprogram.
/scratchbox/tools/bin/make DESTDIR=/home/gigijoe/example_hildonprogram/example.hildonprogram-0.1/debian/example.hildonprogram install
make[1]: Entering directory `/home/gigijoe/example_hildonprogram/example.hildonprogram-0.1'
Making install in src
make[2]: Entering directory `/home/gigijoe/example_hildonprogram/example.hildonprogram-0.1/src'
make[3]: Entering directory `/home/gigijoe/example_hildonprogram/example.hildonprogram-0.1/src'
test -z "/usr/bin" || mkdir -p -- . "/home/gigijoe/example_hildonprogram/example.hildonprogram-0.1/debian/example.hildonprogram/usr/bin"
  /scratchbox/tools/bin/install -c 'example_hildonprogram' '/home/gigijoe/example_hildonprogram/example.hildonprogram-0.1/debian/example.hildonprogram/usr/bin/example_hildonprogram'
make[3]: Nothing to be done for `install-data-am'.
make[3]: Leaving directory `/home/gigijoe/example_hildonprogram/example.hildonprogram-0.1/src'
make[2]: Leaving directory `/home/gigijoe/example_hildonprogram/example.hildonprogram-0.1/src'
make[2]: Entering directory `/home/gigijoe/example_hildonprogram/example.hildonprogram-0.1'
make[3]: Entering directory `/home/gigijoe/example_hildonprogram/example.hildonprogram-0.1'
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
make[3]: Leaving directory `/home/gigijoe/example_hildonprogram/example.hildonprogram-0.1'
make[2]: Leaving directory `/home/gigijoe/example_hildonprogram/example.hildonprogram-0.1'
make[1]: Leaving directory `/home/gigijoe/example_hildonprogram/example.hildonprogram-0.1'
dh_testdir
dh_testroot
dh_installchangelogs
dh_installdocs
dh_installexamples
dh_installman
dh_link
dh_strip
dh_compress
dh_fixperms
dh_installdeb
dh_shlibdeps
dh_gencontrol
dpkg-gencontrol: warning: unknown substitution variable ${misc:Depends}
dh_md5sums
dh_builddeb
dpkg-deb: building package `example.hildonprogram' in `../example.hildonprogram_0.1-1_armel.deb'.
 dpkg-genchanges -sa
dpkg-genchanges: including full source code in upload
dpkg-buildpackage: full upload (original source is included)

到這邊就已經完成囉

[sbox-FREMANTLE_ARMEL: ~/example_hildonprogram] > ls
Makefile     autom4te.cache  configure     example.hildonprogram-0.1            example.hildonprogram_0.1-1_armel.changes  missing
Makefile.am  compile         configure.ac  example.hildonprogram-0.1.tar.gz     example.hildonprogram_0.1-1_armel.deb      packaging
Makefile.in  config.log      data          example.hildonprogram_0.1-1.diff.gz  example.hildonprogram_0.1.orig.tar.gz      src
aclocal.m4   config.status   depcomp       example.hildonprogram_0.1-1.dsc      install-sh


2010年7月23日 星期五

Maemo 5 Hello World

衝著NOKIA N900 Linux base and open platform已經用了五六年的手機終於能退休了.事前其實沒作太多功課,光是看到x-terminal畫面還有busybox banner就已經受不了.期待已久真正功能強大又開放平台的Linux mobile phone終於出現了.對於像我這種天天在Linux programming的人來說真的是美夢成真,外人大概很難理解.網路上也有很多人對NOKIA update & bug fix很不滿.但以這一個月來使用的過程我個人覺得software穩定度已經很好,NOKIA一定也花了很多功夫在收尾.整體流暢度是還比不上IPhone但從Embedded Linux的產品來看真的是一大里程碑.

回到正題,NOKIA N900 Application Software的核心就是Maemo 5,架構可參考http://maemo.org/intro/platform/ 我想做的事就是寫一支可以在N900上跑的程式,用的是最熟悉不過的C Language.在開始之前有幾件事要做
1.在PC Ubuntu安裝Maemo 5 SDK,請參考http://maemo.org/development/
2.N900安裝openssh server & rootfs
開發的流程基本上是在Maemo 5 SDK 上coding and compile 再將binary複製到N900.

雖然說是Hello World但我並不想只是在x-terminal印個Hello World就好,而是能產生Window的程式.
其實到maemo.org就找得到這樣的程式碼.以下就是

/**
 * This file is part of maemo-examples package
 *
 * This maemo code example is licensed under a MIT-style license,
 * that can be found in the file called "COPYING" in the same
 * directory as this file.
 * Copyright (c) 2007-2008 Nokia Corporation. All rights reserved.
 */

/* Includes */
#include

#include
#include

int main(int argc, char *argv[])
{
    /* Create needed variables */
    HildonProgram *program;
    HildonWindow *window;

    /* Initialize the GTK. */
    gtk_init(&argc, &argv);

    /* Create the Hildon program and setup the title */
    program = HILDON_PROGRAM(hildon_program_get_instance());
    g_set_application_name("App Title");

    /* Create HildonWindow and set it to HildonProgram */
    window = HILDON_WINDOW(hildon_window_new());
    hildon_program_add_window(program, window);

    /* Add example label to window */
    gtk_container_add(GTK_CONTAINER(window),
                      GTK_WIDGET(gtk_label_new("HildonProgram Example")));

    /* Begin the main application */
    gtk_widget_show_all(GTK_WIDGET(window));

    /* Connect signal to X in the upper corner */
    g_signal_connect(G_OBJECT(window), "delete_event",
    G_CALLBACK(gtk_main_quit), NULL);

    gtk_main();

    /* Exit */
    return 0;
}

Maemo 5大量的使用glib & gtk,並在gtk上再建立一套UI library叫做Hildon以方便建立Window及各種control element. 程式碼本身我不再贅述,重點在source code compile & link

gcc -Wall `pkg-config --cflags gtk+-2.0 hildon-1` example_hildonprogram.c -o example_hildonprogram `pkg-config --libs gtk+-2.0 hildon-1`

example_hildonprogram就可以執行了

值得一提的是切換SDK platform再compile就可以產生相對應的binary code

[sbox-FREMANTLE_X86: ~] > sb-conf select FREMANTLE_ARMEL

[sbox-FREMANTLE_ARMEL: ~] > sb-conf select FREMANTLE_X86



2010年6月26日 星期六

NOKIA N900 Setup

1.Add extra reposity

Extras-devel
http://repository.maemo.org/extras-devel/
fremantle
free non-free

Extras-testing
http://repository.maemo.org/extras-testing
fremantle
free non-free

2.X-Treminal 新增 ~ | > 符號

gconftool-2 -s /apps/osso/xterm/key_labels -t list --list-type=string "[Tab,Esc,Up,Dn,~,|,>]"
gconftool-2 -s /apps/osso/xterm/keys -t list --list-type=string "[Tab,Escape,Page_Up,Page_Down,asciitilde,bar,greater]"

3.Keyboard Shortcut

General
Ctrl + Backspace: From within an application this will take you back out to the visual task manager. (Thanks to Chanse for that one.)
Ctrl + C: Copy text
Ctrl + V: Paste text
Ctrl + X: Cut text
Ctrl + A: Select all
Ctrl + O: Open (if available)
Ctrl + N: Create a new item (if available)
Ctrl + S: Save (if available)
Ctrl + Z: Undo (if available)
Ctrl + Y: Redo (if available)
Ctrl + F: Open search bar (if available)
Ctrl + Right arrow: Move the insertion point to the end of the word
Ctrl + Left arrow: Move the insertion point to the beginning of the word

Web browser
Ctrl + N: Open a new window
Ctrl + R: Reload the current page
Ctrl + B: Open a bookmark
Ctrl + D: Add a bookmark


Email
Ctrl + Enter: Send a message
Ctrl + R: Reply to a message


RSS Reader
Ctrl + R: Refresh the feed
Screenshots
Ctrl + Shift + P: Capture a screenshot.


3.rooting N900


Install rootsh package


Run root or sudo gainroot



4.Upgrade firmware to PR1.2

https://wiki.maemo.org/Updating_the_tablet_firmware

Download firmware
http://tablets-dev.nokia.com/nokia_N900.php

Usage
http://www.mobile01.com/topicdetail.php?f=122&t=1571608&p=1
http://www.mobile01.com/topicdetail.php?f=122&t=1571904&p=1
http://www.maemoers.com/thread-1176-1-1.html

5.Some screenshots









6.Access built-in camera through gstreamer

http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Using_Multimedia_Components/Camera_API_Usage

Since the maemo platform delegates all multimedia handling to the GStreamer framework, applications that need access to the built-in camera should employ GStreamer for this, instead of directly accessing Video4Linux devices, via the v4l2src GStreamer module.

安裝gstreamer tools
sudo gainroot

apt-get install gstreamer-tools

http://blog.pclewis.com/2010/02/streaming-nokia-n900-camera-to-vlc/


2010年6月10日 星期四

Rowboat Android Compile for BeagleBoard

Attention !!! The article is no longer useful due to rowboat updated ...

1.Get source


repo init
-u git://gitorious.org/rowboat/manifest.git -m rowboat-eclair-dsp.xml

2.Build

cd kernel
git checkout -b rowboat-eclair-2.6.32 rowboat/rowboat-eclair-2.6.32
cd ..

make TARGET_PRODUCT=beagleboard BUILD_WITH_GST=true dvsdk

3.Problems & Solutions

4.IO_ADDRESS undefine

Edit external/ti-dsp/dvsdk_3_00_02_44/dsplink_1_61_03/packages/dsplink/gpp/src/arch/OMAP3530/shmem/Linux/omap3530_phy_shmem.c

#if 0
halObject->generalCtrlBase = (Uint32)IO_ADDRESS(GENERAL_CONTROL_BASE) ;
halObject->iva2CmBase = (Uint32)IO_ADDRESS(IVA2_CM_BASE) ;
halObject->coreCmBase = (Uint32)IO_ADDRESS(CORE_CM_BASE) ;
halObject->perCmBase = (Uint32)IO_ADDRESS(PER_CM_BASE) ;
halObject->iva2PrmBase = (Uint32)IO_ADDRESS(IVA2_PRM_BASE) ;
halObject->mailboxBase = (Uint32)IO_ADDRESS(MAILBOX_BASE) ;
#endif
halObject->generalCtrlBase = (Uint32)ioremap(GENERAL_CONTROL_BASE, 4096) ;
halObject->iva2CmBase = (Uint32)ioremap(IVA2_CM_BASE, 8192) ;
halObject->coreCmBase = (Uint32)ioremap(CORE_CM_BASE, 8192) ;
halObject->perCmBase = (Uint32)ioremap(PER_CM_BASE, 8192) ;
halObject->iva2PrmBase = (Uint32)ioremap(IVA2_PRM_BASE, 8192) ;
halObject->mailboxBase = (Uint32)ioremap(MAILBOX_BASE, 4096) ;

5.

CC [M] /home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.o
/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c:53:2: warning: #warning *** not a warning *** Note: LINUX_VERSION_CODE >= 2.6.26
/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c: In function 'set_cached':
/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c:1086: error: 'L_PTE_CACHEABLE' undeclared (first use in this function)
/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c:1086: error: (Each undeclared identifier is reported only once
/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c:1086: error: for each function it appears in.)
/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c:1086: error: 'L_PTE_BUFFERABLE' undeclared (first use in this function)
make[6]: *** [/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.o] Error 1
make[5]: *** [_module_/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/cmem/src/module] Error 2
make[5]: Leaving directory `/home/gigijoe/rowboat-android/kernel'
gmake[4]: *** [release] Error 2
gmake[4]: Leaving directory `/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/cmem/src/module'
gmake[3]: *** [module] Error 2
gmake[3]: Leaving directory `/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/cmem/src'
gmake[2]: *** [src] Error 2
gmake[2]: Leaving directory `/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/cmem'
make[1]: *** [cmem_build] Error 2
make[1]: Leaving directory `/home/gigijoe/rowboat-android/external/ti-dsp'
make: *** [dvsdk] Error 2

Edit external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c


- vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) |
- (L_PTE_CACHEABLE | L_PTE_BUFFERABLE)
- );
+ vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) |
+ (L_PTE_MT_WRITETHROUGH | L_PTE_MT_BUFFERABLE)
+ );

Reference
http://www.mail-archive.com/davinci-linux-open-source@linux.davincidsp.com/msg15716.html

6.

CC [M] /home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/sdma/src/module/sdmak.o
/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/sdma/src/module/sdmak.c:45:22: error: mach/dma.h: No such file or directory
/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/sdma/src/module/sdmak.c:46:21: error: mach/tc.h: No such file or directory
/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/sdma/src/module/sdmak.c:61:2: warning: #warning *** not a warning *** Note: LINUX_VERSION_CODE >= 2.6.26
/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/sdma/src/module/sdmak.c: In function 'dma_ioctl':
/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/sdma/src/module/sdmak.c:150: error: implicit declaration of function 'omap_request_dma'
/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/sdma/src/module/sdmak.c:150: error: 'OMAP_DMA_NO_DEVICE' undeclared (first use in this function)
/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/sdma/src/module/sdmak.c:150: error: (Each undeclared identifier is reported only once
/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/sdma/src/module/sdmak.c:150: error: for each function it appears in.)
/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/sdma/src/module/sdmak.c:184: error: implicit declaration of function 'omap_free_dma'
make[6]: *** [/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/sdma/src/module/sdmak.o] Error 1
make[5]: *** [_module_/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/sdma/src/module] Error 2
make[5]: Leaving directory `/home/gigijoe/rowboat-android/kernel'
gmake[4]: *** [release] Error 2
gmake[4]: Leaving directory `/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/sdma/src/module'
gmake[3]: *** [module] Error 2
gmake[3]: Leaving directory `/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/sdma/src'
gmake[2]: *** [src] Error 2
gmake[2]: Leaving directory `/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/sdma'
make[1]: *** [sdma_build] Error 2
make[1]: Leaving directory `/home/gigijoe/rowboat-android/external/ti-dsp'
make: *** [dvsdk] Error 2

Edit external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/sdma/src/module/sdmak.c

-#include mach/dma.h
-#include mach/tc.h
+#include plat/dma.h
+#include plat/tc.h


7.Unable to compile mp3codec. Disable it

======== .interfaces [packages/ti/sdo/codecs/mp3dec] ========
package.mak:17: *** target pattern contains no `%'. Stop.
gmake: *** [packages/ti/sdo/codecs/mp3dec,.interfaces] Error 2
gmake[2]: *** [.all-packages] Error 2
gmake[2]: Leaving directory `/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/cs1omap3530_1_00_01'
make[1]: *** [cs_build] Error 2
make[1]: Leaving directory `/home/gigijoe/rowboat-android/external/ti-dsp'
make: *** [dvsdk] Error 2

Edit external/ti-dsp/dvsdk_3_00_02_44/cs1omap3530_1_00_01/packages/ti/sdo/server/cs/codec.cfg

- var MP3DEC = xdc.useModule('ti.sdo.codecs.mp3dec.ce.MP3DEC');
-// MP3DEC.alg.watermark = true; /*if it is evaluation version */
- MP3DEC.alg.watermark = false; /*if it is production version.*/
- MP3DEC.alg.codeSection = "DDR2";
- MP3DEC.alg.dataSection = "DDR2";
- MP3DEC.alg.udataSection = "DDR2";

...

- {name: "mp3dec", mod: MP3DEC,threadAttrs: {
- stackMemId: 0, priority: Server.MINPRI + 2}, groupId : 1,
- },
...

Edit external/ti-dsp/dvsdk_3_00_02_44/cs1omap3530_1_00_01/packages/ti/sdo/server/cs/package.xs

- validate_one_codec( "ti.sdo.codecs.mp3dec", "MP3DEC" );

rm -rf external/ti-dsp/dvsdk_3_00_02_44/cs1omap3530_1_00_01/packages/ti/sdo/codecs/mp3dec

8.

linux/Display_fbdev.c:45:29: error: mach/omapfb.h: No such file or directory
linux/Display_fbdev.c: In function 'Display_fbdev_create':
linux/Display_fbdev.c:260: error: 'OMAPFB_COLOR_YUV422' undeclared (first use in this function)
linux/Display_fbdev.c:260: error: (Each undeclared identifier is reported only once
linux/Display_fbdev.c:260: error: for each function it appears in.)
linux/Display_fbdev.c:279: warning: comparison between signed and unsigned integer expressions
linux/Display_fbdev.c:279: warning: comparison between signed and unsigned integer expressions
linux/Display_fbdev.c:280: warning: comparison between signed and unsigned integer expressions
gmake[3]: *** [obj/linux/Display_fbdev.omap3530.o470MV] Error 1
gmake[3]: Leaving directory `/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/dmai_2_00_01_04/packages/ti/sdo/dmai'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/dmai_2_00_01_04'
make[1]: *** [dmai_build] Error 2
make[1]: Leaving directory `/home/gigijoe/rowboat-android/external/ti-dsp'
make: *** [dvsdk] Error 2

Edit external/ti-dsp/dvsdk_3_00_02_44/dmai_2_00_01_04/packages/ti/sdo/dmai/linux/Display_fbdev.c

#ifdef Dmai_Device_omap3530
- #include mach/omapfb.h
+ #include linux/omapfb.h
#else
// #include video/davincifb.h
#endif


9.

/home/gigijoe/rowboat-android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-gcc -I/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/xdctools_3_15_01_59/packages -I../../../../packages -I/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/packages -I/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages -I/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/xdais_6_24/packages -DDmai_Device_omap3530 -I/home/gigijoe/rowboat-android/kernel/include -I/home/gigijoe/rowboat-android/kernel/arch/arm/plat-omap/include -include /home/gigijoe/rowboat-android/kernel/include/linux/autoconf.h -I/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages -I/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/dsplink_1_61_03/packages -DDmai_BuildOs_linux -Dxdc_target_types__=gnu/targets/std.h -I/home/gigijoe/dvsdk_3_00_00_32/linuxlibs/include -Dxdc_target_name__=arm/GCArmv7A -g -Wall -I/home/gigijoe/rowboat-android/bionic/libc/arch-arm/include -I/home/gigijoe/rowboat-android/bionic/libc/include -I/home/gigijoe/rowboat-android/bionic/libstdc++/include -I/home/gigijoe/rowboat-android/bionic/libc/kernel/common -I/home/gigijoe/rowboat-android/bionic/libc/kernel/arch-arm -I/home/gigijoe/rowboat-android/bionic/libm/include -I/home/gigijoe/rowboat-android/bionic/libm/arch/arm/include -I/home/gigijoe/rowboat-android/bionic/libthread_db/include -DHAVE_ARM_TLS_REGISTER -DANDROID -D_ANDROID_ -DSK_RELEASE -DNDEBUG -UDEBUG -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -finline-functions -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -fno-exceptions -fmessage-length=0 -march=armv7-a -mfloat-abi=softfp -msoft-float -mfpu=neon -mthumb -mthumb-interwork -W -Wall -Wno-unused -Winit-self -Wpointer-arith -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wstrict-aliasing=2 -Wno-multichar -Wno-missing-field-initializers -Os -g -I/home/gigijoe/rowboat-android/external/alsa-lib/include -I/home/gigijoe/rowboat-android/frameworks/base/include -c -o obj/linux/Fifo.omap3530.o470MV linux/Fifo.c
In file included from /home/gigijoe/rowboat-android/bionic/libc/kernel/arch-arm/asm/signal.h:82,
from /home/gigijoe/rowboat-android/bionic/libc/include/signal.h:35,
from /home/gigijoe/rowboat-android/bionic/libc/include/pthread.h:32,
from linux/Fifo.c:35:
/home/gigijoe/rowboat-android/kernel/include/asm-generic/signal.h:94: error: '__BITS_PER_LONG' undeclared here (not in a function)
/home/gigijoe/rowboat-android/kernel/include/asm-generic/signal.h:95: error: conflicting types for 'sigset_t'
/home/gigijoe/rowboat-android/bionic/libc/kernel/arch-arm/asm/signal.h:20: note: previous declaration of 'sigset_t' was here
In file included from /home/gigijoe/rowboat-android/bionic/libc/include/signal.h:35,
from /home/gigijoe/rowboat-android/bionic/libc/include/pthread.h:32,
from linux/Fifo.c:35:
/home/gigijoe/rowboat-android/bionic/libc/kernel/arch-arm/asm/signal.h:84: error: redefinition of 'struct sigaction'
/home/gigijoe/rowboat-android/bionic/libc/kernel/arch-arm/asm/signal.h:97: error: redefinition of 'struct sigaltstack'
/home/gigijoe/rowboat-android/bionic/libc/kernel/arch-arm/asm/signal.h:101: error: conflicting types for 'stack_t'
/home/gigijoe/rowboat-android/kernel/include/asm-generic/signal.h:119: note: previous declaration of 'stack_t' was here
gmake[3]: *** [obj/linux/Fifo.omap3530.o470MV] Error 1
gmake[3]: Leaving directory `/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/dmai_2_00_01_04/packages/ti/sdo/dmai'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/dmai_2_00_01_04'
make[1]: *** [dmai_build] Error 2
make[1]: Leaving directory `/home/gigijoe/rowboat-android/external/ti-dsp'
make: *** [dvsdk] Error 2

Edit external/ti-dsp/dvsdk_3_00_02_44/dmai_2_00_01_04/packages/ti/sdo/dmai/Makefile

-GCC_CPP_FLAGS += $(CPP_FLAGS) -I$(LINUXKERNEL_INSTALL_DIR)/include -I$(LINUXKERNEL_INSTALL_DIR)/arch/arm/$(PLATFORM_ARCH)/include $(HAVE_AUTOCONFIG) -I$(CMEM_INSTALL_DIR)/packages -I$(LINK_INSTALL_DIR)/packages -DDmai_BuildOs_linux -Dxdc_target_types__=gnu/targets/std.h -I$(LINUXLIBS_INSTALL_DIR)/include -Dxdc_target_name__=arm/GCArmv7A
+GCC_CPP_FLAGS += $(CPP_FLAGS) -I$(LINUXKERNEL_INSTALL_DIR)/arch/arm/$(PLATFORM_ARCH)/include $(HAVE_AUTOCONFIG) -I$(CMEM_INSTALL_DIR)/packages -I$(LINK_INSTALL_DIR)/packages -DDmai_BuildOs_linux -Dxdc_target_types__=gnu/targets/std.h -I$(LINUXLIBS_INSTALL_DIR)/include -Dxdc_target_name__=arm/GCArmv7A

10.

/home/gigijoe/rowboat-android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-gcc -I/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/xdctools_3_15_01_59/packages -I../../../../packages -I/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/packages -I/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages -I/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/xdais_6_24/packages -DDmai_Device_omap3530 -I/home/gigijoe/rowboat-android/kernel/arch/arm/plat-omap/include -include /home/gigijoe/rowboat-android/kernel/include/linux/autoconf.h -I/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages -I/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/dsplink_1_61_03/packages -DDmai_BuildOs_linux -Dxdc_target_types__=gnu/targets/std.h -I/home/gigijoe/dvsdk_3_00_00_32/linuxlibs/include -Dxdc_target_name__=arm/GCArmv7A -g -Wall -I/home/gigijoe/rowboat-android/bionic/libc/arch-arm/include -I/home/gigijoe/rowboat-android/bionic/libc/include -I/home/gigijoe/rowboat-android/bionic/libstdc++/include -I/home/gigijoe/rowboat-android/bionic/libc/kernel/common -I/home/gigijoe/rowboat-android/bionic/libc/kernel/arch-arm -I/home/gigijoe/rowboat-android/bionic/libm/include -I/home/gigijoe/rowboat-android/bionic/libm/arch/arm/include -I/home/gigijoe/rowboat-android/bionic/libthread_db/include -DHAVE_ARM_TLS_REGISTER -DANDROID -D_ANDROID_ -DSK_RELEASE -DNDEBUG -UDEBUG -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -finline-functions -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -fno-exceptions -fmessage-length=0 -march=armv7-a -mfloat-abi=softfp -msoft-float -mfpu=neon -mthumb -mthumb-interwork -W -Wall -Wno-unused -Winit-self -Wpointer-arith -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wstrict-aliasing=2 -Wno-multichar -Wno-missing-field-initializers -Os -g -I/home/gigijoe/rowboat-android/external/alsa-lib/include -I/home/gigijoe/rowboat-android/frameworks/base/include -c -o obj/linux/omap3530/Framecopy_accel.omap3530.o470MV linux/omap3530/Framecopy_accel.c
linux/omap3530/Framecopy_accel.c:51:32: error: linux/omap_resizer.h: No such file or directory
linux/omap3530/Framecopy_accel.c: In function 'Framecopy_accel_config':
linux/omap3530/Framecopy_accel.c:78: error: variable 'params' has initializer but incomplete type
linux/omap3530/Framecopy_accel.c:79: warning: excess elements in struct initializer
linux/omap3530/Framecopy_accel.c:79: warning: (near initialization for 'params')
linux/omap3530/Framecopy_accel.c:80: warning: excess elements in struct initializer
linux/omap3530/Framecopy_accel.c:80: warning: (near initialization for 'params')
linux/omap3530/Framecopy_accel.c:81: warning: excess elements in struct initializer
linux/omap3530/Framecopy_accel.c:81: warning: (near initialization for 'params')
linux/omap3530/Framecopy_accel.c:82: error: 'RSZ_INTYPE_YCBCR422_16BIT' undeclared (first use in this function)
linux/omap3530/Framecopy_accel.c:82: error: (Each undeclared identifier is reported only once
linux/omap3530/Framecopy_accel.c:82: error: for each function it appears in.)
linux/omap3530/Framecopy_accel.c:82: warning: excess elements in struct initializer
linux/omap3530/Framecopy_accel.c:82: warning: (near initialization for 'params')
linux/omap3530/Framecopy_accel.c:83: warning: excess elements in struct initializer
linux/omap3530/Framecopy_accel.c:83: warning: (near initialization for 'params')
linux/omap3530/Framecopy_accel.c:84: warning: excess elements in struct initializer
linux/omap3530/Framecopy_accel.c:84: warning: (near initialization for 'params')
linux/omap3530/Framecopy_accel.c:85: warning: excess elements in struct initializer
linux/omap3530/Framecopy_accel.c:85: warning: (near initialization for 'params')
linux/omap3530/Framecopy_accel.c:86: error: 'RSZ_PIX_FMT_UYVY' undeclared (first use in this function)
linux/omap3530/Framecopy_accel.c:86: warning: excess elements in struct initializer
linux/omap3530/Framecopy_accel.c:86: warning: (near initialization for 'params')
linux/omap3530/Framecopy_accel.c:87: warning: excess elements in struct initializer
linux/omap3530/Framecopy_accel.c:87: warning: (near initialization for 'params')
linux/omap3530/Framecopy_accel.c:88: warning: excess elements in struct initializer
linux/omap3530/Framecopy_accel.c:88: warning: (near initialization for 'params')
linux/omap3530/Framecopy_accel.c:89: warning: excess elements in struct initializer
linux/omap3530/Framecopy_accel.c:89: warning: (near initialization for 'params')
linux/omap3530/Framecopy_accel.c:90: warning: excess elements in struct initializer
linux/omap3530/Framecopy_accel.c:90: warning: (near initialization for 'params')
linux/omap3530/Framecopy_accel.c:91: warning: excess elements in struct initializer
linux/omap3530/Framecopy_accel.c:91: warning: (near initialization for 'params')
linux/omap3530/Framecopy_accel.c:92: error: extra brace group at end of initializer
linux/omap3530/Framecopy_accel.c:92: error: (near initialization for 'params')
linux/omap3530/Framecopy_accel.c:97: warning: excess elements in struct initializer
linux/omap3530/Framecopy_accel.c:97: warning: (near initialization for 'params')
linux/omap3530/Framecopy_accel.c:98: error: extra brace group at end of initializer
linux/omap3530/Framecopy_accel.c:98: error: (near initialization for 'params')
linux/omap3530/Framecopy_accel.c:103: warning: excess elements in struct initializer
linux/omap3530/Framecopy_accel.c:103: warning: (near initialization for 'params')
linux/omap3530/Framecopy_accel.c:104: error: extra brace group at end of initializer
linux/omap3530/Framecopy_accel.c:104: error: (near initialization for 'params')
linux/omap3530/Framecopy_accel.c:109: warning: excess elements in struct initializer
linux/omap3530/Framecopy_accel.c:109: warning: (near initialization for 'params')
linux/omap3530/Framecopy_accel.c:78: error: storage size of 'params' isn't known
linux/omap3530/Framecopy_accel.c:140: error: 'RSZ_S_PARAM' undeclared (first use in this function)
linux/omap3530/Framecopy_accel.c:147: error: 'RSZ_S_EXP' undeclared (first use in this function)
linux/omap3530/Framecopy_accel.c:155: error: 'RSZ_REQBUF' undeclared (first use in this function)
linux/omap3530/Framecopy_accel.c: In function 'Framecopy_accel_execute':
linux/omap3530/Framecopy_accel.c:221: error: 'RSZ_QUERYBUF' undeclared (first use in this function)
linux/omap3530/Framecopy_accel.c:235: error: 'RSZ_QUEUEBUF' undeclared (first use in this function)
linux/omap3530/Framecopy_accel.c:241: error: 'RSZ_RESIZE' undeclared (first use in this function)
gmake[3]: *** [obj/linux/omap3530/Framecopy_accel.omap3530.o470MV] Error 1
gmake[3]: Leaving directory `/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/dmai_2_00_01_04/packages/ti/sdo/dmai'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/home/gigijoe/rowboat-android/external/ti-dsp/dvsdk_3_00_02_44/dmai_2_00_01_04'
make[1]: *** [dmai_build] Error 2
make[1]: Leaving directory `/home/gigijoe/rowboat-android/external/ti-dsp'
make: *** [dvsdk] Error 2

Edit external/ti-dsp/dvsdk_3_00_02_44/dmai_2_00_01_04/packages/ti/sdo/dmai/Makefile

+GCC_CPP_FLAGS += $(CPP_FLAGS) -I$(LINUXKERNEL_INSTALL_DIR)/include -I$(LINUXKERNEL_INSTALL_DIR)/arch/arm/$(PLATFORM_ARCH)/include $(HAVE_AUTOCONFIG) -I$(CMEM_INSTALL_DIR)/packages -I$(LINK_INSTALL_DIR)/packages -DDmai_BuildOs_linux -Dxdc_target_types__=gnu/targets/std.h -I$(LINUXLIBS_INSTALL_DIR)/include -Dxdc_target_name__=arm/GCArmv7A
-GCC_CPP_FLAGS += $(CPP_FLAGS) -I$(LINUXKERNEL_INSTALL_DIR)/arch/arm/$(PLATFORM_ARCH)/include $(HAVE_AUTOCONFIG) -I$(CMEM_INSTALL_DIR)/packages -I$(LINK_INSTALL_DIR)/packages -DDmai_BuildOs_linux -Dxdc_target_types__=gnu/targets/std.h -I$(LINUXLIBS_INSTALL_DIR)/include -Dxdc_target_name__=arm/GCArmv7A

11.cmemk: Unknown symbol init_mm


Edit kernel/.config

CONFIG_UNUSED_SYMBOLS=y
vi ./external/ti-dsp/dvsdk_3_00_02_44/codec_engine_2_24_01/cetools/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c

/*
* This is useful to dump out the page tables associated with
* 'addr' in mm 'mm'.
*/
void show_pte(struct mm_struct *mm, unsigned long addr)
{
pgd_t *pgd;
#if 0
if (!mm)
mm = &init_mm;
#endif

vi ./external/ti-dsp/dvsdk_3_00_02_44/linuxutils_2_24_02/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c

/*
* This is useful to dump out the page tables associated with
* 'addr' in mm 'mm'.
*/
void show_pte(struct mm_struct *mm, unsigned long addr)
{
pgd_t *pgd;
#if 0
if (!mm)
mm = &init_mm;
#endif

Reference

http://groups.google.gp/group/linux.kernel/browse_thread/thread/66877343361ce881


12.Disable trace of dsplink

Edit external/ti-dsp/Makefile

-DSPLINK_CONFIG := --platform=OMAP3530 --nodsp=1 --dspcfg_0=OMAP3530SHMEM --dspos_0=DSPBIOS5XX --gppos=OMAPLSP --comps=ponslrmc --trace=1
+DSPLINK_CONFIG := --platform=OMAP3530 --nodsp=1 --dspcfg_0=OMAP3530SHMEM --dspos_0=DSPBIOS5XX --gppos=OMAPLSP --comps=ponslrmc

13.TI DMAI issue

The Dmai not work due to incompatable DSS sysfs interface

export CE_DEBUG=1
export DMAI_DEBUG=3

@0,629,974us: [+6 T:0xafe44a98] CE - Engine_init> CE debugging on (CE_DEBUG=1; allowed CE_DEBUG levels: 1=min, 2=good, 3=max)
@0,430,175us: [+6 T:0xafe44a98] CE - Engine_init> CE debugging on (CE_DEBUG=1; allowed CE_DEBUG levels: 1=min, 2=good, 3=max)
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
@0,590,759us: [+7 T:0x0010dfa8] ti.sdo.dmai - [Dmai] Failed to open /sys/devices/platform/omapfb/overlays for writing
@0,590,850us: [+7 T:0x0010dfa8] ti.sdo.dmai - [Display] Failed to write gfx e:0 on /sys/devices/platform/omapfb/overlays
@0,590,881us: [+7 T:0x0010dfa8] ti.sdo.dmai - Caught SIGSEGV accessing address 0x1
init: untracked pid 1047 exited

For now I just disable sysfs support to get DMAI works with default DSS setup.

Edit external/ti-dsp/dvsdk_3_00_02_44/dmai_2_00_01_04/packages/ti/sdo/dmai/linux/Display.c

/******************************************************************************
 * _Display_sysfsChange (INTERNAL)
 ******************************************************************************/
Int _Display_sysfsChange(Display_Output displayOutput,
                    Char* displayDevice, VideoStd_Type *videoType,
                    Int *rotation)
{
+#if 0
-#ifdef Dmai_Device_omap3530   

Testing

gst-launch-0.10 videotestsrc num-buffers=1000 ! TIDmaiVideoSink accelFrameCopy=false

gst-launch-0.10 filesrc location=/sdcard/video.mp4 ! typefind ! qtdemux name=demux demux.video_00 ! queue ! TIViddec2 ! TIDmaiVideoSink accelFrameCopy=false


2010年6月1日 星期二

Gstreamer V4L2 input & H.264 RTP

Reference

http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines

http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/gst/rtp/README


1.Camera preview

gst-launch-0.10 v4l2src ! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! ximagesink

2.Video Source (192.168.168.90)

gst-launch -v v4l2src ! video/x-raw-yuv,width=640,height=480,framerate=30/1 ! x264enc ! rtph264pay pt=96 ! multiudpsink clients="192.168.168.75:1234"

另外一種方式

http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/tests/examples/rtp/server-v4l2-H264-alsasrc-PCMA.sh

3.Video Sink (192.168.168.75)

gst-launch udpsrc port=1234 caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264" ! gstrtpjitterbuffer latency=100 ! rtph264depay ! ffdec_h264 ! xvimagesink

另外一種方式

http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/tests/examples/rtp/client-H264.sh

http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/tests/examples/rtp/client-H264-PCMA.sh

4.轉載一篇很詳細的文章

http://www.twm-kd.com/computers/software/webcam-and-linux-gstreamer-tutorial/


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