從零開始學Ubuntu心得
從零開始學ubuntu(學習心得) 2011-09-09 17:03:17
標籤: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實用命令 (以下為轉載)