2013年1月24日星期四

Compile gcc-4.1.2 on Ubuntu 12.04 64bit


Compile gcc-4.1.2 on Ubuntu 12.04 64bit

ftp://ftp.gnu.org/gnu/gcc/gcc-4.1.2/

Create a folder where to build the gcc version

mkdir ~/gcc412

Extract the downloaded gcc release to that folder

tar -C ~/gcc412/ -xzvf /path/to/the/file/gcc-4.1.2.tar.gz

Make a build folder:

mkdir ~/gcc412/gcc-build/

At this stage we should be ready to build but first we need to be sure that we've got all the dependencies needed to compile. We need the linux-headers gcc-multilib, zlib1g, zlib1g-dev, zlibc

sudo apt-get install linux-headers-$(uname -r) gcc-multilib zlib1g zlib1g-dev zlibc

Then we need also to fix some file in the gcc folder.

First of all you need to edit the file ~/gcc412/gcc-4.1.2/gcc/config/i386/t-linux64.

At line 9 you should find:
MULTILIB_OSDIRNAMES = ../lib64 ../lib

You need to modify it as follows:
MULTILIB_OSDIRNAMES = ../lib64 ../lib32

Open the file ~/gcc412/gcc-4.1.2/libstdc++-v3/configure and at line 8284 replace:
sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`

with:

sed -e 's/GNU ld (GNU Binutils for Ubuntu) \([0-9.][0-9.]*\).*/\1/'`

Last thing to do is to link some library otherwise the compiler won't find it.
cd /usr/lib
sudo ln -s x86_64-linux-gnu/crt1.o crt1.o
sudo ln -s x86_64-linux-gnu/crti.o crti.o
sudo ln -s x86_64-linux-gnu/crtn.o crtn.o
At this point we are ready to compile gcc.
Go in the build folder:
cd ~/gcc412/gcc-build

run the configure as autodesk suggests:
../configure --prefix=/opt/gcc412 --program-suffix=412 --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --disable-libunwind-exceptions --enable-__cxa_atexit --enable-languages=c,c++

and then compile it:
make -j 2 bootstrap MAKEINFO=makeinfo

As soon as the compiling process ends without throwing errors you will be able to run:
sudo make install

Setup remote debug gdb/gdbserver



cd /usr/local
mkdir arm-gdb

#download and build gdb for host "http://ftp.gnu.org/gnu/gdb/"
cd gdb-6.7
./configure --target=arm-linux-uclibc --prefix=/usr/local/arm-gdb --disable-werror
make
make install

#build gdbserver for target
cd ./gdb/gdbserver

#before building the gdbserver for target, the target toolchain should be ready first
./configure --target=arm-linux-uclibc --host=arm-linux-uclibc --prefix=/usr/local/arm-gdb/gdbserver
export PATH=$PATH:/root/workspace/skyhawk_trunk/build_arm/staging_dir/bin
make CC=arm-linux-uclibc-gcc
make install

#if using uclibc and need debug multi-thread program, make sure the PTHREADS_DEBUG_SUPPORT is enabled when building the library

Using Eclipse Juno Service Release 1 (Setting for debug with gdb/gdbserver)
Debug Configurations > C/C++ Application > change to GDB(DSF) Remote System Process Launcher>
Main (Tab):
  • input the execute file which run on target
Debugger (Tab):
  • select the custom build gdb debugger
  • Force thread list update on suspend (turn on for showing source when break inside thread)
  • .gdbinit (in project root)
    • set solib-absolute-prefix "paths of the .so that used in the project" (path1:path2)
    • set solib-search-path "paths of the .so that used in the project" (path1:path2)
    • handle SIG32 pass noprint nostop
    • set can-use-hw-watchpoints 0
  • Shared Libraries: input the paths of .so that used in the project (search from first line)
  • Connection: set the ip and port of the target which gdbserver is running at
Source(Tab):
  • input the path of the source file, gdb search from the first line

#Debugging steps
cross compile the program for target (disable strip if it exist in makefile)

copy all updated execute and .so file to target

$./gdbserver ip:port execute  (on target)

then start Debug from eclipse

problem not solved yet:
  • Cannot 'step into' the function inside a .so, but it can pause at the breakpoint preset in the .so function, if compiled the execute with .a , 'step into' is ok
  • if set breakpoint inside a function of .so, need to set again in every session of debug

Reference:
http://crasseux.com/books/ctutorial/Building-a-library.html

http://blog.csdn.net/hlchou/article/details/7425492
http://www.study-area.org/cyril/opentools/opentools/x1265.html


Some useful commands:
arm-linux-uclibc-ar -t libmylib.a      -list out the functions name inside the static library
nm --demangle libmylib.a/libmylib.so      -list out the functions name inside the static/shared library

2013年1月20日星期日

TFTP server for Ubuntu 12.04


TFTP server for Ubuntu 12.04 source

用apt-get直接裝TFTP server套件。

    sudo apt-get install tftpd-hpa

Default options放在 /etc/default/tftp-hpa

# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure"

TFTP_DIRECTORY 是TFTP的檔案存放目錄.,我是將它改成rw for all,不知有沒有甚麼副作用?

    sudo chmod a+rw /var/lib/tftpboot

在Ubuntu上面直接裝的TFTP server套件不會在開機時執行,精確一點說應該是開機時跑了卻沒有起來。這是個老毛病,修一下就好。
編輯 /etc/init/tftpd-hpa.conf ,修改它錯誤的初始條件。

#start on runlevel [2345] # the original line which is wrong
start on (filesystem and net-device-up IFACE!=lo)

service tftpd-hpa restart

2013年1月18日星期五

install FreeNX on Ubuntu


How to install FreeNX on Ubuntu 12.04 Precise Pangolin source

Ask anyone who knows me and they will tell you that I am a vocal (and perhaps tireless) advocate of FOSS/GNU/Linux. I loves me some FOSS and GNU/Linux and I really like to help others with it as well!

So after writing my post: How to install NX Free Edition on Ubuntu 12.04 Precise Pangolin, I will follow it up with a story about FOSS. In this post, I will guide you through some easy instructions for installing the GPL,FOSS NX server variant called FreeNX, and the FOSS "qtnx" client that is used to connect to the FreeNX server.

The main difference is that, unlike NX Free Edition, which is licensed as proprietary ( 2 connections limit), FreeNX and qtnx are completely Free Open Source Software (FOSS, GPL)! Sounds good right? It's music to my ears. Afterall, this FOSS/GNU/Linux stuff makes the Technical world go around for everyone.

Update 01/02/13: Want to try something easier? Simply install xrdp:
1.) sudo apt-get install xrdp
2.) Add this to the ~ of the user you plan on logggin in with:
echo "gnome-session --session=ubuntu-2d" > ~/.xsession
3.) sudo /etc/init.d/xrdp restart
4.) Connect to your xrdp host from GNU/Linux with rdesktop , or from win with windows-key+R, mstsc /v:

So here are the simple instructions (and a couple of tweaks) that I used to install FreeNX on Ubuntu 12.04 GNU/Linux:

First, you need to add the freenx-team PPA for Ubuntu 12.04 GNU/Linux. Hit CTRL + ALT + t to get your Terminal, then type or paste in the command below, then hit Enter, then hit Enter to confirm the addition of the new source:
sudo add-apt-repository ppa:freenx-team
Next, update your sources list, then install the FreeNX server software (there are two commands below, the 2nd only runs if 1st is successful). After verifying that no important packages will beremoved, hit Y then enter to install FreeNX server:

sudo apt-get update && sudo apt-get install freenx

Next, as noted in the community documentation for installing FreeNX - download the missing nxsetup script, untar it, then copy it to /usr/lib/nx (the command below is one entire line that runs 3 commands and ends with /usr/lib/nx):
wget https://bugs.launchpad.net/freenx-server/+bug/576359/+attachment/1378450/+files/nxsetup.tar.gz && tar xvf nxsetup.tar.gz && sudo cp nxsetup /usr/lib/nx
Now, run the nxserver setup script. I chose to use the parameter to install the default NoMachine provided encryption keys during this command so the NoMachine win-clients can connect as well as qtnx:
sudo /usr/lib/nx/nxsetup --install --setup-nomachine-key
At this point, you have FreeNX server installed, but now you'll want to configure the FreeNX server to configure clients to use ubuntu-2d session:
echo -e "\n#Use unity 2d for client sessions\nCOMMAND_START_GNOME='gnome-session --session=ubuntu-2d'"|sudo tee -a /etc/nxserver/node.conf


Next, restart the FreeNX server to ensure it takes in the .conf file:
sudo /etc/init.d/freenx-server restart
That's it for the FreeNX server, now let's move on to the client. First, install the 'qtnx' package on Ubuntu 12.04 so we can have a client application to access the FreeNX server. You'll have to launch the Ubuntu Software Center, then click 'Edit > Software Sources' from the top menu. Then place a check by "Community-maintained free and open-source software (universe). Also, uncheck "Cdrom with Ubuntu 12.04" if it's checked. Then close the Software Sources dialog and the Ubuntu Software Center.
Now, run the commands to update your sources and install the qtnx application from the terminal (CTRL + ALT + t):
sudo apt-get update && sudo apt-get install qtnx
Ok, from the Unity menu or the CLI, start the 'qtnx' application. Enter the username/password for a user on the server, set the speed to LAN, then click configure. On the configuration dialog, set a name for the prfile, the hostname(or IP address) for the FreeNX server machine, the client resolution (I used 1024x768), network speed (LAN), and set the platform type to GNOME (see the example screenshot below).


Note: For the non-GNU/Linux clients, you can use nomachine.com's NX Client Free to connect to the server. Just use GNOME as the session.

That's it! Get your FreeNX connection on!
As for the version I tested with, it's: nxserver --version 3.2.0-74-SVN OS (GPL, using backend: 3.5.0)

Extra Tip: If for some reason your client wouldn't connect after testing, try deleting the entries in the ~/.nx directory. I'm not sure why this would help at all in most cases but it seemed to work for me. 



Extra Tip 2: If your clients are seeing the Network Manager 'Edit' buttons as greyed out while connected - have a look at this workaround: http://ubuntuforums.org/showthread.php?t=1616355




Install FreeNX server on Ubuntu 10.04 (Lucid), 10.10 (Maverick) or 11.04 (Natty)

  1. Enable the repository:
    sudo add-apt-repository ppa:freenx-team
  2. If you're using 10.10 Maverick, run
    sudo sed -i 's/maverick/lucid/g' /etc/apt/sources.list.d/freenx-team-ppa-maverick.list
  3. If you're using 11.04 Natty, run
    sudo sed -i 's/natty/lucid/g' /etc/apt/sources.list.d/freenx-team-ppa-natty.list
  4. Update the repository:
    sudo apt-get update
  5. Install FreeNX:
    sudo apt-get install freenx
  6. Download the setup script:
    cd /tmp;
    wget https://bugs.launchpad.net/freenx-server/+bug/576359/+attachment/1378450/+files/nxsetup.tar.gz;
    tar zxvf nxsetup.tar.gz
  7. Install the setup script:
    sudo cp nxsetup /usr/lib/nx/nxsetup
  8. Run the setup script:
    sudo /usr/lib/nx/nxsetup --install


2013年1月17日星期四

Using GCC to create static and shared library .so


[轉貼]用GCC自製Library source

引用: PTT看板: LinuxDev (作者: cole945)


Library可分成三種,static、shared與dynamically loaded。

1. Static libraries

Static 程式庫用於靜態連結,簡單講是把一堆object檔用ar(archiver)
包裝集合起來,檔名以 `.a' 結尾。優點是執行效能通常會比後兩者快,
而且因為是靜態連結,所以不易發生執行時找不到library或版本錯置而
無法執行的問題。缺點則是檔案較大,維護度較低;例如library如果發
現bug需要更新,那麼就必須重新連結執行檔。

1.1 編譯

編譯方式很簡單,先例用 `-c' 編出 object 檔,再用 ar 包起來即可。

____ hello.c ____
#include
void hello(){ printf("Hello "); }

____ world.c ____
#include
void world(){ printf("world."); }

____ mylib.h ____
void hello();
void world();

$ gcc -c hello.c world.c /* 編出 hello.o 與 world.o */
$ ar rcs libmylib.a hello.o world.o /* 包成 limylib.a */

這樣就可以建出一個檔名為 libmylib.a 的檔。輸出的檔名其實沒有硬性規定,
但如果想要配合 gcc 的 '-l' 參數來連結,一定要以 `lib' 開頭,中間是你要
的library名稱,然後緊接著 `.a' 結尾。

1.2 使用

____ main.c ____
#include "mylib.h"
int main() {
hello();
world();
}

使用上就像與一般的 object 檔連結沒有差別。

$ gcc main.c libmylib.a

也可以配合 gcc 的 `-l' 參數使用

$ gcc main.c -L. -lmylib

`-Ldir' 參數用來指定要搜尋程式庫的目錄,`.' 表示搜尋現在所在的目錄。
通常預設會搜 /usr/lib 或 /lib 等目錄。
`-llibrary' 參數用來指定要連結的程式庫 ,'mylib' 表示要與mylib進行連結
,他會搜尋library名稱前加`lib'後接`.a'的檔案來連結。

$ ./a.out
Hello world.


2. Shared libraries

Shared library 會在程式執行起始時才被自動載入。因為程式庫與執行檔
是分離的,所以維護彈性較好。有兩點要注意,shared library是在程式起始
時就要被載入,而不是執行中用到才載入,而且在連結階段需要有該程式庫
才能進行連結。

首先有一些名詞要弄懂,soname、real name與linker name。

soname 用來表示是一個特定 library 的名稱,像是 libmylib.so.1 。
前面以 `lib' 開頭,接著是該 library 的名稱,然後是 `.so' ,接著
是版號,用來表名他的介面;如果介面改變時,就會增加版號來維護相容度。

real name 是實際放有library程式的檔案名稱,後面會再加上 minor 版號與
release 版號,像是 libmylib.so.1.0.0 。

一般來說,版號的改變規則是(印象中在 APress-Difinitive Guide to GCC中有
提到,但目前手邊沒這本書),最尾碼的release版號用於程式內容的修正,
介面完全沒有改變。中間的minor用於有新增加介面,但相舊介面沒改變,所以
與舊版本相容。最前面的version版號用於原介面有移除或改變,與舊版不相容
時。

linker name是用於連結時的名稱,是不含版號的 soname ,如: libmylib.so。
通常 linker name與 real name是用 ln 指到對應的 real name ,用來提供
彈性與維護性。


2.1 編譯
shared library的製作過程較複雜。

$ gcc -c -fPIC hello.c world.c

編譯時要加上 -fPIC 用來產生 position-independent code。也可以用 -fpic
參數。 (不太清楚差異,只知道 -fPIC 較通用於不同平台,但產生的code較大
,而且編譯速度較慢)。

$ gcc -shared -Wl,-soname,libmylib.so.1 -o libmylib.so.1.0.0 \
hello.o world.o

-shared 表示要編譯成 shared library
-Wl 用於參遞參數給linker,因此-soname與libmylib.so.1會被傳給linker處理。
-soname用來指名 soname 為 limylib.so.1
library會被輸出成libmylib.so.1.0.0 (也就是real name)

若不指定 soname 的話,在編譯結連後的執行檔會以連時的library檔名為
soname,並載入他。否則是載入soname指定的library檔案。

可以利用 objdump 來看 library 的 soname。

$ objdump -p libmylib.so | grep SONAME
SONAME libmylib.so.1

若不指名-soname參數的話,則library不會有這個欄位資料。

在編譯後再用 ln 來建立 soname 與 linker name 兩個檔案。
$ ln -s libmylib.so.1.0.0 libmylib.so
$ ln -s libmylib.so.1.0.0 libmylib.so.1


2.2 使用

與使用 static library 同。

$ gcc main.c libmylib.so

以上直接指定與 libmylib.so 連結。

或用

$ gcc main.c -L. -lmylib

linker會搜尋 libmylib.so 來進行連結。

如果目錄下同時有static與shared library的話,會以shared為主。
使用 -static 參數可以避免使用shared連結。

$ gcc main.c -static -L. -lmylib

此時可以用 ldd 看編譯出的執行檔與shared程式庫的相依性
$ldd a.out
linux-gate.so.1 => (0xffffe000)
libmylib.so.1 => not found
libc.so.6 => /lib/libc.so.6 (0xb7dd6000)
/lib/ld-linux.so.2 (0xb7f07000)
輸出結果顯示出該執行檔需要 libmylib.so.1 這個shared library。
會顯示 not found 因為沒指定該library所在的目錄,所找不到該library。

因為編譯時有指定-soname參數為 libmylib.so.1 的關係,所以該執行檔會
載入libmylib.so.1。否則以libmylib.so連結,執行檔則會變成要求載入
libmylib.so

$ ./a.out
./a.out: error while loading shared libraries: libmylib.so.1:
cannot open shared object file: No such file or directory

因為找不到 libmylib.so.1 所以無法執行程式。
有幾個方式可以處理。

a. 把 libmylib.so.1 安裝到系統的library目錄,如/usr/lib下
b. 設定 /etc/ld.so.conf ,加入一個新的library搜尋目錄,並執行ldconfig
更新快取
c. 設定 LD_LIBRARY_PATH 環境變數來搜尋library
這個例子是加入目前的目錄來搜尋要載作的library
$ LD_LIBRARY_PATH=. ./a.out
Hello world.


3. Dynamically loaded libraries

Dynamicaaly loaded libraries 才是像 windows 所用的 DLL ,在使用到
時才載入,編譯連結時不需要相關的library。動態載入庫常被用於像plug-ins
的應用。

3.1 使用方式
動態載入是透過一套 dl function來處理。
#include
void *dlopen(const char *filename, int flag);
開啟載入 filename 指定的 library。
void *dlsym(void *handle, const char *symbol);
取得 symbol 指定的symbol name在library被載入的記憶體位址。
int dlclose(void *handle);
關閉dlopen開啟的handle。
char *dlerror(void);
傳回最近所發生的錯誤訊息。

____ dltest.c ____
#include
#include
#include
int main() {
void *handle;
void (*f)();
char *error;

/* 開啟之前所撰寫的 libmylib.so 程式庫 */
handle = dlopen("./libmylib.so", RTLD_LAZY);
if( !handle ) {
fputs( dlerror(), stderr);
exit(1);
}

/* 取得 hello function 的 address */
f = dlsym(handle, "hello");
if(( error=dlerror())!=NULL) {
fputs(error, stderr);
exit(1);
}
/* 呼叫該 function */
f();
dlclose(handle);
}

編譯時要加上 -ldl 參數來與 dl library 連結
$ gcc dltest.c -ldl
結果會印出 Hello 字串
$ ./a.out
Hello

關於dl的詳細內容請參閱 man dlopen

--
參考資料:

Creating a shared and static library with the gnu compiler [gcc]
http://www.adp-gmbh.ch/cpp/gcc/create_lib.html

Program Library HOWTO
http://tldp.org/HOWTO/Program-Library-HOWTO/index.html

APress - Definitive Guide to GCC

------------------------------------------------------------------------------------------------------------------

Makefile



GCC=gcc  
  CFLAGS=-Wall   -ggdb   -fPIC  
  #CFLAGS=  
   
  all:   libfunc  
   
  libfunc:func.o   func1.o  
                  $(GCC)   -shared   -Wl,-soname,libfunc.so.1   -o   libfunc.so.1.1   $<  
                  ln   -sf   libfunc.so.1.1   libfunc.so.1  
                  ln   -sf   libfunc.so.1   libfunc.so  
   
  %.o:%.c  
                  $(GCC)   -c   $(CFLAGS)   -o   $@   $<  
   
  clean:  
                  rm   -fr   *.o  
                  rm   -fr   *.so*

-------------------------------------------------------------------------------------------------------------------

2013年1月3日星期四

setup git + gitolite + gitweb, add user + repo


Workstation setup

#Install ssh
$sudo apt-get install openssh-server

#Install git-core
$sudo apt-get install python-software-properties 
$sudo add-apt-repository ppa:git-core/ppa 
$sudo apt-get update 
$sudo apt-get install git

$git config --global user.email "Email"

$git config --global user.name "Your Name"


$ssh-keygen -t rsa (and rename ~/.ssh/id_rsa.pub to YourName.pub )

#send YourName.pub to the person which have admin rights to the git server



Git Server Setup

#Adduser git
$sudo useradd git
#edit /etc/sudoers, add user 'git' as sudoer

#Install ssh
$sudo apt-get install openssh-server

#Install git-core
$sudo apt-get install python-software-properties 
$sudo add-apt-repository ppa:git-core/ppa 
$sudo apt-get update 
$sudo apt-get install git

#Install gitolite 
Make sure ~/.ssh/authorized_keys is empty or non-existent



Run this from your workstation (this workstation will have admin rights of the git server)

$ssh-keygen -t rsa (and rename ~/.ssh/id_rsa.pub to YourName.pub )

copy the ssh public key from your workstation to git server $HOME/YourName.pub 

Run the following commands:

git clone git://github.com/sitaramc/gitolite
mkdir -p $HOME/bin
gitolite/install -to $HOME/bin
gitolite setup -pk YourName.pub

If the last command doesn't run perhaps 'bin' in not in your 'PATH'.

You can either add it (add this line to ~/.bashrc), or just run:

$HOME/bin/gitolite setup -pk YourName.pub


Adding Users and repos

Do NOT add new repos or users manually on the server.  Gitolite users, repos, and access rules are maintained by making changes to a special repo called 'gitolite-admin' and pushing those changes to the server.


To administer your gitolite installation, start by doing this on your workstation, which this workstation have added public key to git server and have RW access rights to 'gitolite-admin' repo


$git clone git@host:gitolite-admin


**NOTE**: if you are asked for a password, something has gone wrong. 

(check if this workstation's ssh public key is added to the git server or not)

Now if you 'cd gitolite-admin', you will see two subdirectories in it: 'conf' and 'keydir'.

To add new users alice, bob, and carol, obtain their public keys and add them to 'keydir' as alice.pub, bob.pub, and carol.pub respectively.

    To add a new repo 'foo' and give different levels of access to these

    users, edit the file 'conf/gitolite.conf' and add lines like this:

        repo foo

            RW+         =   alice
            RW          =   bob
            R           =   carol

    See the 'ACCESS RULES' section later for more details.


    Once you have made these changes, do something like this:


        $git add conf

        $git add keydir
        $git commit -m 'added foo, gave access to alice, bob, carol'
        $git push

When the push completes, gitolite will add the new users to ~/.ssh/authorized_keys on the server, as well as create a new, empty, repo called 'foo'.


Install gitweb

$apt-get install apache2 gitweb

$sudo vim /etc/gitweb.conf
change $projectroot to /home/git/repositorieschange $projects_list to /home/git/projects.list
$chmod g+r /home/git/projects.list
$chmod -R g+rx /home/git/repositories

$sudo vim /home/git/.gitolite.rc
# change $REPO_UMASK = 0077; to $REPO_UMASK = 0027; # gets you 'rwxr-x---'

#add authentication to the web
$sudo htpasswd -cb /etc/appach2/gitweb.htpasswd ID PASSWD


$sudo vim /etc/apache2/conf.d/gitweb
Alias /gitweb /usr/share/gitweb<Directory /usr/share/gitweb>Options FollowSymLinks +ExecCGIAddHandler cgi-script .cgiAuthUserFile /etc/apache2/gitweb.htpasswdAuthName "GitWeb"AuthType Basicrequire valid-user</Directory>
$sudo /etc/init.d/apache2 restart #restart to take effect

Vsftpd on ubuntu server 12.04


Vsftpd on ubuntu server 12.04

After install vsftpd, then sudo rm /etc/pam.d/vsftpd (fix the 530 error)

500 OOPS: vsftpd: refusing to run with writable root inside chroot ()
Vsftpd v2.3.5 restriction, when chroot() is enable for the user, the user cannot have write permission to its root.

So downgrade to v2.3.2 instead. Use below link.

Loading Modules on Demand


Loading Modules on Demand
To make it easier for users to load and unload modules, to avoid wasting kernel memory by keeping drivers in core when they are not in use, and to allow the creation of "generic'' kernels that can support a wide variety of hardware, Linux offers support for automatic loading and unloading of modules. To exploit this feature, you need to enable kmod support when you configure the kernel before you compile it; most kernels from distributors come with kmod enabled. This ability to request additional modules when they are needed is particularly useful for drivers using module stacking.

Setup new gitolite user and repo

Setup new gitolite user 
#Create the user's public key
  • $ssh-keygen -t rsa (default output path ~/.ssh/id_rsa.pub, rename it to new_user.pub)
  • git config --global user.email "Email"
  • git config --global user.name "Your Name"

#Add the key to gitolite (gitolite recommends to use method 2)
  • Method 1 - server side (@git~)
    • copy new_user.pub to server's /home/git/publickeys
    • $gitolite setup -pk publickeys/new_user.pub

  • Method 2 - client side (a client which is already added to the git server, and have read rights to gitolite-admin)
    • $git clone git@git.actatekrd.com:gitolite-admin
    • $git add keydir/new_user.pub
    • $git commit -m 'add users: new_user'
    • $git push
#Remove a user
  • $git rm keydir/new_user.pub



Setting up a remote repository and doing an initial “push”
#Create the new repo directory 

ssh to git server (from a client which had NOT added key git server) 
$ssh git@git.actatekrd.com (password:git)

or direct run the below commands on git server
  • $cd /home/git/repositories
  • $mkdir my_project.git
  • $cd my_project.git
  • $git init --bare
  • $git update-server-info (If planning to serve via HTTP)
#Add access rights of the new repo to users
From a client which is already added to the git server and have read rights to gitolite-admin
  • git clone git@git.actatekrd.com:gitolite-admin
  • edit gitolite-admin/conf/gitolite.conf, add access rights of the new repo to users
#Initial push from client(From a client which has RW rights to the new repo)
  • cd my_project
  • git init
  • git add *
  • git commit -m "My initial commit message"
  • git remote add origin git@git.actatekrd.com:my_project.git
  • git push -u origin master
(Optional) can use 'git'  to replace 'git@git.actateked.com' in the future
create ‘config’ file under ~/.ssh
host git
user git
hostname git.actatekrd.com

2013年1月2日星期三

about origen quad

http://wiki.ebuntu.co.kr/mediawiki/index.php/Ubuntu_for_4412

http://git.linaro.org/gitweb/landing-teams/working/samsung/kernel.git

http://forum.insignal.co.kr/viewtopic.php?f=6&t=67


# install jdk
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html


mv jdk1.7.0_11 /usr/lib/jvm

update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_11/bin/javac 1
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_11/bin/java 1
update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.7.0_11/bin/javaws 1

update-alternatives --config javac
update-alternatives --config java
update-alternatives --config javaws

java -version

2013年1月1日星期二

acta3 original compile

apt-get install subversion
rm ~/.gnome2/keyrings/login.keyring   "svn和gnome的一个key冲突了,只要删除就可以了"

svn co http://svn.actatekrd.com/svn/skyhawk/trunk/ skyhawk_trunk
svn co http://svn.actatekrd.com/svn/skyhawk/downloads/ skyhawk_downloads

cd skyhawk_trunk
ln -s ../skyhawk_downloads dl
cp SKYHAWK_buildroot.config .config

#for ubuntu 10.04
apt-get install gcc-4.1
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 40
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.1 30
update-alternatives --config gcc

apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc

getlibs package/config/conf
https://launchpad.net/~jcollins/+archive/jaminppa/+build/1482994/+files/getlibs_2.06-0ubuntu1~ppa2_all.deb

make oldconfig

apt-get install gettext texinfo uboot-mkimage intltool

make

Install and Setup Gcc 4.1(g++4.1) in Ubuntu 10.04


How to Install and Setup Gcc 4.1(g++4.1) in Ubuntu 10.04/10.10

Published in Posted by Meilin in General


The default gcc version in Ubuntu 10.04 LTS and 10.10 is gcc 4.4. However some programs depend on gcc 4.1.1 or gcc 4.1.2. Here? how to install and setup gcc 4.1.3 in Ubuntu 10.04/10.10 which also works if one program need gcc 4.1.1/4.1.2 to run.

Install Gcc 4.1

gcc 4.1.3 is available default in Ubuntu 10.04/10.10 official repository, just run the command in Applications -> Accessories -> Terminal:

sudo apt-get install gcc-4.1
If you absolutely want gcc 4.1.1, refer to ubuntuforums.org.

Set gcc 4.1 as default version

After that, use this command to list installed gcc in your Ubuntu:

ls /usr/bin/gcc*
and use this command to check which is default:

gcc -v
1.) Now, add alternatives for gcc:

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 40
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.1 30
run this command which lists available versions, then type a number to set default.

sudo update-alternatives --config gcc
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).

Selection Path Priority Status

0 /usr/bin/gcc-4.4 40 auto mode
* 1 /usr/bin/gcc-4.1 30 manual mode
2 /usr/bin/gcc-4.4 40 manual mode

2.) add alternatives for g++, i486-linux-gnu-gcc, and i486-linux-gnu-g++ and set 4.1 as default:

update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.4 40
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.1 30
update-alternatives --config g++
update-alternatives --install /usr/bin/i486-linux-gnu-gcc i486-linux-gnu-gcc /usr/bin/i486-linux-gnu-gcc-4.4 40
update-alternatives --install /usr/bin/i486-linux-gnu-gcc i486-linux-gnu-gcc /usr/bin/i486-linux-gnu-gcc-4.1 30
update-alternatives --config i486-linux-gnu-gcc
update-alternatives --install /usr/bin/i486-linux-gnu-g++ i486-linux-gnu-g++ /usr/bin/i486-linux-gnu-g++-4.4 40
update-alternatives --install /usr/bin/i486-linux-gnu-g++ i486-linux-gnu-g++ /usr/bin/i486-linux-gnu-g++-4.1 30
update-alternatives --config i486-linux-gnu-g++

source