2013年(16)
分类: LINUX
2013-02-15 18:18:03
原文地址:Mini2440 nfs配置和启动 作者:gududesiling
Mini2440通过nfs启动linux系统总结
这是我转自:
http://hi.baidu.com/aundapeng/blog/item/e93a7a162b2dca12972b4314.html
(注:以下由我自己班子上实验,改写了一部分)
还有就是,友善提供的原版的内核镜像貌似不行,我试了很长时间,于是自己制作镜像和网卡驱动,有兴趣的朋友可以参看我其他的博文
Mini2440 通过nfs启动linux系统总结
开发主机我用的虚拟机,linux系统为centos ,下面是具体步骤。
主机下:
1.建立NFS共享目录,我这里把共享目录建在/home;
2.解压文件,把mini2440光盘里的linux目录下root_qtopia.tgz解压到/home下,命令:#tar zvxf root_qtopia.tgz –C /home,之后/home下会出现root_qtopia目录;
3.设置共享目录,运行命令:#gedit /etc/exports,编辑nfs配置文件,打开后文件是空的,在文件中加入:/home/root_qtopia *(rw,sync,no_root_squash),保存退出。
其中,/home/root_qtopia是共享目录,*表示所有客户机都可以挂载此目录,rw表示挂载此目录的客户机对此文件可读写的权力,no_root_qtopia表示允许挂载此目录的客户机拥有root身份。
4.启动nfs服务,有两种方法,一种是输入命令:
#/etc/init.d/nfs start,这将启动nfs服务,输入命令:#/etc/init.d/nfs stop,关闭nfs服务。
要想在每次开机都自动启动nfs服务,需输入命令:#serviceconf,此时会弹出linux的服务配置窗口,找到nfs这一项,选中它并启动,然后保存退出即可。
5.此时,主机的nfs服务已经配置完毕,可以输入命令:#mount –t nfs localhost: /home/root_qtopia /mnt/,输入后如果不提示任何消息,说明nfs已经挂载成功,进入/mnt目录下看看是否有/homeroot_qtopia文件夹下的内容。如有,则主机搞定!
注意:要是windows和linux虚拟机IP地址保持在同一网段,我现在的windows的ip为:59.70.157.157,linux虚拟机ip地址是:59.70.157.174。
(注:这个地方要虚拟机和采用brigde方式链接,具体,请晚上查找,非常简单)
下面开始配置mini2440开发板
1.打开windows下的超级终端,连接好串口线、网线、电源,选择nand flash启动开发板,在启动时迅速按空格键(可以先按空格键,在启动,呵呵),进入vivi模式
2.在Supervivi模式下输入如下命令(就是按q,进入vivi的命令模式)
Supervivi> param set linux_cmd_line "console=ttySAC0 root=/dev/nfs nfsroot=59.70.157.174:/home/root_qtopia ip=59.70.157.175:59.70.157.174:59.70.157.1:255.255.255.0:mini2440:eth0:off"
其中 ,param set linux_cmd_line 是设置启动 linux 时的命令参数。其各参数的含义
如下:
nfsroot 是自己开发主机的IP 地址。
“ip=”后面:
第一项(59.70.157.175)是目标板的临时IP(注意不要和局域网内其他IP 冲突);
第二项(59.70.157.174)是开发主机的IP(虚拟机的);
第三项(59.70.157.1)是目标板上网关(GW)的设置;
第四项(255.255.255.0)是子网掩码;
第五项是开发主机的名字(一般无关紧要,可随便填写)
eth0 是网卡设备的名称(随便)。
3.要想每次启动都通过nfs启动系统,输入命令:Supervivi>menu,按下s,然后再按下w,将启动命令写入flash,成功!以后每次都可以以NFS方式启动。如不进行此操作,以后要想通过nfs启动系统都要对开发板进行上面环境变量的设置。
4.输入boot,按enter键即可通过nfs启动系统
注:用ifconfig eth0 192.168.1.230可以设置linux开发板的ip地址,但重启后又变成默认,要想保存改变的ip地址,需要改掉/etc/eth0-setting里面的IP就可以永久保存了。
5下面是我补充的,
在supervivi输入后输入boot启动后,我的提示信息是这样的:
NOW, Booting Linux......
Uncompressing Linux.............................................................
....................................................................... done, bo
oting the kernel.
Linux version 2.6.30.4 () (gcc version 4.3.2 (Sourcery G++ Lite 2008q3
-72) ) #5 Fri Mar 25 21:35:33 CST 2011
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: SMDK2440
ATAG_INITRD is deprecated; please update your bootloader.
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C24XX Clocks, (c) 2004 Simtec Electronics
S3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: console=ttySAC0 root=/dev/nfs nfsroot=59.70.157.174:/home/r
oot_qtopia ip=59.70.157.175:59.70.157.174:59.70.157.1:255.255.255.0:mini2440:eth
0:off
NR_IRQS:99
irq: clearing subpending status 00000003
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 1024 bytes)
Console: colour dummy device 80x30
console [ttySAC0] enabled
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 60548KB available (3680K code, 362K data, 136K init, 0K highmem)
Calibrating delay loop... 201.93 BogoMIPS (lpj=504832)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 936 bytes
NET: Registered protocol family 16
S3C Power Management, Copyright 2004 Simtec Electronics
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4808000, irq 33
DMA channel 1 at c4808040, irq 34
DMA channel 2 at c4808080, irq 35
DMA channel 3 at c48080c0, irq 36
S3C244X: Clock Support, DVS off
bio: create slab
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
s3c2440-i2c s3c2440-i2c: slave address 0x10
s3c2440-i2c s3c2440-i2c: bus frequency set to 98 KHz
s3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NET: Registered protocol family 1
NetWinder Floating Point Emulator V0.97 (extended precision)
Installing knfsd (copyright (C) 1996
JFFS2 version 2.2. (NAND) (SUMMARY) 漏 2001-2006 Red Hat, Inc.
ROMFS MTD (C) 2007 Red Hat, Inc.
yaffs Mar 25 2011 13:36:02 Installing.
msgmni has been set to 118
alg: No test for stdrng (krng)
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Console: switching to colour frame buffer device 30x40
fb0: s3c2410fb frame buffer device
lp: driver loaded but no devices found
ppdev: user-space parallel port driver
Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
brd: module loaded
loop: module loaded
Uniform Multi-Platform E-IDE driver
ide-gd driver 1.18
ide-cd driver 5.00
Driver 'sd' needs updating - please use bus_type methods
dm9000 Ethernet Driver
eth%d: Invalid ethernet MAC address. Please set using ifconfig
eth0 (dm9000): not using net_device_ops yet
eth0: dm9000 at c486e000,c4872004 IRQ 51 MAC: 08:08:08:08:12:27
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2440-nand s3c2440-nand: Tacls=3, 29ns Twrph0=7 69ns, Twrph1=3 29ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bi
t)
Scanning device for bad blocks
Bad eraseblock 44 at 0x000000580000
Bad eraseblock 45 at 0x0000005a0000
Bad eraseblock 46 at 0x0000005c0000
Bad eraseblock 47 at 0x0000005e0000
Bad eraseblock 48 at 0x000000600000
Bad eraseblock 49 at 0x000000620000
Bad eraseblock 50 at 0x000000640000
Bad eraseblock 51 at 0x000000660000
Bad eraseblock 52 at 0x000000680000
Bad eraseblock 53 at 0x0000006a0000
Bad eraseblock 54 at 0x0000006c0000
Bad eraseblock 55 at 0x0000006e0000
Bad eraseblock 56 at 0x000000700000
Bad eraseblock 58 at 0x000000740000
Bad eraseblock 59 at 0x000000760000
Bad eraseblock 60 at 0x000000780000
Bad eraseblock 61 at 0x0000007a0000
Bad eraseblock 62 at 0x0000007c0000
Creating 4 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x000000000000-0x000000040000 : "vivi"
0x000000040000-0x000000060000 : "param"
0x000000060000-0x000000560000 : "kernel"
0x000000560000-0x00003ffe0000 : "root"
mtd: partition "root" extends beyond the end of device "NAND 256MiB 3,3V 8-bit"
-- size truncated to 0xfaa0000
usbmon: debugfs is not available
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
usbcore: registered new interface driver libusual
usbcore: registered new interface driver usbserial
USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial Driver core
USB Serial support registered for FTDI USB Serial Device
usbcore: registered new interface driver ftdi_sio
ftdi_sio: v1.4.3:USB FTDI Serial Converters Driver
USB Serial support registered for pl2303
usbcore: registered new interface driver pl2303
pl2303: Prolific PL2303 USB to serial adaptor driver
mice: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
Advanced Linux Sound Architecture Driver Version 1.0.20.
ALSA device list:
No soundcards found.
TCP cubic registered
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
eth0: link down
IP-Config: Complete:
device=eth0, addr=59.70.157.175, mask=255.255.255.0, gw=59.70.157.1,
host=mini2440, domain=, nis-domain=(none),
bootserver=59.70.157.174, rootserver=59.70.157.174, rootpath=
Looking up port of RPC 100003/2 on 59.70.157.174
eth0: link up, 100Mbps, full-duplex, lpa 0x41E1
Looking up port of RPC 100005/1 on 59.70.157.174
VFS: Mounted root (nfs filesystem) on device 0:11.
Freeing init memory: 136K
hwclock: can't open '/dev/misc/rtc': No such file or directory
[01/Jan/1970:00:00:15 +0000] boa: server version Boa/0.94.13
[01/Jan/1970:00:00:15 +0000] boa: server built Mar 26 2009 at 15:28:42.
[01/Jan/1970:00:00:15 +0000] boa: starting server pid=934, port 80
open device leds: No such file or directory
Try to bring eth0 interface up......NFS root ...Done
Please press Enter to activate this console.
按下回车,如下,然后创建一个文件,看看在虚拟机中是不是有这个文件
[root@FriendlyARM /]# ls
bin etc lib mnt proc sbin tmp var
dev home linuxrc opt root sys usr www
[root@FriendlyARM /]# touch gududesiling[root@FriendlyARM /]# ls
bin home mnt root tmp www
dev lib opt sbin usr gududesiling etc linuxrc proc sys var
6,进入虚拟机,打开/home/root_qtipoa,中确实有gududesiling这个文件,说明我nfs挂在成功了。呵呵