NFS挂载嵌入式Linux根文件系统

   之前转载过一篇《nfs挂载android根文件系统》,但是自己一直都没做成功过,之前因为挂载普通嵌入式Linux根文件系统总是在内核刚启动时,开发板就不向串口打印信息了,而是直接打印到开发板lcd屏上,我想这肯定是uboot的启动参数没有设置正确。但是由于找工作的原因一直都没有去解决。

    今天由于必须用nfs挂载android根文件系统,又重新回到这样一个问题中来,没有设置正确的uboot启动参数,经过多次尝试,终于能让开发板向串口打印信息了。具体设置的uboot的启动参数如下:

>setenv ipaddr 192.168.3.189

>setenv getway 192.168.3.254

>setenv serverip 192.168.3.201

>setenv bootargs root=/dev/nfs rw nfsroot=192.168.3.201:/home/yww/nfs,proto=tcp,nfsvers=3,nolock ip=192.168.3.189:192.168.3.201:192.168.3.254:255.255.255.0:YWW:eth0:off console=ttySAC0,115200 init=/linuxrc

需要说明一点的是,在启动参数中,设置了nfsroot=192.168.3.201:/home/yww/nfs,proto=tcp,nfsvers=3,nolock ,后面这三个参数是在出现了

可以在宿主机上用ping命令ping一下开发板ip,此时终于能够ping通了~~哈哈~~成功不远了~~

     虽然能够向串口打印信息,这样一来,就能看到了到底有没有成功挂载,能够看到出现什么问题了,不出所料啊~~新问题就出来了:

+------------------------------------------------+ | Uboot 1.1.6 For TX-2440A With USB Downloader | +------------------------------------------------+ Press Space key to Download Mode ! Booting Linux ... Copy linux kernel from 0x00120000 to 0x30008000, size = 0x00400000 ... Copy Kernel to SDRAM done,NOW, Booting Linux...... Uncompressing Linux.......................................................................................................................................... done, booting the kernel. Linux version 2.6.31 ([email protected]) (gcc version 4.1.2) #17 Mon Oct 18 21:16:12 CST 2010 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 400.000 MHz, memory 100.000 MHz, peripheral 50.000 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: root=/dev/nfs rw rootfstype=nfs rsize=1024,wsize=1024 nfsroot=192.168.3.201:/home/yww/nfs,proto=tcp,nfsvers=3,nolock ip=192.168.3.189:192.168.3.201:192.168.3.254:255.255.255.0:YWW:eth0:off console=ttySAC0,115200 init=/linuxrc PID hash table entries: 256 (order: 8, 1024 bytes) 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: 60396KB available (3796K code, 332K data, 204K init, 0K highmem) NR_IRQS:85 irq: clearing pending ext status 000c0800 irq: clearing subpending status 00000002 Console: colour dummy device 80x30 console [ttySAC0] enabled Calibrating delay loop... 199.47 BogoMIPS (lpj=498688) Mount-cache hash table entries: 512 CPU: Testing write buffer coherency: ok 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 at 0 SCSI subsystem initialized usbcore: registered new interface driver usbfs usbcore: registered new interface driver hub usbcore: registered new device driver usb s3c-i2c s3c2440-i2c: slave address 0x10 s3c-i2c s3c2440-i2c: bus frequency set to 97 KHz s3c-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) yaffs Sep 16 2010 19:21:37 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 40x30 fb0: s3c2410fb frame buffer device adc initialized 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 nbd: registered device at major 43 Uniform Multi-Platform E-IDE driver ide-gd driver 1.18 ide-cd driver 5.00 dm9000 Ethernet Driver, V1.31 Now use the default MAC address: 08:90:90:90:90:90 eth0: dm9000e at c4814000,c4818004 IRQ 62 MAC: 08:90:90:90:90:90 (www.yww.com) S3C24XX NAND Driver, (c) 2004 Simtec Electronics s3c24xx-nand s3c2440-nand: Tacls=1, 10ns Twrph0=3 30ns, Twrph1=1 10ns s3c24xx-nand s3c2440-nand: NAND hardware ECC NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit) Scanning device for bad blocks Bad eraseblock 97 at 0x000000c20000 Bad eraseblock 743 at 0x000005ce0000 Bad eraseblock 917 at 0x0000072a0000 Bad eraseblock 954 at 0x000007740000 Bad eraseblock 1195 at 0x000009560000 Bad eraseblock 1346 at 0x00000a840000 Bad eraseblock 1821 at 0x00000e3a0000 Creating 3 MTD partitions on "NAND 256MiB 3,3V 8-bit": 0x000000000000-0x000000100000 : "YWW_BOOT" 0x000000120000-0x000000520000 : "YWW_KERNEL" 0x000000520000-0x000010000000 : "YWW_YAFFS2" 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 Initializing USB Mass Storage driver... usbcore: registered new interface driver usb-storage USB Mass Storage support registered. 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.5.0: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 usbcore: registered new interface driver usbsevseg mice: PS/2 mouse device common for all mice s3c2410 TouchScreen successfully loaded input: s3c2410 TouchScreen as /class/input/input0 S3C24XX RTC, (c) 2004,2006 Simtec Electronics s3c2410-rtc s3c2410-rtc: rtc disabled, re-enabling s3c2410-rtc s3c2410-rtc: rtc core: registered s3c as rtc0 Linux video capture interface: v2.00 initializing s3c2440 camera interface...... s3c2440 camif init done Loading OV9650 driver......... SCCB address 0x60, manufacture ID 0xFFFF, expect 0x7FA2 SCCB address 0x60, manufacture ID 0xFFFF, expect 0x7FA2 No OV9650 found!!! S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled usbcore: registered new interface driver hiddev usbcore: registered new interface driver usbhid usbhid: v2.6:USB HID core driver 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. s3c2410-rtc s3c2410-rtc: setting system clock to 2011-01-17 16:04:28 UTC (1295280268) usb 1-1: new full speed USB device using s3c2410-ohci and address 2 usb 1-1: configuration #1 chosen from 1 choice hub 1-1:1.0: USB hub found hub 1-1:1.0: 4 ports detected dm9000 dm9000.0: WARNING: no IRQ resource flags set. eth0: link down IP-Config: Complete: device=eth0, addr=192.168.3.189, mask=255.255.255.0, gw=192.168.3.254, host=YWW, domain=, nis-domain=(none), bootserver=192.168.3.201, rootserver=192.168.3.201, rootpath= Looking up port of RPC 100003/3 on 192.168.3.201 eth0: link up, 100Mbps, full-duplex, lpa 0x4DE1 Looking up port of RPC 100005/3 on 192.168.3.201 Root-NFS: Unable to get mountd port number from server, using default Root-NFS: Server returned error -5 while mounting /home/yww/nfs VFS: Unable to mount root fs via NFS, trying floppy. List of all partitions: 1f00 1024 mtdblock0 (driver?) 1f01 4096 mtdblock1 (driver?) 1f02 256896 mtdblock2 (driver?) No filesystem could mount root, tried: nfs Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0) [] (unwind_backtrace+0x0/0xd4) from [] (panic+0x40/0x124) [] (panic+0x40/0x124) from [] (mount_block_root+0x1c4/0x20c) [] (mount_block_root+0x1c4/0x20c) from [] (prepare_namespace+0x168/0x1cc) [] (prepare_namespace+0x168/0x1cc) from [] (kernel_init+0xc8/0xfc) [] (kernel_init+0xc8/0xfc) from [] (kernel_thread_exit+0x0/0x8)

 

可以看到出现的新问题:

Root-NFS: Unable to get mountd port number from server, using default

Root-NFS: Server returned error -5 while mounting /home/yww/nfs

我们在主机上ping 192.168.3.189

64 bytes from 192.168.3.189: icmp_seq=99 ttl=64 time=1.02 ms
64 bytes from 192.168.3.189: icmp_seq=100 ttl=64 time=1.34 ms
64 bytes from 192.168.3.189: icmp_seq=101 ttl=64 time=0.993 ms

--- 192.168.3.189 ping statistics ---
101 packets transmitted, 101 received, 0% packet loss, time 100011ms
rtt min/avg/max/mdev = 0.777/1.187/6.680/0.894 ms
看上去好像没有丢包啊~~可是为什么挂载不了呢~~~?????

还不是很清楚啊~~会不会是我将我的开发板与主机之间用路由器相连的缘故,明天拿交叉网线直接将开发板与主机连上试试看~~相信会成功的~~哈哈~~大家等等哦~~呵呵~~

 

nfs: server 192.168.3.201 not responding, still trying问题之后加上去的。问题的原因是nfs默认使用的UDP协议,这协议丢包比较严重,所以用上述三个参数将nfs设置为:tcp协议。

你可能感兴趣的:(嵌入式Linux文件系统)