红帽linux5.5 linux 开发环境的搭建 1

来源:互联网 发布:大数据技术专家 编辑:程序博客网 时间:2024/04/29 23:29

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

欢迎大家一起交流学习,知识在与分享。

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

QQ: 474530676

longguopeng168@163.com

   


电脑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




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


原创粉丝点击