紅帽linux5.5 linux 開發環境的搭建 1

原創作品:http://write.blog.csdn.net/postedit/7956383    

歡迎大家一起交流學習,知識在與分享。

希望結交一些志同道和之士 

QQ: 474530676

[email protected]

   


電腦PC(xp) 和 VMware Workstation 8.0.2 和 up6410開發板



虛擬機與arm11的連接( 紅帽linux5.5)


老師資料存放在根目錄下 up6410 文件夾下




******************************************************************************************************************
第一步:
      設置SD卡啓動,將開發板上右上角的開關撥到上面(ON)


第二步:
      用usb轉串口線(先在xp下裝好驅動)把arm開發板和電腦連接起來,usb口接電腦,串口接開發板


********************************************************************************************************************
第三步:
      燒錄SD啓動卡
1,SD卡插入到電腦時,是默認掛載的,這樣進到的是SD卡的文件系統,
        在文件系統下,燒寫SD卡是寫到SD卡的已有文件的後面,而ARM的
       啓動程序bios只檢測SD卡的前512個字節的區域。所以要先將SD卡卸載掉 
  
   
2  ,  一定在/dev目錄下 查看設備 "cd /dev/tty" 按 tab
/////////////////////////////////////////////////////////////////////////////


[root@longguopeng ~]# ll /dev/tty
tty      tty16    tty24    tty32    tty40    tty49    tty57    tty8
tty0     tty17    tty25    tty33    tty41    tty5     tty58    tty9
tty1     tty18    tty26    tty34    tty42    tty50    tty59    ttyS0
tty10    tty19    tty27    tty35    tty43    tty51    tty6     ttyS1
tty11    tty2     tty28    tty36    tty44    tty52    tty60    ttyS2
tty12    tty20    tty29    tty37    tty45    tty53    tty61    ttyS3
tty13    tty21    tty3     tty38    tty46    tty54    tty62    ttyUSB1
tty14    tty22    tty30    tty39    tty47    tty55    tty63    
tty15    tty23    tty31    tty4     tty48    tty56    tty7                  
 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\####




3 ,  然後用 "df -l" 命令找到SD卡設備
 /////////////////////////////////////////////////////////////////////////////


[root@longguopeng ~]# df -l
文件系統               1K-塊        已用     可用 已用% 掛載點
/dev/sda3             20315844  16044668   3222536  84% /
/dev/sda5             19288596    395036  17897936   3% /home
/dev/sda1              1019208     39980    926620   5% /boot
tmpfs                   517532         0    517532   0% /dev/shm
/dev/sdb1              1920256     26548   1893708   2% /media/disk
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\####




4 ,爲了防止出錯,確認卸載了SD卡("umount /media/disk"),且在/dev下找到了SD卡設備,
/////////////////////////////////////////////////////////////////////////


[root@longguopeng ~]# umount /media/disk
文件系統               1K-塊        已用     可用 已用% 掛載點
/dev/sda3             20315844  16044668   3222536  84% /
/dev/sda5             19288596    395036  17897936   3% /home
/dev/sda1              1019208     39980    926620   5% /boot
tmpfs                   517532         0    517532   0% /dev/shm
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\####
           
 
5 ,   切換到老師發的資料up6410(存在根目錄下)文件下的tools目錄下的sd_write工具燒寫程序
命令是: 
//////////////////////////////////////////////////////////////////////////////////


[root@longguopeng ~]# cd /up6410/tools 
[root@longguopeng tools]# ./sd_write /dev/sdb /up6410/images/u-boot-sd.bin
Done.
[root@longguopeng tools] sync
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\####
         
顯示 Done. (表示下載成功)                
      dev/sdb 就是SD卡設備路徑,不需要寫端口號
      u-boot-movi.bin 就是要燒寫到SD卡的啓動程序
                不是寫在文件系統裏,所以在SD卡里看不見文件

                燒寫完之後,輸入 "sync" 命令同步一下,就可以拔出SD卡插到ARM開發板上實驗了!



 6  ,  關閉防火牆關掉
//////////////////////////////////////////////////////////////////////////////////
[root@longguopeng ~]# chkconfig --level 2345 iptables off   #關閉方法
[root@longguopeng ~]# chkconfig --list | grep iptables      #檢查方法
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\####


*********************************************************************************************************************
第四步:
      確認SD卡燒寫成功
        1,輸入 "minicom -s" 指令開啓串口通信程序,並且配置minicom


/////////////////////////////////////////////////////////////////     


[root@longguopeng ~] minicom -s
 


:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 minicom 主菜單 


    [configuration]        //配置
│ Filenames and paths      //文件名和路徑
│ File transfer protocols //文件傳輸協議
│ Serial port setup       //串行端口設置
│ Modem and dialing       //調制解調器和撥號
│ Screen and keyboard     //屏幕和鍵盤
│ Save setup as dfl      //設置保存到
│ Save setup as..       //儲存設定爲
│ Exit                  //退出
│ Exit from Minicom    //退出minicom
-------------------------------------------------


 用方向上下鍵選擇 Serial port setup //串行端口設置


│A-Serial Device(串口設備): /dev/ttyS0
│B-Lockfile Location(鎖文件位置): /var/lock
│C-Callin Program(調入程序):
│D-Callout Program(調出程序):
│E-Bps/Par/Bits(波特率): 115200 8N1
│F-Hardware Flow Control(硬件數據流控制): No
│G-Software Flow Control(軟件數據流控制): No
_________________________________________________  


  需要配置:
                1,修改第三項 --> serial port setup (方向鍵上下移動,回車確定)
                    1:按A修改service Device   :/dev/ttyUSB0   
    ttyUSB0是在/dev 目錄下找到的SD卡設備,連接不通時,重新查看設備
                    
   2:按B修改Lockfile Location :/var/lock
                                                                                                  大小       格式
                    3:按E,再按Q 修改Bps/Par/Bits : 115200 8N1    
                              115200是波特率8N1是數據傳輸方式,8代表8bit的數據,N代表無校驗位,1代表停止位


                    4:按F設置Hardware Flow Control :NO
                    5:按G設置Software Flow Control :NO
                    6:按回車退出
               2,保存
                    選擇"Save setup as dfl"保存配置
               3, 選Exit 退出並進入minicom 界面
          
     4,按下ARM開發板左下角的重啓鍵(RESTR按鍵),minicom 界面就會有u-boot數據輸出了




設置方法 二


打開終端輸入minicom後,初始化進入minicom的歡迎界面,
這裏提示按”Ctrl+A”,再按”Z”鍵進入主配置目錄
Ctrl+A”,再按”w”鍵進入自動換行
按下”O”鍵,並選擇串口配置選項進行配置。接下來的配置是一樣的。
---------------------------------------------
      Minicom Command Summary                       │                                                                   
│          Commands can be called by CTRL-A <key>                   ││                                                                   
│               Main Functions                  Other Functions     ││                                                                   
│ Dialing directory..D  run script (Go)....G | Clear Screen.......C 
│ Send files.........S  Receive files......R | cOnfigure Minicom..O 
│ comm Parameters....P  Add linefeed.......A | Suspend minicom....J 
│Capture on/off.....L  Hangup.............H | eXit and reset.....X 
│send break.........F  initialize Modem...M | Quit with no reset.Q 
│ Terminal settings..T  run Kermit.........K | Cursor key mode....I 
│ lineWrap on/off....W  local Echo on/off..E | Help screen........Z       
│                                            | scroll Back........B      │                                                                         
│      Select function or press Enter for none.                          │                                                                        
│             Written by Miquel van Smoorenburg 1991-1995                
│             Some additions by Jukka Lahtinen 1997-2000                 
     │             i18n by Arnaldo Carvalho de Melo 1998         
----------------------------------------------------


minicom命令摘要,按下Ctrl+D命令將被執行 , Key是對應的“字母”鍵。
“D”鍵:撥號目錄
“S”鍵:發送文件,上傳文件有幾種方式:zmodem、ymodem、xmodem、kermit、ascii
“P”鍵:通信參數。對波特率進行設置。
“L”鍵:捕捉開關。
“F”鍵:發送中斷。
“T”鍵:終端設置。A-終端仿真:VT102終端B-Backspace鍵發送:DEL鍵 C-狀態一致:啓動D-換行延遲(毫秒):0
“W”鍵:換行開關
“G”鍵:運行腳本
“R”鍵:接收文件
“A”鍵:添加一個換行符
“H”鍵:掛斷
“M”鍵:初始化調制解調器
“K”鍵:運行kermit進行刷屏
“E”鍵:切換本地回顯開關
“C”鍵:清除屏幕
“O”鍵:配置minicom
“J”鍵:暫停minicom
“X”鍵:退出和復位
“Q”鍵:退出沒有復位
“I”鍵:光標模式
“Z”鍵:幫助屏幕
“B”鍵:滾動返回


查看兩邊互ping檢測網絡是否通暢,
(minicom超級終端下)ping +IP(Linux),(Linux下)ping +IP(超級終端的IP)
***************************************************************************************************************************************


第五步:
        將內核下載到開發板上
        1,開啓tffp服務
      [root@longguopeng ~]    //tftp.rpmnew (rhel6.2)
            
設置如下:
-------------------------------------------| 
           service tftp
           {
                socket_type  = dgram
                protocol     = udp
                wait         = yes
                user         = root
                server       = /usr/sbin/in.tftpd
                server_args  = -t -v -s /tftpboot //修改這項  -t -v 可不用
                /var/lib/tftpboot(rhel 6.2)
                disable      = no                 //修改這項
                per_source   = 11
                cps          = 100 2
                flags        = IPv4
            }
-------------------------------------------|           
         2,重啓tftp服務(tftp服務包括在xinetd裏)
          
   [root@longguopeng ~] service xinetd restart
       
           
***************************************************************************************************************************************


U-boot 配置顯示如下:
------------------------------------------------|
U-Boot 1.1.6 (Jun 12 2011 - 16:55:02) for SMDK6410                              
                                                                                
****************************************                                        
**    UT-S3C6410 Nand boot v0.18      **                                        
**    ShenZhen Urbetter Technology    **                                        
**    Http://www.urbetter.com         **                                        
****************************************                                        
                                                                                
CPU:     S3C6410@532MHz                                                         
         Fclk = 532MHz, Hclk = 133MHz, Pclk = 66MHz, Serial = CLKUART (SYNC Mod 
Board:   SMDK6410                                                               
DRAM:    128 MB                                                                 
Flash:   0 kB                                                                   
NAND:    256 MB                                                                 
SD/MMC:  1880 MB                                                                
*** Warning - bad CRC or moviNAND, using default environment                    
                                                                                
In:      serial                                                                 
Out:     serial                                                                 
Err:     serial                                                                 
dm9000 i/o: 0x18000300, id: 0x90000a46                                          
MAC: 00:40:5c:26:0a:5b                                                          
operating at unknown: 15 mode                                                   
Hit any key to stop autoboot:  0     
////////////////////////////////////////////////////////////////////////////////////////////
--------------------------------------------------------------------------------
       
在minicom 界面設置環境變量
          
          1 先查看 電腦本地連接ip (可以自己設置本地連接ip,一定要把其它連接禁用!!!!)
 點擊左下角電腦 " 開始 " " 運行 "
 打開   cmd 
                  C:\Documents and Settings\Administrator> ipconfig 
         
 顯示如下:
------------------------------------|
Ethernet adapter 本地連接:


        Connection-specific DNS Suffix  . :
        Autoconfiguration IP Address. . . :192.168.1.177
        Subnet Mask . . . . . . . . . . . :255.255.255.0
        Default Gateway . . . . . . . . . :168.192.1.1
------------------------------------|


修改虛擬機ip地址的配置文件:


[root@longguopeng ~] vim /etc/sysconfig/network-scripts/ifcfg-eth0
-------------------------------------|
DEVICE="eth0"
BOOTPROTO="static"   
  ONBOOT="yes"
      HWADDR="40:16:9F:EB:97:C0"
TYPE="Ethernet"
      NETMASK=255.255.255.0
IPADDR=2.2.2.179


 
   BOOTPROTO:  IP的獲取方式,可以取 dhcp 和 static 
               dhcp 動態獲取
                        static 手動指定 ,如果有這一項的話必須要有
                                IPADDR=x.x.x.x
------------------------------------|
[root@longguopeng ~] service network restart    (重啓網絡)          
        
  
2 在minicom界面數入
 help       命令幫助
printenv     查看環境變量,並修改IP地址
  


   設置開發板的ip: uplooking # setenv ipaddr 168.192.1.253    
                                                  注意:開發板和虛擬機,電腦PC 的網段要一樣
            
            設置虛擬機的ip:uplooking # set serverip  192.168.1.254      
                                                  在虛擬機上用ifconfig指令查看ip地址,


   延時10秒                       uplooking # setenv  bootdelay 10    (可不用)
           10秒後打印環境變量  uplooking # setenv  bootcmd printenv(可不用)
            設置網關                      uplooking # setenv gatewayip 192.168.1.1 
            設置子網掩碼             uplooking # setenv netmask 255.255.255.0
            開啓標準輸入             uplooking # setenv stdin serial
            開啓標準輸出             uplooking # setenv stdout serial
            開啓標準錯誤輸出    uplooking # setenv stderr serial


            設置完成保存設置    uplooking # saveenv
 
           如果命令敲錯了如: uplooking # setenv getewayip 192.168.1.1 
          直接該爲就可以去掉 uplooking # setenv getewayip
            
 看是否可以和虛擬機ip連接
            "ping 192.168.1.254"
                顯示host 192.168.1.254 is alive 就證明開發板已和pc連接上了










顯示配置:
--------------------------------------------------|
uplooking # pri                                      
bootargs=root=/dev/nfs rw nfsroot=192.168.1.254:/nfsroot ip=192.168.1.253 conso0
bootcmd=nand read 0x50008000 0x40000 0x220000;bootm 0x50008000                  
bootdelay=3                                                                     
baudrate=115200                                                                 
ethaddr=11:22:33:44:55:66                                                       
ipaddr=192.168.1.253                                                            
gatewayip=192.168.1.1                                                           
netmask=255.255.255.0                                                           
serverip=192.168.1.254                                                          
stdin=serial                                                                    
stdout=serial                                                                   
stderr=serial                                                                   
                                                                                
Environment size: 343/16380 bytes  
--------------------------------------------------|
     
  3,將內核複製到tftp指定的服務文件夾下 /tftpboot
      [root@longguopeng ~]# cd smdk6410_resource/
   
[root@longguopeng smdk6410_resource]# cd images/
[root@longguopeng images] cp zImage  /tftpboot
            
            確認文件已複製到/tftpboot下就可以下載內核zImage了
            
            在minicom界面輸入  
uplooking # tftp 0x50000000 zImage (這只是測試是否可以下載而已,下載成功可以看到進度條)
      uplooking # md 0x50000000           (查看地址)
            
            就可以下載了 0x50000000  
            就是要下載到開發板的地址,也是內存的起始地址,這個地址不是內核要存放的地址,
            內核存放的地址是0x50008000只有把內核下載到這個地址,內核纔可以啓動! 




**************************************************************************************************************************************
第六步:
        啓動內核,開啓nfs服務
        1,啓動nfs服務
            [root@longguopeng ~] service nfs restart
        
        2,創建nfs服務目錄
            [root@longguopeng ~] mkdir /nfsroot      
                                      // 這個目錄是用來存放文件系統的
        
        3,將文件系統解壓到nfs服務目錄下
            [root@longguopeng ~] tar -xvf /up6410/src/qt_rootfs.tar -C /nfsroot
                                                                                                                         //存放路徑                                     //解壓到的路徑
        
        4,進入/nfsroot目錄 添加共享目錄
            [root@longguopeng ~] vim /etc/exports
           添加一行    
                   /nfsroot *(rw,sync,no_root_squash)


        5,重啓NFS服務
            [root@longguopeng ~] service nfs restart


        6,進入minicom 界面修改環境變量
                
                下面三行寫成一行 換行時空一格  (ctrl+a W 打開換行)
                                                                                                                                                                                                虛擬機ip  
             uplooking # setenv bootargs root=/dev/nfs rw nfsroot=2.2.2.178:/nfsroot
                             開發板ip    虛擬機ip    網關         子防掩碼       名稱             網卡
                         ip=2.2.2.179:2.2.2.178:2.2.1.1:255.255.255.0:www.longguopeng.com:eth0:off
                                                                         
                         console=ttySAC0,115200 men=128M 
               
               可以不用  uplooking # setenv bootcmd tftp 0x50008000 uImage\; bootm 0x50008000   //  自動啓動下載


                保存環境變量 "savenv"
        
  觸屏校對               uplooking # rm -rf /etc/pointercal





7,重新下載內核
             uplooking # tftp 0x50008000 zImage
           
               啓動內核
             uplooking # bootm
                
              啓動正常的話,開發板上就會看到圖形界面


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




過程遇到的問題:
**********************************************************************************************************************
minicom 
------------------------------------------------------------
1   USB設備寫錯了,因該寫USB0
Device /dev/ttyUSB1 access failed: 沒有那個文件或目錄.


2       重啓minicom出現的情況
----------------------------------
出現   Device /dev/ttyUSB0 lock failed: 不允許的操作.
輸入minicom -s 重新設置一下並保存退出。


------------------------------------------------------------
[root@localhost tftpboot]# pstree -p | grep minicom
        |-minicom(14189)
[root@localhost tftpboot]# kill -9 14189
------------------------------------------------------------




再出現   minicom: cannot open /dev/ttyUSB0: 無效的參數
輸入minicom -s 重新設置一下並保存退出,再按下復位鍵


再不行的話:
就關閉電源,把usb重新插一下,啓動minicom ,按復位鍵,有可能不成功,在關閉電源,按復位建。




如果出現下面的:再按一下復位鍵
————————————————————————————————————————
Welcome to minicom 2.1


OPTIONS: History Buffer, F-key Macros, Search History Buffer, I18n           
Compiled on Jul 26 2006, 06:38:09.                                           
                                                                             
Press CTRL-A Z for help on special keys                                     
—————————————————————————————————————————                                                                             
**********************************************************************************************************************
IP 寫錯了


IP-Config: Complete:                                                            
     device=eth0, addr=192.168.1.253, mask=255.255.255.0, gw=192.168.1.1,       
     host=www, domain=, nis-domain=longguopeng.com,                             
     bootserver=192.168.1.254, rootserver=168.192.1.254, rootpath=              
Looking up port of RPC 100003/2 on 168.192.1.254                                
rpcbind: server 168.192.1.254 not responding, timed out                         
Root-NFS: Unable to get nfsd port number from server, using default             
Looking up port of RPC 100005/1 on 168.192.1.254                                
K                                                              


nfs 服務沒開啓 出現的問題
-----------------------------------------
VFS: Unable to mount root fs via NFS, trying floppy.                                                                              
VFS: Cannot open root device "nfs" or unknown-block(2,0)                                                                          
Please append a correct "root=" boot option; here are the available partitions:                                                   
1f00             256 mtdblock0 (driver?)                                                                                          
1f01            3840 mtdblock1 (driver?)                                                                                          
1f02           81920 mtdblock2 (driver?)                                                                                          
1f03          176128 mtdblock3 (driver?)                                                                                          
b300         1924096 mmcblk0 driver: mmcblk                                                                                       
  b301         1924027 mmcblk0p1                                                                                                  
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block




***************************************************************************************************************************************


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