$ apt-get install libglib2.0-dev
2. write source code to print "hello world!"
#include
int main(int argc, char** argv)
{
g_printf("hello world!\n");
}
3. compile
gcc `pkg-config --libs --cflags glib-2.0` hello.c
$ find ~/myspace/git/opencore -type f -name "*.[ch] -o -name "*.cpp" -exec grep -I "equalizer" {} \; -print
1. disable the Atheros proprietary drivers from "system->adminstrator->hardware drivers"
2. unplug the wired ethernet line
3. extract ndiswrapper-1.55.tar.gz, and make & sudo make install
4. extract madwifi-hal-0.10.5.6-r3835-20080801.tar.gz, make & sudo make install
5. extract Wireless_Atheros.zip, use ndisgtk to install the net5211.inf
or
$ sudo ndiswrapper -a XXXX:YYYY ath0 (here XXXX:YYYY is get from lspci -n for Atheros card)
6. setup
add ndiswrapper at the end of /etc/modprobe.d/blacklist
add ath_pci at the end of /etc/modules
$ sudo iwconfig
$ sudo lshw -C network
$ iwlist scan (to find my wireless network)
$ sudo network-admin (which should setup wireless network)
check the following configuration at /etc/network/interfaces
=======================
iface ath0 inet dhcp
wireless-key XXXX
wireless-essid fade
auto ath0
=======================
Here XXXX is my wep password.
call "/etc/init.d/networking restart" to restart
$ cd /usr/local
$ /tmp/jdk-1_5_0_19-linux-i586.bin
$ sudo updatedb
$ locate javac | grep bin
/usr/local/jdk1.5.0_19/bin/javac (the result)
$ sudo /usr/sbin/alternatives --install /usr/bin/java java /usr/local/jdk1.5.0_19/bin/java 100
$ sudo /usr/sbin/alternatives --install /usr/bin/jar jar /usr/local/jdk1.5.0_19/bin/jar 100
$ sudo /usr/sbin/alternatives --install /usr/bin/javac javac /usr/local/jdk1.5.0_19/bin/javac 100
$ sudo /usr/sbin/alternatives --config java
$ cd ~/bin (make sure ~/bin is in $PATH)
$ curl http:/android.git.kernel.org/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ cd ~/myspace/mydroid
$ repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake
$ repo sync
/* bar initialize input (or 3 to each element)
*/
int bar(int* in, int n)
{
int ret;
__asm__(
".set push \n" // save assembler option
".set noreorder\n" // suppress reordering
"lw $9, %2 \n" // $9 = n (counter end)
"li $8, 0 \n" // $8 = 0
"li $12, 0 \n" // $12 = 0
"move $4, %1\n" // $4 = in
"loop: \n"
"lw $11, ($4) \n" // $11 = *in
"ori $11, $11, 3 \n" // $11 = $11 || 3
"sw $11, ($4) \n" // *in = $11
"addi $4, $4, 4 \n" // in++ (move to next addess)
"addi $8, $8, 1 \n" // move to next sample
"bne $8, $9, loop \n" // loop
"sw $11, %0 \n" // save $12 to ret
".set pop \n" // restore assembler option
: "=m" (ret) // to return
: "r" (in),"m" (n) // the input
);
return ret;
}
/* foo returns (val | 3)
*/
int foo(int val)
{
int ret;
__asm__(
".set push\n" // save assembler option
".set noreorder\n" // suppress reordering
"ori $2, %1, %2\n"
"sw $2, %0\n" // save $2 to ret
".set pop\n" // pop assembler option
: "=m" (ret) // ret: memory
: "r" (val), "n" (3) // val: read-only register, n: number
);
return ret;
}
08804554:
8804554: 27bdffd0 addiu sp,sp,-48
8804558: afbe0020 sw s8,32(sp)
880455c: 03a0f021 move s8,sp
8804560: afc40010 sw a0,16(s8)
8804564: 8fc20010 lw v0,16(s8)
8804568: 34420003 ori v0,v0,0x3
880456c: afc20000 sw v0,0(s8)
8804570: 8fc20000 lw v0,0(s8)
8804574: 03c0e821 move sp,s8
8804578: 8fbe0020 lw s8,32(sp)
880457c: 27bd0030 addiu sp,sp,48
8804580: 03e00008 jr ra
8804584: 00000000 nop
$ android create project --target 1 --path ./demo --activity demo --package com.example.demo
$ ant -debug -verbose
#! /bin/sh
out/host/linux-x86/bin/emulator -verbose \
-kernel prebuild/android-arm/kernel/kernel-qemu \
-ramdisk out/target/product/generic/ramdisk.img \
-system out/target/product/generic/system.img \
-init-data out/target/product/generic/userdata.img \
-avd myavd -sdcard ./sdcard.img -no-skin -no-boot-anim
$ cd ~/myspace/demo
$ adb install bin/demo-debug.apk
$ adb install -r bin/demo-debug.apk (for reinstall)
$ adb shell
# logcat
# ps a (to get process id to kill)
# kill -9
$ cd ~/myspace/mydroid
$ source ./build/envsetup.sh
$ lunch 1
$ cd ./frames/base/media/libmediaplayerservice
$ mm (it builds libmediaplayerservice library as an example)
$ cd ~/myspace/mydroid (go back to the root)
$ make snod (build the system image
#!/bin/bash
rate=44100
blksize=8192
cpu=222
call=532
# the following val is got from gprof as percentage cpu time, 30.11%.
pcpu_foo=30.11
duration=`echo "scale=4; $blksize * $call / $rate" | bc`
echo "duration: " $duration
secs_foo=`echo "scale=4; $duration * $pcpu_foo /100" | bc`
echo "secs_foo " $secs_foo
blksecs_foo=`echo "scale=4; $secs_foo/$call"|bc`
echo "blocksecs_foo" $blksecs_foo
cpu_foo=`echo "scale=4; $cpu * $rate / $blksize * $blksecs_foo"|bc`
echo "cpu_foo " $cpu_foo " MCycle/sec"
$ sudo apt-get install libxt-dev libxaw-headers libxaw7-dev
$ make
$ sudo make install
cd ~/myspace/tmp/system/lib
ln -s libc.so libc.so.6
CC=arm-none-linux-gnueabi-gcc
LD=arm-none-linux-gnueabi-ld
AR=arm-none-linux-gnueabi-ar
LD_OPTS= --entry=_start \
--dynamic-linker /system/bin/linker -nostdlib \
-rpath /system/lib -rpath ~/myspace/tmp/system/lib \
-L ~/myspace/tmp/system/lib -L .
foo2.a : foo2.c
$(CC) -g -fpic -c foo2.c
$(CC) -g -shared -nostdlib -o libfoo2.so foo2.o
$(AR) -rcs $@ foo2.o
foo2: main.c start.c foo2.a
$(CC) -g -c main.c
$(CC) -g -c start.c
$(LD) $(LD_OPTS) -lc -lfoo2 -o foo2 main.o start.o
$ make foo2
$ adb push libfoo2.so /data
$ adb push foo2 /data
$ adb shell
# cd data
# ./trace ./foo2
sudo apt-get install portmap nfs-common
sudo /etc/init.d/portmap restart
sudo /etc/init.d/nfs-common restart
sudo mount -t nfs 192.168.0.9:/tftpboot /mnt -o nolock
$ ant debug
$ adb install -r .\bin\foo-debug.apk
$ adb push your\file /sdcard
markc@ubuntu-vm:/opt $ls -la
total 16
drwxr-xr-x 4 root root 4096 2009-04-27 11:04 .
drwxr-xr-x 25 root root 4096 2009-02-18 11:04 ..
drwxr-xr-x 7 root root 4096 2008-08-08 11:04 alp-dev
drwxr-xr-x 2 markc markc 4096 2009-04-27 11:04 work
^ ^
| |
chown chgrp
$ sudo chown markc work
$ sudo chgrp markc work
$ sudo yum remove pulseaudio
@echo off
SET MAKE_MODE=UNIX
SET PATH=D:\disk\cygwin\bin;%PAtH%
SET HOME=D:\disk\markc
SET CYGWIN=tty binmode
D:
chdir %HOME%
bash
# source the system wide bashrc if it exists
if [ -e /etc/bash.bashrc ] ; then
source /etc/bash.bashrc
fi
# source the users bashrc if it exists
if [ -e "${HOME}/.bashrc" ] ; then
source "${HOME}/.bashrc"
fi
export PATH=/usr/bin:/sbin:/usr/local/bin
export PATH=/usr/local/psp/gcc-2.8.2/bin:$PATH
export PATH=/usr/local/psp/devkit/bin:$PATH:.
export PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '
set autoindent
set softtabstop=4
set tabstop=4
set shiftwidth=4
set showmatch
set ignorecase
set background=dark
set hlsearch
set incsearch
set number
syntax on
set fileformats=unix,dos
set fileformat=unix
$ git config --global user.name "foo"
$ git config --global user.email "foo@gmail.com"
$ cd sur
$ git init
$ git add sur.w %my source code
$ git commit -m "first commit"
$ git remote add origin git@github.com:dsmarkchen/sur.git
$ git push origin master
ssh -v git@github.com
$ cd ~/.ssh
$ ssh-keygen -t rsa
/* macros*/
G_BEGIN_DECLS
#define GST_TYPE_MIDISRC (gst_my_midisrc_get_type())
#define GST_MIDISRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MIDISRC,GstMidisrc))
#define GST_MIDISRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MIDISRC,GstMidisrcClass))
#define GST_IS_MIDISRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MIDISRC))
#define GST_IS_MIDISRC_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MIDISRC))
/* standard function returning type information */
GType gst_my_midisrc_get_type (void);
/* definition a class of this element */
typedef struct _GstMidisrc GstMidisrc;
struct _GstMidisrc
{
GstBaseSrc parent;
[...]
};
typedef struct _GstMidisrcClass GstMidisrcClass;
struct _GstMidisrcClass
{
GstBaseSrcClass parent_class;
};
G_END_DECLS
GST_BOILERPLATE (GstMidisrc, gst_my_midisrc, GstBaseSrc, GST_TYPE_BASE_SRC);
static GstElementDetails midisrc_details = {
"A Gstreamer Plug-in",
"Src/Audio",
"audio src for GStreamer Plug-in",
""
};
/* set detail with _base_init function when register the plugin */
static void
gst_my_midisrc_base_init (gpointer klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&src_factory));
gst_element_class_set_details (element_class, &midisrc_details);
}
/* create the class, here we define which function need to be re-implmented from the base class, and add property for the class */
static void
gst_my_midisrc_class_init (GstMidisrcClass *klass)
{
GObjectClass *gobject_class;
GstBaseSrcClass *basesrc_class;
gobject_class = G_OBJECT_CLASS (klass);
basesrc_class = GST_BASE_SRC_CLASS (klass);
gobject_class->set_property = gst_midisrc_set_property;
gobject_class->get_property = gst_midisrc_get_property;
/* basesrc_class->get_caps = gst_midisrc_get_caps;
basesrc_class->set_caps = gst_midisrc_set_caps; */
basesrc_class->start = gst_midisrc_start;
basesrc_class->stop = gst_midisrc_stop;
basesrc_class->create = gst_midisrc_create;
/* install a property for the class as an example */
g_object_class_install_property (
gobject_class, ARG_LOCATION,
g_param_spec_string ("location", "File Location",
"Location of the file to read", NULL, G_PARAM_READWRITE));
}
/* create the object */
static void
gst_my_midisrc_init (GstMidisrc *midisrc, GstMidisrcClass *klass)
{
[...]
}
/* set property sample */
static gboolean
gst_midisrc_set_location (GstMidisrc * src, const gchar * location)
{
/* the element must be stopped in order to do this */
GST_STATE_LOCK (src);
{
GstState state;
state = GST_STATE (src);
if (state != GST_STATE_READY && state != GST_STATE_NULL)
goto wrong_state;
}
GST_STATE_UNLOCK (src);
g_free (src->filename);
g_free (src->uri);
/* clear the filename if we get a NULL (is that possible?) */
if (location == NULL) {
src->filename = NULL;
src->uri = NULL;
} else {
src->filename = g_strdup (location);
}
return TRUE;
/* ERROR */
wrong_state:
{
GST_DEBUG_OBJECT (src, "setting location in wrong state");
GST_STATE_UNLOCK (src);
return FALSE;
}
}
static void
gst_midisrc_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec)
{
GstMidisrc *midisrc;
int tmp = 0;
g_return_if_fail (GST_IS_MIDISRC (object));
midisrc = GST_MIDISRC (object);
switch (prop_id) {
case ARG_LOCATION:
gst_midisrc_set_location(midisrc, g_value_get_string (value));
printf("set location done!\n");
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_midisrc_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec)
{
GstMidisrc *midisrc;
g_return_if_fail (GST_IS_MIDISRC (object));
midisrc = GST_MIDISRC (object);
switch (prop_id) {
case ARG_LOCATION:
g_value_set_string(value, midisrc->filename);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static gboolean
gst_midisrc_start (GstBaseSrc * src)
{
GstMidisrc *midisrc = GST_MIDISRC (src);
[...]
}
static GstFlowReturn
gst_midisrc_create (GstBaseSrc * src,
guint64 offset,
guint length,
GstBuffer ** buffer)
{
GstMidisrc *midisrc = GST_MIDISRC (src);
if (midisrc->eos_reached)
return GST_FLOW_UNEXPECTED;
return( gst_midisrc_get_read (src, buffer));
}
static GstFlowReturn
gst_midisrc_get_read (GstBaseSrc * basesrc, GstBuffer ** buffer)
{
GstFlowReturn res;
GstMidisrc *midisrc = GST_MIDISRC (basesrc);
[...]
[...]
}
smbmnt must be installed suid root for direct user mount.
$ sudo chmod u+s `which smbmnt`
$ sudo chmod u+s `which smbumount`
$ cvs diff -u8pN /path/foo > markc_20090120.patch