Profilo di Shawn肖恩鲍的blogFotoBlogElenchiAltro Strumenti Guida

Shawn

Professione
Località
Interessi
做一个谦虚的人,做一个不讨人厌的人,做一个招人喜欢的人,做一个人畜无害的人……
Nessun elenco musica in questo Windows Live Spaces.

肖恩鲍的blog

08 luglio

Setup VPN in Ubuntu

1. 申请VPN账号
    收到的确认邮件中包含用户名和口令
    附件中有<coreid>.key<coreid>.crt两个文件

2. 确认本地物理网卡IP地址不在192.168.1.0网段
    如果本地有192.168.1.0网段的地址在开启VPN后该网段可能无法访问!

3. 切换为root用户并安装VPN

sudo su -
aptitude install openvpn sysv-rc-conf
sysv-rc-conf --level 2345 openvpn off

3. 安装CA证书及配置文件
   下载ca.crtclient.confroot用户拷贝到/etc/openvpn
ca.crt
client.conf

4. 安装个人证书及密钥
    将VPN确认邮件中的<coreid>.key重命名为client.key
    <coreid>.crt重命名为client.crt
    用root用户将client.key和client.crt拷贝到/etc/openvpn

5. 用root用户更改配置文件权限

chown -R root:root /etc/openvpn
chmod 400 /etc/openvpn/client.key

6. 用普通用户登陆并启动VPN, 启动过程中需要输入用户名和口令

sudo /etc/init.d/openvpn start

7. 用普通用户关闭VPN

sudo /etc/init.d/openvpn stop

8. 目前VPN口令无法通过客户端软件更改!

Setup VMWare USB Access in Ubuntu Gutsy

1. Make sure the virtual machine configured with from vmware console usb controller

Sutdown the virtual machine before config

2. add below line into related <VM Name>.vmx

usb.generic.skipSetConfig = "TRUE" 

3. Edit /etc/init.d/mountdevsubfs.sh uncomment below lines near line 42

mkdir -p /dev/bus/usb/.usbfs
domount usbfs "" /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
ln -s .usbfs/devices /dev/bus/usb/devices
mount --rbind /dev/bus/usb /proc/bus/usb

4. Restart mountdevsubfs.sh

sudo /etc/init.d/mountdevsubfs.sh start 

5. Restart vmware service

sudo /etc/init.d/vmware* restart
6. Start Virtual machine

Setup build env

Switch to root

sudo su

Install system service config tool

aptitude -y install sysv-rc-conf

Install subversion

aptitude -y install subversion subversion-tools

Install git

aptitude -y install git-core git-svn 

Install necessary development tools

aptitude -y install ant binutils binutils-dev binutils-static \
libncurses5-dev libncursesw5-dev ncurses-term ncurses-hexedit \
g++ gcc gcc-3.3 automake1.8 automake1.9 dialog libltdl3 bison \
build-essential libz-dev flex gperf libwxgtk2.6-dev libcurses-widgets-perl \
libcurses-perl libcurses-ui-perl libcurses-ruby libcurses-ruby1.8 \
libsdl-dev valgrind ncurses-dev libtool libx11-dev vim-full exuberant-ctags meld

Install JDK 1.5

aptitude -y install sun-java5-jdk

ln -s /usr/lib/jvm/java-1.5.0-sun-1.5.0.13 /usr/local/jdk1.5

echo "
PATH=/usr/local/jdk1.5/bin:/usr/local/arm-linux/bin:\$PATH:
CLASSPATH=/usr/local/jdk1.5/lib:.
JAVA_HOME=/usr/local/jdk1.5
export PATH CLASSPATH JAVA_HOME
" >>/etc/bash.bashrc

Config cross compiler (marvell)

sudo su

mkdir /opt/tools

cd /opt/tools

svn co svn://192.168.1.250/tools/branches/borqs /opt/tools

rm -f /usr/local/arm-linux* 

ln -sf /opt/tools/arm-linux-4.1.1 /usr/local/arm-linux-4.1.1

ln -sf /opt/tools/prebuilt/Linux/toolchain-eabi-4.2.1 /usr/local/arm-linux-4.2.1

ln -sf /usr/local/arm-linux-4.1.1 /usr/local/arm-linux # for marvell

ln -sf /usr/local/arm-linux-4.2.1 /usr/local/arm-linux # for google

Optional configuration (For resolving the emulator crash problem only):

rm -f /usr/bin/gcc
ln -sf /usr/bin/gcc-3.3 /usr/bin/gcc

Other optional component

sduo aptitude -y install acroread acroread-escript acroread-plugins
sudo aptitude -y install stardict stardict-oxford-gb stardict-langdao-ec-gb
sudo aptitude -y install virtualbox


sudo aptitude -y install wine

 

SVN Quick Start


From $1

Table of contents
No headers

注意:CM email: cm@borqs.com1

Note:  svn://192.168.1.250/test/branches/borqs is demo and test URL 

若多次登录验证错误请参考以下操作恢复

rm -fr ~/.subversion/auth

check out 

svn co [svn://192.168.1.250/test/branches/borqs] <test_lastest>

update

svn update

commit

svn ci <-m 'Your Chinese Name: change log'> <filename or pathname>

Log format

日志需要至少包含二行做为日志头
第一行写拼音名+冒号+摘要
第二行写Trac项目名(如jadesring)+冒号+Trac Ticket号

第三行开始写其它内容

<Your Name>:<Summary>
<Trac Project Name>:<Trac Ticket Number>
<other comments>
...

注意:Ticket对应的状态必须为assignedreopened

Add

svn add [filename or pathname]

Revision 

svn co --revision [revision number] [svn://192.168.1.250/test/branches/borqs] <test_rv3>

or

svn co -r [revision number] [svn://192.168.1.250/test/branches/borqs] <test_rv3>

Review version log

svn log [svn://192.168.1.250/test/branches/borqs]

List

svn list [svn://192.168.1.250/test/branches/borqs]

Create branch

temp branch name standard:

[your SVN ID]_[based branch revision number]_[description]

[CR number]_[your SVN ID]

svn copy -r [revision number] [svn://192.168.1.250/test/branches/borqs] [svn://192.168.1.250/test/pool/branch_name] <-m 'Your Chinese Name: change log'>

merge

注意:

合并的操作是在本地进行的,合并完成后需要提交

# 将branches下borqs的版本10与pool下test版本20的不同合并到my_working_copy目录下

svn merge svn://192.168.1.250/test/branches/borqs@10 svn://192.168.1.250/test/pool/test@20 my_working_copy

# 将branches下borqs版本10和20的不同合并到my_working_copy目录下

svn merge -r 10:20 svn://192.168.1.250/test/branches/borqs my_working_copy

# 将branches下borqs版本10和20的不同合并到当前的目录下

svn merge -r 10:20 svn://192.168.1.250/test/branches/borqs

# 合并错了返回到合并前版本的操作

svn -R revert ./

例如:

你的版本是在pool/your_dev_versionbranches/borqs分支出,主分支在branches/borqs

你要做的事情是取出最新的branches/borqs到本地工作目录,

然后比较pool/your_dev_version初始版本HEAD的不同合并到branches/borqs的本地工作目录,

解决冲突,最后update,再ci

二进制文件可能被忽略,可以使用以下命令强制列出当前状态

svn st --no-ignore

定义可执行文件的在版本库中的执行权限

svn propset svn:executable '' <File path>

在工作目录中执行 svn switch 命令切换当前工作目录的URL

 svn switch <New URL>

更多操作请看下面附件中的手册,中文手册是1.2版,英文是1.4版。

NFS How to for TavorEVB board


 NFS How to for TavorEVB board

 Version  Date  Changelogs
 0.1  Nov.15, 2007 Initial version
 0.2  Nov.22, 2007 Add details for how to get rootfs, and minor corrections
 0.3  Dec.03, 2007 Fix NFS connection limitation & slow issue with Ubuntu 7.04 in Step B.
 0.4  Jan.10, 2008 Update for Android build case


IP addr for Host PC:      192.168.100.1
IP addr for target board: 192.168.100.2

Steps:

A. target tavor EVB board side setting:

2 methods:

1. automatically config in kernel:
 build kernel with "root=nfs" parameters with kernel codes in SVN server.

# cd /svn/linux/branches/borqs
# ./setup.sh PRODUCT=TAVOR root=nfs
2. manually config in kernel:
a). change cmdline to support NFS booting:
 CONFIG_CMDLINE="root=/dev/nfs nfsroot=192.168.100.1:/download/root ip=192.168.100.2:192.168.100.1::255.255.255.0::usb0:on console=ttyS0,115200 mem=52M"
b). enable USB Eth driver with GADGET driver (for USB client):
 CONFIG_USB_GADGET=y
 CONFIG_USB_NET_CDCETHER=y
 CONFIG_USB_ETH=y
 # CONFIG_USB_ETH_RNDIS is not set
c). rebuild kernel and flash the zImage to tavor board.


B. Host PC side setting (Ubuntu 7.04):

1. add IP addr auto-config in /etc/network/interfaces:
 auto usb0
 iface usb0 inet static
        address 192.168.100.1
        netmask 255.255.255.0
        network 192.168.0.0
        up iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24 &
        up echo 1 > /proc/sys/net/ipv4/ip_forward &
        up iptables -P FORWARD ACCEPT &
        down iptables -D POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24 &
1.1 add device info in /etc/hosts, like the last line:
 127.0.1.1 zhaoliang-desktop
 192.168.100.2 phone

1.2 Ubuntu Feisty and Gutsy appear to have a bug where ifdown is not run when the interface is unplugged, meaning this only works once after the system is booted. One can patch /etc/udev/rules.d/85-ifupdown.rules, editing the two lines at the end of the file like this:

 # Bring devices up and down only if they're marked auto.
 # Use start-stop-daemon so we don't wait on dhcp
 ACTION=="add",          RUN+="/sbin/start-stop-daemon --start --background --pidfile /var/run/network/bogus --startas /sbin/ifup -- --allow auto $env{INTERFACE}"
 LABEL="net_end"
 ACTION=="remove",       RUN+="/sbin/start-stop-daemon --start --background --pidfile /var/run/network/bogus --startas /sbin/ifdown -- --allow auto $env{INTERFACE}"

the bug is that the LABEL="net_end" is at the wrong position.

2. install nfs service:
 apt-get install nfs-kernel-server
 apt-get install nfs-common
Note: do not use nfs-user-server which is out of date now.
3. add export directory(/download/root) to NFS service by editing /etc/exports:
root@zhaoliang-desktop:/etc# cat /etc/exports
# /etc/exports: the access control list for filesystems which may be exported
#               to NFS clients.  See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes       hostname1(rw,sync) hostname2(ro,sync)
#
# Example for NFSv4:
# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt)
# /srv/nfs4/homes  gss/krb5i(rw,sync)
#
/download/root *(rw,no_root_squash,no_all_squash,sync,no_subtree_check)
# /tftpboot/192.168.100.2 192.168.100.2/24(rw,no_root_squash,no_all_squash,sync)

4. copy root files to /download/root:
We can get them from [your project]/rel/target/rootfs after building Marvell packages.
A easy way is to make a tar.gz package and extract it to /download/root

Here is the rootfs I used:
root@zhaoliang-desktop:/download# ll /download/root/
total 52
drwxrwxrwx 2 root root 4096 2007-01-23 22:37 bin
drwxrwxrwx 6 root root 4096 2007-04-03 05:17 dev
drwxrwxrwx 4 root root 4096 2007-11-13 14:27 etc
drwxr-xr-x 7 root root 4096 2007-03-24 04:51 lib
lrwxrwxrwx 1 root root   11 2007-11-13 18:39 linuxrc -> bin/busybox
drwxrwxrwx 2 root root 4096 2005-08-25 05:21 mnt
drwxrwxrwx 2 root root 4096 2005-08-25 05:21 proc
drwxr-xr-x 2 root root 4096 2006-10-18 14:02 resource
drwxrwxrwx 2 root root 4096 2005-08-25 05:21 root
drwxrwxrwx 2 root root 4096 2007-11-13 18:39 sbin
drwxrwxrwx 2 root root 4096 2005-08-25 05:21 sys
drwxrwxrwx 2 root root 4096 2005-08-25 05:21 tmp
drwxrwxrwx 6 root root 4096 2006-10-13 18:15 usr
drwxrwxrwx 4 root root 4096 2005-08-25 05:21 var

5. rootfs how to Android SW stack:
Before building android SW stack, disable YAFFS2 mount in init process by commenting out line 497 to 505 in ./system/init/init.c.
After building android SW stack,  in output directory (like ./out/linux-x86-release/generic/), you will get root/system/data.
Build up /download/root with the following steps:

# !you may need to clean /download/root first.
# cp -r ./out/linux-x86-release/generic/root/* /download/root/
# cp -r ./out/linux-x86-release/generic/system /download/root/
# cp -r ./out/linux-x86-release/generic/data /download/root/

C. Try NFS with Tavor board:

1. power up the Tavor board and checking the its output from minicom.
2. after kernel is up, and we can see the IP addr is showing in minicom, connect USB cable
3. wait for about 10-30 seconds, NFS mount is done and then we can telnet from Host PC (192.168.100.1) to Tavor board (192.168.100.2).


D. Issues we have now:

1. NFS can only be used on the first time due to hotplug & network issue.
 So if you want to use NFS again, pls reboot Host PC.
 It will be fixed later by co-working with IT.
 Fixed in version 0.3 in Dec 3, 2007!!!

2. the mounting time for NFS is very slow now, about 10-30 seconds.
 It will be improved later by co-working with IT.
 Fixed in version 0.3 in Dec 3, 2007!!!

Readme for TFTP server install

在ubuntu下安装xinetd模式的tftpd服务

1、安装server与client
sudo apt-get install tftpd-hpa tftp-hpa

2、删除standalone的启动方式
sudo update-rc.d -f tftpd-hpa remove

3、新建用户tftpd及其主目录
sudo mkdir -p /home/tftpd
sudo useradd -s /bin/false -g nogroup -d /home/tftpd [-p PASSWORD] tftpd

3.5 install xinetd

sudo apt-get install xinetd

4、新建xinetd启动文件
cat /etc/xinetd.d/tftpd
service tftp
{
disable = no
socket_type = dgram
wait = no
user = root
protocol = udp
server = /usr/sbin/in.tftpd
server_args = -s /home/tftpd -p -c -U 077 -u tftpd
log_on_success += PID HOST DURATION
log_on_failure += HOST
}
5、注释掉/etc/inetd.conf文件中tftpd启动
#tftp dgram udp wait root /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot

5.5 if you have other network connections, such as WiFi, dual-eth cards, pls shutdown the others if tftp is not working.

6、重新启动xinetd服务
sudo /etc/init.d/xinetd restart

7、测试tftpd服务是否成功
tftp localhost
tftp> put 123.log
tftp> put 123.log test.log
tftp> get test.log
tftp> get test.log abc.log
tftp> verbose
Verbose mode on.
tftp> trace
Packet tracing on.
tftp> put kkk.log
sent DATA
received ACK
.........
sent DATA
received ACK
Sent 12999997 bytes in -1.5 seconds [-69987938 bit/s]


NFS Setup Steps

NFS服务器端的配置:
(1)               先确认是否安装了NFS,查看目录/etc/xinetd.d/下是否存在nfs文件(一般在虚拟机下安装都会完全安装,所以会有)
(2)               宿主机的网络配置,主要是是IP地址的设置;命令如下:
# ifconfig eth0 down
# ifconfig eth0 192.168.1.10 up
再# ifconfig一下,看配置是否正确,也可以在图形用户界面下配置
(3)               编辑/etc/exports文件,命令如下:
# vi /etc/exports
在里面输入/home/nfs 192.168.1.1(rw,sync,no_root_squash),保存退出;
/home/nfs:是宿主机上共享的文件夹;
192.168.1.11:是开发板的IP地址;
rm:开发板可以读写访问共享的文件夹;
sync所有数据在请求时写入共享 ;
no_root_squash:root用户具有根目录的完全管理访问权限
意思是:允许IP为192.168.1.11的ARM9开发系统将宿主机上的/home/nfs这个目录mount到开发系统下,即ARM9开发系统可以通过网络访问宿主机上的/home/nfs目录。
(4)               重启NFS 命令如下:
# service nfs restart
 
NFS客户端的配置:
  
(1)       用minicom启动开发系统;
(2)       网络的配置,命令如下:
# ifconfig eth0 192.168.1.11
# ifconfig
(3)       Ping一下主机,看开发板和主机之间是否相通
(4)       在ARM9开发系统中建立目录/mnt/nfs
  # mkdir /mnt/nfs
(5)       若相通,则将宿主机上的目录/home/nfs mount到ARM9开发系统下的目录/mnt/nfs上。命令如下:
 # mount -t nfs -o nolock 192.168.1.1:/home/embeder/nfs /tmp/nfs
(6)       进入目录/mnp/nfs,查看是否和宿主机上的目录/home/nfs中的内容一样?^_^,应该是一样的。
可能出现的问题:
(1)       服务器端的防火墙没有关掉;会出现Connection Refuse的错误;因为被防火墙给屏蔽掉了!
(2)       出现mount version older than kernal的问题,刚开始介绍的时候说的那个问题就是这个,服务器和开发系统内核版本的问题。但是不要担心,并不用更新,完全可以正常使用。
 
 
Foto 1 di 6
Nessun elemento ancora aggiunto.