1,给ubuntu建立tftp服务器:
1.1:首先设置虚拟机能上网步骤如下:
1.1.1 配置ip,配置 /etc/network/interfaces 文件
1.1.2 .然后是DNS,配置 /etc/resolv.conf
例如:配置静态IP地址
vim /etc/network/interfaces
内容如下:
auto lo
iface lo inet loopback
iface eth0 inet static
address 192.168.1.5
netmask 255.255.255.0
gateway 192.168.1.1
auto eth0
配置DNS
vim /etc/resolv.conf
增加以下内容:
nameserver 202.96.134.133
1.1.3 .增加默认网关
route add default gw 192.168.1.1
1.1.4 .重新启动网络配置
/etc/init.d/networking restart
1.2:建立tftp服务器:
网上摘抄方法:
1. sudo apt-get install tftp-hpa tftpd-hpa
2. cd /
sudo mkdir /tftpboot
sudo chmod 777 /tftpboot
3. sudo in.tftpd -l /tftpboot
这样tftp服务器就启动了,下面可以做一个测试
4. cd /tftpboot
touch test
建立一个文件
5. cd /home/usrname
登录另一个目录
6. tftp 192.168.0.60
换成自己的ip
> get /tftpboot/test
如果能够得到文件,那么就成功了。
PS:不要忘了 sudo apt-get install xinetd
sudo apt-get install netkit-inetd
关于不能上传(put)的解决
打开目录 /etc/xinetd.d/
新建文件tftp
tftp内容:
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot -c
per_source = 11
cps = 100 2
}
重新启动服务:
sudo /etc/init.d/xinetd restart
sudo in.tftpd -l /tftpboot
安装过程中出现的问题及原因
现象一:
tftp> get test.log
Transfer timed out.
原因:
tftpd服务没有启动
现象二:
tftp> get test.log
Error code 2: Only absolute filenames allowed
原因:
在/etc/xinetd.d/tftpd中设置的server_args为/etc/default/tftpd-hpa
cat /etc/default/tftpd-hpa
#Defaults for tftpd-hpa
RUN_DAEMON="no"
OPTIONS="-s /home/tftpd -c -p -U 077 -u tftpd"
设置的时候只要将server_args=改为你自己设定的服务器文件夹就行了
现象三:
tftp> put ex070416.log
Error code 1: File not found
原因:
指定的文件不存在;或tftpd启动参数中没有指定-c选项,允许上传文件。
3.板子通过tftp下载虚拟机的文件:
U-Boot> setenv ethaddr 3e:36:65:ba: 6f :be
U-Boot> setenv ipaddr 192.168.1.254
U-Boot> setenv getwayip 192.168.1.1
U-Boot> setenv netmask 255.255.255.0
U-Boot> setenv serverip 192.168.1.5
U-Boot> setenv bootfile uImage
U-Boot> saveenv
Saving Environment to NAND...
Erasing Nand...
Erasing at 0x60000 -- 100% complete.
Writing to Nand... done
U-Boot> tftp uImage
macb0: link up, 100Mbps full-duplex (lpa: 0x41e1)
Using macb0 device
TFTP from server 192.168.1.5; our IP address is 192.168.1.254
Filename 'uImage'.
Load address: 0x0
Loading: #################################################################
###########
done
Bytes transferred = 1113208 (10fc78 hex)
这样u-boot就可以直接下载文件到板子上了!
当然你也可以下载其它的文件:
U-Boot> tftp test
2.下载内核:
U-Boot> tftp 0x22000000 uImage
macb0: link up, 100Mbps full-duplex (lpa: 0x41e1)
Using macb0 device
TFTP from server 192.168.1.5; our IP address is 192.168.1.254
Filename 'uImage'.
Load address: 0x22000000
Loading: #################################################################
#########
done
Bytes transferred = 1075144 (1067c8 hex)
U-Boot> bootm 0x22000000
U-Boot> bootm 0x22000000
## Booting kernel from Legacy Image at 22000000 ...
Image Name: Linux-2.6.24
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1075080 Bytes = 1 MB
Load Address: 20008000
Entry Point: 20008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
Uncompressing Linux....................................................................... done, booting the kernel.
Linux version 2.6.24 (root@emboard) (gcc version 4.2.3 (Sourcery G++ Lite 2008q1-126)) #1 Thu May 20 21:16:55 HKT 2010
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
Machine: Atmel AT91SAM9260-EK
Memory policy: ECC disabled, Data cache writeback
Clocks: CPU 198 MHz, master 99 MHz, main 18.432 MHz
CPU0: D VIVT write-back cache
CPU0: I cache: 8192 bytes, associativity 4, 32 byte lines, 64 sets
CPU0: D cache: 8192 bytes, associativity 4, 32 byte lines, 64 sets
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: console=ttyS0,115200
AT91: 96 gpio irqs in 3 banks
PID hash table entries: 256 (order: 8, 1024 bytes)
Console: colour dummy device 80x30
console [ttyS0] 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: 62616KB available (1944K code, 194K data, 100K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 64 bytes
NET: Registered protocol family 16
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
Time: pit clocksource has been installed.
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
NetWinder Floating Point Emulator V0.97 (double precision)
io scheduler noop registered
io scheduler anticipatory registered (default)
atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL
atmel_usart.1: ttyS1 at MMIO 0xfffb0000 (irq = 6) is a ATMEL_SERIAL
atmel_usart.2: ttyS2 at MMIO 0xfffb4000 (irq = 7) is a ATMEL_SERIAL
RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize
ssc ssc.0: Atmel SSC device at 0xc4820000 (irq 14)
MACB_mii_bus: probed
eth0: Atmel MACB at 0xfffc4000 irq 21 (3e:36:65:ba:6f:be)
eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=ffffffff:00, irq=-1)
Driver 'sd' needs updating - please use bus_type methods
usbmon: debugfs is not available
at91_ohci at91_ohci: AT91 OHCI
at91_ohci at91_ohci: new USB bus registered, assigned bus number 1
at91_ohci at91_ohci: irq 20, io mem 0x00500000
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.
udc: at91_udc version 3 May 2006
mice: PS/2 mouse device common for all mice
rtc-at91sam9 at91_rtt.0: rtc core: registered at91_rtt as rtc0
rtc-at91sam9 at91_rtt.0: rtc0: SET TIME!
i2c /dev entries driver
i2c-gpio i2c-gpio: using pins 55 (SDA) and 56 (SCL)
at91sam9_wdt: invalid timeout (must be between 1 and 16)
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
rtc-at91sam9 at91_rtt.0: hctosys: unable to read the hardware clock
VFS: Cannot open root device "<NULL>" or unknown-block(0,0)
Please append a correct "root=" boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
停在这里就运行不下去了!
google下,知道是内核恐慌.原因是内核的
Linux内核命令行有6个环境变量。如果即将达到或者已经超过了的话 root= 参数会没有传进去启动时会引发panics错误。
所以去看uboot的参数传递,没有!
现在去看下u-boot
配置内核 :
RomBOOT
>
U-Boot 1.3.4 (May 18 2010 - 21:40:34)
DRAM: 64 MB
NAND: 256 MiB
In: serial
Out: serial
Err: serial
Net: macb0
macb0: Starting autonegotiation...
macb0: Autonegotiation complete
macb0: link up, 100Mbps full-duplex (lpa: 0x41e1)
Hit any key to stop autoboot: 0
U-Boot>
U-Boot>
U-Boot>
U-Boot>
U-Boot>
U-Boot>
U-Boot>
U-Boot>
U-Boot>
U-Boot>
U-Boot>
U-Boot>
U-Boot> printenv
bootdelay=3
baudrate=115200
ethact=macb0
ethaddr=3e:36:65:ba:6f:be
ipaddr=192.168.1.254
getwayip=192.168.1.1
netmask=255.255.255.0
serverip=192.168.1.5
bootfile=uImage
bootcmd=nand read 0x22000000 0x00800000 0x20000000; bootm 0x22000000
bootargs=noinitrd console=ttyS0,115200 init=/linuxrc root=/dev/mtdblock2 rootfs=cramfs men=64M
stdin=serial
stdout=serial
stderr=serial
Environment size: 373/131067 bytes
U-Boot> tftp 0x22000000 uImage
macb0: link up, 100Mbps full-duplex (lpa: 0x41e1)
Using macb0 device
TFTP from server 192.168.1.5; our IP address is 192.168.1.254
Filename 'uImage'.
Load address: 0x22000000
Loading: #################################################################
############
done
Bytes transferred = 1119716 (1115e4 hex)
U-Boot> bootm 0x22000000
## Booting kernel from Legacy Image at 22000000 ...
Image Name: Linux-2.6.24
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1119652 Bytes = 1.1 MB
Load Address: 20008000
Entry Point: 20008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
Uncompressing Linux.......................................................................... done, booting the kernel.
Linux version 2.6.24 (root@emboard) (gcc version 4.2.3 (Sourcery G++ Lite 2008q1-126)) #1 Thu May 20 22:01:58 HKT 2010
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
Machine: Atmel AT91SAM9260-EK
Memory policy: ECC disabled, Data cache writeback
Clocks: CPU 198 MHz, master 99 MHz, main 18.432 MHz
CPU0: D VIVT write-back cache
CPU0: I cache: 8192 bytes, associativity 4, 32 byte lines, 64 sets
CPU0: D cache: 8192 bytes, associativity 4, 32 byte lines, 64 sets
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: noinitrd console=ttyS0,115200 init=/linuxrc root=/dev/mtdblock2 rootfs=cramfs men=64M
AT91: 96 gpio irqs in 3 banks
PID hash table entries: 256 (order: 8, 1024 bytes)
Console: colour dummy device 80x30
console [ttyS0] 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: 62592KB available (2036K code, 195K data, 100K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 64 bytes
NET: Registered protocol family 16
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
Time: pit clocksource has been installed.
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
NetWinder Floating Point Emulator V0.97 (double precision)
yaffs May 20 2010 21:59:45 Installing.
io scheduler noop registered
io scheduler anticipatory registered (default)
Unable to handle kernel NULL pointer dereference at virtual address 00000c20
pgd = c0004000
[00000c20] *pgd=00000000
Internal error: Oops: 0 [#1]
Modules linked in:
CPU: 0 Not tainted (2.6.24 #1)
PC is at 0xc20
LR is at link_path_walk+0x8c/0x168
pc : [<00000c20>] lr : [<c008479c>] psr: 60000013
sp : c3c79d98 ip : c022d511 fp : c3c79de4
r10: c022d516 r9 : 00000000 r8 : c022d510
r7 : 00000000 r6 : c3800d08 r5 : c3c79ee0 r4 : 00000107
r3 : 00000000 r2 : c3c79db0 r1 : c3c79da4 r0 : c3c79ee0
Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: 0005317f Table: 20004000 DAC: 00000017
Process khelper (pid: 616, stack limit = 0xc3c78268)
Stack: (0xc3c79d98 to 0xc3c7a000)
9d80: 00000101 c3c78000
9da0: 00000107 01c000e1 00000004 c022d511 c3c0d7a0 c3801a18 c3c78000 c3c263c0
9dc0: c3c79ee0 c3c0d7a0 c3801798 c022d510 00000000 00000000 c3c79e5c c3c79de8
9de0: c008479c c00838a8 c3801798 c3c0d7a0 c3c79f64 c3801698 c3c1ab20 00000101
9e00: 00000001 00000000 c3c79f34 c3c79f10 00000001 c0238e10 c0239590 c0238e10
9e20: 3f2e5100 00000000 c3c79f54 00000011 00000000 c3c27b20 c3c79ecc c3c263c0
9e40: 00000001 c3c79ee0 00000001 c022d510 c3c79e6c c3c79e60 c00848a0 c0084720
9e60: c3c79e9c c3c79e70 c0084d04 c0084888 c022d510 00000001 c3c79e9c c3c79ee0
9e80: ffffff9c c022d510 00000001 c3c79f70 c3c79ebc c3c79ea0 c00857ec c0084ad0
9ea0: c3c79ee0 c022d510 c3cfe000 c3c19dfc c3c79ed4 c3c79ec0 c00858c0 c00857a8
9ec0: 00000011 00000000 c3c79f44 c3c79ed8 c007eef8 c00858ac 00000011 00000000
9ee0: c3801798 c3c0d7a0 c3c79f64 c3801698 c3c1ab20 00000105 00000001 00000000
9f00: c3c79f34 c3c79f10 00000001 c0238e10 c0239590 c0238e10 3f2e5100 00000000
9f20: c3c79f54 00000011 00000000 c3c27b20 c3c64380 c022d510 c3c79f6c c3c79f48
9f40: c008042c c007eed8 c022d510 c3c19dfc c3cfe000 c3c79f70 00000000 00000000
9f60: c3c79fd4 c3c79f70 c00254f4 c00803fc 00000000 00000000 00000000 00000000
9f80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9fa0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 c3c78000
9fc0: 00000000 c3c741e0 c3c79ff4 c3c79fd8 c0048700 c00254c4 00000000 00000000
9fe0: 00000000 00000000 00000000 c3c79ff8 c003bbc0 c0048630 ffffffff ffffffff
Backtrace:
[<c0083898>] (__link_path_walk+0x0/0xe78) from [<c008479c>] (link_path_walk+0x8c/0x168)
[<c0084710>] (link_path_walk+0x0/0x168) from [<c00848a0>] (path_walk+0x28/0x2c)
r8:c022d510 r7:00000001 r6:c3c79ee0 r5:00000001 r4:c3c263c0
[<c0084878>] (path_walk+0x0/0x2c) from [<c0084d04>] (do_path_lookup+0x244/0x274)
[<c0084ac0>] (do_path_lookup+0x0/0x274) from [<c00857ec>] (__path_lookup_intent_open+0x54/0x94)
r8:c3c79f70 r7:00000001 r6:c022d510 r5:ffffff9c r4:c3c79ee0
[<c0085798>] (__path_lookup_intent_open+0x0/0x94) from [<c00858c0>] (path_lookup_open+0x24/0x2c)
r7:c3c19dfc r6:c3cfe000 r5:c022d510 r4:c3c79ee0
[<c008589c>] (path_lookup_open+0x0/0x2c) from [<c007eef8>] (open_exec+0x30/0xc0)
[<c007eec8>] (open_exec+0x0/0xc0) from [<c008042c>] (do_execve+0x40/0x184)
r5:c022d510 r4:c3c64380
[<c00803ec>] (do_execve+0x0/0x184) from [<c00254f4>] (kernel_execve+0x40/0x8c)
r9:00000000 r8:00000000 r7:c3c79f70 r6:c3cfe000 r5:c3c19dfc
r4:c022d510
[<c00254b4>] (kernel_execve+0x0/0x8c) from [<c0048700>] (____call_usermodehelper+0xe0/0xec)
r7:c3c741e0 r6:00000000 r5:c3c78000 r4:00000000
[<c0048620>] (____call_usermodehelper+0x0/0xec) from [<c003bbc0>] (do_exit+0x0/0x710)
r7:00000000 r6:00000000 r5:00000000 r4:00000000
Code: bad PC value.
---[ end trace e314335e86712eef ]---
atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL
atmel_usart.1: ttyS1 at MMIO 0xfffb0000 (irq = 6) is a ATMEL_SERIAL
atmel_usart.2: ttyS2 at MMIO 0xfffb4000 (irq = 7) is a ATMEL_SERIAL
RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize
ssc ssc.0: Atmel SSC device at 0xc4820000 (irq 14)
MACB_mii_bus: probed
eth0: Atmel MACB at 0xfffc4000 irq 21 (3e:36:65:ba:6f:be)
eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=ffffffff:00, irq=-1)
Driver 'sd' needs updating - please use bus_type methods
usbmon: debugfs is not available
ohci_hcd: 2006 August 04 USB 1.1 'Open' Host Controller (OHCI) Driver
at91_ohci at91_ohci: AT91 OHCI
at91_ohci at91_ohci: new USB bus registered, assigned bus number 1
at91_ohci at91_ohci: irq 20, io mem 0x00500000
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.
udc: at91_udc version 3 May 2006
mice: PS/2 mouse device common for all mice
rtc-at91sam9 at91_rtt.0: rtc core: registered at91_rtt as rtc0
rtc-at91sam9 at91_rtt.0: rtc0: SET TIME!
i2c /dev entries driver
i2c-gpio i2c-gpio: using pins 55 (SDA) and 56 (SCL)
at91sam9_wdt: invalid timeout (must be between 1 and 16)
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
rtc-at91sam9 at91_rtt.0: hctosys: unable to read the hardware clock
VFS: Cannot open root device "mtdblock2" or unknown-block(0,0)
Please append a correct "root=" boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
现在内核已经起来了,现在就是要做文件系统了!
对内核进行重新配置
root@emboard:/workdir/atmel/at91sam9260/kernel/linux-2.6.24# make menuconfig
修改后重新启动板子可以看到mtd分区:
RomBOOT
>
U-Boot 1.3.4 (May 18 2010 - 21:40:34)
DRAM: 64 MB
NAND: RomBOOT
>
U-Boot 1.3.4 (May 18 2010 - 21:40:34)
DRAM: 64 MB
NAND: 256 MiB
In: serial
Out: serial
Err: serial
Net: macb0
macb0: Starting autonegotiation...
macb0: Autonegotiation complete
macb0: link up, 100Mbps full-duplex (lpa: 0x41e1)
Hit any key to stop autoboot: 0
macb0: link up, 100Mbps full-duplex (lpa: 0x41e1)
Using macb0 device
TFTP from server 192.168.1.5; our IP address is 192.168.1.254
Filename 'uImage'.
Load address: 0x22000000
Loading: #################################################################
#############################
done
Bytes transferred = 1377500 (1504dc hex)
## Booting kernel from Legacy Image at 22000000 ...
Image Name: Linux-2.6.24
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1377436 Bytes = 1.3 MB
Load Address: 20008000
Entry Point: 20008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
Uncompressing Linux.......................................................................................... done, booting the kernel.
Linux version 2.6.24 (root@emboard) (gcc version 4.2.3 (Sourcery G++ Lite 2008q1-126)) #2 Thu May 20 23:52:25 HKT 2010
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
Machine: Atmel AT91SAM9260-EK
Memory policy: ECC disabled, Data cache writeback
Clocks: CPU 198 MHz, master 99 MHz, main 18.432 MHz
CPU0: D VIVT write-back cache
CPU0: I cache: 8192 bytes, associativity 4, 32 byte lines, 64 sets
CPU0: D cache: 8192 bytes, associativity 4, 32 byte lines, 64 sets
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: menm=64M noinitrd console=ttyS0,115200 init=linuxrc root=/dev/mtdblock2 rootfstype=cramfs
AT91: 96 gpio irqs in 3 banks
PID hash table entries: 256 (order: 8, 1024 bytes)
Console: colour dummy device 80x30
console [ttyS0] 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: 61964KB available (2544K code, 245K data, 112K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 64 bytes
NET: Registered protocol family 16
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
Time: pit clocksource has been installed.
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
NetWinder Floating Point Emulator V0.97 (double precision)
Installing knfsd (copyright (C) 1996 [email protected]).
yaffs May 20 2010 23:08:52 Installing.
io scheduler noop registered
io scheduler anticipatory registered (default)
atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL
atmel_usart.1: ttyS1 at MMIO 0xfffb0000 (irq = 6) is a ATMEL_SERIAL
atmel_usart.2: ttyS2 at MMIO 0xfffb4000 (irq = 7) is a ATMEL_SERIAL
RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize
nbd: registered device at major 43
ssc ssc.0: Atmel SSC device at 0xc4820000 (irq 14)
MACB_mii_bus: probed
eth0: Atmel MACB at 0xfffc4000 irq 21 (3e:36:65:ba:6f:be)
eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=ffffffff:00, irq=-1)
Driver 'sd' needs updating - please use bus_type methods
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)
AT91 NAND: 8-bit, Software ECC
Scanning device for bad blocks
Creating 6 MTD partitions on "at91_nand":
0x00000000-0x00400000 : "Bootstrap"
0x00400000-0x00800000 : "u-boot"
0x00800000-0x01e00000 : "kernel"
0x01e00000-0x04600000 : "fs"
0x04600000-0x08200000 : "user space0"
0x08200000-0x10000000 : "user space2"
usbmon: debugfs is not available
at91_ohci at91_ohci: AT91 OHCI
at91_ohci at91_ohci: new USB bus registered, assigned bus number 1
at91_ohci at91_ohci: irq 20, io mem 0x00500000
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.
udc: at91_udc version 3 May 2006
mice: PS/2 mouse device common for all mice
rtc-at91sam9 at91_rtt.0: rtc core: registered at91_rtt as rtc0
rtc-at91sam9 at91_rtt.0: rtc0: SET TIME!
i2c /dev entries driver
i2c-gpio i2c-gpio: using pins 55 (SDA) and 56 (SCL)
at91sam9_wdt: invalid timeout (must be between 1 and 16)
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
rtc-at91sam9 at91_rtt.0: hctosys: unable to read the hardware clock
Root-NFS: No NFS server available, giving up.
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device "mtdblock2" or unknown-block(2,0)
Please append a correct "root=" boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
3.板子通过nfs挂载主机的文件:
root@emboard:/workdir/atmel/at91sam9260# apt-get install nfs-kernel-serve
root@emboard:/workdir/atmel/at91sam9260# vim /etc/exports
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes hostname1(rw,sync) hostname2(ro,sync)
#
# Example for NFSv4:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt)
# /srv/nfs4/homes gss/krb5i(rw,sync)
#
/workdir/atmel/at91sam9260/filesyetem/rootfs *(rw,sync,no_root_squash)
root@emboard:/workdir/atmel/at91sam9260# exportfs -r
root@emboard:/workdir/atmel/at91sam9260# /etc/init.d/nfs-kernel-server restart
* Stopping NFS kernel daemon
...done.
* Unexporting directories for NFS kernel daemon...
...done.
* Exporting directories for NFS kernel daemon...
exportfs: /etc/exports [2]: Neither 'subtree_check' or 'no_subtree_check' specified for export "*:/workdir/atmel/at91sam9260/filesyetem/rootfs".
Assuming default behaviour ('no_subtree_check').
NOTE: this default has changed since nfs-utils version 1.0.x
...done.
* Starting NFS kernel daemon
...done.
@emboard:/workdir/atmel/at91sam9260# mount -t nfs 192.168.1.5:/workdir/atmel/at91sam9260/filesyetem/rootfs /mnt
root@emboard:/workdir/atmel/at91sam9260# ls /mnt/
app bin boot dev driver etc home lib linuxrc mnt proc root sbin sys tmp usr var
这样可以看到成功挂载,nfs服务器配置成功
root@emboard:/workdir/atmel/at91sam9260# umount 192.168.1.5:/workdir/atmel/at91sam9260/filesyetem/rootfs
root@emboard:/workdir/atmel/at91sam9260# ls /mnt/
hgfs
成功卸载了.
================================================
安装nfs服务器端和客户端
root@emboard:/workdir/atmel/at91sam9260# apt-get install portmap nfs-kernel-server
root@emboard:/workdir/atmel/at91sam9260# apt-get install portmap nfs-common
2.配置共享文件
编辑/etc/exports,在其中增加要共享的目录
/nfs *(rw,sync,no_subtree_check)
root@emboard:/workdir/atmel/at91sam9260# exportfs -ra
3.重启服务
root@emboard:/workdir/atmel/at91sam9260# /etc/init.d/portmap restart
root@emboard:/workdir/atmel/at91sam9260# /etc/init.d/nfs-kernel-server restart
4.客户就可以加载了
root@emboard:/workdir/atmel/at91sam9260# mount 192.168.1.5:/nfs /workdir/ -o nolock
5,设置开发板的启动参数
U-Boot>setenv bootargs mem= 64M console=ttyS0 115200 root=/dev/nfs
nfsroot=192.168.1.5:/nfs/rootfs
ip=192.168.1.254:192.168.1.5:192.168.1.1:255.255.255.0::eth0:off
这样就可以看到系统通过nfs文件系统启动了.
当然要把内核关于nfs的选项选中
当开发板的系统跑起来后,可以执行这个命令来验证:
[root@microcreat /]$mount -o nolock -t nfs 192.168.1.5:/nfs/rootfs /mnt/
要加上-o nolock
内核里面关于nfs文件系统的选项选上