从零开始学Ubuntu心得

从零开始学ubuntu(学习心得) 2011-09-09 17:03:17

 

    2011.8.1开始至今,对着ubuntu,玩机、学习基本命令。看了两本书后,大概到8月底就开始玩开发板。开发板是友善的mini2440,将开发板与电脑相关起来就几乎花了一个星期。

    一 、由于对操作系统的超级终端之前一点概念都没有,在ubuntu下查找资料才知道,有三个选择:minicom、kermit、gtkterm。我选择了minicom。根据手册配置好。安装了lrzsz软件包:

$sudo apt-get install lrzsz

通过串口用xmodem协议写内核时会提示没有xmodem协议。

    到这里,在终端也只可以看到:

$minicom

welcom to minicom 2.4

options:I18n

compiled on Jan 25 2010,06:49:09

port/dev/ttyusb0

press ctrlA Z for help on special keys

    央求男友帮忙检查,才发现串口(我是用usb转串口+两头都是母头的串口线链接)根本没有连通,测试之后才知道我用的是交叉线(即线内部已经交叉连接了)。更改之后,开发板开机,在minicom终端下,有显示系列信息了!!

    二、 搭建交叉编译环境arm-linux-gcc

2011.9.5

    1.将arm-linux-gcc-4.3.2.tgz复制到 /tmp路径下

   2.在终端安装标准C开发环境,

    sudo apt-get install build-essential libncurses5-dev

  3.进入/usr/local/arm/4.3.2 目录,先将该目录权限修改为“777”,再

sudo tar -zxvf arm-linux-gcc-4.3.2.tgz -C /(c是大写,空格再反斜杠)

这样会自动解压到/usr/local/4.3.2目录下。

PS:我就是没有修改权限,绕了一点弯路。解压的时候,报错!

4.修改环境变量

1) sudo gedit /root/.bashrc 文末添加

export PATH=$PATH:/usr.local/arm/4.3.2/bin

保存退出。

2********)sudo vi /etc/bash.bashrc

文末加:

if [空格-d空格/usr/local/arm/空格];then

   PATH=/usr/local/arm/bin:"${PATH}"

fi

3)修改profile:

sudo vi /etc/profile

文末加:

export PATH=$PATH:/usr.local/arm/4.3.2/bin

使其生效:

source /etc/profile

验证:

echo $PATH

回显:/usr/local/arm/bin;......

到此,运行arm-linux-gcc -v

显示:arm-linux-gcc的第3行:exec:arm-none-linux-gnueabi-gcc未 找到。

烦!!!这个时候就要回过去找问题了。网上搜索的人们也有遇到此问题的,但没有直接的答案。我看他们的运行命令,这个我自认不如人家。发现,在/usr/local/arm/4.3.2/bin下面真的有个arm-none-linux-gnueabi-gcc,也有arm-linux-gcc等 文件,可是它干嘛说找不到呢?我就 打开 arm-linux-gcc

cat /usr/local/arm/4.3.2/bin/arm-linux-gcc

内容为: exec:arm-none-linux-gnueabi-gcc -march=armv4t $*

修改为: exec: /usr/local/arm/bin/arm-none-linux-gnueabi-gcc -march=armv4t $*

运行: arm-linux-gcc

错误还在!!

以下两种方式都不报错:

1) $ /usr/local/arm/bin/arm-none-linux-gnueabi-gcc -v

2) $ /usr/local/arm/bin/arm-linux-gcc -v

细心的 亲们,一定已经发现了问题所在了吧。在查看$PATH时返回的信息,路径为/usr/local/arm/bin,而在此路径是没有/bin的。修改为/usr/local/arm/4.3.2/bin的PATH问题就解决了!!!

三、这是最让我头疼的,配置NFS服务

环境:ubuntu10.4

ifconfig:

inet addr:192.168.0.2 bcast:192.168.0.255 mask:255.255.255.0

1)设置共享目录

  $sudo gedit /etc/exports

第一次打开为空白,如下添加内容:

/opt/FriendlyARM/mini2440/root_qtopia/  *(rw,sync,no_root_squash)



修改权限:
chmod 777 -R

/opt/FriendlyARM/mini2440/root_qtopia/

 

2)安装NFS

 

sudo apt-get install nfs-kernel-server (apt同时也安装了nfs-common portmap)

 

3)配置nfs

 

 a. sudo gedit /etc/default/portmap

 

将末行“-i 127.0.0.1”去掉-i 127.0.0.1为“”。

 

b. sudo dpkg-reconfigure portmap

 

对should portmap be bound to the loopback address?

 

选N

 

c. 配置/etc/hosts.deny

 

sudo gedit /etc/hosts.deny(禁止任何主机host与你的nfs服务器进行nfs链接)

 

末行添加:

 

###NFS DAEMONS

 

ALL:ALL

 

配置/etc/hosts.allow

 

sudo gedit /etc/hosts.allow

 

文末添加:

 

###NFS DAEMONS

 

portmap:192.168.0.

 

lockd:192.168.0.

 

mountd:192.168.0.

 

rquotad:192.168.0.

 

statd:192.168.0.

 

nfsd:192.168.0.



$ sudo /etc/init.d/portmap restart 重启portmap daemon.
显示如下
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the restart(8) utility, e.g. restart portmap
portmap start/running, process   XXXX



$ sudo showmount -e
显示 clnt-create : RPC : Program not registered

$ sudo   exportfs -r 更新

$ sudo    showmount 192.168.0.2 -e
显示
Export list for 192.168.0.2:

/opt/FriendlyARM/mini2440/root_qtopia/

*

六 启用
   $ sudo /etc/init.d/nfs-kernel-server restart 重启nfs服务
显示如下
* Stopping NFS kernel daemon                                                      [ OK ]
* Unexporting directories for NFS kernel daemon...                   [ OK ]
* Exporting directories for NFS kernel daemon...                           
   exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export "*:
/opt/FriendlyARM/mini2440/root_qtopia/

".
   Assuming default behaviour ('no_subtree_check').
   NOTE: this default has changed since nfs-utils version 1.0.x
                                                                        

* Starting NFS kernel daemon                                                          [ OK ]

挂载
mount -t nfs 192.168.0.2:
/opt/FriendlyARM/mini2440/root_qtopia/   /nfsmnt
mount -t nfs 192.168.0.2:
/opt/FriendlyARM/mini2440/root_qtopia/    /nfsmnt   -o nolock

虽然还不知道能不能在开发板上用,今天终于初见端倪,在主文件夹下/nfsmnt找到了想要的内容!!

 

明天就是教师节啦,祝老师们节日快乐!

 

2011年的中秋节前夕写一篇博文,以勉励 吾辈。中秋快乐!


有一绝好的配置NFS的网址推荐:

http://mostlylinux.wordpress.com/network/nfshowto/#step01

ps:有关ping实用命令 (以下为转载)

 

举例说明
ping就是对一个网址发送测试数据包,看对方网址是否有响应并统计响应时间,以此测试网络。   
具体方式是,开始--运行--cmd,在调出的dos窗口下输入 ping 空格 + 你要ping的网址,回车。   
比如 “ ping XXX网址” 之后屏幕会显示类似信息   
Pinging XXX 网址 [61.135.169.105] with 32 bytes of data:   
Reply from 61.135.169.105: bytes=32 time=1244ms TTL=46   
Reply from 61.135.169.105: bytes=32 time=1150ms TTL=46   
Reply from 61.135.169.105: bytes=32 time=960ms TTL=46   
Reply from 61.135.169.105: bytes=32 time=1091ms TTL=46   
后面的time=1244ms 是响应时间,这个时间越小,说明你连接这个地址速度越快。
本段PING测试
  
1.Ping本机IP   
例如本机IP地址为:172.168.200.2。则执行命令Ping 172.168.200.2。如果网卡安装配置没有问题,则应有类似下列显示:   
Reply from 172.168.200.2 bytes=32 time<10ms   
Ping statistics for 172.168.200.2   
Packets Sent=4 Received=4 Lost=0 0% loss   
Approximate round trip times in milli-seconds   
Minimum=0ms Maxiumu=1ms Average=0ms   
如果在MS-DOS方式下执行此命令显示内容为:Request timed out,则表明网卡安装或配置有问题。将网线断开再次执行此命令,如果显示正常,则说明本机使用的IP地址可能与另一台正在使用的机器IP地址重复了。如果仍然不正常,则表明本机网卡安装或配置有问题,需继续检查相关网络配置。   
2.Ping网关IP   
假定网关IP为:172.168.6.1,则执行命令Ping 172.168.6.1。在MS-DOS方式下执行此命令,如果显示类似以下信息:   
Reply from 172.168.6.1 bytes=32 time=9ms TTL=255   
Ping statistics for 172.168.6.1   
Packets Sent=4 Received=4 Lost=0   
Approximate round trip times in milli-seconds   
Minimum=1ms Maximum=9ms Average=5ms   
则表明局域网中的网关路由器正在正常运行。反之,则说明网关有问题。   
3.Ping远程IP   
这一命令可以检测本机能否正常访问Internet。比如本地电信运营商的IP地址为:202.102.48.141。在MS-DOS方式下执行命令:Ping 202.102.48.141,如果屏幕显示:   Reply from 202.102.48.141 bytes=32 time=33ms TTL=252   
Reply from 202.102.48.141 bytes=32 time=21ms TTL=252   
Reply from 202.102.48.141 bytes=32 time=5ms TTL=252   
Reply from 202.102.48.141 bytes=32 time=6ms TTL=252   
Ping statistics for 202.102.48.141   
Packets Sent=4 Received=4 Lost=0 0% loss   
Approximate round trip times in milli-seconds   
Minimum=5ms Maximum=33ms Average=16ms   
则表明运行正常,能够正常接入互联网。反之,则表明主机文件(windows/host)存在问题。

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章