以nfs 方式載入mini2440核心及檔案系統

來源:互聯網
上載者:User

說明:環境為虛擬機器+cenos,其centos核心為:


//*********************samba配置************************************************
關鍵steps 
1:修改檔案 /etc/samba/smb.conf

  [global]

  workgroup = MYGROUP

# 關鍵地方,匿名需要改為share 預設為user認證方式

 security = share 

  [suiyuan_wlan] //在windows上面顯示的名稱

  comment = file backup share //注釋 無關緊要

  path = /wlan#共用的目錄 記得要更改存取權限 chmod 755

  public = yes

  guest ok = yes
wirtable  = yes
在windows上面 訪問  \\ip\suiyuan_wlan 就可以查看linux上面共用的目錄了
2: 重新啟動服務
倆個相關的服務是否開啟 
service smb restart
service nmb restart 

//*******************************************************************************

[root@centos ~]$uname -a
Linux centos.ocaldomain 2.6.18-194.el5xen #1 SMP Fri Apr 2 16:16:54 EDT 2010 i686 i686 i386 GNU/Linux

使用過的uboot為tekkman製作的。開發板為:mini2440

一:linux上 nfs 建立

配置nfs exports檔案

查看nsf 服務是否啟動:

[root@centos ~]$service nfs status
rpc.mountd (pid 9313) is running...
nfsd (pid 9310 9309 9308 9307 9306 9305 9304 9303) is running...
rpc.rquotad (pid 9298) is running.

 則表示nfs服務正常運行。

查看nfs的設定檔

[root@centos /etc]$cat exports
/opt/FriendlyARM/mini2440/rootfs_qtopia_qt4 *(rw,sync,no_root_squash)
/opt/FriendlyARM/ *(rw,sync,no_root_squash)
/mini2440/rootfs *(rw,sync,no_root_squash)  //其中/mini2440/rootfs為nfs共用的目錄
/mini2440/fsmini *(rw,sync,no_root_squash)
/mini2440/qte_yaffs *(rw,sync,no_root_squash)

當對檔案/etc/exprots進行了編輯之後需要重新啟動nfs服務
[root@centos /etc]$service nfs restart
Shutting down NFS mountd:                                  [  OK  ]
Shutting down NFS daemon:                                  [  OK  ]
Shutting down NFS quotas:                                  [  OK  ]
Shutting down NFS services:                                [  OK  ]
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]

之後exprots中的檔案就可以配共用訪問了。

在uboot中需要設定命令參數值:如下

[u-boot@MINI2440]# printenv
bootdelay=1
baudrate=115200
ethaddr=08:90:90:90:90:90
xloy=bmp d 70000
 stdin=serial
stdout=serial
stderr=serial
ethact=dm9000
filesize=229DEC
fileaddr=30008000
gatewayip=192.168.1.1
netmask=255.255.255.0
ipaddr=192.168.1.146
serverip=192.168.1.149
bootcmd=nfs 0x30008000 192.168.1.149:/opt/FriendlyARM/uImage;bootm
bootargs=noinitrd root=/dev/nfs proto=tcp,nolock,nfsvers=3, rw nfsroot=192.168.1.149:/mini2440/rootfs ip=192.168.1.146:192.168.1.149::255.255.255.0 console=ttySAC0,115200 init=/linuxrc mem=64M

Environment size: 509/131068 bytes 以上顏色表示的為主要的參數。

其中

核心放到了目錄:/opt/FriendlyARM/uImage中。uImage是通過/opt/FriendlyARM/mini2440/tekkaman/tools/mkimage命令將zImage轉化為uImage的。在產生核心zImge的過程中,好像可以用make uImage命令產生uboot可以下載的uImage,但是我自己實驗的時候不行。

rootfs放到了/mini2440/rootfs 中,rootfs是自己穿件的根檔案系統。

同時zImage 到uimage 的轉化自己寫了一個shell指令碼。如下

[root@centos /opt/FriendlyARM]$cat zImage_to_uImage.sh
#!/bin/sh
/opt/FriendlyARM/mini2440/tekkaman/tools/mkimage  -A arm -O linux -T kernel -C none -a 30008000 -e 30008040 -n  "linux_kernel_`date '+%Y-%m-%d %T'`" -d /opt/FriendlyARM/mini2440/linux-2.6.32.2/arch/arm/boot/zImage /opt/FriendlyARM/uImage

[root@centos /opt/FriendlyARM]$./zImage_to_uImage.sh
Image Name:   linux_kernel_2012-02-05 15:03:01
Created:      Sun Feb  5 15:03:01 2012
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    2268588 Bytes = 2215.42 kB = 2.16 MB
Load Address: 30008000
Entry Point:  30008040

只要在調試核心中的驅動或者根檔案系統的時候,不要下載到flash中去,通過nsf直接在內從進行,有助於對flash的使用次數及速度。

同時可以利用uboot中的的ftp來載入核心到記憶體中去,但是需要在serverip對於機器上面已經開啟了tftpf服務。

總結一下linux上面tftp服務的建立及在uboot中使用ftp下載核心到記憶體中。

二:linux上 tftp 建立

對網路的設定檔進行編輯

[root@centos /etc/sysconfig/networking/devices]$gedit ifcfg-eth0 &

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=static //這個應該是“static”,而不是“dhcp”或“none”;
HWADDR=00:0C:29:E7:A4:D5
ONBOOT=yes
DHCP_HOSTNAME=centos.ocaldomain
IPADDR=192.168.1.149
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
然後重新啟用下網卡就可以了.

#service iptables stop  

 #service iptables status

#service network restart

Tfpt服務安裝

1:掛載光碟片

2:由於tftp跟xinetd有關,因此首先安裝xinetd rpm.

[root@centos /media/CentOS_5.5_Final/CentOS]$ls |grep xinet*

xinetd-2.3.14-10.el5.i386.rpm

之後再安裝 tftp rpm

[root@centos/media/CentOS_5.5_Final/CentOS]$rpm -ivh tftp-server-0.49-2.el5.centos.i386.rpm

3:修改設定檔 /etc/xinetd.d/tftp

[root@centos /etc/xinetd.d]$vi tftp

# default: off

# description: The tftp server serves files using the trivial file transfer \

#       protocol.  The tftp protocol is often used to boot diskless \

#       workstations, download configuration files to network-aware printers, \

#       and to start the installation process for some operating systems.

service tftp

{

         socket_type              = dgram

         protocol            = udp

         wait                    = yes

         user                    = root

         server                         = /usr/sbin/in.tftpd

        server_args              = -s /opt/FriendlyARM       //為核心uImage存放的位置與shell zImage_to_uImage.sh中最終產生uImage的位置相同

        
disable                       = yes  -àno

         per_source                = 11

         cps                      = 100 2

         flags                            = IPv4

}

4:重新啟動xinetd服務

[root@centos /media/CentOS_5.5_Final/CentOS]$
/etc/init.d/xinetd restart

之後uboot通過tftp下載核心uImage可以順利進行了。

u-boot@MINI2440]# tftp 0x30008000 uImage
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 08:90:90:90:90:90
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 192.168.1.149; our IP address is 192.168.1.146
Filename 'uImage'.
Load address: 0x30008000
Loading: T #################################################################
  #################################################################
  #########################
done
Bytes transferred = 2268652 (229dec hex)

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.