分类: Linux Development

  • Check shared library depends under android platform

    source build/envsetup.sh
    lunch full-eng

    arm-linux-androideabi-readelf -d out/target/product/generic/system/bin/fsck_msdos

  • Mirror SVN repository

    #!/bin/bash
    SVN=/mirror/svn
    PRJ=”DD-WRT”
    BASE=${SVN}/${PRJ}
    MIRROR=file://$BASE
    MASTER=svn://svn.dd-wrt.com/${PRJ}
    BUILD=”/build”

    [[ ! -d ${BASE} ]] && {
    svnadmin create ${BASE}

    cat > ${BASE}/hooks/pre-revprop-change <<EOF
    #!/bin/sh
    exit 0
    EOF

    chmod +x ${BASE}/hooks/pre-revprop-change

    svnsync init ${MIRROR} ${MASTER}
    }

    # list
    svn proplist –verbose –revprop -r 0 ${MIRROR}

    #sync mirror against master
    svnsync –non-interactive sync ${MIRROR}

    # list
    #svn proplist –verbose –revprop -r 0 ${MIRROR}

    exit

    # Checkout build
    mkdir ${BUILD}/${PRJ}
    cd ${BUILD}/${PRJ}
    svn checkout -q ${MIRROR}/branches/devel ${PRJ}-devel

    #Update build against mirror
    cd ${BUILD}/${PRJ}
    svn update
    svn log –verbose –limit 3

    # build image
    # http://www.dd-wrt.com/wiki/index.php/Development/zh_cn

  • Debian CD Image download

    http://ftp.at.debian.org/debian-cd/6.0.7/amd64/iso-cd/

    aria2c -j 10 http://ftp.at.debian.org/debian-cd/6.0.7/amd64/iso-cd/debian-6.0.7-amd64-netinst.iso

     

     

     

  • clone svn repository into git

    ## Install git-svn tool
    # if CentOS
    yum install subversion-perl

    # if Ubuntu
    sudo apt-get install libsvn-perl

    ## In git server, Create empty repo of exfat as my project

    ## Create Bare repo of /repo/exfat
    cd /repo
    git init --bare exfat.git
    cd exfat.git
    cp hooks/post-update.sample hooks/post-update
    git symbolic-ref HEAD refs/remotes/trunk

    ## Clone svn with git-svn in work repo of /repo/svn/exfat
    cd /repo/svn
    git svn clone -s http://exfat.googlecode.com/svn /repo/svn/exfat
    cd exfat
    git config core.worktree /repo/svn/exfat
    git gc

    ## Convert SVN Tag to Git Tag
    /usr/local/bin/svn2git

    ##   Add svn ignore, if have
    git svn show-ignore > .gitignore
    git add .gitignore
    git commit -m ‘Convert svn:ignore properties to .gitignore.’

    # # Push git rep to bare repository
    git remote add origin /repo/exfat.git
    git push origin –mirror

    ## Put other svn branch into bare repo
    # git branch -r
    git checkout -t -b svn-trunk trunk
    git push origin –mirror

    git checkout -t -b svn-v1.0.x v1.0.x
    git push origin –mirror

     

    ## Verify by checkout in workstation

    cd /tmp/test
    git clone ssh://git.zhenglei.net/repo/exfat.git
    cd exfat

  • Rip Flac on ubuntu

    sudo apt-get install ripit
    sudo nano /etc/ripit/config
    ripit

  • setup git server on centos 5

    # Install Git on git.zhenglei.net
    yum install expat-devel zlib-devel gettext-devel openssl-devel
    unzip git-1.7.2.5.zip
    cd git-1.7.2.5
    make prefix=/usr/local install

    ## Create empty repository of test.git in /repo of git.zhenglei.net
    mkdir /repo
    cd /repo
    GIT_DIR=test.git git init
    cd test.git
    git –bare update-server-info
    cp hooks/post-update.sample hooks/post-update

    ## Access git.zhenglei.net via port XXXX over ssh
    # Config ssh on workstation
    echo “Host git.zhenglei.net” >>~/.ssh/config
    echo “hostname git.zhenglei.net”>>~/.ssh/config
    echo port XXXX >>~/.ssh/config

    ## Clone test.git
    git clone ssh://root@git.zhenglei.net/repo/test.git

    ## Add README in local
    cd test
    touch README
    git add README
    git commit -m “add readme”

    ## Push back to server
    git push origin master

  • Script to Build Android Kernel Under Ubuntu

    #!/bin/bash
    #
    ANDROID=”android-4.1.1_r6.1″
    GCC=4.4.3

    KERNEL=goldfish
    KCONFIG=goldfish_armv7_defconfig

    #GIT_SERVER=aosp.zhenglei.net
    GIT_SERVER=127.0.0.1
    GIT_PATH=”git/aosp”

    PREBUILT=prebuilt
    HOST=”linux-x86″
    ARCH=”arm”
    BUILD_PATH=”build”

    function get_Tool {
    LOC=”$1″
    TAG=”$2″
    VER=”$3″
    TOOL_CHAIN=${ARCH}-eabi-${GCC}

    if [ ! -d ${LOC}/${TOOL_CHAIN} ];then
    if [ ! -d ${PREBUILT}/${TOOL_PATH} ];then
    if [ -d ${PREBUILT} ];then
    rm -rf ${PREBUILT}
    fi
    git clone git://${GIT_SERVER}/${GIT_PATH}/platform/prebuilt
    fi

    cd ${PREBUILT}
    CUR_BRANCH=`git branch|grep “^* “|sed “s/^* //”`
    if [ “${CUR_BRANCH}” != “${TAG}” ];then
    #    git tag -l
    git checkout -b ${TAG}
    fi
    cd ..

    cp -r ${PREBUILT}/${HOST}/toolchain/${TOOL_CHAIN} ${LOC}

    fi
    TOOL_PATH=”`pwd`/${LOC}/${TOOL_CHAIN}”
    }

    function get_Kernel {
    kernel=”$1″
    if [ ! -d ${kernel} ];then
    git clone git://${GIT_SERVER}/${GIT_PATH}/kernel/${kernel}.git
    fi

    cd ${kernel}
    # git branch -a
    CUR_BRANCH=`git branch|grep “^* “|sed “s/^* //”`
    if [ “${CUR_BRANCH}” != “${kernel}” ];then
    git checkout -t remotes/origin/android-${kernel}-2.6.29 -b ${kernel}
    fi
    if [ ! -d ../${BUILD_PATH}/${kernel} ];then
    mkdir ../${BUILD_PATH}/${kernel}
    git archive –format tar HEAD|tar x -C ../${BUILD_PATH}/${kernel}/
    fi
    cd ..
    }

    function build_Kernel {
    config=$1
    cd ${BUILD_PATH}/${kernel}
    #ls -l arch/${ARCH}/configs/
    make ${config}

    START=`date +%s`
    echo “Start to build at time:  $START”
    echo “################################”
    echo
    echo

    make -j4

    echo
    echo
    echo “################################”
    FINISH=`date +%s`
    echo “Finish build at time: $FINISH”
    echo
    ELAPSED=`expr $FINISH – $START`
    echo “Elapsed time: $ELAPSED”
    cd ..
    cd ..
    }

    ##### Main ######
    if [ ! -d ${BUILD_PATH} ];then
    mkdir ${BUILD_PATH}
    fi

    rm -rf ${BUILD_PATH}/*

    get_Tool $BUILD_PATH $ANDROID $GCC

    export ARCH=arm
    export SUBARCH=arm
    export CROSS_COMPILE=arm-eabi-
    export PATH=${TOOL_PATH}/bin:$PATH

    get_Kernel $KERNEL

    build_Kernel $KCONFIG

    # Output

    cp ${BUILD_PATH}/${KERNEL}/arch/${ARCH}/boot/zImage ${BUILD_PATH}/${KERNEL}/

    # Luanch emulator with build kernel
    # emulator -kernel ${KERNEL}/zImage

  • Multi-Section http downlioad under Ubuntu

    Install tool:   aria2c

    wget http://sourceforge.net/projects/aria2/files/stable/aria2-1.16.1/aria2-1.16.1.tar.bz2
    tar xvfj aria2*.bz2
    cd aria2*
    ./configure
    make
    sudo make install

    Download with   aria2c

    aria2c -j 10 http://anon.nasa-global.edgesuite.net/HD_downloads/HLV_Launch_anim.mov

     

  • Setup ajaxplorer on debian 6

    apt-get install nginx spawn-fcgi

    apt-get install  php5-cli php5-cgi php5-gd php5-mcrypt

     

    #change locale from C to EN UTF-8 by selecting en_US.UTF-8

    dpkg-reconfigure locales

     

    modify .brshrc by adding

    export LANG=en_US.UTF-8

     

     

     

    #config php5 nginx by install a pre-configed deb package

    dpkg -i php-nginx_0.2_all.deb

     

    # restart nginx and php

    /etc/init.d/php-fastcgi stop

    /etc/init.d/nginx restart

    /etc/init.d/php-fastcgi start