2011年12月28日 星期三

jenkins on Ubuntu

1. install jenkins

nohup java ­jar jenkins.war > $LOGFILE 2>&1  (default 8080 port)

or nohup java ­jar jenkins.war --httpPort=xxxx
-1 means using https

2. start jenkins
/etc/init.d/jenkins start 
or service jenkins start

3. modify variables: 
sudo vi /etc/default/jenkins
ex. JENKINS_ARGS="--prefix=/jenkins", http:127.0.0.1:8080/jenkins

4. modify apache2 
sudo vi /etc/apache2/site-available/default
-->add 
ProxyPass /jenkins http://xxx.xxx.xxx.xxx:8080/jenkins
ProxyPassReverse  /jenkins http://xxx.xxx.xxx.xxx:8080/jenkins
ProxyRequest off

2011年12月6日 星期二

ubuntu 新增user與加入sudoer

1. sudo adduser xxx
2. 加入sudoer
   a. sudo vi /etc/sudoer
       在root ALL=(ALL) ALL 底下加入一行
       xxx    ALL=(ALL) ALL
   或是
   b. sudo sudo usermod -g admin xxx
        user xxx即可有sudo權限

2011年9月9日 星期五

Android LOGV

1. java:
修改frameworks/base/core/java/android/util/Config.java
public static final boolean LOGV = false 改為true;

或是針對個別檔案

將private static final boolean localLOGV = Config.LOGV || false;
 改為 private static final boolean localLOGV = true;




2. cpp: 將檔案中//#define LOG_NDEBUG 0 改為#define LOG_NDEBUG 0

2011年8月22日 星期一

Android 設定檔media_profiles.xml & asound.conf

Android的media_profiles.xml必須放在system/etc目錄底下
裡面定義了video及audio的codec格式

在libmedia裡的mediaprofile.cpp定義了此路徑
const char *defaultXmlFile = "/etc/media_profiles.xml"

Android的asound.conf則是關於聲音的設定也是放在system/etc底下
external/alsa-lib/src/conf/alsa.conf 會去load它, external/alsa-lib/src/conf.c中有一些說明

@hooks [
         {
                 func load
                 files [
                         "/etc/asound.conf"
                         "~/.asoundrc"
                 ]
                 errors false
         }
 ]


2011年8月15日 星期一

gitweb設定

1. 已有apache2
2.  安裝gitweb 
    # sudo apt-get install gitweb
3.會產生/usr/share/gitweb, 底下有一些git*檔案,其中index.cgi為/usr/lib/cgi-bin/gitweb.cgi的符號連結
4. 讓apache知道gitweb並執行index.cgi檔
    #sudo vi /etc/apache2/conf.d/gitweb
           Alias /gitweb /usr/share/gitweb
           <Directory /usr/share/gitweb>
           Options FollowSymLinks +ExecCGI
           AddHandler cgi-script .cgi
          </Directory>
5. 設定gitweb的projects list參數 (git repository)
     #sudo  vi /etc/gitweb.conf  

 $projectroot = "/your_path"; # (有許多xxx.git的上一層)
 $git_temp = "/tmp";
 $projects_list = $projectroot;  
  $stylesheet = "/gitweb.css";    # /usr/share/gitweb中的東西    

 $logo = "/git-logo.png";   # /usr/share/gitweb中的東西

 $favicon = "/git-favicon.png";  # /usr/share/gitweb中的東西
6. 重新啟動apache2
     # /etc/init.d/apache2 restart
7. 瀏覽http://127.0.0.1/gitweb 

2011年8月11日 星期四

ubuntu 10.04使用su

原本ubuntu沒有預設root 密碼,所以無法以su變成root
透過sudo passwd 或sudo passwd root可設置root 密碼(非sudo 密碼)

但是增加密碼之後一般user還是無法以su變成root,因為有pam的限制,如以下連結
http://www.l-penguin.idv.tw/article/pam_whell.htm


第一種方法:加入wheel群組的user才可以使用su,但ubuntu中也沒有wheel群組

先用sudo groupadd wheel 增加wheel群組
再用sudo usermod -G wheel 你的user加入wheel群組

然後編輯/etc/pam.d/su
auth required pam_wheel.so use_uid

第二種:直接編輯/etc/pam.d/su
auth required pam_wheel.so group=你加入的群組


就可以用su變成root 了

2011年8月10日 星期三

Android: 誰用了HAL

vi /your-android/hardware/libhardware/hardware.c


#define HAL_LIBRARY_PATH1 "/system/lib/hw"
#define HAL_LIBRARY_PATH2 "/vendor/lib/hw"

...



int hw_get_module(const char *id, const struct hw_module_t **module)
{...
...

snprintf(path, sizeof(path), "%s/%s.%s.so",
                     HAL_LIBRARY_PATH1, id, prop);

其中id為硬體如sensor, gps...,prop為device name
如gps.xxx.so

再透過load()以dlopen的方式開啟

而hw_get_module會被jni或對應的service所引用,進而使用HAL