以nfs 方式加载mini2440内核及文件系统

说明:环境为虚拟机+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)

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

家有工程师

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值