從零開始學ubuntu(學習心得)

    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)存在問題。

 




 

 

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